LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/unoidl - unomodule.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 62 4.8 %
Date: 2013-07-09 Functions: 3 14 21.4 %
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 <com/sun/star/lang/XMultiServiceFactory.hpp>
      21             : #include <com/sun/star/frame/DispatchResultState.hpp>
      22             : 
      23             : #include "sddll.hxx"
      24             : #include "sdmod.hxx"
      25             : #include "unomodule.hxx"
      26             : #include <sfx2/objface.hxx>
      27             : #include <sfx2/bindings.hxx>
      28             : #include <sfx2/request.hxx>
      29             : #include <osl/mutex.hxx>
      30             : #include <vcl/svapp.hxx>
      31             : 
      32             : using namespace ::com::sun::star;
      33             : 
      34          10 : OUString SAL_CALL SdUnoModule_getImplementationName() throw( uno::RuntimeException )
      35             : {
      36          10 :     return OUString( "com.sun.star.comp.Draw.DrawingModule" );
      37             : }
      38             : 
      39           0 : uno::Sequence< OUString > SAL_CALL SdUnoModule_getSupportedServiceNames() throw( uno::RuntimeException )
      40             : {
      41           0 :     uno::Sequence< OUString > aSeq( 1 );
      42           0 :     aSeq[0] = "com.sun.star.drawing.ModuleDispatcher";
      43           0 :     return aSeq;
      44             : }
      45             : 
      46           0 : uno::Reference< uno::XInterface > SAL_CALL SdUnoModule_createInstance(
      47             :                 const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
      48             : {
      49           0 :     SolarMutexGuard aGuard;
      50           0 :     return uno::Reference< uno::XInterface >( static_cast< cppu::OWeakObject* >( new SdUnoModule( rSMgr ) ) );
      51             : }
      52             : 
      53             :     // XNotifyingDispatch
      54           0 : void SAL_CALL SdUnoModule::dispatchWithNotification( const util::URL& aURL, const uno::Sequence< beans::PropertyValue >& aArgs, const uno::Reference< frame::XDispatchResultListener >& xListener ) throw (uno::RuntimeException)
      55             : {
      56             :     // there is no guarantee, that we are holded alive during this method!
      57             :     // May the outside dispatch container will be updated by a CONTEXT_CHANGED
      58             :     // asynchronous ...
      59           0 :     uno::Reference< uno::XInterface > xThis(static_cast< frame::XNotifyingDispatch* >(this));
      60             : 
      61           0 :     SolarMutexGuard aGuard;
      62           0 :     SdDLL::Init();
      63           0 :     const SfxSlot* pSlot = SD_MOD()->GetInterface()->GetSlot( aURL.Complete );
      64             : 
      65           0 :     sal_Int16 aState = frame::DispatchResultState::DONTKNOW;
      66           0 :     if ( !pSlot )
      67           0 :         aState = frame::DispatchResultState::FAILURE;
      68             :     else
      69             :     {
      70           0 :         SfxRequest aReq( pSlot, aArgs, SFX_CALLMODE_SYNCHRON, SD_MOD()->GetPool() );
      71           0 :         const SfxPoolItem* pResult = SD_MOD()->ExecuteSlot( aReq );
      72           0 :         if ( pResult )
      73           0 :             aState = frame::DispatchResultState::SUCCESS;
      74             :         else
      75           0 :             aState = frame::DispatchResultState::FAILURE;
      76             :     }
      77             : 
      78           0 :     if ( xListener.is() )
      79             :     {
      80           0 :         xListener->dispatchFinished(
      81             :             frame::DispatchResultEvent(
      82           0 :                     xThis, aState, uno::Any()));
      83           0 :     }
      84           0 : }
      85             :     // XDispatch
      86           0 : void SAL_CALL SdUnoModule::dispatch( const util::URL& aURL, const uno::Sequence< beans::PropertyValue >& aArgs ) throw( uno::RuntimeException )
      87             : {
      88           0 :     dispatchWithNotification(aURL, aArgs, uno::Reference< frame::XDispatchResultListener >());
      89           0 : }
      90             : 
      91           0 : void SAL_CALL SdUnoModule::addStatusListener(const uno::Reference< frame::XStatusListener > &, const util::URL&) throw( uno::RuntimeException )
      92             : {
      93           0 : }
      94             : 
      95           0 : void SAL_CALL SdUnoModule::removeStatusListener(const uno::Reference< frame::XStatusListener > &, const util::URL&) throw( uno::RuntimeException )
      96             : {
      97           0 : }
      98             : 
      99           0 : uno::Sequence< uno::Reference< frame::XDispatch > > SAL_CALL SdUnoModule::queryDispatches( const uno::Sequence< frame::DispatchDescriptor >& seqDescripts ) throw( uno::RuntimeException )
     100             : {
     101           0 :     sal_Int32 nCount = seqDescripts.getLength();
     102           0 :     uno::Sequence< uno::Reference< frame::XDispatch > > lDispatcher( nCount );
     103             : 
     104           0 :     for( sal_Int32 i=0; i<nCount; ++i )
     105             :     {
     106           0 :         lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL  ,
     107           0 :                                         seqDescripts[i].FrameName   ,
     108           0 :                                         seqDescripts[i].SearchFlags );
     109             :     }
     110             : 
     111           0 :     return lDispatcher;
     112             : }
     113             : 
     114             : // XDispatchProvider
     115           0 : uno::Reference< frame::XDispatch > SAL_CALL SdUnoModule::queryDispatch( const util::URL& aURL, const OUString&, sal_Int32 ) throw( uno::RuntimeException )
     116             : {
     117           0 :     SolarMutexGuard aGuard;
     118           0 :     SdDLL::Init();
     119           0 :     const SfxSlot* pSlot = SD_MOD()->GetInterface()->GetSlot( aURL.Complete );
     120             : 
     121           0 :     uno::Reference< frame::XDispatch > xSlot;
     122           0 :     if ( pSlot )
     123           0 :         xSlot = this;
     124             : 
     125           0 :     return xSlot;
     126             : }
     127             : 
     128             : // XServiceInfo
     129           0 : OUString SAL_CALL SdUnoModule::getImplementationName(  ) throw(uno::RuntimeException)
     130             : {
     131           0 :     return SdUnoModule_getImplementationName();
     132             : }
     133             : 
     134           0 : sal_Bool SAL_CALL SdUnoModule::supportsService( const OUString& sServiceName ) throw(uno::RuntimeException)
     135             : {
     136           0 :     uno::Sequence< OUString > seqServiceNames = getSupportedServiceNames();
     137           0 :     const OUString*           pArray          = seqServiceNames.getConstArray();
     138           0 :     for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ )
     139             :     {
     140           0 :         if ( pArray[nCounter] == sServiceName )
     141             :         {
     142           0 :             return sal_True ;
     143             :         }
     144             :     }
     145           0 :     return sal_False ;
     146             : }
     147             : 
     148           0 : uno::Sequence< OUString > SAL_CALL SdUnoModule::getSupportedServiceNames(  ) throw(uno::RuntimeException)
     149             : {
     150           0 :     return SdUnoModule_getSupportedServiceNames();
     151          33 : }
     152             : 
     153             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10