oox/source/drawingml/chart/datatableconverter.cxx |   30 ++++++++++++++++------
 oox/source/drawingml/chart/plotareaconverter.cxx  |    7 +++--
 oox/source/token/properties.txt                   |    7 ++---
 3 files changed, 32 insertions(+), 12 deletions(-)

New commits:
commit a712d8da7f2ac0dbc15564f2c8353bd13c33ef87
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Mon May 16 15:53:59 2022 +0900
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Mon May 16 15:53:59 2022 +0900

    oox: add data table and props. with the new UNO DataTable service
    
    Refactor filling of the old data table UNO properties to use the
    new service DataTable and its properties.
    
    Change-Id: Iee611c88bec6f58a50b5ae09d3acffd16e0b6dd9

diff --git a/oox/source/drawingml/chart/datatableconverter.cxx 
b/oox/source/drawingml/chart/datatableconverter.cxx
index 802edc9464ac..3c477c5d7507 100644
--- a/oox/source/drawingml/chart/datatableconverter.cxx
+++ b/oox/source/drawingml/chart/datatableconverter.cxx
@@ -20,6 +20,7 @@
 #include <drawingml/chart/datatableconverter.hxx>
 
 #include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XDataTable.hpp>
 #include <drawingml/chart/plotareamodel.hxx>
 #include <oox/token/properties.hxx>
 
@@ -36,13 +37,28 @@ DataTableConverter::~DataTableConverter() = default;
 
 void DataTableConverter::convertFromModel(uno::Reference<chart2::XDiagram> 
const& rxDiagram)
 {
-    PropertySet aPropSet(rxDiagram);
-    if (mrModel.mbShowHBorder)
-        aPropSet.setProperty(PROP_DataTableHBorder, mrModel.mbShowHBorder);
-    if (mrModel.mbShowVBorder)
-        aPropSet.setProperty(PROP_DataTableVBorder, mrModel.mbShowVBorder);
-    if (mrModel.mbShowOutline)
-        aPropSet.setProperty(PROP_DataTableOutline, mrModel.mbShowOutline);
+    if (!rxDiagram.is())
+        return;
+
+    try
+    {
+        uno::Reference<chart2::XDataTable> xDataTable(
+            createInstance("com.sun.star.chart2.DataTable"), 
uno::UNO_QUERY_THROW);
+        rxDiagram->setDataTable(xDataTable);
+
+        PropertySet aPropSet(xDataTable);
+        if (mrModel.mbShowHBorder)
+            aPropSet.setProperty(PROP_HBorder, mrModel.mbShowHBorder);
+        if (mrModel.mbShowVBorder)
+            aPropSet.setProperty(PROP_VBorder, mrModel.mbShowVBorder);
+        if (mrModel.mbShowOutline)
+            aPropSet.setProperty(PROP_Outline, mrModel.mbShowOutline);
+        if (mrModel.mbShowKeys)
+            aPropSet.setProperty(PROP_Keys, mrModel.mbShowKeys);
+    }
+    catch (uno::Exception&)
+    {
+    }
 }
 
 } // namespace oox
diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx 
b/oox/source/drawingml/chart/plotareaconverter.cxx
index afbb28adee03..18c0fd774feb 100644
--- a/oox/source/drawingml/chart/plotareaconverter.cxx
+++ b/oox/source/drawingml/chart/plotareaconverter.cxx
@@ -433,8 +433,11 @@ void PlotAreaConverter::convertFromModel( View3DModel& 
rView3DModel )
         nAxesSetIdx = 1 - nAxesSetIdx;
     }
 
-    DataTableConverter dataTableConverter (*this, 
mrModel.mxDataTable.getOrCreate());
-    dataTableConverter.convertFromModel(xDiagram);
+    if (mrModel.mxDataTable)
+    {
+        DataTableConverter dataTableConverter(*this, 
*mrModel.mxDataTable.get());
+        dataTableConverter.convertFromModel(xDiagram);
+    }
 
     // plot area formatting
     if( xDiagram.is() && !mb3dChart )
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 8467d3683875..904ba3f35c0e 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -127,9 +127,6 @@ D3DSceneLightOn2
 D3DScenePerspective
 D3DSceneShadeMode
 DDELinks
-DataTableHBorder
-DataTableOutline
-DataTableVBorder
 DatabaseRanges
 Decoration
 DefaultScrollValue
@@ -246,6 +243,7 @@ HasVerticalScrollBar
 HasXAxisTitle
 HasYAxisTitle
 HasZAxisTitle
+HBorder
 HeaderBodyDistance
 HeaderHeight
 HeaderIsDynamicHeight
@@ -293,6 +291,7 @@ IsVisible
 IterationCount
 IterationEpsilon
 Japanese
+Keys
 Label
 LabelBorderColor
 LabelBorderStyle
@@ -364,6 +363,7 @@ OpCodeMap
 Opaque
 Orientation
 OutputPosition
+Outline
 OverlapSequence
 Overlay
 PageScale
@@ -585,6 +585,7 @@ UseSelectedPage
 VScroll
 Validation
 Value
+VBorder
 VaryColorsByPoint
 VertJustify
 VertJustifyMethod

Reply via email to