diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-03-12 10:21:36 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-08-05 12:04:00 -0400 |
commit | dbc107538979efa3f153a5983ccf137df20464d2 (patch) | |
tree | eed861c08c61c6c5109e64f22a06ef9b62258e56 | |
parent | 430778af918608709b0fd12fae6693aec62fbd70 (diff) |
sw HTML export: handle field shadings view option
private/mmeeks/cp-6.2-bits
Regardless of the value of the View -> Field Shadings option, shadings
were always lost when saving to HTML.
Implement handling of this in the HTML conditionally, so in case that
UI option is on, then shadings are preserved in the HTML result;
disabling that option results in the old behavior, though.
Change-Id: I1bd19f4c6e22aff2f84fac25f0a506ad0127cc3c
Reviewed-on: https://gerrit.libreoffice.org/69081
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
-rw-r--r-- | sw/source/filter/html/css1atr.cxx | 18 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.hxx | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 630f3d611221..ed30270f96e5 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -185,11 +185,6 @@ OString lclConvToHex(sal_uInt16 nHex) return OString(aNToABuf, 2); } -OString lclGetCSS1Color(const Color& rColor) -{ - return "#" + lclConvToHex(rColor.GetRed()) + lclConvToHex(rColor.GetGreen()) + lclConvToHex(rColor.GetBlue()); -} - /// Determines if rProperty has to be suppressed due to ReqIF mode. bool IgnorePropertyForReqIF(bool bReqIF, const OString& rProperty) { @@ -207,6 +202,11 @@ bool IgnorePropertyForReqIF(bool bReqIF, const OString& rProperty) } } +OString GetCSS1_Color(const Color& rColor) +{ + return "#" + lclConvToHex(rColor.GetRed()) + lclConvToHex(rColor.GetGreen()) + lclConvToHex(rColor.GetBlue()); +} + class SwCSS1OutMode { SwHTMLWriter& rWrt; @@ -2233,7 +2233,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFor aColor = pVSh->GetViewOptions()->GetRetoucheColor(); } - OutCSS1_PropertyAscii(sCSS1_P_background, lclGetCSS1Color(aColor)); + OutCSS1_PropertyAscii(sCSS1_P_background, GetCSS1_Color(aColor)); } } @@ -2408,7 +2408,7 @@ static Writer& OutCSS1_SvxColor( Writer& rWrt, const SfxPoolItem& rHt ) if( COL_AUTO == aColor ) aColor = COL_BLACK; - rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_color, lclGetCSS1Color(aColor)); + rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_color, GetCSS1_Color(aColor)); return rWrt; } @@ -3268,7 +3268,7 @@ static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt, { if( bColor ) { - OString sTmp(lclGetCSS1Color(aColor)); + OString sTmp(GetCSS1_Color(aColor)); sOut += OStringToOUString(sTmp, RTL_TEXTENCODING_ASCII_US); } @@ -3383,7 +3383,7 @@ static void OutCSS1_SvxBorderLine( SwHTMLWriter& rHTMLWrt, sOut.append(' '); // and also the color - sOut.append(lclGetCSS1Color(pLine->GetColor())); + sOut.append(GetCSS1_Color(pLine->GetColor())); rHTMLWrt.OutCSS1_PropertyAscii(pProperty, sOut.makeStringAndClear()); } diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 775fc664ec39..badc1f801df8 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -691,6 +691,8 @@ Writer& OutHTML_NumBulListEnd( SwHTMLWriter& rWrt, Writer& OutCSS1_SvxBox( Writer& rWrt, const SfxPoolItem& rHt ); +OString GetCSS1_Color(const Color& rColor); + #endif // INCLUDED_SW_SOURCE_FILTER_HTML_WRTHTML_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |