summaryrefslogtreecommitdiff
path: root/oox
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
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')
-rw-r--r--oox/source/drawingml/chart/datatableconverter.cxx30
-rw-r--r--oox/source/drawingml/chart/plotareaconverter.cxx7
-rw-r--r--oox/source/token/properties.txt7
3 files changed, 32 insertions, 12 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 )
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 8f17d34dbe49..5df793846a50 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
@@ -247,6 +244,7 @@ HasVerticalScrollBar
HasXAxisTitle
HasYAxisTitle
HasZAxisTitle
+HBorder
HeaderBodyDistance
HeaderHeight
HeaderIsDynamicHeight
@@ -294,6 +292,7 @@ IsVisible
IterationCount
IterationEpsilon
Japanese
+Keys
Label
LabelBorderColor
LabelBorderStyle
@@ -365,6 +364,7 @@ OpCodeMap
Opaque
Orientation
OutputPosition
+Outline
OverlapSequence
Overlay
PageScale
@@ -586,6 +586,7 @@ UseSelectedPage
VScroll
Validation
Value
+VBorder
VaryColorsByPoint
VertJustify
VertJustifyMethod