LCOV - code coverage report
Current view: top level - svtools/source/uno - toolboxcontroller.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 237 381 62.2 %
Date: 2012-08-25 Functions: 29 47 61.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 259 756 34.3 %

           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 <svtools/toolboxcontroller.hxx>
      30                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      31                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      32                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      33                 :            : #include <com/sun/star/frame/XDispatchProvider.hpp>
      34                 :            : #include <com/sun/star/lang/DisposedException.hpp>
      35                 :            : #include <com/sun/star/frame/XLayoutManager.hpp>
      36                 :            : #include <com/sun/star/util/URLTransformer.hpp>
      37                 :            : #include <osl/mutex.hxx>
      38                 :            : #include <vcl/svapp.hxx>
      39                 :            : #include <svtools/imgdef.hxx>
      40                 :            : #include <svtools/miscopt.hxx>
      41                 :            : #include <toolkit/unohlp.hxx>
      42                 :            : #include <vcl/toolbox.hxx>
      43                 :            : #include <comphelper/componentcontext.hxx>
      44                 :            : 
      45                 :            : const int TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIBLE  = 1;
      46                 :            : const char TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIBLE[] = "SupportsVisible";
      47                 :            : 
      48                 :            : using ::rtl::OUString;
      49                 :            : 
      50                 :            : using namespace ::cppu;
      51                 :            : using namespace ::com::sun::star::awt;
      52                 :            : using namespace ::com::sun::star::uno;
      53                 :            : using namespace ::com::sun::star::util;
      54                 :            : using namespace ::com::sun::star::beans;
      55                 :            : using namespace ::com::sun::star::lang;
      56                 :            : using namespace ::com::sun::star::frame;
      57                 :            : using namespace ::com::sun::star::frame;
      58                 :            : 
      59                 :            : namespace svt
      60                 :            : {
      61                 :            : 
      62         [ #  # ]:          0 : struct DispatchInfo
      63                 :            : {
      64                 :            :     Reference< XDispatch > mxDispatch;
      65                 :            :     const URL maURL;
      66                 :            :     const Sequence< PropertyValue > maArgs;
      67                 :            : 
      68                 :          0 :     DispatchInfo( const Reference< XDispatch >& xDispatch, const URL& rURL, const Sequence< PropertyValue >& rArgs )
      69         [ #  # ]:          0 :         : mxDispatch( xDispatch ), maURL( rURL ), maArgs( rArgs ) {}
      70                 :            : };
      71                 :            : 
      72                 :      70851 : struct ToolboxController_Impl
      73                 :            : {
      74                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >          m_xParentWindow;
      75                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xUrlTransformer;
      76                 :            :     rtl::OUString m_sModuleName;
      77                 :            :      sal_uInt16 m_nToolBoxId;
      78                 :            : 
      79                 :            :     DECL_STATIC_LINK( ToolboxController_Impl, ExecuteHdl_Impl, DispatchInfo* );
      80                 :            : 
      81                 :      70851 :     ToolboxController_Impl()
      82                 :      70851 :         : m_nToolBoxId( SAL_MAX_UINT16 )
      83                 :      70851 :     {}
      84                 :            : };
      85                 :            : 
      86                 :      52583 : ToolboxController::ToolboxController(
      87                 :            : 
      88                 :            :     const Reference< XMultiServiceFactory >& rServiceManager,
      89                 :            :     const Reference< XFrame >& xFrame,
      90                 :            :     const ::rtl::OUString& aCommandURL ) :
      91                 :      52583 :     OPropertyContainer(GetBroadcastHelper())
      92                 :            :     ,   OWeakObject()
      93                 :            :     ,   m_bSupportVisible(sal_False)
      94                 :            :     ,   m_bInitialized( sal_False )
      95                 :            :     ,   m_bDisposed( sal_False )
      96                 :            :     ,   m_xFrame(xFrame)
      97                 :            :     ,   m_xServiceManager( rServiceManager )
      98                 :            :     ,   m_aCommandURL( aCommandURL )
      99   [ +  -  +  - ]:     105166 :     ,   m_aListenerContainer( m_aMutex )
         [ +  - ][ +  - ]
                 [ +  - ]
     100                 :            : {
     101                 :            :     registerProperty(rtl::OUString(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIBLE), TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIBLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY,
     102 [ +  - ][ +  - ]:      52583 :         &m_bSupportVisible, getCppuType(&m_bSupportVisible));
     103                 :            : 
     104 [ +  - ][ +  - ]:      52583 :     m_pImpl = new ToolboxController_Impl;
     105                 :            : 
     106                 :            :     try
     107                 :            :     {
     108                 :            :         m_pImpl->m_xUrlTransformer.set(
     109                 :            :             ::com::sun::star::util::URLTransformer::create(
     110 [ +  - ][ +  - ]:      52583 :                 ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) );
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
     111                 :            :     }
     112         [ #  # ]:          0 :     catch(const Exception&)
     113                 :            :     {
     114                 :            :     }
     115                 :      52583 : }
     116                 :            : 
     117                 :      18268 : ToolboxController::ToolboxController() :
     118                 :      18268 :     OPropertyContainer(GetBroadcastHelper())
     119                 :            :     ,   OWeakObject()
     120                 :            :     ,   m_bSupportVisible(sal_False)
     121                 :            :     ,   m_bInitialized( sal_False )
     122                 :            :     ,   m_bDisposed( sal_False )
     123   [ +  -  +  - ]:      36536 :     ,   m_aListenerContainer( m_aMutex )
         [ +  - ][ +  - ]
                 [ +  - ]
     124                 :            : {
     125                 :            :     registerProperty(rtl::OUString(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIBLE), TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIBLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY,
     126 [ +  - ][ +  - ]:      18268 :         &m_bSupportVisible, getCppuType(&m_bSupportVisible));
     127                 :            : 
     128 [ +  - ][ +  - ]:      18268 :     m_pImpl = new ToolboxController_Impl;
     129                 :      18268 : }
     130                 :            : 
     131 [ +  - ][ +  - ]:      70851 : ToolboxController::~ToolboxController()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     132                 :            : {
     133 [ +  - ][ +  - ]:      70851 :     delete m_pImpl;
     134         [ -  + ]:      70851 : }
     135                 :            : 
     136                 :      83802 : Reference< XFrame > ToolboxController::getFrameInterface() const
     137                 :            : {
     138         [ +  - ]:      83802 :     SolarMutexGuard aSolarMutexGuard;
     139         [ +  - ]:      83802 :     return m_xFrame;
     140                 :            : }
     141                 :            : 
     142                 :          0 : Reference< XMultiServiceFactory > ToolboxController::getServiceManager() const
     143                 :            : {
     144         [ #  # ]:          0 :     SolarMutexGuard aSolarMutexGuard;
     145         [ #  # ]:          0 :     return m_xServiceManager;
     146                 :            : }
     147                 :            : 
     148                 :       1438 : Reference< XLayoutManager > ToolboxController::getLayoutManager() const
     149                 :            : {
     150                 :       1438 :     Reference< XLayoutManager > xLayoutManager;
     151                 :       1438 :     Reference< XPropertySet > xPropSet;
     152                 :            :     {
     153         [ +  - ]:       1438 :         SolarMutexGuard aSolarMutexGuard;
     154 [ +  - ][ +  - ]:       1438 :         xPropSet = Reference< XPropertySet >( m_xFrame, UNO_QUERY );
                 [ +  - ]
     155                 :            :     }
     156                 :            : 
     157         [ +  - ]:       1438 :     if ( xPropSet.is() )
     158                 :            :     {
     159                 :            :         try
     160                 :            :         {
     161 [ +  - ][ +  - ]:       1438 :             xLayoutManager.set(xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))),UNO_QUERY);
         [ +  - ][ +  - ]
                 [ #  # ]
     162                 :            :         }
     163         [ #  # ]:          0 :         catch ( Exception& )
     164                 :            :         {
     165                 :            :         }
     166                 :            :     }
     167                 :            : 
     168                 :       1438 :     return xLayoutManager;
     169                 :            : }
     170                 :            : 
     171                 :            : // XInterface
     172                 :     665681 : Any SAL_CALL ToolboxController::queryInterface( const Type& rType )
     173                 :            : throw ( RuntimeException )
     174                 :            : {
     175                 :            :     Any a = ::cppu::queryInterface(
     176                 :            :                 rType ,
     177                 :            :                 static_cast< XToolbarController* >( this ),
     178                 :            :                 static_cast< XStatusListener* >( this ),
     179                 :            :                 static_cast< XEventListener* >( this ),
     180                 :            :                 static_cast< XInitialization* >( this ),
     181                 :            :                 static_cast< XComponent* >( this ),
     182         [ +  - ]:     665681 :                 static_cast< XUpdatable* >( this ));
     183         [ +  + ]:     665681 :     if ( !a.hasValue())
     184                 :            :     {
     185                 :            :         a = ::cppu::queryInterface(rType
     186                 :            :             ,static_cast<XPropertySet*>(this)
     187                 :            :             ,static_cast<XMultiPropertySet*>(this)
     188         [ +  - ]:     125108 :             ,static_cast<XFastPropertySet*>(this));
     189         [ +  + ]:     125108 :         if (!a.hasValue())
     190         [ +  - ]:      54461 :             return OWeakObject::queryInterface( rType );
     191                 :            :     }
     192                 :     665681 :     return a;
     193                 :            : }
     194                 :            : 
     195                 :    1382026 : void SAL_CALL ToolboxController::acquire() throw ()
     196                 :            : {
     197                 :    1382026 :     OWeakObject::acquire();
     198                 :    1382026 : }
     199                 :            : 
     200                 :    1382026 : void SAL_CALL ToolboxController::release() throw ()
     201                 :            : {
     202                 :    1382026 :     OWeakObject::release();
     203                 :    1382026 : }
     204                 :            : 
     205                 :      70851 : void SAL_CALL ToolboxController::initialize( const Sequence< Any >& aArguments )
     206                 :            : throw ( Exception, RuntimeException )
     207                 :            : {
     208                 :      70851 :     bool bInitialized( true );
     209                 :            : 
     210                 :            :     {
     211         [ +  - ]:      70851 :         SolarMutexGuard aSolarMutexGuard;
     212                 :            : 
     213         [ -  + ]:      70851 :         if ( m_bDisposed )
     214         [ #  # ]:          0 :             throw DisposedException();
     215                 :            : 
     216         [ +  - ]:      70851 :         bInitialized = m_bInitialized;
     217                 :            :     }
     218                 :            : 
     219         [ +  - ]:      70851 :     if ( !bInitialized )
     220                 :            :     {
     221         [ +  - ]:      70851 :         SolarMutexGuard aSolarMutexGuard;
     222                 :      70851 :         m_bInitialized = sal_True;
     223                 :            :         //shizhoubo add
     224                 :      70851 :         m_bSupportVisible = sal_False;
     225                 :      70851 :         PropertyValue aPropValue;
     226         [ +  + ]:     425106 :         for ( int i = 0; i < aArguments.getLength(); i++ )
     227                 :            :         {
     228 [ +  - ][ +  - ]:     354255 :             if ( aArguments[i] >>= aPropValue )
     229                 :            :             {
     230         [ +  + ]:     354255 :                 if ( aPropValue.Name == "Frame" )
     231         [ +  - ]:      70851 :                     m_xFrame.set(aPropValue.Value,UNO_QUERY);
     232         [ +  + ]:     283404 :                 else if ( aPropValue.Name == "CommandURL" )
     233                 :      70851 :                     aPropValue.Value >>= m_aCommandURL;
     234         [ +  + ]:     212553 :                 else if ( aPropValue.Name == "ServiceManager" )
     235         [ +  - ]:      70851 :                     m_xServiceManager.set(aPropValue.Value,UNO_QUERY);
     236         [ +  + ]:     141702 :                 else if ( aPropValue.Name == "ParentWindow" )
     237         [ +  - ]:      70851 :                     m_pImpl->m_xParentWindow.set(aPropValue.Value,UNO_QUERY);
     238         [ +  - ]:      70851 :                 else if ( aPropValue.Name == "ModuleName" )
     239                 :      70851 :                     aPropValue.Value >>= m_pImpl->m_sModuleName;
     240                 :            :             }
     241                 :            :         }
     242                 :            : 
     243                 :            :         try
     244                 :            :         {
     245 [ +  + ][ +  - ]:      70851 :             if ( !m_pImpl->m_xUrlTransformer.is() && m_xServiceManager.is() )
                 [ +  + ]
     246                 :            :                 m_pImpl->m_xUrlTransformer.set(
     247                 :            :                     ::com::sun::star::util::URLTransformer::create(
     248 [ +  - ][ +  - ]:      18268 :                         ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) );
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
     249                 :            :         }
     250         [ #  # ]:          0 :         catch(const Exception&)
     251                 :            :         {
     252                 :            :         }
     253                 :            : 
     254         [ +  - ]:      70851 :         if ( !m_aCommandURL.isEmpty() )
     255 [ +  - ][ +  - ]:      70851 :             m_aListenerMap.insert( URLToDispatchMap::value_type( m_aCommandURL, Reference< XDispatch >() ));
         [ +  - ][ +  - ]
     256                 :            :     }
     257                 :      70851 : }
     258                 :            : 
     259                 :      68589 : void SAL_CALL ToolboxController::update()
     260                 :            : throw ( RuntimeException )
     261                 :            : {
     262                 :            :     {
     263         [ +  - ]:      68589 :         SolarMutexGuard aSolarMutexGuard;
     264         [ -  + ]:      68589 :         if ( m_bDisposed )
     265 [ #  # ][ +  - ]:      68589 :             throw DisposedException();
     266                 :            :     }
     267                 :            : 
     268                 :            :     // Bind all registered listeners to their dispatch objects
     269                 :      68589 :     bindListener();
     270                 :      68589 : }
     271                 :            : 
     272                 :            : // XComponent
     273                 :      70647 : void SAL_CALL ToolboxController::dispose()
     274                 :            : throw (::com::sun::star::uno::RuntimeException)
     275                 :            : {
     276         [ +  - ]:      70647 :     Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
     277                 :            : 
     278                 :            :     {
     279         [ +  - ]:      70647 :         SolarMutexGuard aSolarMutexGuard;
     280         [ -  + ]:      70647 :         if ( m_bDisposed )
     281 [ #  # ][ +  - ]:      70647 :             throw DisposedException();
     282                 :            :     }
     283                 :            : 
     284         [ +  - ]:      70647 :     com::sun::star::lang::EventObject aEvent( xThis );
     285         [ +  - ]:      70647 :     m_aListenerContainer.disposeAndClear( aEvent );
     286                 :            : 
     287         [ +  - ]:      70647 :     SolarMutexGuard aSolarMutexGuard;
     288         [ +  - ]:      70647 :     Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
     289         [ +  - ]:      70647 :     URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
     290 [ +  - ][ +  + ]:     150056 :     while ( pIter != m_aListenerMap.end() )
     291                 :            :     {
     292                 :            :         try
     293                 :            :         {
     294         [ +  - ]:      79409 :             Reference< XDispatch > xDispatch( pIter->second );
     295                 :            : 
     296                 :      79409 :             com::sun::star::util::URL aTargetURL;
     297         [ +  - ]:      79409 :             aTargetURL.Complete = pIter->first;
     298         [ +  - ]:      79409 :             if ( m_pImpl->m_xUrlTransformer.is() )
     299 [ +  - ][ +  - ]:      79409 :                 m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
     300                 :            : 
     301 [ +  + ][ +  - ]:      79409 :             if ( xDispatch.is() && xStatusListener.is() )
                 [ +  + ]
     302 [ +  - ][ +  - ]:      79409 :                 xDispatch->removeStatusListener( xStatusListener, aTargetURL );
                 [ #  # ]
     303                 :            :         }
     304         [ #  # ]:          0 :         catch ( Exception& )
     305                 :            :         {
     306                 :            :         }
     307                 :            : 
     308                 :      79409 :         ++pIter;
     309                 :            :     }
     310                 :            : 
     311 [ +  - ][ +  - ]:      70647 :     m_bDisposed = sal_True;
     312                 :      70647 : }
     313                 :            : 
     314                 :          0 : void SAL_CALL ToolboxController::addEventListener( const Reference< XEventListener >& xListener )
     315                 :            : throw ( RuntimeException )
     316                 :            : {
     317                 :          0 :     m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
     318                 :          0 : }
     319                 :            : 
     320                 :          0 : void SAL_CALL ToolboxController::removeEventListener( const Reference< XEventListener >& aListener )
     321                 :            : throw ( RuntimeException )
     322                 :            : {
     323                 :          0 :     m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), aListener );
     324                 :          0 : }
     325                 :            : 
     326                 :            : // XEventListener
     327                 :          0 : void SAL_CALL ToolboxController::disposing( const EventObject& Source )
     328                 :            : throw ( RuntimeException )
     329                 :            : {
     330                 :          0 :     Reference< XInterface > xSource( Source.Source );
     331                 :            : 
     332         [ #  # ]:          0 :     SolarMutexGuard aSolarMutexGuard;
     333                 :            : 
     334         [ #  # ]:          0 :     if ( m_bDisposed )
     335                 :          0 :         return;
     336                 :            : 
     337         [ #  # ]:          0 :     URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
     338 [ #  # ][ #  # ]:          0 :     while ( pIter != m_aListenerMap.end() )
     339                 :            :     {
     340                 :            :         // Compare references and release dispatch references if they are equal.
     341 [ #  # ][ #  # ]:          0 :         Reference< XInterface > xIfac( pIter->second, UNO_QUERY );
     342 [ #  # ][ #  # ]:          0 :         if ( xSource == xIfac )
     343         [ #  # ]:          0 :             pIter->second.clear();
     344                 :          0 :         ++pIter;
     345                 :          0 :     }
     346                 :            : 
     347         [ #  # ]:          0 :     Reference< XInterface > xIfac( m_xFrame, UNO_QUERY );
     348 [ #  # ][ #  # ]:          0 :     if ( xIfac == xSource )
     349 [ #  # ][ #  # ]:          0 :         m_xFrame.clear();
                 [ #  # ]
     350                 :            : }
     351                 :            : 
     352                 :            : // XStatusListener
     353                 :         44 : void SAL_CALL ToolboxController::statusChanged( const FeatureStateEvent& )
     354                 :            : throw ( RuntimeException )
     355                 :            : {
     356                 :            :     // must be implemented by sub class
     357                 :         44 : }
     358                 :            : 
     359                 :            : // XToolbarController
     360                 :          0 : void SAL_CALL ToolboxController::execute( sal_Int16 KeyModifier )
     361                 :            : throw (::com::sun::star::uno::RuntimeException)
     362                 :            : {
     363                 :          0 :     Reference< XDispatch >       xDispatch;
     364                 :          0 :     ::rtl::OUString                     aCommandURL;
     365                 :            : 
     366                 :            :     {
     367         [ #  # ]:          0 :         SolarMutexGuard aSolarMutexGuard;
     368                 :            : 
     369         [ #  # ]:          0 :         if ( m_bDisposed )
     370         [ #  # ]:          0 :             throw DisposedException();
     371                 :            : 
     372   [ #  #  #  #  :          0 :         if ( m_bInitialized &&
             #  #  #  # ]
                 [ #  # ]
     373                 :          0 :              m_xFrame.is() &&
     374                 :          0 :              m_xServiceManager.is() &&
     375                 :          0 :              !m_aCommandURL.isEmpty() )
     376                 :            :         {
     377                 :            : 
     378                 :          0 :             aCommandURL = m_aCommandURL;
     379         [ #  # ]:          0 :             URLToDispatchMap::iterator pIter = m_aListenerMap.find( m_aCommandURL );
     380 [ #  # ][ #  # ]:          0 :             if ( pIter != m_aListenerMap.end() )
     381 [ #  # ][ #  # ]:          0 :                 xDispatch = pIter->second;
     382         [ #  # ]:          0 :         }
     383                 :            :     }
     384                 :            : 
     385         [ #  # ]:          0 :     if ( xDispatch.is() )
     386                 :            :     {
     387                 :            :         try
     388                 :            :         {
     389                 :          0 :             com::sun::star::util::URL aTargetURL;
     390         [ #  # ]:          0 :             Sequence<PropertyValue>   aArgs( 1 );
     391                 :            : 
     392                 :            :             // Provide key modifier information to dispatch function
     393 [ #  # ][ #  # ]:          0 :             aArgs[0].Name   = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "KeyModifier" ));
     394 [ #  # ][ #  # ]:          0 :             aArgs[0].Value  = makeAny( KeyModifier );
     395                 :            : 
     396                 :          0 :             aTargetURL.Complete = aCommandURL;
     397         [ #  # ]:          0 :             if ( m_pImpl->m_xUrlTransformer.is() )
     398 [ #  # ][ #  # ]:          0 :                 m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
     399 [ #  # ][ #  # ]:          0 :             xDispatch->dispatch( aTargetURL, aArgs );
         [ #  # ][ #  # ]
     400                 :            :         }
     401         [ #  # ]:          0 :         catch ( DisposedException& )
     402                 :            :         {
     403                 :            :         }
     404                 :          0 :     }
     405                 :          0 : }
     406                 :            : 
     407                 :          2 : void SAL_CALL ToolboxController::click()
     408                 :            : throw (::com::sun::star::uno::RuntimeException)
     409                 :            : {
     410                 :          2 : }
     411                 :            : 
     412                 :          0 : void SAL_CALL ToolboxController::doubleClick()
     413                 :            : throw (::com::sun::star::uno::RuntimeException)
     414                 :            : {
     415                 :          0 : }
     416                 :            : 
     417                 :          0 : Reference< XWindow > SAL_CALL ToolboxController::createPopupWindow()
     418                 :            : throw (::com::sun::star::uno::RuntimeException)
     419                 :            : {
     420                 :          0 :     return Reference< XWindow >();
     421                 :            : }
     422                 :            : 
     423                 :      51774 : Reference< XWindow > SAL_CALL ToolboxController::createItemWindow( const Reference< XWindow >& )
     424                 :            : throw (::com::sun::star::uno::RuntimeException)
     425                 :            : {
     426                 :      51774 :     return Reference< XWindow >();
     427                 :            : }
     428                 :            : 
     429                 :       9472 : void ToolboxController::addStatusListener( const rtl::OUString& aCommandURL )
     430                 :            : {
     431                 :       9472 :     Reference< XDispatch >       xDispatch;
     432                 :       9472 :     Reference< XStatusListener > xStatusListener;
     433                 :       9472 :     com::sun::star::util::URL    aTargetURL;
     434                 :            : 
     435                 :            :     {
     436         [ +  - ]:       9472 :         SolarMutexGuard aSolarMutexGuard;
     437         [ +  - ]:       9472 :         URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL );
     438                 :            : 
     439                 :            :         // Already in the list of status listener. Do nothing.
     440 [ +  - ][ +  + ]:       9472 :         if ( pIter != m_aListenerMap.end() )
     441                 :            :             return;
     442                 :            : 
     443                 :            :         // Check if we are already initialized. Implementation starts adding itself as status listener when
     444                 :            :         // intialize is called.
     445         [ +  - ]:       9216 :         if ( !m_bInitialized )
     446                 :            :         {
     447                 :            :             // Put into the boost::unordered_map of status listener. Will be activated when initialized is called
     448 [ +  - ][ +  - ]:       9216 :             m_aListenerMap.insert( URLToDispatchMap::value_type( aCommandURL, Reference< XDispatch >() ));
                 [ +  - ]
     449                 :            :             return;
     450                 :            :         }
     451                 :            :         else
     452                 :            :         {
     453                 :            :             // Add status listener directly as intialize has already been called.
     454         [ #  # ]:          0 :             Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
     455 [ #  # ][ #  # ]:          0 :             if ( m_xServiceManager.is() && xDispatchProvider.is() )
                 [ #  # ]
     456                 :            :             {
     457                 :          0 :                 aTargetURL.Complete = aCommandURL;
     458         [ #  # ]:          0 :                 if ( m_pImpl->m_xUrlTransformer.is() )
     459 [ #  # ][ #  # ]:          0 :                     m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
     460 [ #  # ][ #  # ]:          0 :                 xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
                 [ #  # ]
     461                 :            : 
     462 [ #  # ][ #  # ]:          0 :                 xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY );
                 [ #  # ]
     463         [ #  # ]:          0 :                 URLToDispatchMap::iterator aIter = m_aListenerMap.find( aCommandURL );
     464 [ #  # ][ #  # ]:          0 :                 if ( aIter != m_aListenerMap.end() )
     465                 :            :                 {
     466         [ #  # ]:          0 :                     Reference< XDispatch > xOldDispatch( aIter->second );
     467 [ #  # ][ #  # ]:          0 :                     aIter->second = xDispatch;
     468                 :            : 
     469                 :            :                     try
     470                 :            :                     {
     471         [ #  # ]:          0 :                         if ( xOldDispatch.is() )
     472 [ #  # ][ #  # ]:          0 :                             xOldDispatch->removeStatusListener( xStatusListener, aTargetURL );
     473                 :            :                     }
     474         [ #  # ]:          0 :                     catch ( Exception& )
     475                 :            :                     {
     476                 :          0 :                     }
     477                 :            :                 }
     478                 :            :                 else
     479 [ #  # ][ #  # ]:          0 :                     m_aListenerMap.insert( URLToDispatchMap::value_type( aCommandURL, xDispatch ));
                 [ #  # ]
     480                 :          0 :             }
     481         [ +  - ]:       9472 :         }
           [ -  +  #  # ]
     482                 :            :     }
     483                 :            : 
     484                 :            :     // Call without locked mutex as we are called back from dispatch implementation
     485                 :            :     try
     486                 :            :     {
     487         [ #  # ]:       9472 :         if ( xDispatch.is() )
     488 [ #  # ][ #  # ]:          0 :             xDispatch->addStatusListener( xStatusListener, aTargetURL );
     489                 :            :     }
     490         [ #  # ]:          0 :     catch ( Exception& )
     491                 :            :     {
     492 [ +  - ][ +  - ]:       9472 :     }
                 [ -  + ]
     493                 :            : }
     494                 :            : 
     495                 :         52 : void ToolboxController::removeStatusListener( const rtl::OUString& aCommandURL )
     496                 :            : {
     497         [ +  - ]:         52 :     SolarMutexGuard aSolarMutexGuard;
     498                 :            : 
     499         [ +  - ]:         52 :     URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL );
     500 [ +  - ][ +  - ]:         52 :     if ( pIter != m_aListenerMap.end() )
     501                 :            :     {
     502         [ +  - ]:         52 :         Reference< XDispatch > xDispatch( pIter->second );
     503         [ +  - ]:         52 :         Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
     504         [ +  - ]:         52 :         m_aListenerMap.erase( pIter );
     505                 :            : 
     506                 :            :         try
     507                 :            :         {
     508                 :         52 :             com::sun::star::util::URL aTargetURL;
     509                 :         52 :             aTargetURL.Complete = aCommandURL;
     510         [ +  - ]:         52 :             if ( m_pImpl->m_xUrlTransformer.is() )
     511 [ +  - ][ +  - ]:         52 :                 m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
     512                 :            : 
     513 [ +  + ][ +  - ]:         52 :             if ( xDispatch.is() && xStatusListener.is() )
                 [ +  + ]
     514 [ +  - ][ +  - ]:         52 :                 xDispatch->removeStatusListener( xStatusListener, aTargetURL );
                 [ #  # ]
     515                 :            :         }
     516         [ #  # ]:          0 :         catch ( Exception& )
     517                 :            :         {
     518                 :         52 :         }
     519         [ +  - ]:         52 :     }
     520                 :         52 : }
     521                 :            : 
     522                 :      70098 : void ToolboxController::bindListener()
     523                 :            : {
     524         [ +  - ]:      70098 :     std::vector< Listener > aDispatchVector;
     525                 :      70098 :     Reference< XStatusListener > xStatusListener;
     526                 :            : 
     527                 :            :     {
     528         [ +  - ]:      70098 :         SolarMutexGuard aSolarMutexGuard;
     529                 :            : 
     530         [ -  + ]:      70098 :         if ( !m_bInitialized )
     531                 :      70098 :             return;
     532                 :            : 
     533                 :            :         // Collect all registered command URL's and store them temporary
     534         [ +  - ]:      70098 :         Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
     535 [ +  - ][ +  - ]:      70098 :         if ( m_xServiceManager.is() && xDispatchProvider.is() )
                 [ +  - ]
     536                 :            :         {
     537 [ +  - ][ +  - ]:      70098 :             xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY );
                 [ #  # ]
     538         [ +  - ]:      70098 :             URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
     539 [ +  - ][ +  + ]:     150384 :             while ( pIter != m_aListenerMap.end() )
     540                 :            :             {
     541                 :      80286 :                 com::sun::star::util::URL aTargetURL;
     542         [ +  - ]:      80286 :                 aTargetURL.Complete = pIter->first;
     543         [ +  - ]:      80286 :                 if ( m_pImpl->m_xUrlTransformer.is() )
     544 [ +  - ][ +  - ]:      80286 :                     m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
     545                 :            : 
     546         [ +  - ]:      80286 :                 Reference< XDispatch > xDispatch( pIter->second );
     547         [ +  + ]:      80286 :                 if ( xDispatch.is() )
     548                 :            :                 {
     549                 :            :                     // We already have a dispatch object => we have to requery.
     550                 :            :                     // Release old dispatch object and remove it as listener
     551                 :            :                     try
     552                 :            :                     {
     553 [ +  - ][ +  - ]:       4503 :                         xDispatch->removeStatusListener( xStatusListener, aTargetURL );
     554                 :            :                     }
     555         [ #  # ]:          0 :                     catch ( Exception& )
     556                 :            :                     {
     557                 :            :                     }
     558                 :            :                 }
     559                 :            : 
     560         [ +  - ]:      80286 :                 pIter->second.clear();
     561                 :      80286 :                 xDispatch.clear();
     562                 :            : 
     563                 :            :                 // Query for dispatch object. Old dispatch will be released with this, too.
     564                 :            :                 try
     565                 :            :                 {
     566 [ +  - ][ +  - ]:      80286 :                     xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 );
         [ #  # ][ +  - ]
     567                 :            :                 }
     568         [ #  # ]:          0 :                 catch ( Exception& )
     569                 :            :                 {
     570                 :            :                 }
     571 [ +  - ][ +  - ]:      80286 :                 pIter->second = xDispatch;
     572                 :            : 
     573         [ +  - ]:      80286 :                 Listener aListener( aTargetURL, xDispatch );
     574         [ +  - ]:      80286 :                 aDispatchVector.push_back( aListener );
     575                 :      80286 :                 ++pIter;
     576         [ +  - ]:      80286 :             }
     577 [ +  - ][ +  - ]:      70098 :         }
     578                 :            :     }
     579                 :            : 
     580                 :            :     // Call without locked mutex as we are called back from dispatch implementation
     581         [ +  - ]:      70098 :     if ( xStatusListener.is() )
     582                 :            :     {
     583                 :            :         try
     584                 :            :         {
     585         [ +  + ]:     150384 :             for ( sal_uInt32 i = 0; i < aDispatchVector.size(); i++ )
     586                 :            :             {
     587         [ +  - ]:      80286 :                 Listener& rListener = aDispatchVector[i];
     588         [ +  + ]:      80286 :                 if ( rListener.xDispatch.is() )
     589 [ +  - ][ +  - ]:      79883 :                     rListener.xDispatch->addStatusListener( xStatusListener, rListener.aURL );
     590         [ +  + ]:        403 :                 else if ( rListener.aURL.Complete == m_aCommandURL )
     591                 :            :                 {
     592                 :            :                     try
     593                 :            :                     {
     594                 :            :                         // Send status changed for the main URL, if we cannot get a valid dispatch object.
     595                 :            :                         // UI disables the button. Catch exception as we release our mutex, it is possible
     596                 :            :                         // that someone else already disposed this instance!
     597         [ +  - ]:        211 :                         FeatureStateEvent aFeatureStateEvent;
     598                 :        211 :                         aFeatureStateEvent.IsEnabled = sal_False;
     599                 :        211 :                         aFeatureStateEvent.FeatureURL = rListener.aURL;
     600                 :        211 :                         aFeatureStateEvent.State = Any();
     601 [ +  - ][ +  - ]:        211 :                         xStatusListener->statusChanged( aFeatureStateEvent );
         [ #  # ][ +  - ]
     602                 :            :                     }
     603   [ #  #  #  # ]:          0 :                     catch ( Exception& )
     604                 :            :                     {
     605                 :            :                     }
     606                 :            :                 }
     607                 :            :             }
     608                 :            :         }
     609         [ #  # ]:          0 :         catch ( Exception& )
     610                 :            :         {
     611                 :            :         }
     612 [ -  + ][ +  - ]:      70098 :     }
     613                 :            : }
     614                 :            : 
     615                 :          0 : void ToolboxController::unbindListener()
     616                 :            : {
     617         [ #  # ]:          0 :     SolarMutexGuard aSolarMutexGuard;
     618                 :            : 
     619         [ #  # ]:          0 :     if ( !m_bInitialized )
     620         [ #  # ]:          0 :         return;
     621                 :            : 
     622                 :            :     // Collect all registered command URL's and store them temporary
     623         [ #  # ]:          0 :     Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
     624 [ #  # ][ #  # ]:          0 :     if ( m_xServiceManager.is() && xDispatchProvider.is() )
                 [ #  # ]
     625                 :            :     {
     626         [ #  # ]:          0 :         Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
     627         [ #  # ]:          0 :         URLToDispatchMap::iterator pIter = m_aListenerMap.begin();
     628 [ #  # ][ #  # ]:          0 :         while ( pIter != m_aListenerMap.end() )
     629                 :            :         {
     630                 :          0 :             com::sun::star::util::URL aTargetURL;
     631         [ #  # ]:          0 :             aTargetURL.Complete = pIter->first;
     632         [ #  # ]:          0 :             if ( m_pImpl->m_xUrlTransformer.is() )
     633 [ #  # ][ #  # ]:          0 :                 m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
     634                 :            : 
     635         [ #  # ]:          0 :             Reference< XDispatch > xDispatch( pIter->second );
     636         [ #  # ]:          0 :             if ( xDispatch.is() )
     637                 :            :             {
     638                 :            :                 // We already have a dispatch object => we have to requery.
     639                 :            :                 // Release old dispatch object and remove it as listener
     640                 :            :                 try
     641                 :            :                 {
     642 [ #  # ][ #  # ]:          0 :                     xDispatch->removeStatusListener( xStatusListener, aTargetURL );
     643                 :            :                 }
     644         [ #  # ]:          0 :                 catch ( Exception& )
     645                 :            :                 {
     646                 :            :                 }
     647                 :            :             }
     648         [ #  # ]:          0 :             pIter->second.clear();
     649                 :          0 :             ++pIter;
     650                 :          0 :         }
     651 [ #  # ][ #  # ]:          0 :     }
     652                 :            : }
     653                 :            : 
     654                 :       1524 : sal_Bool ToolboxController::isBound() const
     655                 :            : {
     656         [ +  - ]:       1524 :     SolarMutexGuard aSolarMutexGuard;
     657                 :            : 
     658         [ -  + ]:       1524 :     if ( !m_bInitialized )
     659                 :          0 :         return sal_False;
     660                 :            : 
     661         [ +  - ]:       1524 :     URLToDispatchMap::const_iterator pIter = m_aListenerMap.find( m_aCommandURL );
     662 [ +  - ][ +  - ]:       1524 :     if ( pIter != m_aListenerMap.end() )
     663         [ +  - ]:       1524 :         return ( pIter->second.is() );
     664                 :            : 
     665         [ +  - ]:       1524 :     return sal_False;
     666                 :            : }
     667                 :            : 
     668                 :        676 : sal_Bool ToolboxController::hasBigImages() const
     669                 :            : {
     670         [ +  - ]:        676 :     return SvtMiscOptions().AreCurrentSymbolsLarge();
     671                 :            : }
     672                 :            : 
     673                 :          0 : void ToolboxController::updateStatus()
     674                 :            : {
     675                 :          0 :     bindListener();
     676                 :          0 : }
     677                 :            : 
     678                 :        119 : void ToolboxController::updateStatus( const rtl::OUString aCommandURL )
     679                 :            : {
     680                 :        119 :     Reference< XDispatch > xDispatch;
     681                 :        119 :     Reference< XStatusListener > xStatusListener;
     682                 :        119 :     com::sun::star::util::URL aTargetURL;
     683                 :            : 
     684                 :            :     {
     685         [ +  - ]:        119 :         SolarMutexGuard aSolarMutexGuard;
     686                 :            : 
     687         [ -  + ]:        119 :         if ( !m_bInitialized )
     688                 :        119 :             return;
     689                 :            : 
     690                 :            :         // Try to find a dispatch object for the requested command URL
     691         [ +  - ]:        119 :         Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
     692 [ +  - ][ +  - ]:        119 :         xStatusListener = Reference< XStatusListener >( static_cast< OWeakObject* >( this ), UNO_QUERY );
     693 [ +  - ][ +  - ]:        119 :         if ( m_xServiceManager.is() && xDispatchProvider.is() )
                 [ +  - ]
     694                 :            :         {
     695                 :        119 :             aTargetURL.Complete = aCommandURL;
     696         [ +  - ]:        119 :             if ( m_pImpl->m_xUrlTransformer.is() )
     697 [ +  - ][ +  - ]:        119 :                 m_pImpl->m_xUrlTransformer->parseStrict( aTargetURL );
     698 [ +  - ][ +  - ]:        119 :             xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 );
                 [ +  - ]
     699         [ +  - ]:        119 :         }
           [ +  -  #  # ]
     700                 :            :     }
     701                 :            : 
     702 [ +  - ][ +  - ]:        119 :     if ( xDispatch.is() && xStatusListener.is() )
                 [ +  - ]
     703                 :            :     {
     704                 :            :         // Catch exception as we release our mutex, it is possible that someone else
     705                 :            :         // has already disposed this instance!
     706                 :            :         // Add/remove status listener to get a update status information from the
     707                 :            :         // requested command.
     708                 :            :         try
     709                 :            :         {
     710 [ +  - ][ +  - ]:        119 :             xDispatch->addStatusListener( xStatusListener, aTargetURL );
     711 [ +  - ][ +  - ]:        119 :             xDispatch->removeStatusListener( xStatusListener, aTargetURL );
     712                 :            :         }
     713         [ #  # ]:          0 :         catch ( Exception& )
     714                 :            :         {
     715                 :            :         }
     716 [ -  + ][ -  + ]:        119 :     }
                 [ +  - ]
     717                 :            : }
     718                 :            : 
     719                 :          0 : Reference< XURLTransformer > ToolboxController::getURLTransformer() const
     720                 :            : {
     721                 :          0 :     return m_pImpl->m_xUrlTransformer;
     722                 :            : }
     723                 :            : 
     724                 :        248 : Reference< ::com::sun::star::awt::XWindow > ToolboxController::getParent() const
     725                 :            : {
     726                 :        248 :     return m_pImpl->m_xParentWindow;
     727                 :            : }
     728                 :            : 
     729                 :          0 : const rtl::OUString& ToolboxController::getModuleName() const
     730                 :            : {
     731                 :          0 :     return m_pImpl->m_sModuleName;
     732                 :            : }
     733                 :            : 
     734                 :          0 : void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequence< PropertyValue >& rArgs )
     735                 :            : {
     736                 :            :     try
     737                 :            :     {
     738         [ #  # ]:          0 :         Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY_THROW );
     739                 :          0 :         URL aURL;
     740                 :          0 :         aURL.Complete = sCommandURL;
     741 [ #  # ][ #  # ]:          0 :         getURLTransformer()->parseStrict( aURL );
                 [ #  # ]
     742                 :            : 
     743 [ #  # ][ #  # ]:          0 :         Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, OUString(), 0 ), UNO_QUERY_THROW );
                 [ #  # ]
     744                 :            : 
     745 [ #  # ][ #  # ]:          0 :         Application::PostUserEvent( STATIC_LINK(0, ToolboxController_Impl, ExecuteHdl_Impl), new DispatchInfo( xDispatch, aURL, rArgs ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     746                 :            : 
     747                 :            :     }
     748                 :          0 :     catch( Exception& )
     749                 :            :     {
     750                 :            :     }
     751                 :          0 : }
     752                 :            : 
     753                 :            : //
     754                 :            : //-------------------------------------------------------------------------
     755                 :            : // XPropertySet by shizhoubo
     756                 :          0 : com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >  SAL_CALL ToolboxController::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException)
     757                 :            : {
     758                 :          0 :     Reference<XPropertySetInfo>  xInfo( createPropertySetInfo( getInfoHelper() ) );
     759                 :          0 :     return xInfo;
     760                 :            : }
     761                 :            : //-------------------------------------------------------------------------
     762                 :     141294 : ::cppu::IPropertyArrayHelper& ToolboxController::getInfoHelper()
     763                 :            : {
     764                 :     141294 :         return *const_cast<ToolboxController*>(this)->getArrayHelper();
     765                 :            : }
     766                 :            : //OPropertyArrayUsageHelper by shizhoubo
     767                 :            : //------------------------------------------------------------------------------
     768                 :       1088 : ::cppu::IPropertyArrayHelper* ToolboxController::createArrayHelper( ) const
     769                 :            : {
     770         [ +  - ]:       1088 :         com::sun::star::uno::Sequence< Property > aProps;
     771         [ +  - ]:       1088 :         describeProperties(aProps);
     772 [ +  - ][ +  - ]:       1088 :         return new ::cppu::OPropertyArrayHelper(aProps);
     773                 :            : }
     774                 :            : //shizhoubo for supportsvisiable
     775                 :       1922 : void ToolboxController::setSupportVisibleProperty(sal_Bool bValue)
     776                 :            : {
     777                 :       1922 :     m_bSupportVisible = bValue;
     778                 :       1922 : }
     779                 :            : //OPropertySetHelper by shizhoubo
     780                 :          0 : sal_Bool SAL_CALL ToolboxController::convertFastPropertyValue( com::sun::star::uno::Any&    aConvertedValue ,
     781                 :            :                                              com::sun::star::uno::Any&        aOldValue       ,
     782                 :            :                                              sal_Int32                        nHandle         ,
     783                 :            :                                              const com::sun::star::uno::Any&  aValue          ) throw( com::sun::star::lang::IllegalArgumentException )
     784                 :            : {
     785         [ #  # ]:          0 :     switch (nHandle)
     786                 :            :     {
     787                 :            :         case TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIBLE:
     788                 :            :         {
     789                 :          0 :             sal_Bool aNewValue(sal_False);
     790                 :          0 :             aValue >>= aNewValue;
     791         [ #  # ]:          0 :             if (aNewValue != m_bSupportVisible)
     792                 :            :             {
     793         [ #  # ]:          0 :                 aConvertedValue <<= aNewValue;
     794         [ #  # ]:          0 :                 aOldValue <<= m_bSupportVisible;
     795                 :          0 :                 return sal_True;
     796                 :            :             }
     797                 :          0 :             return sal_False;
     798                 :            :         }
     799                 :            :     }
     800                 :          0 :     return OPropertyContainer::convertFastPropertyValue(aConvertedValue, aOldValue, nHandle, aValue);
     801                 :            : }
     802                 :            : 
     803                 :       1922 : void SAL_CALL ToolboxController::setFastPropertyValue_NoBroadcast(
     804                 :            :     sal_Int32                       nHandle,
     805                 :            :     const com::sun::star::uno::Any& aValue )
     806                 :            : throw( com::sun::star::uno::Exception)
     807                 :            : {
     808                 :       1922 :     OPropertyContainer::setFastPropertyValue_NoBroadcast(nHandle, aValue);
     809         [ +  - ]:       1922 :     if (TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIBLE == nHandle)
     810                 :            :     {
     811                 :       1922 :         sal_Bool rValue(sal_False);
     812 [ +  - ][ +  - ]:       1922 :         if (( aValue >>= rValue ) && m_bInitialized)
                 [ +  - ]
     813         [ +  - ]:       1922 :             this->setSupportVisibleProperty( rValue );
     814                 :            :     }
     815                 :       1922 : }
     816                 :            : 
     817                 :            : //--------------------------------------------------------------------
     818                 :            : 
     819                 :          0 : IMPL_STATIC_LINK_NOINSTANCE( ToolboxController_Impl, ExecuteHdl_Impl, DispatchInfo*, pDispatchInfo )
     820                 :            : {
     821                 :          0 :     pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs );
     822         [ #  # ]:          0 :     delete pDispatchInfo;
     823                 :          0 :     return 0;
     824                 :            : }
     825                 :            : 
     826                 :         44 : void ToolboxController::enable( bool bEnable )
     827                 :            : {
     828                 :         44 :     ToolBox* pToolBox = 0;
     829                 :         44 :     sal_uInt16 nItemId = 0;
     830 [ +  - ][ +  - ]:         44 :     if( getToolboxId( nItemId, &pToolBox ) )
     831                 :            :     {
     832 [ +  - ][ +  - ]:         44 :         pToolBox->EnableItem( nItemId, bEnable ? sal_True : sal_False );
     833                 :            :     }
     834                 :         44 : }
     835                 :            : 
     836                 :         44 : bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox )
     837                 :            : {
     838 [ +  + ][ -  + ]:         44 :     if( (m_pImpl->m_nToolBoxId != SAL_MAX_UINT16) && (ppToolBox == 0) )
     839                 :          0 :         return m_pImpl->m_nToolBoxId;
     840                 :            : 
     841         [ +  - ]:         44 :     ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
     842                 :            : 
     843 [ +  - ][ +  + ]:         44 :     if( (m_pImpl->m_nToolBoxId == SAL_MAX_UINT16) && pToolBox )
     844                 :            :     {
     845                 :         34 :         const sal_uInt16 nCount = pToolBox->GetItemCount();
     846         [ +  - ]:         85 :         for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos )
     847                 :            :         {
     848                 :         51 :             const sal_uInt16 nItemId = pToolBox->GetItemId( nPos );
     849 [ +  - ][ +  + ]:         51 :             if ( pToolBox->GetItemCommand( nItemId ) == String( m_aCommandURL ) )
                 [ +  - ]
     850                 :            :             {
     851                 :         34 :                 m_pImpl->m_nToolBoxId = nItemId;
     852                 :         34 :                 break;
     853                 :            :             }
     854                 :            :         }
     855                 :            :     }
     856                 :            : 
     857         [ +  - ]:         44 :     if( ppToolBox )
     858                 :         44 :         *ppToolBox = pToolBox;
     859                 :            : 
     860                 :         44 :     rItemId = m_pImpl->m_nToolBoxId;
     861                 :            : 
     862 [ +  - ][ +  - ]:         44 :     return (rItemId != SAL_MAX_UINT16) && (( ppToolBox == 0) || (*ppToolBox != 0) );
                 [ +  - ]
     863                 :            : }
     864                 :            : //end
     865                 :            : 
     866                 :            : } // svt
     867                 :            : 
     868                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10