1f8e07b45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
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
10f8e07b45SAndrew Rist  *
11f8e07b45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f8e07b45SAndrew Rist  *
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.
19f8e07b45SAndrew Rist  *
20f8e07b45SAndrew Rist  *************************************************************/
21f8e07b45SAndrew Rist 
22f8e07b45SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_
25cdf0e10cSrcweir #define __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_________________________________________________________________________________________________________________
28cdf0e10cSrcweir //	my own includes
29cdf0e10cSrcweir //_________________________________________________________________________________________________________________
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx>
32cdf0e10cSrcweir #include <macros/generic.hxx>
33cdf0e10cSrcweir #include <macros/xinterface.hxx>
34cdf0e10cSrcweir #include <macros/xtypeprovider.hxx>
35cdf0e10cSrcweir #include <stdtypes.h>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir //_________________________________________________________________________________________________________________
38cdf0e10cSrcweir //	interface includes
39cdf0e10cSrcweir //_________________________________________________________________________________________________________________
40cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
41cdf0e10cSrcweir #include <com/sun/star/frame/XStatusListener.hpp>
42cdf0e10cSrcweir #include <com/sun/star/frame/XStatusbarController.hpp>
43cdf0e10cSrcweir #include <com/sun/star/frame/XUIControllerRegistration.hpp>
44cdf0e10cSrcweir #include <com/sun/star/ui/XUIConfiguration.hpp>
45cdf0e10cSrcweir #include <com/sun/star/frame/XModuleManager.hpp>
46cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
47cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir //_________________________________________________________________________________________________________________
50cdf0e10cSrcweir //	other includes
51cdf0e10cSrcweir //_________________________________________________________________________________________________________________
52cdf0e10cSrcweir #include <rtl/ustring.hxx>
53cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
54cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
55cdf0e10cSrcweir #include <vcl/status.hxx>
56*2503e1a5SAriel Constenla-Haile #include <map>
57cdf0e10cSrcweir 
58cdf0e10cSrcweir namespace framework
59cdf0e10cSrcweir {
60cdf0e10cSrcweir 
61cdf0e10cSrcweir class FrameworkStatusBar;
62cdf0e10cSrcweir class StatusBarManager : public ::com::sun::star::frame::XFrameActionListener         ,
63cdf0e10cSrcweir                          public ::com::sun::star::lang::XComponent                    ,
64cdf0e10cSrcweir                          public ::com::sun::star::lang::XTypeProvider                 ,
65cdf0e10cSrcweir                          public ::com::sun::star::ui::XUIConfigurationListener,
66cdf0e10cSrcweir 					     public ThreadHelpBase		                                  ,
67cdf0e10cSrcweir 					     public ::cppu::OWeakObject
68cdf0e10cSrcweir {
69cdf0e10cSrcweir     friend class FrameworkStatusBar;
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     public:
72cdf0e10cSrcweir         StatusBarManager( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServicveManager,
73cdf0e10cSrcweir                           const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
74cdf0e10cSrcweir                           const rtl::OUString& rResourceName,
75cdf0e10cSrcweir                           StatusBar* pStatusBar );
76cdf0e10cSrcweir         virtual ~StatusBarManager();
77cdf0e10cSrcweir 
78cdf0e10cSrcweir         //  XInterface, XTypeProvider, XServiceInfo
79cdf0e10cSrcweir         FWK_DECLARE_XINTERFACE
80cdf0e10cSrcweir         FWK_DECLARE_XTYPEPROVIDER
81cdf0e10cSrcweir 
82cdf0e10cSrcweir         StatusBar* GetStatusBar() const;
83cdf0e10cSrcweir 
84cdf0e10cSrcweir         // XFrameActionListener
85cdf0e10cSrcweir 		virtual void SAL_CALL frameAction( const com::sun::star::frame::FrameActionEvent& Action ) throw ( ::com::sun::star::uno::RuntimeException );
86cdf0e10cSrcweir 
87cdf0e10cSrcweir         // XEventListener
88cdf0e10cSrcweir 		virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException );
89cdf0e10cSrcweir 
90cdf0e10cSrcweir         // XUIConfigurationListener
91cdf0e10cSrcweir         virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
92cdf0e10cSrcweir         virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
93cdf0e10cSrcweir         virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
94cdf0e10cSrcweir 
95cdf0e10cSrcweir         // XComponent
96cdf0e10cSrcweir         void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
97cdf0e10cSrcweir         void SAL_CALL addEventListener( const com::sun::star::uno::Reference< XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException );
98cdf0e10cSrcweir         void SAL_CALL removeEventListener( const com::sun::star::uno::Reference< XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir         void FillStatusBar( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rStatusBarData );
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     protected:
103cdf0e10cSrcweir         void StateChanged( StateChangedType nType );
104cdf0e10cSrcweir 	    void DataChanged( const DataChangedEvent& rDCEvt );
105cdf0e10cSrcweir 	    void UserDraw( const UserDrawEvent& rUDEvt );
106cdf0e10cSrcweir         void Command( const CommandEvent& rEvt );
107cdf0e10cSrcweir         void MouseMove( const MouseEvent& rMEvt );
108cdf0e10cSrcweir         void MouseButtonDown( const MouseEvent& rMEvt );
109cdf0e10cSrcweir         void MouseButtonUp( const MouseEvent& rMEvt );
110cdf0e10cSrcweir         DECL_LINK( Click, StatusBar* );
111cdf0e10cSrcweir         DECL_LINK( DoubleClick, StatusBar* );
112cdf0e10cSrcweir 
113cdf0e10cSrcweir         void RemoveControllers();
114cdf0e10cSrcweir         rtl::OUString RetrieveLabelFromCommand( const rtl::OUString& aCmdURL );
115cdf0e10cSrcweir         void CreateControllers();
116cdf0e10cSrcweir         void UpdateControllers();
117cdf0e10cSrcweir         void AddFrameActionListener();
118cdf0e10cSrcweir         void MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL ::com::sun::star::frame::XStatusbarController::*_pMethod )(const ::com::sun::star::awt::MouseEvent&));
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     protected:
121*2503e1a5SAriel Constenla-Haile         typedef std::map< sal_uInt16, ::com::sun::star::uno::Reference< com::sun::star::frame::XStatusListener > > StatusBarControllerMap;
122cdf0e10cSrcweir 
123cdf0e10cSrcweir         sal_Bool                                                                                        m_bDisposed : 1,
124cdf0e10cSrcweir                                                                                                         m_bFrameActionRegistered : 1,
125cdf0e10cSrcweir                                                                                                         m_bUpdateControllers : 1;
126cdf0e10cSrcweir         sal_Bool                                                                                        m_bModuleIdentified;
127cdf0e10cSrcweir         StatusBar*                                                                                      m_pStatusBar;
128cdf0e10cSrcweir         rtl::OUString                                                                                   m_aModuleIdentifier;
129cdf0e10cSrcweir         rtl::OUString                                                                                   m_aResourceName;
130cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::frame::XFrame >                                 m_xFrame;
131cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >                        m_xUICommandLabels;
132*2503e1a5SAriel Constenla-Haile         StatusBarControllerMap                                                                          m_aControllerMap;
133cdf0e10cSrcweir         ::cppu::OMultiTypeInterfaceContainerHelper                                                      m_aListenerContainer;   /// container for ALL Listener
134cdf0e10cSrcweir         ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >                  m_xServiceManager;
135cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration >  m_xStatusbarControllerRegistration;
136cdf0e10cSrcweir };
137cdf0e10cSrcweir 
138cdf0e10cSrcweir }
139cdf0e10cSrcweir 
140cdf0e10cSrcweir #endif // __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_
141