diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-17 16:15:09 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-05-21 08:24:01 +0200 |
commit | d256dbede60533369d1aac64cca34721183f6a8a (patch) | |
tree | de87948686ad1bd88165efe0139bb081517a872e /chart2 | |
parent | f2bc5c6229e8e72feb3dd887b6d509e52d666c0c (diff) |
fdo#46808, Convert chart2::Title service to new style
API CHANGE: The chart2::XTitled interface now takes and returns
a XTitle2 instead of an XTitle.
Change-Id: I96c35909d3a13f1abb544296a782a0b6a7a58ec6
Diffstat (limited to 'chart2')
18 files changed, 176 insertions, 113 deletions
diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx index ad07eb12c70a..89f6f9e9de6b 100644 --- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx @@ -77,7 +77,7 @@ WrappedTitleStringProperty::~WrappedTitleStringProperty() void WrappedTitleStringProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY); + Reference< chart2::XTitle2 > xTitle(xInnerPropertySet,uno::UNO_QUERY); if(xTitle.is()) { OUString aString; @@ -89,7 +89,7 @@ Any WrappedTitleStringProperty::getPropertyValue( const Reference< beans::XPrope throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) ); - Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY); + Reference< chart2::XTitle2 > xTitle(xInnerPropertySet,uno::UNO_QUERY); if(xTitle.is()) { Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText()); @@ -294,7 +294,7 @@ Reference< beans::XPropertySet > TitleWrapper::getFirstCharacterPropertySet() { Reference< beans::XPropertySet > xProp; - Reference< chart2::XTitle > xTitle( this->getTitleObject() ); + Reference< chart2::XTitle2 > xTitle = this->getTitleObject(); if( xTitle.is()) { Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText()); @@ -333,7 +333,7 @@ void TitleWrapper::setFastCharacterPropertyValue( OSL_ASSERT( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle && nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP ); - Reference< chart2::XTitle > xTitle( this->getTitleObject() ); + Reference< chart2::XTitle2 > xTitle( this->getTitleObject() ); if( xTitle.is()) { Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText()); @@ -494,7 +494,7 @@ awt::Size TitleWrapper::getCurrentSizeForReference() // ================================================================================ -Reference< chart2::XTitle > TitleWrapper::getTitleObject() +Reference< chart2::XTitle2 > TitleWrapper::getTitleObject() { return TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() ); } diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx index 5a437115de86..85f765753be1 100644 --- a/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx @@ -30,7 +30,7 @@ #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/chart2/XTitle.hpp> +#include <com/sun/star/chart2/XTitle2.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <boost/shared_ptr.hpp> @@ -112,7 +112,7 @@ protected: ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getFirstCharacterPropertySet(); private: - ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle > getTitleObject(); + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle2 > getTitleObject(); private: ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; diff --git a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx index d21f485166fe..342411941236 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx @@ -300,7 +300,7 @@ Any WrappedAxisTitleExistenceProperty::getPropertyValue( const Reference< beans: { sal_Bool bHasTitle = sal_False; - Reference< chart2::XTitle > xTitle( TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() ) ); + Reference< chart2::XTitle2 > xTitle( TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() ) ); if( xTitle.is() && !TitleHelper::getCompleteString( xTitle ).isEmpty() ) bHasTitle = sal_True; diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index 29a3f38be4be..2f81a5c25226 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -393,7 +393,7 @@ OUString ObjectNameProvider::getTitleName( const OUString& rObjectCID { OUString aRet; - Reference< XTitle > xTitle( + Reference< XTitle2 > xTitle( ObjectIdentifier::getObjectPropertySet( rObjectCID , xChartModel ), uno::UNO_QUERY ); if( xTitle.is() ) { diff --git a/chart2/source/controller/dialogs/TitleDialogData.cxx b/chart2/source/controller/dialogs/TitleDialogData.cxx index 91d44353934e..b1560dba7579 100644 --- a/chart2/source/controller/dialogs/TitleDialogData.cxx +++ b/chart2/source/controller/dialogs/TitleDialogData.cxx @@ -62,10 +62,10 @@ void TitleDialogData::readFromModel( const uno::Reference< frame::XModel>& xChar nTitleIndex < static_cast< sal_Int32 >( TitleHelper::NORMAL_TITLE_END ); nTitleIndex++) { - uno::Reference< XTitle > xTitle = TitleHelper::getTitle( + uno::Reference< XTitle2 > xTitle = TitleHelper::getTitle( static_cast< TitleHelper::eTitleType >( nTitleIndex ), xChartModel ); this->aExistenceList[nTitleIndex] = xTitle.is(); - this->aTextList[nTitleIndex]=TitleHelper::getCompleteString( xTitle ); + this->aTextList[nTitleIndex] = TitleHelper::getCompleteString( xTitle ); } } @@ -97,8 +97,8 @@ bool TitleDialogData::writeDifferenceToModel( else if( !pOldState || ( pOldState->aTextList[nN] != this->aTextList[nN] ) ) { //change content - uno::Reference< XTitle > xTitle( - TitleHelper::getTitle( static_cast< TitleHelper::eTitleType >( nN ), xChartModel ) ); + uno::Reference< XTitle2 > xTitle = + TitleHelper::getTitle( static_cast< TitleHelper::eTitleType >( nN ), xChartModel ); if(xTitle.is()) { TitleHelper::setCompleteString( this->aTextList[nN], xTitle, xContext ); diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx index 8fd50b0a64d7..6f7b4ebc2817 100644 --- a/chart2/source/controller/main/ChartController_TextEdit.cxx +++ b/chart2/source/controller/main/ChartController_TextEdit.cxx @@ -145,7 +145,7 @@ bool ChartController::EndTextEdit() ControllerLockGuard aCLGuard( getModel() ); TitleHelper::setCompleteString( aString, uno::Reference< - ::com::sun::star::chart2::XTitle >::query( xPropSet ), m_xCC ); + ::com::sun::star::chart2::XTitle2 >::query( xPropSet ), m_xCC ); OSL_ENSURE( m_pTextActionUndoGuard.get(), "ChartController::EndTextEdit: no TextUndoGuard!" ); if ( m_pTextActionUndoGuard.get() ) diff --git a/chart2/source/inc/TitleHelper.hxx b/chart2/source/inc/TitleHelper.hxx index ec9db23e2401..3fec3e3033d5 100644 --- a/chart2/source/inc/TitleHelper.hxx +++ b/chart2/source/inc/TitleHelper.hxx @@ -52,13 +52,13 @@ public: }; static ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle > + ::com::sun::star::chart2::XTitle2 > getTitle( eTitleType nTitleIndex , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ); static ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle > + ::com::sun::star::chart2::XTitle2 > createTitle( eTitleType nTitleIndex , const OUString& rTitleText , const ::com::sun::star::uno::Reference< @@ -72,17 +72,17 @@ public: ::com::sun::star::frame::XModel >& xModel ); static OUString getCompleteString( const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle >& xTitle ); + ::com::sun::star::chart2::XTitle2 >& xTitle ); static void setCompleteString( const OUString& rNewText , const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle >& xTitle + ::com::sun::star::chart2::XTitle2 >& xTitle , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext , float * pDefaultCharHeight = 0 ); static bool getTitleType( eTitleType& rType , const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle >& xTitle + ::com::sun::star::chart2::XTitle2 >& xTitle , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ); }; diff --git a/chart2/source/model/inc/Diagram.hxx b/chart2/source/model/inc/Diagram.hxx index f31c3c509a12..c9223636a26d 100644 --- a/chart2/source/model/inc/Diagram.hxx +++ b/chart2/source/model/inc/Diagram.hxx @@ -150,10 +150,10 @@ protected: // ____ XTitled ____ virtual ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle > SAL_CALL getTitleObject() + ::com::sun::star::chart2::XTitle2 > SAL_CALL getTitleObject() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setTitleObject( const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle >& Title ) + ::com::sun::star::chart2::XTitle2 >& Title ) throw (::com::sun::star::uno::RuntimeException); // ____ X3DDefaultSetter ____ @@ -209,7 +209,7 @@ private: m_xFloor; ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle > + ::com::sun::star::chart2::XTitle2 > m_xTitle; ::com::sun::star::uno::Reference< diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx index 35fcabb89571..bac6aea6a194 100644 --- a/chart2/source/model/main/Axis.cxx +++ b/chart2/source/model/main/Axis.cxx @@ -341,7 +341,7 @@ Axis::Axis( const Axis & rOther ) : lcl_CloneSubGrids( rOther.m_aSubGridProperties, m_aSubGridProperties ); ModifyListenerHelper::addListenerToAllSequenceElements( m_aSubGridProperties, m_xModifyEventForwarder ); - m_xTitle.set( CloneHelper::CreateRefClone< Reference< chart2::XTitle > >()( rOther.m_xTitle )); + m_xTitle.set( CloneHelper::CreateRefClone< Reference< chart2::XTitle2 > >()( rOther.m_xTitle )); if( m_xTitle.is()) ModifyListenerHelper::addListener( m_xTitle, m_xModifyEventForwarder ); } @@ -480,18 +480,18 @@ Sequence< Reference< beans::XPropertySet > > SAL_CALL Axis::getSubTickProperties // ____ XTitled ____ -Reference< chart2::XTitle > SAL_CALL Axis::getTitleObject() +Reference< chart2::XTitle2 > SAL_CALL Axis::getTitleObject() throw (uno::RuntimeException) { MutexGuard aGuard( GetMutex() ); return m_xTitle; } -void SAL_CALL Axis::setTitleObject( const Reference< chart2::XTitle >& xNewTitle ) +void SAL_CALL Axis::setTitleObject( const Reference< chart2::XTitle2 >& xNewTitle ) throw (uno::RuntimeException) { Reference< util::XModifyListener > xModifyEventForwarder; - Reference< chart2::XTitle > xOldTitle; + Reference< chart2::XTitle2 > xOldTitle; { MutexGuard aGuard( GetMutex() ); xOldTitle = m_xTitle; diff --git a/chart2/source/model/main/Axis.hxx b/chart2/source/model/main/Axis.hxx index 46301fee3605..c5c2c1768e23 100644 --- a/chart2/source/model/main/Axis.hxx +++ b/chart2/source/model/main/Axis.hxx @@ -106,11 +106,11 @@ protected: // ____ XTitled ____ virtual ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle > SAL_CALL getTitleObject() + ::com::sun::star::chart2::XTitle2 > SAL_CALL getTitleObject() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setTitleObject( const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle >& Title ) + ::com::sun::star::chart2::XTitle2 >& Title ) throw (::com::sun::star::uno::RuntimeException); // ____ XCloneable ____ @@ -160,7 +160,7 @@ private: //member ::com::sun::star::beans::XPropertySet > > m_aSubGridProperties; ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle > m_xTitle; + ::com::sun::star::chart2::XTitle2 > m_xTitle; }; } // namespace chart diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index e2157c4f2daa..da5224319b36 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -156,7 +156,7 @@ ChartModel::ChartModel( const ChartModel & rOther ) m_xOldModelAgg->setDelegator( *this ); Reference< util::XModifyListener > xListener; - Reference< chart2::XTitle > xNewTitle = CreateRefClone< Reference< chart2::XTitle > >()( rOther.m_xTitle ); + Reference< chart2::XTitle2 > xNewTitle = CreateRefClone< Reference< chart2::XTitle2 > >()( rOther.m_xTitle ); Reference< chart2::XDiagram > xNewDiagram = CreateRefClone< Reference< chart2::XDiagram > >()( rOther.m_xDiagram ); Reference< beans::XPropertySet > xNewPageBackground = CreateRefClone< Reference< beans::XPropertySet > >()( rOther.m_xPageBackground ); Reference< chart2::XChartTypeManager > xChartTypeManager = CreateRefClone< Reference< chart2::XChartTypeManager > >()( rOther.m_xChartTypeManager ); @@ -967,14 +967,14 @@ uno::Reference< beans::XPropertySet > SAL_CALL ChartModel::getPageBackground() } // ____ XTitled ____ -uno::Reference< chart2::XTitle > SAL_CALL ChartModel::getTitleObject() +uno::Reference< chart2::XTitle2 > SAL_CALL ChartModel::getTitleObject() throw (uno::RuntimeException) { MutexGuard aGuard( m_aModelMutex ); return m_xTitle; } -void SAL_CALL ChartModel::setTitleObject( const uno::Reference< chart2::XTitle >& xTitle ) +void SAL_CALL ChartModel::setTitleObject( const uno::Reference< chart2::XTitle2 >& xTitle ) throw (uno::RuntimeException) { { diff --git a/chart2/source/model/main/ChartModel.hxx b/chart2/source/model/main/ChartModel.hxx index f7d81b8dff92..b27e8340a3fe 100644 --- a/chart2/source/model/main/ChartModel.hxx +++ b/chart2/source/model/main/ChartModel.hxx @@ -160,7 +160,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > m_xDiagram; - ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle > + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle2 > m_xTitle; bool m_bIsDisposed; @@ -480,10 +480,10 @@ public: // ____ XTitled ____ virtual ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle > SAL_CALL getTitleObject() + ::com::sun::star::chart2::XTitle2 > SAL_CALL getTitleObject() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setTitleObject( const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle >& Title ) + ::com::sun::star::chart2::XTitle2 >& Title ) throw (::com::sun::star::uno::RuntimeException); // ____ XInterface (for old API wrapper) ____ diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx index ec1637ba1f51..eb7fac357755 100644 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -307,7 +307,7 @@ Diagram::Diagram( const Diagram & rOther ) : m_xWall.set( CloneHelper::CreateRefClone< Reference< beans::XPropertySet > >()( rOther.m_xWall )); m_xFloor.set( CloneHelper::CreateRefClone< Reference< beans::XPropertySet > >()( rOther.m_xFloor )); - m_xTitle.set( CloneHelper::CreateRefClone< Reference< chart2::XTitle > >()( rOther.m_xTitle )); + m_xTitle.set( CloneHelper::CreateRefClone< Reference< chart2::XTitle2 > >()( rOther.m_xTitle )); m_xLegend.set( CloneHelper::CreateRefClone< Reference< chart2::XLegend > >()( rOther.m_xLegend )); ModifyListenerHelper::addListener( m_xWall, m_xModifyEventForwarder ); @@ -442,17 +442,17 @@ void SAL_CALL Diagram::setDiagramData( } // ____ XTitled ____ -uno::Reference< chart2::XTitle > SAL_CALL Diagram::getTitleObject() +uno::Reference< chart2::XTitle2 > SAL_CALL Diagram::getTitleObject() throw (uno::RuntimeException) { MutexGuard aGuard( GetMutex() ); return m_xTitle; } -void SAL_CALL Diagram::setTitleObject( const uno::Reference< chart2::XTitle >& xNewTitle ) +void SAL_CALL Diagram::setTitleObject( const uno::Reference< chart2::XTitle2 >& xNewTitle ) throw (uno::RuntimeException) { - Reference< chart2::XTitle > xOldTitle; + Reference< chart2::XTitle2 > xOldTitle; { MutexGuard aGuard( GetMutex() ); if( m_xTitle == xNewTitle ) diff --git a/chart2/source/model/main/Title.cxx b/chart2/source/model/main/Title.cxx index 346a967058af..5eb9686106c5 100644 --- a/chart2/source/model/main/Title.cxx +++ b/chart2/source/model/main/Title.cxx @@ -370,6 +370,40 @@ void Title::fireModifyEvent() m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this ))); } +sal_Bool Title::getPropertyBool(const OUString& aPropertyName) throw (css::uno::RuntimeException) +{ + uno::Any any = getPropertyValue(aPropertyName); + sal_Bool b = sal_False; + any >>= b; + return b; +} + +double Title::getPropertyDouble(const OUString& aPropertyName) throw (css::uno::RuntimeException) +{ + uno::Any any = getPropertyValue(aPropertyName); + double b = sal_False; + any >>= b; + return b; +} + +awt::Size Title::getReferencePageSize() throw(css::uno::RuntimeException) +{ + uno::Any any = getPropertyValue("ReferencePageSize"); + awt::Size b; + any >>= b; + return b; +} + +chart2::RelativePosition Title::getRelativePosition() throw(css::uno::RuntimeException) +{ + uno::Any any = getPropertyValue("RelativePosition"); + chart2::RelativePosition b; + any >>= b; + return b; +} + + + // ================================================================================ diff --git a/chart2/source/model/main/Title.hxx b/chart2/source/model/main/Title.hxx index c177d6e9ebc4..32c7c1726576 100644 --- a/chart2/source/model/main/Title.hxx +++ b/chart2/source/model/main/Title.hxx @@ -25,7 +25,7 @@ #include "MutexContainer.hxx" #include <cppuhelper/implbase5.hxx> #include <comphelper/uno3.hxx> -#include <com/sun/star/chart2/XTitle.hpp> +#include <com/sun/star/chart2/XTitle2.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/util/XCloneable.hpp> @@ -36,7 +36,7 @@ namespace chart namespace impl { typedef ::cppu::WeakImplHelper5< - ::com::sun::star::chart2::XTitle, + ::com::sun::star::chart2::XTitle2, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::util::XCloneable, ::com::sun::star::util::XModifyBroadcaster, @@ -61,9 +61,41 @@ public: APPHELPER_XSERVICEINFO_DECL() /// merge XInterface implementations - DECLARE_XINTERFACE() + DECLARE_XINTERFACE() /// merge XTypeProvider implementations - DECLARE_XTYPEPROVIDER() + DECLARE_XTYPEPROVIDER() + + + // ambiguous overloads + virtual void SAL_CALL setPropertyValue(const rtl::OUString& p1, const com::sun::star::uno::Any& p2) throw(css::uno::RuntimeException) + { ::property::OPropertySet::setPropertyValue(p1, p2); } + virtual com::sun::star::uno::Any SAL_CALL getPropertyValue(const rtl::OUString& p1) throw(css::uno::RuntimeException) + { return ::property::OPropertySet::getPropertyValue(p1); } + virtual void SAL_CALL addPropertyChangeListener(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener>& p2) throw(css::uno::RuntimeException) + { ::property::OPropertySet::addPropertyChangeListener(p1, p2); } + virtual void SAL_CALL removePropertyChangeListener(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener>& p2) throw(css::uno::RuntimeException) + { ::property::OPropertySet::removePropertyChangeListener(p1, p2); } + virtual void SAL_CALL addVetoableChangeListener(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XVetoableChangeListener>& p2) throw(css::uno::RuntimeException) + { ::property::OPropertySet::addVetoableChangeListener(p1, p2); } + virtual void SAL_CALL removeVetoableChangeListener(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XVetoableChangeListener>& p2) throw(css::uno::RuntimeException) + { ::property::OPropertySet::removeVetoableChangeListener(p1, p2); } + + // Attributes + virtual double SAL_CALL getTextRotation() throw(css::uno::RuntimeException) + { return getPropertyDouble("TextRotation"); } + virtual void SAL_CALL setTextRotation(double p1) throw(css::uno::RuntimeException) + { setPropertyDouble("TextRotation", p1); } + virtual sal_Bool SAL_CALL getStackCharacters() throw(css::uno::RuntimeException) + { return getPropertyBool("StackCharacters"); } + virtual void SAL_CALL setStackCharacters(sal_Bool p1) throw(css::uno::RuntimeException) + { setPropertyBool("StackCharacters", p1); } + virtual com::sun::star::chart2::RelativePosition SAL_CALL getRelativePosition() throw(css::uno::RuntimeException); + virtual void SAL_CALL setRelativePosition(const com::sun::star::chart2::RelativePosition& p1) throw(css::uno::RuntimeException) + { setPropertyValue("RelativePosition", css::uno::Any(p1)); } + virtual com::sun::star::awt::Size SAL_CALL getReferencePageSize() throw(css::uno::RuntimeException); + virtual void SAL_CALL setReferencePageSize(const com::sun::star::awt::Size& p1) throw(css::uno::RuntimeException) + { setPropertyValue("ReferencePageSize", css::uno::Any(p1)); } + protected: explicit Title( const Title & rOther ); @@ -119,6 +151,14 @@ protected: void fireModifyEvent(); private: + + sal_Bool getPropertyBool(const OUString& p1) throw(::com::sun::star::uno::RuntimeException); + double getPropertyDouble(const OUString& p1) throw(::com::sun::star::uno::RuntimeException); + void setPropertyBool(const OUString& p1, sal_Bool p2) throw(::com::sun::star::uno::RuntimeException) + { setPropertyValue( p1, css::uno::Any(p2) ); } + void setPropertyDouble(const OUString& p1, double p2) throw(::com::sun::star::uno::RuntimeException) + { setPropertyValue( p1, css::uno::Any(p2) ); } + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString > > m_aStrings; diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index 9dc31b17363a..135227774289 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -344,7 +344,7 @@ OUString ObjectIdentifier::createClassifiedIdentifierForObject( try { //title - Reference< XTitle > xTitle( xObject, uno::UNO_QUERY ); + Reference< XTitle2 > xTitle( xObject, uno::UNO_QUERY ); if( xTitle.is() ) { TitleHelper::eTitleType aTitleType; diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx index a8a0b0074990..dda05135c7f2 100644 --- a/chart2/source/tools/TitleHelper.cxx +++ b/chart2/source/tools/TitleHelper.cxx @@ -23,6 +23,7 @@ #include "AxisHelper.hxx" #include "DiagramHelper.hxx" #include <com/sun/star/chart2/FormattedString.hpp> +#include <com/sun/star/chart2/Title.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <rtl/ustrbuf.hxx> @@ -122,23 +123,23 @@ uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleInde return xResult; } -uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex +uno::Reference< XTitle2 > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex , const uno::Reference< frame::XModel >& xModel ) { uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xModel ) ); if( xTitled.is()) - return xTitled->getTitleObject(); + xTitled->getTitleObject(); return NULL; } -uno::Reference< XTitle > TitleHelper::createTitle( +uno::Reference< XTitle2 > TitleHelper::createTitle( TitleHelper::eTitleType eTitleType , const OUString& rTitleText , const uno::Reference< frame::XModel >& xModel , const uno::Reference< uno::XComponentContext > & xContext , ReferenceSizeProvider * pRefSizeProvider ) { - uno::Reference< XTitle > xTitle; + uno::Reference< XTitle2 > xTitle; uno::Reference< XTitled > xTitled( lcl_getTitleParent( eTitleType, xModel ) ); if( !xTitled.is() ) @@ -168,79 +169,70 @@ uno::Reference< XTitle > TitleHelper::createTitle( { uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ) ); - xTitle.set( xContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.chart2.Title", - xContext ), uno::UNO_QUERY ); + xTitle = chart2::Title::create( xContext ); - if(xTitle.is()) + // default char height (main: 13.0 == default) + float fDefaultCharHeightSub = 11.0; + float fDefaultCharHeightAxis = 9.0; + switch( eTitleType ) { - // default char height (main: 13.0 == default) - float fDefaultCharHeightSub = 11.0; - float fDefaultCharHeightAxis = 9.0; - switch( eTitleType ) - { - case TitleHelper::SUB_TITLE: - TitleHelper::setCompleteString( - rTitleText, xTitle, xContext, & fDefaultCharHeightSub ); - break; - case TitleHelper::X_AXIS_TITLE: - case TitleHelper::Y_AXIS_TITLE: - case TitleHelper::Z_AXIS_TITLE: - case TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION: - case TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION: - case TitleHelper::SECONDARY_X_AXIS_TITLE: - case TitleHelper::SECONDARY_Y_AXIS_TITLE: - TitleHelper::setCompleteString( - rTitleText, xTitle, xContext, & fDefaultCharHeightAxis ); - break; - default: - TitleHelper::setCompleteString( rTitleText, xTitle, xContext ); - break; - } + case TitleHelper::SUB_TITLE: + TitleHelper::setCompleteString( + rTitleText, xTitle, xContext, & fDefaultCharHeightSub ); + break; + case TitleHelper::X_AXIS_TITLE: + case TitleHelper::Y_AXIS_TITLE: + case TitleHelper::Z_AXIS_TITLE: + case TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION: + case TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION: + case TitleHelper::SECONDARY_X_AXIS_TITLE: + case TitleHelper::SECONDARY_Y_AXIS_TITLE: + TitleHelper::setCompleteString( + rTitleText, xTitle, xContext, & fDefaultCharHeightAxis ); + break; + default: + TitleHelper::setCompleteString( rTitleText, xTitle, xContext ); + break; + } - // set/clear autoscale - if( pRefSizeProvider ) - pRefSizeProvider->setValuesAtTitle( xTitle ); + // set/clear autoscale + if( pRefSizeProvider ) + pRefSizeProvider->setValuesAtTitle( xTitle ); - xTitled->setTitleObject( xTitle ); + xTitled->setTitleObject( xTitle ); - //default rotation 90 degree for y axis title in normal coordinatesystems or for x axis title for swapped coordinatesystems - if( eTitleType == TitleHelper::X_AXIS_TITLE || - eTitleType == TitleHelper::Y_AXIS_TITLE || - eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE || - eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE ) + //default rotation 90 degree for y axis title in normal coordinatesystems or for x axis title for swapped coordinatesystems + if( eTitleType == TitleHelper::X_AXIS_TITLE || + eTitleType == TitleHelper::Y_AXIS_TITLE || + eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE || + eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE ) + { + try { - try - { - bool bDummy = false; - bool bIsVertical = DiagramHelper::getVertical( xDiagram, bDummy, bDummy ); - - Reference< beans::XPropertySet > xTitleProps( xTitle, uno::UNO_QUERY ); - if( xTitleProps.is() ) - { - if( (!bIsVertical && eTitleType == TitleHelper::Y_AXIS_TITLE) - || (bIsVertical && eTitleType == TitleHelper::X_AXIS_TITLE) - || (!bIsVertical && eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE) - || (bIsVertical && eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE) ) - { - double fNewAngleDegree = 90.0; - xTitleProps->setPropertyValue( "TextRotation", uno::makeAny( fNewAngleDegree )); - } - } - } - catch( const uno::Exception & ex ) + bool bDummy = false; + bool bIsVertical = DiagramHelper::getVertical( xDiagram, bDummy, bDummy ); + + if( (!bIsVertical && eTitleType == TitleHelper::Y_AXIS_TITLE) + || (bIsVertical && eTitleType == TitleHelper::X_AXIS_TITLE) + || (!bIsVertical && eTitleType == TitleHelper::SECONDARY_Y_AXIS_TITLE) + || (bIsVertical && eTitleType == TitleHelper::SECONDARY_X_AXIS_TITLE) ) { - ASSERT_EXCEPTION( ex ); + double fNewAngleDegree = 90.0; + xTitle->setTextRotation( fNewAngleDegree ); } } + catch( const uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); + } } } return xTitle; } -OUString TitleHelper::getCompleteString( const uno::Reference< XTitle >& xTitle ) +OUString TitleHelper::getCompleteString( const uno::Reference< XTitle2 >& xTitle ) { OUString aRet; if(!xTitle.is()) @@ -252,7 +244,7 @@ OUString TitleHelper::getCompleteString( const uno::Reference< XTitle >& xTitle } void TitleHelper::setCompleteString( const OUString& rNewText - , const uno::Reference< XTitle >& xTitle + , const uno::Reference< XTitle2 >& xTitle , const uno::Reference< uno::XComponentContext > & xContext , float * pDefaultCharHeight /* = 0 */ ) { @@ -262,10 +254,7 @@ void TitleHelper::setCompleteString( const OUString& rNewText OUString aNewText = rNewText; - bool bStacked = false; - uno::Reference< beans::XPropertySet > xTitleProperties( xTitle, uno::UNO_QUERY ); - if( xTitleProperties.is() ) - xTitleProperties->getPropertyValue( "StackCharacters" ) >>= bStacked; + bool bStacked = xTitle->getStackCharacters(); if( bStacked ) { @@ -337,14 +326,14 @@ void TitleHelper::removeTitle( TitleHelper::eTitleType nTitleIndex bool TitleHelper::getTitleType( eTitleType& rType , const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XTitle >& xTitle + ::com::sun::star::chart2::XTitle2 >& xTitle , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ) { if( !xTitle.is() || !xModel.is() ) return false; - Reference< chart2::XTitle > xCurrentTitle; + Reference< chart2::XTitle2 > xCurrentTitle; for( sal_Int32 nTitleType = TITLE_BEGIN; nTitleType < NORMAL_TITLE_END; nTitleType++ ) { xCurrentTitle = TitleHelper::getTitle( static_cast<eTitleType>(nTitleType), xModel ); diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index e5ae969c483d..5698e3e2a43a 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2167,7 +2167,7 @@ boost::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType nXDistance = nXOffset; } - uno::Reference< XTitle > xTitle( TitleHelper::getTitle( eType, xChartModel ) ); + uno::Reference< XTitle2 > xTitle( TitleHelper::getTitle( eType, xChartModel ) ); OUString aCompleteString( TitleHelper::getCompleteString( xTitle ) ); if( !aCompleteString.isEmpty() ) { |