summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTünde Tóth <tundeth@gmail.com>2019-11-14 08:54:08 +0100
committerXisco Faulí <xiscofauli@libreoffice.org>2019-11-19 17:58:09 +0100
commitbc32cf9f1ad996c34ed19805787bbc2e5f198b91 (patch)
treeb1619b1b42e99077fb19101c84291dea1ddb6f03 /sw
parent91ed8daea449c6c33217d891f431dcebb8a4bd4e (diff)
tdf#128504 save DOCX as ODT: don't color not highlighted hyperlinks
During DOCX import, not highlighted hyperlinks, ie. without hyperlink character styles, set the Visited/Unvisited character style text attributes to "Default Style" to avoid saving them with the default highlighted hyperlink character styles in ODT. Regression from the commit 576611895e51186d38ddefa10ed8d66075d9de37 "tdf#127741 DOCX import: format hyperlink with Default character style". Change-Id: I95e919a137f1ba85ca85372d5bdb23d958ef33c0 Reviewed-on: https://gerrit.libreoffice.org/82650 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/odfexport/data/tdf128504.docxbin0 -> 3969 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx11
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx4
3 files changed, 13 insertions, 2 deletions
diff --git a/sw/qa/extras/odfexport/data/tdf128504.docx b/sw/qa/extras/odfexport/data/tdf128504.docx
new file mode 100644
index 000000000000..2e6e5225b88c
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/tdf128504.docx
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 70290151f9ac..d297ac2893d1 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -2254,6 +2254,17 @@ DECLARE_ODFEXPORT_TEST(tdf99631, "tdf99631.docx")
assertXPathContent(pXmlDoc2, "//config:config-item[@config:name='VisibleAreaWidth']", "4515");
assertXPathContent(pXmlDoc2, "//config:config-item[@config:name='VisibleAreaHeight']", "1354");
}
+
+DECLARE_ODFEXPORT_TEST(tdf128504, "tdf128504.docx")
+{
+ uno::Reference<text::XTextRange> xPara = getParagraph(6);
+ uno::Reference<beans::XPropertySet> xRun(getRun(xPara, 1), uno::UNO_QUERY);
+ OUString unVisitedStyleName = getProperty<OUString>(xRun, "UnvisitedCharStyleName");
+ CPPUNIT_ASSERT(!unVisitedStyleName.equalsIgnoreAsciiCase("Internet Link"));
+ OUString visitedStyleName = getProperty<OUString>(xRun, "VisitedCharStyleName");
+ CPPUNIT_ASSERT(!visitedStyleName.equalsIgnoreAsciiCase("Visited Internet Link"));
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 0be232d6569f..d1eb890ddc62 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7205,8 +7205,8 @@ void DocxAttributeOutput::TextINetFormat( const SwFormatINetFormat& rLink )
const SwCharFormat* pCharFormat = pINetFormat->GetCharFormat();
OString aStyleId(m_rExport.m_pStyles->GetStyleId(m_rExport.GetId(pCharFormat)));
-
- m_pSerializer->singleElementNS(XML_w, XML_rStyle, FSNS(XML_w, XML_val), aStyleId);
+ if (!aStyleId.isEmpty() && !aStyleId.equalsIgnoreAsciiCase("DefaultStyle"))
+ m_pSerializer->singleElementNS(XML_w, XML_rStyle, FSNS(XML_w, XML_val), aStyleId);
}
void DocxAttributeOutput::TextCharFormat( const SwFormatCharFormat& rCharFormat )