tdf127448 Chart: Avoid distortion of charts with multilevel axis labels
and too long tickmark lines.
Note: larger chart distortion is a regression
from commit: 4b3a648a2f
(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@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
This commit is contained in:
committed by
László Németh
parent
9670abc430
commit
55136439e7
@@ -1619,6 +1619,10 @@ void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabel
|
|||||||
if( nTextLevel>0 )
|
if( nTextLevel>0 )
|
||||||
{
|
{
|
||||||
lcl_shiftLabels(*apTickIter, aCummulatedLabelsDistance);
|
lcl_shiftLabels(*apTickIter, aCummulatedLabelsDistance);
|
||||||
|
//multilevel labels: 0 or 90 by default
|
||||||
|
if( m_aAxisProperties.m_bSwapXAndY )
|
||||||
|
fRotationAngleDegree = 90.0;
|
||||||
|
else
|
||||||
fRotationAngleDegree = 0.0;
|
fRotationAngleDegree = 0.0;
|
||||||
}
|
}
|
||||||
aCummulatedLabelsDistance += lcl_getLabelsDistance(
|
aCummulatedLabelsDistance += lcl_getLabelsDistance(
|
||||||
@@ -1682,6 +1686,7 @@ void VCartesianAxis::createLabels()
|
|||||||
aComplexProps.bOverlapAllowed = aComplexProps.fRotationAngleDegree != 0.0;
|
aComplexProps.bOverlapAllowed = aComplexProps.fRotationAngleDegree != 0.0;
|
||||||
if( nTextLevel > 0 )
|
if( nTextLevel > 0 )
|
||||||
{
|
{
|
||||||
|
//multilevel labels: 0 or 90 by default
|
||||||
if( m_aAxisProperties.m_bSwapXAndY )
|
if( m_aAxisProperties.m_bSwapXAndY )
|
||||||
aComplexProps.fRotationAngleDegree = 90.0;
|
aComplexProps.fRotationAngleDegree = 90.0;
|
||||||
else
|
else
|
||||||
@@ -1769,7 +1774,7 @@ void VCartesianAxis::updatePositions()
|
|||||||
double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
|
double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
|
||||||
if( nDepth > 0 )
|
if( nDepth > 0 )
|
||||||
{
|
{
|
||||||
/* Multi-level Labels: default to 0 or 90 */
|
//multilevel labels: 0 or 90 by default
|
||||||
if( pTickFactory2D->isHorizontalAxis() )
|
if( pTickFactory2D->isHorizontalAxis() )
|
||||||
fRotationAngleDegree = 0.0;
|
fRotationAngleDegree = 0.0;
|
||||||
else
|
else
|
||||||
@@ -1863,6 +1868,14 @@ void VCartesianAxis::createShapes()
|
|||||||
if( apTickIter )
|
if( apTickIter )
|
||||||
{
|
{
|
||||||
double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
|
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(
|
B2DVector aLabelsDistance(lcl_getLabelsDistance(
|
||||||
*apTickIter, pTickFactory2D->getDistanceAxisTickToText(m_aAxisProperties),
|
*apTickIter, pTickFactory2D->getDistanceAxisTickToText(m_aAxisProperties),
|
||||||
fRotationAngleDegree));
|
fRotationAngleDegree));
|
||||||
|
BIN
sw/qa/extras/layout/data/horizontal_multilevel.odt
Normal file
BIN
sw/qa/extras/layout/data/horizontal_multilevel.odt
Normal file
Binary file not shown.
@@ -2341,6 +2341,21 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127304)
|
|||||||
"0");
|
"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)
|
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796)
|
||||||
{
|
{
|
||||||
SwDoc* pDoc = createDoc("tdf124796.odt");
|
SwDoc* pDoc = createDoc("tdf124796.odt");
|
||||||
|
Reference in New Issue
Block a user