summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-07-06 16:33:10 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-07-06 21:27:30 +0200
commitfafc6f046f9e92d5776d31ea6abb188ec74aaa71 (patch)
tree253d4950f2e7098eaf6e08d8c630de5a852ce0b7 /sw
parent510209df4bcf457cac819e75889d564d620f119d (diff)
sw HTML export: avoid writing <font> in XHTML mode
First, it should be <$prefix:font>, not <font>, but then XHTML prefers CSS for font color. Change-Id: I947c0b93a117c8e88e4aec91c3c7f843bd943c59 Reviewed-on: https://gerrit.libreoffice.org/57085 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/htmlexport/data/reqif-p.xhtml1
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx3
-rw-r--r--sw/source/filter/html/htmlatr.cxx26
3 files changed, 25 insertions, 5 deletions
diff --git a/sw/qa/extras/htmlexport/data/reqif-p.xhtml b/sw/qa/extras/htmlexport/data/reqif-p.xhtml
index b05cdeb9d8e7..fa69342d00a6 100644
--- a/sw/qa/extras/htmlexport/data/reqif-p.xhtml
+++ b/sw/qa/extras/htmlexport/data/reqif-p.xhtml
@@ -4,3 +4,4 @@
<reqif-xhtml:span style="text-decoration: underline">u</reqif-xhtml:span>
<reqif-xhtml:strong>s</reqif-xhtml:strong>
<reqif-xhtml:strike>s</reqif-xhtml:strike>
+<reqif-xhtml:font color="#ce181e">s</reqif-xhtml:font>
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 5d82b82c9524..229c553502cd 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -369,6 +369,9 @@ DECLARE_HTMLEXPORT_TEST(testReqIfParagraph, "reqif-p.xhtml")
// This was "<strike>" instead of CSS.
CPPUNIT_ASSERT(aStream.indexOf("<reqif-xhtml:span style=\"text-decoration: line-through\"") != -1);
+
+ // This was "<font>" instead of CSS + namespace prefix was missing.
+ CPPUNIT_ASSERT(aStream.indexOf("<reqif-xhtml:span style=\"color: #ce181e\"") != -1);
}
DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOleData, "reqif-ole-data.xhtml")
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index fffc6dcf320d..fbdb746c726c 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -2631,13 +2631,29 @@ static Writer& OutHTML_SvxColor( Writer& rWrt, const SfxPoolItem& rHt )
if( COL_AUTO == aColor )
aColor = COL_BLACK;
- OString sOut = "<" OOO_STRING_SVTOOLS_HTML_font " "
- OOO_STRING_SVTOOLS_HTML_O_color "=";
- rWrt.Strm().WriteOString( sOut );
- HTMLOutFuncs::Out_Color( rWrt.Strm(), aColor ).WriteChar( '>' );
+ if (rHTMLWrt.mbXHTML)
+ {
+ OString sOut = "<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_span
+ " " OOO_STRING_SVTOOLS_HTML_O_style "=";
+ rWrt.Strm().WriteOString(sOut);
+ HTMLOutFuncs::Out_Color(rWrt.Strm(), aColor, /*bXHTML=*/true).WriteChar('>');
+ }
+ else
+ {
+ OString sOut = "<" OOO_STRING_SVTOOLS_HTML_font " "
+ OOO_STRING_SVTOOLS_HTML_O_color "=";
+ rWrt.Strm().WriteOString( sOut );
+ HTMLOutFuncs::Out_Color( rWrt.Strm(), aColor ).WriteChar( '>' );
+ }
}
else
- HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_font, false );
+ {
+ if (rHTMLWrt.mbXHTML)
+ HTMLOutFuncs::Out_AsciiTag(
+ rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_span, false);
+ else
+ HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_font, false );
+ }
return rWrt;
}