diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2005-02-25 08:37:58 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2005-02-25 08:37:58 +0000 |
commit | 9496b744b3cc6ba434614a334969d98380437032 (patch) | |
tree | 2a3137b1c0d1bc808c74096e6643239d249632bb /package | |
parent | 2b0c932db36f940ff937dbb097a9a84bf70a2b7f (diff) |
INTEGRATION: CWS mav16 (1.16.18); FILE MERGED
2005/02/10 14:11:04 mav 1.16.18.1: #i41809# fallback to detect mediatype of a package with no manifest.xml
Diffstat (limited to 'package')
-rw-r--r-- | package/source/xstor/xstorage.cxx | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index f18735601612..84713a071752 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xstorage.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: mav $ $Date: 2004-11-29 11:00:31 $ + * last change: $Author: vg $ $Date: 2005-02-25 09:37:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -266,6 +266,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XInputStream > xInputStream, , m_bHasCommonPassword( sal_False ) , m_pParent( NULL ) , m_bControlMediaType( sal_False ) +, m_bMTFallbackUsed( sal_False ) { // all the checks done below by assertion statements must be done by factory OSL_ENSURE( xInputStream.is(), "No input stream is provided!\n" ); @@ -296,6 +297,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > xStream, , m_bHasCommonPassword( sal_False ) , m_pParent( NULL ) , m_bControlMediaType( sal_False ) +, m_bMTFallbackUsed( sal_False ) { // all the checks done below by assertion statements must be done by factory OSL_ENSURE( xStream.is(), "No stream is provided!\n" ); @@ -331,6 +333,7 @@ OStorage_Impl::OStorage_Impl( OStorage_Impl* pParent, , m_bHasCommonPassword( sal_False ) , m_pParent( pParent ) // can be empty in case of temporary readonly substorages , m_bControlMediaType( sal_False ) +, m_bMTFallbackUsed( sal_False ) { OSL_ENSURE( xPackageFolder.is(), "No package folder!\n" ); } @@ -526,11 +529,12 @@ void OStorage_Impl::GetStorageProperties() { if ( !m_bControlMediaType ) { - uno::Reference< beans::XPropertySet > xProps( m_xPackageFolder, uno::UNO_QUERY ); - if ( !xProps.is() ) - throw uno::RuntimeException(); // TODO: + uno::Reference< beans::XPropertySet > xPackageProps( m_xPackage, uno::UNO_QUERY_THROW ); + xPackageProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaTypeFallbackUsed" ) ) ) + >>= m_bMTFallbackUsed; - xProps->getPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ) ) >>= m_aMediaType; + uno::Reference< beans::XPropertySet > xProps( m_xPackageFolder, uno::UNO_QUERY_THROW ); + xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ) ) >>= m_aMediaType; m_bControlMediaType = sal_True; } } @@ -978,6 +982,9 @@ void OStorage_Impl::Commit() SetModifiedInternally( sal_False ); + // after commit the mediatype treated as the correct one + m_bMTFallbackUsed = sal_False; + // when the storage is commited the parent is modified if ( m_pParent ) m_pParent->SetModifiedInternally( sal_True ); @@ -3570,7 +3577,8 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName, else if ( m_pImpl->m_bIsRoot && ( aPropertyName.equalsAscii( "HasEncryptedEntries" ) || aPropertyName.equalsAscii( "URL" ) || aPropertyName.equalsAscii( "RepairPackage" ) ) - || aPropertyName.equalsAscii( "IsRoot" ) ) + || aPropertyName.equalsAscii( "IsRoot" ) + || aPropertyName.equalsAscii( "MediaTypeFallbackUsed" ) ) throw beans::PropertyVetoException(); // TODO else throw beans::UnknownPropertyException(); // TODO @@ -3588,7 +3596,8 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa if ( !m_pImpl ) throw lang::DisposedException(); - if ( aPropertyName.equalsAscii( "MediaType" ) ) + if ( aPropertyName.equalsAscii( "MediaType" ) + || aPropertyName.equalsAscii( "MediaTypeFallbackUsed" ) ) { try { @@ -3607,7 +3616,10 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa aCaught ); } - return uno::makeAny( m_pImpl->m_aMediaType ); + if ( aPropertyName.equalsAscii( "MediaType" ) ) + return uno::makeAny( m_pImpl->m_aMediaType ); + else + return uno::makeAny( m_pImpl->m_bMTFallbackUsed ); } else if ( aPropertyName.equalsAscii( "IsRoot" ) ) { |