oox/source/export/shapes.cxx       |    3 -
 sd/qa/unit/data/odp/tdf149126.odp  |binary
 sd/qa/unit/data/xml/tdf92001_0.xml |   32 +++++++++++---------
 sd/qa/unit/export-tests-ooxml2.cxx |   59 ++++++++++++++++++++-----------------
 4 files changed, 51 insertions(+), 43 deletions(-)

New commits:
commit a6d87845afc4080bb976f8e248d6c6cfc9a045b1
Author:     Tibor Nagy <nagy.tib...@nisz.hu>
AuthorDate: Fri Jun 3 15:32:50 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Jun 24 16:18:41 2022 +0200

    tdf#149126 fix export of PPTX preset shapes
    
    Follow-up to commit 63cd67e5e18f01aca303131e148c80398a181a41
    "tdf#92525 tdf#142398: fix export of simple custom shapes" and
    commit 744e6c0b758fefe6011f09860b44f03ab70fbcfe
    "tdf#147459 PPTX: add "glue points" to some basic shapes".
    
    Thanks to Regina Henschel for the code pointer.
    
    Change-Id: I378ffffc2ba09fcffcaa4e5dcf74bfd19e9f704d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135361
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>
    (cherry picked from commit 3c80d00689dd52c11ebc8de1c90142148e58b2ce)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136324
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 305bc2e78f53..79691c338985 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -926,8 +926,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
     bool bPresetWriteSuccessful = false;
     // Let the custom shapes what has name and preset information in OOXML, to 
be written
     // as preset ones with parameters. Try that with this converter class.
