summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2021-08-17 14:28:48 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-08-24 11:17:54 +0200
commite9fd6d94c3fe58ad6319daba5afca644e4e699a7 (patch)
tree8951230202a7c0d8bfb9a85fdef729738d6ac049
parentarm: fix bridge (diff)
downloadcore-e9fd6d94c3fe58ad6319daba5afca644e4e699a7.tar.gz
core-e9fd6d94c3fe58ad6319daba5afca644e4e699a7.zip
tdf#142351 chart ooxml import: fix category axis cross position
Set PROP_CrossoverPosition value regardless of the mrModel.mbAuto value, which is a different thing. This element specifies that this axis is a date or text axis based on the data that is used for the axis labels, not a specific choice. Change-Id: Ifa291aac2f4bb3981d968de3489b23f1af485104 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120592 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit e701732725dd641741f39020d7dc965bc4db765d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120875 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--chart2/qa/extras/chart2export.cxx17
-rw-r--r--chart2/qa/extras/data/xlsx/tdf142351.xlsxbin0 -> 15077 bytes
-rw-r--r--oox/source/drawingml/chart/axisconverter.cxx4
3 files changed, 16 insertions, 5 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 89dcdeb529fd..608905e59328 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -531,10 +531,21 @@ void Chart2ExportTest::testBarChart()
void Chart2ExportTest::testCrosses()
{
- load(u"/chart2/qa/extras/data/docx/", "Bar_horizontal_cone.docx");
- xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
+ // test crosses val="autoZero" with DOCX
+ {
+ load(u"/chart2/qa/extras/data/docx/", "Bar_horizontal_cone.docx");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/charts/chart", "Office Open XML Text");
+
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:crosses", "val", "autoZero");
+ }
+ // tdf#142351: test crossesAt val="-50" with XLSX
+ {
+ load(u"/chart2/qa/extras/data/xlsx/", "tdf142351.xlsx");
+ xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+ CPPUNIT_ASSERT(pXmlDoc);
- assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:crosses", "val", "autoZero");
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx/c:crossesAt", "val", "-50");
+ }
}
void Chart2ExportTest::testScatterChartTextXValues()
diff --git a/chart2/qa/extras/data/xlsx/tdf142351.xlsx b/chart2/qa/extras/data/xlsx/tdf142351.xlsx
new file mode 100644
index 000000000000..0414bb3f1625
--- /dev/null
+++ b/chart2/qa/extras/data/xlsx/tdf142351.xlsx
Binary files differ
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx
index 7aa141c0f798..4620f5b5a15c 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -372,8 +372,8 @@ void AxisConverter::convertFromModel(const Reference<XCoordinateSystem>& rxCoord
case XML_max: eAxisPos = cssc::ChartAxisPosition_END; break;
case XML_autoZero: eAxisPos = cssc::ChartAxisPosition_ZERO; break;
}
- if( !mrModel.mbAuto )
- aAxisProp.setProperty( PROP_CrossoverPosition, eAxisPos );
+
+ aAxisProp.setProperty( PROP_CrossoverPosition, eAxisPos );
// calculate automatic origin depending on scaling mode of crossing axis
bool bCrossingLogScale = pCrossingAxis && lclIsLogarithmicScale( *pCrossingAxis );