diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-11-13 16:10:49 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-11-13 18:23:43 +0100 |
commit | 3dee7948c732faf488846d4d3d1237e89afde28c (patch) | |
tree | 4b3237a12fa99081fae056791df5a7c67b77f950 /sw/source/uibase/app | |
parent | 6be596c282f84a3cb3a62edccfdfbf69663cf59e (diff) |
More proper construction of vnd.sun.star.pkg URL
See commit bff8d843bd4e5dcca5dc1a60c2c7852b1b72a00b
The SwUiWriterTest::testEmbeddedDataSource unit test is adjusted to
test the paths with "#".
Change-Id: I8d85147128915c7100ab9cc2888eb73c94fe6486
Reviewed-on: https://gerrit.libreoffice.org/44678
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/source/uibase/app')
-rw-r--r-- | sw/source/uibase/app/docsh.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 8f50bc411834..b1ae1e37b2da 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -118,6 +118,8 @@ #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp> #include <com/sun/star/sdb/XDocumentDataSource.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> +#include <com/sun/star/uri/VndSunStarPkgUrlReferenceFactory.hpp> #include <unomid.h> #include <unotextrange.hxx> @@ -428,9 +430,15 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) uno::Reference<sdb::XDatabaseContext> xDatabaseContext = sdb::DatabaseContext::create(comphelper::getProcessComponentContext()); const INetURLObject& rOldURLObject = GetMedium()->GetURLObject(); - OUString aURL = "vnd.sun.star.pkg://"; - aURL += INetURLObject::encode(rOldURLObject.GetMainURL(INetURLObject::DecodeMechanism::WithCharset), INetURLObject::PART_AUTHORITY, INetURLObject::EncodeMechanism::All); - aURL += "/" + INetURLObject::encode(m_xDoc->GetDBManager()->getEmbeddedName(), INetURLObject::PART_FPATH, INetURLObject::EncodeMechanism::All); + auto xContext(comphelper::getProcessComponentContext()); + auto xUri = css::uri::UriReferenceFactory::create(xContext) + ->parse(rOldURLObject.GetMainURL(INetURLObject::DecodeMechanism::NONE)); + assert(xUri.is()); + xUri = css::uri::VndSunStarPkgUrlReferenceFactory::create(xContext)->createVndSunStarPkgUrlReference(xUri); + assert(xUri.is()); + OUString const aURL = xUri->getUriReference() + "/" + + INetURLObject::encode(m_xDoc->GetDBManager()->getEmbeddedName(), + INetURLObject::PART_FPATH, INetURLObject::EncodeMechanism::All); uno::Reference<sdb::XDocumentDataSource> xDataSource(xDatabaseContext->getByName(aURL), uno::UNO_QUERY); uno::Reference<frame::XStorable> xStorable(xDataSource->getDatabaseDocument(), uno::UNO_QUERY); |