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 SD_VIEW_SHELL_IMPLEMENTATION_HXX
21 #define SD_VIEW_SHELL_IMPLEMENTATION_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>
36 /** This class contains (will contain) the implementation of methods that
37 have not be accessible from the outside.
39 class ViewShell::Implementation
42 bool mbIsShowingUIControls
;
43 bool mbIsMainViewShell
;
44 /// Set to true when the ViewShell::Init() method has been called.
46 /** Set to true while ViewShell::ArrangeGUIElements() is being
47 executed. It is used as guard against recursive execution.
51 /** Remember a link to the sub shell factory, so that it can be
52 unregistered at the ViewShellManager when a ViewShell is deleted.
54 ViewShellManager::SharedShellFactory mpSubShellFactory
;
56 /** This update lock for the ToolBarManager exists in order to avoid
57 problems with tool bars being displayed while the mouse button is
58 pressed. With docked tool bars this can lead to a size change of
59 the view. This would change the relative mouse coordinates and thus
60 interpret every mouse click as move command.
62 class ToolBarManagerLock
65 /** Create a new instance. This allows the mpSelf member to be set
68 static ::boost::shared_ptr
<ToolBarManagerLock
> Create (
69 const ::boost::shared_ptr
<ToolBarManager
>& rpManager
);
70 /** Release the lock. When the UI is captured
71 (Application::IsUICaptured() returns <TRUE/>) then the lock is
72 released later asynchronously.
74 When this flag is <TRUE/> then the lock is released even
75 when IsUICaptured() returns <TRUE/>.
77 void Release (bool bForce
= false);
78 DECL_LINK(TimeoutCallback
, void *);
80 ::std::auto_ptr
<ToolBarManager::UpdateLock
> mpLock
;
81 /** The timer is used both as a safe guard to unlock the update lock
82 when Release() is not called explicitly. It is also used to
83 defer the release of the lock to a time when the UI is not
87 /** The shared_ptr to this allows the ToolBarManagerLock to control
88 its own lifetime. This, of course, does work only when no one
89 holds another shared_ptr longer than only temporary.
91 ::boost::shared_ptr
<ToolBarManagerLock
> mpSelf
;
92 ToolBarManagerLock (const ::boost::shared_ptr
<sd::ToolBarManager
>& rpManager
);
93 ~ToolBarManagerLock (void);
98 // The member is not an auto_ptr because it takes over its own life time
100 ::boost::weak_ptr
<ToolBarManagerLock
> mpUpdateLockForMouse
;
102 Implementation (ViewShell
& rViewShell
);
103 ~Implementation (void);
105 /** Process the SID_MODIFY slot.
107 void ProcessModifyPageSlot (
108 SfxRequest
& rRequest
,
109 SdPage
* pCurrentPage
,
112 /** Assign the given layout to the given page. This method is at the
113 moment merely a front end for ProcessModifyPageSlot.
115 If a NULL pointer is given then this call is ignored.
117 void AssignLayout ( SfxRequest
& rRequest
, PageKind ePageKind
);
119 /** Determine the view id of the view shell. This corresponds to the
120 view id stored in the SfxViewFrame class.
122 We can not use the view of that class because with the introduction
123 of the multi pane GUI we do not switch the SfxViewShell anymore when
124 switching the view in the center pane. The view id of the
125 SfxViewFrame is thus not modified and we can not set it from the
128 The view id is still needed for the SFX to determine on start up
129 (e.g. after loading a document) which ViewShellBase sub class to
130 use. These sub classes--like OutlineViewShellBase--exist only to be
131 used by the SFX as factories. They only set the initial pane
132 configuration, nothing more.
134 So what we do here in essence is to return on of the
135 ViewShellFactoryIds that can be used to select the factory that
136 creates the ViewShellBase subclass with the initial pane
137 configuration that has in the center pane a view shell of the same
140 sal_uInt16
GetViewId (void);
142 /** Return a pointer to the image map dialog that is displayed in some
145 Returns <NULL/> when the image map dialog is not available.
147 static SvxIMapDlg
* GetImageMapDialog (void);
150 ViewShell
& mrViewShell
;
154 } // end of namespace sd
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */