summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2019-11-07 15:25:21 +0100
committerRegina Henschel <rb.henschel@t-online.de>2019-11-08 15:25:35 +0100
commit9b2a94321e3a05364064cb60dafc1d1b69eece56 (patch)
tree8855511c7abe24b46c4dcca4d3ef126db43fd29e
parent145672243d16a827dfd14a7b4e5cc0b7dd6f8751 (diff)
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.henschel@t-online.de>
-rw-r--r--svx/qa/unit/customshapes.cxx29
-rw-r--r--svx/qa/unit/data/tdf128413_tbrl_OnOff.odpbin0 -> 14170 bytes
-rw-r--r--svx/source/svdraw/svdoashp.cxx5
3 files changed, 32 insertions, 2 deletions
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
--- /dev/null
+++ b/svx/qa/unit/data/tdf128413_tbrl_OnOff.odp
Binary files 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(),