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