oox/source/export/shapes.cxx        |   27 ++++++++++++++++++++++++++-
 sd/qa/unit/data/pptx/tdt142291.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   30 ++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 1 deletion(-)

New commits:
commit 1b167f3e0b1afec7c257f458db7505d8d8f177b3
Author:     Tibor Nagy <nagy.tib...@nisz.hu>
AuthorDate: Thu Nov 3 16:10:11 2022 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Mon Nov 14 12:15:01 2022 +0100

    tdf#142291 PPTX export: fix table border styles
    
    Export border style subset used by the PPTX
    import, ::table::BorderLineStyle::SOLID, DOTTED,
    DASHED, DASH_DOT and DASH_DOT_DOT.
    
    See also tablecell.cxx:applyLineAttributes().
    
    Change-Id: I5e4d631f7ca410beb76155579ea5b21a6eb66350
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142240
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index d102880af7bd..88be4362b228 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -24,6 +24,7 @@
 
 #include <filter/msfilter/util.hxx>
 #include <o3tl/string_view.hxx>
+#include <o3tl/any.hxx>
 #include <oox/core/xmlfilterbase.hxx>
 #include <oox/export/shapes.hxx>
 #include <oox/export/utils.hxx>
@@ -65,6 +66,7 @@
 #include <com/sun/star/presentation/ClickAction.hpp>
 #include <com/sun/star/drawing/XGluePointsSupplier.hpp>
 #include <com/sun/star/container/XIdentifierAccess.hpp>
+#include <com/sun/star/table/BorderLineStyle.hpp>
 #include <tools/globname.hxx>
 #include <comphelper/classids.hxx>
 #include <comphelper/propertysequence.hxx>
@@ -2290,7 +2292,30 @@ void ShapeExport::WriteBorderLine(const sal_Int32 
XML_line, const BorderLine2& r
             mpFS->singleElementNS(XML_a, XML_noFill);
         else
             DrawingML::WriteSolidFill( ::Color(ColorTransparency, 
rBorderLine.Color) );
-        mpFS->endElementNS( XML_a, XML_line );
+
+        OUString sBorderStyle;
+        sal_Int16 nStyle = rBorderLine.LineStyle;
+        mAny.setValue(&nStyle, cppu::UnoType<sal_Int16>::get());
+        switch (*o3tl::doAccess<sal_Int16>(mAny))
+        {
+            case ::table::BorderLineStyle::SOLID:
+                sBorderStyle = "solid";
+                break;
+            case ::table::BorderLineStyle::DOTTED:
+                sBorderStyle = "dot";
+                break;
+            case ::table::BorderLineStyle::DASHED:
+                sBorderStyle = "dash";
+                break;
+            case ::table::BorderLineStyle::DASH_DOT:
+                sBorderStyle = "dashDot";
+                break;
+            case ::table::BorderLineStyle::DASH_DOT_DOT:
+                sBorderStyle = "sysDashDotDot";
+                break;
+        }
+        mpFS->singleElementNS(XML_a, XML_prstDash, XML_val, sBorderStyle);
+        mpFS->endElementNS(XML_a, XML_line);
     }
     else if( nBorderWidth == 0)
     {
diff --git a/sd/qa/unit/data/pptx/tdt142291.pptx 
b/sd/qa/unit/data/pptx/tdt142291.pptx
new file mode 100644
index 000000000000..eb5a17eebe88
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdt142291.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index f7866c70a154..69f50c016315 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -76,6 +76,7 @@ public:
     {
     }
 
+    void testTdf142291();
     void testTdf151492();
     void testTdf149697();
     void testTdf149126();
@@ -146,6 +147,7 @@ public:
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
+    CPPUNIT_TEST(testTdf142291);
     CPPUNIT_TEST(testTdf151492);
     CPPUNIT_TEST(testTdf149697);
     CPPUNIT_TEST(testTdf149126);
@@ -222,6 +224,34 @@ public:
     }
 };
 
+void SdOOXMLExportTest2::testTdf142291()
+{
+    loadFromURL(u"pptx/tdt142291.pptx");
+    utl::TempFileNamed tempFile = save("Impress Office Open XML");
+
+    xmlDocUniquePtr pXmlDocContent = parseExport(tempFile.GetURL(), 
"ppt/slides/slide1.xml");
+    assertXPath(pXmlDocContent,
+                
"/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
+                "a:tcPr/a:lnL/a:prstDash",
+                "val", "sysDashDotDot");
+    assertXPath(pXmlDocContent,
+                
"/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
+                "a:tcPr/a:lnR/a:prstDash",
+                "val", "dot");
+    assertXPath(pXmlDocContent,
+                
"/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
+                "a:tcPr/a:lnT/a:prstDash",
+                "val", "solid");
+    assertXPath(pXmlDocContent,
+                
"/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[1]/"
+                "a:tcPr/a:lnB/a:prstDash",
+                "val", "dash");
+    assertXPath(pXmlDocContent,
+                
"/p:sld/p:cSld/p:spTree/p:graphicFrame/a:graphic/a:graphicData/a:tbl/a:tr/a:tc[2]/"
+                "a:tcPr/a:lnR/a:prstDash",
+                "val", "dashDot");
+}
+
 void SdOOXMLExportTest2::testTdf151492()
 {
     loadFromURL(u"odp/tdf151492.odp");

Reply via email to