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

nd101 (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 13 09:36:38 UTC 2020


 oox/source/drawingml/transform2dcontext.cxx  |    4 ++--
 sd/qa/unit/data/pptx/smartart-tdf134221.pptx |binary
 sd/qa/unit/import-tests-smartart.cxx         |   17 +++++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 4a4fc98e5908db1e027c8438fbbcabefe6b0de8a
Author:     nd101 <Fong at nd.com.cn>
AuthorDate: Tue Jun 23 22:20:24 2020 +0800
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Jul 13 11:36:02 2020 +0200

    tdf#134221 Fix SMARTART caption text location
    
    Caption text shall be placed off center. Apply the transform2d.
    
    Change-Id: Iefdf207c8aadefecbe2e3154879d03ca10456d7b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96956
    Tested-by: Jenkins
    Tested-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx
index 2a324b15c23d..234cf5920269 100644
--- a/oox/source/drawingml/transform2dcontext.cxx
+++ b/oox/source/drawingml/transform2dcontext.cxx
@@ -53,7 +53,7 @@ ContextHandlerRef Transform2DContext::onCreateContext( sal_Int32 aElementToken,
     {
         // Workaround: only for rectangles
         const sal_Int32 nType = mrShape.getCustomShapeProperties()->getShapePresetType();
-        if( nType == XML_rect || nType == XML_roundRect )
+        if( nType == XML_rect || nType == XML_roundRect || nType == XML_ellipse )
         {
             switch( aElementToken )
             {
@@ -62,7 +62,7 @@ ContextHandlerRef Transform2DContext::onCreateContext( sal_Int32 aElementToken,
                         const OUString sXValue = rAttribs.getString( XML_x ).get();
                         const OUString sYValue = rAttribs.getString( XML_y ).get();
 
-                        if( !sXValue.isEmpty() )
+                        if( !sXValue.isEmpty() && nType != XML_ellipse )
                             mrShape.getTextBody()->getTextProperties().moTextOffLeft = GetCoordinate( sXValue.toInt32() - mrShape.getPosition().X );
                         if( !sYValue.isEmpty() )
                             mrShape.getTextBody()->getTextProperties().moTextOffUpper = GetCoordinate( sYValue.toInt32() - mrShape.getPosition().Y );
diff --git a/sd/qa/unit/data/pptx/smartart-tdf134221.pptx b/sd/qa/unit/data/pptx/smartart-tdf134221.pptx
new file mode 100755
index 000000000000..5ef12a7ffc65
Binary files /dev/null and b/sd/qa/unit/data/pptx/smartart-tdf134221.pptx differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 9496c1eae7c2..bbbe6880d8a8 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -109,6 +109,7 @@ public:
     void testOrgChart2();
     void testTdf131553();
     void testFillColorList();
+    void testTdf134221();
 
     CPPUNIT_TEST_SUITE(SdImportTestSmartArt);
 
@@ -155,6 +156,7 @@ public:
     CPPUNIT_TEST(testOrgChart2);
     CPPUNIT_TEST(testTdf131553);
     CPPUNIT_TEST(testFillColorList);
+    CPPUNIT_TEST(testTdf134221);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -1508,6 +1510,21 @@ void SdImportTestSmartArt::testFillColorList()
     xDocShRef->DoClose();
 }
 
+void SdImportTestSmartArt::testTdf134221()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-tdf134221.pptx"), PPTX);
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
+    uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+    uno::Reference<drawing::XShape> xShapeB = findChildShapeByText(xGroup, "B");
+    CPPUNIT_ASSERT(xShapeB.is());
+    uno::Reference<beans::XPropertySet> xTxtProps(xShapeB, uno::UNO_QUERY_THROW);
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(736),
+        xTxtProps->getPropertyValue("TextUpperDistance").get<sal_Int32>());
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list