1f8e07b45SAndrew Rist /************************************************************** 2*d3bacab6SAriel Constenla-Haile * 3f8e07b45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f8e07b45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f8e07b45SAndrew Rist * distributed with this work for additional information 6f8e07b45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f8e07b45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f8e07b45SAndrew Rist * "License"); you may not use this file except in compliance 9f8e07b45SAndrew Rist * with the License. You may obtain a copy of the License at 10*d3bacab6SAriel Constenla-Haile * 11f8e07b45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*d3bacab6SAriel Constenla-Haile * 13f8e07b45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f8e07b45SAndrew Rist * software distributed under the License is distributed on an 15f8e07b45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f8e07b45SAndrew Rist * KIND, either express or implied. See the License for the 17f8e07b45SAndrew Rist * specific language governing permissions and limitations 18f8e07b45SAndrew Rist * under the License. 19*d3bacab6SAriel Constenla-Haile * 20f8e07b45SAndrew Rist *************************************************************/ 21f8e07b45SAndrew Rist 22cdf0e10cSrcweir #ifndef __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_ 23cdf0e10cSrcweir #define __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_ 24cdf0e10cSrcweir 25cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx> 26cdf0e10cSrcweir #include <macros/generic.hxx> 27cdf0e10cSrcweir #include <macros/xinterface.hxx> 28cdf0e10cSrcweir #include <macros/xtypeprovider.hxx> 29cdf0e10cSrcweir #include <stdtypes.h> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 32cdf0e10cSrcweir #include <com/sun/star/frame/XStatusbarController.hpp> 33dccf82beSAriel Constenla-Haile #include <com/sun/star/frame/XUIControllerFactory.hpp> 34cdf0e10cSrcweir #include <com/sun/star/ui/XUIConfiguration.hpp> 35cdf0e10cSrcweir #include <com/sun/star/frame/XModuleManager.hpp> 36cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 37cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 38cdf0e10cSrcweir 39cdf0e10cSrcweir #include <rtl/ustring.hxx> 40cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 41cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 42cdf0e10cSrcweir #include <vcl/status.hxx> 432503e1a5SAriel Constenla-Haile #include <map> 44cdf0e10cSrcweir 45cdf0e10cSrcweir namespace framework 46cdf0e10cSrcweir { 47cdf0e10cSrcweir 48cdf0e10cSrcweir class FrameworkStatusBar; 49cdf0e10cSrcweir class StatusBarManager : public ::com::sun::star::frame::XFrameActionListener , 50cdf0e10cSrcweir public ::com::sun::star::lang::XComponent , 51cdf0e10cSrcweir public ::com::sun::star::lang::XTypeProvider , 52cdf0e10cSrcweir public ::com::sun::star::ui::XUIConfigurationListener, 53cdf0e10cSrcweir public ThreadHelpBase , 54cdf0e10cSrcweir public ::cppu::OWeakObject 55cdf0e10cSrcweir { 56cdf0e10cSrcweir friend class FrameworkStatusBar; 57cdf0e10cSrcweir 58cdf0e10cSrcweir public: 59cdf0e10cSrcweir StatusBarManager( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServicveManager, 60cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, 61cdf0e10cSrcweir const rtl::OUString& rResourceName, 62cdf0e10cSrcweir StatusBar* pStatusBar ); 63cdf0e10cSrcweir virtual ~StatusBarManager(); 64cdf0e10cSrcweir 65cdf0e10cSrcweir // XInterface, XTypeProvider, XServiceInfo 66cdf0e10cSrcweir FWK_DECLARE_XINTERFACE 67cdf0e10cSrcweir FWK_DECLARE_XTYPEPROVIDER 68cdf0e10cSrcweir 69cdf0e10cSrcweir StatusBar* GetStatusBar() const; 70cdf0e10cSrcweir 71cdf0e10cSrcweir // XFrameActionListener 72cdf0e10cSrcweir virtual void SAL_CALL frameAction( const com::sun::star::frame::FrameActionEvent& Action ) throw ( ::com::sun::star::uno::RuntimeException ); 73cdf0e10cSrcweir 74cdf0e10cSrcweir // XEventListener 75cdf0e10cSrcweir virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); 76cdf0e10cSrcweir 77cdf0e10cSrcweir // XUIConfigurationListener 78cdf0e10cSrcweir virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); 79cdf0e10cSrcweir virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); 80cdf0e10cSrcweir virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); 81cdf0e10cSrcweir 82cdf0e10cSrcweir // XComponent 83cdf0e10cSrcweir void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); 84cdf0e10cSrcweir void SAL_CALL addEventListener( const com::sun::star::uno::Reference< XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException ); 85cdf0e10cSrcweir void SAL_CALL removeEventListener( const com::sun::star::uno::Reference< XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException ); 86cdf0e10cSrcweir 87cdf0e10cSrcweir void FillStatusBar( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rStatusBarData ); 88cdf0e10cSrcweir 89cdf0e10cSrcweir protected: 90cdf0e10cSrcweir void StateChanged( StateChangedType nType ); 91cdf0e10cSrcweir void DataChanged( const DataChangedEvent& rDCEvt ); 92cdf0e10cSrcweir void UserDraw( const UserDrawEvent& rUDEvt ); 93cdf0e10cSrcweir void Command( const CommandEvent& rEvt ); 94cdf0e10cSrcweir void MouseMove( const MouseEvent& rMEvt ); 95cdf0e10cSrcweir void MouseButtonDown( const MouseEvent& rMEvt ); 96cdf0e10cSrcweir void MouseButtonUp( const MouseEvent& rMEvt ); 97cdf0e10cSrcweir DECL_LINK( Click, StatusBar* ); 98cdf0e10cSrcweir DECL_LINK( DoubleClick, StatusBar* ); 99cdf0e10cSrcweir 100cdf0e10cSrcweir void RemoveControllers(); 101cdf0e10cSrcweir rtl::OUString RetrieveLabelFromCommand( const rtl::OUString& aCmdURL ); 102cdf0e10cSrcweir void CreateControllers(); 103cdf0e10cSrcweir void UpdateControllers(); 104cdf0e10cSrcweir void AddFrameActionListener(); 105cdf0e10cSrcweir void MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL ::com::sun::star::frame::XStatusbarController::*_pMethod )(const ::com::sun::star::awt::MouseEvent&)); 106cdf0e10cSrcweir 107cdf0e10cSrcweir protected: 108*d3bacab6SAriel Constenla-Haile typedef std::map< sal_uInt16, ::com::sun::star::uno::Reference< com::sun::star::frame::XStatusbarController > > StatusBarControllerMap; 109cdf0e10cSrcweir 110cdf0e10cSrcweir sal_Bool m_bDisposed : 1, 111cdf0e10cSrcweir m_bFrameActionRegistered : 1, 112cdf0e10cSrcweir m_bUpdateControllers : 1; 113cdf0e10cSrcweir sal_Bool m_bModuleIdentified; 114cdf0e10cSrcweir StatusBar* m_pStatusBar; 115cdf0e10cSrcweir rtl::OUString m_aModuleIdentifier; 116cdf0e10cSrcweir rtl::OUString m_aResourceName; 117cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::frame::XFrame > m_xFrame; 118cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > m_xUICommandLabels; 1192503e1a5SAriel Constenla-Haile StatusBarControllerMap m_aControllerMap; 120cdf0e10cSrcweir ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener 121cdf0e10cSrcweir ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; 122dccf82beSAriel Constenla-Haile ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerFactory > m_xStatusbarControllerFactory; 123cdf0e10cSrcweir }; 124cdf0e10cSrcweir 125cdf0e10cSrcweir } 126cdf0e10cSrcweir 127cdf0e10cSrcweir #endif // __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_ 128