LibreOffice Module sd (master) 1
ViewShellManager.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 <o3tl/deleter.hxx>
24#include <memory>
25#include <utility>
26
27class FmFormShell;
28class SfxShell;
29
30namespace sd
31{
32class ViewShell;
33class ViewShellBase;
34
55{
56public:
57 typedef std::shared_ptr<ShellFactory<SfxShell>> SharedShellFactory;
58
60
65
71 void Shutdown();
72
75 void AddSubShellFactory(ViewShell const* pViewShell, const SharedShellFactory& rpFactory);
76 void RemoveSubShellFactory(ViewShell const* pViewShell, const SharedShellFactory& rpFactory);
77
80 void ActivateViewShell(ViewShell* pViewShell);
81
85 void ActivateShell(SfxShell* pShell);
86
92 void DeactivateViewShell(const ViewShell* pShell);
93
96 void DeactivateShell(const SfxShell* pShell);
97
110 void SetFormShell(const ViewShell* pParentShell, FmFormShell* pFormShell, bool bAbove);
111
121 void ActivateSubShell(const ViewShell& rParentShell, ShellId nId);
122
125 void DeactivateSubShell(const ViewShell& rParentShell, ShellId nId);
126
130 void InvalidateAllSubShells(ViewShell const* pViewShell);
131
145 void MoveToTop(const ViewShell& rShell);
146
155 SfxShell* GetShell(ShellId nId) const;
156
160 SfxShell* GetTopShell() const;
161
164 SfxShell* GetTopViewShell() const;
165
169 {
170 public:
171 UpdateLock(std::shared_ptr<ViewShellManager> pManager)
172 : mpManager(std::move(pManager))
173 {
174 mpManager->LockUpdate();
175 }
176 ~UpdateLock() COVERITY_NOEXCEPT_FALSE { mpManager->UnlockUpdate(); }
177
178 private:
179 std::shared_ptr<ViewShellManager> mpManager;
180 };
181 friend class UpdateLock;
182
183private:
184 class Implementation;
185 std::unique_ptr<ViewShellManager::Implementation,
189
190 void LockUpdate();
191 void UnlockUpdate();
192};
193
194} // end of namespace sd
195
196/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
Use this class to safely lock updates of the view shell stack.
UpdateLock(std::shared_ptr< ViewShellManager > pManager)
std::shared_ptr< ViewShellManager > mpManager
~UpdateLock() COVERITY_NOEXCEPT_FALSE
The ViewShellManager has the responsibility to manage the view shells and sub shells on the SFX shell...
std::shared_ptr< ShellFactory< SfxShell > > SharedShellFactory
void ActivateShell(SfxShell *pShell)
Activate the given shell which is not a view shell.
std::unique_ptr< ViewShellManager::Implementation, o3tl::default_delete< ViewShellManager::Implementation > > mpImpl
void DeactivateSubShell(const ViewShell &rParentShell, ShellId nId)
Deactivate the specified sub shell.
void AddSubShellFactory(ViewShell const *pViewShell, const SharedShellFactory &rpFactory)
Set the factory for sub shells of the specified view shell.
SfxShell * GetShell(ShellId nId) const
Return the first, i.e.
void DeactivateViewShell(const ViewShell *pShell)
Deactivate the specified shell, i.e.
~ViewShellManager()
Before the destructor is called the method Shutdown() has to have been called.
ViewShellManager(ViewShellBase &rBase)
SfxShell * GetTopViewShell() const
Return the top-most active view shell on the internal shell stack.
void InvalidateAllSubShells(ViewShell const *pViewShell)
Send all sub shells of the specified view shell an Invalidate() call.
void DeactivateShell(const SfxShell *pShell)
Deactivate the specified shell.
void Shutdown()
Tell a ViewShellManager object to prepare to be deleted, i.e.
void ActivateViewShell(ViewShell *pViewShell)
Activate the given view shell.
void RemoveSubShellFactory(ViewShell const *pViewShell, const SharedShellFactory &rpFactory)
void ActivateSubShell(const ViewShell &rParentShell, ShellId nId)
Activate the specified shell as sub shell for the given view shell.
void MoveToTop(const ViewShell &rShell)
Move the specified view shell to the top most position on the stack of view shells in relation to the...
void SetFormShell(const ViewShell *pParentShell, FmFormShell *pFormShell, bool bAbove)
Associate the form shell with a view shell and their relative position.
SfxShell * GetTopShell() const
Return the top-most shell on the SFX shell stack regardless of whether that is a view shell or a sub ...
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
ToolbarId