summaryrefslogtreecommitdiff
path: root/sot/source
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2001-05-21 12:28:40 +0000
committerMathias Bauer <mba@openoffice.org>2001-05-21 12:28:40 +0000
commit4c5825daeb3b7bfd2dbf2714b60745a7258f23fa (patch)
tree741a4c61416c1ec3fc525138dbfc54c595b22223 /sot/source
parent794735c369a5b194635ee03220cb0bd68866a273 (diff)
#86409#: don't open xml-streams in Init, they could be encrypted
Diffstat (limited to 'sot/source')
-rw-r--r--sot/source/sdstor/ucbstorage.cxx21
1 files changed, 18 insertions, 3 deletions
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 58dadeb42bea..e6897d4b0cd7 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -924,13 +924,26 @@ void UCBStorage_Impl::Init()
::rtl::OUString aContentType= xRow->getString(3);
UCBStorageElement_Impl* pElement = new UCBStorageElement_Impl( aTitle, aContentType, bIsFolder, (ULONG) nSize );
m_aChildrenList.Insert( pElement, LIST_APPEND );
+
if ( !bIsFolder )
{
// will be replaced by a detection using the MediaType
- BaseStorageStream* pStream = m_pAntiImpl->OpenStream( xRow->getString(1), STREAM_STD_READ, m_bDirect );
- if ( Storage::IsStorageFile( const_cast < SvStream* > ( pStream->GetSvStream() ) ) )
+ String aName( m_aURL );
+ aName += '/';
+ aName += String( xRow->getString(1) );
+ ::ucb::Content aContent( aName, Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
+
+ ::rtl::OUString aMediaType;
+ Any aAny = aContent.getPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ) );
+ if ( ( aAny >>= aMediaType ) && ( aMediaType.compareToAscii("application/vnd.sun.star.oleobject") == 0 ) )
pElement->m_bIsStorage = TRUE;
- delete pStream;
+ else if ( !aMediaType.getLength() )
+ {
+ BaseStorageStream* pStream = m_pAntiImpl->OpenStream( xRow->getString(1), STREAM_STD_READ, m_bDirect );
+ if ( Storage::IsStorageFile( const_cast < SvStream* > ( pStream->GetSvStream() ) ) )
+ pElement->m_bIsStorage = TRUE;
+ delete pStream;
+ }
}
}
}
@@ -1062,6 +1075,8 @@ sal_Int16 UCBStorage_Impl::Commit()
else if ( pElement->m_xStream.Is() )
{
nLocalRet = pElement->m_xStream->Commit();
+ if ( pElement->m_xStream->m_bIsOLEStorage )
+ pElement->m_xStream->m_aContentType = String::CreateFromAscii("application/vnd.sun.star.oleobject");
pContent = pElement->GetContent();
}