-    if (!sShapeType.startsWith("ooxml") && sShapeType != "non-primitive"
-        && GetDocumentType() == DOCUMENT_DOCX && !mbUserShapes
+    if (!sShapeType.startsWith("ooxml") && sShapeType != "non-primitive" && 
!mbUserShapes
         && xShape->getShapeType() == "com.sun.star.drawing.CustomShape"
         && !lcl_IsOnAllowlist(sShapeType))
     {
diff --git a/sd/qa/unit/data/odp/tdf149126.odp 
b/sd/qa/unit/data/odp/tdf149126.odp
new file mode 100644
index 000000000000..1d9c3c8c2318
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf149126.odp differ
diff --git a/sd/qa/unit/data/xml/tdf92001_0.xml 
b/sd/qa/unit/data/xml/tdf92001_0.xml
index 1bacf2f2559c..08d9622583d3 100644
--- a/sd/qa/unit/data/xml/tdf92001_0.xml
+++ b/sd/qa/unit/data/xml/tdf92001_0.xml
@@ -15,7 +15,10 @@
   </Transformation>
   <CustomShapeGeometry>
    <PropertyValue name="AdjustmentValues">
-    <AdjustmentValues/>
+    <AdjustmentValues>
+     <EnhancedCustomShapeAdjustmentValue value="47433" 
propertyState="DIRECT_VALUE"/>
+     <EnhancedCustomShapeAdjustmentValue value="90654" 
propertyState="DIRECT_VALUE"/>
+    </AdjustmentValues>
    </PropertyValue>
    <PropertyValue name="Equations" handle="0" propertyState="DIRECT_VALUE"/>
    <PropertyValue name="Handles" handle="0" propertyState="DIRECT_VALUE"/>
@@ -27,31 +30,31 @@
       <Coordinates>
        <EnhancedCustomShapeParameterPair>
         <First value="0" type="0"/>
-        <Second value="5677" type="0"/>
+        <Second value="8" type="1"/>
        </EnhancedCustomShapeParameterPair>
        <EnhancedCustomShapeParameterPair>
-        <First value="8631" type="0"/>
-        <Second value="5677" type="0"/>
+        <First value="5" type="1"/>
+        <Second value="8" type="1"/>
        </EnhancedCustomShapeParameterPair>
        <EnhancedCustomShapeParameterPair>
-        <First value="8631" type="0"/>
+        <First value="5" type="1"/>
         <Second value="0" type="0"/>
        </EnhancedCustomShapeParameterPair>
        <EnhancedCustomShapeParameterPair>
-        <First value="21600" type="0"/>
-        <Second value="10800" type="0"/>
+        <First value="14" type="1"/>
+        <Second value="7" type="1"/>
        </EnhancedCustomShapeParameterPair>
        <EnhancedCustomShapeParameterPair>
-        <First value="8631" type="0"/>
-        <Second value="21600" type="0"/>
+        <First value="5" type="1"/>
+        <Second value="13" type="1"/>
        </EnhancedCustomShapeParameterPair>
        <EnhancedCustomShapeParameterPair>
-        <First value="8631" type="0"/>
-        <Second value="15923" type="0"/>
+        <First value="5" type="1"/>
+        <Second value="9" type="1"/>
        </EnhancedCustomShapeParameterPair>
        <EnhancedCustomShapeParameterPair>
         <First value="0" type="0"/>
-        <Second value="15923" type="0"/>
+        <Second value="9" type="1"/>
        </EnhancedCustomShapeParameterPair>
       </Coordinates>
      </PropertyValue>
@@ -63,11 +66,12 @@
        <EnhancedCustomShapeSegment command="5" count="0"/>
       </Segments>
      </PropertyValue>
-     <PropertyValue name="SubViewSize" handle="0" 
propertyState="DIRECT_VALUE"/>
      <PropertyValue name="TextFrames" handle="0" propertyState="DIRECT_VALUE"/>
     </Path>
    </PropertyValue>
-   <PropertyValue name="Type" value="ooxml-non-primitive" handle="0" 
propertyState="DIRECT_VALUE"/>
+   <PropertyValue name="TextCameraZRotateAngle" value="0" handle="0" 
propertyState="DIRECT_VALUE"/>
+   <PropertyValue name="TextPreRotateAngle" value="0" handle="0" 
propertyState="DIRECT_VALUE"/>
+   <PropertyValue name="Type" value="ooxml-rightArrow" handle="0" 
propertyState="DIRECT_VALUE"/>
    <PropertyValue name="ViewBox">
     <ViewBox x="0" y="0" width="0" height="0"/>
    </PropertyValue>
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index b9c1f437c64c..0029f882463b 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -70,6 +70,7 @@ static void assertMotionPath(std::u16string_view rStr1, 
std::u16string_view rStr
 class SdOOXMLExportTest2 : public SdModelTestBaseXML
 {
 public:
+    void testTdf149126();
     void testTdf131905();
     void testTdf93883();
     void testTdf91378();
@@ -137,6 +138,7 @@ public:
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
+    CPPUNIT_TEST(testTdf149126);
     CPPUNIT_TEST(testTdf131905);
     CPPUNIT_TEST(testTdf93883);
     CPPUNIT_TEST(testTdf91378);
@@ -210,6 +212,20 @@ public:
     }
 };
 
+void SdOOXMLExportTest2::testTdf149126()
+{
+    ::sd::DrawDocShellRef xDocShRef
+        = 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf149126.odp"), 
ODP);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+
+    xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, 
"ppt/slides/slide1.xml");
+    assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom", "prst",
+                "triangle");
+
+    xDocShRef->DoClose();
+}
+
 void SdOOXMLExportTest2::testTdf131905()
 {
     ::sd::DrawDocShellRef xDocShRef
@@ -661,7 +677,7 @@ void SdOOXMLExportTest2::testPresetShapesExport()
         "donut",
         "adj","val 9601",
         "bevel",
-        "adj","val 42587",
+        "adj","val 42592",
         "foldedCorner",
         "adj","val 10750",
         "verticalScroll",
@@ -692,9 +708,9 @@ void SdOOXMLExportTest2::testPresetShapesExport()
         "adj5","val -22375",
         "adj6","val -134550",
         "blockArc",
-        "adj1","val 13020000",
-        "adj2","val 19380000",
-        "adj3","val 3773",
+        "adj1","val 12975429",
+        "adj2","val 19424571",
+        "adj3","val 3770",
     };
 
     utl::TempFile tempFile;
