bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / inc / ViewShellBase.hxx
blob478d28231a503ad464831736341e72c115261cfd
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 INCLUDED_SD_SOURCE_UI_INC_VIEWSHELLBASE_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_VIEWSHELLBASE_HXX
23 #include <glob.hxx>
24 #include <sfx2/viewsh.hxx>
25 #include <memory>
27 class SdDrawDocument;
28 class SfxRequest;
30 namespace sd { namespace tools {
31 class EventMultiplexer;
32 } }
34 namespace sd {
36 class DrawController;
37 class DrawDocShell;
38 class FormShellManager;
39 class ToolBarManager;
40 class ViewShell;
41 class ViewShellManager;
42 class ViewTabBar;
44 /** SfxViewShell descendant that the stacked Draw/Impress shells are
45 based on.
47 <p>The "base" part of the name does not mean that this is a base
48 class of some class hierarchy. It rather is the base of the
49 stacked shells.</p>
51 <p>This class starts as a new and relatively small class. Over
52 time as much code as possible should be moved from the stacked
53 shells to this class.</p>
55 class ViewShellBase
56 : public SfxViewShell
58 public:
59 SFX_DECL_INTERFACE(SD_IF_SDVIEWSHELLBASE)
61 private:
62 /// SfxInterface initializer.
63 static void InitInterface_Impl();
65 public:
66 /** This constructor is used by the view factory of the SFX macros.
67 Note that LateInit() has to be called after the constructor
68 terminates and before doing anything else.
70 ViewShellBase (
71 SfxViewFrame *pFrame,
72 SfxViewShell* pOldShell);
74 virtual ~ViewShellBase() override;
76 /** This method is part of the object construction. It HAS to be called
77 after the constructor has created a new object.
79 void LateInit (const OUString& rsDefaultView);
81 std::shared_ptr<ViewShellManager> const & GetViewShellManager() const;
83 /** Return the main view shell stacked on the called ViewShellBase
84 object. This is usually the view shell displayed in the center
85 pane.
87 std::shared_ptr<ViewShell> GetMainViewShell() const;
89 /** When given a view frame this static method returns the
90 corresponding sd::ViewShellBase object.
91 @return
92 When the SfxViewShell of the given frame is not a
93 ViewShellBase object then NULL is returned.
95 static ViewShellBase* GetViewShellBase (SfxViewFrame const * pFrame);
97 DrawDocShell* GetDocShell() const { return mpDocShell;}
98 SdDrawDocument* GetDocument() const { return mpDocument;}
100 /** Callback function for general slot calls. At the moment these are
101 slots for switching the pane docking windows on and off.
103 virtual void Execute (SfxRequest& rRequest);
105 /** Callback function for retrieving item values related to certain
106 slots. This is the companion of Execute() and handles the slots
107 concerned with showing the pane docking windows.
109 void GetState (SfxItemSet& rSet);
111 /* override these from SfxViewShell */
112 virtual OUString GetSelectionText(bool = false) override;
113 virtual bool HasSelection(bool = true ) const override;
115 SvBorder GetBorder (bool bOuterResize);
116 virtual void InnerResizePixel (const Point& rOrigin, const Size& rSize, bool inplaceEditModeChange) override;
117 virtual void OuterResizePixel (const Point& rOrigin, const Size& rSize) override;
119 /** This call is forwarded to the main sub-shell.
121 virtual ErrCode DoVerb (long nVerb) override;
123 /** Return a new renderer that can be used for example for printing the
124 document.
126 virtual css::uno::Reference<css::view::XRenderable> GetRenderable() override;
128 /// Forwarded to the print manager.
129 virtual SfxPrinter* GetPrinter (bool bCreate = false) override;
131 /// Forwarded to the print manager.
132 virtual sal_uInt16 SetPrinter (
133 SfxPrinter* pNewPrinter,
134 SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL) override;
136 /// Forward methods to main sub shell.
137 virtual void WriteUserDataSequence (
138 css::uno::Sequence< css::beans::PropertyValue >&) override;
140 /** Pass the given properties to the main view shell. After that we
141 ensure that the right view shell type is displayed in the center
142 pane.
144 virtual void ReadUserDataSequence (
145 const css::uno::Sequence< css::beans::PropertyValue >&) override;
147 virtual void UIActivating( SfxInPlaceClient* ) override;
148 virtual void UIDeactivated( SfxInPlaceClient* ) override;
149 virtual void Activate (bool IsMDIActivate) override;
150 using SfxViewShell::Deactivate;
151 virtual void SetZoomFactor (
152 const Fraction &rZoomX,
153 const Fraction &rZoomY) override;
154 virtual bool PrepareClose (bool bUI = true) override;
155 virtual void WriteUserData (OUString&, bool bBrowse = false) override;
156 virtual void ReadUserData (const OUString&, bool bBrowse = false) override;
157 virtual SdrView* GetDrawView() const override;
159 /** When <TRUE/> is given, then the mouse shape is set to hour glass (or
160 whatever the busy shape looks like on the system.)
162 void SetBusyState (bool bBusy);
164 /** Call this method when the controls of this view shell or the
165 embedded sub shell need to be rearranged. This is necessary
166 e.g. when the border has been modified (UpdateBorder() calls this
167 method).
169 This method is like ResizePixel() with no arguments.
171 void Rearrange();
173 /** Update the border that is set with SfxViewShell::SetBorderPixel().
174 This is done by adding the border used by the ViewShellBase itself
175 with the border used by the main view shell.
177 @param bForce if true the borders are also updated if old border
178 and new border are same.
180 void UpdateBorder ( bool bForce = false );
182 /** With this method the UI controls can be turned on or off. It is
183 used by the FuSlideShow to hide the UI controls while showing a
184 non-full-screen or in-window presentation in the center pane.
186 void ShowUIControls (bool bVisible);
188 /** Return an event multiplexer. It is a single class that forwards
189 events from various sources. This method must not be called before
190 LateInit() has terminated.
192 std::shared_ptr<tools::EventMultiplexer> const & GetEventMultiplexer();
194 /** returns the complete area of the current view relative to the frame
195 window
197 const ::tools::Rectangle& getClientRectangle() const;
199 std::shared_ptr<ToolBarManager> const & GetToolBarManager() const;
200 std::shared_ptr<FormShellManager> const & GetFormShellManager() const;
202 DrawController& GetDrawController() const;
204 void SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabBar);
206 /** Return the window that is used by the main view shell to display its
207 view and other UI elements, like scroll bars and rulers. Ownership
208 of that window remains with the called ViewShellBase object.
210 vcl::Window* GetViewWindow();
212 /** returns the ui descriptive name for the given uno slot. The result is taken from the configuration
213 and not cached, so do not use it excessive (f.e. in status updates) */
214 OUString RetrieveLabelFromCommand( const OUString& aCmdURL ) const;
215 /// See SfxViewShell::getPart().
216 int getPart() const override;
217 /// See SfxViewShell::NotifyCursor().
218 void NotifyCursor(SfxViewShell* pViewShell) const override;
220 protected:
222 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
224 virtual void InitializeFramework();
226 private:
227 class Implementation;
228 std::unique_ptr<Implementation> mpImpl;
229 DrawDocShell* mpDocShell;
230 SdDrawDocument* mpDocument;
232 /** Determine from the properties of the document shell the initial type
233 of the view shell in the center pane. We use this method to avoid
234 starting with the wrong type. When ReadUserDataSequence() is called
235 we check that the right type is active and change again if that is
236 not the case because something went wrong.
238 OUString GetInitialViewShellType();
241 } // end of namespace sd
243 #endif
245 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */