[Libreoffice-commits] core.git: sw/qa sw/source
Tünde Tóth (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 10 06:17:07 UTC 2019
sw/qa/extras/ooxmlexport/data/tdf127362.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 15 +++++++++++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 6 ++++++
3 files changed, 21 insertions(+)
New commits:
commit 745f4cc374297a73ff5243cdd42a839e469619e7
Author: Tünde Tóth <tundeth at gmail.com>
AuthorDate: Mon Sep 9 13:50:30 2019 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Tue Sep 10 08:16:32 2019 +0200
tdf#127362 DOCX export: fix image hyperlink with space to bookmark target
Images as hyperlinks to internal bookmark targets didn't work after
export, because spaces were replaced only in bookmarks with underline
characters, now in hyperlinks, too.
Change-Id: I281b2cde276607aa93de92745cfa1ba887ba9976
Reviewed-on: https://gerrit.libreoffice.org/78782
Reviewed-by: László Németh <nemeth at numbertext.org>
Tested-by: László Németh <nemeth at numbertext.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf127362.odt b/sw/qa/extras/ooxmlexport/data/tdf127362.odt
new file mode 100644
index 000000000000..488f1528fd15
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf127362.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index b8c9f7a9f15c..dd059cdb6af9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -729,6 +729,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127339, "tdf127339.docx")
assertXPathNoAttribute(pXmlRels, "/rels:Relationships/rels:Relationship[@Target='#bookmark']", "TargetMode");
}
+DECLARE_OOXMLEXPORT_TEST(testTdf127362, "tdf127362.odt")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+
+ xmlDocPtr pXmlRels = parseExport("word/_rels/document.xml.rels");
+ if (!pXmlRels)
+ return;
+
+ OUString bookmarkName = "#" + getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:bookmarkStart", "name");
+ OUString anchor = getXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@Id='rId3']", "Target");
+ CPPUNIT_ASSERT_EQUAL(anchor, bookmarkName);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 46c44a0b8a87..77f12ac20a7c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4851,6 +4851,12 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
xPropSet->getPropertyValue("HyperLinkURL") >>= sURL;
if(!sURL.isEmpty())
{
+ if (sURL.startsWith("#") && sURL.indexOf(' ') != -1 && !sURL.endsWith("|outline") && !sURL.endsWith("|table") &&
+ !sURL.endsWith("|frame") && !sURL.endsWith("|graphic") && !sURL.endsWith("|ole") && !sURL.endsWith("|region"))
+ {
+ // Spaces are prohibited in bookmark name.
+ sURL = sURL.replace(' ', '_');
+ }
sRelId = GetExport().GetFilter().addRelation( m_pSerializer->getOutputStream(),
oox::getRelationship(Relationship::HYPERLINK),
sURL, !sURL.startsWith("#") );
More information about the Libreoffice-commits
mailing list