diff options
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r-- | oox/source/drawingml/chart/datatableconverter.cxx | 30 | ||||
-rw-r--r-- | oox/source/drawingml/chart/plotareaconverter.cxx | 7 |
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 ) |