summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2019-04-15 16:15:25 +0200
committerRegina Henschel <rb.henschel@t-online.de>2019-04-16 12:05:43 +0200
commitf0d07c5b84300e508d49dfceb968cb6a0dae436c (patch)
tree38acad86a9527f09f23c55b580bcf2f5a472dd2e /svx
parentba9e513ee8305c668c94b6ba59e26da278581652 (diff)
tdf#124740 Handle position is already scaled for ooxml-foo shapes
If a 'ooxml-foo' shape has a path internal coordinate system by using w and h attribute, the position of the handle was out of place. Because in 'ooxml-foo' shapes the handle position is not directly connected to the adjustment value but via formulas, the handle position is already scaled when calculating the position. Change-Id: I84ef8c5ea3bbe94a1bfd9d8ba17b97248086234f Reviewed-on: https://gerrit.libreoffice.org/70783 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'svx')
-rw-r--r--svx/qa/unit/customshapes.cxx23
-rw-r--r--svx/qa/unit/data/tdf124740_HandleInOOXMLUserShape.pptxbin0 -> 14929 bytes
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx5
3 files changed, 27 insertions, 1 deletions
diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index e58d46ab505d..526721d1a6c3 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -295,6 +295,29 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf124029_arc_position)
CPPUNIT_ASSERT_EQUAL_MESSAGE("shape width", static_cast<sal_uInt32>(1610),
static_cast<sal_uInt32>(aFrameRect.Width));
}
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf124740_handle_path_coordsystem)
+{
+ // tdf124740 OOXML shape with handle and w and h attribute on path has wrong
+ // handle position
+ // The handle position was scaled erroneously twice.
+ const OUString sFileName("tdf124740_HandleInOOXMLUserShape.pptx");
+ OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + sFileName;
+ mxComponent = loadFromDesktop(sURL, "com.sun.star.comp.drawing.DrawingDocument");
+ CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+ uno::Reference<drawing::XShape> xShape(getShape(0));
+ // The shape has one, horizontal adjust handle. It is about 1/5 of 10cm from left
+ // shape edge, shape is 6cm from left . That results in a position
+ // of 8cm from left page edge, which is 8000 in 1/100 mm unit.
+ SdrObjCustomShape& rSdrObjCustomShape(
+ static_cast<SdrObjCustomShape&>(*GetSdrObjectFromXShape(xShape)));
+ EnhancedCustomShape2d aCustomShape2d(rSdrObjCustomShape);
+ Point aPosition;
+ aCustomShape2d.GetHandlePosition(0, aPosition);
+ double fX(aPosition.X());
+ // tolerance for rounding to integer
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("handle X coordinate", 8000.0, fX, 2.0);
+}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf124740_HandleInOOXMLUserShape.pptx b/svx/qa/unit/data/tdf124740_HandleInOOXMLUserShape.pptx
new file mode 100644
index 000000000000..dd6df7b03b43
--- /dev/null
+++ b/svx/qa/unit/data/tdf124740_HandleInOOXMLUserShape.pptx
Binary files differ
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index b8b859f7b82e..339973707bdd 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -1163,7 +1163,10 @@ bool EnhancedCustomShape2d::GetHandlePosition( const sal_uInt32 nIndex, Point& r
aHandle.aPosition.Second = aFirst;
}
}
- rReturnPosition = GetPoint( aHandle.aPosition );
+ if (bOOXMLShape)
+ rReturnPosition = GetPoint(aHandle.aPosition, false /*bScale*/);
+ else
+ rReturnPosition = GetPoint(aHandle.aPosition, true /*bScale*/);
}
const GeoStat aGeoStat(mrSdrObjCustomShape.GetGeoStat());
if ( aGeoStat.nShearAngle )