sw/qa/extras/ooxmlexport/data/tdf123628.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 14 ++++++++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 5 +---- sw/source/filter/ww8/wrtw8sty.cxx | 4 ++++ 4 files changed, 19 insertions(+), 4 deletions(-)
New commits: commit 0ddd856af3a9383dc2c6a9a95fd5dc4bfdfeaf7d Author: Tünde Tóth <tund...@gmail.com> AuthorDate: Mon Sep 30 10:48:25 2019 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Tue Oct 1 15:09:08 2019 +0200 tdf#123628 DOCX export: fix color change of unvisited hyperlinks by exporting the character style name "Hyperlink" requested by Word instead of the previous "Internet Link" to allow unvisited/visited color change at opening the link in the document editor. Change-Id: Ib5e22f8f26a6f3c71543d6e5410d6cc263b83830 Reviewed-on: https://gerrit.libreoffice.org/79855 Reviewed-by: László Németh <nem...@numbertext.org> Tested-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/ooxmlexport/data/tdf123628.odt b/sw/qa/extras/ooxmlexport/data/tdf123628.odt new file mode 100755 index 000000000000..53ce54ad2e70 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123628.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index ec8635943f4d..07ae47ffff37 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -815,6 +815,20 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127735, "internal_hyperlink_table.odt") CPPUNIT_ASSERT_EQUAL(anchor, bookmarkName); } +DECLARE_OOXMLEXPORT_TEST(testTdf123628, "tdf123628.odt") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + + xmlDocPtr pXmlStyles = parseExport("word/styles.xml"); + if (!pXmlStyles) + return; + + assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink/w:r/w:rPr/w:rStyle", "val", "InternetLink"); + assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='InternetLink']/w:name", "val", "Hyperlink"); +} + 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 79d82b72c7a6..cab57300c1da 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7198,10 +7198,7 @@ void DocxAttributeOutput::CharHighlight( const SvxBrushItem& rHighlight ) void DocxAttributeOutput::TextINetFormat( const SwFormatINetFormat& rLink ) { - const SwTextINetFormat* pINetFormat = rLink.GetTextINetFormat(); - const SwCharFormat* pCharFormat = pINetFormat->GetCharFormat(); - - OString aStyleId(m_rExport.m_pStyles->GetStyleId(m_rExport.GetId(pCharFormat))); + OString aStyleId = MSWordStyles::CreateStyleId(rLink.GetINetFormat()); m_pSerializer->singleElementNS(XML_w, XML_rStyle, FSNS(XML_w, XML_val), aStyleId); } diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index c8715e0be9d3..2e67ac47e5a8 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -630,6 +630,10 @@ void MSWordStyles::OutputStyle( SwFormat* pFormat, sal_uInt16 nPos ) // tdf#92335 don't export redundant DOCX import style "ListLabel" return; } + else if (aName.equalsIgnoreAsciiCase("Internet Link")) + { + aName = "Hyperlink"; + } m_rExport.AttrOutput().StartStyle( aName, (bFormatColl ? STYLE_TYPE_PARA : STYLE_TYPE_CHAR), nBase, nWwNext, GetWWId( *pFormat ), nPos, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits