From 9ed1dd01be8afa0961e388a79e9ff4c1235820c2 Mon Sep 17 00:00:00 2001 From: Marco Cecchetti Date: Sun, 19 Jul 2015 18:18:00 +0200 Subject: tdf#90839: support for wrapped text in data labels and for centered data value Now in a pie chart the text of a label can be wrapped, the wrapping is automatic and the maximum text width is fixed to almost half the pie radius. This feature is used to import correctly the relative text wrapping property provided by MSO. Moreover the data value and percent value of a label are now centered horizontally, respect with the label text. Conflicts: chart2/qa/extras/xshape/chart2xshape.cxx Change-Id: Ie10d6184365436f763cd9693a5bbefcfa9b3862b Reviewed-on: https://gerrit.libreoffice.org/17193 Tested-by: Jenkins Reviewed-by: Andras Timar --- .../itemsetwrapper/TextLabelItemConverter.cxx | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx') diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx index faee4a61d291..2731f709bbaf 100644 --- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx @@ -335,6 +335,36 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte } } break; + case SCHATTR_DATADESCR_WRAP_TEXT: + { + + try + { + bool bNew = static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue(); + bool bOld = false; + GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bOld; + if( mbDataSeries ) + { + Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY); + if( bOld!=bNew || + DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, "TextWordWrap", uno::makeAny( bOld ) ) ) + { + DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "TextWordWrap", uno::makeAny( bNew ) ); + bChanged = true; + } + } + else if( bOld!=bNew ) + { + GetPropertySet()->setPropertyValue( "TextWordWrap", uno::makeAny( bNew )); + bChanged = true; + } + } + catch( const uno::Exception& e ) + { + ASSERT_EXCEPTION( e ); + } + } + break; case SCHATTR_DATADESCR_PLACEMENT: { try @@ -544,6 +574,20 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r } } break; + case SCHATTR_DATADESCR_WRAP_TEXT: + { + bool bValue = false; + try + { + GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bValue; + rOutItemSet.Put( SfxBoolItem( nWhichId, bValue )); + } + catch( const uno::Exception& e ) + { + ASSERT_EXCEPTION( e ); + } + } + break; case SCHATTR_DATADESCR_PLACEMENT: { try -- cgit