LCOV - code coverage report
Current view: top level - svx/source/form - fmdmod.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 22 22 100.0 %
Date: 2015-06-13 12:38:46 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sal/macros.h>
      21             : #include <svx/fmdmod.hxx>
      22             : #include "fmservs.hxx"
      23             : #include <fmobj.hxx>
      24             : #include <svx/unoshape.hxx>
      25             : #include <comphelper/processfactory.hxx>
      26             : #include <svx/fmglob.hxx>
      27             : 
      28             : using namespace ::svxform;
      29             : 
      30             : 
      31       97850 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >  SAL_CALL SvxFmMSFactory::createInstance(const OUString& rServiceSpecifier) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception )
      32             : {
      33       97850 :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >  xRet;
      34       97850 :     if ( rServiceSpecifier.startsWith( "com.sun.star.form.component." ) )
      35             :     {
      36         317 :         css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
      37         317 :         xRet = xContext->getServiceManager()->createInstanceWithContext(rServiceSpecifier, xContext);
      38             :     }
      39       97533 :     else if ( rServiceSpecifier == "com.sun.star.drawing.ControlShape" )
      40             :     {
      41         339 :         SdrObject* pObj = new FmFormObj();
      42         339 :         xRet = static_cast<cppu::OWeakObject*>(static_cast<SvxShape_UnoImplHelper*>(new SvxShapeControl(pObj)));
      43             :     }
      44       97850 :     if (!xRet.is())
      45       97194 :         xRet = SvxUnoDrawMSFactory::createInstance(rServiceSpecifier);
      46       96140 :     return xRet;
      47             : }
      48             : 
      49             : 
      50             : 
      51             : // Encapsulation violation: We *know* that
      52             : // SvxUnoDrawMSFactory::createInstanceWithArguments() always throws.
      53             : 
      54             : SAL_WNOUNREACHABLE_CODE_PUSH
      55             : 
      56          50 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL  SvxFmMSFactory::createInstanceWithArguments(const OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception )
      57             : {
      58          50 :     return SvxUnoDrawMSFactory::createInstanceWithArguments(ServiceSpecifier, Arguments );
      59             : }
      60             : 
      61             : SAL_WNOUNREACHABLE_CODE_POP
      62             : 
      63             : 
      64         389 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL SvxFmMSFactory::getAvailableServiceNames() throw( ::com::sun::star::uno::RuntimeException, std::exception )
      65             : {
      66             :     static const OUString aSvxComponentServiceNameList[] =
      67             :     {
      68             :         OUString(FM_SUN_COMPONENT_TEXTFIELD),
      69             :         OUString(FM_SUN_COMPONENT_FORM),
      70             :         OUString(FM_SUN_COMPONENT_LISTBOX),
      71             :         OUString(FM_SUN_COMPONENT_COMBOBOX),
      72             :         OUString(FM_SUN_COMPONENT_RADIOBUTTON),
      73             :         OUString(FM_SUN_COMPONENT_GROUPBOX),
      74             :         OUString(FM_SUN_COMPONENT_FIXEDTEXT),
      75             :         OUString(FM_SUN_COMPONENT_COMMANDBUTTON),
      76             :         OUString(FM_SUN_COMPONENT_CHECKBOX),
      77             :         OUString(FM_SUN_COMPONENT_GRIDCONTROL),
      78             :         OUString(FM_SUN_COMPONENT_IMAGEBUTTON),
      79             :         OUString(FM_SUN_COMPONENT_FILECONTROL),
      80             :         OUString(FM_SUN_COMPONENT_TIMEFIELD),
      81             :         OUString(FM_SUN_COMPONENT_DATEFIELD),
      82             :         OUString(FM_SUN_COMPONENT_NUMERICFIELD),
      83             :         OUString(FM_SUN_COMPONENT_CURRENCYFIELD),
      84             :         OUString(FM_SUN_COMPONENT_PATTERNFIELD),
      85             :         OUString(FM_SUN_COMPONENT_HIDDENCONTROL),
      86             :         OUString(FM_SUN_COMPONENT_IMAGECONTROL)
      87         423 :     };
      88             : 
      89             :     static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] );
      90             : 
      91         389 :     ::com::sun::star::uno::Sequence< OUString > aSeq( nSvxComponentServiceNameListCount );
      92         389 :     OUString* pStrings = aSeq.getArray();
      93        7780 :     for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ )
      94        7391 :         pStrings[nIdx] = aSvxComponentServiceNameList[nIdx];
      95             : 
      96         778 :     ::com::sun::star::uno::Sequence< OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
      97         778 :     return concatServiceNames( aParentSeq, aSeq );
      98         435 : }
      99             : 
     100             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11