update dev300-m58
[ooovba.git] / sd / source / ui / inc / ViewShellBase.hxx
blob2fc8268f7a2f803616e9dd70fb8c42a542efcffb
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: ViewShellBase.hxx,v $
10 * $Revision: 1.23.34.1 $
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_BASE_HXX
32 #define SD_VIEW_SHELL_BASE_HXX
34 #include "ViewShell.hxx"
36 #include "glob.hxx"
37 #include <sfx2/viewsh.hxx>
38 #include <sfx2/viewfac.hxx>
39 #include <memory>
40 #include <boost/shared_ptr.hpp>
41 #include <boost/scoped_ptr.hpp>
43 #include <set>
45 class SdDrawDocument;
46 class SfxRequest;
48 namespace sd { namespace tools {
49 class EventMultiplexer;
50 } }
52 namespace sd {
54 class DrawController;
55 class DrawDocShell;
56 class FormShellManager;
57 class ToolBarManager;
58 class UpdateLockManager;
59 class ViewShell;
60 class ViewShellManager;
61 class CustomHandleManager;
63 /** SfxViewShell descendant that the stacked Draw/Impress shells are
64 based on.
66 <p>The "base" part of the name does not mean that this is a base
67 class of some class hierarchy. It rather is the base of the
68 stacked shells.</p>
70 <p>This class starts as a new and relatively small class. Over
71 time as much code as possible should be moved from the stacked
72 shells to this class.</p>
74 class ViewShellBase
75 : public SfxViewShell
77 public:
78 TYPEINFO();
79 SFX_DECL_VIEWFACTORY(ViewShellBase);
80 SFX_DECL_INTERFACE(SD_IF_SDVIEWSHELLBASE)
82 /** This constructor is used by the view factory of the SFX macros.
83 Note that LateInit() has to be called after the constructor
84 terminates and before doing anything else.
86 ViewShellBase (
87 SfxViewFrame *pFrame,
88 SfxViewShell* pOldShell);
90 virtual ~ViewShellBase (void);
92 /** This method is part of the object construction. It HAS to be called
93 after the constructor has created a new object.
95 virtual void LateInit (const ::rtl::OUString& rsDefaultView);
97 ::boost::shared_ptr<ViewShellManager> GetViewShellManager (void) const;
99 /** Return the main view shell stacked on the called ViewShellBase
100 object. This is usually the view shell displayed in the center
101 pane.
103 ::boost::shared_ptr<ViewShell> GetMainViewShell (void) const;
105 /** When given a view frame this static method returns the
106 corresponding sd::ViewShellBase object.
107 @return
108 When the SfxViewShell of the given frame is not a
109 ViewShellBase object then NULL is returned.
111 static ViewShellBase* GetViewShellBase (SfxViewFrame* pFrame);
113 DrawDocShell* GetDocShell (void) const;
114 SdDrawDocument* GetDocument (void) const;
116 /** Callback function for retrieving item values related to menu entries.
118 void GetMenuState (SfxItemSet& rSet);
120 /** Callback function for general slot calls. At the moment these are
121 slots for switching the pane docking windows on and off.
123 virtual void Execute (SfxRequest& rRequest);
125 /** Callback function for retrieving item values related to certain
126 slots. This is the companion of Execute() and handles the slots
127 concerned with showing the pane docking windows.
129 virtual void GetState (SfxItemSet& rSet);
131 SvBorder GetBorder (bool bOuterResize);
132 virtual void InnerResizePixel (const Point& rOrigin, const Size& rSize);
133 virtual void OuterResizePixel (const Point& rOrigin, const Size& rSize);
135 /** This call is forwarded to the main sub-shell.
137 virtual ErrCode DoVerb (long nVerb);
139 /// Forwarded to the print manager.
140 virtual SfxPrinter* GetPrinter (BOOL bCreate = FALSE);
142 /// Forwarded to the print manager.
143 virtual USHORT SetPrinter (
144 SfxPrinter* pNewPrinter,
145 USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false);
147 /// Forwarded to the print manager.
148 virtual PrintDialog* CreatePrintDialog (::Window *pParent);
150 /// Forwarded to the print manager.
151 virtual SfxTabPage* CreatePrintOptionsPage (
152 ::Window *pParent,
153 const SfxItemSet &rOptions);
155 /// Forwarded to the print manager.
156 virtual USHORT Print (SfxProgress& rProgress, BOOL bIsAPI, PrintDialog* pDialog);
158 /// Forwarded to the print manager.
159 virtual ErrCode DoPrint (
160 SfxPrinter *pPrinter,
161 PrintDialog *pPrintDialog,
162 BOOL bSilent, BOOL bIsAPI );
164 /// Forwarded to the print manager.
165 USHORT SetPrinterOptDlg (
166 SfxPrinter* pNewPrinter,
167 USHORT nDiffFlags = SFX_PRINTER_ALL,
168 BOOL _bShowDialog = TRUE);
170 virtual void PreparePrint (PrintDialog* pPrintDialog);
172 /// Forward methods to main sub shell.
173 virtual void WriteUserDataSequence (
174 ::com::sun::star::uno::Sequence <
175 ::com::sun::star::beans::PropertyValue >&,
176 sal_Bool bBrowse = sal_False);
178 /** Pass the given properties to the main view shell. After that we
179 ensure that the right view shell type is displayed in the center
180 pane.
182 virtual void ReadUserDataSequence (
183 const ::com::sun::star::uno::Sequence <
184 ::com::sun::star::beans::PropertyValue >&,
185 sal_Bool bBrowse = sal_False);
187 virtual void UIActivating( SfxInPlaceClient* );
188 virtual void UIDeactivated( SfxInPlaceClient* );
189 virtual void Activate (BOOL IsMDIActivate);
190 virtual void Deactivate (BOOL IsMDIActivate);
191 virtual void SetZoomFactor (
192 const Fraction &rZoomX,
193 const Fraction &rZoomY);
194 virtual USHORT PrepareClose (BOOL bUI = TRUE, BOOL bForBrowsing = FALSE);
195 virtual void WriteUserData (String&, BOOL bBrowse = FALSE);
196 virtual void ReadUserData (const String&, BOOL bBrowse = FALSE);
197 virtual SdrView* GetDrawView (void) const;
198 virtual void AdjustPosSizePixel (const Point &rOfs, const Size &rSize);
200 /** When <TRUE/> is given, then the mouse shape is set to hour glass (or
201 whatever the busy shape looks like on the system.)
203 void SetBusyState (bool bBusy);
205 /** Call this method when the controls of this view shell or the
206 embedded sub shell need to be rearranged. This is necessary
207 e.g. when the border has been modified (UpdateBorder() calls this
208 method).
210 This method is like ResizePixel() with no arguments.
212 void Rearrange (void);
214 /** Update the border that is set with SfxViewShell::SetBorderPixel().
215 This is done by adding the border used by the ViewShellBase itself
216 with the border used by the main view shell.
218 @param bForce if true the borders are also updated if old border
219 and new border are same.
221 void UpdateBorder ( bool bForce = false );
223 /** With this method the UI controls can be turned on or off. It is
224 used by the FuSlideShow to hide the UI controls while showing a
225 non-full-screen or in-window presentation in the center pane.
227 void ShowUIControls (bool bVisible);
229 /** this method starts the presentation by
230 executing the slot SID_PRESENTATION asynchronous */
231 void StartPresentation();
233 /** Return an event multiplexer. It is a single class that forwards
234 events from various sources. This method must not be called before
235 LateInit() has terminated.
237 ::boost::shared_ptr<tools::EventMultiplexer> GetEventMultiplexer (void);
239 /** returns the complete area of the current view relative to the frame
240 window
242 const Rectangle& getClientRectangle() const;
244 ::boost::shared_ptr<UpdateLockManager> GetUpdateLockManager (void) const;
246 ::boost::shared_ptr<ToolBarManager> GetToolBarManager (void) const;
248 ::boost::shared_ptr<FormShellManager> GetFormShellManager (void) const;
250 DrawController& GetDrawController (void) const;
252 void SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabBar);
254 /** Return the window that is used by the main view shell to display its
255 view and other UI elements, like scroll bars and rulers. Ownership
256 of that window remains with the called ViewShellBase object.
258 ::Window* GetViewWindow (void);
260 CustomHandleManager& getCustomHandleManager() const;
262 protected:
263 osl::Mutex maMutex;
265 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
267 virtual void InitializeFramework (void);
269 private:
270 class Implementation;
271 ::boost::scoped_ptr<Implementation> mpImpl;
272 DrawDocShell* mpDocShell;
273 SdDrawDocument* mpDocument;
275 /** Determine from the properties of the document shell the initial type
276 of the view shell in the center pane. We use this method to avoid
277 starting with the wrong type. When ReadUserDataSequence() is called
278 we check that the right type is active and change again if that is
279 not the case because something went wrong.
281 ::rtl::OUString GetInitialViewShellType (void);
284 class ICustomhandleSupplier
286 public:
287 virtual void addCustomHandler( SdrView& rSourceView, ViewShell::ShellType eShellType, SdrHdlList& rHandlerList ) = 0;
290 class CustomHandleManager : public ICustomhandleSupplier
292 public:
293 CustomHandleManager( ViewShellBase& rViewShellBase );
294 virtual ~CustomHandleManager();
296 void registerSupplier( ICustomhandleSupplier* pSupplier );
297 void unRegisterSupplier( ICustomhandleSupplier* pSupplier );
299 virtual void addCustomHandler( SdrView& rSourceView, ViewShell::ShellType eShellType, SdrHdlList& rHandlerList );
301 private:
302 ViewShellBase& mrViewShellBase;
303 std::set< ICustomhandleSupplier* > maSupplier;
306 } // end of namespace sd
308 #endif