LCOV - code coverage report
Current view: top level - sw/inc - docsh.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 7 9 77.8 %
Date: 2014-04-11 Functions: 7 9 77.8 %
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             : #ifndef INCLUDED_SW_INC_DOCSH_HXX
      20             : #define INCLUDED_SW_INC_DOCSH_HXX
      21             : 
      22             : #include <rtl/ref.hxx>
      23             : #include <com/sun/star/frame/XController.hpp>
      24             : #include <com/sun/star/uno/Sequence.h>
      25             : #include <vcl/timer.hxx>
      26             : #include <sfx2/docfac.hxx>
      27             : #include <sfx2/objsh.hxx>
      28             : #include "swdllapi.h"
      29             : #include <swdll.hxx>
      30             : #include <shellid.hxx>
      31             : 
      32             : #include <svl/lstner.hxx>
      33             : #include <svtools/embedhlp.hxx>
      34             : 
      35             : class SwDoc;
      36             : class SfxDocumentInfoDialog;
      37             : class SfxStyleSheetBasePool;
      38             : class SfxInPlaceClient;
      39             : class FontList;
      40             : class SwView;
      41             : class SwWrtShell;
      42             : class SwFEShell;
      43             : class Reader;
      44             : class SwReader;
      45             : class SwCrsrShell;
      46             : class SwSrcView;
      47             : class SwPaM;
      48             : class SwgReaderOption;
      49             : class SwOLEObj;
      50             : class IDocumentDeviceAccess;
      51             : class IDocumentSettingAccess;
      52             : class IDocumentTimerAccess;
      53             : class IDocumentChartDataProviderAccess;
      54             : 
      55             : class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
      56             : {
      57             :     SwDoc*                  pDoc;                           ///< Document.
      58             :     rtl::Reference< SfxStyleSheetBasePool > mxBasePool;     ///< Passing through for formats.
      59             :     FontList*               pFontList;                      ///< Current Fontlist.
      60             : 
      61             :     /** For "historical reasons" nothing can be done without the WrtShell.
      62             :      Back-pointer on View (again "for historical reasons").
      63             :      Back-pointer is valid until in Activate a new one is set
      64             :      or until it is deleted in the View's Dtor. */
      65             : 
      66             :     SwView*                 pView;
      67             :     SwWrtShell*             pWrtShell;
      68             : 
      69             :     Timer                   aFinishedTimer; /**< Timer for checking graphics-links.
      70             :                                              If all are present, the doc is loaded completely. */
      71             : 
      72             :     comphelper::EmbeddedObjectContainer*    pOLEChildList;
      73             :     sal_Int16               nUpdateDocMode;    ///< contains the com::sun::star::document::UpdateDocMode
      74             :     bool                    bInUpdateFontList; ///< prevent nested calls of UpdateFontList
      75             :     bool                    bIsATemplate;      ///< prevent nested calls of UpdateFontList
      76             : 
      77             :     /// Methods for access to doc.
      78             :     SAL_DLLPRIVATE void                  AddLink();
      79             :     SAL_DLLPRIVATE void                  RemoveLink();
      80             : 
      81             :     /// Catch hint for DocInfo.
      82             :     SAL_DLLPRIVATE virtual void          Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
      83             : 
      84             :     /// FileIO
      85             :     SAL_DLLPRIVATE virtual bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) SAL_OVERRIDE;
      86             :     SAL_DLLPRIVATE virtual bool Load( SfxMedium& rMedium ) SAL_OVERRIDE;
      87             :     SAL_DLLPRIVATE virtual bool LoadFrom( SfxMedium& rMedium ) SAL_OVERRIDE;
      88             :     SAL_DLLPRIVATE virtual bool ConvertFrom( SfxMedium &rMedium ) SAL_OVERRIDE;
      89             :     SAL_DLLPRIVATE virtual bool ConvertTo( SfxMedium &rMedium ) SAL_OVERRIDE;
      90             :     SAL_DLLPRIVATE virtual bool SaveAs( SfxMedium& rMedium ) SAL_OVERRIDE;
      91             :     SAL_DLLPRIVATE virtual bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) SAL_OVERRIDE;
      92             : 
      93             :     SAL_DLLPRIVATE virtual bool     PrepareClose( bool bUI = true ) SAL_OVERRIDE;
      94             : 
      95             :     SAL_DLLPRIVATE virtual bool     InsertGeneratedStream(SfxMedium& rMedium,
      96             :             css::uno::Reference<css::text::XTextRange> const& xInsertPosition)
      97             :         SAL_OVERRIDE;
      98             : 
      99             :     /// Make DocInfo known to the Doc.
     100             :     SAL_DLLPRIVATE virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog(
     101             :                                     Window *pParent, const SfxItemSet &) SAL_OVERRIDE;
     102             :     /// OLE-stuff
     103             :     SAL_DLLPRIVATE virtual void          Draw( OutputDevice*, const JobSetup&, sal_uInt16) SAL_OVERRIDE;
     104             : 
     105             :     /// Methods for StyleSheets
     106             : 
     107             :     // @param nSlot
     108             :     // Only used for nFamily == SFX_STYLE_FAMILY_PAGE. Identifies optional Slot by which the edit is triggered.
     109             :     // Used to activate certain dialog pane
     110             :     SAL_DLLPRIVATE sal_uInt16 Edit(
     111             :         const OUString &rName,
     112             :         const OUString& rParent,
     113             :         const sal_uInt16 nFamily,
     114             :         sal_uInt16 nMask,
     115             :         const sal_Bool bNew,
     116             :         const OString& sPageId = OString(),
     117             :         SwWrtShell* pActShell = 0,
     118             :         const sal_Bool bBasic = sal_False );
     119             : 
     120             :     SAL_DLLPRIVATE sal_uInt16            Delete(const OUString &rName, sal_uInt16 nFamily);
     121             :     SAL_DLLPRIVATE sal_uInt16            Hide(const OUString &rName, sal_uInt16 nFamily, bool bHidden);
     122             :     SAL_DLLPRIVATE sal_uInt16            ApplyStyles(const OUString &rName,
     123             :         const sal_uInt16 nFamily,
     124             :         SwWrtShell* pShell = 0,
     125             :         sal_uInt16 nMode = 0);
     126             :     SAL_DLLPRIVATE sal_uInt16            DoWaterCan( const OUString &rName, sal_uInt16 nFamily);
     127             :     SAL_DLLPRIVATE sal_uInt16            UpdateStyle(const OUString &rName, sal_uInt16 nFamily, SwWrtShell* pShell = 0);
     128             :     SAL_DLLPRIVATE sal_uInt16            MakeByExample(const OUString &rName,
     129             :                                         sal_uInt16 nFamily, sal_uInt16 nMask, SwWrtShell* pShell = 0);
     130             : 
     131             :     SAL_DLLPRIVATE void                  InitDraw();
     132             :     SAL_DLLPRIVATE void                  SubInitNew();   ///< for InitNew and HtmlSourceMode.
     133             : 
     134             :     SAL_DLLPRIVATE void                  RemoveOLEObjects();
     135             :     SAL_DLLPRIVATE void                  CalcLayoutForOLEObjects();
     136             : 
     137             :     SAL_DLLPRIVATE void                  Init_Impl();
     138             :     SAL_DLLPRIVATE DECL_STATIC_LINK( SwDocShell, IsLoadFinished, void* );
     139             : 
     140             :     using SfxObjectShell::GetVisArea;
     141             : 
     142             : protected:
     143             :     /// override to update text fields
     144             :     virtual void                DoFlushDocInfo() SAL_OVERRIDE;
     145             : 
     146             : public:
     147             :     using SotObject::GetInterface;
     148             : 
     149             :     /// but we implement this ourselves.
     150          37 :     SFX_DECL_INTERFACE(SW_DOCSHELL)
     151      407897 :     SFX_DECL_OBJECTFACTORY()
     152             :     TYPEINFO_OVERRIDE();
     153             : 
     154             :     static SfxInterface *_GetInterface() { return GetStaticInterface(); }
     155             : 
     156             :     static OUString GetEventName( sal_Int32 nId );
     157             : 
     158             :     /// Doc is required for SO data exchange!
     159             :     SwDocShell( SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED );
     160             :     SwDocShell( const sal_uInt64 i_nSfxCreationFlags );
     161             :     SwDocShell( SwDoc *pDoc, SfxObjectCreateMode eMode = SFX_CREATE_MODE_STANDARD );
     162             :     virtual ~SwDocShell();
     163             : 
     164             :     /// OLE 2.0-notification.
     165             :     DECL_LINK( Ole2ModifiedHdl, void * );
     166             : 
     167             :     /// OLE-stuff.
     168             :     virtual void      SetVisArea( const Rectangle &rRect ) SAL_OVERRIDE;
     169             :     virtual Rectangle GetVisArea( sal_uInt16 nAspect ) const SAL_OVERRIDE;
     170             :     virtual Printer  *GetDocumentPrinter() SAL_OVERRIDE;
     171             :     virtual OutputDevice* GetDocumentRefDev() SAL_OVERRIDE;
     172             :     virtual void      OnDocumentPrinterChanged( Printer * pNewPrinter ) SAL_OVERRIDE;
     173             :     virtual sal_uLong     GetMiscStatus() const SAL_OVERRIDE;
     174             : 
     175             :     virtual void            PrepareReload() SAL_OVERRIDE;
     176             :     virtual void            SetModified( bool = true ) SAL_OVERRIDE;
     177             : 
     178             :     /// Dispatcher
     179             :     void                    Execute(SfxRequest &);
     180             :     void                    ExecStyleSheet(SfxRequest&);
     181             :     void                    ExecDB(SfxRequest&);
     182             : 
     183             :     void                    GetState(SfxItemSet &);
     184             :     void                    StateAlways(SfxItemSet &);
     185             :     void                    StateStyleSheet(SfxItemSet&, SwWrtShell* pSh = 0 );
     186             : 
     187             :     /// returns Doc. But be careful!
     188      183751 :     inline SwDoc*                   GetDoc() { return pDoc; }
     189             :     inline const SwDoc*             GetDoc() const { return pDoc; }
     190             :     IDocumentDeviceAccess*          getIDocumentDeviceAccess();
     191             :     const IDocumentSettingAccess*   getIDocumentSettingAccess() const;
     192             :     IDocumentChartDataProviderAccess*       getIDocumentChartDataProviderAccess();
     193             : 
     194             :     void                    UpdateFontList();
     195             :     void                    UpdateChildWindows();
     196             : 
     197             :     /// global IO.
     198             :     virtual bool            Save() SAL_OVERRIDE;
     199             : 
     200             :     /// For Style PI.
     201             :     virtual SfxStyleSheetBasePool*  GetStyleSheetPool() SAL_OVERRIDE;
     202             : 
     203             :     /// Set View for actions via Shell.
     204             :     void          SetView(SwView* pVw);
     205           0 :     const SwView *GetView() const { return pView; }
     206      162655 :     SwView       *GetView()       { return pView; }
     207             : 
     208             :     /// Accress to the SwWrtShell belonging to SwView.
     209      237457 :           SwWrtShell *GetWrtShell()       { return pWrtShell; }
     210             :     const SwWrtShell *GetWrtShell() const { return pWrtShell; }
     211             : 
     212             :     /// For Core - it knows the DocShell but not the WrtShell!
     213             :           SwFEShell *GetFEShell();
     214             :     const SwFEShell *GetFEShell() const
     215             :                 { return ((SwDocShell*)this)->GetFEShell(); }
     216             : 
     217             :     /// For inserting document.
     218             :     Reader* StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr,
     219             :                             SwCrsrShell* pCrsrSh = 0, SwPaM* pPaM = 0);
     220             : 
     221             :     virtual bool DdeGetData( const OUString& rItem, const OUString& rMimeType,
     222             :                              ::com::sun::star::uno::Any & rValue ) SAL_OVERRIDE;
     223             :     virtual bool DdeSetData( const OUString& rItem, const OUString& rMimeType,
     224             :                              const ::com::sun::star::uno::Any & rValue ) SAL_OVERRIDE;
     225             :     virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const OUString& rItem ) SAL_OVERRIDE;
     226             :     virtual void ReconnectDdeLink(SfxObjectShell& rServer) SAL_OVERRIDE;
     227             : 
     228             :     virtual void FillClass( SvGlobalName * pClassName,
     229             :                                    sal_uInt32 * pClipFormat,
     230             :                                    OUString * pAppName,
     231             :                                    OUString * pLongUserName,
     232             :                                    OUString * pUserName,
     233             :                                    sal_Int32 nFileFormat,
     234             :                                    bool bTemplate = false ) const SAL_OVERRIDE;
     235             : 
     236             :     virtual void LoadStyles( SfxObjectShell& rSource ) SAL_OVERRIDE;
     237             : 
     238             :     void _LoadStyles( SfxObjectShell& rSource, sal_Bool bPreserveCurrentDocument );
     239             : 
     240             :     // Show page style format dialog
     241             :     // @param nSlot
     242             :     // Identifies slot by which the dialog is triggered. Used to activate certain dialog pane
     243             :     void FormatPage(
     244             :         const OUString& rPage,
     245             :         const OString& rPageId,
     246             :         SwWrtShell& rActShell );
     247             : 
     248             :     // #i59688#
     249             :     /** linked graphics are now loaded on demand.
     250             :      Thus, loading of linked graphics no longer needed and necessary for
     251             :      the load of document being finished. */
     252             : 
     253             :     void LoadingFinished();
     254             : 
     255             :     /// Cancel transfer (called from SFX).
     256             :     virtual void CancelTransfers() SAL_OVERRIDE;
     257             : 
     258             :     /// Re-read Doc from Html-source.
     259             :     void    ReloadFromHtml( const OUString& rStreamName, SwSrcView* pSrcView );
     260             : 
     261        1369 :     sal_Int16   GetUpdateDocMode() const {return nUpdateDocMode;}
     262             : 
     263             :     void ToggleBrowserMode(sal_Bool bOn, SwView* pView);
     264             : 
     265             :     sal_uLong LoadStylesFromFile( const OUString& rURL, SwgReaderOption& rOpt,
     266             :                                 sal_Bool bUnoCall );
     267             :     void InvalidateModel();
     268             :     void ReactivateModel();
     269             : 
     270             :     virtual ::com::sun::star::uno::Sequence< OUString >  GetEventNames() SAL_OVERRIDE;
     271             : 
     272             :     /// #i20883# Digital Signatures and Encryption
     273             :     virtual sal_uInt16 GetHiddenInformationState( sal_uInt16 nStates ) SAL_OVERRIDE;
     274             : 
     275             :     /** #i42634# Overwrites SfxObjectShell::UpdateLinks
     276             :      This new function is necessary to trigger update of links in docs
     277             :      read by the binary filter: */
     278             :     virtual void UpdateLinks() SAL_OVERRIDE;
     279             : 
     280             :     virtual void setDocAccTitle( const OUString& rTitle );
     281             :     virtual const OUString getDocAccTitle() const;
     282             : 
     283             :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
     284             :                                 GetController();
     285             : 
     286             :     SfxInPlaceClient* GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef );
     287           0 :     SAL_DLLPRIVATE sal_Bool IsTemplate() { return bIsATemplate; }
     288          72 :     SAL_DLLPRIVATE void SetIsTemplate( bool bValue ) { bIsATemplate = bValue; }
     289             : 
     290             :     virtual const ::sfx2::IXmlIdRegistry* GetXmlIdRegistry() const SAL_OVERRIDE;
     291             : 
     292             :     /** passwword protection for Writer (derived from SfxObjectShell)
     293             :      see also:    FN_REDLINE_ON, FN_REDLINE_ON */
     294             :     virtual bool    IsChangeRecording() const SAL_OVERRIDE;
     295             :     virtual bool    HasChangeRecordProtection() const SAL_OVERRIDE;
     296             :     virtual void    SetChangeRecording( bool bActivate ) SAL_OVERRIDE;
     297             :     virtual bool    SetProtectionPassword( const OUString &rPassword ) SAL_OVERRIDE;
     298             :     virtual bool    GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash ) SAL_OVERRIDE;
     299             : };
     300             : 
     301             : /** Find the right DocShell and create a new one:
     302             :     The return value specifies what should happen to the Shell
     303             :     0 - Error, could not find the DocShell
     304             :     1 - DocShell is an existing Document
     305             :     2 - DocShell was created anew, thus it needs to be closed again
     306             :         (will be assigned to xLockRef additionally)
     307             : */
     308             : int SwFindDocShell( SfxObjectShellRef& xDocSh,
     309             :                     SfxObjectShellLock& xLockRef,
     310             :                     const OUString& rFileName,
     311             :                     const OUString& rPasswd,
     312             :                     const OUString& rFilter,
     313             :                     sal_Int16 nVersion,
     314             :                     SwDocShell* pDestSh );
     315             : 
     316             : #endif
     317             : 
     318             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10