[Libreoffice-commits] core.git: svx/qa svx/source

Regina Henschel (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 16 10:06:22 UTC 2019


 svx/qa/unit/customshapes.cxx                           |   23 +++++++++++++++++
 svx/qa/unit/data/tdf124740_HandleInOOXMLUserShape.pptx |binary
 svx/source/customshapes/EnhancedCustomShape2d.cxx      |    5 ++-
 3 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit f0d07c5b84300e508d49dfceb968cb6a0dae436c
Author:     Regina Henschel <rb.henschel at t-online.de>
AuthorDate: Mon Apr 15 16:15:25 2019 +0200
Commit:     Regina Henschel <rb.henschel at t-online.de>
CommitDate: Tue Apr 16 12:05:43 2019 +0200

    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 at t-online.de>

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
Binary files /dev/null and b/svx/qa/unit/data/tdf124740_HandleInOOXMLUserShape.pptx 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 )


More information about the Libreoffice-commits mailing list