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 .
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"
27 #include <boost/shared_ptr.hpp>
28 #include <boost/weak_ptr.hpp>
35 /** This class contains (will contain) the implementation of methods that
36 have not be accessible from the outside.
38 class ViewShell::Implementation
41 bool mbIsShowingUIControls
;
42 bool mbIsMainViewShell
;
43 /// Set to true when the ViewShell::Init() method has been called.
45 /** Set to true while ViewShell::ArrangeGUIElements() is being
46 executed. It is used as guard against recursive execution.
50 /** Remember a link to the sub shell factory, so that it can be
51 unregistered at the ViewShellManager when a ViewShell is deleted.
53 ViewShellManager::SharedShellFactory mpSubShellFactory
;
55 /** This update lock for the ToolBarManager exists in order to avoid
56 problems with tool bars being displayed while the mouse button is
57 pressed. With docked tool bars this can lead to a size change of
58 the view. This would change the relative mouse coordinates and thus
59 interpret every mouse click as move command.
61 class ToolBarManagerLock
64 /** Create a new instance. This allows the mpSelf member to be set
67 static ::boost::shared_ptr
<ToolBarManagerLock
> Create (
68 const ::boost::shared_ptr
<ToolBarManager
>& rpManager
);
69 /** Release the lock. When the UI is captured
70 (Application::IsUICaptured() returns <TRUE/>) then the lock is
71 released later asynchronously.
73 When this flag is <TRUE/> then the lock is released even
74 when IsUICaptured() returns <TRUE/>.
76 void Release (bool bForce
= false);
77 DECL_LINK_TYPED(TimeoutCallback
, Timer
*, void);
79 ::std::unique_ptr
<ToolBarManager::UpdateLock
> mpLock
;
80 /** The timer is used both as a safe guard to unlock the update lock
81 when Release() is not called explicitly. It is also used to
82 defer the release of the lock to a time when the UI is not
86 /** The shared_ptr to this allows the ToolBarManagerLock to control
87 its own lifetime. This, of course, does work only when no one
88 holds another shared_ptr longer than only temporary.
90 ::boost::shared_ptr
<ToolBarManagerLock
> mpSelf
;
91 ToolBarManagerLock (const ::boost::shared_ptr
<sd::ToolBarManager
>& rpManager
);
92 ~ToolBarManagerLock();
97 // The member is not a unqiue_ptr because it takes over its own life time
99 ::boost::weak_ptr
<ToolBarManagerLock
> mpUpdateLockForMouse
;
101 Implementation (ViewShell
& rViewShell
);
104 /** Process the SID_MODIFY slot.
106 void ProcessModifyPageSlot (
107 SfxRequest
& rRequest
,
108 SdPage
* pCurrentPage
,
111 /** Assign the given layout to the given page. This method is at the
112 moment merely a front end for ProcessModifyPageSlot.
114 If a NULL pointer is given then this call is ignored.
116 void AssignLayout ( SfxRequest
& rRequest
, PageKind ePageKind
);
118 /** Determine the view id of the view shell. This corresponds to the
119 view id stored in the SfxViewFrame class.
121 We can not use the view of that class because with the introduction
122 of the multi pane GUI we do not switch the SfxViewShell anymore when
123 switching the view in the center pane. The view id of the
124 SfxViewFrame is thus not modified and we can not set it from the
127 The view id is still needed for the SFX to determine on start up
128 (e.g. after loading a document) which ViewShellBase sub class to
129 use. These sub classes--like OutlineViewShellBase--exist only to be
130 used by the SFX as factories. They only set the initial pane
131 configuration, nothing more.
133 So what we do here in essence is to return on of the
134 ViewShellFactoryIds that can be used to select the factory that
135 creates the ViewShellBase subclass with the initial pane
136 configuration that has in the center pane a view shell of the same
139 sal_uInt16
GetViewId();
141 /** Return a pointer to the image map dialog that is displayed in some
144 Returns <NULL/> when the image map dialog is not available.
146 static SvxIMapDlg
* GetImageMapDialog();
149 ViewShell
& mrViewShell
;
152 } // end of namespace sd
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */