sw/source/core/doc/doc.cxx | 8 +++++++- sw/source/uibase/dbui/dbmgr.cxx | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
New commits: commit 290cc96e98c8d66396402f9be51739646b1eafa7 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Jun 2 08:55:03 2015 +0200 SwDBManager: refer embedded data source from doc settings So that next time the document is loaded, we can find it. With this, the MM wizard can create embedded data source definitions which can be saved / loaded back from/to ODF properly. Change-Id: I5d012ce7fe878bb23ef6dac4526254cbee2683fb diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index c65309f..b427c93 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -495,7 +495,13 @@ void SwDoc::ChgDBData(const SwDBData& rNewData) if( rNewData != maDBData ) { if (maDBData.sEmbeddedName != rNewData.sEmbeddedName && GetDocShell()) - SwDBManager::LoadAndRegisterEmbeddedDataSource(rNewData, *GetDocShell()); + { + uno::Reference<embed::XStorage> xStorage = GetDocShell()->GetStorage(); + // It's OK that we don't have the named sub-storage yet, in case + // we're in the process of creating it. + if (xStorage->hasByName(rNewData.sEmbeddedName)) + SwDBManager::LoadAndRegisterEmbeddedDataSource(rNewData, *GetDocShell()); + } maDBData = rNewData; getIDocumentState().SetModified(); diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 5f5c703..38996db 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -2642,6 +2642,12 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const {"TargetStorage", uno::makeAny(xStorage)}, {"StreamRelPath", uno::makeAny(aStreamRelPath)} }); + + // 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)); } xStore->storeAsURL(sTmpName, aSequence); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits