diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-08-26 19:04:50 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-08-31 15:12:09 +0200 |
commit | 5e463fc3a09ab5103012d5df5011b2a23bf7bed6 (patch) | |
tree | 7f038c2098e4110a5c9b5f863774651bc2675a1b /xmloff/source | |
parent | 56218a88d684cfb8269be7061ab984d7a9b05a6a (diff) |
ODF import: workaround dubious draw:fill="solid" on frame styles
Since the gradient frame backgrounds were added in LO 4.1, we export
this:
fo:background-color="transparent" draw:fill="solid"
Which doesn't make a whole lot of sense as this is really a "none" fill,
and now with the backward compatibility stuff in the style import code
we get the pool default color added when setting the BackTransparent
property, and with the draw:fill="solid" it becomes visible and the
background color is now Sky Blue 1.
So try to detect draw:fill="solid" without draw:fill-color attribute
and contradicting transparent legacy attribute and nerf it. This way
we also export draw:fill="none" again, although still with a bogus
draw:fill-color but that shouldn't cause any harm.
Change-Id: I1c2bea46ba7d9a3f042b875df0ca12c7f6037909
(cherry picked from commit 68efa6f5128abf4cd097ae81a4cfd7fecbcb2a80)
Reviewed-on: https://gerrit.libreoffice.org/18040
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/draw/sdpropls.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/text/txtimppr.cxx | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index 009c2ec67c16..d1514d4fa312 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -106,8 +106,8 @@ const XMLPropertyMapEntry aXMLSDProperties[] = GMAP( "LineCap", XML_NAMESPACE_SVG , XML_STROKE_LINECAP, XML_SD_TYPE_LINECAP, 0 ), // fill attributes - GMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SD_TYPE_FILLSTYLE, 0 ), - GMAP_D("FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0), + GMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SD_TYPE_FILLSTYLE, CTF_FILLSTYLE ), + GMAP_D("FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, CTF_FILLCOLOR ), GMAP_D("FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0), GMAP( "FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLGRADIENTNAME ), GMAP( "FillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, 0 ), diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx index ab11b94955aa..2ee33fcd5af2 100644 --- a/xmloff/source/text/txtimppr.cxx +++ b/xmloff/source/text/txtimppr.cxx @@ -20,6 +20,7 @@ #include <osl/thread.h> #include <com/sun/star/awt/FontFamily.hpp> #include <com/sun/star/awt/FontPitch.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/text/SizeType.hpp> @@ -408,6 +409,8 @@ void XMLTextImportPropertyMapper::finished( XMLPropertyState* pAllMargin = 0; XMLPropertyState* pMargins[4] = { 0, 0, 0, 0 }; ::std::unique_ptr<XMLPropertyState> pNewMargins[4]; + XMLPropertyState* pFillStyle(nullptr); + XMLPropertyState* pFillColor(nullptr); for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin(); aIter != rProperties.end(); @@ -491,6 +494,8 @@ void XMLTextImportPropertyMapper::finished( bHasAnyWidth = true; break; case CTF_BACKGROUND_TRANSPARENCY: pBackTransparency = property; break; case CTF_BACKGROUND_TRANSPARENT: pBackTransparent = property; break; + case CTF_FILLSTYLE: pFillStyle = property; break; + case CTF_FILLCOLOR: pFillColor = property; break; case CTF_PARAMARGINALL: case CTF_PARAMARGINALL_REL: pAllParaMargin = property; break; @@ -653,6 +658,15 @@ void XMLTextImportPropertyMapper::finished( pFontStyleNameCTL, pFontFamilyCTL, pFontPitchCTL, pFontCharSetCTL, &pNewFontStyleNameCTL, &pNewFontFamilyCTL, &pNewFontPitchCTL, &pNewFontCharSetCTL ); + if (pFillStyle && !pFillColor && pBackTransparent + && drawing::FillStyle_SOLID == pFillStyle->maValue.get<drawing::FillStyle>() + && pBackTransparent->maValue.get<bool>()) + { + // fo:background="transparent", draw:fill="solid" without draw:fill-color + // prevent getSvxBrushItemFromSourceSet from adding bogus default color + pFillStyle->mnIndex = -1; + } + // #i5775# don't overwrite %transparency with binary transparency if( ( pBackTransparency != NULL ) && ( pBackTransparent != NULL ) ) { |