From 5d1ad167294878789e644452f23ef883af93fe87 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 9 May 2013 11:12:06 +0200 Subject: fdo#46808 Convert chart2::FormattedString service to new style API CHANGE: dropped the following services from the new unified interface because the current service does not implement them. service ::com::sun::star::style::CharacterProperties; [optional] service ::com::sun::star::style::CharacterPropertiesAsian; [optional] service ::com::sun::star::style::CharacterPropertiesComplex; Change-Id: I7cb6a5d4e998975b1272f4f4da03feea30cd30b6 --- chart2/source/tools/TitleHelper.cxx | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'chart2/source/tools/TitleHelper.cxx') diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx index c5b74b54fcd9..a8a0b0074990 100644 --- a/chart2/source/tools/TitleHelper.cxx +++ b/chart2/source/tools/TitleHelper.cxx @@ -22,6 +22,7 @@ #include "macros.hxx" #include "AxisHelper.hxx" #include "DiagramHelper.hxx" +#include #include #include @@ -300,30 +301,23 @@ void TitleHelper::setCompleteString( const OUString& rNewText } else { - uno::Reference< uno::XInterface > xI( - xContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.chart2.FormattedString", xContext ) ); - uno::Reference< XFormattedString > xFormattedString( xI, uno::UNO_QUERY ); + uno::Reference< chart2::XFormattedString2 > xFormattedString = + chart2::FormattedString::create( xContext ); - if(xFormattedString.is()) + xFormattedString->setString( aNewText ); + aNewStringList[0].set( xFormattedString ); + if( pDefaultCharHeight != 0 ) { - xFormattedString->setString( aNewText ); - aNewStringList[0].set( xFormattedString ); - if( pDefaultCharHeight != 0 ) + try { - try - { - uno::Reference< beans::XPropertySet > xProp( xFormattedString, uno::UNO_QUERY_THROW ); - - uno::Any aFontSize( uno::makeAny( *pDefaultCharHeight )); - xProp->setPropertyValue( "CharHeight", aFontSize ); - xProp->setPropertyValue( "CharHeightAsian", aFontSize ); - xProp->setPropertyValue( "CharHeightComplex", aFontSize ); - } - catch( const uno::Exception & ex ) - { - ASSERT_EXCEPTION( ex ); - } + uno::Any aFontSize( uno::makeAny( *pDefaultCharHeight )); + xFormattedString->setPropertyValue( "CharHeight", aFontSize ); + xFormattedString->setPropertyValue( "CharHeightAsian", aFontSize ); + xFormattedString->setPropertyValue( "CharHeightComplex", aFontSize ); + } + catch( const uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); } } } -- cgit