[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - chart2/source sw/qa
Tünde Tóth (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 2 14:12:21 UTC 2020
chart2/source/view/charttypes/VSeriesPlotter.cxx | 19 +++++++------------
chart2/source/view/inc/LegendEntryProvider.hxx | 4 ++--
chart2/source/view/inc/VSeriesPlotter.hxx | 2 +-
chart2/source/view/main/VLegend.cxx | 2 +-
sw/qa/extras/layout/data/legend-itemorder-min.docx |binary
sw/qa/extras/layout/layout.cxx | 17 +++++++++++++++++
6 files changed, 28 insertions(+), 16 deletions(-)
New commits:
commit 305250469e0b22307454ebbf294457f4f2097ba9
Author: Tünde Tóth <tundeth at gmail.com>
AuthorDate: Tue Jun 23 13:52:39 2020 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Jul 2 16:11:48 2020 +0200
tdf#134247 Chart OOXML import: fix order of legend entries
The order of legend entries was reversed in stacked column,
line and area charts.
Change-Id: Ia4a439aa6cee0619ad323c3fb728ff358cf28537
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96941
Tested-by: Jenkins
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit b3057b7944dc52cc2ee3c57f44d4265c625e8dad)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97675
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 19b43ae3d964..75a0ea173aba 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -2394,7 +2394,7 @@ bool VSeriesPlotter::shouldSnapRectToUsedArea()
std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries(
const awt::Size& rEntryKeyAspectRatio
- , css::chart::ChartLegendExpansion eLegendExpansion
+ , LegendPosition eLegendPosition
, const Reference< beans::XPropertySet >& xTextProperties
, const Reference< drawing::XShapes >& xTarget
, const Reference< lang::XMultiServiceFactory >& xShapeFactory
@@ -2450,24 +2450,19 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries(
bBreak = true;
bFirstSeries = false;
- // add entries reverse if chart is stacked in y-direction and the legend is not wide.
- // If the legend is wide and we have a stacked bar-chart the normal order
+ // add entries reverse if chart is stacked in y-direction and the legend position is right or left.
+ // If the legend is top or bottom and we have a stacked bar-chart the normal order
// is the correct one, unless the chart type is horizontal bar-chart.
bool bReverse = false;
- if( eLegendExpansion != css::chart::ChartLegendExpansion_WIDE )
+ if ( bSwapXAndY )
{
StackingDirection eStackingDirection( pSeries->getStackingDirection() );
- bReverse = ( eStackingDirection == StackingDirection_Y_STACKING );
-
- if( bSwapXAndY )
- {
- bReverse = !bReverse;
- }
+ bReverse = ( eStackingDirection != StackingDirection_Y_STACKING );
}
- else if( bSwapXAndY )
+ else if ( eLegendPosition == LegendPosition_LINE_START || eLegendPosition == LegendPosition_LINE_END )
{
StackingDirection eStackingDirection( pSeries->getStackingDirection() );
- bReverse = ( eStackingDirection != StackingDirection_Y_STACKING );
+ bReverse = ( eStackingDirection == StackingDirection_Y_STACKING );
}
if (bReverse)
diff --git a/chart2/source/view/inc/LegendEntryProvider.hxx b/chart2/source/view/inc/LegendEntryProvider.hxx
index 88693900e8fb..8c7ae00fafab 100644
--- a/chart2/source/view/inc/LegendEntryProvider.hxx
+++ b/chart2/source/view/inc/LegendEntryProvider.hxx
@@ -19,7 +19,7 @@
#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_LEGENDENTRYPROVIDER_HXX
#define INCLUDED_CHART2_SOURCE_VIEW_INC_LEGENDENTRYPROVIDER_HXX
-#include <com/sun/star/chart/ChartLegendExpansion.hpp>
+#include <com/sun/star/chart2/LegendPosition.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
@@ -72,7 +72,7 @@ public:
virtual std::vector< ViewLegendEntry > createLegendEntries(
const css::awt::Size& rEntryKeyAspectRatio,
- css::chart::ChartLegendExpansion eLegendExpansion,
+ css::chart2::LegendPosition eLegendPosition,
const css::uno::Reference< css::beans::XPropertySet >& xTextProperties,
const css::uno::Reference< css::drawing::XShapes >& xTarget,
const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory,
diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx
index 7e60be2bdf1b..17215faae4b5 100644
--- a/chart2/source/view/inc/VSeriesPlotter.hxx
+++ b/chart2/source/view/inc/VSeriesPlotter.hxx
@@ -182,7 +182,7 @@ public:
virtual std::vector< ViewLegendEntry > createLegendEntries(
const css::awt::Size& rEntryKeyAspectRatio,
- css::chart::ChartLegendExpansion eLegendExpansion,
+ css::chart2::LegendPosition eLegendPosition,
const css::uno::Reference< css::beans::XPropertySet >& xTextProperties,
const css::uno::Reference< css::drawing::XShapes >& xTarget,
const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory,
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index 6c71db319d8e..d16495e426f3 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -998,7 +998,7 @@ void VLegend::createShapes(
if (pLegendEntryProvider)
{
std::vector<ViewLegendEntry> aNewEntries = pLegendEntryProvider->createLegendEntries(
- aMaxSymbolExtent, eExpansion, xLegendProp,
+ aMaxSymbolExtent, eLegendPosition, xLegendProp,
xLegendContainer, m_xShapeFactory, m_xContext, mrModel);
if (aNewEntries.size() == 0)
return;
diff --git a/sw/qa/extras/layout/data/legend-itemorder-min.docx b/sw/qa/extras/layout/data/legend-itemorder-min.docx
new file mode 100644
index 000000000000..8783d3908267
Binary files /dev/null and b/sw/qa/extras/layout/data/legend-itemorder-min.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index d5b88bd285d3..4f9ed8ec7f6f 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2328,6 +2328,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125335)
// This failed, if the legend first label is not "Data3". The legend position is bottom.
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134247)
+{
+ SwDoc* pDoc = createDoc("legend-itemorder-min.docx");
+ SwDocShell* pShell = pDoc->GetDocShell();
+
+ // Dump the rendering of the first page as an XML file.
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+ MetafileXmlDump dumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ assertXPathContent(pXmlDoc,
+ "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/textarray[14]/text",
+ "1. adatsor");
+ // This failed, if the legend first label is not "1. adatsor".
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf75659)
{
SwDoc* pDoc = createDoc("tdf75659.docx");
More information about the Libreoffice-commits
mailing list