summaryrefslogtreecommitdiff
path: root/oox/source/drawingml
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-05-16 15:53:59 +0900
committerTomaž Vajngerl <quikee@gmail.com>2022-07-17 21:48:46 +0200
commit71bcaa477e9379f4c584b3309d7a6149c801702c (patch)
tree48f2d12c3108f26691d02d05b868807a4d48e879 /oox/source/drawingml
parent2fffe41501aa694082da2ac92e925b98c704bffd (diff)
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 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136790 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r--oox/source/drawingml/chart/datatableconverter.cxx30
-rw-r--r--oox/source/drawingml/chart/plotareaconverter.cxx7
2 files changed, 28 insertions, 9 deletions
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 a30b3bdc6249..96e51c577d43 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);
+ dataTableConverter.convertFromModel(xDiagram);
+ }
// plot area formatting
if( xDiagram.is() && !mb3dChart )