@@ -720,9 +736,8 @@ void SdOOXMLExportTest2::testPresetShapesExport()
 
 void SdOOXMLExportTest2::testTdf92527()
 {
-    // We draw a diamond in an empty document. A newly created diamond shape 
does not have
-    // CustomShapeGeometry - Path - Segments property, and previously 
DrawingML exporter
-    // did not export custom shapes which did not have CustomShapeGeometry - 
Path - Segments property.
+    // We draw a diamond in an empty document.
+    // If custom shape has name and preset information in OOXML, should be 
export as preset shape.
     sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/empty.fodp"), FODG );
     uno::Reference<css::lang::XMultiServiceFactory> 
xFactory(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY);
     uno::Reference<drawing::XShape> 
xShape1(xFactory->createInstance("com.sun.star.drawing.CustomShape"), 
uno::UNO_QUERY);
@@ -759,8 +774,8 @@ void SdOOXMLExportTest2::testTdf92527()
             aCoordinates = rProp.Value.get< 
uno::Sequence<drawing::EnhancedCustomShapeParameterPair> >();
     }
 
-    // 5 coordinate pairs, 1 MoveTo, 4 LineTo
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aCoordinates.getLength());
+    // 4 coordinate pairs
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aCoordinates.getLength());
     xDocShRef->DoClose();
 }
 
@@ -1050,27 +1065,17 @@ void SdOOXMLExportTest2::testTdf111798()
     xDocShRef->DoClose();
     xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
 
-    const OUString data[][26] =
+    const OUString data[][11] =
     {
         {
             "2700000", "2458080", "2414880", "1439640", "1440000",
-            "moveTo",  "0",     "5400",
-            "lnTo[1]", "16200", "5400",
-            "lnTo[2]", "16200", "0",
-            "lnTo[3]", "21600", "10800",
-            "lnTo[4]", "16200", "21600",
-            "lnTo[5]", "16200", "16200",
-            "lnTo[6]", "0",     "16200"
+            "gd[1]", "adj1", "val 50000",
+            "gd[2]", "adj2", "val 25000"
         },
         {
             "2700000", "6778080", "2414880", "1439640", "1440000",
-            "moveTo",  "5400",  "0",
-            "lnTo[1]", "5400",  "16200",
-            "lnTo[2]", "0",     "16200",
-            "lnTo[3]", "10800", "21600",
-            "lnTo[4]", "21600", "16200",
-            "lnTo[5]", "16200", "16200",
-            "lnTo[6]", "16200", "0"
+            "gd[1]", "adj1", "val 50000",
+            "gd[2]", "adj2", "val 25006"
         }
     };
 
@@ -1090,9 +1095,9 @@ void SdOOXMLExportTest2::testTdf111798()
 
         while (nDataIndex < SAL_N_ELEMENTS(data[nShapeIndex]))
         {
-            const OString sPt = sSpPr + "/a:custGeom/a:pathLst/a:path/a:" + 
data[nShapeIndex][nDataIndex++].toUtf8() + "/a:pt";
-            assertXPath(pXmlDoc, sPt, "x", data[nShapeIndex][nDataIndex++]);
-            assertXPath(pXmlDoc, sPt, "y", data[nShapeIndex][nDataIndex++]);
+            const OString sGd = sSpPr + "/a:prstGeom/a:avLst/a:" + 
data[nShapeIndex][nDataIndex++].toUtf8() + "";
+            assertXPath(pXmlDoc, sGd, "name", data[nShapeIndex][nDataIndex++]);
+            assertXPath(pXmlDoc, sGd, "fmla", data[nShapeIndex][nDataIndex++]);
         }
     }
 }

Reply via email to