1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_
21 #define __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_
23 #include <threadhelp/threadhelpbase.hxx>
24 #include <macros/generic.hxx>
25 #include <macros/xinterface.hxx>
26 #include <macros/xtypeprovider.hxx>
29 #include <com/sun/star/frame/XFrame.hpp>
30 #include <com/sun/star/frame/XStatusListener.hpp>
31 #include <com/sun/star/frame/XStatusbarController.hpp>
32 #include <com/sun/star/frame/XUIControllerFactory.hpp>
33 #include <com/sun/star/ui/XUIConfiguration.hpp>
34 #include <com/sun/star/frame/XModuleManager.hpp>
35 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
36 #include <com/sun/star/container/XNameAccess.hpp>
38 #include <rtl/ustring.hxx>
39 #include <cppuhelper/weak.hxx>
40 #include <cppuhelper/interfacecontainer.hxx>
41 #include <vcl/status.hxx>
47 class FrameworkStatusBar
;
48 class StatusBarManager
: public ::com::sun::star::frame::XFrameActionListener
,
49 public ::com::sun::star::lang::XComponent
,
50 public ::com::sun::star::lang::XTypeProvider
,
51 public ::com::sun::star::ui::XUIConfigurationListener
,
52 public ThreadHelpBase
,
53 public ::cppu::OWeakObject
55 friend class FrameworkStatusBar
;
58 StatusBarManager( const com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>& rServicveManager
,
59 const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& rFrame
,
60 const OUString
& rResourceName
,
61 StatusBar
* pStatusBar
);
62 virtual ~StatusBarManager();
64 // XInterface, XTypeProvider, XServiceInfo
65 FWK_DECLARE_XINTERFACE
66 FWK_DECLARE_XTYPEPROVIDER
68 StatusBar
* GetStatusBar() const;
70 // XFrameActionListener
71 virtual void SAL_CALL
frameAction( const com::sun::star::frame::FrameActionEvent
& Action
) throw ( ::com::sun::star::uno::RuntimeException
);
74 virtual void SAL_CALL
disposing( const com::sun::star::lang::EventObject
& Source
) throw ( ::com::sun::star::uno::RuntimeException
);
76 // XUIConfigurationListener
77 virtual void SAL_CALL
elementInserted( const ::com::sun::star::ui::ConfigurationEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
);
78 virtual void SAL_CALL
elementRemoved( const ::com::sun::star::ui::ConfigurationEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
);
79 virtual void SAL_CALL
elementReplaced( const ::com::sun::star::ui::ConfigurationEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
);
82 void SAL_CALL
dispose() throw ( ::com::sun::star::uno::RuntimeException
);
83 void SAL_CALL
addEventListener( const com::sun::star::uno::Reference
< XEventListener
>& xListener
) throw( com::sun::star::uno::RuntimeException
);
84 void SAL_CALL
removeEventListener( const com::sun::star::uno::Reference
< XEventListener
>& xListener
) throw( com::sun::star::uno::RuntimeException
);
86 void FillStatusBar( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexAccess
>& rStatusBarData
);
89 void StateChanged( StateChangedType nType
);
90 void DataChanged( const DataChangedEvent
& rDCEvt
);
91 void UserDraw( const UserDrawEvent
& rUDEvt
);
92 void Command( const CommandEvent
& rEvt
);
93 void MouseMove( const MouseEvent
& rMEvt
);
94 void MouseButtonDown( const MouseEvent
& rMEvt
);
95 void MouseButtonUp( const MouseEvent
& rMEvt
);
96 DECL_LINK(Click
, void *);
97 DECL_LINK(DoubleClick
, void *);
99 void RemoveControllers();
100 OUString
RetrieveLabelFromCommand( const OUString
& aCmdURL
);
101 void CreateControllers();
102 void UpdateControllers();
103 void AddFrameActionListener();
104 void MouseButton( const MouseEvent
& rMEvt
,sal_Bool ( SAL_CALL ::com::sun::star::frame::XStatusbarController::*_pMethod
)(const ::com::sun::star::awt::MouseEvent
&));
107 typedef std::map
< sal_uInt16
, ::com::sun::star::uno::Reference
< com::sun::star::frame::XStatusListener
> > StatusBarControllerMap
;
109 sal_Bool m_bDisposed
: 1,
110 m_bFrameActionRegistered
: 1,
111 m_bUpdateControllers
: 1;
112 sal_Bool m_bModuleIdentified
;
113 StatusBar
* m_pStatusBar
;
114 OUString m_aModuleIdentifier
;
115 OUString m_aResourceName
;
116 com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
> m_xFrame
;
117 com::sun::star::uno::Reference
< com::sun::star::container::XNameAccess
> m_xUICommandLabels
;
118 StatusBarControllerMap m_aControllerMap
;
119 ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer
; /// container for ALL Listener
120 ::com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
> m_xServiceManager
;
121 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XUIControllerFactory
> m_xStatusbarControllerFactory
;
126 #endif // __FRAMEWORK_UIELEMENT_STATUSBARMANAGER_HXX_
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */