LCOV - code coverage report
Current view: top level - sd/source/ui/inc - ViewShellBase.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 1 1 100.0 %
Date: 2014-04-11 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10