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 INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARMANAGER_HXX
21 #define INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARMANAGER_HXX
23 #include <macros/generic.hxx>
24 #include <macros/xinterface.hxx>
25 #include <macros/xtypeprovider.hxx>
28 #include <com/sun/star/frame/XFrame.hpp>
29 #include <com/sun/star/frame/XStatusbarController.hpp>
30 #include <com/sun/star/frame/XUIControllerFactory.hpp>
31 #include <com/sun/star/ui/XUIConfiguration.hpp>
32 #include <com/sun/star/frame/XModuleManager.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
34 #include <com/sun/star/container/XNameAccess.hpp>
36 #include <rtl/ustring.hxx>
37 #include <cppuhelper/implbase3.hxx>
38 #include <cppuhelper/interfacecontainer.hxx>
39 #include <vcl/status.hxx>
40 #include <vcl/vclptr.hxx>
46 class FrameworkStatusBar
;
47 class StatusBarManager
: public ::cppu::WeakImplHelper3
<
48 css::frame::XFrameActionListener
,
49 css::lang::XComponent
,
50 css::ui::XUIConfigurationListener
>
53 friend class FrameworkStatusBar
;
56 StatusBarManager( const com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>& rxContext
,
57 const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& rFrame
,
58 const OUString
& rResourceName
,
59 StatusBar
* pStatusBar
);
60 virtual ~StatusBarManager();
62 StatusBar
* GetStatusBar() const;
64 // XFrameActionListener
65 virtual void SAL_CALL
frameAction( const com::sun::star::frame::FrameActionEvent
& Action
) throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
68 virtual void SAL_CALL
disposing( const com::sun::star::lang::EventObject
& Source
) throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
70 // XUIConfigurationListener
71 virtual void SAL_CALL
elementInserted( const ::com::sun::star::ui::ConfigurationEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
72 virtual void SAL_CALL
elementRemoved( const ::com::sun::star::ui::ConfigurationEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
73 virtual void SAL_CALL
elementReplaced( const ::com::sun::star::ui::ConfigurationEvent
& Event
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
76 void SAL_CALL
dispose() throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
77 void SAL_CALL
addEventListener( const com::sun::star::uno::Reference
< XEventListener
>& xListener
) throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
78 void SAL_CALL
removeEventListener( const com::sun::star::uno::Reference
< XEventListener
>& xListener
) throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
80 void FillStatusBar( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexAccess
>& rStatusBarData
);
83 void DataChanged( const DataChangedEvent
& rDCEvt
);
84 void UserDraw( const UserDrawEvent
& rUDEvt
);
85 void Command( const CommandEvent
& rEvt
);
86 void MouseMove( const MouseEvent
& rMEvt
);
87 void MouseButtonDown( const MouseEvent
& rMEvt
);
88 void MouseButtonUp( const MouseEvent
& rMEvt
);
89 DECL_LINK(Click
, void *);
90 DECL_LINK(DoubleClick
, void *);
92 void RemoveControllers();
93 OUString
RetrieveLabelFromCommand( const OUString
& aCmdURL
);
94 void CreateControllers();
95 void UpdateControllers();
96 void AddFrameActionListener();
97 void MouseButton( const MouseEvent
& rMEvt
,sal_Bool ( SAL_CALL ::com::sun::star::frame::XStatusbarController::*_pMethod
)(const ::com::sun::star::awt::MouseEvent
&));
100 typedef std::map
< sal_uInt16
, ::com::sun::star::uno::Reference
< com::sun::star::frame::XStatusbarController
> > StatusBarControllerMap
;
102 bool m_bDisposed
: 1,
103 m_bFrameActionRegistered
: 1,
104 m_bUpdateControllers
: 1;
105 bool m_bModuleIdentified
;
106 VclPtr
<StatusBar
> m_pStatusBar
;
107 OUString m_aModuleIdentifier
;
108 OUString m_aResourceName
;
109 com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
> m_xFrame
;
110 com::sun::star::uno::Reference
< com::sun::star::container::XNameAccess
> m_xUICommandLabels
;
111 StatusBarControllerMap m_aControllerMap
;
113 ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer
; /// container for ALL Listener
114 ::com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
> m_xContext
;
115 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XUIControllerFactory
> m_xStatusbarControllerFactory
;
120 #endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_STATUSBARMANAGER_HXX
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */