diff options
author | Tünde Tóth <tundeth@gmail.com> | 2020-03-17 15:25:56 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-03-30 12:45:57 +0200 |
commit | ab40a7843a66d1fe276224db16ddaecd538df234 (patch) | |
tree | 9651bd37bc32f184de0eca75d2aa83658f612c9c /oox | |
parent | 55c8ab7294e9e1651b94215d4ff14c7afcb7d733 (diff) |
tdf#131370 chart: implement OOXML import/export of legend overlay feature
Follow-up of the following commits related to the new UNO property
Overlay for legends:
commit 9fab1ba8ddc59924c633aa17c65f7330a4762726
(tdf#75330 add a new overlay/no-overlay feature for the legend)
commit 65123d41f62597053bc3893ee4fb46868a6b1f2d
(tdf#75330 chart: implement ODF import/export of legend overlay feature)
Change-Id: Ie3eff9b8a4f99980a7ae28add909a27eb0e9d14b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90655
Tested-by: Jenkins
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/drawingml/chart/titlemodel.hxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/chart/chartspacefragment.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/chart/titlecontext.cxx | 6 | ||||
-rw-r--r-- | oox/source/drawingml/chart/titleconverter.cxx | 3 | ||||
-rw-r--r-- | oox/source/drawingml/chart/titlemodel.cxx | 4 | ||||
-rw-r--r-- | oox/source/export/chartexport.cxx | 6 | ||||
-rw-r--r-- | oox/source/token/properties.txt | 1 |
7 files changed, 15 insertions, 9 deletions
diff --git a/oox/inc/drawingml/chart/titlemodel.hxx b/oox/inc/drawingml/chart/titlemodel.hxx index c31b8d34ba73..4b693e2e60e0 100644 --- a/oox/inc/drawingml/chart/titlemodel.hxx +++ b/oox/inc/drawingml/chart/titlemodel.hxx @@ -80,7 +80,7 @@ struct LegendModel sal_Int32 mnPosition; /// Legend position. bool mbOverlay; /// True = legend may overlay other objects. - explicit LegendModel(bool bMSO2007Doc); + explicit LegendModel(); ~LegendModel(); }; diff --git a/oox/source/drawingml/chart/chartspacefragment.cxx b/oox/source/drawingml/chart/chartspacefragment.cxx index 4d5d9158567f..aa045d4a5079 100644 --- a/oox/source/drawingml/chart/chartspacefragment.cxx +++ b/oox/source/drawingml/chart/chartspacefragment.cxx @@ -98,7 +98,7 @@ ContextHandlerRef ChartSpaceFragment::onCreateContext( sal_Int32 nElement, const case C_TOKEN( floor ): return new WallFloorContext( *this, mrModel.mxFloor.create() ); case C_TOKEN( legend ): - return new LegendContext( *this, mrModel.mxLegend.create(bMSO2007Document) ); + return new LegendContext( *this, mrModel.mxLegend.create() ); case C_TOKEN( plotArea ): return new PlotAreaContext( *this, mrModel.mxPlotArea.create() ); case C_TOKEN( plotVisOnly ): diff --git a/oox/source/drawingml/chart/titlecontext.cxx b/oox/source/drawingml/chart/titlecontext.cxx index f62d8ced995f..35ba44cf60fc 100644 --- a/oox/source/drawingml/chart/titlecontext.cxx +++ b/oox/source/drawingml/chart/titlecontext.cxx @@ -88,7 +88,6 @@ TitleContext::~TitleContext() ContextHandlerRef TitleContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { - bool bMSO2007Doc = getFilter().isMSO2007Document(); // this context handler is used for <c:title> only switch( nElement ) { @@ -96,7 +95,7 @@ ContextHandlerRef TitleContext::onCreateContext( sal_Int32 nElement, const Attri return new LayoutContext( *this, mrModel.mxLayout.create() ); case C_TOKEN( overlay ): - mrModel.mbOverlay = rAttribs.getBool( XML_val, !bMSO2007Doc ); + mrModel.mbOverlay = rAttribs.getBool( XML_val, true ); return nullptr; case C_TOKEN( spPr ): @@ -147,7 +146,6 @@ LegendContext::~LegendContext() ContextHandlerRef LegendContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { - bool bMSO2007Doc = getFilter().isMSO2007Document(); // this context handler is used for <c:legend> only switch( nElement ) { @@ -162,7 +160,7 @@ ContextHandlerRef LegendContext::onCreateContext( sal_Int32 nElement, const Attr return new LegendEntryContext( *this, mrModel.maLegendEntries.create() ); case C_TOKEN( overlay ): - mrModel.mbOverlay = rAttribs.getBool( XML_val, !bMSO2007Doc ); + mrModel.mbOverlay = rAttribs.getBool( XML_val, true ); return nullptr; case C_TOKEN( spPr ): diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx index c0de3919571e..10ebd308b4fa 100644 --- a/oox/source/drawingml/chart/titleconverter.cxx +++ b/oox/source/drawingml/chart/titleconverter.cxx @@ -249,6 +249,9 @@ void LegendConverter::convertFromModel( const Reference< XDiagram >& rxDiagram ) if (bTopRight && !bManualLayout) aPropSet.setProperty( PROP_RelativePosition , makeAny(eRelPos)); + + aPropSet.setProperty(PROP_Overlay, mrModel.mbOverlay); + if (mrModel.maLegendEntries.size() > 0) legendEntriesFormatting(rxDiagram); } diff --git a/oox/source/drawingml/chart/titlemodel.cxx b/oox/source/drawingml/chart/titlemodel.cxx index ff1891d02f8d..f28520573904 100644 --- a/oox/source/drawingml/chart/titlemodel.cxx +++ b/oox/source/drawingml/chart/titlemodel.cxx @@ -50,9 +50,9 @@ LegendEntryModel::~LegendEntryModel() { } -LegendModel::LegendModel(bool bMSO2007Doc) : +LegendModel::LegendModel() : mnPosition( XML_r ), - mbOverlay( !bMSO2007Doc ) + mbOverlay( false ) { } diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 78685f38b5d3..2d7758fb7ed0 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -1197,7 +1197,11 @@ void ChartExport::exportLegend( const Reference< css::chart::XChartDocument >& x if (strPos != nullptr) { - pFS->singleElement(FSNS(XML_c, XML_overlay), XML_val, "0"); + uno::Any aOverlay = xProp->getPropertyValue("Overlay"); + if(aOverlay.get<bool>()) + pFS->singleElement(FSNS(XML_c, XML_overlay), XML_val, "1"); + else + pFS->singleElement(FSNS(XML_c, XML_overlay), XML_val, "0"); } // shape properties diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 4624573d579b..83dd8f9ff3d1 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -347,6 +347,7 @@ Opaque Orientation OutputPosition OverlapSequence +Overlay PageScale PageStyle PageToggle |