diff options
author | Martin Gallwey <mtg@openoffice.org> | 2001-01-16 16:06:14 +0000 |
---|---|---|
committer | Martin Gallwey <mtg@openoffice.org> | 2001-01-16 16:06:14 +0000 |
commit | a07c5767d169736eb5315dd9b6bfcfc76190cef5 (patch) | |
tree | 07168cc7c1b3535c67c98b001da519dc84573048 /package/source/zippackage/ZipPackageEntry.cxx | |
parent | 7861586c997fcc1373cceb5af1c0e9724eb3b625 (diff) |
This change allows the compression state of a saved stream to be changed. That is, if a stream in a saved Package is stored uncompressed, the user can specify that it should be stored compressed when that Package is next written to disk
Diffstat (limited to 'package/source/zippackage/ZipPackageEntry.cxx')
-rw-r--r-- | package/source/zippackage/ZipPackageEntry.cxx | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/package/source/zippackage/ZipPackageEntry.cxx b/package/source/zippackage/ZipPackageEntry.cxx index fd30cf0a44bd..fb387b47f849 100644 --- a/package/source/zippackage/ZipPackageEntry.cxx +++ b/package/source/zippackage/ZipPackageEntry.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ZipPackageEntry.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: mtg $ $Date: 2001-01-11 15:05:48 $ + * last change: $Author: mtg $ $Date: 2001-01-16 17:06:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,7 +67,8 @@ using namespace com::sun::star::package::ZipConstants; using namespace rtl; ZipPackageEntry::ZipPackageEntry (void) -: bPackageMember ( sal_False ) +: bPackageMember ( sal_False ) +, bToBeCompressed ( sal_True ) { } @@ -147,31 +148,15 @@ void SAL_CALL ZipPackageEntry::setPropertyValue( const ::rtl::OUString& aPropert { aValue >>= sMediaType; - // If this ZipPackageEntry is a new entry to the package, set it's - // compression method based on mime type. Obviously, if it's an existing - // member, we can't change the compression type without Bad Things - // Happening (tm) - if ( !bPackageMember && sMediaType.getLength() > 0 ) - { - if ( sMediaType.indexOf (OUString::createFromAscii("text")) != -1) - aEntry.nMethod = DEFLATED; - else - aEntry.nMethod = STORED; - } + if ( sMediaType.indexOf (OUString::createFromAscii("text")) != -1) + bToBeCompressed = sal_True; + else + bToBeCompressed = sal_False; } else if (aPropertyName == OUString::createFromAscii("Size")) aValue >>= aEntry.nSize; else if (aPropertyName == OUString::createFromAscii("Compress")) - { - if (bPackageMember) - return; - sal_Bool bCompress; - aValue >>= bCompress; - if (bCompress) - aEntry.nMethod = DEFLATED; - else - aEntry.nMethod = STORED; - } + aValue >>= bToBeCompressed; else throw beans::UnknownPropertyException(); } @@ -191,12 +176,7 @@ uno::Any SAL_CALL ZipPackageEntry::getPropertyValue( const ::rtl::OUString& Prop } else if (PropertyName == OUString::createFromAscii("Compress")) { - sal_Bool bCompress = sal_False; - - if (aEntry.nMethod == DEFLATED) - bCompress = sal_True; - - aAny <<= bCompress; + aAny <<= bToBeCompressed; return aAny; } else |