diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-04-19 14:26:59 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-04-19 17:08:04 +0200 |
commit | 02ac62846ee82d7005733bf2396b25a5688362e0 (patch) | |
tree | 775c02bee4c8e608d00ba9e7f94063c145c62a5d /xmloff | |
parent | f3bb88b67b350900f60934e0f7bd550fa4fd47ec (diff) |
sw bibliography, relative URLs: switch to absolute URLs in the doc model
Interestingly at least on Linux, our click handler doesn't know how to
open "test.pdf", but "test.pdf#page=2" works. If these URLs are normal
hyperlinks (and not biblio source URLs) then both work.
It turns out the hyperlink case works because the doc model deals with
absolute URLs and only ODF import/export converts to relative ones. Do
the same for
<text:bibliography-mark text:url="...">
and that way the click handler gets an absolute URL even for "test.pdf",
which then works.
Change-Id: If8282f444d0f6e6defe4282e2753ae8b37b5b09a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114266
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/txtflde.cxx | 7 | ||||
-rw-r--r-- | xmloff/source/text/txtfldi.cxx | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 50d072b6b2a9..111df2f0a7bf 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -2731,8 +2731,13 @@ void XMLTextFieldExport::ProcessBibliographyData( if (!sStr.isEmpty()) { + XMLTokenEnum eElement = MapBibliographyFieldName(rProp.Name); + if (eElement == XML_URL) + { + sStr = GetExport().GetRelativeReference(sStr); + } rExport.AddAttribute(XML_NAMESPACE_TEXT, - MapBibliographyFieldName(rProp.Name), + eElement, sStr); } } diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index 3e8e660dc030..b3ab45c378f2 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -2974,7 +2974,12 @@ void XMLBibliographyFieldImportContext::startFastElement( } else { - aAny <<= aIter.toString(); + OUString aStringValue = aIter.toString(); + if (nToken == XML_URL) + { + aStringValue = GetImport().GetAbsoluteReference(aStringValue); + } + aAny <<= aStringValue; aValue.Value = aAny; aValues.push_back(aValue); |