chart2/qa/extras/chart2import.cxx | 155 ++++++++++++++++++-- chart2/qa/extras/data/odp/BarChartVeryLongLabel.odp |binary chart2/source/view/axes/Tickmarks.cxx | 5 chart2/source/view/axes/Tickmarks.hxx | 11 + chart2/source/view/axes/VCartesianAxis.cxx | 43 ++++- chart2/source/view/main/ChartView.cxx | 12 + sw/qa/extras/layout/layout2.cxx | 2 7 files changed, 198 insertions(+), 30 deletions(-)
New commits: commit ca22f1ce703c1d03fc1b1ed1f5ac1fc903b09e6f Author: Tomaž Vajngerl <[email protected]> AuthorDate: Fri Feb 11 19:41:37 2022 +0900 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Sat Feb 12 06:32:02 2022 +0100 chart2: Break labels text and limit the size to the axis size Previously a long label wouldn't be broken into multiple lines and be limited to the axis size if the chart sizing was automatic. This would cause the label to distort the whole chart and make the chart area very narrow. With this change the label text is limited to the axis width and gets broken into multiple lines if this is necessary. BarChartVeryLongLabel.odp provides a test document which includes automatic size and fixed size chart are. We make sure the area that the label text occupies is not larger than the chart wall size. Change-Id: If58bfa3e51ab68f720f22df5416ae305401bcd34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129814 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 76fa05a57028..0c129d26978b 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -132,6 +132,7 @@ public: void testTdf48041(); void testTdf121205(); void testFixedSizeBarChartVeryLongLabel(); + void testAutomaticSizeBarChartVeryLongLabel(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); @@ -215,6 +216,7 @@ public: CPPUNIT_TEST(testTdf48041); CPPUNIT_TEST(testTdf121205); CPPUNIT_TEST(testFixedSizeBarChartVeryLongLabel); + CPPUNIT_TEST(testAutomaticSizeBarChartVeryLongLabel); CPPUNIT_TEST_SUITE_END(); }; @@ -2101,8 +2103,9 @@ void Chart2ImportTest::testFixedSizeBarChartVeryLongLabel() // case the best course of action is to just crop the label text. This // test checks that the rendered text is actually cropped. - load(u"/chart2/qa/extras/data/odp/", "FixedSizeBarChartVeryLongLabel.odp"); + load(u"/chart2/qa/extras/data/odp/", "BarChartVeryLongLabel.odp"); + // Select shape 0 which has fixed size chart Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY); CPPUNIT_ASSERT(xChartDoc.is()); @@ -2151,7 +2154,86 @@ void Chart2ImportTest::testFixedSizeBarChartVeryLongLabel() // Check text is actually cropped uno::Reference<text::XTextRange> xLabel(xIndexAccess->getByIndex(0), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("Very very very very..."), xLabel->getString()); + CPPUNIT_ASSERT_EQUAL(OUString("Very very very very very very..."), xLabel->getString()); + + uno::Reference<drawing::XShape> xChartWall = getShapeByName(xShapes, "CID/DiagramWall="); + CPPUNIT_ASSERT(xChartWall.is()); + + // The text shape width should be smaller than the chart wall + CPPUNIT_ASSERT_EQUAL(sal_Int32(5085), xChartWall->getSize().Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(7113), xChartWall->getSize().Height); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(4870), xXAxis->getSize().Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(398), xXAxis->getSize().Height); +} + +void Chart2ImportTest::testAutomaticSizeBarChartVeryLongLabel() +{ + // Bar chart area size is automatic so we expect the label to be broken + // into multiple lines. + + load(u"/chart2/qa/extras/data/odp/", "BarChartVeryLongLabel.odp"); + + // Select shape 1, which has an automatic sized chart + Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xChartDoc.is()); + + Reference<chart2::XAxis> xHAxis = getAxisFromDoc(xChartDoc, 0, 0, 0); + CPPUNIT_ASSERT(xHAxis.is()); + + chart2::ScaleData aScaleData = xHAxis->getScaleData(); + CPPUNIT_ASSERT(aScaleData.Categories.is()); + + Reference<chart2::data::XLabeledDataSequence> xLabeledDataSequence = aScaleData.Categories; + CPPUNIT_ASSERT(xLabeledDataSequence.is()); + + Reference<chart2::data::XDataSequence> xDataSequence = xLabeledDataSequence->getValues(); + CPPUNIT_ASSERT(xDataSequence.is()); + + Reference<chart2::data::XTextualDataSequence> xTextualDataSequence(xDataSequence, uno::UNO_QUERY); + CPPUNIT_ASSERT(xTextualDataSequence.is()); + + std::vector<OUString> aCategories; + const Sequence<OUString> aTextData(xTextualDataSequence->getTextualData()); + ::std::copy(aTextData.begin(), aTextData.end(), + ::std::back_inserter(aCategories)); + + // Check that we have a very very long label text + CPPUNIT_ASSERT_EQUAL(OUString("Very very very very very very very very very very very loooooooooooong label"), aCategories[0]); + + // Check visible text + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); + uno::Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xShapes.is()); + + uno::Reference<drawing::XShape> xXAxis = getShapeByName(xShapes, "CID/D=0:CS=0:Axis=0,0", + // Axis occurs twice in chart xshape representation so need to get the one related to labels + [](const uno::Reference<drawing::XShape>& rXShape) -> bool + { + uno::Reference<drawing::XShapes> xAxisShapes(rXShape, uno::UNO_QUERY); + CPPUNIT_ASSERT(xAxisShapes.is()); + uno::Reference<drawing::XShape> xChildShape(xAxisShapes->getByIndex(0), uno::UNO_QUERY); + uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor(xChildShape, uno::UNO_QUERY_THROW); + return (xShapeDescriptor->getShapeType() == "com.sun.star.drawing.TextShape"); + }); + CPPUNIT_ASSERT(xXAxis.is()); + + uno::Reference<container::XIndexAccess> xIndexAccess(xXAxis, UNO_QUERY_THROW); + + // Check text is unmodified + uno::Reference<text::XTextRange> xLabel(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Very very very very very very very very very very very loooooooooooong label"), xLabel->getString()); + + uno::Reference<drawing::XShape> xChartWall = getShapeByName(xShapes, "CID/DiagramWall="); + CPPUNIT_ASSERT(xChartWall.is()); + + // The text shape width should be smaller than the chart wall + CPPUNIT_ASSERT_EQUAL(sal_Int32(5761), xChartWall->getSize().Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(7200), xChartWall->getSize().Height); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(5320), xXAxis->getSize().Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1192), xXAxis->getSize().Height); } CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); diff --git a/chart2/qa/extras/data/odp/BarChartVeryLongLabel.odp b/chart2/qa/extras/data/odp/BarChartVeryLongLabel.odp new file mode 100644 index 000000000000..c627af79e4d5 Binary files /dev/null and b/chart2/qa/extras/data/odp/BarChartVeryLongLabel.odp differ diff --git a/chart2/qa/extras/data/odp/FixedSizeBarChartVeryLongLabel.odp b/chart2/qa/extras/data/odp/FixedSizeBarChartVeryLongLabel.odp deleted file mode 100644 index 18869b638d1e..000000000000 Binary files a/chart2/qa/extras/data/odp/FixedSizeBarChartVeryLongLabel.odp and /dev/null differ diff --git a/chart2/source/view/axes/Tickmarks.cxx b/chart2/source/view/axes/Tickmarks.cxx index d10583c1b77d..01e4a7216ac1 100644 --- a/chart2/source/view/axes/Tickmarks.cxx +++ b/chart2/source/view/axes/Tickmarks.cxx @@ -203,11 +203,6 @@ sal_Int32 TickFactory2D::getTickScreenDistance( TickIter& rIter ) return pFirstTickInfo->getScreenDistanceBetweenTicks( *pSecondTickInfo ); } -const B2DVector & TickFactory2D::getXaxisStartPos() const -{ - return m_aAxisStartScreenPosition2D; -} - B2DVector TickFactory2D::getTickScreenPosition2D( double fScaledLogicTickValue ) const { B2DVector aRet(m_aAxisStartScreenPosition2D); diff --git a/chart2/source/view/axes/Tickmarks.hxx b/chart2/source/view/axes/Tickmarks.hxx index c712f6542b39..bb33be50421c 100644 --- a/chart2/source/view/axes/Tickmarks.hxx +++ b/chart2/source/view/axes/Tickmarks.hxx @@ -132,7 +132,16 @@ public: bool isHorizontalAxis() const; bool isVerticalAxis() const; - const ::basegfx::B2DVector & getXaxisStartPos() const; + + const ::basegfx::B2DVector & getXaxisStartPos() const + { + return m_aAxisStartScreenPosition2D; + } + + const ::basegfx::B2DVector & getXaxisEndPos() const + { + return m_aAxisEndScreenPosition2D; + } private: ::basegfx::B2DVector getTickScreenPosition2D( double fScaledLogicTickValue ) const; diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index d42c811ae092..e6b52f0eb0c2 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -721,10 +721,13 @@ bool VCartesianAxis::createTextShapes( } } - if (!isBreakOfLabelsAllowed(rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis) && + bool bIsBreakOfLabelsAllowed = isBreakOfLabelsAllowed( rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis ); + if (!bIsBreakOfLabelsAllowed && !isAutoStaggeringOfLabelsAllowed(rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis) && !rAxisLabelProperties.isStaggered()) + { return createTextShapesSimple(xTarget, rTickIter, rAxisLabelProperties, pTickFactory); + } FixedNumberFormatter aFixedNumberFormatter( m_xNumberFormatsSupplier, rAxisLabelProperties.m_nNumberFormatKey ); @@ -733,9 +736,16 @@ bool VCartesianAxis::createTextShapes( B2DVector aTextToTickDistance = pTickFactory->getDistanceAxisTickToText(m_aAxisProperties, true); sal_Int32 nLimitedSpaceForText = -1; - if( isBreakOfLabelsAllowed( rAxisLabelProperties, bIsHorizontalAxis, bIsVerticalAxis ) ) + if (bIsBreakOfLabelsAllowed) { - nLimitedSpaceForText = nScreenDistanceBetweenTicks; + if (!m_aAxisProperties.m_bLimitSpaceForLabels) + { + basegfx::B2DVector nDeltaVector = pTickFactory->getXaxisEndPos() - pTickFactory->getXaxisStartPos(); + nLimitedSpaceForText = nDeltaVector.getX(); + } + if (nScreenDistanceBetweenTicks > 0) + nLimitedSpaceForText = nScreenDistanceBetweenTicks; + if( bIsStaggered ) nLimitedSpaceForText *= 2; @@ -874,9 +884,11 @@ bool VCartesianAxis::createTextShapes( recordMaximumTextSize( *pTickInfo->xTextShape, rAxisLabelProperties.m_fRotationAngleDegree ); // Label has multiple lines and the words are broken - if( nLimitedSpaceForText>0 && !rAxisLabelProperties.m_bOverlapAllowed + if (nLimitedSpaceForText > 0 + && !rAxisLabelProperties.m_bOverlapAllowed && rAxisLabelProperties.m_fRotationAngleDegree == 0.0 - && lcl_hasWordBreak( pTickInfo->xTextShape ) ) + && nTick > 0 + && lcl_hasWordBreak(pTickInfo->xTextShape)) { // Label has multiple lines and belongs to a complex category // axis. Rotate 90 degrees to try to avoid overlaps. diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 56955f4c8f8b..1d8fce7bed9a 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1489,7 +1489,9 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D || aConsumedOuterRect.getMaxX() < aAvailableOuterRect.getMaxX() || aConsumedOuterRect.getMinY() > aAvailableOuterRect.getMinY() || aConsumedOuterRect.getMinY() < aAvailableOuterRect.getMaxY() ) + { bLessSpaceConsumedThanExpected = true; + } } if (bLessSpaceConsumedThanExpected && !rParam.mbUseFixedInnerSize) @@ -1497,6 +1499,16 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D aVDiagram.adjustInnerSize( aConsumedOuterRect ); pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix( createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) )); + + // Need to re-adjust again if the labels have changed height because of + // text can break. Ideally this shouldn't be needed, but the chart height + // isn't readjusted otherwise. + pVCooSys->createAxesLabels(); + aConsumedOuterRect = ShapeFactory::getRectangleOfShape(*xBoundingShape); + aVDiagram.adjustInnerSize(aConsumedOuterRect); + pVCooSys->setTransformationSceneToScreen(B3DHomMatrixToHomogenMatrix( + createTransformationSceneToScreen(aVDiagram.getCurrentRectangle()))); + } pVCooSys->updatePositions();//todo: logically this belongs to the condition above, but it seems also to be necessary to give the axes group shapes the right bounding rects for hit test - probably caused by bug i106183 -> check again if fixed } diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index ee66a69d8632..e5e958f9ffe7 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -885,7 +885,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testHorizontal_multilevel) sal_Int32 nYposition = getXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/textarray[7]", "y") .toInt32(); - CPPUNIT_ASSERT_DOUBLES_EQUAL(7945, nYposition, 20); + CPPUNIT_ASSERT_DOUBLES_EQUAL(8057, nYposition, 20); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138194) commit 92da88582ae8d5ddbd786f9936e1b2b46eaddf2c Author: Tomaž Vajngerl <[email protected]> AuthorDate: Fri Feb 11 14:05:37 2022 +0900 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Sat Feb 12 06:31:49 2022 +0100 chart2: crop x-axis label if it's too long on fixed size charts If the label text is too long on a fixed size chart area, crop it as we can't resize the chart area to accomodate for text breaking into multiple lines. The algorithm to determine if cropping is needed has assumed that we need this in case the x-axis label is vertical, so there was no check to actually make sure the text is horizontal or vertical and in case it was horizontal, it has taken height into account and not width, so nothing got cropped. Change-Id: I8e73027fc51722280418c9e0be34ce487c41171e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129813 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 0b4f6d89303e..76fa05a57028 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -123,20 +123,15 @@ public: void testTdf90510(); // Pie chart label placement settings(XLS) void testTdf109858(); // Pie chart label placement settings(XLSX) void testTdf130105(); - void testTdf111173(); void testTdf122226(); - void testInternalDataProvider(); - void testTdf115107(); // import complex data point labels void testTdf115107_2(); // import complex data point labels in cobo charts with multiple data series - void testTdf116163(); - void testTdf48041(); - void testTdf121205(); + void testFixedSizeBarChartVeryLongLabel(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); @@ -213,17 +208,13 @@ public: CPPUNIT_TEST(testTdf130105); CPPUNIT_TEST(testTdf111173); CPPUNIT_TEST(testTdf122226); - CPPUNIT_TEST(testInternalDataProvider); - CPPUNIT_TEST(testTdf115107); CPPUNIT_TEST(testTdf115107_2); - CPPUNIT_TEST(testTdf116163); - CPPUNIT_TEST(testTdf48041); - CPPUNIT_TEST(testTdf121205); + CPPUNIT_TEST(testFixedSizeBarChartVeryLongLabel); CPPUNIT_TEST_SUITE_END(); }; @@ -2103,6 +2094,66 @@ void Chart2ImportTest::testTdf121205() CPPUNIT_ASSERT_EQUAL(OUString("Firstline\nSecondline\nThirdline"), aTitle); } +void Chart2ImportTest::testFixedSizeBarChartVeryLongLabel() +{ + // Bar chart area size is fixed (not automatic) so we can't resize + // the chart area to let the label break into multiple lines. In this + // case the best course of action is to just crop the label text. This + // test checks that the rendered text is actually cropped. + + load(u"/chart2/qa/extras/data/odp/", "FixedSizeBarChartVeryLongLabel.odp"); + + Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xChartDoc.is()); + + Reference<chart2::XAxis> xHAxis = getAxisFromDoc(xChartDoc, 0, 0, 0); + CPPUNIT_ASSERT(xHAxis.is()); + + chart2::ScaleData aScaleData = xHAxis->getScaleData(); + CPPUNIT_ASSERT(aScaleData.Categories.is()); + + Reference<chart2::data::XLabeledDataSequence> xLabeledDataSequence = aScaleData.Categories; + CPPUNIT_ASSERT(xLabeledDataSequence.is()); + + Reference<chart2::data::XDataSequence> xDataSequence = xLabeledDataSequence->getValues(); + CPPUNIT_ASSERT(xDataSequence.is()); + + Reference<chart2::data::XTextualDataSequence> xTextualDataSequence(xDataSequence, uno::UNO_QUERY); + CPPUNIT_ASSERT(xTextualDataSequence.is()); + + std::vector<OUString> aCategories; + const Sequence<OUString> aTextData(xTextualDataSequence->getTextualData()); + ::std::copy(aTextData.begin(), aTextData.end(), + ::std::back_inserter(aCategories)); + + // Check that we have a very very long label text + CPPUNIT_ASSERT_EQUAL(OUString("Very very very very very very very very very very very loooooooooooong label"), aCategories[0]); + + // Check visible text + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage(); + uno::Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xShapes.is()); + + uno::Reference<drawing::XShape> xXAxis = getShapeByName(xShapes, "CID/D=0:CS=0:Axis=0,0", + // Axis occurs twice in chart xshape representation so need to get the one related to labels + [](const uno::Reference<drawing::XShape>& rXShape) -> bool + { + uno::Reference<drawing::XShapes> xAxisShapes(rXShape, uno::UNO_QUERY); + CPPUNIT_ASSERT(xAxisShapes.is()); + uno::Reference<drawing::XShape> xChildShape(xAxisShapes->getByIndex(0), uno::UNO_QUERY); + uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor(xChildShape, uno::UNO_QUERY_THROW); + return (xShapeDescriptor->getShapeType() == "com.sun.star.drawing.TextShape"); + }); + CPPUNIT_ASSERT(xXAxis.is()); + + uno::Reference<container::XIndexAccess> xIndexAccess(xXAxis, UNO_QUERY_THROW); + + // Check text is actually cropped + uno::Reference<text::XTextRange> xLabel(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Very very very very..."), xLabel->getString()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/odp/FixedSizeBarChartVeryLongLabel.odp b/chart2/qa/extras/data/odp/FixedSizeBarChartVeryLongLabel.odp new file mode 100644 index 000000000000..18869b638d1e Binary files /dev/null and b/chart2/qa/extras/data/odp/FixedSizeBarChartVeryLongLabel.odp differ diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index cb053a7ce986..d42c811ae092 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -81,15 +81,20 @@ static void lcl_ResizeTextShapeToFitAvailableSpace( SvxShapeText& rShape2DText, const tAnySequence& rPropValues, const bool bIsHorizontalAxis ) { - const sal_Int32 nFullSize = bIsHorizontalAxis ? rAxisLabelProperties.m_aFontReferenceSize.Height : rAxisLabelProperties.m_aFontReferenceSize.Width; + bool bTextHorizontal = rAxisLabelProperties.m_fRotationAngleDegree != 0.0; + bool bIsDirectionVertical = bIsHorizontalAxis && bTextHorizontal; + const sal_Int32 nFullSize = bIsDirectionVertical ? rAxisLabelProperties.m_aFontReferenceSize.Height : rAxisLabelProperties.m_aFontReferenceSize.Width; if( !nFullSize || !rLabel.getLength() ) return; - sal_Int32 nMaxLabelsSize = bIsHorizontalAxis ? rAxisLabelProperties.m_aMaximumSpaceForLabels.Height : rAxisLabelProperties.m_aMaximumSpaceForLabels.Width; const sal_Int32 nAvgCharWidth = rShape2DText.getSize().Width / rLabel.getLength(); - const sal_Int32 nTextSize = bIsHorizontalAxis ? ShapeFactory::getSizeAfterRotation(rShape2DText, rAxisLabelProperties.m_fRotationAngleDegree).Height : - ShapeFactory::getSizeAfterRotation(rShape2DText, rAxisLabelProperties.m_fRotationAngleDegree).Width; + + sal_Int32 nMaxLabelsSize = bIsDirectionVertical ? rAxisLabelProperties.m_aMaximumSpaceForLabels.Height : rAxisLabelProperties.m_aMaximumSpaceForLabels.Width; + + awt::Size aSizeAfterRotation = ShapeFactory::getSizeAfterRotation(rShape2DText, rAxisLabelProperties.m_fRotationAngleDegree); + + const sal_Int32 nTextSize = bIsDirectionVertical ? aSizeAfterRotation.Height : aSizeAfterRotation.Width; if( !nAvgCharWidth ) return; @@ -857,10 +862,12 @@ bool VCartesianAxis::createTextShapes( //create single label if(!pTickInfo->xTextShape.is()) + { pTickInfo->xTextShape = createSingleLabel( xTarget , aAnchorScreenPosition2D, aLabel , rAxisLabelProperties, m_aAxisProperties , aPropNames, aPropValues, bIsHorizontalAxis ); + } if(!pTickInfo->xTextShape.is()) continue; @@ -1836,12 +1843,12 @@ void VCartesianAxis::createShapes() if( !prepareShapeCreation() ) return; - std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure - TickFactory2D* pTickFactory2D = apTickFactory2D.get(); - //create line shapes if(m_nDimension==2) { + std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure + TickFactory2D* pTickFactory2D = apTickFactory2D.get(); + //create extra long ticks to separate complex categories (create them only there where the labels are) if( isComplexCategoryAxis() ) {
