summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2009-10-14 16:58:08 +0000
committerKurt Zenker <kz@openoffice.org>2009-10-14 16:58:08 +0000
commitdd74e6d59eab15a9ad7c674372293a7d3dbad975 (patch)
tree476cd284f1003569e254ff567be850908f07aea7 /package
parent9033e68b120609c2817915b9b6c024a395f09280 (diff)
CWS-TOOLING: integrate CWS fwk121
2009-09-30 11:20:33 +0200 mav r276548 : #i105387# allow manifest.xml have no ODF version attribute even for ODF1.2 2009-09-30 10:54:46 +0200 mav r276545 : #i105387# allow manifest.xml have no ODF version attribute even for ODF1.2 2009-09-30 10:02:12 +0200 mav r276543 : #i105082# integrating the fix from fwk117, since it is necessary for some scenarios fixed in this cws 2009-09-30 07:33:48 +0200 jsc r276537 : #i105360# explicitly flush OStorageStream after write operations and OStoreFile when registry file is closed 2009-09-29 14:15:09 +0200 jsc r276528 : #i105360# explicitly flush OStorageStream after write operations and OStoreFile when registry file is closed 2009-09-29 09:45:28 +0200 dr r276507 : #i105325# set correct format while opening zip package 2009-09-28 18:46:45 +0200 mav r276500 : CWS-TOOLING: rebase CWS fwk121 to trunk@276429 (milestone: DEV300:m60)
Diffstat (limited to 'package')
-rw-r--r--package/inc/ZipPackage.hxx1
-rw-r--r--package/source/xstor/xstorage.cxx18
-rw-r--r--package/source/zippackage/ZipPackage.cxx20
3 files changed, 30 insertions, 9 deletions
diff --git a/package/inc/ZipPackage.hxx b/package/inc/ZipPackage.hxx
index 0549c06b6bb7..72cba808de15 100644
--- a/package/inc/ZipPackage.hxx
+++ b/package/inc/ZipPackage.hxx
@@ -91,6 +91,7 @@ protected:
::rtl::OUString m_aURL;
sal_Bool m_bHasEncryptedEntries;
sal_Bool m_bHasNonEncryptedEntries;
+ sal_Bool m_bInconsistent;
sal_Bool m_bUseManifest;
sal_Bool m_bForceRecovery;
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 4d0af7bb7619..74c30049e9bd 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -4780,7 +4780,10 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName,
//TODO: think about interaction handler
- if ( m_pData->m_bReadOnlyWrap )
+ // WORKAROUND:
+ // The old document might have no version in the manifest.xml, so we have to allow to set the version
+ // even for readonly storages, so that the version from content.xml can be used.
+ if ( m_pData->m_bReadOnlyWrap && !aPropertyName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) )
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: Access denied
if ( m_pData->m_nStorageType == ZIP_STORAGE )
@@ -4800,11 +4803,16 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName,
aValue >>= m_pImpl->m_aVersion;
m_pImpl->m_bControlVersion = sal_True;
- m_pImpl->m_bBroadcastModified = sal_True;
- m_pImpl->m_bIsModified = sal_True;
+ // this property can be set even for readonly storage
+ if ( !m_pData->m_bReadOnlyWrap )
+ {
+ m_pImpl->m_bBroadcastModified = sal_True;
+ m_pImpl->m_bIsModified = sal_True;
+ }
}
else if ( m_pData->m_bIsRoot && ( aPropertyName.equalsAscii( "HasEncryptedEntries" )
|| aPropertyName.equalsAscii( "HasNonEncryptedEntries" )
+ || aPropertyName.equalsAscii( "IsInconsistent" )
|| aPropertyName.equalsAscii( "URL" )
|| aPropertyName.equalsAscii( "RepairPackage" ) )
|| aPropertyName.equalsAscii( "IsRoot" )
@@ -4939,7 +4947,9 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa
return uno::makeAny( sal_False ); // RepairPackage
}
else if ( m_pData->m_nStorageType == PACKAGE_STORAGE
- && ( aPropertyName.equalsAscii( "HasEncryptedEntries" ) || aPropertyName.equalsAscii( "HasNonEncryptedEntries" ) ) )
+ && ( aPropertyName.equalsAscii( "HasEncryptedEntries" )
+ || aPropertyName.equalsAscii( "HasNonEncryptedEntries" )
+ || aPropertyName.equalsAscii( "IsInconsistent" ) ) )
{
try {
m_pImpl->ReadContents();
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index b95711778e77..6ca9981d2291 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -201,6 +201,7 @@ ZipPackage::ZipPackage (const uno::Reference < XMultiServiceFactory > &xNewFacto
: m_aMutexHolder( new SotMutexHolder )
, m_bHasEncryptedEntries ( sal_False )
, m_bHasNonEncryptedEntries ( sal_False )
+, m_bInconsistent ( sal_False )
, m_bUseManifest ( sal_True )
, m_bForceRecovery ( sal_False )
, m_bMediaTypeFallbackUsed ( sal_False )
@@ -426,20 +427,23 @@ void ZipPackage::parseManifest()
m_xRootFolder->removeByName( sMimetype );
}
+ m_bInconsistent = m_pRootFolder->LookForUnexpectedODF12Streams( ::rtl::OUString() );
+
sal_Bool bODF12AndOlder = ( m_pRootFolder->GetVersion().compareTo( ODFVER_012_TEXT ) >= 0 );
- if ( !m_bForceRecovery && bODF12AndOlder && m_pRootFolder->LookForUnexpectedODF12Streams( ::rtl::OUString() ) )
+ if ( !m_bForceRecovery && bODF12AndOlder && m_bInconsistent )
{
- // this is an ODF1.2 document that contains streams not referred in the manifest.xml
+ // this is an ODF1.2 document that contains streams not referred in the manifest.xml;
+ // in case of ODF1.2 documents without version in manifest.xml the property IsInconsistent
+ // should be checked later
throw ZipIOException(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "there are streams not referred in manifest.xml\n" ) ),
uno::Reference< uno::XInterface >() );
}
+ // in case it is a correct ODF1.2 document, the version must be set
+ // and the META-INF folder is reserved for package format
if ( bODF12AndOlder )
- {
- // it is ODF1.2 or later, let the META-INF folder be unavailable for user
m_xRootFolder->removeByName( sMeta );
- }
}
}
@@ -1633,6 +1637,7 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const
if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HasEncryptedEntries") )
||aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HasNonEncryptedEntries") )
+ ||aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("IsInconsistent") )
||aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaTypeFallbackUsed") ) )
throw PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EncryptionKey") ) )
@@ -1671,6 +1676,11 @@ Any SAL_CALL ZipPackage::getPropertyValue( const OUString& PropertyName )
aAny <<= m_bHasNonEncryptedEntries;
return aAny;
}
+ else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "IsInconsistent" ) ) )
+ {
+ aAny <<= m_bInconsistent;
+ return aAny;
+ }
else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "UseManifest" ) ) )
{
aAny <<= m_bUseManifest;