LibreOffice Module framework (master) 1
statusbarmanager.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
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>
27
30#include <vcl/status.hxx>
31#include <vcl/vclptr.hxx>
32#include <map>
33#include <mutex>
34
35namespace framework
36{
37
38class FrameworkStatusBar;
39class StatusBarManager final: public ::cppu::WeakImplHelper<
40 css::frame::XFrameActionListener,
41 css::lang::XComponent,
42 css::ui::XUIConfigurationListener >
43
44{
45 friend class FrameworkStatusBar;
46
47 public:
48 StatusBarManager( css::uno::Reference< css::uno::XComponentContext > xContext,
49 css::uno::Reference< css::frame::XFrame > xFrame,
50 StatusBar* pStatusBar );
51 virtual ~StatusBarManager() override;
52
53 StatusBar* GetStatusBar() const;
54
55 // XFrameActionListener
56 virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& Action ) override;
57
58 // XEventListener
59 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
60
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;
65
66 // XComponent
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;
70
71 void FillStatusBar( const css::uno::Reference< css::container::XIndexAccess >& rStatusBarData );
72
73 private:
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);
82
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&));
87
88 typedef std::map< sal_uInt16, css::uno::Reference< css::frame::XStatusbarController > > StatusBarControllerMap;
89
90 bool m_bDisposed : 1,
94 css::uno::Reference< css::frame::XFrame > m_xFrame;
96 std::mutex m_mutex;
98 css::uno::Reference< css::uno::XComponentContext > m_xContext;
99 css::uno::Reference< css::frame::XUIControllerFactory > m_xStatusbarControllerFactory;
100};
101
102}
103
104/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent &Action) override
css::uno::Reference< css::frame::XUIControllerFactory > m_xStatusbarControllerFactory
void MouseButton(const MouseEvent &rMEvt, sal_Bool(SAL_CALL css::frame::XStatusbarController::*_pMethod)(const css::awt::MouseEvent &))
virtual ~StatusBarManager() override
void DataChanged(const DataChangedEvent &rDCEvt)
VclPtr< StatusBar > m_pStatusBar
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
void UserDraw(const UserDrawEvent &rUDEvt)
css::uno::Reference< css::uno::XComponentContext > m_xContext
StatusBarControllerMap m_aControllerMap
virtual void SAL_CALL elementRemoved(const css::ui::ConfigurationEvent &Event) override
void Command(const CommandEvent &rEvt)
std::map< sal_uInt16, css::uno::Reference< css::frame::XStatusbarController > > StatusBarControllerMap
DECL_LINK(DoubleClick, StatusBar *, void)
css::uno::Reference< css::frame::XFrame > m_xFrame
void MouseButtonDown(const MouseEvent &rMEvt)
virtual void SAL_CALL elementReplaced(const css::ui::ConfigurationEvent &Event) override
DECL_LINK(Click, StatusBar *, void)
void MouseButtonUp(const MouseEvent &rMEvt)
comphelper::OInterfaceContainerHelper4< XEventListener > m_aListenerContainer
void SAL_CALL addEventListener(const css::uno::Reference< XEventListener > &xListener) override
void MouseMove(const MouseEvent &rMEvt)
void FillStatusBar(const css::uno::Reference< css::container::XIndexAccess > &rStatusBarData)
StatusBarManager(css::uno::Reference< css::uno::XComponentContext > xContext, css::uno::Reference< css::frame::XFrame > xFrame, StatusBar *pStatusBar)
void SAL_CALL dispose() override
virtual void SAL_CALL elementInserted(const css::ui::ConfigurationEvent &Event) override
void SAL_CALL removeEventListener(const css::uno::Reference< XEventListener > &xListener) override
StatusBar * GetStatusBar() const
unsigned char sal_Bool