summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2019-12-21 22:32:55 +0100
committerTomaž Vajngerl <quikee@gmail.com>2020-02-26 12:04:11 +0100
commitb4a6977e05d87fe0a79b266ec30e4f403404f1b4 (patch)
tree969b5d55c1f3ea2dedff31009ae89ff0eec38da5 /xmloff
parent79d396a2a64bec4e6c9aa514af40fdd67a62d8ce (diff)
tdf#129532 tdf#98839 fixes for mirror of custom shapes
tdf#98839 In case a sheared custom shape was mirrored, the shear angle in draw:transform had a wrong sign in the saved file. tdf#129532 Mirroring given in draw:transform in file or via macro was wrongly applied. Errors: 1)Mirroring from draw:transform attribute had overwritten already existing mirroring in the enhanced-geometry. 2)Mirroring from draw:transform attribute was set in enhanced- geometry attributes but not really applied. Change-Id: Ifa52f3606b5a33e6492a02d6e19c883d28752da8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85670 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/draw/ximpshap.cxx67
1 files changed, 40 insertions, 27 deletions
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 419c0174ae81..f0a8a169842a 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -3755,11 +3755,9 @@ void SdXMLCustomShapeContext::StartElement( const uno::Reference< xml::sax::XAtt
void SdXMLCustomShapeContext::EndElement()
{
- // for backward compatibility, the above SetTransformation() may already have
- // applied a call to SetMirroredX/SetMirroredY. This is not yet added to the
- // beans::PropertyValues in maCustomShapeGeometry. When applying these now, this
- // would be lost again.
- // TTTT: Remove again after aw080
+ // Customshapes remember mirror state in its enhanced geometry.
+ // SetTransformation() in StartElement() may have applied mirroring, but that is not yet
+ // contained. Merge that information here before writing the property.
if(!maUsedTransformation.isIdentity())
{
basegfx::B2DVector aScale, aTranslate;
@@ -3767,43 +3765,58 @@ void SdXMLCustomShapeContext::EndElement()
maUsedTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
- bool bFlippedX(aScale.getX() < 0.0);
- bool bFlippedY(aScale.getY() < 0.0);
-
- if(bFlippedX && bFlippedY)
+ if (aScale.getX() < 0.0)
{
- // when both are used it is the same as 180 degree rotation; reset
- bFlippedX = bFlippedY = false;
+ const OUString sName("MirroredX");
+ //fdo#84043 Merge, if property exists, otherwise append it
+ auto aI = std::find_if(maCustomShapeGeometry.begin(), maCustomShapeGeometry.end(),
+ [&sName](beans::PropertyValue& rValue) { return rValue.Name == sName; });
+ if (aI != maCustomShapeGeometry.end())
+ {
+ beans::PropertyValue& rItem = *aI;
+ bool bMirroredX;
+ rItem.Value >>= bMirroredX;
+ rItem.Value <<= !bMirroredX;
+ rItem.Handle = -1;
+ rItem.State = beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ beans::PropertyValue* pItem;
+ maCustomShapeGeometry.emplace_back();
+ pItem = &maCustomShapeGeometry.back();
+ pItem->Name = sName;
+ pItem->Handle = -1;
+ pItem->Value <<= true;
+ pItem->State = beans::PropertyState_DIRECT_VALUE;
+ }
}
- if(bFlippedX || bFlippedY)
+ if (aScale.getY() < 0.0)
{
- OUString sName;
-
- if(bFlippedX)
- sName = "MirroredX";
- else
- sName = "MirroredY";
-
- //fdo#84043 overwrite the property if it already exists, otherwise append it
- beans::PropertyValue* pItem;
+ const OUString sName("MirroredY");
+ //fdo#84043 Merge, if property exists, otherwise append it
auto aI = std::find_if(maCustomShapeGeometry.begin(), maCustomShapeGeometry.end(),
[&sName](beans::PropertyValue& rValue) { return rValue.Name == sName; });
if (aI != maCustomShapeGeometry.end())
{
beans::PropertyValue& rItem = *aI;
- pItem = &rItem;
+ bool bMirroredY;
+ rItem.Value >>= bMirroredY;
+ rItem.Value <<= !bMirroredY;
+ rItem.Handle = -1;
+ rItem.State = beans::PropertyState_DIRECT_VALUE;
}
else
{
+ beans::PropertyValue* pItem;
maCustomShapeGeometry.emplace_back();
pItem = &maCustomShapeGeometry.back();
+ pItem->Name = sName;
+ pItem->Handle = -1;
+ pItem->Value <<= true;
+ pItem->State = beans::PropertyState_DIRECT_VALUE;
}
-
- pItem->Name = sName;
- pItem->Handle = -1;
- pItem->Value <<= true;
- pItem->State = beans::PropertyState_DIRECT_VALUE;
}
}