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