diff options
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 475388d2134e..9ad6184de3ac 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -134,6 +134,21 @@ void lcl_emitEvent(SfxEventHintId nEventId, sal_Int32 nStrId, SfxObjectShell* pD pDocShell)); } +// Construct vnd.sun.star.pkg:// URL +OUString ConstructVndSunStarPkgUrl(const OUString& rMainURL, std::u16string_view rStreamRelPath) +{ + auto xContext(comphelper::getProcessComponentContext()); + auto xUri = css::uri::UriReferenceFactory::create(xContext)->parse(rMainURL); + assert(xUri.is()); + xUri = css::uri::VndSunStarPkgUrlReferenceFactory::create(xContext) + ->createVndSunStarPkgUrlReference(xUri); + assert(xUri.is()); + return xUri->getUriReference() + "/" + + INetURLObject::encode( + rStreamRelPath, INetURLObject::PART_FPATH, + INetURLObject::EncodeMechanism::All); +} + } std::vector<std::pair<SwDocShell*, OUString>> SwDBManager::m_aUncommittedRegistrations; @@ -254,10 +269,9 @@ void SAL_CALL SwDataSourceRemovedListener::revokedDatabaseLocation(const sdb::Da if (!pDocShell) return; - OUString aOwnURL = pDocShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::WithCharset); - OUString sTmpName = "vnd.sun.star.pkg://" + - INetURLObject::encode(aOwnURL, INetURLObject::PART_AUTHORITY, INetURLObject::EncodeMechanism::All); - sTmpName += "/" + m_pDBManager->getEmbeddedName(); + const OUString sTmpName = ConstructVndSunStarPkgUrl( + pDocShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::NONE), + m_pDBManager->getEmbeddedName()); if (sTmpName != rEvent.OldLocation) return; @@ -2760,21 +2774,6 @@ OUString LoadAndRegisterDataSource_Impl(DBConnURIType type, const uno::Reference } return sFind; } - -// Construct vnd.sun.star.pkg:// URL -OUString ConstructVndSunStarPkgUrl(const OUString& rMainURL, std::u16string_view rStreamRelPath) -{ - auto xContext(comphelper::getProcessComponentContext()); - auto xUri = css::uri::UriReferenceFactory::create(xContext)->parse(rMainURL); - assert(xUri.is()); - xUri = css::uri::VndSunStarPkgUrlReferenceFactory::create(xContext) - ->createVndSunStarPkgUrlReference(xUri); - assert(xUri.is()); - return xUri->getUriReference() + "/" - + INetURLObject::encode( - rStreamRelPath, INetURLObject::PART_FPATH, - INetURLObject::EncodeMechanism::All); -} } OUString SwDBManager::LoadAndRegisterDataSource(weld::Window* pParent, SwDocShell* pDocShell) |