From e18bc316efbd815b047f4e19ebd033e7a842d10d Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 1 Jul 2020 09:39:09 +0200 Subject: [PATCH] Related: tdf#131175 OOXML chart: insert hatch definition into the right table Both the chart and the containing document has one, but the intention is to insert this into the chart one. This is needed, but not enough to render the right hatch for data labels. Change-Id: I485d84e2ae33728963b648c05e730d418567fc0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97569 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- include/oox/core/filterbase.hxx | 3 +++ oox/source/core/filterbase.cxx | 10 ++++++++++ oox/source/drawingml/chart/seriesconverter.cxx | 11 +++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx index e341de4e0885..22a15a8eb52d 100644 --- a/include/oox/core/filterbase.hxx +++ b/include/oox/core/filterbase.hxx @@ -180,6 +180,9 @@ public: the imported document. */ ModelObjectHelper& getModelObjectHelper() const; + ModelObjectHelper& getModelObjectHelperForModel( + const css::uno::Reference& xFactory) const; + /** Returns a helper for the handling of OLE objects. */ ::oox::ole::OleObjectHelper& getOleObjectHelper() const; diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index 2eea42a8decf..cabd522b962d 100644 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -137,6 +137,8 @@ struct FilterBaseImpl GraphicHelperRef mxGraphicHelper; /// Graphic and graphic object handling. ModelObjHelperRef mxModelObjHelper; /// Tables to create new named drawing objects. + std::map, ModelObjHelperRef> + mxModelObjHelpers; OleObjHelperRef mxOleObjHelper; /// OLE object handling. VbaProjectRef mxVbaProject; /// VBA project manager. @@ -352,6 +354,14 @@ ModelObjectHelper& FilterBase::getModelObjectHelper() const return *mxImpl->mxModelObjHelper; } +ModelObjectHelper& FilterBase::getModelObjectHelperForModel( + const css::uno::Reference& xFactory) const +{ + if (!mxImpl->mxModelObjHelpers.count(xFactory)) + mxImpl->mxModelObjHelpers[xFactory] = std::make_shared(xFactory); + return *mxImpl->mxModelObjHelpers[xFactory]; +} + OleObjectHelper& FilterBase::getOleObjectHelper() const { if( !mxImpl->mxOleObjHelper ) diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index f2df3aebe536..4124d83d3d55 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -283,7 +284,10 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat if (mrModel.mxShapeProp) { importBorderProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper()); - importFillProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper(), getFilter().getModelObjectHelper()); + uno::Reference xFactory(getChartDocument(), uno::UNO_QUERY); + ModelObjectHelper& rHelper = getFilter().getModelObjectHelperForModel(xFactory); + importFillProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper(), + rHelper); } if( mrModel.mxText && mrModel.mxText->mxTextBody && !mrModel.mxText->mxTextBody->getParagraphs().empty() ) { @@ -370,7 +374,10 @@ void DataLabelsConverter::convertFromModel( const Reference< XDataSeries >& rxDa { // Import baseline border properties for these data labels. importBorderProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper()); - importFillProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper(), getFilter().getModelObjectHelper()); + uno::Reference xFactory(getChartDocument(), uno::UNO_QUERY); + ModelObjectHelper& rHelper = getFilter().getModelObjectHelperForModel(xFactory); + importFillProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper(), + rHelper); } } // import leaderline of data labels