chart2/source/view/charttypes/VSeriesPlotter.cxx | 7 ++++++- sw/qa/extras/layout/data/tdf125335.odt |binary sw/qa/extras/layout/layout.cxx | 20 +++++++++++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-)
New commits: commit 729c8d135b6b958e6d2cd87ee72166ecdb0afbfc Author: Balazs Varga <balazs.varga...@gmail.com> AuthorDate: Tue May 21 10:18:26 2019 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Wed May 22 08:09:53 2019 +0200 tdf#125335 fix order of bar chart legend names in top-bottom positions by considering the axis direction. Note: Legend name order in left/right position was fixed in commit 40144617ce05d7eff86eeb8a412c6991fe0b819e Change-Id: Id5bd585a666c3bcf346af5317e9197e6460f932a Reviewed-on: https://gerrit.libreoffice.org/72670 Reviewed-by: László Németh <nem...@numbertext.org> Tested-by: László Németh <nem...@numbertext.org> diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 17f044654535..350254c14764 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -2402,7 +2402,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( // 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 - // is the correct one + // is the correct one, unless the chart type is horizontal bar-chart. bool bReverse = false; if( eLegendExpansion != css::chart::ChartLegendExpansion_WIDE ) { @@ -2414,6 +2414,11 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( bReverse = !bReverse; } } + else if( bSwapXAndY ) + { + StackingDirection eStackingDirection( pSeries->getStackingDirection() ); + bReverse = ( eStackingDirection != StackingDirection_Y_STACKING ); + } if (bReverse) aResult.insert( aResult.begin(), aSeriesEntries.begin(), aSeriesEntries.end() ); diff --git a/sw/qa/extras/layout/data/tdf125335.odt b/sw/qa/extras/layout/data/tdf125335.odt new file mode 100644 index 000000000000..992d93471001 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf125335.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 93cd45e1f429..1175d25ef573 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2306,7 +2306,25 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf114163) pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/textarray[12]/text", "Data3"); - // This failed, if the legend first label is not "Data3". + // This failed, if the legend first label is not "Data3". The legend position is right. +} + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125335) +{ + SwDoc* pDoc = createDoc("tdf125335.odt"); + SwDocShell* pShell = pDoc->GetDocShell(); + + // Dump the rendering of the first page as an XML file. + std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); + MetafileXmlDump dumper; + xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + CPPUNIT_ASSERT(pXmlDoc); + + assertXPathContent( + pXmlDoc, + "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/textarray[12]/text", + "Data3"); + // This failed, if the legend first label is not "Data3". The legend position is bottom. } CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf108021) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits