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

Generated by: LCOV version 1.10