calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / framework / inc / uielement / styletoolbarcontroller.hxx
blob45b1ad7ecccedd82410dcca8a645518cd1a50f05
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
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/.
8 */
10 #pragma once
12 #include <svtools/toolboxcontroller.hxx>
13 #include <com/sun/star/frame/XDispatchProvider.hpp>
15 namespace framework {
17 /**
18 * A dispatcher that serves as a proxy for style commands with arguments
19 * i.e. .uno:StyleApply?... in order to provide useful status updates to
20 * generic UI elements such as toolbars or menubar. It listens to special
21 * status commands, and computes a boolean status out of them. Then it
22 * forwards that boolean status to the listener, as if it was the status
23 * of the original command.
25 * Note that the implementation is minimal: Although the UI element appears
26 * to be the owner of the dispatcher, it's still responsible, as usual, to
27 * call removeStatusListener same amount of times as addStatusListener,
28 * otherwise the dispatcher might not be destructed. In addition this
29 * implementation might hold a hard reference on the owner, and it's the
30 * responsibility of the owner to destroy the dispatcher first, in order
31 * to break the cycle.
33 class StyleDispatcher final : public cppu::WeakImplHelper< css::frame::XDispatch, css::frame::XStatusListener >
35 public:
36 StyleDispatcher( const css::uno::Reference< css::frame::XFrame >& rFrame,
37 css::uno::Reference< css::util::XURLTransformer > xUrlTransformer,
38 const css::util::URL& rURL );
40 // XDispatch
41 void SAL_CALL dispatch( const css::util::URL& rURL, const css::uno::Sequence< css::beans::PropertyValue >& rArguments ) override;
42 void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& rListener, const css::util::URL& rURL ) override;
43 void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& rListener, const css::util::URL& rURL ) override;
45 // XStatusListener
46 void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
48 // XEventListener
49 void SAL_CALL disposing( const css::lang::EventObject& rSource ) override;
51 private:
52 OUString m_aStyleName, m_aCommand, m_aStatusCommand;
53 css::uno::Reference< css::util::XURLTransformer > m_xUrlTransformer;
54 css::uno::Reference< css::frame::XDispatchProvider > m_xFrame;
55 css::uno::Reference< css::frame::XDispatch > m_xStatusDispatch;
56 css::uno::Reference< css::frame::XStatusListener > m_xOwner;
59 class StyleToolbarController final : public svt::ToolboxController
61 public:
62 StyleToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rContext,
63 const css::uno::Reference< css::frame::XFrame >& rFrame,
64 const OUString& rCommand );
66 // XUpdatable
67 void SAL_CALL update() override;
69 // XStatusListener
70 void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
72 // XComponent
73 void SAL_CALL dispose() override;
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */