summaryrefslogtreecommitdiff
path: root/writerperfect
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2011-07-22 12:26:16 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2011-07-22 12:26:16 +0200
commitc8ffa554649191908b8b2beda9ccb7603892ad74 (patch)
tree62aab36fa892592453b7ed29f57d2530db3e17d9 /writerperfect
parentfaa27e0e6c39b128c6cc792da30eccf3a3ab156b (diff)
Don't output opacity gradients if the stops are completely opaque
Diffstat (limited to 'writerperfect')
-rw-r--r--writerperfect/source/filter/OdgGenerator.cxx26
1 files changed, 17 insertions, 9 deletions
diff --git a/writerperfect/source/filter/OdgGenerator.cxx b/writerperfect/source/filter/OdgGenerator.cxx
index 5ad616d0ff1c..45facff4cb0a 100644
--- a/writerperfect/source/filter/OdgGenerator.cxx
+++ b/writerperfect/source/filter/OdgGenerator.cxx
@@ -906,6 +906,7 @@ void OdgGenerator::drawGraphicObject(const ::WPXPropertyList &propList, const ::
void OdgGeneratorPrivate::_writeGraphicsStyle()
{
+ bool bUseOpacityGradient = false;
#if 0
if(mxStyle["libwpg:stroke-solid"] && !mxStyle["libwpg:stroke-solid"]->getInt() && (mxDashArray.count() >=2 ) )
{
@@ -937,6 +938,7 @@ void OdgGeneratorPrivate::_writeGraphicsStyle()
#endif
if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "gradient")
{
+ bUseOpacityGradient = true;
TagOpenElement *pDrawGradientElement = new TagOpenElement("draw:gradient");
TagOpenElement *pDrawOpacityElement = new TagOpenElement("draw:opacity");
if (mxStyle["draw:style"])
@@ -1020,18 +1022,21 @@ void OdgGeneratorPrivate::_writeGraphicsStyle()
else
pDrawOpacityElement->addAttribute("draw:end", "100%");
+ mGraphicsGradientStyles.push_back(pDrawGradientElement);
+ mGraphicsGradientStyles.push_back(new TagCloseElement("draw:gradient"));
+
// Work around a mess in LibreOffice where both opacities of 100% are interpreted as complete transparency
// Nevertheless, when one is different, immediately, they are interpreted correctly
if (!(mxStyle["libwpg:start-opacity"] && mxStyle["libwpg:end-opacity"]) || (mxStyle["libwpg:start-opacity"]->getDouble() == 1.0 && mxStyle["libwpg:end-opacity"]->getDouble() == 1.0))
{
- pDrawOpacityElement->addAttribute("draw:start", "0%");
- pDrawOpacityElement->addAttribute("draw:end", "0%");
+ delete pDrawOpacityElement;
+ bUseOpacityGradient = false;
+ }
+ else
+ {
+ mGraphicsGradientStyles.push_back(pDrawOpacityElement);
+ mGraphicsGradientStyles.push_back(new TagCloseElement("draw:opacity"));
}
-
- mGraphicsGradientStyles.push_back(pDrawGradientElement);
- mGraphicsGradientStyles.push_back(new TagCloseElement("draw:gradient"));
- mGraphicsGradientStyles.push_back(pDrawOpacityElement);
- mGraphicsGradientStyles.push_back(new TagCloseElement("draw:opacity"));
}
else if(mxGradient.count() >= 2)
{
@@ -1123,8 +1128,11 @@ void OdgGeneratorPrivate::_writeGraphicsStyle()
pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "gradient");
sValue.sprintf("Gradient_%i", miGradientIndex-1);
pStyleGraphicsPropertiesElement->addAttribute("draw:fill-gradient-name", sValue);
- sValue.sprintf("Transparency_%i", miGradientIndex-1);
- pStyleGraphicsPropertiesElement->addAttribute("draw:opacity-name", sValue);
+ if (bUseOpacityGradient)
+ {
+ sValue.sprintf("Transparency_%i", miGradientIndex-1);
+ pStyleGraphicsPropertiesElement->addAttribute("draw:opacity-name", sValue);
+ }
}
else
{