summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/source/tools/ChartTypeHelper.cxx20
-rw-r--r--sw/qa/extras/layout/data/tdf130242.odtbin0 -> 13515 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx32
3 files changed, 50 insertions, 2 deletions
diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx
index b7b3e889e1a1..b54e410bcb73 100644
--- a/chart2/source/tools/ChartTypeHelper.cxx
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -314,10 +314,26 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const
}
else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) )
{
+ bool bStacked = false;
+ {
+ uno::Reference<beans::XPropertySet> xSeriesProp(xSeries, uno::UNO_QUERY);
+ chart2::StackingDirection eStacking = chart2::StackingDirection_NO_STACKING;
+ xSeriesProp->getPropertyValue("StackingDirection") >>= eStacking;
+ bStacked = (eStacking == chart2::StackingDirection_Y_STACKING);
+ }
+
aRet.realloc(2);
sal_Int32* pSeq = aRet.getArray();
- *pSeq++ = css::chart::DataLabelPlacement::TOP;
- *pSeq++ = css::chart::DataLabelPlacement::CENTER;
+ if (bStacked)
+ {
+ *pSeq++ = css::chart::DataLabelPlacement::CENTER;
+ *pSeq++ = css::chart::DataLabelPlacement::TOP;
+ }
+ else
+ {
+ *pSeq++ = css::chart::DataLabelPlacement::TOP;
+ *pSeq++ = css::chart::DataLabelPlacement::CENTER;
+ }
}
else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
{
diff --git a/sw/qa/extras/layout/data/tdf130242.odt b/sw/qa/extras/layout/data/tdf130242.odt
new file mode 100644
index 000000000000..3e97bd3e5fe1
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf130242.odt
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index b6bdd958cbed..c1c43399c9f4 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2515,9 +2515,41 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130031)
xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
CPPUNIT_ASSERT(pXmlDoc);
sal_Int32 nY = getXPath(pXmlDoc, "//textarray[11]", "y").toInt32();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 4339
+ // - Actual : 2182
+ // - Delta : 50
+ // i.e. the data label appeared above the data point.
CPPUNIT_ASSERT_DOUBLES_EQUAL(4339, nY, 50);
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130242)
+{
+ SwDoc* pDoc = createDoc("tdf130242.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);
+ sal_Int32 nY = getXPath(pXmlDoc, "//textarray[11]", "y").toInt32();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 4958
+ // - Actual : 3352
+ // - Delta : 50
+ // i.e. the data label appeared above the data point.
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(4958, nY, 50);
+
+ nY = getXPath(pXmlDoc, "//textarray[13]", "y").toInt32();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 3018
+ // - Actual : 2343
+ // - Delta : 50
+ // i.e. the data label appeared above the data point.
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(3018, nY, 50);
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116925)
{
SwDoc* pDoc = createDoc("tdf116925.docx");