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>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf127579.odt b/sw/qa/extras/ooxmlexport/data/tdf127579.odt
new file mode 100644
index 0000000..a35fb47
--- /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 2d51c79..18e957b 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 bb90acc..7c7ea52 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 &&