diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2015-11-22 16:04:36 +1000 |
---|---|---|
committer | Mike Kaganski <mikekaganski@hotmail.com> | 2015-11-24 13:46:49 +0000 |
commit | ae0e830f9ace78b889713e7e74ce46f88fa21470 (patch) | |
tree | d8799369cc9459bf100a3e949616666626ed54e3 | |
parent | ccd04a5f46c491d50b071cf2a58b77a2bacb1922 (diff) |
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@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
-rw-r--r-- | svx/source/svdraw/svdotext.cxx | 13 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf95970.docx | bin | 0 -> 13092 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 28 |
3 files changed, 41 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 6de973428c77..0159d382326a 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 Binary files differnew file mode 100644 index 000000000000..501ef361adad --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf95970.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 8c28ff91a0fc..53b55b9e5bbc 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: */ |