LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/svtools - toolboxcontroller.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 4 75.0 %
Date: 2012-08-25 Functions: 3 4 75.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 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                 :            : #ifndef _SVTOOLS_TOOLBOXCONTROLLER_HXX
      30                 :            : #define _SVTOOLS_TOOLBOXCONTROLLER_HXX
      31                 :            : 
      32                 :            : #include "svtools/svtdllapi.h"
      33                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      34                 :            : #include <com/sun/star/lang/XInitialization.hpp>
      35                 :            : #include <com/sun/star/util/XUpdatable.hpp>
      36                 :            : #include <com/sun/star/frame/XFrame.hpp>
      37                 :            : #include <com/sun/star/frame/XDispatch.hpp>
      38                 :            : #include <com/sun/star/frame/XStatusListener.hpp>
      39                 :            : #include <com/sun/star/frame/XToolbarController.hpp>
      40                 :            : #include <com/sun/star/util/XURLTransformer.hpp>
      41                 :            : #include <com/sun/star/frame/XLayoutManager.hpp>
      42                 :            : #include <cppuhelper/weak.hxx>
      43                 :            : #include <cppuhelper/interfacecontainer.hxx>
      44                 :            : #include <comphelper/broadcasthelper.hxx>
      45                 :            : #include <comphelper/proparrhlp.hxx>
      46                 :            : #include <comphelper/property.hxx>
      47                 :            : #include <comphelper/propertycontainer.hxx>
      48                 :            : #include <cppuhelper/propshlp.hxx>
      49                 :            : 
      50                 :            : #include <boost/unordered_map.hpp>
      51                 :            : 
      52                 :            : class ToolBox;
      53                 :            : 
      54                 :            : namespace svt
      55                 :            : {
      56                 :            : struct ToolboxController_Impl;
      57                 :            : 
      58                 :            : class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusListener,
      59                 :            :                           public ::com::sun::star::frame::XToolbarController,
      60                 :            :                           public ::com::sun::star::lang::XInitialization,
      61                 :            :                           public ::com::sun::star::util::XUpdatable,
      62                 :            :                           public ::com::sun::star::lang::XComponent,
      63                 :            :                           public ::comphelper::OMutexAndBroadcastHelper,//shizhoubo
      64                 :            :                           public ::comphelper::OPropertyContainer,//shizhoubo
      65                 :            :                           public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >,//shizhoubo
      66                 :            :                           public ::cppu::OWeakObject
      67                 :            : {
      68                 :            :     private:
      69                 :            :         sal_Bool  m_bSupportVisible; //shizhoubo
      70                 :            :     public:
      71                 :            :         ToolboxController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
      72                 :            :                            const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
      73                 :            :                            const rtl::OUString& aCommandURL );
      74                 :            :         ToolboxController();
      75                 :            :         virtual ~ToolboxController();
      76                 :            : 
      77                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > getFrameInterface() const;
      78                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceManager() const;
      79                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > getLayoutManager() const;
      80                 :            : 
      81                 :            :         void updateStatus( const rtl::OUString aCommandURL );
      82                 :            :         void updateStatus();
      83                 :            : 
      84                 :            :         // XInterface
      85                 :            :         virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
      86                 :            :         virtual void SAL_CALL acquire() throw ();
      87                 :            :         virtual void SAL_CALL release() throw ();
      88                 :            : 
      89                 :            :         // XInitialization
      90                 :            :         virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
      91                 :            : 
      92                 :            :         // XUpdatable
      93                 :            :         virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
      94                 :            : 
      95                 :            :         // XComponent
      96                 :            :         virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
      97                 :            :         virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
      98                 :            :         virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
      99                 :            : 
     100                 :            :         // XEventListener
     101                 :            :         using cppu::OPropertySetHelper::disposing;
     102                 :            :         virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
     103                 :            : 
     104                 :            :         // XStatusListener
     105                 :            :         virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) = 0;
     106                 :            : 
     107                 :            :         // XToolbarController
     108                 :            :         virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
     109                 :            :         virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
     110                 :            :         virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
     111                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
     112                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
     113                 :            :         // OPropertySetHelper //shizhoubo
     114                 :            :         virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue ) throw(com::sun::star::uno::Exception);
     115                 :            :         virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& rConvertedValue, com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const com::sun::star::uno::Any& rValue) throw(com::sun::star::lang::IllegalArgumentException);
     116                 :            :         // XPropertySet //shizhoubo
     117                 :            :         virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo>  SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
     118                 :            :         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
     119                 :            :         // OPropertyArrayUsageHelper //shizhoubo
     120                 :            :         virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
     121                 :            : 
     122                 :            : 
     123                 :          0 :         const rtl::OUString& getCommandURL() const { return  m_aCommandURL; }
     124                 :            :         const rtl::OUString& getModuleName() const;
     125                 :            : 
     126                 :            :         void dispatchCommand( const ::rtl::OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
     127                 :            : 
     128                 :            :         void enable( bool bEnable );
     129                 :            : 
     130                 :            :     protected:
     131                 :            :         bool getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox );
     132                 :            :         void setSupportVisibleProperty(sal_Bool bValue); //shizhoubo
     133                 :     262882 :         struct Listener
     134                 :            :         {
     135                 :      80286 :             Listener( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) :
     136                 :      80286 :                 aURL( rURL ), xDispatch( rDispatch ) {}
     137                 :            : 
     138                 :            :             ::com::sun::star::util::URL aURL;
     139                 :            :             ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
     140                 :            :         };
     141                 :            : 
     142                 :            :         typedef ::boost::unordered_map< ::rtl::OUString,
     143                 :            :                                  com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >,
     144                 :            :                                  ::rtl::OUStringHash,
     145                 :            :                                  ::std::equal_to< ::rtl::OUString > > URLToDispatchMap;
     146                 :            : 
     147                 :            :         // methods to support status forwarder, known by the old sfx2 toolbox controller implementation
     148                 :            :         void addStatusListener( const rtl::OUString& aCommandURL );
     149                 :            :         void removeStatusListener( const rtl::OUString& aCommandURL );
     150                 :            :         void bindListener();
     151                 :            :         void unbindListener();
     152                 :            :         sal_Bool isBound() const;
     153                 :            :         sal_Bool hasBigImages() const;
     154                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > getURLTransformer() const;
     155                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > getParent() const;
     156                 :            : 
     157                 :            :         sal_Bool                                                                            m_bInitialized : 1,
     158                 :            :                                                                                             m_bDisposed : 1;
     159                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >                 m_xFrame;
     160                 :            :         ToolboxController_Impl*                                                             m_pImpl;
     161                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >    m_xServiceManager;
     162                 :            :         rtl::OUString                                                                       m_aCommandURL;
     163                 :            :         URLToDispatchMap                                                                    m_aListenerMap;
     164                 :            :         ::cppu::OMultiTypeInterfaceContainerHelper                                          m_aListenerContainer;   /// container for ALL Listener
     165                 :            : };
     166                 :            : 
     167                 :            : }
     168                 :            : 
     169                 :            : #endif // _SVTOOLS_TOOLBOXCONTROLLER_HXX
     170                 :            : 
     171                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10