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

Generated by: LCOV version 1.10