LCOV - code coverage report
Current view: top level - sd/source/ui/unoidl - unomodule.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 61 3.3 %
Date: 2012-08-25 Functions: 1 12 8.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 90 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      30                 :            : #include <com/sun/star/frame/DispatchResultState.hpp>
      31                 :            : 
      32                 :            : #include "sddll.hxx"
      33                 :            : #include "sdmod.hxx"
      34                 :            : #include "unomodule.hxx"
      35                 :            : #include <sfx2/objface.hxx>
      36                 :            : #include <sfx2/bindings.hxx>
      37                 :            : #include <sfx2/request.hxx>
      38                 :            : #include <osl/mutex.hxx>
      39                 :            : #include <vcl/svapp.hxx>
      40                 :            : 
      41                 :            : using namespace ::com::sun::star;
      42                 :            : 
      43                 :         22 : ::rtl::OUString SAL_CALL SdUnoModule_getImplementationName() throw( uno::RuntimeException )
      44                 :            : {
      45                 :         22 :     return rtl::OUString( "com.sun.star.comp.Draw.DrawingModule" );
      46                 :            : }
      47                 :            : 
      48                 :          0 : uno::Sequence< rtl::OUString > SAL_CALL SdUnoModule_getSupportedServiceNames() throw( uno::RuntimeException )
      49                 :            : {
      50                 :          0 :     uno::Sequence< rtl::OUString > aSeq( 1 );
      51         [ #  # ]:          0 :     aSeq[0] = "com.sun.star.drawing.ModuleDispatcher";
      52                 :          0 :     return aSeq;
      53                 :            : }
      54                 :            : 
      55                 :          0 : uno::Reference< uno::XInterface > SAL_CALL SdUnoModule_createInstance(
      56                 :            :                 const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
      57                 :            : {
      58         [ #  # ]:          0 :     SolarMutexGuard aGuard;
      59 [ #  # ][ #  # ]:          0 :     return uno::Reference< uno::XInterface >( static_cast< cppu::OWeakObject* >( new SdUnoModule( rSMgr ) ) );
                 [ #  # ]
      60                 :            : }
      61                 :            : 
      62                 :            :     // XNotifyingDispatch
      63                 :          0 : void SAL_CALL SdUnoModule::dispatchWithNotification( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
      64                 :            : {
      65                 :            :     // there is no guarantee, that we are holded alive during this method!
      66                 :            :     // May the outside dispatch container will be updated by a CONTEXT_CHANGED
      67                 :            :     // asynchronous ...
      68         [ #  # ]:          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xThis(static_cast< ::com::sun::star::frame::XNotifyingDispatch* >(this));
      69                 :            : 
      70         [ #  # ]:          0 :     SolarMutexGuard aGuard;
      71         [ #  # ]:          0 :     SdDLL::Init();
      72 [ #  # ][ #  # ]:          0 :     const SfxSlot* pSlot = SD_MOD()->GetInterface()->GetSlot( aURL.Complete );
         [ #  # ][ #  # ]
                 [ #  # ]
      73                 :            : 
      74                 :          0 :     sal_Int16 aState = ::com::sun::star::frame::DispatchResultState::DONTKNOW;
      75         [ #  # ]:          0 :     if ( !pSlot )
      76                 :          0 :         aState = ::com::sun::star::frame::DispatchResultState::FAILURE;
      77                 :            :     else
      78                 :            :     {
      79 [ #  # ][ #  # ]:          0 :         SfxRequest aReq( pSlot, aArgs, SFX_CALLMODE_SYNCHRON, SD_MOD()->GetPool() );
      80 [ #  # ][ #  # ]:          0 :         const SfxPoolItem* pResult = SD_MOD()->ExecuteSlot( aReq );
      81         [ #  # ]:          0 :         if ( pResult )
      82                 :          0 :             aState = ::com::sun::star::frame::DispatchResultState::SUCCESS;
      83                 :            :         else
      84         [ #  # ]:          0 :             aState = ::com::sun::star::frame::DispatchResultState::FAILURE;
      85                 :            :     }
      86                 :            : 
      87         [ #  # ]:          0 :     if ( xListener.is() )
      88                 :            :     {
      89         [ #  # ]:          0 :         xListener->dispatchFinished(
      90                 :            :             ::com::sun::star::frame::DispatchResultEvent(
      91 [ #  # ][ #  # ]:          0 :                     xThis, aState, ::com::sun::star::uno::Any()));
                 [ #  # ]
      92         [ #  # ]:          0 :     }
      93                 :          0 : }
      94                 :            :     // XDispatch
      95                 :          0 : void SAL_CALL SdUnoModule::dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw( ::com::sun::star::uno::RuntimeException )
      96                 :            : {
      97         [ #  # ]:          0 :     dispatchWithNotification(aURL, aArgs, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >());
      98                 :          0 : }
      99                 :            : 
     100                 :          0 : void SAL_CALL SdUnoModule::addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > &, const ::com::sun::star::util::URL&) throw( ::com::sun::star::uno::RuntimeException )
     101                 :            : {
     102                 :          0 : }
     103                 :            : 
     104                 :          0 : void SAL_CALL SdUnoModule::removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > &, const ::com::sun::star::util::URL&) throw( ::com::sun::star::uno::RuntimeException )
     105                 :            : {
     106                 :          0 : }
     107                 :            : 
     108                 :          0 : SEQUENCE< REFERENCE< XDISPATCH > > SAL_CALL SdUnoModule::queryDispatches( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescripts ) throw( ::com::sun::star::uno::RuntimeException )
     109                 :            : {
     110                 :          0 :     sal_Int32 nCount = seqDescripts.getLength();
     111                 :          0 :     SEQUENCE< REFERENCE< XDISPATCH > > lDispatcher( nCount );
     112                 :            : 
     113         [ #  # ]:          0 :     for( sal_Int32 i=0; i<nCount; ++i )
     114                 :            :     {
     115         [ #  # ]:          0 :         lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL  ,
     116                 :          0 :                                         seqDescripts[i].FrameName   ,
     117 [ #  # ][ #  # ]:          0 :                                         seqDescripts[i].SearchFlags );
     118                 :            :     }
     119                 :            : 
     120                 :          0 :     return lDispatcher;
     121                 :            : }
     122                 :            : 
     123                 :            : // XDispatchProvider
     124                 :          0 : REFERENCE< XDISPATCH > SAL_CALL SdUnoModule::queryDispatch( const UNOURL& aURL, const rtl::OUString&, sal_Int32 ) throw( RUNTIMEEXCEPTION )
     125                 :            : {
     126         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     127         [ #  # ]:          0 :     SdDLL::Init();
     128 [ #  # ][ #  # ]:          0 :     const SfxSlot* pSlot = SD_MOD()->GetInterface()->GetSlot( aURL.Complete );
         [ #  # ][ #  # ]
                 [ #  # ]
     129                 :            : 
     130                 :          0 :     REFERENCE< XDISPATCH > xSlot;
     131         [ #  # ]:          0 :     if ( pSlot )
     132         [ #  # ]:          0 :         xSlot = this;
     133                 :            : 
     134         [ #  # ]:          0 :     return xSlot;
     135                 :            : }
     136                 :            : 
     137                 :            : // XServiceInfo
     138                 :          0 : ::rtl::OUString SAL_CALL SdUnoModule::getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException)
     139                 :            : {
     140                 :          0 :     return SdUnoModule_getImplementationName();
     141                 :            : }
     142                 :            : 
     143                 :          0 : sal_Bool SAL_CALL SdUnoModule::supportsService( const ::rtl::OUString& sServiceName ) throw(::com::sun::star::uno::RuntimeException)
     144                 :            : {
     145         [ #  # ]:          0 :     UNOSEQUENCE< rtl::OUString > seqServiceNames = getSupportedServiceNames();
     146                 :          0 :     const rtl::OUString*         pArray          = seqServiceNames.getConstArray();
     147         [ #  # ]:          0 :     for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ )
     148                 :            :     {
     149         [ #  # ]:          0 :         if ( pArray[nCounter] == sServiceName )
     150                 :            :         {
     151                 :          0 :             return sal_True ;
     152                 :            :         }
     153                 :            :     }
     154         [ #  # ]:          0 :     return sal_False ;
     155                 :            : }
     156                 :            : 
     157                 :          0 : ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SdUnoModule::getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException)
     158                 :            : {
     159                 :          0 :     return SdUnoModule_getSupportedServiceNames();
     160                 :            : }
     161                 :            : 
     162                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10