LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/sfx2 - docfile.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 3 100.0 %
Date: 2013-07-09 Functions: 10 12 83.3 %
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 _SFXDOCFILE_HXX
      21             : #define _SFXDOCFILE_HXX
      22             : 
      23             : #include <com/sun/star/io/XSeekable.hpp>
      24             : #include "sal/config.h"
      25             : #include "sfx2/dllapi.h"
      26             : #include "sal/types.h"
      27             : #include <com/sun/star/util/RevisionTag.hpp>
      28             : #include <com/sun/star/util/DateTime.hpp>
      29             : #include <com/sun/star/io/XOutputStream.hpp>
      30             : #include <com/sun/star/io/XInputStream.hpp>
      31             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      32             : #include <com/sun/star/lang/XServiceInfo.hpp>
      33             : #include <com/sun/star/ucb/XContent.hpp>
      34             : #include <com/sun/star/ucb/XCommandEnvironment.hpp>
      35             : #include <com/sun/star/task/XInteractionHandler.hpp>
      36             : #include <com/sun/star/embed/XStorage.hpp>
      37             : #include <com/sun/star/beans/PropertyValue.hpp>
      38             : #include <tools/link.hxx>
      39             : #include <tools/stream.hxx>
      40             : #include <tools/string.hxx>
      41             : #include <svl/lstner.hxx>
      42             : 
      43             : #include <cppuhelper/weak.hxx>
      44             : #include <ucbhelper/content.hxx>
      45             : 
      46             : #include <vector>
      47             : 
      48             : class SvKeyValueIterator;
      49             : class SfxObjectFactory;
      50             : class SfxFilter;
      51             : class SfxMedium_Impl;
      52             : class INetURLObject;
      53             : class SfxObjectShell;
      54             : class SfxFrame;
      55             : class Timer;
      56             : class SfxItemSet;
      57             : class DateTime;
      58             : 
      59             : class SFX2_DLLPUBLIC SfxMedium : public SvRefBase
      60             : {
      61             :     SfxMedium_Impl* pImp;
      62             : 
      63             :     SAL_DLLPRIVATE void SetIsRemote_Impl();
      64             :     SAL_DLLPRIVATE void CloseInStream_Impl();
      65             :     SAL_DLLPRIVATE sal_Bool CloseOutStream_Impl();
      66             :     SAL_DLLPRIVATE void CloseStreams_Impl();
      67             :     DECL_DLLPRIVATE_STATIC_LINK( SfxMedium, UCBHdl_Impl, sal_uInt32 * );
      68             : 
      69             :     SAL_DLLPRIVATE void SetEncryptionDataToStorage_Impl();
      70             : 
      71             : public:
      72             : 
      73             :                         SfxMedium();
      74             :                         /**
      75             :                          * @param pSet Takes ownership
      76             :                          */
      77             :                         SfxMedium( const String &rName,
      78             :                                    StreamMode nOpenMode,
      79             :                                    const SfxFilter *pFilter = 0,
      80             :                                    SfxItemSet *pSet = 0 );
      81             :                         //TODO: the next, non-defined overload is only there to
      82             :                         // detect uses of the above (String, StreamMode, etc.)
      83             :                         // overload from when it still had an additional third
      84             :                         // parameter sal_Bool bDirect, where now a leftover
      85             :                         // "false" or "sal_False" could be mistaken for a null
      86             :                         // pointer argument for the pFilter parameter; it can be
      87             :                         // removed once we are confident all old uses of the
      88             :                         // original overload have been adapted (in platform
      89             :                         // specific code etc.):
      90             :                         SfxMedium(String const &, StreamMode, void *)
      91             :                             SAL_DELETED_FUNCTION;
      92             : 
      93             :                         /**
      94             :                          * @param pSet does NOT take ownership
      95             :                          */
      96             :                         SfxMedium( const css::uno::Reference< css::embed::XStorage >& xStorage,
      97             :                                     const String& rBaseURL,
      98             :                                     const SfxItemSet* pSet=0 );
      99             :                         /**
     100             :                          * @param pSet does NOT take ownership
     101             :                          */
     102             :                         SfxMedium( const css::uno::Reference< css::embed::XStorage >& xStorage,
     103             :                                     const String& rBaseURL,
     104             :                                     const String& rTypeName,
     105             :                                     const SfxItemSet* pSet=0 );
     106             :                         SfxMedium( const css::uno::Sequence< css::beans::PropertyValue >& aArgs );
     107             : 
     108             :                         ~SfxMedium();
     109             : 
     110             :     void                UseInteractionHandler( sal_Bool );
     111             :     css::uno::Reference< css::task::XInteractionHandler >
     112             :                         GetInteractionHandler();
     113             : 
     114             :     void setStreamToLoadFrom(
     115             :         const css::uno::Reference<css::io::XInputStream>& xInputStream,
     116             :         sal_Bool bIsReadOnly);
     117             : 
     118             :     void                SetLoadTargetFrame(SfxFrame* pFrame );
     119             :     SfxFrame*           GetLoadTargetFrame() const;
     120             : 
     121             :     void                SetFilter(const SfxFilter *pFlt, sal_Bool bResetOrig = sal_False);
     122             :     const SfxFilter* GetFilter() const;
     123             :     const SfxFilter *   GetOrigFilter( sal_Bool bNotCurrent = sal_False ) const;
     124             :     const OUString& GetOrigURL() const;
     125             : 
     126             :     SfxItemSet  *       GetItemSet() const;
     127             :     void                Close();
     128             :     void                CloseAndRelease();
     129             :     void                ReOpen();
     130             :     void                CompleteReOpen();
     131             :     const OUString& GetName() const;
     132             :     const INetURLObject& GetURLObject() const;
     133             : 
     134             :     void                CheckFileDate( const css::util::DateTime& aInitDate );
     135             :     sal_Bool            DocNeedsFileDateCheck();
     136             :     css::util::DateTime GetInitFileDate( sal_Bool bIgnoreOldValue );
     137             : 
     138             :     css::uno::Reference< css::ucb::XContent > GetContent() const;
     139             :     const OUString& GetPhysicalName() const;
     140             :     sal_Bool            IsRemote();
     141             :     sal_Bool            IsOpen() const; // { return aStorage.Is() || pInStream; }
     142             :     void                DownLoad( const Link& aLink = Link());
     143             :     void                SetDoneLink( const Link& rLink );
     144             : 
     145             :     sal_uInt32          GetErrorCode() const;
     146       12923 :     sal_uInt32          GetError() const
     147       12923 :                         { return ERRCODE_TOERROR(GetErrorCode()); }
     148             :     sal_uInt32          GetLastStorageCreationState();
     149             : 
     150             :     void                SetError( sal_uInt32 nError, const OUString& aLogMessage );
     151             : 
     152             :     void                AddLog( const OUString& aMessage );
     153             : 
     154             :     void                CloseInStream();
     155             :     sal_Bool            CloseOutStream();
     156             : 
     157             :     void                CloseStorage();
     158             : 
     159             :     StreamMode          GetOpenMode() const;
     160             :     void                SetOpenMode( StreamMode nStorOpen, sal_Bool bDontClose = sal_False );
     161             : 
     162             :     SvStream*           GetInStream();
     163             :     SvStream*           GetOutStream();
     164             : 
     165             :     sal_Bool            Commit();
     166             :     sal_Bool            IsStorage();
     167             : 
     168             :     sal_Int8            ShowLockedDocumentDialog( const css::uno::Sequence< OUString >& aData, sal_Bool bIsLoading, sal_Bool bOwnLock );
     169             :     bool                LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI );
     170             :     void                UnlockFile( sal_Bool bReleaseLockStream );
     171             : 
     172             :     css::uno::Reference< css::embed::XStorage > GetStorage( sal_Bool bCreateTempIfNo = sal_True );
     173             :     css::uno::Reference< css::embed::XStorage > GetOutputStorage();
     174             :     void                ResetError();
     175             :     sal_Bool            UsesCache() const;
     176             :     void                SetUsesCache( sal_Bool );
     177             :     sal_Bool            IsExpired() const;
     178             :     void                SetName( const String& rName, sal_Bool bSetOrigURL = sal_False );
     179             :     sal_Bool            IsAllowedForExternalBrowser() const;
     180             :     long                GetFileVersion() const;
     181             : 
     182             :     const css::uno::Sequence < css::util::RevisionTag >&
     183             :                         GetVersionList( bool _bNoReload = false );
     184             :     sal_Bool            IsReadOnly();
     185             : 
     186             :     // Whether the medium had originally been opened r/o, independent of later
     187             :     // changes via SetOpenMode; used to keep track of the "true" state of the
     188             :     // medium across toggles via SID_EDITDOC (which do change SetOpenMode):
     189             :     bool                IsOriginallyReadOnly() const;
     190             : 
     191             :     css::uno::Reference< css::io::XInputStream >  GetInputStream();
     192             : 
     193             :     void                CreateTempFile( sal_Bool bReplace = sal_True );
     194             :     void                CreateTempFileNoCopy();
     195             :     OUString     SwitchDocumentToTempFile();
     196             :     sal_Bool            SwitchDocumentToFile( const OUString& aURL );
     197             : 
     198             :     OUString     GetBaseURL( bool bForSaving=false );
     199             :     void                SetInCheckIn( bool bInCheckIn );
     200             :     bool                IsInCheckIn( );
     201             : 
     202             :     SAL_DLLPRIVATE sal_Bool HasStorage_Impl() const;
     203             : 
     204             :     SAL_DLLPRIVATE void StorageBackup_Impl();
     205             :     SAL_DLLPRIVATE OUString GetBackup_Impl();
     206             : 
     207             :     SAL_DLLPRIVATE css::uno::Reference< css::embed::XStorage > GetZipStorageToSign_Impl( sal_Bool bReadOnly = sal_True );
     208             :     SAL_DLLPRIVATE void CloseZipStorage_Impl();
     209             : 
     210             :     // the storage that will be returned by the medium on GetStorage request
     211             :     SAL_DLLPRIVATE void SetStorage_Impl( const css::uno::Reference< css::embed::XStorage >& xNewStorage );
     212             : 
     213             :     SAL_DLLPRIVATE css::uno::Reference< css::io::XInputStream > GetInputStream_Impl();
     214             :     SAL_DLLPRIVATE void CloseAndReleaseStreams_Impl();
     215             :     SAL_DLLPRIVATE sal_uInt16 AddVersion_Impl( css::util::RevisionTag& rVersion );
     216             :     SAL_DLLPRIVATE sal_Bool TransferVersionList_Impl( SfxMedium& rMedium );
     217             :     SAL_DLLPRIVATE sal_Bool SaveVersionList_Impl( sal_Bool bUseXML );
     218             :     SAL_DLLPRIVATE sal_Bool RemoveVersion_Impl( const OUString& rVersion );
     219             : 
     220             :     SAL_DLLPRIVATE void SetExpired_Impl( const DateTime& rDateTime );
     221             :     SAL_DLLPRIVATE SvKeyValueIterator* GetHeaderAttributes_Impl();
     222             : 
     223             :     // Diese Protokolle liefern MIME Typen
     224             :     SAL_DLLPRIVATE sal_Bool SupportsMIME_Impl() const;
     225             : 
     226             :     SAL_DLLPRIVATE void Init_Impl();
     227             :     SAL_DLLPRIVATE void ForceSynchronStream_Impl( sal_Bool bSynchron );
     228             : 
     229             :     SAL_DLLPRIVATE void GetLockingStream_Impl();
     230             :     SAL_DLLPRIVATE void GetMedium_Impl();
     231             :     SAL_DLLPRIVATE sal_Bool TryDirectTransfer( const OUString& aURL, SfxItemSet& aTargetSet );
     232             :     SAL_DLLPRIVATE void Transfer_Impl();
     233             :     SAL_DLLPRIVATE void CreateFileStream();
     234             :     SAL_DLLPRIVATE void SetUpdatePickList(sal_Bool);
     235             :     SAL_DLLPRIVATE sal_Bool IsUpdatePickList() const;
     236             : 
     237             :     SAL_DLLPRIVATE void SetLongName(const OUString &rName);
     238             :     SAL_DLLPRIVATE const OUString & GetLongName() const;
     239             :     SAL_DLLPRIVATE ErrCode CheckOpenMode_Impl( sal_Bool bSilent, sal_Bool bAllowRO = sal_True );
     240             :     SAL_DLLPRIVATE sal_Bool IsPreview_Impl();
     241             :     SAL_DLLPRIVATE void ClearBackup_Impl();
     242             :     SAL_DLLPRIVATE void Done_Impl( ErrCode );
     243             :     SAL_DLLPRIVATE void SetPhysicalName_Impl(const OUString& rName);
     244             :     SAL_DLLPRIVATE void CanDisposeStorage_Impl( sal_Bool bDisposeStorage );
     245             :     SAL_DLLPRIVATE sal_Bool WillDisposeStorageOnClose_Impl();
     246             : 
     247             :     SAL_DLLPRIVATE void DoBackup_Impl();
     248             :     SAL_DLLPRIVATE void DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent );
     249             :     SAL_DLLPRIVATE void DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent,
     250             :                                                 const OUString& aPrefix,
     251             :                                                 const OUString& aExtension,
     252             :                                                 const OUString& aDestDir );
     253             : 
     254             :     SAL_DLLPRIVATE sal_Bool UseBackupToRestore_Impl( ::ucbhelper::Content& aOriginalContent,
     255             :                              const css::uno::Reference< css::ucb::XCommandEnvironment >& xComEnv );
     256             : 
     257             :     SAL_DLLPRIVATE sal_Bool StorageCommit_Impl();
     258             : 
     259             :     SAL_DLLPRIVATE sal_Bool TransactedTransferForFS_Impl( const INetURLObject& aSource,
     260             :                              const INetURLObject& aDest,
     261             :                              const css::uno::Reference< css::ucb::XCommandEnvironment >& xComEnv );
     262             : 
     263             :     SAL_DLLPRIVATE sal_Bool SignContents_Impl( sal_Bool bScriptingContent, const OUString& aODFVersion, sal_Bool bHasValidDocumentSignature );
     264             : 
     265             :     // the following two methods must be used and make sence only during saving currently
     266             :     // TODO/LATER: in future the signature state should be controlled by the medium not by the document
     267             :     //             in this case the methods will be used generally, and might need to be renamed
     268             :     SAL_DLLPRIVATE sal_uInt16 GetCachedSignatureState_Impl();
     269             :     SAL_DLLPRIVATE void       SetCachedSignatureState_Impl( sal_uInt16 nState );
     270             : 
     271             :     static css::uno::Sequence < css::util::RevisionTag > GetVersionList(
     272             :                     const css::uno::Reference< css::embed::XStorage >& xStorage );
     273             :     static OUString CreateTempCopyWithExt( const OUString& aURL );
     274             :     static sal_Bool CallApproveHandler( const css::uno::Reference< css::task::XInteractionHandler >& xHandler, css::uno::Any aRequest, sal_Bool bAllowAbort );
     275             : 
     276             :     static sal_Bool     SetWritableForUserOnly( const OUString& aURL );
     277             :     static sal_uInt32   CreatePasswordToModifyHash( const OUString& aPasswd, sal_Bool bWriter );
     278             : };
     279             : 
     280         430 : SV_DECL_IMPL_REF( SfxMedium )
     281             : 
     282             : typedef ::std::vector< SfxMedium* > SfxMediumList;
     283             : 
     284             : #endif
     285             : 
     286             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10