Kaydet (Commit) 729c8d13 authored tarafından Balazs Varga's avatar Balazs Varga Kaydeden (comit) László Németh

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 40144617

Change-Id: Id5bd585a666c3bcf346af5317e9197e6460f932a
Reviewed-on: https://gerrit.libreoffice.org/72670Reviewed-by: 's avatarLászló Németh <nemeth@numbertext.org>
Tested-by: 's avatarLászló Németh <nemeth@numbertext.org>
üst 2d3a9079
...@@ -2402,7 +2402,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( ...@@ -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. // 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 // 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; bool bReverse = false;
if( eLegendExpansion != css::chart::ChartLegendExpansion_WIDE ) if( eLegendExpansion != css::chart::ChartLegendExpansion_WIDE )
{ {
...@@ -2414,6 +2414,11 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( ...@@ -2414,6 +2414,11 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries(
bReverse = !bReverse; bReverse = !bReverse;
} }
} }
else if( bSwapXAndY )
{
StackingDirection eStackingDirection( pSeries->getStackingDirection() );
bReverse = ( eStackingDirection != StackingDirection_Y_STACKING );
}
if (bReverse) if (bReverse)
aResult.insert( aResult.begin(), aSeriesEntries.begin(), aSeriesEntries.end() ); aResult.insert( aResult.begin(), aSeriesEntries.begin(), aSeriesEntries.end() );
......
...@@ -2306,7 +2306,25 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf114163) ...@@ -2306,7 +2306,25 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf114163)
pXmlDoc, pXmlDoc,
"/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/textarray[12]/text", "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/textarray[12]/text",
"Data3"); "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) CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf108021)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment