LibreOffice Module sd (master) 1
ToolBarManager.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 "ShellFactory.hxx"
23#include <rtl/ustring.hxx>
24
25#include <sal/types.h>
26#include <memory>
27#include <utility>
28
29class SdrView;
30namespace sd { class ViewShell; }
31namespace sd::tools { class EventMultiplexer; }
32
33namespace sd {
34
35class ViewShellBase;
36class ViewShellManager;
37
60 : public std::enable_shared_from_this<ToolBarManager>
61{
62public:
66 static std::shared_ptr<ToolBarManager> Create (
67 ViewShellBase& rBase,
68 const std::shared_ptr<tools::EventMultiplexer>& rpMultiplexer,
69 const std::shared_ptr<ViewShellManager>& rpViewShellManager);
70
72
78 void Shutdown();
79
89 void MainViewShellChanged (const ViewShell& rMainViewShell);
90
95 const ViewShell& rViewShell,
96 const SdrView& rView);
97
100 constexpr static OUStringLiteral msToolBar = u"toolbar"; // Draw_Toolbox_Sd, 23011
101 constexpr static OUStringLiteral msOptionsToolBar = u"optionsbar";
102 // Draw_Options_Toolbox, 23020
103 constexpr static OUStringLiteral msCommonTaskToolBar = u"commontaskbar";
104 // Draw_CommonTask_Toolbox, 23021
105 constexpr static OUStringLiteral msViewerToolBar = u"viewerbar"; // Draw_Viewer_Toolbox, 23023
106 constexpr static OUStringLiteral msSlideSorterToolBar = u"slideviewtoolbar";
107 // Slide_Toolbox, 23012
108 constexpr static OUStringLiteral msSlideSorterObjectBar = u"slideviewobjectbar";
109 // Slide_Obj_Toolbox, 23014
110 constexpr static OUStringLiteral msOutlineToolBar = u"outlinetoolbar"; // Outline_Toolbox, 23017
111 constexpr static OUStringLiteral msMasterViewToolBar = u"masterviewtoolbar";
112 // SID_MASTERPAGE, 27053
113 constexpr static OUStringLiteral msDrawingObjectToolBar = u"drawingobjectbar";
114 // Draw_Obj_Toolbox, 23013
115 constexpr static OUStringLiteral msGluePointsToolBar = u"gluepointsobjectbar";
116 // Gluepoints_Toolbox, 23019
117 constexpr static OUStringLiteral msTextObjectBar = u"textobjectbar";
118 // Draw_Text_Toolbox_Sd, 23016
119 constexpr static OUStringLiteral msBezierObjectBar = u"bezierobjectbar";
120 // Bezier_Toolbox_Sd, 23015
121 constexpr static OUStringLiteral msGraphicObjectBar = u"graphicobjectbar";
122 // Draw_Graf_Toolbox, 23030
123 constexpr static OUStringLiteral msMediaObjectBar = u"mediaobjectbar";
124 // Draw_Media_Toolbox, 23031
125 constexpr static OUStringLiteral msTableObjectBar = u"tableobjectbar";
126 // Draw_Table_Toolbox, 23018
127
130 enum class ToolBarGroup {
131 Permanent,
132 Function,
133 CommonTask,
134 MasterMode,
135 LAST = MasterMode
136 };
137
146 void ResetToolBars (ToolBarGroup eGroup);
147
153 void ResetAllToolBars();
154
167 void AddToolBar (
168 ToolBarGroup eGroup,
169 const OUString& rsToolBarName);
170
182 void AddToolBarShell (
183 ToolBarGroup eGroup,
184 ShellId nToolBarId);
185
191 void RemoveToolBar (
192 ToolBarGroup eGroup,
193 const OUString& rsToolBarName);
194
208 void SetToolBar (
209 ToolBarGroup eGroup,
210 const OUString& rsToolBarName);
211
226 void SetToolBarShell (
227 ToolBarGroup eGroup,
228 ShellId nToolBarId);
229
230 void PreUpdate();
231
235 void RequestUpdate();
236
243
248 class UpdateLock { public:
249 UpdateLock(std::shared_ptr<ToolBarManager> pManager)
250 : mpManager(std::move(pManager)) { mpManager->LockUpdate(); }
251 ~UpdateLock() COVERITY_NOEXCEPT_FALSE { mpManager->UnlockUpdate(); }
252 private:
253 std::shared_ptr<ToolBarManager> mpManager;
254 };
255 friend class UpdateLock;
256
257 void ToolBarsDestroyed();
258
259private:
260 class Implementation;
261 std::unique_ptr<Implementation> mpImpl;
262
267
268 void LockUpdate();
269 void UnlockUpdate();
270};
271
272} // end of namespace sd
273
274/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Use this class to prevent the visible tool bars from being updated (and thus causing repaints and GUI...
UpdateLock(std::shared_ptr< ToolBarManager > pManager)
std::shared_ptr< ToolBarManager > mpManager
~UpdateLock() COVERITY_NOEXCEPT_FALSE
Manage the set of visible tool bars (and object bars).
static constexpr OUStringLiteral msCommonTaskToolBar
static constexpr OUStringLiteral msSlideSorterToolBar
static constexpr OUStringLiteral msOutlineToolBar
void AddToolBarShell(ToolBarGroup eGroup, ShellId nToolBarId)
Add the tool bar shell to the shell stack.
ToolBarGroup
The set of tool bar groups.
static constexpr OUStringLiteral msBezierObjectBar
void RequestUpdate()
Request an update of the active tool bars.
void MainViewShellChanged()
When the view in the center pane changes then this method sets up the initial set of tool bars for th...
std::unique_ptr< Implementation > mpImpl
void LockViewShellManager()
This is a hint for the ToolBarManager to improve the performance when it updates its tool bars when i...
void AddToolBar(ToolBarGroup eGroup, const OUString &rsToolBarName)
Add the tool bar with the given name to the specified group of tool bars.
void SetToolBarShell(ToolBarGroup eGroup, ShellId nToolBarId)
This is basically a shortcut for ResetToolBars(),AddToolBar().
void RemoveToolBar(ToolBarGroup eGroup, const OUString &rsToolBarName)
Remove the tool bar with the given name from the specified group.
void SetToolBar(ToolBarGroup eGroup, const OUString &rsToolBarName)
This is basically a shortcut for ResetToolBars(),AddToolBar().
static constexpr OUStringLiteral msGluePointsToolBar
static constexpr OUStringLiteral msSlideSorterObjectBar
static constexpr OUStringLiteral msDrawingObjectToolBar
static constexpr OUStringLiteral msOptionsToolBar
static constexpr OUStringLiteral msTextObjectBar
void SelectionHasChanged(const ViewShell &rViewShell, const SdrView &rView)
Call this method when the selection has changed to update the more temporary tool bars (those in the ...
void ResetAllToolBars()
Reset all tool bars, regardless of the group they belong to.
void ResetToolBars(ToolBarGroup eGroup)
Reset the set of visible object bars in the specified group.
static constexpr OUStringLiteral msMediaObjectBar
static constexpr OUStringLiteral msMasterViewToolBar
void Shutdown()
Call this method prior to the destructor to prevent the ToolBarManager from accessing the ViewShellMa...
static constexpr OUStringLiteral msToolBar
The set of tool bars that are handled by this manager class.
static constexpr OUStringLiteral msViewerToolBar
ToolBarManager()
The ViewShellBase is used to get the XLayoutManager and to determine the plug in mode.
static constexpr OUStringLiteral msGraphicObjectBar
static constexpr OUStringLiteral msTableObjectBar
static std::shared_ptr< ToolBarManager > Create(ViewShellBase &rBase, const std::shared_ptr< tools::EventMultiplexer > &rpMultiplexer, const std::shared_ptr< ViewShellManager > &rpViewShellManager)
Use this method instead of the constructor to create new objects of this class.
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
float u
@ Function
ToolbarId