1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _WRITESTREAM_HXX_ 29*cdf0e10cSrcweir #define _WRITESTREAM_HXX_ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/io/XStream.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/io/XSeekable.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/io/XTruncate.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/packages/XDataSinkEncrSupport.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/packages/NoEncryptionException.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/embed/XEncryptionProtectedSource2.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/embed/XStorage.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/embed/XRelationshipAccess.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/embed/XExtendedStorageStream.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/embed/XTransactedObject.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/embed/XTransactionBroadcaster.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 48*cdf0e10cSrcweir #include <com/sun/star/beans/StringPair.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/logging/XSimpleLogRing.hpp> 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 53*cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 54*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir #include <comphelper/sequenceashashmap.hxx> 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir #include <list> 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir #include "ocompinstream.hxx" 61*cdf0e10cSrcweir #include "mutexholder.hxx" 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir struct PreCreationStruct 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir SotMutexHolderRef m_rMutexRef; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir PreCreationStruct() 69*cdf0e10cSrcweir : m_rMutexRef( new SotMutexHolder ) 70*cdf0e10cSrcweir {} 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir }; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir namespace cppu { 75*cdf0e10cSrcweir class OTypeCollection; 76*cdf0e10cSrcweir } 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir namespace package { 79*cdf0e10cSrcweir void StaticAddLog( const ::rtl::OUString& aMessage ); 80*cdf0e10cSrcweir bool PackageEncryptionDatasEqual( const ::comphelper::SequenceAsHashMap& aHash1, const ::comphelper::SequenceAsHashMap& aHash2 ); 81*cdf0e10cSrcweir } 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir struct WSInternalData_Impl 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir SotMutexHolderRef m_rSharedMutexRef; 86*cdf0e10cSrcweir ::cppu::OTypeCollection* m_pTypeCollection; 87*cdf0e10cSrcweir ::cppu::OMultiTypeInterfaceContainerHelper m_aListenersContainer; // list of listeners 88*cdf0e10cSrcweir sal_Int32 m_nStorageType; 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir // the mutex reference MUST NOT be empty 91*cdf0e10cSrcweir WSInternalData_Impl( const SotMutexHolderRef rMutexRef, sal_Int32 nStorageType ) 92*cdf0e10cSrcweir : m_rSharedMutexRef( rMutexRef ) 93*cdf0e10cSrcweir , m_pTypeCollection( NULL ) 94*cdf0e10cSrcweir , m_aListenersContainer( rMutexRef->GetMutex() ) 95*cdf0e10cSrcweir , m_nStorageType( nStorageType ) 96*cdf0e10cSrcweir {} 97*cdf0e10cSrcweir }; 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir typedef ::std::list< OInputCompStream* > InputStreamsList_Impl; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir struct OStorage_Impl; 102*cdf0e10cSrcweir class OWriteStream; 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir struct OWriteStream_Impl : public PreCreationStruct 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir friend struct OStorage_Impl; 107*cdf0e10cSrcweir friend class OWriteStream; 108*cdf0e10cSrcweir friend class OInputCompStream; 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir OWriteStream* m_pAntiImpl; 111*cdf0e10cSrcweir ::rtl::OUString m_aTempURL; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xCacheStream; 114*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xCacheSeek; 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir InputStreamsList_Impl m_aInputStreamsList; 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir sal_Bool m_bHasDataToFlush; // only modified elements will be sent to the original content 119*cdf0e10cSrcweir sal_Bool m_bFlushed; // sending the streams is coordinated by the root storage of the package 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::packages::XDataSinkEncrSupport > m_xPackageStream; 122*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::logging::XSimpleLogRing > m_xLogRing; 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir OStorage_Impl* m_pParent; 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aProps; 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir sal_Bool m_bForceEncrypted; 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir sal_Bool m_bUseCommonEncryption; 133*cdf0e10cSrcweir sal_Bool m_bHasCachedEncryptionData; 134*cdf0e10cSrcweir ::comphelper::SequenceAsHashMap m_aEncryptionData; 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir sal_Bool m_bCompressedSetExplicit; 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > m_xPackage; 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir sal_Bool m_bHasInsertedStreamOptimization; 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir sal_Int32 m_nStorageType; 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir // Relations info related data, stored in *.rels file in OFOPXML format 145*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xOrigRelInfoStream; 146*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > m_aOrigRelInfo; 147*cdf0e10cSrcweir sal_Bool m_bOrigRelInfoBroken; 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > m_aNewRelInfo; 150*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xNewRelInfoStream; 151*cdf0e10cSrcweir sal_Int16 m_nRelInfoStatus; 152*cdf0e10cSrcweir sal_Int32 m_nRelId; 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir private: 156*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > GetServiceFactory(); 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir ::rtl::OUString GetFilledTempFileIfNo( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xStream ); 159*cdf0e10cSrcweir ::rtl::OUString FillTempGetFileName(); 160*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetTempFileAsStream(); 161*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetTempFileAsInputStream(); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStream_Impl( sal_Int32 nStreamMode, 164*cdf0e10cSrcweir sal_Bool bHierarchyAccess ); 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir ::comphelper::SequenceAsHashMap GetCommonRootEncryptionData() throw ( ::com::sun::star::packages::NoEncryptionException ); 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > ReadPackageStreamProperties(); 169*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > InsertOwnProps( 170*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps, 171*cdf0e10cSrcweir sal_Bool bUseCommonEncryption ); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir public: 174*cdf0e10cSrcweir OWriteStream_Impl( 175*cdf0e10cSrcweir OStorage_Impl* pParent, 176*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::packages::XDataSinkEncrSupport >& xPackageStream, 177*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory >& xPackage, 178*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory, 179*cdf0e10cSrcweir sal_Bool bForceEncrypted, 180*cdf0e10cSrcweir sal_Int32 nStorageType, 181*cdf0e10cSrcweir sal_Bool bDefaultCompress, 182*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xRelInfoStream = 183*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >() ); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir ~OWriteStream_Impl(); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir void CleanCacheStream(); 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir void AddLog( const ::rtl::OUString& aMessage ); 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir sal_Bool UsesCommonEncryption_Impl() { return m_bUseCommonEncryption; } 192*cdf0e10cSrcweir sal_Bool HasTempFile_Impl() { return ( m_aTempURL.getLength() != 0 ); } 193*cdf0e10cSrcweir sal_Bool IsTransacted(); 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir sal_Bool HasWriteOwner_Impl() { return ( m_pAntiImpl != NULL ); } 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir void InsertIntoPackageFolder( 198*cdf0e10cSrcweir const ::rtl::OUString& aName, 199*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xParentPackageFolder ); 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir void SetToBeCommited() { m_bFlushed = sal_True; } 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir sal_Bool HasCachedEncryptionData() { return m_bHasCachedEncryptionData; } 204*cdf0e10cSrcweir ::comphelper::SequenceAsHashMap& GetCachedEncryptionData() { return m_aEncryptionData; } 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir sal_Bool IsModified() { return m_bHasDataToFlush || m_bFlushed; } 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir sal_Bool IsEncrypted(); 209*cdf0e10cSrcweir void SetDecrypted(); 210*cdf0e10cSrcweir void SetEncrypted( const ::comphelper::SequenceAsHashMap& aEncryptionData ); 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir void DisposeWrappers(); 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir void InsertStreamDirectly( 215*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, 216*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps ); 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir void Commit(); 219*cdf0e10cSrcweir void Revert(); 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir void Free( sal_Bool bMust ); // allows to try to disconnect from the temporary stream 222*cdf0e10cSrcweir // in case bMust is set to sal_True the method 223*cdf0e10cSrcweir // will throw exception in case the file is still busy 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir void SetModified(); // can be done only by parent storage after renaming 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetStreamProperties(); 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > GetAllRelationshipsIfAny(); 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir void CopyInternallyTo_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xDestStream, 232*cdf0e10cSrcweir const ::comphelper::SequenceAsHashMap& aEncryptionData ); 233*cdf0e10cSrcweir void CopyInternallyTo_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xDestStream ); 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStream( 236*cdf0e10cSrcweir sal_Int32 nStreamMode, 237*cdf0e10cSrcweir const ::comphelper::SequenceAsHashMap& aEncryptionData, 238*cdf0e10cSrcweir sal_Bool bHierarchyAccess ); 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStream( 241*cdf0e10cSrcweir sal_Int32 nStreamMode, 242*cdf0e10cSrcweir sal_Bool bHierarchyAccess ); 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetRawInStream(); 246*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetPlainRawInStream(); 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir void InputStreamDisposed( OInputCompStream* pStream ); 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir void CreateReadonlyCopyBasedOnData( 251*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xDataToCopy, 252*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps, 253*cdf0e10cSrcweir sal_Bool bUseCommonEncryption, 254*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream ); 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir void GetCopyOfLastCommit( ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream ); 257*cdf0e10cSrcweir void GetCopyOfLastCommit( 258*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream, 259*cdf0e10cSrcweir const ::comphelper::SequenceAsHashMap& aEncryptionData ); 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir void CommitStreamRelInfo( 263*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xRelStorage, 264*cdf0e10cSrcweir const ::rtl::OUString& aOrigStreamName, 265*cdf0e10cSrcweir const ::rtl::OUString& aNewStreamName ); 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir void ReadRelInfoIfNecessary(); 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir sal_Int32 GetNewRelId() { return m_nRelId ++; } 270*cdf0e10cSrcweir }; 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir class OWriteStream : ::com::sun::star::lang::XTypeProvider 273*cdf0e10cSrcweir , public ::com::sun::star::io::XInputStream 274*cdf0e10cSrcweir , public ::com::sun::star::io::XOutputStream 275*cdf0e10cSrcweir , public ::com::sun::star::embed::XExtendedStorageStream 276*cdf0e10cSrcweir , public ::com::sun::star::io::XSeekable 277*cdf0e10cSrcweir , public ::com::sun::star::io::XTruncate 278*cdf0e10cSrcweir , public ::com::sun::star::embed::XEncryptionProtectedSource2 279*cdf0e10cSrcweir , public ::com::sun::star::embed::XRelationshipAccess 280*cdf0e10cSrcweir , public ::com::sun::star::embed::XTransactedObject 281*cdf0e10cSrcweir , public ::com::sun::star::embed::XTransactionBroadcaster 282*cdf0e10cSrcweir , public ::com::sun::star::beans::XPropertySet 283*cdf0e10cSrcweir , public ::cppu::OWeakObject 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir friend struct OWriteStream_Impl; 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir protected: 288*cdf0e10cSrcweir ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > m_xInStream; 289*cdf0e10cSrcweir ::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > m_xOutStream; 290*cdf0e10cSrcweir ::com::sun::star::uno::Reference < ::com::sun::star::io::XSeekable > m_xSeekable; 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir OWriteStream_Impl* m_pImpl; 293*cdf0e10cSrcweir WSInternalData_Impl* m_pData; 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir sal_Bool m_bInStreamDisconnected; 296*cdf0e10cSrcweir sal_Bool m_bInitOnDemand; 297*cdf0e10cSrcweir sal_Int64 m_nInitPosition; 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir sal_Bool m_bTransacted; 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir OWriteStream( OWriteStream_Impl* pImpl, sal_Bool bTransacted ); 302*cdf0e10cSrcweir OWriteStream( OWriteStream_Impl* pImpl, ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xStream, sal_Bool bTransacted ); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir void CloseOutput_Impl(); 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir void CopyToStreamInternally_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream ); 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir void ModifyParentUnlockMutex_Impl( ::osl::ResettableMutexGuard& aGuard ); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir void BroadcastTransaction( sal_Int8 nMessage ); 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir public: 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir virtual ~OWriteStream(); 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir void CheckInitOnDemand(); 317*cdf0e10cSrcweir void DeInit(); 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir // XInterface 320*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) 321*cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 322*cdf0e10cSrcweir virtual void SAL_CALL acquire() throw(); 323*cdf0e10cSrcweir virtual void SAL_CALL release() throw(); 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir // XTypeProvider 326*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() 327*cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 328*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() 329*cdf0e10cSrcweir throw( ::com::sun::star::uno::RuntimeException ); 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir // XInputStream 332*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) 333*cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 334*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 335*cdf0e10cSrcweir virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) 336*cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 337*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL available( ) 338*cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 339*cdf0e10cSrcweir virtual void SAL_CALL closeInput( ) 340*cdf0e10cSrcweir throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir // XOutputStream 343*cdf0e10cSrcweir virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 344*cdf0e10cSrcweir virtual void SAL_CALL flush( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 345*cdf0e10cSrcweir virtual void SAL_CALL closeOutput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir //XSeekable 348*cdf0e10cSrcweir virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 349*cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getPosition() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 350*cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getLength() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir //XStream 353*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException); 354*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException); 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir // XTruncate 357*cdf0e10cSrcweir virtual void SAL_CALL truncate() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir //XComponent 360*cdf0e10cSrcweir virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); 361*cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 362*cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir //XEncryptionProtectedSource 365*cdf0e10cSrcweir virtual void SAL_CALL setEncryptionPassword( const ::rtl::OUString& aPass ) 366*cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException, 367*cdf0e10cSrcweir ::com::sun::star::io::IOException ); 368*cdf0e10cSrcweir virtual void SAL_CALL removeEncryption() 369*cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException, 370*cdf0e10cSrcweir ::com::sun::star::io::IOException ); 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir //XEncryptionProtectedSource2 373*cdf0e10cSrcweir virtual void SAL_CALL setEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir //XRelationshipAccess 376*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasByID( const ::rtl::OUString& sID ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 377*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getTargetByID( const ::rtl::OUString& sID ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 378*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getTypeByID( const ::rtl::OUString& sID ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 379*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > SAL_CALL getRelationshipByID( const ::rtl::OUString& sID ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 380*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > SAL_CALL getRelationshipsByType( const ::rtl::OUString& sType ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 381*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > SAL_CALL getAllRelationships( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 382*cdf0e10cSrcweir virtual void SAL_CALL insertRelationshipByID( const ::rtl::OUString& sID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aEntry, ::sal_Bool bReplace ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 383*cdf0e10cSrcweir virtual void SAL_CALL removeRelationshipByID( const ::rtl::OUString& sID ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 384*cdf0e10cSrcweir virtual void SAL_CALL insertRelationships( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > >& aEntries, ::sal_Bool bReplace ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 385*cdf0e10cSrcweir virtual void SAL_CALL clearRelationships( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir //XPropertySet 388*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw ( ::com::sun::star::uno::RuntimeException ); 389*cdf0e10cSrcweir virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw ( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); 390*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw ( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); 391*cdf0e10cSrcweir virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw ( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); 392*cdf0e10cSrcweir virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw ( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); 393*cdf0e10cSrcweir virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw ( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); 394*cdf0e10cSrcweir virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw ( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir // XTransactedObject 397*cdf0e10cSrcweir virtual void SAL_CALL commit() 398*cdf0e10cSrcweir throw ( ::com::sun::star::io::IOException, 399*cdf0e10cSrcweir ::com::sun::star::embed::StorageWrappedTargetException, 400*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException ); 401*cdf0e10cSrcweir virtual void SAL_CALL revert() 402*cdf0e10cSrcweir throw ( ::com::sun::star::io::IOException, 403*cdf0e10cSrcweir ::com::sun::star::embed::StorageWrappedTargetException, 404*cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException ); 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir // XTransactionBroadcaster 407*cdf0e10cSrcweir virtual void SAL_CALL addTransactionListener( 408*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XTransactionListener >& aListener ) 409*cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 410*cdf0e10cSrcweir virtual void SAL_CALL removeTransactionListener( 411*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XTransactionListener >& aListener ) 412*cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir }; 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir #endif 417*cdf0e10cSrcweir 418