Kaydet (Commit) 2cacaf6a authored tarafından Miklos Vajna's avatar Miklos Vajna

oox::vml::ShadowModel: differentiate between not having it and having it off

Having it explicitly disabled was already handled, but apparently
01d059c1 turned on shadows by default.
Fix this.

Change-Id: I1401a28b36a9b5aea302f9a19a6d02a29e6b358d
üst 01d059c1
......@@ -228,11 +228,14 @@ struct FillModel
/** The shadow model structure contains all shape shadow properties. */
struct ShadowModel
{
OptValue<bool> moHasShadow; ///< Specifies whether to show a shadow.
bool mbHasShadow; ///< Is a v:shadow element seen?
OptValue<bool> moShadowOn; ///< Is the element turned on?
OptValue<OUString> moColor; ///< Specifies the color of the shadow.
OptValue<OUString> moOffset; ///< Specifies the shadow's offset from the shape's location.
OptValue<double> moOpacity; ///< Specifies the opacity of the shadow.
ShadowModel();
/** Writes the properties to the passed property map. */
void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper) const;
};
......
......@@ -714,9 +714,14 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper&
// ============================================================================
ShadowModel::ShadowModel()
: mbHasShadow(false)
{
}
void ShadowModel::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper) const
{
if (moHasShadow.has() && !moHasShadow.get())
if (!mbHasShadow || (moShadowOn.has() && !moShadowOn.get()))
return;
drawingml::Color aColor = ConversionHelper::decodeColor(rGraphicHelper, moColor, moOpacity, API_RGB_GRAY);
......
......@@ -335,7 +335,8 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A
break;
case VML_TOKEN( shadow ):
{
mrTypeModel.maShadowModel.moHasShadow.assignIfUsed(lclDecodeBool(rAttribs, XML_on));
mrTypeModel.maShadowModel.mbHasShadow = true;
mrTypeModel.maShadowModel.moShadowOn.assignIfUsed(lclDecodeBool(rAttribs, XML_on));
mrTypeModel.maShadowModel.moColor.assignIfUsed(rAttribs.getString(XML_color));
mrTypeModel.maShadowModel.moOffset.assignIfUsed(rAttribs.getString(XML_offset));
mrTypeModel.maShadowModel.moOpacity = lclDecodePercent(rAttribs, XML_opacity, 1.0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment