summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2019-09-03 14:54:52 +0200
committerLászló Németh <nemeth@numbertext.org>2019-09-04 13:36:35 +0200
commit4b3a648a2fd7d733674f95bb7f20670c57e99252 (patch)
treeb47efad3e9b36bda99aed0c671ece1848d9729da
parentca6ddfcc9385f1c31531eae31dfa81a9dda246f0 (diff)
tdf#127304 Chart: fix rotation of multilevel axis labels
If the first level of horizontal category axis labels is rotated vertically, then the other levels should not be rotated. Regression from commit: 23c0b3e13f88d6d71d528777d4f86f50c0766672 (tdf#107074 uncommenting createLabels for the axis fixes the issue) Change-Id: Ia1978fdc345fa154cff2ea03d2a94475f73398a6 Reviewed-on: https://gerrit.libreoffice.org/78557 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
-rw-r--r--chart2/source/view/axes/VCartesianAxis.cxx12
-rw-r--r--sw/qa/extras/layout/data/tdf127304.odtbin0 -> 13381 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx21
3 files changed, 28 insertions, 5 deletions
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 34faa8bdac79..4874f7f9575f 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -757,8 +757,8 @@ bool VCartesianAxis::createTextShapes(
}
}
- // Stores an array of text label strings in case of a normal
- // (non-complex) category axis.
+ // Stores an array of text label strings in case of a normal
+ // (non-complex) category axis.
const uno::Sequence<OUString>* pCategories = nullptr;
if( m_bUseTextLabels && !m_aAxisProperties.m_bComplexCategories )
pCategories = &m_aTextLabels;
@@ -1680,10 +1680,12 @@ void VCartesianAxis::createLabels()
{
aComplexProps.bLineBreakAllowed = true;
aComplexProps.bOverlapAllowed = aComplexProps.fRotationAngleDegree != 0.0;
- //Only the first level of complex vertical category axis labels orientation should be horizontal
- if( nTextLevel > 0 && m_aAxisProperties.m_bSwapXAndY )
+ if( nTextLevel > 0 )
{
- aComplexProps.fRotationAngleDegree = 90.0;
+ if( m_aAxisProperties.m_bSwapXAndY )
+ aComplexProps.fRotationAngleDegree = 90.0;
+ else
+ aComplexProps.fRotationAngleDegree = 0.0;
}
}
AxisLabelProperties& rAxisLabelProperties = m_aAxisProperties.m_bComplexCategories ? aComplexProps : m_aAxisLabelProperties;
diff --git a/sw/qa/extras/layout/data/tdf127304.odt b/sw/qa/extras/layout/data/tdf127304.odt
new file mode 100644
index 000000000000..e8a4d6e03b0a
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf127304.odt
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 2a43db31486c..f5cae5aa8405 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2320,6 +2320,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf126244)
"900");
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127304)
+{
+ SwDoc* pDoc = createDoc("tdf127304.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);
+ // Test the first level of horizontal category axis labels orientation. The first level orientation should be vertical.
+ assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[1]", "orientation",
+ "900");
+ // Test the second level of horizontal category axis labels orientation. The second level orientation should be horizontal.
+ assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[5]", "orientation",
+ "0");
+ // Test the third level of horizontal category axis labels orientation. The third level orientation should be horizontal.
+ assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[7]", "orientation",
+ "0");
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796)
{
SwDoc* pDoc = createDoc("tdf124796.odt");