[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - chart2/source sw/qa
Balazs Varga (via logerrit)
logerrit at kemper.freedesktop.org
Mon Sep 16 07:24:35 UTC 2019
chart2/source/view/axes/VCartesianAxis.cxx | 17 +++++++++++++++--
sw/qa/extras/layout/data/horizontal_multilevel.odt |binary
sw/qa/extras/layout/layout.cxx | 15 +++++++++++++++
3 files changed, 30 insertions(+), 2 deletions(-)
New commits:
commit 996d41f2fe6a9eaced42269d5eee9bcd8110dca3
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Thu Sep 5 16:43:23 2019 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Mon Sep 16 09:24:00 2019 +0200
tdf#127448 Chart: Avoid distortion of charts with multilevel axis labels
and too long tickmark lines.
Note: larger chart distortion is a regression
from commit: 4b3a648a2fd7d733674f95bb7f20670c57e99252
(tdf#127304 Chart: fix rotation of multilevel axis labels)
Change-Id: Idbcd40d93c21a685e9ad1e49eb8c088a20ecae15
Reviewed-on: https://gerrit.libreoffice.org/78662
Reviewed-by: László Németh <nemeth at numbertext.org>
Tested-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit 55136439e71b7adc62a46a3d3dc8de26d54d989d)
Reviewed-on: https://gerrit.libreoffice.org/78773
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index ad6b0845e00a..4b7f4df2f8ac 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -1584,7 +1584,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),
@@ -1648,6 +1652,7 @@ void VCartesianAxis::createLabels()
if( nTextLevel > 0 )
{
+ //multilevel labels: 0 or 90 by default
if( m_aAxisProperties.m_bSwapXAndY )
aComplexProps.fRotationAngleDegree = 90.0;
else
@@ -1735,7 +1740,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
@@ -1829,6 +1834,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
new file mode 100644
index 000000000000..9bd12586500a
Binary files /dev/null and b/sw/qa/extras/layout/data/horizontal_multilevel.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 8246de165dcc..e235cab6af45 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2427,6 +2427,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");
More information about the Libreoffice-commits
mailing list