chart2/source/view/axes/VCartesianAxis.cxx | 13 ++++++++++--- sw/qa/extras/layout/data/tdf126244.docx |binary sw/qa/extras/layout/layout.cxx | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-)
New commits: commit 0dab9b7c83099a192ec61486e7a9fd04aecd3686 Author: Balazs Varga <balazs.varga...@gmail.com> AuthorDate: Wed Jul 31 15:58:09 2019 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Thu Aug 1 10:48:06 2019 +0200 tdf#126244 Chart view: fix rotation of complex category labels The first level of vertical category axis labels orientation should be horizontal, other levels should be rotated to 90°. Also do not allow text break for complex vertical category axis labels. Change-Id: I01a6d9f753e767927fa71e2967dc3e6bad270565 Reviewed-on: https://gerrit.libreoffice.org/76754 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> Tested-by: László Németh <nem...@numbertext.org> diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 483411c4c605..34faa8bdac79 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -527,10 +527,13 @@ bool VCartesianAxis::isBreakOfLabelsAllowed( rAxisLabelProperties.fRotationAngleDegree == 90.0 || rAxisLabelProperties.fRotationAngleDegree == 270.0 ) ) return false; - if ( !m_aAxisProperties.m_bSwapXAndY ) + //no break for complex vertical category axis + if( !m_aAxisProperties.m_bSwapXAndY ) return bIsHorizontalAxis; - else + else if( m_aAxisProperties.m_bSwapXAndY && !m_aAxisProperties.m_bComplexCategories ) return bIsVerticalAxis; + else + return false; } namespace{ @@ -1677,7 +1680,11 @@ 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 ) + { + aComplexProps.fRotationAngleDegree = 90.0; + } } AxisLabelProperties& rAxisLabelProperties = m_aAxisProperties.m_bComplexCategories ? aComplexProps : m_aAxisLabelProperties; while (!createTextShapes(m_xTextTarget, *apTickIter, rAxisLabelProperties, diff --git a/sw/qa/extras/layout/data/tdf126244.docx b/sw/qa/extras/layout/data/tdf126244.docx new file mode 100644 index 000000000000..cf3b0d14a76c Binary files /dev/null and b/sw/qa/extras/layout/data/tdf126244.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 84728d8e2254..2f69230849e1 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2295,6 +2295,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122800) // This failed, if the textarray length of the first axis label not 22. } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf126244) +{ + SwDoc* pDoc = createDoc("tdf126244.docx"); + 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 vertical category axis labels orientation. The first level orientation should be horizontal. + assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[1]", "orientation", + "0"); + // Test the second level of vertical category axis labels orientation. The second level orientation should be vertical. + assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[5]", "orientation", + "900"); + // Test the third level of vertical category axis labels orientation. The third level orientation should be vertical. + assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[7]", "orientation", + "900"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796) { SwDoc* pDoc = createDoc("tdf124796.odt"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits