diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-11 09:42:29 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-11 09:49:45 +0200 |
commit | 12783429cfa5984adf02efdfcbe6e1653d58365f (patch) | |
tree | f5e8d2695e87d21e3ab077a11239ae3f5c24f889 | |
parent | 5041d1548a9875da5c594e459a12fb3949312636 (diff) |
SwDBManager: avoid registering two data sources when creating an emebedded one
SwDBManager::LoadAndRegisterDataSource() calls
SwXDocumentSettings::setPropertyValue() to set its EmbeddedDatabaseName
UNO property, when creating the embedded data source definition. OTOH,
during load, SwXDocumentSettings calls
SwDBManager::LoadAndRegisterEmbeddedDataSource() to register the data
source. The result is that when creating the embedded definition using
the MM wizard, we registered two data sources.
Fix the problem by first setting the UNO property, and only then storing
the data source definition.
Change-Id: I3efc141d9ab94828007a48a8bf5949b4f3b6510a
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 48077f6f05be..eb2c9c0a642c 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -2692,13 +2692,14 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const OUString aStreamRelPath = "EmbeddedDatabase"; uno::Reference<embed::XStorage> xStorage = pDocShell->GetStorage(); - SwDBManager::StoreEmbeddedDataSource(xStore, xStorage, aStreamRelPath, aOwnURL); - // Refer to the sub-storage name in the document settings, so // we can load it again next time the file is imported. uno::Reference<lang::XMultiServiceFactory> xFactory(pDocShell->GetModel(), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPropertySet(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); xPropertySet->setPropertyValue("EmbeddedDatabaseName", uno::makeAny(aStreamRelPath)); + + // Store it only after setting the above property, so that only one data source gets registered. + SwDBManager::StoreEmbeddedDataSource(xStore, xStorage, aStreamRelPath, aOwnURL); } } xDBContext->registerObject( sFind, xNewInstance ); |