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

Generated by: LCOV version 1.10