summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-04-27 11:29:18 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-04-27 16:27:10 +0200
commitf6b419b8946c5fc2dafa8f4201a4c7379148f306 (patch)
tree5fdce6ccf4434507a31d0d020c7d688bc8d7668b /sw/source
parent8ff946045138fde19c0656129da611729aa98cb1 (diff)
sw bibliography, refer to a page: save edited page number
This is the writing side of commit e920406994dd2b880d4b752e3ea4e09e4a8f97cc (sw bibliography, refer to a page: add dedicate widget to show the page number, 2021-04-21). Change-Id: If47932eedd689ca474bfdf44613d0c30087053b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114664 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx34
1 files changed, 33 insertions, 1 deletions
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index 483fe01cf3aa..58cd9e0e2bc3 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -99,6 +99,31 @@ bool SplitUrlAndPage(const OUString& rText, OUString& rUrl, int& nPageNumber)
rUrl = xUriRef->getUriReference();
return true;
}
+
+OUString MergeUrlAndPage(const OUString& rUrl, const std::unique_ptr<weld::SpinButton>& xPageSB)
+{
+ if (!xPageSB->get_sensitive())
+ {
+ return rUrl;
+ }
+
+ uno::Reference<uri::XUriReferenceFactory> xUriReferenceFactory
+ = uri::UriReferenceFactory::create(comphelper::getProcessComponentContext());
+ uno::Reference<uri::XUriReference> xUriRef;
+ try
+ {
+ xUriRef = xUriReferenceFactory->parse(rUrl);
+ }
+ catch (const uno::Exception& rException)
+ {
+ SAL_WARN("sw.ui", "MergeUrlAndPage: failed to parse url: " << rException.Message);
+ return rUrl;
+ }
+
+ OUString aFragment("page=" + OUString::number(xPageSB->get_value()));
+ xUriRef->setFragment(aFragment);
+ return xUriRef->getUriReference();
+}
}
// dialog to insert a directory selection
@@ -1732,7 +1757,14 @@ OUString SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) cons
const TextInfo aCurInfo = aTextInfoArr[nIndex];
if(aCurInfo.nToxField == eField)
{
- return pEdits[nIndex]->get_text();
+ if (aCurInfo.nToxField != AUTH_FIELD_URL)
+ {
+ return pEdits[nIndex]->get_text();
+ }
+ else
+ {
+ return MergeUrlAndPage(pEdits[nIndex]->get_text(), m_xPageSB);
+ }
}
}