diff options
-rw-r--r-- | chart2/source/view/axes/VCartesianAxis.cxx | 17 | ||||
-rw-r--r-- | sw/qa/extras/layout/data/horizontal_multilevel.odt | bin | 0 -> 13425 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 15 |
3 files changed, 30 insertions, 2 deletions
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 4874f7f9575f..ce795abb17d0 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -1619,7 +1619,11 @@ void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabel if( nTextLevel>0 ) { lcl_shiftLabels(*apTickIter, aCummulatedLabelsDistance); - fRotationAngleDegree = 0.0; + //multilevel labels: 0 or 90 by default + if( m_aAxisProperties.m_bSwapXAndY ) + fRotationAngleDegree = 90.0; + else + fRotationAngleDegree = 0.0; } aCummulatedLabelsDistance += lcl_getLabelsDistance( *apTickIter, pTickFactory2D->getDistanceAxisTickToText(m_aAxisProperties), @@ -1682,6 +1686,7 @@ void VCartesianAxis::createLabels() aComplexProps.bOverlapAllowed = aComplexProps.fRotationAngleDegree != 0.0; if( nTextLevel > 0 ) { + //multilevel labels: 0 or 90 by default if( m_aAxisProperties.m_bSwapXAndY ) aComplexProps.fRotationAngleDegree = 90.0; else @@ -1769,7 +1774,7 @@ void VCartesianAxis::updatePositions() double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree; if( nDepth > 0 ) { - /* Multi-level Labels: default to 0 or 90 */ + //multilevel labels: 0 or 90 by default if( pTickFactory2D->isHorizontalAxis() ) fRotationAngleDegree = 0.0; else @@ -1863,6 +1868,14 @@ void VCartesianAxis::createShapes() if( apTickIter ) { double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree; + if( nTextLevel > 0 ) + { + //Multi-level Labels: default to 0 or 90 + if( m_aAxisProperties.m_bSwapXAndY ) + fRotationAngleDegree = 90.0; + else + fRotationAngleDegree = 0.0; + } B2DVector aLabelsDistance(lcl_getLabelsDistance( *apTickIter, pTickFactory2D->getDistanceAxisTickToText(m_aAxisProperties), fRotationAngleDegree)); diff --git a/sw/qa/extras/layout/data/horizontal_multilevel.odt b/sw/qa/extras/layout/data/horizontal_multilevel.odt Binary files differnew file mode 100644 index 000000000000..9bd12586500a --- /dev/null +++ b/sw/qa/extras/layout/data/horizontal_multilevel.odt diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 6fd861d68dc8..43f2381ada5b 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2341,6 +2341,21 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127304) "0"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testHorizontal_multilevel) +{ + SwDoc* pDoc = createDoc("horizontal_multilevel.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 Y position of horizontal category axis label. + assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/textarray[7]", "y", + "7945"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796) { SwDoc* pDoc = createDoc("tdf124796.odt"); |