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

Generated by: LCOV version 1.11