summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTünde Tóth <toth.tunde@nisz.hu>2023-04-18 12:01:18 +0200
committerLászló Németh <nemeth@numbertext.org>2023-04-25 14:52:02 +0200
commit5ee52d401e2086f79f794a4ec1a1d7beec8aa582 (patch)
tree52c519829ca79864f5f6c4dd56749a5272863ed8
parenttdf#150824 sw DOCX: fix export of new tracked tables (diff)
downloadcore-5ee52d401e2086f79f794a4ec1a1d7beec8aa582.tar.gz
core-5ee52d401e2086f79f794a4ec1a1d7beec8aa582.zip
tdf#119565 XLSX export: fix lost line properties inherited from theme
Line properties (LineWidth and LineJoint) of shape inherited from theme lost after export. Perhaps regression from commit 5391d4872e71d1edba7acc4ad2d2e3b5b97e1723 "ooxml: Preserve shape style and theme attributes for line". Change-Id: I9977bb20f16245f3c95ccbe2c5c8033b5b0c9cc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150547 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--oox/source/export/drawingml.cxx7
-rw-r--r--sc/qa/unit/data/xlsx/tdf119565.xlsxbin0 -> 9611 bytes
-rw-r--r--sc/qa/unit/subsequent_export_test4.cxx26
3 files changed, 31 insertions, 2 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index aaad66b4d083..60a5cdd62d7e 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1263,7 +1263,8 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet, Referenc
mpFS->startElementNS( XML_a, XML_ln,
XML_cap, cap,
XML_w, sax_fastparser::UseIf(OString::number(nEmuLineWidth),
- nLineWidth == 0 || (nLineWidth > 1 && nStyleLineWidth != nLineWidth)) );
+ nLineWidth == 0 || GetDocumentType() == DOCUMENT_XLSX // tdf#119565 LO doesn't export the actual theme.xml in XLSX.
+ || (nLineWidth > 1 && nStyleLineWidth != nLineWidth)));
if( bColorSet )
{
@@ -1431,7 +1432,9 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet, Referenc
{
LineJoint eLineJoint = mAny.get<LineJoint>();
- if( aStyleLineJoint == LineJoint_NONE || aStyleLineJoint != eLineJoint )
+ // tdf#119565 LO doesn't export the actual theme.xml in XLSX.
+ if (aStyleLineJoint == LineJoint_NONE || GetDocumentType() == DOCUMENT_XLSX
+ || aStyleLineJoint != eLineJoint)
{
// style-defined line joint does not exist, or is different from the shape's joint
switch( eLineJoint )
diff --git a/sc/qa/unit/data/xlsx/tdf119565.xlsx b/sc/qa/unit/data/xlsx/tdf119565.xlsx
new file mode 100644
index 000000000000..de530c0131f2
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/tdf119565.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx
index 8cb9a73a5f4e..79b5441c8f17 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
@@ -1612,6 +1613,31 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentStyles)
}
}
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf119565)
+{
+ createScDoc("xlsx/tdf119565.xlsx");
+ saveAndReload("Calc Office Open XML");
+
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xShapeProps(xPage->getByIndex(0), uno::UNO_QUERY_THROW);
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 35
+ // - Actual : 0
+ // i.e. line width inherited from theme lost after export.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(35),
+ xShapeProps->getPropertyValue("LineWidth").get<sal_Int32>());
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 3
+ // - Actual : 4
+ // i.e. line joint inherited from theme lost after export.
+ CPPUNIT_ASSERT_EQUAL(drawing::LineJoint_MITER,
+ xShapeProps->getPropertyValue("LineJoint").get<drawing::LineJoint>());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */