sw/qa/extras/ooxmlexport/data/tdf127579.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 9 +++++++++ sw/source/filter/ww8/ww8atr.cxx | 23 +++++++++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-)
New commits: commit 4a76d2038a700ef97c0d0a261d2b83dafc37ca9c Author: Tünde Tóth <tund...@gmail.com> AuthorDate: Mon Nov 25 10:49:37 2019 +0100 Commit: Xisco Faulí <xiscofa...@libreoffice.org> CommitDate: Wed Dec 11 16:27:22 2019 +0100 tdf#127579 DOCX export: fix losing color and underline of ODT hyperlinks using "InternetLink" in hyperlink/r/rPr/rStyle instead of the actual character style, and keep actual character formatting in hyperlink/r/rPr/rFonts, like MSO does. Change-Id: Ic75c907eff422efbf96badcd2af50562cc3cbf25 Reviewed-on: https://gerrit.libreoffice.org/83676 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> Tested-by: László Németh <nem...@numbertext.org> (cherry picked from commit d57b4480903f700ad7c95e885b9dd0ace5883cfc) Reviewed-on: https://gerrit.libreoffice.org/84554 Reviewed-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/ooxmlexport/data/tdf127579.odt b/sw/qa/extras/ooxmlexport/data/tdf127579.odt new file mode 100644 index 000000000000..a35fb47a0338 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf127579.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 41923490b057..6a40ce994253 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -899,6 +899,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127925, "tdf127925.odt") assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='VisitedInternetLink']/w:name", "val", "FollowedHyperlink"); } +DECLARE_OOXMLEXPORT_TEST(testTdf127579, "tdf127579.odt") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:hyperlink/w:r/w:rPr/w:rStyle", "val", "InternetLink"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index bb20b8ea4a0a..dd9bcf6d02ef 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -221,8 +221,27 @@ void MSWordExportBase::ExportPoolItemsToCHP( ww8::PoolItems &rItems, sal_uInt16 //properties that it rises to the top and is exported first." //In bug 119649, it is in such situation, so we need to ignore the link style when doing ms word filter exports and //add the second judgement for #i24291# definition. - if ( nWhich == RES_TXTATR_INETFMT && ( rItems.begin()->second->Which() == RES_TXTATR_CHARFMT ) ) - continue; + if (nWhich == RES_TXTATR_CHARFMT) + { + const SfxPoolItem* pINetItem = SearchPoolItems(rItems, RES_TXTATR_INETFMT); + if (pINetItem) + { + const SwCharFormat* pFormat = static_cast<const SwFormatCharFormat&>(*pItem).GetCharFormat(); + const SwCharFormat* pINetFormat = m_pDoc->FindCharFormatByName( + static_cast<const SwFormatINetFormat&>(*pINetItem).GetINetFormat()); + ww8::PoolItems aCharItems, aINetItems; + GetPoolItems(pFormat->GetAttrSet(), aCharItems, false); + GetPoolItems(pINetFormat->GetAttrSet(), aINetItems, false); + for (const auto& rCharItem : aCharItems) + { + const SfxPoolItem* pCharItem = rCharItem.second; + sal_uInt16 nCharWhich = pCharItem->Which(); + if (!SearchPoolItems(aINetItems, nCharWhich) && !SearchPoolItems(rItems, nCharWhich)) + AttrOutput().OutputItem(*pCharItem); + } + continue; + } + } // tdf#38778 Fix output of the font in DOC run for fields if (pFont && _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits