LCOV - code coverage report
Current view: top level - sw/inc - docsh.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 10 70.0 %
Date: 2012-08-25 Functions: 7 10 70.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _SWDOCSH_HXX
      29                 :            : #define _SWDOCSH_HXX
      30                 :            : 
      31                 :            : #include <rtl/ref.hxx>
      32                 :            : #include <com/sun/star/frame/XController.hpp>
      33                 :            : #include <com/sun/star/uno/Sequence.h>
      34                 :            : #include <vcl/timer.hxx>
      35                 :            : #include <sfx2/docfac.hxx>
      36                 :            : #include <sfx2/objsh.hxx>
      37                 :            : #include "swdllapi.h"
      38                 :            : #include <swdll.hxx>
      39                 :            : #include <shellid.hxx>
      40                 :            : 
      41                 :            : #include <svl/lstner.hxx>
      42                 :            : #include <svtools/embedhlp.hxx>
      43                 :            : 
      44                 :            : class SwDoc;
      45                 :            : class SfxDocumentInfoDialog;
      46                 :            : class SfxStyleSheetBasePool;
      47                 :            : class SfxInPlaceClient;
      48                 :            : class FontList;
      49                 :            : class SwView;
      50                 :            : class SwWrtShell;
      51                 :            : class SwFEShell;
      52                 :            : class Reader;
      53                 :            : class SwReader;
      54                 :            : class SwCrsrShell;
      55                 :            : class SwSrcView;
      56                 :            : class SwPaM;
      57                 :            : class SwgReaderOption;
      58                 :            : class SwOLEObj;
      59                 :            : class IDocumentDeviceAccess;
      60                 :            : class IDocumentSettingAccess;
      61                 :            : class IDocumentTimerAccess;
      62                 :            : class IDocumentChartDataProviderAccess;
      63                 :            : 
      64                 :            : 
      65                 :            : class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
      66                 :            : {
      67                 :            :     SwDoc*                  pDoc;                           // Document.
      68                 :            :     rtl::Reference< SfxStyleSheetBasePool > mxBasePool;     // Passing through for formats.
      69                 :            :     FontList*               pFontList;                      // Current Fontlist.
      70                 :            : 
      71                 :            :     // For "historical reasons" nothing can be done without the WrtShell.
      72                 :            :     // Back-pointer on View (again "for historical reasons").
      73                 :            :     // Back-pointer is valid until in Activate a new one is set
      74                 :            :     // or until it is deleted in the View's Dtor.
      75                 :            : 
      76                 :            :     SwView*                 pView;
      77                 :            :     SwWrtShell*             pWrtShell;
      78                 :            : 
      79                 :            :     Timer                   aFinishedTimer; // Timer for checking graphics-links.
      80                 :            :                                             // If all are present, the doc is loaded completely.
      81                 :            : 
      82                 :            :     comphelper::EmbeddedObjectContainer*    pOLEChildList;
      83                 :            :     sal_Int16               nUpdateDocMode;    // contains the com::sun::star::document::UpdateDocMode
      84                 :            :     bool                    bInUpdateFontList; //prevent nested calls of UpdateFontList
      85                 :            :     bool                    bIsATemplate;      //prevent nested calls of UpdateFontList
      86                 :            : 
      87                 :            :     // Methods for access to doc.
      88                 :            :     SW_DLLPRIVATE void                  AddLink();
      89                 :            :     SW_DLLPRIVATE void                  RemoveLink();
      90                 :            : 
      91                 :            :     // Catch hint for DocInfo.
      92                 :            :     SW_DLLPRIVATE virtual void          Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
      93                 :            : 
      94                 :            :     // FileIO
      95                 :            :     SW_DLLPRIVATE virtual sal_Bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
      96                 :            :     SW_DLLPRIVATE virtual sal_Bool Load( SfxMedium& rMedium );
      97                 :            :     SW_DLLPRIVATE virtual sal_Bool LoadFrom( SfxMedium& rMedium );
      98                 :            :     SW_DLLPRIVATE virtual sal_Bool            ConvertFrom( SfxMedium &rMedium );
      99                 :            :     SW_DLLPRIVATE virtual sal_Bool            ConvertTo( SfxMedium &rMedium );
     100                 :            :     SW_DLLPRIVATE virtual sal_Bool SaveAs( SfxMedium& rMedium );
     101                 :            :     SW_DLLPRIVATE virtual sal_Bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
     102                 :            : 
     103                 :            :     SW_DLLPRIVATE virtual sal_uInt16            PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
     104                 :            : 
     105                 :            : 
     106                 :            :     // Make DocInfo known to the Doc.
     107                 :            :     SW_DLLPRIVATE virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog(
     108                 :            :                                     Window *pParent, const SfxItemSet &);
     109                 :            :     // OLE-stuff
     110                 :            :     SW_DLLPRIVATE virtual void          Draw( OutputDevice*, const JobSetup&, sal_uInt16);
     111                 :            : 
     112                 :            :     // Methods for StyleSheets
     113                 :            :     SW_DLLPRIVATE sal_uInt16                    Edit( const String &rName, const String& rParent, sal_uInt16 nFamily,
     114                 :            :                                     sal_uInt16 nMask, sal_Bool bNew,
     115                 :            :                                     sal_uInt16 nPageId = 0,
     116                 :            :                                     SwWrtShell* pActShell = 0,
     117                 :            :                                     sal_Bool bBasic = sal_False );
     118                 :            :     SW_DLLPRIVATE sal_uInt16                    Delete(const String &rName, sal_uInt16 nFamily);
     119                 :            :     SW_DLLPRIVATE sal_uInt16                    ApplyStyles(const String &rName, sal_uInt16 nFamily, SwWrtShell* pShell = 0,
     120                 :            :                                         sal_uInt16 nMode = 0 );
     121                 :            :     SW_DLLPRIVATE sal_uInt16                    DoWaterCan( const String &rName, sal_uInt16 nFamily);
     122                 :            :     SW_DLLPRIVATE sal_uInt16                    UpdateStyle(const String &rName, sal_uInt16 nFamily, SwWrtShell* pShell = 0);
     123                 :            :     SW_DLLPRIVATE sal_uInt16                    MakeByExample(const String &rName,
     124                 :            :                                             sal_uInt16 nFamily, sal_uInt16 nMask, SwWrtShell* pShell = 0);
     125                 :            : 
     126                 :            :     SW_DLLPRIVATE void                  InitDraw();
     127                 :            :     SW_DLLPRIVATE void                  SubInitNew();   // for InitNew and HtmlSourceMode.
     128                 :            : 
     129                 :            :     SW_DLLPRIVATE void                  RemoveOLEObjects();
     130                 :            :     SW_DLLPRIVATE void                  CalcLayoutForOLEObjects();
     131                 :            : 
     132                 :            :     SW_DLLPRIVATE void                    Init_Impl();
     133                 :            :     SW_DLLPRIVATE DECL_STATIC_LINK( SwDocShell, IsLoadFinished, void* );
     134                 :            : 
     135                 :            : 
     136                 :            :     using SfxObjectShell::GetVisArea;
     137                 :            :     using SfxObjectShell::GetStyleFamilyBitmap;
     138                 :            : 
     139                 :            : protected:
     140                 :            :     /// override to update text fields
     141                 :            :     virtual void                DoFlushDocInfo();
     142                 :            : 
     143                 :            : public:
     144                 :            :     using SotObject::GetInterface;
     145                 :            : 
     146                 :            :     // but we implement this ourselves.
     147                 :         73 :     SFX_DECL_INTERFACE(SW_DOCSHELL)
     148                 :     465187 :     SFX_DECL_OBJECTFACTORY()
     149                 :            :     TYPEINFO();
     150                 :            : 
     151                 :          0 :     static SfxInterface *_GetInterface() { return GetStaticInterface(); }
     152                 :            : 
     153                 :            :     static rtl::OUString GetEventName( sal_Int32 nId );
     154                 :            : 
     155                 :            :     //Doc is required for SO data exchange!
     156                 :            :     SwDocShell( SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED );
     157                 :            :     SwDocShell( const sal_uInt64 i_nSfxCreationFlags );
     158                 :            :     SwDocShell( SwDoc *pDoc, SfxObjectCreateMode eMode = SFX_CREATE_MODE_STANDARD );
     159                 :            :     ~SwDocShell();
     160                 :            : 
     161                 :            :     // OLE 2.0-notification.
     162                 :            :     DECL_LINK( Ole2ModifiedHdl, void * );
     163                 :            : 
     164                 :            :     // OLE-stuff.
     165                 :            :     virtual void      SetVisArea( const Rectangle &rRect );
     166                 :            :     virtual Rectangle GetVisArea( sal_uInt16 nAspect ) const;
     167                 :            :     virtual Printer  *GetDocumentPrinter();
     168                 :            :     virtual OutputDevice* GetDocumentRefDev();
     169                 :            :     virtual void      OnDocumentPrinterChanged( Printer * pNewPrinter );
     170                 :            :     virtual sal_uLong     GetMiscStatus() const;
     171                 :            : 
     172                 :            :     virtual void            PrepareReload();
     173                 :            :     virtual void            SetModified( sal_Bool = sal_True );
     174                 :            : 
     175                 :            :     // Dispatcher
     176                 :            :     void                    Execute(SfxRequest &);
     177                 :            :     void                    ExecStyleSheet(SfxRequest&);
     178                 :            :     void                    ExecDB(SfxRequest&);
     179                 :            : 
     180                 :            :     void                    GetState(SfxItemSet &);
     181                 :            :     void                    StateAlways(SfxItemSet &);
     182                 :            :     void                    StateStyleSheet(SfxItemSet&, SwWrtShell* pSh = 0 );
     183                 :            : 
     184                 :            :     // returns Doc. But be careful!
     185                 :      75334 :     inline SwDoc*                   GetDoc() { return pDoc; }
     186                 :            :     inline const SwDoc*             GetDoc() const { return pDoc; }
     187                 :            :     IDocumentDeviceAccess*          getIDocumentDeviceAccess();
     188                 :            :     const IDocumentSettingAccess*   getIDocumentSettingAccess() const;
     189                 :            :     IDocumentChartDataProviderAccess*       getIDocumentChartDataProviderAccess();
     190                 :            : 
     191                 :            : 
     192                 :            :     void                    UpdateFontList();
     193                 :            :     void                    UpdateChildWindows();
     194                 :            : 
     195                 :            :     // global IO.
     196                 :            :     virtual sal_Bool            Save();
     197                 :            : 
     198                 :            :     // For Style PI.
     199                 :            :     virtual SfxStyleSheetBasePool*  GetStyleSheetPool();
     200                 :            : 
     201                 :            :     // For Organizer.
     202                 :            :     virtual sal_Bool Insert(SfxObjectShell &rSource,
     203                 :            :                         sal_uInt16  nSourceIdx1,
     204                 :            :                         sal_uInt16  nSourceIdx2,
     205                 :            :                         sal_uInt16  nSourceIdx3,
     206                 :            :                         sal_uInt16& nIdx1,
     207                 :            :                         sal_uInt16& nIdx2,
     208                 :            :                         sal_uInt16& nIdx3,
     209                 :            :                         sal_uInt16& nRemovedIdx);
     210                 :            : 
     211                 :            :     virtual sal_Bool Remove(sal_uInt16 nIdx1,
     212                 :            :                         sal_uInt16 nIdx2 = INDEX_IGNORE,
     213                 :            :                         sal_uInt16 nIdx3 = INDEX_IGNORE);
     214                 :            : 
     215                 :            :     virtual Bitmap      GetStyleFamilyBitmap( SfxStyleFamily eFamily );
     216                 :            : 
     217                 :            :     // Set View for actions via Shell.
     218                 :            :     void          SetView(SwView* pVw);
     219                 :          0 :     const SwView *GetView() const { return pView; }
     220                 :     144962 :     SwView       *GetView()       { return pView; }
     221                 :            : 
     222                 :            :     // Accress to the SwWrtShell belonging to SwView.
     223                 :      20749 :           SwWrtShell *GetWrtShell()       { return pWrtShell; }
     224                 :            :     const SwWrtShell *GetWrtShell() const { return pWrtShell; }
     225                 :            : 
     226                 :            :     // For Core - it knows the DocShell but not the WrtShell!
     227                 :            :           SwFEShell *GetFEShell();
     228                 :            :     const SwFEShell *GetFEShell() const
     229                 :            :                 { return ((SwDocShell*)this)->GetFEShell(); }
     230                 :            : 
     231                 :            : 
     232                 :            :     // For inserting document.
     233                 :            :     Reader* StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr,
     234                 :            :                             SwCrsrShell* pCrsrSh = 0, SwPaM* pPaM = 0);
     235                 :            : 
     236                 :            :     virtual long DdeGetData( const String& rItem, const String& rMimeType,
     237                 :            :                              ::com::sun::star::uno::Any & rValue );
     238                 :            :     virtual long DdeSetData( const String& rItem, const String& rMimeType,
     239                 :            :                                 const ::com::sun::star::uno::Any & rValue );
     240                 :            :     virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem );
     241                 :            :     virtual void ReconnectDdeLink(SfxObjectShell& rServer);
     242                 :            : 
     243                 :            :     virtual void FillClass( SvGlobalName * pClassName,
     244                 :            :                                    sal_uInt32 * pClipFormat,
     245                 :            :                                    String * pAppName,
     246                 :            :                                    String * pLongUserName,
     247                 :            :                                    String * pUserName,
     248                 :            :                                    sal_Int32 nFileFormat,
     249                 :            :                                    sal_Bool bTemplate = sal_False ) const;
     250                 :            : 
     251                 :            :     virtual void LoadStyles( SfxObjectShell& rSource );
     252                 :            : 
     253                 :            :     void _LoadStyles( SfxObjectShell& rSource, sal_Bool bPreserveCurrentDocument );
     254                 :            : 
     255                 :            :     // Display dialog for page style. If required display column page.
     256                 :            :     void FormatPage( const String& rPage,
     257                 :            :                         sal_uInt16 nPageId = 0,
     258                 :            :                         SwWrtShell*     pActShell = 0 );
     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();
     269                 :            : 
     270                 :            :     // Re-read Doc from Html-source.
     271                 :            :     void    ReloadFromHtml( const String& rStreamName, SwSrcView* pSrcView );
     272                 :            : 
     273                 :        661 :     sal_Int16   GetUpdateDocMode() const {return nUpdateDocMode;}
     274                 :            : 
     275                 :            :     //Activate wait cursor for all windows of this document
     276                 :            :     //Optionally all dispatcher could be Locked
     277                 :            :     //Usually locking should be done using the class: SwWaitObject!
     278                 :            :     void EnterWait( sal_Bool bLockDispatcher );
     279                 :            :     void LeaveWait( sal_Bool bLockDispatcher );
     280                 :            : 
     281                 :            :     void ToggleBrowserMode(sal_Bool bOn, SwView* pView);
     282                 :            : 
     283                 :            :     sal_uLong LoadStylesFromFile( const String& rURL, SwgReaderOption& rOpt,
     284                 :            :                                 sal_Bool bUnoCall );
     285                 :            :     void InvalidateModel();
     286                 :            :     void ReactivateModel();
     287                 :            : 
     288                 :            :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >  GetEventNames();
     289                 :            : 
     290                 :            :     // #i20883# Digital Signatures and Encryption
     291                 :            :     virtual sal_uInt16 GetHiddenInformationState( sal_uInt16 nStates );
     292                 :            : 
     293                 :            : 
     294                 :            :     // #i42634# Overwrites SfxObjectShell::UpdateLinks
     295                 :            :     // This new function is necessary to trigger update of links in docs
     296                 :            :     // read by the binary filter:
     297                 :            :     virtual void UpdateLinks();
     298                 :            : 
     299                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
     300                 :            :                                 GetController();
     301                 :            : 
     302                 :            :     SfxInPlaceClient* GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef );
     303                 :          0 :     SW_DLLPRIVATE sal_Bool IsTemplate() { return bIsATemplate; }
     304                 :        102 :     SW_DLLPRIVATE void SetIsTemplate( bool bValue ) { bIsATemplate = bValue; }
     305                 :            : 
     306                 :            :     virtual const ::sfx2::IXmlIdRegistry* GetXmlIdRegistry() const;
     307                 :            : 
     308                 :            :     // passwword protection for Writer (derived from SfxObjectShell)
     309                 :            :     // see also:    FN_REDLINE_ON, FN_REDLINE_ON
     310                 :            :     virtual bool    IsChangeRecording() const;
     311                 :            :     virtual bool    HasChangeRecordProtection() const;
     312                 :            :     virtual void    SetChangeRecording( bool bActivate );
     313                 :            :     virtual bool    SetProtectionPassword( const String &rPassword );
     314                 :            :     virtual bool    GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash );
     315                 :            : };
     316                 :            : 
     317                 :            : class Graphic;
     318                 :            : //implemented in source/ui/docvw/romenu.cxx
     319                 :            : String ExportGraphic( const Graphic &rGraphic, const String &rGrfName );
     320                 :            : 
     321                 :            : #endif
     322                 :            : 
     323                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10