sw/qa/extras/ooxmlexport/data/tdf127339.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 9 +++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 3 +-- writerfilter/source/ooxml/OOXMLStreamImpl.cxx | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-)
New commits: commit 04163422234d1becac05b16c7460518277294d6b Author: Tünde Tóth <[email protected]> AuthorDate: Thu Sep 5 11:49:49 2019 +0200 Commit: László Németh <[email protected]> CommitDate: Fri Sep 6 12:54:57 2019 +0200 tdf#127339 DOCX import/export: fix image hyperlink to bookmark target Images as hyperlinks didn't work with internal bookmark targets. Change-Id: I5f3bf150f62d11837b45851e221119dcff93dcaa Reviewed-on: https://gerrit.libreoffice.org/78639 Reviewed-by: László Németh <[email protected]> Tested-by: László Németh <[email protected]> diff --git a/sw/qa/extras/ooxmlexport/data/tdf127339.docx b/sw/qa/extras/ooxmlexport/data/tdf127339.docx new file mode 100644 index 000000000000..7f0239ddb009 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf127339.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 77d20697e340..31abac2a3aa9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -715,6 +715,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127116, "tdf127116.odt") CPPUNIT_ASSERT_EQUAL(anchor, bookmarkName); } +DECLARE_OOXMLEXPORT_TEST(testTdf127339, "tdf127339.docx") +{ + xmlDocPtr pXmlRels = parseExport("word/_rels/document.xml.rels"); + if (!pXmlRels) + return; + + assertXPathNoAttribute(pXmlRels, "/rels:Relationships/rels:Relationship[@Target='#bookmark']", "TargetMode"); +} + 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 4f6b492d5d33..46c44a0b8a87 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4843,7 +4843,6 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size XFastAttributeListRef docPrAttrListRef( docPrattrList ); m_pSerializer->startElementNS( XML_wp, XML_docPr, docPrAttrListRef ); - //TODO: internal hyperlink OUString sURL, sRelId; if(pSdrObj) { @@ -4854,7 +4853,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size { sRelId = GetExport().GetFilter().addRelation( m_pSerializer->getOutputStream(), oox::getRelationship(Relationship::HYPERLINK), - sURL, true ); + sURL, !sURL.startsWith("#") ); m_pSerializer->singleElementNS( XML_a, XML_hlinkClick, FSNS( XML_xmlns, XML_a ), "http://schemas.openxmlformats.org/drawingml/2006/main", FSNS( XML_r, XML_id ), sRelId.toUtf8()); diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx index 417dd1acf0b2..2b773e02cf5e 100644 --- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx @@ -111,7 +111,7 @@ bool OOXMLStreamImpl::lcl_getTarget(const uno::Reference<embed::XRelationshipAcc bExternal = true; } // Only cache external targets, internal ones are more complex (see below) - if (bExternal) + if (bExternal || aTarget.startsWith("#")) maIdCache[aId] = aTarget; } } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
