summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2022-11-03 16:10:11 +0100
committerLászló Németh <nemeth@numbertext.org>2022-11-14 12:15:01 +0100
commit1b167f3e0b1afec7c257f458db7505d8d8f177b3 (patch)
treefc1931af02f61ad890325b39e4e45075ccaecfdc
parent2d7db6981e5087507c02bde6c0841c388cfaad0f (diff)
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 <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--oox/source/export/shapes.cxx27
-rw-r--r--sd/qa/unit/data/pptx/tdt142291.pptxbin0 -> 21484 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx30
3 files changed, 56 insertions, 1 deletions
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
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdt142291.pptx
Binary files 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");