[Libreoffice-commits] core.git: svx/source sw/qa
Mike Kaganski
mike.kaganski at collabora.com
Tue Nov 24 05:47:20 PST 2015
svx/source/svdraw/svdotext.cxx | 13 +++++++++++++
sw/qa/extras/ooxmlimport/data/tdf95970.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 28 ++++++++++++++++++++++++++++
3 files changed, 41 insertions(+)
New commits:
commit ae0e830f9ace78b889713e7e74ce46f88fa21470
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date: Sun Nov 22 16:04:36 2015 +1000
tdf#95970: Don't loose mirroring in SdrTextObj::TRSetBaseGeometry
Currently, negative scaling (mirroring) is lost in
SdrTextObj::NbcSetSnapRect, when rect is justified.
This patch cares for this.
Possibly it's better to make these changes directly in
SdrTextObj::NbcSetSnapRect?
Change-Id: I353ff01626e15b398de95e28eae78572991dfdc3
Reviewed-on: https://gerrit.libreoffice.org/20109
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 6de9734..0159d38 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1722,6 +1722,9 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
aScale.setY(fabs(aScale.getY()));
fRotate = fmod(fRotate + F_PI, F_2PI);
}
+ // flip?
+ bool bFlipX = basegfx::fTools::less(aScale.getX(), 0.0),
+ bFlipY = basegfx::fTools::less(aScale.getY(), 0.0);
// reset object shear and rotations
aGeo.nRotationAngle = 0;
@@ -1769,6 +1772,16 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
Rectangle aBaseRect(aPoint, aSize);
SetSnapRect(aBaseRect);
+ // flip?
+ if (bFlipX)
+ {
+ Mirror(Point(), Point(0, 1));
+ }
+ if (bFlipY)
+ {
+ Mirror(Point(), Point(1, 0));
+ }
+
// shear?
if(!basegfx::fTools::equalZero(fShearX))
{
diff --git a/sw/qa/extras/ooxmlimport/data/tdf95970.docx b/sw/qa/extras/ooxmlimport/data/tdf95970.docx
new file mode 100644
index 0000000..501ef36
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf95970.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 8c28ff9..53b55b9 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -78,6 +78,7 @@
#include <oox/drawingml/drawingmltypes.hxx>
#include <unotools/streamwrap.hxx>
#include <comphelper/propertysequence.hxx>
+#include <com/sun/star/drawing/HomogenMatrix3.hpp>
#include <bordertest.hxx>
@@ -2961,6 +2962,33 @@ DECLARE_OOXMLIMPORT_TEST(testTdf60351, "tdf60351.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aPolygon[5].Y);
}
+DECLARE_OOXMLIMPORT_TEST(testTdf95970, "tdf95970.docx")
+{
+ // First shape: the rotation should be -12.94 deg, it should be mirrored.
+ // Proper color order of image on test doc (left->right):
+ // top row: green->red
+ // bottom row: yellow->blue
+ uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY_THROW);
+ sal_Int32 aRotate = 0;
+ xPropertySet->getPropertyValue("RotateAngle") >>= aRotate;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(34706), aRotate);
+ bool bIsMirrored = false;
+ xPropertySet->getPropertyValue("IsMirrored") >>= bIsMirrored;
+ CPPUNIT_ASSERT(bIsMirrored);
+ drawing::HomogenMatrix3 aTransform;
+ xPropertySet->getPropertyValue("Transformation") >>= aTransform;
+ CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line1.Column1, 4767.0507250872988));
+ CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line1.Column2, -1269.0985325236848));
+ CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line1.Column3, 696.73611111111109));
+ CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line2.Column1, 1095.3035265135941));
+ CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line2.Column2, 5523.4525711162969));
+ CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line2.Column3, 672.04166666666663));
+ CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line3.Column1, 0.0));
+ CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line3.Column2, 0.0));
+ CPPUNIT_ASSERT(basegfx::fTools::equal(aTransform.Line3.Column3, 1.0));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list