bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / ui / inc / ViewShellBase.hxx
blob0de9a17007db68c045156b4d613442b8e7004e56
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 SD_VIEW_SHELL_BASE_HXX
21 #define SD_VIEW_SHELL_BASE_HXX
23 #include <com/sun/star/frame/XFrame.hpp>
25 #include "ViewShell.hxx"
27 #include "glob.hxx"
28 #include <sfx2/viewsh.hxx>
29 #include <sfx2/viewfac.hxx>
30 #include <memory>
31 #include <boost/shared_ptr.hpp>
32 #include <boost/scoped_ptr.hpp>
34 #include <set>
36 class SdDrawDocument;
37 class SfxRequest;
39 namespace sd { namespace tools {
40 class EventMultiplexer;
41 } }
43 namespace sd {
45 class DrawController;
46 class DrawDocShell;
47 class FormShellManager;
48 class ToolBarManager;
49 class ViewShell;
50 class ViewShellManager;
51 class ViewTabBar;
53 /** SfxViewShell descendant that the stacked Draw/Impress shells are
54 based on.
56 <p>The "base" part of the name does not mean that this is a base
57 class of some class hierarchy. It rather is the base of the
58 stacked shells.</p>
60 <p>This class starts as a new and relatively small class. Over
61 time as much code as possible should be moved from the stacked
62 shells to this class.</p>
64 class ViewShellBase
65 : public SfxViewShell
67 public:
68 TYPEINFO();
69 SFX_DECL_VIEWFACTORY(ViewShellBase);
70 SFX_DECL_INTERFACE(SD_IF_SDVIEWSHELLBASE)
72 /** This constructor is used by the view factory of the SFX macros.
73 Note that LateInit() has to be called after the constructor
74 terminates and before doing anything else.
76 ViewShellBase (
77 SfxViewFrame *pFrame,
78 SfxViewShell* pOldShell);
80 virtual ~ViewShellBase (void);
82 /** This method is part of the object construction. It HAS to be called
83 after the constructor has created a new object.
85 virtual void LateInit (const OUString& rsDefaultView);
87 ::boost::shared_ptr<ViewShellManager> GetViewShellManager (void) const;
89 /** Return the main view shell stacked on the called ViewShellBase
90 object. This is usually the view shell displayed in the center
91 pane.
93 ::boost::shared_ptr<ViewShell> GetMainViewShell (void) const;
95 /** When given a view frame this static method returns the
96 corresponding sd::ViewShellBase object.
97 @return
98 When the SfxViewShell of the given frame is not a
99 ViewShellBase object then NULL is returned.
101 static ViewShellBase* GetViewShellBase (SfxViewFrame* pFrame);
103 DrawDocShell* GetDocShell (void) const;
104 SdDrawDocument* GetDocument (void) const;
106 /** Callback function for general slot calls. At the moment these are
107 slots for switching the pane docking windows on and off.
109 virtual void Execute (SfxRequest& rRequest);
111 /** Callback function for retrieving item values related to certain
112 slots. This is the companion of Execute() and handles the slots
113 concerned with showing the pane docking windows.
115 virtual void GetState (SfxItemSet& rSet);
117 /* override these from SfxViewShell */
118 virtual String GetSelectionText(sal_Bool);
119 virtual sal_Bool HasSelection(sal_Bool) const;
121 SvBorder GetBorder (bool bOuterResize);
122 virtual void InnerResizePixel (const Point& rOrigin, const Size& rSize);
123 virtual void OuterResizePixel (const Point& rOrigin, const Size& rSize);
125 /** This call is forwarded to the main sub-shell.
127 virtual ErrCode DoVerb (long nVerb);
129 /** Return a new renderer that can be used for example for printing the
130 document.
132 virtual com::sun::star::uno::Reference<com::sun::star::view::XRenderable> GetRenderable (void);
134 /// Forwarded to the print manager.
135 virtual SfxPrinter* GetPrinter (sal_Bool bCreate = sal_False);
137 /// Forwarded to the print manager.
138 virtual sal_uInt16 SetPrinter (
139 SfxPrinter* pNewPrinter,
140 sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false);
142 /// Forward methods to main sub shell.
143 virtual void WriteUserDataSequence (
144 ::com::sun::star::uno::Sequence <
145 ::com::sun::star::beans::PropertyValue >&,
146 sal_Bool bBrowse = sal_False);
148 /** Pass the given properties to the main view shell. After that we
149 ensure that the right view shell type is displayed in the center
150 pane.
152 virtual void ReadUserDataSequence (
153 const ::com::sun::star::uno::Sequence <
154 ::com::sun::star::beans::PropertyValue >&,
155 sal_Bool bBrowse = sal_False);
157 virtual void UIActivating( SfxInPlaceClient* );
158 virtual void UIDeactivated( SfxInPlaceClient* );
159 virtual void Activate (sal_Bool IsMDIActivate);
160 virtual void Deactivate (sal_Bool IsMDIActivate);
161 virtual void SetZoomFactor (
162 const Fraction &rZoomX,
163 const Fraction &rZoomY);
164 virtual sal_uInt16 PrepareClose (sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False);
165 virtual void WriteUserData (String&, sal_Bool bBrowse = sal_False);
166 virtual void ReadUserData (const String&, sal_Bool bBrowse = sal_False);
167 virtual SdrView* GetDrawView (void) const;
168 virtual void AdjustPosSizePixel (const Point &rOfs, const Size &rSize);
170 /** When <TRUE/> is given, then the mouse shape is set to hour glass (or
171 whatever the busy shape looks like on the system.)
173 void SetBusyState (bool bBusy);
175 /** Call this method when the controls of this view shell or the
176 embedded sub shell need to be rearranged. This is necessary
177 e.g. when the border has been modified (UpdateBorder() calls this
178 method).
180 This method is like ResizePixel() with no arguments.
182 void Rearrange (void);
184 /** Update the border that is set with SfxViewShell::SetBorderPixel().
185 This is done by adding the border used by the ViewShellBase itself
186 with the border used by the main view shell.
188 @param bForce if true the borders are also updated if old border
189 and new border are same.
191 void UpdateBorder ( bool bForce = false );
193 /** With this method the UI controls can be turned on or off. It is
194 used by the FuSlideShow to hide the UI controls while showing a
195 non-full-screen or in-window presentation in the center pane.
197 void ShowUIControls (bool bVisible);
199 /** this method starts the presentation by
200 executing the slot SID_PRESENTATION asynchronous */
201 void StartPresentation();
203 /** Return an event multiplexer. It is a single class that forwards
204 events from various sources. This method must not be called before
205 LateInit() has terminated.
207 ::boost::shared_ptr<tools::EventMultiplexer> GetEventMultiplexer (void);
209 /** returns the complete area of the current view relative to the frame
210 window
212 const Rectangle& getClientRectangle() const;
214 ::boost::shared_ptr<ToolBarManager> GetToolBarManager (void) const;
215 ::boost::shared_ptr<FormShellManager> GetFormShellManager (void) const;
217 DrawController& GetDrawController (void) const;
219 void SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabBar);
221 /** Return the window that is used by the main view shell to display its
222 view and other UI elements, like scroll bars and rulers. Ownership
223 of that window remains with the called ViewShellBase object.
225 ::Window* GetViewWindow (void);
227 /** returns the ui descriptive name for the given uno slot. The result is taken from the configuration
228 and not cached, so do not use it excessive (f.e. in status updates) */
229 OUString RetrieveLabelFromCommand( const OUString& aCmdURL ) const;
231 protected:
232 osl::Mutex maMutex;
234 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
236 virtual void InitializeFramework (void);
238 private:
239 class Implementation;
240 ::boost::scoped_ptr<Implementation> mpImpl;
241 DrawDocShell* mpDocShell;
242 SdDrawDocument* mpDocument;
244 /** Determine from the properties of the document shell the initial type
245 of the view shell in the center pane. We use this method to avoid
246 starting with the wrong type. When ReadUserDataSequence() is called
247 we check that the right type is active and change again if that is
248 not the case because something went wrong.
250 OUString GetInitialViewShellType (void);
253 } // end of namespace sd
255 #endif
257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */