summaryrefslogtreecommitdiff
path: root/embeddedobj
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2007-11-01 16:50:22 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2007-11-01 16:50:22 +0000
commit2f5c66b9a59f09de18f7a3f258d7a6ad6a47bb87 (patch)
tree2776bc3a2eaf58fdfcee23f1ef5bb69ef646909d /embeddedobj
parent1b1f25ab146f61c6941730879e8083c582c66a42 (diff)
INTEGRATION: CWS fwk76_SRC680 (1.32.6); FILE MERGED
2007/10/11 08:38:11 mav 1.32.6.2: #i81789# the document should be marked as embedded before the parent is set 2007/10/08 11:09:08 mav 1.32.6.1: #i81789# the document should be marked as embedded before the parent is set
Diffstat (limited to 'embeddedobj')
-rw-r--r--embeddedobj/source/commonembedding/persistence.cxx78
1 files changed, 50 insertions, 28 deletions
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index fd3dec3ceb97..27af39b12b47 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: persistence.cxx,v $
*
- * $Revision: 1.32 $
+ * $Revision: 1.33 $
*
- * last change: $Author: hr $ $Date: 2007-08-02 17:05:11 $
+ * last change: $Author: hr $ $Date: 2007-11-01 17:50:22 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -336,10 +336,6 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl()
uno::Reference< util::XCloseable > xDocument( m_xFactory->createInstance( GetDocumentServiceName() ),
uno::UNO_QUERY );
- uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY );
- if ( xChild.is() )
- xChild->setParent( m_xParent );
-
uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY );
uno::Reference< frame::XLoadable > xLoadable( xModel, uno::UNO_QUERY );
if ( !xLoadable.is() )
@@ -347,9 +343,20 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl()
try
{
- // set the document mode to embedded
+ // set the document mode to embedded as the first action on document!!!
SetDocToEmbedded( xModel, m_aModuleName );
+ try
+ {
+ uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY );
+ if ( xChild.is() )
+ xChild->setParent( m_xParent );
+ }
+ catch( const lang::NoSupportException & )
+ {
+ OSL_ENSURE( false, "Cannot set parent at document" );
+ }
+
// init document as a new
xLoadable->initNew();
xModel->attachResource( xModel->getURL(),m_aDocMediaDescriptor);
@@ -380,10 +387,6 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl()
uno::Reference< util::XCloseable > xDocument( m_xFactory->createInstance( GetDocumentServiceName() ),
uno::UNO_QUERY );
- uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY );
- if ( xChild.is() )
- xChild->setParent( m_xParent );
-
uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY );
if ( !xLoadable.is() )
throw uno::RuntimeException();
@@ -413,6 +416,17 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl()
// the document is not really an embedded one, it is a link
SetDocToEmbedded( uno::Reference < frame::XModel >( xDocument, uno::UNO_QUERY ), m_aModuleName );
+ try
+ {
+ uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY );
+ if ( xChild.is() )
+ xChild->setParent( m_xParent );
+ }
+ catch( const lang::NoSupportException & )
+ {
+ OSL_ENSURE( false, "Cannot set parent at document" );
+ }
+
// load the document
xLoadable->load( aArgs );
@@ -459,17 +473,6 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag
uno::Reference< util::XCloseable > xDocument( m_xFactory->createInstance( GetDocumentServiceName() ), uno::UNO_QUERY );
- try
- {
- uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY );
- if ( xChild.is() )
- xChild->setParent( m_xParent );
- }
- catch( const lang::NoSupportException & )
- {
- OSL_ENSURE( false, "Cannot set parent at document" );
- }
-
uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY );
uno::Reference< document::XStorageBasedDocument > xDoc
#ifdef USE_STORAGEBASED_DOCUMENT
@@ -543,8 +546,20 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag
try
{
- // set the document mode to embedded
+ // set the document mode to embedded as the first step!!!
SetDocToEmbedded( uno::Reference < frame::XModel >( xDocument, uno::UNO_QUERY ), m_aModuleName );
+
+ try
+ {
+ uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY );
+ if ( xChild.is() )
+ xChild->setParent( m_xParent );
+ }
+ catch( const lang::NoSupportException & )
+ {
+ OSL_ENSURE( false, "Cannot set parent at document" );
+ }
+
if ( xDoc.is() )
xDoc->loadFromStorage( xStorage, aArgs );
else
@@ -816,19 +831,26 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::CreateDocFromMediaDesc
uno::Reference< util::XCloseable > xDocument( m_xFactory->createInstance( GetDocumentServiceName() ),
uno::UNO_QUERY );
- uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY );
- if ( xChild.is() )
- xChild->setParent( m_xParent );
-
uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY );
if ( !xLoadable.is() )
throw uno::RuntimeException();
try
{
- // set the document mode to embedded
+ // set the document mode to embedded as the first action on the document!!!
SetDocToEmbedded( uno::Reference < frame::XModel >( xDocument, uno::UNO_QUERY ), m_aModuleName );
+ try
+ {
+ uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY );
+ if ( xChild.is() )
+ xChild->setParent( m_xParent );
+ }
+ catch( const lang::NoSupportException & )
+ {
+ OSL_ENSURE( false, "Cannot set parent at document" );
+ }
+
xLoadable->load( addAsTemplate( aMedDescr ) );
}
catch( uno::Exception& )