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