diff options
Diffstat (limited to 'chart2/source/tools')
-rw-r--r-- | chart2/source/tools/FormattedStringHelper.cxx | 14 | ||||
-rw-r--r-- | chart2/source/tools/TitleHelper.cxx | 36 |
2 files changed, 21 insertions, 29 deletions
diff --git a/chart2/source/tools/FormattedStringHelper.cxx b/chart2/source/tools/FormattedStringHelper.cxx index 82ad2392bf69..f3a26442954c 100644 --- a/chart2/source/tools/FormattedStringHelper.cxx +++ b/chart2/source/tools/FormattedStringHelper.cxx @@ -21,6 +21,7 @@ #include "FormattedStringHelper.hxx" #include "macros.hxx" #include "PropertyHelper.hxx" +#include <com/sun/star/chart2/FormattedString.hpp> //............................................................................. namespace chart @@ -32,27 +33,24 @@ using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -Sequence< Reference< chart2::XFormattedString > > +Sequence< Reference< chart2::XFormattedString2 > > FormattedStringHelper::createFormattedStringSequence( const Reference< uno::XComponentContext > & xContext , const OUString & rString , const Reference< beans::XPropertySet > & xTextProperties ) throw() { - Reference< XFormattedString > xFormStr; + Reference< XFormattedString2 > xFormStr; try { if( xContext.is() ) { - xFormStr.set( - xContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.chart2.FormattedString", xContext ), - uno::UNO_QUERY_THROW ); + xFormStr = chart2::FormattedString::create(xContext); xFormStr->setString( rString ); // set character properties comphelper::copyProperties( - xTextProperties, Reference< beans::XPropertySet >( xFormStr, uno::UNO_QUERY ) ); + xTextProperties, Reference< beans::XPropertySet >( xFormStr, uno::UNO_QUERY_THROW ) ); } } catch( const uno::Exception & ex ) @@ -60,7 +58,7 @@ Sequence< Reference< chart2::XFormattedString > > ASSERT_EXCEPTION( ex ); } - return Sequence< Reference< XFormattedString > >( & xFormStr, 1 ); + return Sequence< Reference< XFormattedString2 > >( & xFormStr, 1 ); } //............................................................................. 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 <com/sun/star/chart2/FormattedString.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <rtl/ustrbuf.hxx> @@ -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 ); } } } |