summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-06-16 12:53:59 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-06-16 12:53:59 +0000
commit31011bf56d5015c1c8e5a6d1aaecceaac7d1e5aa (patch)
tree754b32c313d54a96c800e03768dbd4b028939068
parent47ccc8df9b529ae2fa2585c67f3306786d056e40 (diff)
INTEGRATION: CWS rptchart02 (1.24.4); FILE MERGED
2008/04/16 06:36:18 oj 1.24.4.2: RESYNC: (1.24-1.25); FILE MERGED 2008/03/12 09:30:03 oj 1.24.4.1: check if storage is readonly
-rw-r--r--comphelper/source/container/embeddedobjectcontainer.cxx31
1 files changed, 23 insertions, 8 deletions
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index 557ae6770fc9..60fe605d2959 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: embeddedobjectcontainer.cxx,v $
- * $Revision: 1.25 $
+ * $Revision: 1.26 $
*
* This file is part of OpenOffice.org.
*
@@ -168,8 +168,21 @@ sal_Bool EmbeddedObjectContainer::CommitImageSubStorage()
{
try
{
- uno::Reference< embed::XTransactedObject > xTransact( pImpl->mxImageStorage, uno::UNO_QUERY_THROW );
- xTransact->commit();
+ sal_Bool bReadOnlyMode = sal_True;
+ uno::Reference < beans::XPropertySet > xSet(pImpl->mxImageStorage,uno::UNO_QUERY);
+ if ( xSet.is() )
+ {
+ // get the open mode from the parent storage
+ sal_Int32 nMode = 0;
+ uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("OpenMode") );
+ if ( aAny >>= nMode )
+ bReadOnlyMode = !(nMode & embed::ElementModes::WRITE );
+ } // if ( xSet.is() )
+ if ( !bReadOnlyMode )
+ {
+ uno::Reference< embed::XTransactedObject > xTransact( pImpl->mxImageStorage, uno::UNO_QUERY_THROW );
+ xTransact->commit();
+ }
}
catch( uno::Exception& )
{
@@ -371,9 +384,12 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::Get_Impl( con
aObjDescr[1].Value <<= xCopy;
}
+ uno::Sequence< beans::PropertyValue > aMediaDescr( 1 );
+ aMediaDescr[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
+ aMediaDescr[0].Value <<= bReadOnlyMode;
xObj = uno::Reference < embed::XEmbeddedObject >( xFactory->createInstanceInitFromEntry(
pImpl->mxStorage, rName,
- bReadOnlyMode, aObjDescr ), uno::UNO_QUERY );
+ aMediaDescr, aObjDescr ), uno::UNO_QUERY );
// insert object into my list
AddEmbeddedObject( xObj, rName );
@@ -1068,16 +1084,15 @@ sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < e
// the media type will be provided with object insertion
::rtl::OUString aOrigStorMediaType;
uno::Reference< beans::XPropertySet > xStorProps( pImpl->mxStorage, uno::UNO_QUERY_THROW );
- xStorProps->getPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ) )
- >>= aOrigStorMediaType;
+ static const ::rtl::OUString s_sMediaType(RTL_CONSTASCII_USTRINGPARAM("MediaType"));
+ xStorProps->getPropertyValue( s_sMediaType ) >>= aOrigStorMediaType;
OSL_ENSURE( aOrigStorMediaType.getLength(), "No valuable media type in the storage!\n" );
uno::Reference< beans::XPropertySet > xTargetStorProps(
pImpl->mpTempObjectContainer->pImpl->mxStorage,
uno::UNO_QUERY_THROW );
- xTargetStorProps->setPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ),
- uno::makeAny( aOrigStorMediaType ) );
+ xTargetStorProps->setPropertyValue( s_sMediaType,uno::makeAny( aOrigStorMediaType ) );
}
catch( uno::Exception& )
{