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 <ToolBarManager.hxx>
23 #include <tools/link.hxx>
24 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
25 #include <com/sun/star/ui/XContextChangeEventListener.hpp>
26 #include <comphelper/compbase.hxx>
27 #include <o3tl/deleter.hxx>
28 #include <rtl/ref.hxx>
31 namespace com::sun::star::drawing::framework
33 class XConfigurationController
;
36 namespace com::sun::star::frame
48 class EventMultiplexerEvent
;
51 namespace sd::framework
{
53 typedef comphelper::WeakComponentImplHelper
<
54 css::drawing::framework::XConfigurationChangeListener
55 > ToolBarModuleInterfaceBase
;
57 /** This module is responsible for locking the ToolBarManager during
58 configuration updates and for triggering ToolBarManager updates.
60 class ToolBarModule final
61 : public ToolBarModuleInterfaceBase
64 /** Create a new module.
66 This is the access point to the drawing framework.
68 explicit ToolBarModule (
69 const rtl::Reference
<sd::DrawController
>& rxController
);
70 virtual ~ToolBarModule() override
;
72 virtual void disposing(std::unique_lock
<std::mutex
>&) override
;
74 // XConfigurationChangeListener
76 virtual void SAL_CALL
notifyConfigurationChange (
77 const css::drawing::framework::ConfigurationChangeEvent
& rEvent
) override
;
81 virtual void SAL_CALL
disposing (
82 const css::lang::EventObject
& rEvent
) override
;
86 css::drawing::framework::XConfigurationController
> mxConfigurationController
;
87 ViewShellBase
* mpBase
;
88 std::unique_ptr
<ToolBarManager::UpdateLock
, o3tl::default_delete
<ToolBarManager::UpdateLock
>> mpToolBarManagerLock
;
89 bool mbMainViewSwitchUpdatePending
;
90 bool mbListeningEventMultiplexer
= false;
92 /** Update toolbars via ToolbarManager
94 @param pViewShell may be nullptr
96 void UpdateToolbars(ViewShell
* pViewShell
);
98 void HandleUpdateStart();
99 void HandleUpdateEnd();
100 void HandlePaneViewShellFocused(
101 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxResourceId
);
103 DECL_LINK(EventMultiplexerListener
, ::sd::tools::EventMultiplexerEvent
&, void);
106 } // end of namespace sd::framework
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */