diff options
author | Tünde Tóth <tundeth@gmail.com> | 2020-07-17 11:37:31 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-07-22 11:08:59 +0200 |
commit | b877b9bc894892e61f0d6311729f7b01139923d6 (patch) | |
tree | 2a5500eb2fbed8d07061cabc45fe826c7f71d995 /chart2 | |
parent | 084ac2c5a2a6a3d932113dd629dde7b08c96f7ab (diff) |
chart2: clean-up redundant ShapeFactory::createText()
It's needless since commit 9eb614f8d2d9cc983c51bcdde211ee0c59c3a96c
(tdf#134659 chart2: use centered label alignment at text break).
Change-Id: I8607cf1c85e13152bab2543a7970a77f9c72db6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98946
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 33 | ||||
-rw-r--r-- | chart2/source/view/inc/ShapeFactory.hxx | 36 | ||||
-rw-r--r-- | chart2/source/view/main/ShapeFactory.cxx | 104 |
3 files changed, 2 insertions, 171 deletions
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index bbc1788ec148..dbb8dbd8fbd4 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -613,40 +613,11 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re aFormattedLabels[i] = aCustomLabels[i]; } - // center the text - sal_uInt32 nProperties = pPropNames->getLength(); - pPropNames->realloc( nProperties + 1 ); - pPropValues->realloc( nProperties + 1 ); - (*pPropNames)[ nProperties ] = UNO_NAME_EDIT_PARA_ADJUST; - (*pPropValues)[ nProperties ] <<= style::ParagraphAdjust_CENTER; - // create text shape xTextShape = ShapeFactory::getOrCreateShapeFactory( m_xShapeFactory )-> createText( xTarget_, aFormattedLabels, *pPropNames, *pPropValues, ShapeFactory::makeTransformation( aScreenPosition2D ) ); } - else if( bMultiLineLabel ) - { - // prepare properties for each paragraph - // we want to have the value and percent value centered respect - // with the category name - Sequence< tNameSequence > aParaPropNames(3); - aParaPropNames[1].realloc(1); - aParaPropNames[1][0] = "ParaAdjust"; - aParaPropNames[2].realloc(1); - aParaPropNames[2][0] = "ParaAdjust"; - - Sequence< tAnySequence > aParaPropValues(3); - aParaPropValues[1].realloc(1); - aParaPropValues[1][0] <<= style::ParagraphAdjust_CENTER; - aParaPropValues[2].realloc(1); - aParaPropValues[2][0] <<= style::ParagraphAdjust_CENTER; - - //create text shape - xTextShape = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)-> - createText( xTarget_, aTextList, aParaPropNames, aParaPropValues - , *pPropNames, *pPropValues, ShapeFactory::makeTransformation( aScreenPosition2D ) ); - } else { // join text list elements @@ -665,8 +636,8 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re //create text shape xTextShape = ShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)-> - createText( xTarget_, aText.makeStringAndClear() - , *pPropNames, *pPropValues, ShapeFactory::makeTransformation( aScreenPosition2D ) ); + createText( xTarget_, aText.makeStringAndClear(), *pPropNames, *pPropValues, + ShapeFactory::makeTransformation( aScreenPosition2D ) ); } if( !xTextShape.is() ) diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx index 7a698e4b9d87..83b8d8294d16 100644 --- a/chart2/source/view/inc/ShapeFactory.hxx +++ b/chart2/source/view/inc/ShapeFactory.hxx @@ -198,42 +198,6 @@ public: , const css::uno::Any& rATransformation ); - /** This method creates a text shape made up by a set of paragraphs. - * For each paragraph the related text style is passed to the method. - * - * @param xTarget - * where to append the new created text shape. - * - * @param rTextParagraphs - * the set of paragraphs which made up the text shape. - * - * @param rParaPropNames - * a collection of lists of text property names: - * there must be a list of text property names for each paragraph. - * - * @param rParaPropValues - * a collection of lists of text property values: - * there must be a list of text property values for each paragraph. - * - * @param rPropNames - * a list of text property names to be applied to the whole text shape. - * - * @param rPropValues - * a list of text property values to be applied to the whole text shape. - * - * @param rATransformation - * a transformation to be applied to the text shape as final step. - * - */ - css::uno::Reference< css::drawing::XShape > - createText( const css::uno::Reference< css::drawing::XShapes >& xTarget - , const css::uno::Sequence< OUString >& rTextParagraphs - , const css::uno::Sequence< tNameSequence >& rParaPropNames - , const css::uno::Sequence< tAnySequence >& rParaPropValues - , const tNameSequence& rPropNames - , const tAnySequence& rPropValues - , const css::uno::Any& rATransformation ); - css::uno::Reference< css::drawing::XShape > createText(const css::uno::Reference< css::drawing::XShapes >& xTarget , css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& xFormattedString diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index b2e19781c8ef..674d42ddbacc 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -2171,110 +2171,6 @@ uno::Reference< drawing::XShape > } uno::Reference< drawing::XShape > - ShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget - , const uno::Sequence< OUString >& rTextParagraphs - , const uno::Sequence< tNameSequence >& rParaPropNames - , const uno::Sequence< tAnySequence >& rParaPropValues - , const tNameSequence& rPropNames - , const tAnySequence& rPropValues - , const uno::Any& rATransformation ) -{ - if( !xTarget.is() ) - return nullptr; - - if( !rTextParagraphs.hasElements() ) - return nullptr; - - sal_Int32 nNumberOfParagraphs = rTextParagraphs.getLength(); - - if( rParaPropNames.getLength() != nNumberOfParagraphs ) - return nullptr; - - if( rParaPropValues.getLength() != nNumberOfParagraphs ) - return nullptr; - - bool bNotEmpty = false; - for( sal_Int32 nN = 0; nN < nNumberOfParagraphs; ++nN ) - { - if( !rTextParagraphs[nN].isEmpty() ) - { - bNotEmpty = true; - break; - } - } - if( !bNotEmpty ) - return nullptr; - - //create shape and add to page - uno::Reference< drawing::XShape > xShape( - m_xShapeFactory->createInstance( - "com.sun.star.drawing.TextShape" ), uno::UNO_QUERY ); - xTarget->add(xShape); - - //set paragraph properties - bNotEmpty = false; - Reference< text::XText > xText( xShape, uno::UNO_QUERY ); - if( xText.is() ) - { - // the first cursor is used for appending the next paragraph, - // after a new string has been inserted the cursor is moved at the end - // of the inserted string - // the second cursor is used for selecting the paragraph and apply the - // passed text properties - Reference< text::XTextCursor > xInsertCursor = xText->createTextCursor(); - Reference< text::XTextCursor > xSelectionCursor = xText->createTextCursor(); - if( xInsertCursor.is() && xSelectionCursor.is() ) - { - uno::Reference< beans::XPropertySet > xSelectionProp( xSelectionCursor, uno::UNO_QUERY ); - if( xSelectionProp.is() ) - { - for( sal_Int32 nN = 0; nN < nNumberOfParagraphs; ++nN ) - { - if( !rTextParagraphs[nN].isEmpty() ) - { - xInsertCursor->gotoEnd(false); - if( bNotEmpty ) - { - xText->insertString( xInsertCursor, "\n", false ); - } - xSelectionCursor->gotoEnd(false); - xText->insertString( xInsertCursor, rTextParagraphs[nN], false ); - bNotEmpty = true; - xSelectionCursor->gotoEnd(true); // select current paragraph - PropertyMapper::setMultiProperties( rParaPropNames[nN], rParaPropValues[nN], xSelectionProp ); - } - } - } - } - } - - if( !bNotEmpty ) - return nullptr; - - uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY ); - if( xProp.is() ) - { - //set whole text shape properties - PropertyMapper::setMultiProperties( rPropNames, rPropValues, xProp ); - - if (rATransformation.hasValue()) - { - //set position matrix - //the matrix needs to be set at the end behind autogrow and such position influencing properties - try - { - xProp->setPropertyValue( "Transformation", rATransformation ); - } - catch( const uno::Exception& ) - { - TOOLS_WARN_EXCEPTION("chart2", "" ); - } - } - } - return xShape; -} - -uno::Reference< drawing::XShape > ShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget , uno::Sequence< uno::Reference< chart2::XFormattedString > >& xFormattedString , const tNameSequence& rPropNames |