merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / inc / ViewShellImplementation.hxx
blob1e4f5dd34bd72be9c47dc32e8c9c7fe4cd3c3de8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ViewShellImplementation.hxx,v $
10 * $Revision: 1.13 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SD_VIEW_SHELL_IMPLEMENTATION_HXX
32 #define SD_VIEW_SHELL_IMPLEMENTATION_HXX
34 #include "ViewShell.hxx"
35 #include "ViewShellManager.hxx"
36 #include "ToolBarManager.hxx"
38 #include <boost/shared_ptr.hpp>
39 #include <boost/weak_ptr.hpp>
40 #include <memory>
43 class SvxIMapDlg;
45 namespace sd {
47 class DrawController;
49 /** This class contains (will contain) the implementation of methods that
50 have not be accessible from the outside.
52 class ViewShell::Implementation
54 public:
55 bool mbIsShowingUIControls;
56 bool mbIsMainViewShell;
57 /// Set to true when the ViewShell::Init() method has been called.
58 bool mbIsInitialized;
59 /** Set to true while ViewShell::ArrangeGUIElements() is being
60 executed. It is used as guard against recursive execution.
62 bool mbArrangeActive;
64 /** Remember a link to the sub shell factory, so that it can be
65 unregistered at the ViewShellManager when a ViewShell is deleted.
67 ViewShellManager::SharedShellFactory mpSubShellFactory;
69 /** This update lock for the ToolBarManager exists in order to avoid
70 problems with tool bars being displayed while the mouse button is
71 pressed. Whith docked tool bars this can lead to a size change of
72 the view. This would change the relative mouse coordinates and thus
73 interpret every mouse click as move command.
75 class ToolBarManagerLock
77 public:
78 /** Create a new instance. This allows the mpSelf member to be set
79 automatically.
81 static ::boost::shared_ptr<ToolBarManagerLock> Create (
82 const ::boost::shared_ptr<ToolBarManager>& rpManager);
83 /** Release the lock. When the UI is captured
84 (Application::IsUICaptured() returns <TRUE/>) then the lock is
85 released later asynchronously.
86 @param bForce
87 When this flag is <TRUE/> then the lock is released even
88 when IsUICaptured() returns <TRUE/>.
90 void Release (bool bForce = false);
91 DECL_LINK(TimeoutCallback,Timer*);
92 private:
93 ::std::auto_ptr<ToolBarManager::UpdateLock> mpLock;
94 /** The timer is used both as a safe guard to unlock the update lock
95 when Release() is not called explicitly. It is also used to
96 defer the release of the lock to a time when the UI is not
97 captured.
99 Timer maTimer;
100 /** The shared_ptr to this allows the ToolBarManagerLock to control
101 its own lifetime. This, of course, does work only when no one
102 holds another shared_ptr longer than only temporary.
104 ::boost::shared_ptr<ToolBarManagerLock> mpSelf;
105 ToolBarManagerLock (const ::boost::shared_ptr<sd::ToolBarManager>& rpManager);
106 ~ToolBarManagerLock (void);
108 class Deleter;
109 friend class Deleter;
111 // The member is not an auto_ptr because it takes over its own life time
112 // control.
113 ::boost::weak_ptr<ToolBarManagerLock> mpUpdateLockForMouse;
115 Implementation (ViewShell& rViewShell);
116 ~Implementation (void);
118 /** Process the SID_MODIFY slot.
120 void ProcessModifyPageSlot (
121 SfxRequest& rRequest,
122 SdPage* pCurrentPage,
123 PageKind ePageKind);
125 /** Assign the given layout to the given page. This method is at the
126 moment merely a front end for ProcessModifyPageSlot.
127 @param pPage
128 If a NULL pointer is given then this call is ignored.
130 void AssignLayout (
131 SdPage* pPage,
132 AutoLayout aLayout);
134 /** Determine the view id of the view shell. This corresponds to the
135 view id stored in the SfxViewFrame class.
137 We can not use the view of that class because with the introduction
138 of the multi pane GUI we do not switch the SfxViewShell anymore when
139 switching the view in the center pane. The view id of the
140 SfxViewFrame is thus not modified and we can not set it from the
141 outside.
143 The view id is still needed for the SFX to determine on start up
144 (e.g. after loading a document) which ViewShellBase sub class to
145 use. These sub classes--like OutlineViewShellBase--exist only to be
146 used by the SFX as factories. They only set the initial pane
147 configuration, nothing more.
149 So what we do here in essence is to return on of the
150 ViewShellFactoryIds that can be used to select the factory that
151 creates the ViewShellBase subclass with the initial pane
152 configuration that has in the center pane a view shell of the same
153 type as mrViewShell.
155 sal_uInt16 GetViewId (void);
157 /** Return a pointer to the image map dialog that is displayed in some
158 child window.
159 @return
160 Returns <NULL/> when the image map dialog is not available.
162 static SvxIMapDlg* GetImageMapDialog (void);
164 private:
165 ViewShell& mrViewShell;
169 } // end of namespace sd
171 #endif