summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTünde Tóth <tundeth@gmail.com>2019-11-25 10:49:37 +0100
committerLászló Németh <nemeth@numbertext.org>2019-12-05 12:42:19 +0100
commitd57b4480903f700ad7c95e885b9dd0ace5883cfc (patch)
tree15cfd12411816e66d5bd0e6b590bc90eacca71d2 /sw
parentc0cdb01ef33042be76251c4a353e0582a0838e0e (diff)
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 <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf127579.odtbin0 -> 8551 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport13.cxx9
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx23
3 files changed, 30 insertions, 2 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf127579.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 2d51c79490e1..18e957bbcb09 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -984,6 +984,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 bb90acc939f8..7c7ea52981ac 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 &&