From fa2304aef2ea65cbbb15e3694a61c05999032d20 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 29 Apr 2015 14:44:16 +0200 Subject: dbaccess: attachResource() and load() calls are swapped in case of embedding Change-Id: I34600202f0f5c988222f7d4f305ba90df09cd614 --- dbaccess/source/core/dataaccess/databasedocument.cxx | 10 ++++++++++ dbaccess/source/core/dataaccess/databasedocument.hxx | 2 ++ 2 files changed, 12 insertions(+) (limited to 'dbaccess') diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 5062648b9e3f..5eab51cdd71a 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -173,6 +173,7 @@ ODatabaseDocument::ODatabaseDocument(const ::rtl::Reference& ,m_bClosing( false ) ,m_bAllowDocumentScripting( false ) ,m_bHasBeenRecovered( false ) + ,m_bEmbedded(false) { OSL_TRACE( "DD: ctor: %p: %p", this, m_pImpl.get() ); @@ -593,6 +594,9 @@ void SAL_CALL ODatabaseDocument::load( const Sequence< PropertyValue >& _Argumen // note that we do *not* call impl_setInitialized() here: The initialization is only complete // when the XModel::attachResource has been called, not sooner. + // however, in case of embedding, XModel::attachResource is already called. + if (m_bEmbedded) + impl_setInitialized(); impl_setModified_nothrow( false, aGuard ); // <- SYNCHRONIZED @@ -756,6 +760,12 @@ void SAL_CALL ODatabaseDocument::recoverFromFile( const OUString& i_SourceLocati // XModel sal_Bool SAL_CALL ODatabaseDocument::attachResource( const OUString& _rURL, const Sequence< PropertyValue >& _rArguments ) throw (RuntimeException, std::exception) { + if (_rURL.isEmpty() && _rArguments.getLength() == 1 && _rArguments[0].Name == "SetEmbedded") + { + m_bEmbedded = true; + return true; + } + DocumentGuard aGuard( *this, DocumentGuard::MethodUsedDuringInit ); bool bRet = false; try diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 5b2b3e839e39..693ad296f7c8 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -200,6 +200,8 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe bool m_bClosing; bool m_bAllowDocumentScripting; bool m_bHasBeenRecovered; + /// If XModel::attachResource() was called to inform us that the document is embedded into an other one. + bool m_bEmbedded; enum StoreType { SAVE, SAVE_AS }; /** stores the document to the given URL, rebases it to the respective new storage, if necessary, resets -- cgit