bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / inc / ViewShellImplementation.hxx
blob77dfc3ea0dedded8860211b9e044cac73d06ea33
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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 .
20 #ifndef INCLUDED_SD_SOURCE_UI_INC_VIEWSHELLIMPLEMENTATION_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_VIEWSHELLIMPLEMENTATION_HXX
23 #include "ViewShell.hxx"
24 #include "ViewShellManager.hxx"
25 #include "ToolBarManager.hxx"
26 #include <o3tl/deleter.hxx>
27 #include <memory>
29 class SvxIMapDlg;
31 namespace sd {
33 /** This class contains (will contain) the implementation of methods that
34 have not be accessible from the outside.
36 class ViewShell::Implementation
38 public:
39 bool mbIsMainViewShell;
40 /// Set to true when the ViewShell::Init() method has been called.
41 bool mbIsInitialized;
42 /** Set to true while ViewShell::ArrangeGUIElements() is being
43 executed. It is used as guard against recursive execution.
45 bool mbArrangeActive;
47 /** Remember a link to the sub shell factory, so that it can be
48 unregistered at the ViewShellManager when a ViewShell is deleted.
50 ViewShellManager::SharedShellFactory mpSubShellFactory;
52 /** This update lock for the ToolBarManager exists in order to avoid
53 problems with tool bars being displayed while the mouse button is
54 pressed. With docked tool bars this can lead to a size change of
55 the view. This would change the relative mouse coordinates and thus
56 interpret every mouse click as move command.
58 class ToolBarManagerLock
60 public:
61 /** Create a new instance. This allows the mpSelf member to be set
62 automatically.
64 static std::shared_ptr<ToolBarManagerLock> Create (
65 const std::shared_ptr<ToolBarManager>& rpManager);
66 /** Release the lock. When the UI is captured
67 (Application::IsUICaptured() returns <TRUE/>) then the lock is
68 released later asynchronously.
69 @param bForce
70 When this flag is <TRUE/> then the lock is released even
71 when IsUICaptured() returns <TRUE/>.
73 void Release (bool bForce = false);
74 DECL_LINK(TimeoutCallback, Timer *, void);
75 private:
76 ::std::unique_ptr<ToolBarManager::UpdateLock, o3tl::default_delete<ToolBarManager::UpdateLock>> mpLock;
77 /** The timer is used both as a safe guard to unlock the update lock
78 when Release() is not called explicitly. It is also used to
79 defer the release of the lock to a time when the UI is not
80 captured.
82 Timer maTimer;
83 /** The shared_ptr to this allows the ToolBarManagerLock to control
84 its own lifetime. This, of course, does work only when no one
85 holds another shared_ptr longer than only temporary.
87 std::shared_ptr<ToolBarManagerLock> mpSelf;
88 ToolBarManagerLock (const std::shared_ptr<sd::ToolBarManager>& rpManager);
89 ~ToolBarManagerLock();
91 class Deleter;
92 friend class Deleter;
94 // The member is not a unique_ptr because it takes over its own life time
95 // control.
96 std::weak_ptr<ToolBarManagerLock> mpUpdateLockForMouse;
98 Implementation (ViewShell& rViewShell);
99 ~Implementation() COVERITY_NOEXCEPT_FALSE;
101 /** Process the SID_MODIFY slot.
103 void ProcessModifyPageSlot (
104 SfxRequest& rRequest,
105 SdPage* pCurrentPage,
106 PageKind ePageKind);
108 /** Assign the given layout to the given page. This method is at the
109 moment merely a front end for ProcessModifyPageSlot.
110 @param pPage
111 If a NULL pointer is given then this call is ignored.
113 void AssignLayout ( SfxRequest const & rRequest, PageKind ePageKind );
115 /** Determine the view id of the view shell. This corresponds to the
116 view id stored in the SfxViewFrame class.
118 We can not use the view of that class because with the introduction
119 of the multi pane GUI we do not switch the SfxViewShell anymore when
120 switching the view in the center pane. The view id of the
121 SfxViewFrame is thus not modified and we can not set it from the
122 outside.
124 The view id is still needed for the SFX to determine on start up
125 (e.g. after loading a document) which ViewShellBase sub class to
126 use. These sub classes--like OutlineViewShellBase--exist only to be
127 used by the SFX as factories. They only set the initial pane
128 configuration, nothing more.
130 So what we do here in essence is to return one of the
131 ViewShellFactoryIds that can be used to select the factory that
132 creates the ViewShellBase subclass with the initial pane
133 configuration that has in the center pane a view shell of the same
134 type as mrViewShell.
136 SfxInterfaceId GetViewId();
138 /** Return a pointer to the image map dialog that is displayed in some
139 child window.
140 @return
141 Returns <NULL/> when the image map dialog is not available.
143 static SvxIMapDlg* GetImageMapDialog();
145 private:
146 ViewShell& mrViewShell;
149 } // end of namespace sd
151 #endif
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */