Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SD_VIEW_SHELL_BASE_HXX
30 : : #define SD_VIEW_SHELL_BASE_HXX
31 : :
32 : : #include <com/sun/star/frame/XFrame.hpp>
33 : :
34 : : #include "ViewShell.hxx"
35 : :
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>
42 : :
43 : : #include <set>
44 : :
45 : : class SdDrawDocument;
46 : : class SfxRequest;
47 : :
48 : : namespace sd { namespace tools {
49 : : class EventMultiplexer;
50 : : } }
51 : :
52 : : namespace sd {
53 : :
54 : : class DrawController;
55 : : class DrawDocShell;
56 : : class FormShellManager;
57 : : class ToolBarManager;
58 : : class ViewShell;
59 : : class ViewShellManager;
60 : : class ViewTabBar;
61 : :
62 : : /** SfxViewShell descendant that the stacked Draw/Impress shells are
63 : : based on.
64 : :
65 : : <p>The "base" part of the name does not mean that this is a base
66 : : class of some class hierarchy. It rather is the base of the
67 : : stacked shells.</p>
68 : :
69 : : <p>This class starts as a new and relatively small class. Over
70 : : time as much code as possible should be moved from the stacked
71 : : shells to this class.</p>
72 : : */
73 : : class ViewShellBase
74 : : : public SfxViewShell
75 : : {
76 : : public:
77 : : TYPEINFO();
78 : 0 : SFX_DECL_VIEWFACTORY(ViewShellBase);
79 : 25 : SFX_DECL_INTERFACE(SD_IF_SDVIEWSHELLBASE)
80 : :
81 : : /** This constructor is used by the view factory of the SFX macros.
82 : : Note that LateInit() has to be called after the constructor
83 : : terminates and before doing anything else.
84 : : */
85 : : ViewShellBase (
86 : : SfxViewFrame *pFrame,
87 : : SfxViewShell* pOldShell);
88 : :
89 : : virtual ~ViewShellBase (void);
90 : :
91 : : /** This method is part of the object construction. It HAS to be called
92 : : after the constructor has created a new object.
93 : : */
94 : : virtual void LateInit (const ::rtl::OUString& rsDefaultView);
95 : :
96 : : ::boost::shared_ptr<ViewShellManager> GetViewShellManager (void) const;
97 : :
98 : : /** Return the main view shell stacked on the called ViewShellBase
99 : : object. This is usually the view shell displayed in the center
100 : : pane.
101 : : */
102 : : ::boost::shared_ptr<ViewShell> GetMainViewShell (void) const;
103 : :
104 : : /** When given a view frame this static method returns the
105 : : corresponding sd::ViewShellBase object.
106 : : @return
107 : : When the SfxViewShell of the given frame is not a
108 : : ViewShellBase object then NULL is returned.
109 : : */
110 : : static ViewShellBase* GetViewShellBase (SfxViewFrame* pFrame);
111 : :
112 : : DrawDocShell* GetDocShell (void) const;
113 : : SdDrawDocument* GetDocument (void) const;
114 : :
115 : : /** Callback function for general slot calls. At the moment these are
116 : : slots for switching the pane docking windows on and off.
117 : : */
118 : : virtual void Execute (SfxRequest& rRequest);
119 : :
120 : : /** Callback function for retrieving item values related to certain
121 : : slots. This is the companion of Execute() and handles the slots
122 : : concerned with showing the pane docking windows.
123 : : */
124 : : virtual void GetState (SfxItemSet& rSet);
125 : :
126 : : SvBorder GetBorder (bool bOuterResize);
127 : : virtual void InnerResizePixel (const Point& rOrigin, const Size& rSize);
128 : : virtual void OuterResizePixel (const Point& rOrigin, const Size& rSize);
129 : :
130 : : /** This call is forwarded to the main sub-shell.
131 : : */
132 : : virtual ErrCode DoVerb (long nVerb);
133 : :
134 : : /** Return a new renderer that can be used for example for printing the
135 : : document.
136 : : */
137 : : virtual com::sun::star::uno::Reference<com::sun::star::view::XRenderable> GetRenderable (void);
138 : :
139 : : /// Forwarded to the print manager.
140 : : virtual SfxPrinter* GetPrinter (sal_Bool bCreate = sal_False);
141 : :
142 : : /// Forwarded to the print manager.
143 : : virtual sal_uInt16 SetPrinter (
144 : : SfxPrinter* pNewPrinter,
145 : : sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false);
146 : :
147 : : /// Forwarded to the print manager.
148 : : virtual SfxTabPage* CreatePrintOptionsPage (
149 : : ::Window *pParent,
150 : : const SfxItemSet &rOptions);
151 : :
152 : : /// Forward methods to main sub shell.
153 : : virtual void WriteUserDataSequence (
154 : : ::com::sun::star::uno::Sequence <
155 : : ::com::sun::star::beans::PropertyValue >&,
156 : : sal_Bool bBrowse = sal_False);
157 : :
158 : : /** Pass the given properties to the main view shell. After that we
159 : : ensure that the right view shell type is displayed in the center
160 : : pane.
161 : : */
162 : : virtual void ReadUserDataSequence (
163 : : const ::com::sun::star::uno::Sequence <
164 : : ::com::sun::star::beans::PropertyValue >&,
165 : : sal_Bool bBrowse = sal_False);
166 : :
167 : : virtual void UIActivating( SfxInPlaceClient* );
168 : : virtual void UIDeactivated( SfxInPlaceClient* );
169 : : virtual void Activate (sal_Bool IsMDIActivate);
170 : : virtual void Deactivate (sal_Bool IsMDIActivate);
171 : : virtual void SetZoomFactor (
172 : : const Fraction &rZoomX,
173 : : const Fraction &rZoomY);
174 : : virtual sal_uInt16 PrepareClose (sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False);
175 : : virtual void WriteUserData (String&, sal_Bool bBrowse = sal_False);
176 : : virtual void ReadUserData (const String&, sal_Bool bBrowse = sal_False);
177 : : virtual SdrView* GetDrawView (void) const;
178 : : virtual void AdjustPosSizePixel (const Point &rOfs, const Size &rSize);
179 : :
180 : : /** When <TRUE/> is given, then the mouse shape is set to hour glass (or
181 : : whatever the busy shape looks like on the system.)
182 : : */
183 : : void SetBusyState (bool bBusy);
184 : :
185 : : /** Call this method when the controls of this view shell or the
186 : : embedded sub shell need to be rearranged. This is necessary
187 : : e.g. when the border has been modified (UpdateBorder() calls this
188 : : method).
189 : :
190 : : This method is like ResizePixel() with no arguments.
191 : : */
192 : : void Rearrange (void);
193 : :
194 : : /** Update the border that is set with SfxViewShell::SetBorderPixel().
195 : : This is done by adding the border used by the ViewShellBase itself
196 : : with the border used by the main view shell.
197 : :
198 : : @param bForce if true the borders are also updated if old border
199 : : and new border are same.
200 : : */
201 : : void UpdateBorder ( bool bForce = false );
202 : :
203 : : /** With this method the UI controls can be turned on or off. It is
204 : : used by the FuSlideShow to hide the UI controls while showing a
205 : : non-full-screen or in-window presentation in the center pane.
206 : : */
207 : : void ShowUIControls (bool bVisible);
208 : :
209 : : /** this method starts the presentation by
210 : : executing the slot SID_PRESENTATION asynchronous */
211 : : void StartPresentation();
212 : :
213 : : /** Return an event multiplexer. It is a single class that forwards
214 : : events from various sources. This method must not be called before
215 : : LateInit() has terminated.
216 : : */
217 : : ::boost::shared_ptr<tools::EventMultiplexer> GetEventMultiplexer (void);
218 : :
219 : : /** returns the complete area of the current view relative to the frame
220 : : window
221 : : */
222 : : const Rectangle& getClientRectangle() const;
223 : :
224 : : ::boost::shared_ptr<ToolBarManager> GetToolBarManager (void) const;
225 : : ::boost::shared_ptr<FormShellManager> GetFormShellManager (void) const;
226 : :
227 : : DrawController& GetDrawController (void) const;
228 : :
229 : : void SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabBar);
230 : :
231 : : /** Return the window that is used by the main view shell to display its
232 : : view and other UI elements, like scroll bars and rulers. Ownership
233 : : of that window remains with the called ViewShellBase object.
234 : : */
235 : : ::Window* GetViewWindow (void);
236 : :
237 : : /** returns the ui descriptive name for the given uno slot. The result is taken from the configuration
238 : : and not cached, so do not use it excessive (f.e. in status updates) */
239 : : ::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) const;
240 : :
241 : : protected:
242 : : osl::Mutex maMutex;
243 : :
244 : : virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
245 : :
246 : : virtual void InitializeFramework (void);
247 : :
248 : : private:
249 : : class Implementation;
250 : : ::boost::scoped_ptr<Implementation> mpImpl;
251 : : DrawDocShell* mpDocShell;
252 : : SdDrawDocument* mpDocument;
253 : :
254 : : /** Determine from the properties of the document shell the initial type
255 : : of the view shell in the center pane. We use this method to avoid
256 : : starting with the wrong type. When ReadUserDataSequence() is called
257 : : we check that the right type is active and change again if that is
258 : : not the case because something went wrong.
259 : : */
260 : : ::rtl::OUString GetInitialViewShellType (void);
261 : : };
262 : :
263 : : } // end of namespace sd
264 : :
265 : : #endif
266 : :
267 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|