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 .
22 #include <com/sun/star/frame/XFrame.hpp>
23 #include <com/sun/star/frame/XStatusbarController.hpp>
24 #include <com/sun/star/frame/XUIControllerFactory.hpp>
25 #include <com/sun/star/ui/XUIConfigurationListener.hpp>
26 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <cppuhelper/implbase.hxx>
29 #include <comphelper/interfacecontainer4.hxx>
30 #include <vcl/status.hxx>
31 #include <vcl/vclptr.hxx>
38 class FrameworkStatusBar
;
39 class StatusBarManager final
: public ::cppu::WeakImplHelper
<
40 css::frame::XFrameActionListener
,
41 css::lang::XComponent
,
42 css::ui::XUIConfigurationListener
>
45 friend class FrameworkStatusBar
;
48 StatusBarManager( css::uno::Reference
< css::uno::XComponentContext
> xContext
,
49 css::uno::Reference
< css::frame::XFrame
> xFrame
,
50 StatusBar
* pStatusBar
);
51 virtual ~StatusBarManager() override
;
53 StatusBar
* GetStatusBar() const;
55 // XFrameActionListener
56 virtual void SAL_CALL
frameAction( const css::frame::FrameActionEvent
& Action
) override
;
59 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
61 // XUIConfigurationListener
62 virtual void SAL_CALL
elementInserted( const css::ui::ConfigurationEvent
& Event
) override
;
63 virtual void SAL_CALL
elementRemoved( const css::ui::ConfigurationEvent
& Event
) override
;
64 virtual void SAL_CALL
elementReplaced( const css::ui::ConfigurationEvent
& Event
) override
;
67 void SAL_CALL
dispose() override
;
68 void SAL_CALL
addEventListener( const css::uno::Reference
< XEventListener
>& xListener
) override
;
69 void SAL_CALL
removeEventListener( const css::uno::Reference
< XEventListener
>& xListener
) override
;
71 void FillStatusBar( const css::uno::Reference
< css::container::XIndexAccess
>& rStatusBarData
);
74 void DataChanged( const DataChangedEvent
& rDCEvt
);
75 void UserDraw( const UserDrawEvent
& rUDEvt
);
76 void Command( const CommandEvent
& rEvt
);
77 void MouseMove( const MouseEvent
& rMEvt
);
78 void MouseButtonDown( const MouseEvent
& rMEvt
);
79 void MouseButtonUp( const MouseEvent
& rMEvt
);
80 DECL_LINK(Click
, StatusBar
*, void);
81 DECL_LINK(DoubleClick
, StatusBar
*, void);
83 void RemoveControllers();
84 void CreateControllers();
85 void UpdateControllers();
86 void MouseButton( const MouseEvent
& rMEvt
,sal_Bool ( SAL_CALL
css::frame::XStatusbarController::*_pMethod
)(const css::awt::MouseEvent
&));
88 typedef std::map
< sal_uInt16
, css::uno::Reference
< css::frame::XStatusbarController
> > StatusBarControllerMap
;
91 m_bFrameActionRegistered
: 1,
92 m_bUpdateControllers
: 1;
93 VclPtr
<StatusBar
> m_pStatusBar
;
94 css::uno::Reference
< css::frame::XFrame
> m_xFrame
;
95 StatusBarControllerMap m_aControllerMap
;
97 comphelper::OInterfaceContainerHelper4
<XEventListener
> m_aListenerContainer
;
98 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
99 css::uno::Reference
< css::frame::XUIControllerFactory
> m_xStatusbarControllerFactory
;
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */