diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-09 11:12:06 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-05-13 09:38:03 +0200 |
commit | 5d1ad167294878789e644452f23ef883af93fe87 (patch) | |
tree | 8f8e14de156eb20e5843e7458502b58828c258a9 /chart2 | |
parent | 39ab9c4e4f4fb26326d8b1f08e4ef45cbe268cfb (diff) |
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
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/inc/FormattedStringHelper.hxx | 4 | ||||
-rw-r--r-- | chart2/source/model/main/FormattedString.hxx | 69 | ||||
-rw-r--r-- | chart2/source/tools/FormattedStringHelper.cxx | 14 | ||||
-rw-r--r-- | chart2/source/tools/TitleHelper.cxx | 36 | ||||
-rw-r--r-- | chart2/source/view/inc/LegendEntryProvider.hxx | 4 | ||||
-rw-r--r-- | chart2/source/view/main/VLegend.cxx | 2 |
6 files changed, 68 insertions, 61 deletions
diff --git a/chart2/source/inc/FormattedStringHelper.hxx b/chart2/source/inc/FormattedStringHelper.hxx index 0dadc937cea6..cd24645ddd2c 100644 --- a/chart2/source/inc/FormattedStringHelper.hxx +++ b/chart2/source/inc/FormattedStringHelper.hxx @@ -19,7 +19,7 @@ #ifndef _CHART2_TOOLS_FORMATTEDSTRINGHELPER_HXX #define _CHART2_TOOLS_FORMATTEDSTRINGHELPER_HXX -#include <com/sun/star/chart2/XFormattedString.hpp> +#include <com/sun/star/chart2/XFormattedString2.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include "charttoolsdllapi.hxx" @@ -34,7 +34,7 @@ class OOO_DLLPUBLIC_CHARTTOOLS FormattedStringHelper public: static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XFormattedString > > + ::com::sun::star::chart2::XFormattedString2 > > createFormattedStringSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext diff --git a/chart2/source/model/main/FormattedString.hxx b/chart2/source/model/main/FormattedString.hxx index c88fff0b21f1..90f864b74e9a 100644 --- a/chart2/source/model/main/FormattedString.hxx +++ b/chart2/source/model/main/FormattedString.hxx @@ -26,7 +26,7 @@ #include "ServiceMacros.hxx" #include "ModifyListenerHelper.hxx" #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/chart2/XFormattedString.hpp> +#include <com/sun/star/chart2/XFormattedString2.hpp> #include <com/sun/star/util/XCloneable.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -36,11 +36,11 @@ namespace chart namespace impl { typedef ::cppu::WeakImplHelper5< - ::com::sun::star::chart2::XFormattedString, - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::util::XCloneable, - ::com::sun::star::util::XModifyBroadcaster, - ::com::sun::star::util::XModifyListener > + ::css::chart2::XFormattedString2, + ::css::lang::XServiceInfo, + ::css::util::XCloneable, + ::css::util::XModifyBroadcaster, + ::css::util::XModifyListener > FormattedString_Base; } @@ -50,8 +50,8 @@ class FormattedString : public ::property::OPropertySet { public: - FormattedString( ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > const & xContext ); + FormattedString( ::css::uno::Reference< + ::css::uno::XComponentContext > const & xContext ); virtual ~FormattedString(); /// declare XServiceInfo methods @@ -60,52 +60,67 @@ public: APPHELPER_SERVICE_FACTORY_HELPER( FormattedString ) /// merge XInterface implementations - DECLARE_XINTERFACE() + DECLARE_XINTERFACE() /// merge XTypeProvider implementations - DECLARE_XTYPEPROVIDER() + DECLARE_XTYPEPROVIDER() + + + virtual void SAL_CALL setPropertyValue(const OUString& p1, const css::uno::Any& p2) throw (css::uno::RuntimeException) + { ::property::OPropertySet::setPropertyValue(p1, p2); } + virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& p1) throw (css::uno::RuntimeException) + { return ::property::OPropertySet::getPropertyValue(p1); } + virtual void SAL_CALL addPropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) throw (css::uno::RuntimeException) + { ::property::OPropertySet::addPropertyChangeListener(p1, p2); } + virtual void SAL_CALL removePropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) throw (css::uno::RuntimeException) + { ::property::OPropertySet::removePropertyChangeListener(p1, p2); } + virtual void SAL_CALL addVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) throw (css::uno::RuntimeException) + { ::property::OPropertySet::addVetoableChangeListener(p1, p2); } + virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) throw (css::uno::RuntimeException) + { ::property::OPropertySet::removeVetoableChangeListener(p1, p2); } + protected: explicit FormattedString( const FormattedString & rOther ); // ____ XFormattedString ____ virtual OUString SAL_CALL getString() - throw (::com::sun::star::uno::RuntimeException); + throw (::css::uno::RuntimeException); virtual void SAL_CALL setString( const OUString& String ) - throw (::com::sun::star::uno::RuntimeException); + throw (::css::uno::RuntimeException); // ____ OPropertySet ____ - virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const - throw(::com::sun::star::beans::UnknownPropertyException); + virtual ::css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const + throw(::css::beans::UnknownPropertyException); // ____ OPropertySet ____ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); // ____ XPropertySet ____ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL + virtual ::css::uno::Reference< ::css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() - throw (::com::sun::star::uno::RuntimeException); + throw (::css::uno::RuntimeException); // ____ XCloneable ____ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() - throw (::com::sun::star::uno::RuntimeException); + virtual ::css::uno::Reference< ::css::util::XCloneable > SAL_CALL createClone() + throw (::css::uno::RuntimeException); // ____ XModifyBroadcaster ____ virtual void SAL_CALL addModifyListener( - const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) - throw (::com::sun::star::uno::RuntimeException); + const ::css::uno::Reference< ::css::util::XModifyListener >& aListener ) + throw (::css::uno::RuntimeException); virtual void SAL_CALL removeModifyListener( - const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) - throw (::com::sun::star::uno::RuntimeException); + const ::css::uno::Reference< ::css::util::XModifyListener >& aListener ) + throw (::css::uno::RuntimeException); // ____ XModifyListener ____ virtual void SAL_CALL modified( - const ::com::sun::star::lang::EventObject& aEvent ) - throw (::com::sun::star::uno::RuntimeException); + const ::css::lang::EventObject& aEvent ) + throw (::css::uno::RuntimeException); // ____ XEventListener (base of XModifyListener) ____ virtual void SAL_CALL disposing( - const ::com::sun::star::lang::EventObject& Source ) - throw (::com::sun::star::uno::RuntimeException); + const ::css::lang::EventObject& Source ) + throw (::css::uno::RuntimeException); // ____ OPropertySet ____ virtual void firePropertyChangeEvent(); @@ -116,7 +131,7 @@ protected: private: OUString m_aString; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder; + ::css::uno::Reference< ::css::util::XModifyListener > m_xModifyEventForwarder; }; } // namespace chart 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 ); } } } diff --git a/chart2/source/view/inc/LegendEntryProvider.hxx b/chart2/source/view/inc/LegendEntryProvider.hxx index b9acba38681c..940f884edd22 100644 --- a/chart2/source/view/inc/LegendEntryProvider.hxx +++ b/chart2/source/view/inc/LegendEntryProvider.hxx @@ -21,7 +21,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/chart/ChartLegendExpansion.hpp> -#include <com/sun/star/chart2/XFormattedString.hpp> +#include <com/sun/star/chart2/XFormattedString2.hpp> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -60,7 +60,7 @@ struct ViewLegendEntry */ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XFormattedString > > aLabel; + ::com::sun::star::chart2::XFormattedString2 > > aLabel; }; class LegendEntryProvider diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 4b7d699d9ab0..2bc9a65895ba 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -168,7 +168,7 @@ awt::Size lcl_createTextShapes( xTarget->add( xEntry ); // set label text - Sequence< Reference< XFormattedString > > aLabelSeq = (*aIt).aLabel; + Sequence< Reference< XFormattedString2 > > aLabelSeq = (*aIt).aLabel; for( sal_Int32 i = 0; i < aLabelSeq.getLength(); ++i ) { // todo: support more than one text range |