diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-05-03 00:05:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-05-03 00:06:33 +0100 |
commit | d726281e9020ebaddfdf6659ecfe7a0454014dff (patch) | |
tree | 439e6e848904ec034c8630444d5dbe3e6443ab06 /sot | |
parent | 80fdb3498c68f9e7f9bdd98674e762cb084fce57 (diff) |
Related: fdo#47644 compound storage backend is poor at knowing stream size
Change-Id: Ie4aa6939f9f37e04fda5425a6e28c5d846a9cb62
Diffstat (limited to 'sot')
-rw-r--r-- | sot/inc/sot/stg.hxx | 3 | ||||
-rw-r--r-- | sot/inc/sot/storage.hxx | 1 | ||||
-rw-r--r-- | sot/source/sdstor/stg.cxx | 7 | ||||
-rw-r--r-- | sot/source/sdstor/storage.cxx | 7 | ||||
-rw-r--r-- | sot/source/sdstor/ucbstorage.cxx | 5 |
5 files changed, 23 insertions, 0 deletions
diff --git a/sot/inc/sot/stg.hxx b/sot/inc/sot/stg.hxx index 225c89eee23a..ab567f3c5b64 100644 --- a/sot/inc/sot/stg.hxx +++ b/sot/inc/sot/stg.hxx @@ -94,6 +94,7 @@ public: virtual sal_Bool Commit() = 0; virtual sal_Bool Revert() = 0; virtual sal_Bool Equals( const BaseStorageStream& rStream ) const = 0; + virtual sal_Size remainingSize() = 0; }; class BaseStorage : public StorageBase @@ -178,6 +179,7 @@ public: virtual sal_Bool ValidateMode( StreamMode ) const; const SvStream* GetSvStream() const; virtual sal_Bool Equals( const BaseStorageStream& rStream ) const; + virtual sal_Size remainingSize(); }; class UCBStorageStream; @@ -270,6 +272,7 @@ public: virtual sal_Bool Revert(); virtual sal_Bool Validate( sal_Bool=sal_False ) const; virtual sal_Bool ValidateMode( StreamMode ) const; + virtual sal_Size remainingSize(); const SvStream* GetSvStream() const; virtual sal_Bool Equals( const BaseStorageStream& rStream ) const; sal_Bool SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue ); diff --git a/sot/inc/sot/storage.hxx b/sot/inc/sot/storage.hxx index b77d6dd13a31..925ae42f89c1 100644 --- a/sot/inc/sot/storage.hxx +++ b/sot/inc/sot/storage.hxx @@ -95,6 +95,7 @@ public: sal_Bool GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue ); ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetXInputStream() const; + virtual sal_Size remainingSize(); }; #ifndef SOT_DECL_SOTSTORAGESTREAM_DEFINED diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx index 27c95c82162d..4f4e991ae6ec 100644 --- a/sot/source/sdstor/stg.cxx +++ b/sot/source/sdstor/stg.cxx @@ -234,6 +234,13 @@ sal_uLong StorageStream::Seek( sal_uLong n ) return n; } +sal_Size StorageStream::remainingSize() +{ + if( Validate() ) + return pEntry->GetSize() - Tell(); + return 0; +} + void StorageStream::Flush() { // Flushing means committing, since streams are never transacted diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index 1006b7c1e5b1..67b270f33863 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -286,6 +286,13 @@ sal_uInt32 SotStorageStream::GetSize() const return nSize; } +sal_Size SotStorageStream::remainingSize() +{ + if (pOwnStm) + return pOwnStm->remainingSize(); + return SvStream::remainingSize(); +} + /************************************************************************* |* SotStorageStream::CopyTo() |* diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 0254ef2f446d..2a1a00047221 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -1554,6 +1554,11 @@ sal_Bool UCBStorageStream::GetProperty( const String& rName, ::com::sun::star::u return sal_False; } +sal_Size UCBStorageStream::remainingSize() +{ + return pImp->GetSize() - Tell(); +} + UCBStorage::UCBStorage( SvStream& rStrm, sal_Bool bDirect ) { String aURL = GetLinkedFile( rStrm ); |