Kaydet (Commit) fa2304ae authored tarafından Miklos Vajna's avatar Miklos Vajna

dbaccess: attachResource() and load() calls are swapped in case of embedding

Change-Id: I34600202f0f5c988222f7d4f305ba90df09cd614
üst c9af6320
......@@ -173,6 +173,7 @@ ODatabaseDocument::ODatabaseDocument(const ::rtl::Reference<ODatabaseModelImpl>&
,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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment