svx/qa/unit/customshapes.cxx | 29 +++++++++++++++++++++++++++++ svx/qa/unit/data/tdf128413_tbrl_OnOff.odp |binary svx/source/svdraw/svdoashp.cxx | 5 +++-- 3 files changed, 32 insertions(+), 2 deletions(-)
New commits: commit 9b2a94321e3a05364064cb60dafc1d1b69eece56 Author: Regina Henschel <rb.hensc...@t-online.de> AuthorDate: Thu Nov 7 15:25:21 2019 +0100 Commit: Regina Henschel <rb.hensc...@t-online.de> CommitDate: Fri Nov 8 15:25:35 2019 +0100 tdf#128413 SetSnapRect of custom shapes expects logic rect SdrObjCustomShape has its own version of SetSnapRect. This expects a logic rectangle in its input parameter. That was not considered in method SetVerticalWriting(). The result was, that for rotated or sheared shapes, which has text, setting tb-rl writing mode changed size and position. Change-Id: Idefd75cf25fd9ff4b9088ee494c65d5e6c5d12c8 Reviewed-on: https://gerrit.libreoffice.org/82233 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.hensc...@t-online.de> diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index 25ddbc97df17..796fa4824809 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -602,6 +602,35 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_TextRotateAngle) CPPUNIT_ASSERT_EQUAL(OUString(), sErrors); } + +CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf128413_tbrlOnOff) +{ + // The document contains a rotated shape with text. The error was, that switching + // tb-rl writing-mode on, changed the shape size and position. + + const OUString sFileName("tdf128413_tbrl_OnOff.odp"); + OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + sFileName; + mxComponent = loadFromDesktop(sURL, "com.sun.star.comp.drawing.DrawingDocument"); + uno::Reference<drawing::XShape> xShape(getShape(0)); + uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); + CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", xShapeProps.is()); + awt::Rectangle aOrigRect; + xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_FRAMERECT) >>= aOrigRect; + + SdrObjCustomShape& rSdrObjCustomShape( + static_cast<SdrObjCustomShape&>(*GetSdrObjectFromXShape(xShape))); + rSdrObjCustomShape.SetVerticalWriting(true); + + awt::Rectangle aObservedRect; + xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_FRAMERECT) >>= aObservedRect; + OUString sError; + if (aOrigRect.Width != aObservedRect.Width || aOrigRect.Height != aObservedRect.Height + || aOrigRect.X != aObservedRect.X || aOrigRect.Y != aObservedRect.Y) + { + sError = "Shape has wrong size or wrong position."; + } + CPPUNIT_ASSERT_EQUAL(OUString(), sError); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/qa/unit/data/tdf128413_tbrl_OnOff.odp b/svx/qa/unit/data/tdf128413_tbrl_OnOff.odp new file mode 100644 index 000000000000..f10f98bbeccf Binary files /dev/null and b/svx/qa/unit/data/tdf128413_tbrl_OnOff.odp differ diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 2fa14030b11a..7afb195499cd 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -2208,8 +2208,9 @@ void SdrObjCustomShape::SetVerticalWriting( bool bVertical ) SdrTextHorzAdjust eHorz = rSet.Get(SDRATTR_TEXT_HORZADJUST).GetValue(); SdrTextVertAdjust eVert = rSet.Get(SDRATTR_TEXT_VERTADJUST).GetValue(); - // rescue object size - tools::Rectangle aObjectRect = GetSnapRect(); + // rescue object size, SetSnapRect below expects logic rect, + // not snap rect. + tools::Rectangle aObjectRect = GetLogicRect(); // prepare ItemSet to set exchanged width and height items SfxItemSet aNewSet(*rSet.GetPool(), _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits