Kaydet (Commit) f0d07c5b authored tarafından Regina Henschel's avatar Regina Henschel

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: 's avatarRegina Henschel <rb.henschel@t-online.de>
üst ba9e513e
...@@ -295,6 +295,29 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf124029_arc_position) ...@@ -295,6 +295,29 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf124029_arc_position)
CPPUNIT_ASSERT_EQUAL_MESSAGE("shape width", static_cast<sal_uInt32>(1610), CPPUNIT_ASSERT_EQUAL_MESSAGE("shape width", static_cast<sal_uInt32>(1610),
static_cast<sal_uInt32>(aFrameRect.Width)); 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -1163,7 +1163,10 @@ bool EnhancedCustomShape2d::GetHandlePosition( const sal_uInt32 nIndex, Point& r ...@@ -1163,7 +1163,10 @@ bool EnhancedCustomShape2d::GetHandlePosition( const sal_uInt32 nIndex, Point& r
aHandle.aPosition.Second = aFirst; 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()); const GeoStat aGeoStat(mrSdrObjCustomShape.GetGeoStat());
if ( aGeoStat.nShearAngle ) if ( aGeoStat.nShearAngle )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment