diff options
Diffstat (limited to 'chart2/source/controller/chartapiwrapper')
-rwxr-xr-x | chart2/source/controller/chartapiwrapper/AxisWrapper.cxx | 110 | ||||
-rwxr-xr-x[-rw-r--r--] | chart2/source/controller/chartapiwrapper/AxisWrapper.hxx | 17 | ||||
-rwxr-xr-x[-rw-r--r--] | chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx | 7 | ||||
-rwxr-xr-x | chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx | 233 | ||||
-rwxr-xr-x[-rw-r--r--] | chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx | 32 | ||||
-rwxr-xr-x | chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx | 10 | ||||
-rwxr-xr-x | chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx | 236 | ||||
-rwxr-xr-x[-rw-r--r--] | chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx | 86 | ||||
-rwxr-xr-x | chart2/source/controller/chartapiwrapper/GridWrapper.cxx | 13 | ||||
-rwxr-xr-x[-rw-r--r--] | chart2/source/controller/chartapiwrapper/GridWrapper.hxx | 13 | ||||
-rwxr-xr-x | chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx | 106 | ||||
-rwxr-xr-x[-rw-r--r--] | chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx | 3 |
12 files changed, 606 insertions, 260 deletions
diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx index ebb9459e7d54..80b7cd20574b 100755 --- a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx @@ -29,10 +29,15 @@ #include "precompiled_chart2.hxx" #include "AxisWrapper.hxx" #include "AxisHelper.hxx" +#include "TitleHelper.hxx" #include "Chart2ModelContact.hxx" #include "ContainerHelper.hxx" #include "macros.hxx" #include "WrappedDirectStateProperty.hxx" +#include "GridWrapper.hxx" +#include "TitleWrapper.hxx" +#include "DisposeHelper.hxx" + #include <comphelper/InlineContainer.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp> @@ -82,6 +87,9 @@ enum PROP_AXIS_AUTO_MIN, PROP_AXIS_AUTO_STEPMAIN, PROP_AXIS_AUTO_STEPHELP, + PROP_AXIS_TYPE, + PROP_AXIS_TIME_INCREMENT, + PROP_AXIS_EXPLICIT_TIME_INCREMENT, PROP_AXIS_LOGARITHMIC, PROP_AXIS_REVERSEDIRECTION, PROP_AXIS_VISIBLE, @@ -174,6 +182,27 @@ void lcl_AddPropertiesToVector( beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( + Property( C2U( "AxisType" ), + PROP_AXIS_TYPE, + ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), //type com::sun::star::chart::ChartAxisType + //#i111967# no PropertyChangeEvent is fired on change so far + beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( C2U( "TimeIncrement" ), + PROP_AXIS_TIME_INCREMENT, + ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::TimeIncrement * >(0)), + //#i111967# no PropertyChangeEvent is fired on change so far + beans::PropertyAttribute::MAYBEVOID )); + + rOutProperties.push_back( + Property( C2U( "ExplicitTimeIncrement" ), + PROP_AXIS_EXPLICIT_TIME_INCREMENT, + ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::TimeIncrement * >(0)), + beans::PropertyAttribute::READONLY | + beans::PropertyAttribute::MAYBEVOID )); + + rOutProperties.push_back( Property( C2U( "Logarithmic" ), PROP_AXIS_LOGARITHMIC, ::getBooleanCppuType(), @@ -374,6 +403,83 @@ AxisWrapper::~AxisWrapper() { } +// ____ chart::XAxis ____ +Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getAxisTitle() throw (uno::RuntimeException) +{ + if( !m_xAxisTitle.is() ) + { + TitleHelper::eTitleType eTitleType( TitleHelper::X_AXIS_TITLE ); + switch( m_eType ) + { + case X_AXIS: + eTitleType = TitleHelper::X_AXIS_TITLE; + break; + case Y_AXIS: + eTitleType = TitleHelper::Y_AXIS_TITLE; + break; + case Z_AXIS: + eTitleType = TitleHelper::Z_AXIS_TITLE; + break; + case SECOND_X_AXIS: + eTitleType = TitleHelper::SECONDARY_X_AXIS_TITLE; + break; + case SECOND_Y_AXIS: + eTitleType = TitleHelper::SECONDARY_Y_AXIS_TITLE; + break; + default: + return 0; + } + m_xAxisTitle = new TitleWrapper( eTitleType, m_spChart2ModelContact ); + } + return m_xAxisTitle; +} +Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getMajorGrid() throw (uno::RuntimeException) +{ + if( !m_xMajorGrid.is() ) + { + GridWrapper::tGridType eGridType( GridWrapper::X_MAJOR_GRID ); + switch( m_eType ) + { + case X_AXIS: + eGridType = GridWrapper::X_MAJOR_GRID; + break; + case Y_AXIS: + eGridType = GridWrapper::Y_MAJOR_GRID; + break; + case Z_AXIS: + eGridType = GridWrapper::Z_MAJOR_GRID; + break; + default: + return 0; + } + m_xMajorGrid = new GridWrapper( eGridType, m_spChart2ModelContact ); + } + return m_xMajorGrid; +} +Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getMinorGrid() throw (uno::RuntimeException) +{ + if( !m_xMinorGrid.is() ) + { + GridWrapper::tGridType eGridType( GridWrapper::X_MAJOR_GRID ); + switch( m_eType ) + { + case X_AXIS: + eGridType = GridWrapper::X_MINOR_GRID; + break; + case Y_AXIS: + eGridType = GridWrapper::Y_MINOR_GRID; + break; + case Z_AXIS: + eGridType = GridWrapper::Z_MINOR_GRID; + break; + default: + return 0; + } + m_xMinorGrid = new GridWrapper( eGridType, m_spChart2ModelContact ); + } + return m_xMinorGrid; +} + // ____ XShape ____ awt::Point SAL_CALL AxisWrapper::getPosition() throw (uno::RuntimeException) @@ -454,6 +560,10 @@ void SAL_CALL AxisWrapper::dispose() Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) ); + DisposeHelper::DisposeAndClear( m_xAxisTitle ); + DisposeHelper::DisposeAndClear( m_xMajorGrid ); + DisposeHelper::DisposeAndClear( m_xMinorGrid ); + clearWrappedPropertySet(); } diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx index 86bd52367bbe..f7a7d514e1f4 100644..100755 --- a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx @@ -30,9 +30,10 @@ #include "WrappedPropertySet.hxx" #include "ReferenceSizePropertyProvider.hxx" #include "ServiceMacros.hxx" -#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase5.hxx> #include <comphelper/uno3.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <com/sun/star/chart/XAxis.hpp> #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/drawing/XShape.hpp> @@ -45,14 +46,13 @@ namespace chart { - namespace wrapper { - class Chart2ModelContact; -class AxisWrapper : public ::cppu::ImplInheritanceHelper4< +class AxisWrapper : public ::cppu::ImplInheritanceHelper5< WrappedPropertySet + , com::sun::star::chart::XAxis , com::sun::star::drawing::XShape , com::sun::star::lang::XComponent , com::sun::star::lang::XServiceInfo @@ -93,6 +93,11 @@ public: ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + // ____ chart::XAxis ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getAxisTitle( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getMajorGrid( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getMinorGrid( ) throw (::com::sun::star::uno::RuntimeException); + // ____ XShape ____ virtual ::com::sun::star::awt::Point SAL_CALL getPosition() throw (::com::sun::star::uno::RuntimeException); @@ -131,6 +136,10 @@ private: //member tAxisType m_eType; ::com::sun::star::uno::Any m_aTemporaryHelpStepValue; + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xAxisTitle; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xMajorGrid; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xMinorGrid; }; } // namespace wrapper diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx index e20167e216c2..dafef0f2aa72 100644..100755 --- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx +++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx @@ -27,8 +27,7 @@ #ifndef CHART_CHART2MODELCONTACT_HXX #define CHART_CHART2MODELCONTACT_HXX -#include <com/sun/star/chart2/ExplicitScaleData.hpp> -#include <com/sun/star/chart2/ExplicitIncrementData.hpp> +#include <chartview/ExplicitScaleValues.hxx> #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XDataSeries.hpp> @@ -79,8 +78,8 @@ public: sal_Bool getExplicitValuesForAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > & xAxis, - ::com::sun::star::chart2::ExplicitScaleData & rOutExplicitScale, - ::com::sun::star::chart2::ExplicitIncrementData & rOutExplicitIncrement ); + ExplicitScaleData & rOutExplicitScale, + ExplicitIncrementData & rOutExplicitIncrement ); sal_Int32 getExplicitNumberFormatKeyForAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx index 7a0907b05a28..3498b812557a 100755 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx @@ -64,9 +64,11 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::rtl::OUString; using ::osl::MutexGuard; +using ::com::sun::star::chart2::XAnyDescriptionAccess; using ::com::sun::star::chart::XComplexDescriptionAccess; using ::com::sun::star::chart::XChartData; using ::com::sun::star::chart::XChartDataArray; +using ::com::sun::star::chart::XDateCategories; namespace { @@ -132,7 +134,7 @@ struct lcl_Operator virtual ~lcl_Operator() { } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) = 0; + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) = 0; virtual bool setsCategories( bool /*bDataInColumns*/ ) { @@ -155,13 +157,20 @@ struct lcl_AllOperator : public lcl_Operator return true; } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) { if( !xDataAccess.is() ) return; + Reference< XAnyDescriptionAccess > xNewAny( m_xDataToApply, uno::UNO_QUERY ); Reference< XComplexDescriptionAccess > xNewComplex( m_xDataToApply, uno::UNO_QUERY ); - if( xNewComplex.is() ) + if( xNewAny.is() ) + { + xDataAccess->setData( xNewAny->getData() ); + xDataAccess->setComplexRowDescriptions( xNewAny->getComplexRowDescriptions() ); + xDataAccess->setComplexColumnDescriptions( xNewAny->getComplexColumnDescriptions() ); + } + else if( xNewComplex.is() ) { xDataAccess->setData( xNewComplex->getData() ); xDataAccess->setComplexRowDescriptions( xNewComplex->getComplexRowDescriptions() ); @@ -192,7 +201,7 @@ struct lcl_DataOperator : public lcl_Operator { } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) { if( xDataAccess.is() ) xDataAccess->setData( lcl_getNANInsteadDBL_MIN( m_rData ) ); @@ -205,96 +214,208 @@ struct lcl_DataOperator : public lcl_Operator struct lcl_RowDescriptionsOperator : public lcl_Operator { - lcl_RowDescriptionsOperator( const Sequence< OUString >& rRowDescriptions ) + lcl_RowDescriptionsOperator( const Sequence< OUString >& rRowDescriptions + , const Reference< chart2::XChartDocument >& xChartDoc ) : lcl_Operator() , m_rRowDescriptions( rRowDescriptions ) + , m_xChartDoc(xChartDoc) + , m_bDataInColumns(true) { } virtual bool setsCategories( bool bDataInColumns ) { + m_bDataInColumns = bDataInColumns; return bDataInColumns; } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) { if( xDataAccess.is() ) + { xDataAccess->setRowDescriptions( m_rRowDescriptions ); + if( m_bDataInColumns ) + DiagramHelper::switchToTextCategories( m_xChartDoc ); + } } const Sequence< OUString >& m_rRowDescriptions; + Reference< chart2::XChartDocument > m_xChartDoc; + bool m_bDataInColumns; }; //-------------------------------------------------------------------------- struct lcl_ComplexRowDescriptionsOperator : public lcl_Operator { - lcl_ComplexRowDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexRowDescriptions ) + lcl_ComplexRowDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexRowDescriptions + , const Reference< chart2::XChartDocument >& xChartDoc ) : lcl_Operator() , m_rComplexRowDescriptions( rComplexRowDescriptions ) + , m_xChartDoc(xChartDoc) + , m_bDataInColumns(true) { } virtual bool setsCategories( bool bDataInColumns ) { + m_bDataInColumns = bDataInColumns; return bDataInColumns; } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) { if( xDataAccess.is() ) + { xDataAccess->setComplexRowDescriptions( m_rComplexRowDescriptions ); + if( m_bDataInColumns ) + DiagramHelper::switchToTextCategories( m_xChartDoc ); + } } const Sequence< Sequence< OUString > >& m_rComplexRowDescriptions; + Reference< chart2::XChartDocument > m_xChartDoc; + bool m_bDataInColumns; +}; +//-------------------------------------------------------------------------- + +struct lcl_AnyRowDescriptionsOperator : public lcl_Operator +{ + lcl_AnyRowDescriptionsOperator( const Sequence< Sequence< uno::Any > >& rAnyRowDescriptions ) + : lcl_Operator() + , m_rAnyRowDescriptions( rAnyRowDescriptions ) + { + } + + virtual bool setsCategories( bool bDataInColumns ) + { + return bDataInColumns; + } + + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) + { + if( xDataAccess.is() ) + xDataAccess->setAnyRowDescriptions( m_rAnyRowDescriptions ); + } + + const Sequence< Sequence< uno::Any > >& m_rAnyRowDescriptions; }; //-------------------------------------------------------------------------- struct lcl_ColumnDescriptionsOperator : public lcl_Operator { - lcl_ColumnDescriptionsOperator( const Sequence< OUString >& rColumnDescriptions ) + lcl_ColumnDescriptionsOperator( const Sequence< OUString >& rColumnDescriptions + , const Reference< chart2::XChartDocument >& xChartDoc ) : lcl_Operator() , m_rColumnDescriptions( rColumnDescriptions ) + , m_xChartDoc(xChartDoc) + , m_bDataInColumns(true) { } virtual bool setsCategories( bool bDataInColumns ) { + m_bDataInColumns = bDataInColumns; return !bDataInColumns; } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) { if( xDataAccess.is() ) + { xDataAccess->setColumnDescriptions( m_rColumnDescriptions ); + if( !m_bDataInColumns ) + DiagramHelper::switchToTextCategories( m_xChartDoc ); + } } const Sequence< OUString >& m_rColumnDescriptions; + Reference< chart2::XChartDocument > m_xChartDoc; + bool m_bDataInColumns; }; //-------------------------------------------------------------------------- struct lcl_ComplexColumnDescriptionsOperator : public lcl_Operator { - lcl_ComplexColumnDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexColumnDescriptions ) + lcl_ComplexColumnDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexColumnDescriptions + , const Reference< chart2::XChartDocument >& xChartDoc ) : lcl_Operator() , m_rComplexColumnDescriptions( rComplexColumnDescriptions ) + , m_xChartDoc(xChartDoc) + , m_bDataInColumns(true) { } virtual bool setsCategories( bool bDataInColumns ) { + m_bDataInColumns = bDataInColumns; return !bDataInColumns; } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) { if( xDataAccess.is() ) + { xDataAccess->setComplexColumnDescriptions( m_rComplexColumnDescriptions ); + if( !m_bDataInColumns ) + DiagramHelper::switchToTextCategories( m_xChartDoc ); + } } const Sequence< Sequence< OUString > >& m_rComplexColumnDescriptions; + Reference< chart2::XChartDocument > m_xChartDoc; + bool m_bDataInColumns; +}; + +//-------------------------------------------------------------------------- + +struct lcl_AnyColumnDescriptionsOperator : public lcl_Operator +{ + lcl_AnyColumnDescriptionsOperator( const Sequence< Sequence< uno::Any > >& rAnyColumnDescriptions ) + : lcl_Operator() + , m_rAnyColumnDescriptions( rAnyColumnDescriptions ) + { + } + + virtual bool setsCategories( bool bDataInColumns ) + { + return bDataInColumns; + } + + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) + { + if( xDataAccess.is() ) + xDataAccess->setAnyColumnDescriptions( m_rAnyColumnDescriptions ); + } + + const Sequence< Sequence< uno::Any > >& m_rAnyColumnDescriptions; +}; + +//-------------------------------------------------------------------------- + +struct lcl_DateCategoriesOperator : public lcl_Operator +{ + lcl_DateCategoriesOperator( const Sequence< double >& rDates ) + : lcl_Operator() + , m_rDates( rDates ) + { + } + + virtual bool setsCategories( bool /*bDataInColumns*/ ) + { + return true; + } + + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) + { + Reference< XDateCategories > xDateCategories( xDataAccess, uno::UNO_QUERY ); + if( xDateCategories.is() ) + xDateCategories->setDateCategories( m_rDates ); + } + + const Sequence< double >& m_rDates; }; //-------------------------------------------------------------------------- @@ -353,6 +474,7 @@ Sequence< OUString > SAL_CALL ChartDataWrapper::getColumnDescriptions() return m_xDataAccess->getColumnDescriptions(); return Sequence< OUString > (); } + // ____ XComplexDescriptionAccess (read) ____ Sequence< Sequence< OUString > > SAL_CALL ChartDataWrapper::getComplexRowDescriptions() throw (uno::RuntimeException) { @@ -369,6 +491,32 @@ Sequence< Sequence< OUString > > SAL_CALL ChartDataWrapper::getComplexColumnDesc return Sequence< Sequence< OUString > >(); } +// ____ XAnyDescriptionAccess (read) ____ +Sequence< Sequence< uno::Any > > SAL_CALL ChartDataWrapper::getAnyRowDescriptions() throw (uno::RuntimeException) +{ + initDataAccess(); + if( m_xDataAccess.is() ) + return m_xDataAccess->getAnyRowDescriptions(); + return Sequence< Sequence< uno::Any > >(); +} +Sequence< Sequence< uno::Any > > SAL_CALL ChartDataWrapper::getAnyColumnDescriptions() throw (uno::RuntimeException) +{ + initDataAccess(); + if( m_xDataAccess.is() ) + return m_xDataAccess->getAnyColumnDescriptions(); + return Sequence< Sequence< uno::Any > >(); +} + +// ____ XDateCategories (read) ____ +Sequence< double > SAL_CALL ChartDataWrapper::getDateCategories() throw (uno::RuntimeException) +{ + initDataAccess(); + Reference< XDateCategories > xDateCategories( m_xDataAccess, uno::UNO_QUERY ); + if( xDateCategories.is() ) + return xDateCategories->getDateCategories(); + return Sequence< double >(); +} + // ____ XChartDataArray (write)____ void SAL_CALL ChartDataWrapper::setData( const Sequence< Sequence< double > >& rData ) throw (uno::RuntimeException) @@ -379,28 +527,50 @@ void SAL_CALL ChartDataWrapper::setData( const Sequence< Sequence< double > >& r void SAL_CALL ChartDataWrapper::setRowDescriptions( const Sequence< OUString >& rRowDescriptions ) throw (uno::RuntimeException) { - lcl_RowDescriptionsOperator aOperator( rRowDescriptions ); + lcl_RowDescriptionsOperator aOperator( rRowDescriptions, m_spChart2ModelContact->getChart2Document() ); applyData( aOperator ); } void SAL_CALL ChartDataWrapper::setColumnDescriptions( const Sequence< OUString >& rColumnDescriptions ) throw (uno::RuntimeException) { - lcl_ColumnDescriptionsOperator aOperator( rColumnDescriptions ); + lcl_ColumnDescriptionsOperator aOperator( rColumnDescriptions, m_spChart2ModelContact->getChart2Document() ); applyData( aOperator ); } // ____ XComplexDescriptionAccess (write) ____ void SAL_CALL ChartDataWrapper::setComplexRowDescriptions( const Sequence< Sequence< ::rtl::OUString > >& rRowDescriptions ) throw (uno::RuntimeException) { - lcl_ComplexRowDescriptionsOperator aOperator( rRowDescriptions ); + lcl_ComplexRowDescriptionsOperator aOperator( rRowDescriptions, m_spChart2ModelContact->getChart2Document() ); applyData( aOperator ); } void SAL_CALL ChartDataWrapper::setComplexColumnDescriptions( const Sequence< Sequence< ::rtl::OUString > >& rColumnDescriptions ) throw (uno::RuntimeException) { - lcl_ComplexColumnDescriptionsOperator aOperator( rColumnDescriptions ); + lcl_ComplexColumnDescriptionsOperator aOperator( rColumnDescriptions, m_spChart2ModelContact->getChart2Document() ); + applyData( aOperator ); +} + +// ____ XAnyDescriptionAccess (write) ____ +void SAL_CALL ChartDataWrapper::setAnyRowDescriptions( const Sequence< Sequence< uno::Any > >& rRowDescriptions ) throw (uno::RuntimeException) +{ + lcl_AnyRowDescriptionsOperator aOperator( rRowDescriptions ); + applyData( aOperator ); +} +void SAL_CALL ChartDataWrapper::setAnyColumnDescriptions( const Sequence< Sequence< uno::Any > >& rColumnDescriptions ) throw (uno::RuntimeException) +{ + lcl_AnyColumnDescriptionsOperator aOperator( rColumnDescriptions ); applyData( aOperator ); } +// ____ XDateCategories (write) ____ +void SAL_CALL ChartDataWrapper::setDateCategories( const Sequence< double >& rDates ) throw (uno::RuntimeException) +{ + Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() ); + ControllerLockGuard aCtrlLockGuard( uno::Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY )); + lcl_DateCategoriesOperator aOperator( rDates ); + applyData( aOperator ); + DiagramHelper::switchToDateCategories( xChartDoc ); +} + //-------------------------------------------------------------------------------------- // ____ XChartData (base of XChartDataArray) ____ @@ -508,11 +678,11 @@ void ChartDataWrapper::initDataAccess() if( !xChartDoc.is() ) return; if( xChartDoc->hasInternalDataProvider() ) - m_xDataAccess = Reference< XComplexDescriptionAccess >( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW ); + m_xDataAccess = Reference< XAnyDescriptionAccess >( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW ); else { //create a separate "internal data provider" that is not connected to the model - m_xDataAccess = Reference< XComplexDescriptionAccess >( ChartModelHelper::createInternalDataProvider( + m_xDataAccess = Reference< XAnyDescriptionAccess >( ChartModelHelper::createInternalDataProvider( xChartDoc, false /*bConnectToModel*/ ), uno::UNO_QUERY_THROW ); } } @@ -569,30 +739,9 @@ void ChartDataWrapper::applyData( lcl_Operator& rDataOperator ) return; uno::Reference< chart2::data::XDataSource > xSource( xDataProvider->createDataSource( aArguments ) ); - // determine a template - uno::Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY ); - uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram()); - DiagramHelper::tTemplateWithServiceName aTemplateAndService = - DiagramHelper::getTemplateForDiagram( xDia, xFact ); - ::rtl::OUString aServiceName( aTemplateAndService.second ); - uno::Reference< chart2::XChartTypeTemplate > xTemplate = aTemplateAndService.first; - - // (fall-back) - if( ! xTemplate.is()) - { - if( aServiceName.getLength() == 0 ) - aServiceName = C2U("com.sun.star.chart2.template.Column"); - xTemplate.set( xFact->createInstance( aServiceName ), uno::UNO_QUERY ); - } - OSL_ASSERT( xTemplate.is()); - - if( xTemplate.is() && xSource.is()) - { - // argument detection works with internal knowledge of the - // ArrayDataProvider - OSL_ASSERT( xDia.is()); - xTemplate->changeDiagramData( xDia, xSource, aArguments ); - } + uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram() ); + if( xDia.is() ) + xDia->setDiagramData( xSource, aArguments ); //correct stacking mode if( bStacked || bPercent || bDeep ) diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx index d56397953d79..16695914f892 100644..100755 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx @@ -29,9 +29,10 @@ #include "ServiceMacros.hxx" #include "MutexContainer.hxx" -#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase5.hxx> #include <cppuhelper/interfacecontainer.hxx> -#include <com/sun/star/chart/XComplexDescriptionAccess.hpp> +#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp> +#include <com/sun/star/chart/XDateCategories.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -48,8 +49,9 @@ class Chart2ModelContact; struct lcl_Operator; class ChartDataWrapper : public MutexContainer, public - ::cppu::WeakImplHelper4< - com::sun::star::chart::XComplexDescriptionAccess, + ::cppu::WeakImplHelper5< + com::sun::star::chart2::XAnyDescriptionAccess, + com::sun::star::chart::XDateCategories, com::sun::star::lang::XServiceInfo, com::sun::star::lang::XEventListener, com::sun::star::lang::XComponent > @@ -64,7 +66,25 @@ public: APPHELPER_XSERVICEINFO_DECL() protected: - // ____ XComplexDescriptionAccess ____ + // ____ XDateCategories ____ + virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getDateCategories() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDateCategories( const ::com::sun::star::uno::Sequence< double >& rDates ) throw (::com::sun::star::uno::RuntimeException); + + // ____ XAnyDescriptionAccess ____ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL + getAnyRowDescriptions() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAnyRowDescriptions( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aRowDescriptions ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL + getAnyColumnDescriptions() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAnyColumnDescriptions( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aColumnDescriptions ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XComplexDescriptionAccess (base of XAnyDescriptionAccess) ____ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getComplexRowDescriptions() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setComplexRowDescriptions( @@ -136,7 +156,7 @@ private: //methods private: //member ::com::sun::star::uno::Reference< - ::com::sun::star::chart::XComplexDescriptionAccess > m_xDataAccess; + ::com::sun::star::chart2::XAnyDescriptionAccess > m_xDataAccess; ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index e8d91cd6c124..42d5667b7d82 100755 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -56,11 +56,9 @@ #include "WrappedAddInProperty.hxx" #include "WrappedIgnoreProperty.hxx" #include "ChartRenderer.hxx" -#include "UndoManager.hxx" #include <com/sun/star/chart2/XTitled.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> -#include <com/sun/star/chart/XComplexDescriptionAccess.hpp> #include <comphelper/InlineContainer.hxx> // header for function SvxShapeCollection_NewInstance #include <svx/unoshcol.hxx> @@ -81,8 +79,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart; -using ::com::sun::star::chart::XComplexDescriptionAccess; using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::beans::Property; @@ -1413,12 +1411,6 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( xResult.set( m_xChartView ); bServiceFound = true; } - else if ( aServiceSpecifier.equals( CHART_UNDOMANAGER_SERVICE_NAME ) ) - { - Reference< chart2::XUndoManager > xUndoManager( new UndoManager() ); - xResult.set( xUndoManager ); - bServiceFound = true; - } else { // try to create a shape diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index c174614a0bf3..e365edb7bd46 100755 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -30,14 +30,11 @@ #include "DiagramWrapper.hxx" #include "macros.hxx" #include "servicenames_charttypes.hxx" -#include "TitleWrapper.hxx" #include "DataSeriesPointWrapper.hxx" #include "AxisWrapper.hxx" #include "AxisHelper.hxx" #include "Chart2ModelContact.hxx" #include "PositionAndSizeHelper.hxx" -#include "TitleHelper.hxx" -#include "GridWrapper.hxx" #include "WallFloorWrapper.hxx" #include "MinMaxLineWrapper.hxx" #include "UpDownBarWrapper.hxx" @@ -88,6 +85,7 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Sequence; using ::com::sun::star::beans::Property; +using ::com::sun::star::chart::XAxis; using ::osl::MutexGuard; using ::rtl::OUString; @@ -884,193 +882,209 @@ void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxesAndAxisTitles( cons return m_spChart2ModelContact->GetDiagramRectangleIncludingTitle(); } -// ____ XAxisZSupplier ____ -Reference< - drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle() +// ____ XAxisSupplier ____ +Reference< XAxis > SAL_CALL DiagramWrapper::getAxis( sal_Int32 nDimensionIndex ) throw (uno::RuntimeException) { - if( !m_xZAxisTitle.is() ) + Reference< XAxis > xAxis; + if(!nDimensionIndex) + { + if( !m_xXAxis.is() ) + m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact ); + xAxis = m_xXAxis; + } + else if(1==nDimensionIndex) + { + if( !m_xYAxis.is() ) + m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact ); + xAxis = m_xYAxis; + } + else if(2==nDimensionIndex) { - m_xZAxisTitle = new TitleWrapper( TitleHelper::Z_AXIS_TITLE, m_spChart2ModelContact ); + if( !m_xZAxis.is() ) + m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact ); + xAxis = m_xZAxis; } - return m_xZAxisTitle; + return xAxis; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getZMainGrid() +Reference< XAxis > SAL_CALL DiagramWrapper::getSecondaryAxis( sal_Int32 nDimensionIndex ) throw (uno::RuntimeException) { - if( ! m_xZMainGrid.is()) + Reference< XAxis > xAxis; + if(!nDimensionIndex) { - m_xZMainGrid = new GridWrapper( GridWrapper::Z_MAIN_GRID, m_spChart2ModelContact ); + if( !m_xSecondXAxis.is() ) + m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact ); + xAxis = m_xSecondXAxis; } - return m_xZMainGrid; + else if(1==nDimensionIndex) + { + if( !m_xSecondYAxis.is() ) + m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact ); + xAxis = m_xSecondYAxis; + } + return xAxis; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getZHelpGrid() +// ____ XAxisZSupplier ____ +Reference< drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle() throw (uno::RuntimeException) { - if( !m_xZHelpGrid.is() ) - { - m_xZHelpGrid = new GridWrapper( GridWrapper::Z_SUB_GRID, m_spChart2ModelContact ); - } - return m_xZHelpGrid; + Reference< drawing::XShape > xRet; + Reference< XAxis > xAxis( getAxis(2) ); + if( xAxis.is() ) + xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); + return xRet; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZMainGrid() + throw (uno::RuntimeException) +{ + Reference< beans::XPropertySet > xRet; + Reference< XAxis > xAxis( getAxis(2) ); + if( xAxis.is() ) + xRet = xAxis->getMajorGrid(); + return xRet; +} + +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZHelpGrid() + throw (uno::RuntimeException) +{ + Reference< beans::XPropertySet > xRet; + Reference< XAxis > xAxis( getAxis(2) ); + if( xAxis.is() ) + xRet = xAxis->getMinorGrid(); + return xRet; +} + +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis() throw (uno::RuntimeException) { if( ! m_xZAxis.is()) - { m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact ); - } - return m_xZAxis; + return Reference< beans::XPropertySet >( m_xZAxis, uno::UNO_QUERY ); } // ____ XTwoAxisXSupplier ____ -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis() throw (uno::RuntimeException) { if( ! m_xSecondXAxis.is()) - { m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact ); - } - return m_xSecondXAxis; + return Reference< beans::XPropertySet >( m_xSecondXAxis, uno::UNO_QUERY ); } // ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____ -Reference< - drawing::XShape > SAL_CALL DiagramWrapper::getXAxisTitle() +Reference< drawing::XShape > SAL_CALL DiagramWrapper::getXAxisTitle() throw (uno::RuntimeException) { - - if( !m_xXAxisTitle.is() ) - { - m_xXAxisTitle = new TitleWrapper( TitleHelper::X_AXIS_TITLE, m_spChart2ModelContact ); - } - return m_xXAxisTitle; + Reference< drawing::XShape > xRet; + Reference< XAxis > xAxis( getAxis(0) ); + if( xAxis.is() ) + xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); + return xRet; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getXAxis() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXAxis() throw (uno::RuntimeException) { if( ! m_xXAxis.is()) - { m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact ); - } - - return m_xXAxis; + return Reference< beans::XPropertySet >( m_xXAxis, uno::UNO_QUERY ); } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getXMainGrid() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXMainGrid() throw (uno::RuntimeException) { - if( ! m_xXMainGrid.is()) - { - m_xXMainGrid = new GridWrapper( GridWrapper::X_MAIN_GRID, m_spChart2ModelContact ); - } - - return m_xXMainGrid; + Reference< beans::XPropertySet > xRet; + Reference< XAxis > xAxis( getAxis(0) ); + if( xAxis.is() ) + xRet = xAxis->getMajorGrid(); + return xRet; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getXHelpGrid() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXHelpGrid() throw (uno::RuntimeException) { - if( ! m_xXHelpGrid.is()) - { - m_xXHelpGrid = new GridWrapper( GridWrapper::X_SUB_GRID, m_spChart2ModelContact ); - } - return m_xXHelpGrid; + Reference< beans::XPropertySet > xRet; + Reference< XAxis > xAxis( getAxis(0) ); + if( xAxis.is() ) + xRet = xAxis->getMinorGrid(); + return xRet; } // ____ XTwoAxisYSupplier ____ -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryYAxis() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryYAxis() throw (uno::RuntimeException) { if( ! m_xSecondYAxis.is()) - { m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact ); - } - return m_xSecondYAxis; + return Reference< beans::XPropertySet >( m_xSecondYAxis, uno::UNO_QUERY ); } // ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____ -Reference< - drawing::XShape > SAL_CALL DiagramWrapper::getYAxisTitle() +Reference< drawing::XShape > SAL_CALL DiagramWrapper::getYAxisTitle() throw (uno::RuntimeException) { - if( !m_xYAxisTitle.is() ) - { - m_xYAxisTitle = new TitleWrapper( TitleHelper::Y_AXIS_TITLE, m_spChart2ModelContact ); - } - return m_xYAxisTitle; + Reference< drawing::XShape > xRet; + Reference< XAxis > xAxis( getAxis(1) ); + if( xAxis.is() ) + xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); + return xRet; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getYAxis() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYAxis() throw (uno::RuntimeException) { if( ! m_xYAxis.is()) - { m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact ); - } - return m_xYAxis; + return Reference< beans::XPropertySet >( m_xYAxis, uno::UNO_QUERY ); } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getYHelpGrid() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid() throw (uno::RuntimeException) { - if( ! m_xYHelpGrid.is()) - { - m_xYHelpGrid = new GridWrapper( GridWrapper::Y_SUB_GRID, m_spChart2ModelContact ); - } - return m_xYHelpGrid; + Reference< beans::XPropertySet > xRet; + Reference< XAxis > xAxis( getAxis(1) ); + if( xAxis.is() ) + xRet = xAxis->getMajorGrid(); + return xRet; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYHelpGrid() throw (uno::RuntimeException) { - if( ! m_xYMainGrid.is()) - { - m_xYMainGrid = new GridWrapper( GridWrapper::Y_MAIN_GRID, m_spChart2ModelContact ); - } - return m_xYMainGrid; + Reference< beans::XPropertySet > xRet; + Reference< XAxis > xAxis( getAxis(1) ); + if( xAxis.is() ) + xRet = xAxis->getMinorGrid(); + return xRet; } // ____ XSecondAxisTitleSupplier ____ -Reference< - drawing::XShape > SAL_CALL DiagramWrapper::getSecondXAxisTitle() +Reference< drawing::XShape > SAL_CALL DiagramWrapper::getSecondXAxisTitle() throw (uno::RuntimeException) { - if( !m_xSecondXAxisTitle.is() ) - { - m_xSecondXAxisTitle = new TitleWrapper( TitleHelper::SECONDARY_X_AXIS_TITLE, m_spChart2ModelContact ); - } - return m_xSecondXAxisTitle; + Reference< drawing::XShape > xRet; + Reference< XAxis > xAxis( getSecondaryAxis(0) ); + if( xAxis.is() ) + xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); + return xRet; } -Reference< - drawing::XShape > SAL_CALL DiagramWrapper::getSecondYAxisTitle() +Reference< drawing::XShape > SAL_CALL DiagramWrapper::getSecondYAxisTitle() throw (uno::RuntimeException) { - if( !m_xSecondYAxisTitle.is() ) - { - m_xSecondYAxisTitle = new TitleWrapper( TitleHelper::SECONDARY_Y_AXIS_TITLE, m_spChart2ModelContact ); - } - return m_xSecondYAxisTitle; + Reference< drawing::XShape > xRet; + Reference< XAxis > xAxis( getSecondaryAxis(1) ); + if( xAxis.is() ) + xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); + return xRet; } // ____ XStatisticDisplay ____ @@ -1163,22 +1177,11 @@ void SAL_CALL DiagramWrapper::dispose() // /-- MutexGuard aGuard( GetMutex()); - DisposeHelper::DisposeAndClear( m_xXAxisTitle ); - DisposeHelper::DisposeAndClear( m_xYAxisTitle ); - DisposeHelper::DisposeAndClear( m_xZAxisTitle ); - DisposeHelper::DisposeAndClear( m_xSecondXAxisTitle ); - DisposeHelper::DisposeAndClear( m_xSecondYAxisTitle ); DisposeHelper::DisposeAndClear( m_xXAxis ); DisposeHelper::DisposeAndClear( m_xYAxis ); DisposeHelper::DisposeAndClear( m_xZAxis ); DisposeHelper::DisposeAndClear( m_xSecondXAxis ); DisposeHelper::DisposeAndClear( m_xSecondYAxis ); - DisposeHelper::DisposeAndClear( m_xXMainGrid ); - DisposeHelper::DisposeAndClear( m_xYMainGrid ); - DisposeHelper::DisposeAndClear( m_xZMainGrid ); - DisposeHelper::DisposeAndClear( m_xXHelpGrid ); - DisposeHelper::DisposeAndClear( m_xYHelpGrid ); - DisposeHelper::DisposeAndClear( m_xZHelpGrid ); DisposeHelper::DisposeAndClear( m_xWall ); DisposeHelper::DisposeAndClear( m_xFloor ); DisposeHelper::DisposeAndClear( m_xMinMaxLineWrapper ); @@ -2147,3 +2150,4 @@ APPHELPER_XSERVICEINFO_IMPL( DiagramWrapper, lcl_aServiceName ); } // namespace wrapper } // namespace chart + diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx index 111e24bd6a8b..678041420cf3 100644..100755 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx @@ -30,7 +30,13 @@ #include "WrappedPropertySet.hxx" #include "ServiceMacros.hxx" #include "DiagramHelper.hxx" -#include <cppuhelper/implbase12.hxx> + +#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13) +#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13 +#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 13 +#include "comphelper/implbase_var.hxx" +#endif + #include <comphelper/uno3.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -41,6 +47,7 @@ #include <com/sun/star/chart2/XChartTypeTemplate.hpp> #include <com/sun/star/chart2/XChartTypeManager.hpp> #include <com/sun/star/chart/XDiagram.hpp> +#include <com/sun/star/chart/XAxisSupplier.hpp> #include <com/sun/star/chart/XAxisZSupplier.hpp> #include <com/sun/star/chart/XTwoAxisXSupplier.hpp> #include <com/sun/star/chart/XTwoAxisYSupplier.hpp> @@ -56,15 +63,15 @@ namespace chart { - namespace wrapper { class Chart2ModelContact; -class DiagramWrapper : public ::cppu::ImplInheritanceHelper12< +class DiagramWrapper : public ::comphelper::ImplInheritanceHelper13< WrappedPropertySet , ::com::sun::star::chart::XDiagram + , ::com::sun::star::chart::XAxisSupplier , ::com::sun::star::chart::XAxisZSupplier , ::com::sun::star::chart::XTwoAxisXSupplier // : XAxisXSupplier , ::com::sun::star::chart::XTwoAxisYSupplier // : XAxisYSupplier @@ -123,6 +130,14 @@ public: virtual ::rtl::OUString SAL_CALL getShapeType() throw (::com::sun::star::uno::RuntimeException); + // ____ XAxisSupplier ____ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::chart::XAxis > SAL_CALL getAxis( sal_Int32 nDimensionIndex ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::chart::XAxis > SAL_CALL getSecondaryAxis( sal_Int32 nDimensionIndex ) + throw (::com::sun::star::uno::RuntimeException); + // ____ XAxisZSupplier ____ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL getZAxisTitle() @@ -244,72 +259,27 @@ private: ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShape > - m_xXAxisTitle; - ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShape > - m_xYAxisTitle; - ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShape > - m_xZAxisTitle; - ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShape > - m_xSecondXAxisTitle; - ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShape > - m_xSecondYAxisTitle; - - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xXAxis; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xYAxis; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xZAxis; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xSecondXAxis; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xSecondYAxis; - - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xXMainGrid; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xYMainGrid; + ::com::sun::star::chart::XAxis > m_xXAxis; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xZMainGrid; + ::com::sun::star::chart::XAxis > m_xYAxis; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xXHelpGrid; + ::com::sun::star::chart::XAxis > m_xZAxis; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xYHelpGrid; + ::com::sun::star::chart::XAxis > m_xSecondXAxis; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xZHelpGrid; + ::com::sun::star::chart::XAxis > m_xSecondYAxis; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xWall; + ::com::sun::star::beans::XPropertySet > m_xWall; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xFloor; + ::com::sun::star::beans::XPropertySet > m_xFloor; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xMinMaxLineWrapper; + ::com::sun::star::beans::XPropertySet > m_xMinMaxLineWrapper; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xUpBarWrapper; + ::com::sun::star::beans::XPropertySet > m_xUpBarWrapper; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xDownBarWrapper; + ::com::sun::star::beans::XPropertySet > m_xDownBarWrapper; }; } // namespace wrapper diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx index 6586511424db..51c269d7dd40 100755 --- a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx @@ -112,17 +112,17 @@ void GridWrapper::getDimensionAndSubGridBool( tGridType eType, sal_Int32& rnDime switch( eType ) { - case X_MAIN_GRID: + case X_MAJOR_GRID: rnDimensionIndex = 0; rbSubGrid = false; break; - case Y_MAIN_GRID: + case Y_MAJOR_GRID: rnDimensionIndex = 1; rbSubGrid = false; break; - case Z_MAIN_GRID: + case Z_MAJOR_GRID: rnDimensionIndex = 2; rbSubGrid = false; break; - case X_SUB_GRID: + case X_MINOR_GRID: rnDimensionIndex = 0; rbSubGrid = true; break; - case Y_SUB_GRID: + case Y_MINOR_GRID: rnDimensionIndex = 1; rbSubGrid = true; break; - case Z_SUB_GRID: + case Z_MINOR_GRID: rnDimensionIndex = 2; rbSubGrid = true; break; } } @@ -209,3 +209,4 @@ APPHELPER_XSERVICEINFO_IMPL( GridWrapper, lcl_aServiceName ); } // namespace wrapper } // namespace chart + diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx index c731b6c22666..653c46353676 100644..100755 --- a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx @@ -42,7 +42,6 @@ namespace chart { - namespace wrapper { @@ -57,12 +56,12 @@ class GridWrapper : public ::cppu::ImplInheritanceHelper2< public: enum tGridType { - X_MAIN_GRID, - Y_MAIN_GRID, - Z_MAIN_GRID, - X_SUB_GRID, - Y_SUB_GRID, - Z_SUB_GRID + X_MAJOR_GRID, + Y_MAJOR_GRID, + Z_MAJOR_GRID, + X_MINOR_GRID, + Y_MINOR_GRID, + Z_MINOR_GRID }; GridWrapper( tGridType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx index a89ca372d9ee..64773ad062f9 100755 --- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx @@ -33,9 +33,8 @@ #include "CommonConverters.hxx" #include "AxisHelper.hxx" #include <com/sun/star/chart2/XAxis.hpp> -#include <com/sun/star/chart2/ExplicitIncrementData.hpp> -#include <com/sun/star/chart2/ExplicitScaleData.hpp> -#include <com/sun/star/chart2/AxisOrientation.hpp> +#include <com/sun/star/chart/ChartAxisType.hpp> +#include <chartview/ExplicitScaleValues.hxx> using namespace ::com::sun::star; using ::com::sun::star::uno::Any; @@ -43,6 +42,7 @@ using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::rtl::OUString; +using ::com::sun::star::chart::TimeIncrement; //............................................................................. namespace chart @@ -91,6 +91,15 @@ WrappedScaleProperty::WrappedScaleProperty( tScaleProperty eScaleProperty case SCALE_PROP_AUTO_STEPHELP: m_aOuterName = C2U("AutoStepHelp"); break; + case SCALE_PROP_AXIS_TYPE: + m_aOuterName = C2U("AxisType"); + break; + case SCALE_PROP_DATE_INCREMENT: + m_aOuterName = C2U("TimeIncrement"); + break; + case SCALE_PROP_EXPLICIT_DATE_INCREMENT: + m_aOuterName = C2U("ExplicitTimeIncrement"); + break; case SCALE_PROP_LOGARITHMIC: m_aOuterName = C2U("Logarithmic"); break; @@ -121,6 +130,9 @@ void WrappedScaleProperty::addWrappedProperties( std::vector< WrappedProperty* > rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_ORIGIN, spChart2ModelContact ) ); rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_STEPMAIN, spChart2ModelContact ) ); rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_STEPHELP, spChart2ModelContact ) ); + rList.push_back( new WrappedScaleProperty( SCALE_PROP_AXIS_TYPE, spChart2ModelContact ) ); + rList.push_back( new WrappedScaleProperty( SCALE_PROP_DATE_INCREMENT, spChart2ModelContact ) ); + rList.push_back( new WrappedScaleProperty( SCALE_PROP_EXPLICIT_DATE_INCREMENT, spChart2ModelContact ) ); rList.push_back( new WrappedScaleProperty( SCALE_PROP_LOGARITHMIC, spChart2ModelContact ) ); rList.push_back( new WrappedScaleProperty( SCALE_PROP_REVERSEDIRECTION, spChart2ModelContact ) ); } @@ -265,6 +277,43 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons bSetScaleData = true; break; } + case SCALE_PROP_AXIS_TYPE: + { + sal_Int32 nType = 0; + if( (rOuterValue >>= nType) ) + { + if( ::com::sun::star::chart::ChartAxisType::AUTOMATIC == nType ) + { + aScaleData.AutoDateAxis = true; + if( aScaleData.AxisType == AxisType::DATE ) + aScaleData.AxisType = AxisType::CATEGORY; + } + else if( ::com::sun::star::chart::ChartAxisType::CATEGORY == nType ) + { + aScaleData.AutoDateAxis = false; + if( aScaleData.AxisType == AxisType::DATE ) + aScaleData.AxisType = AxisType::CATEGORY; + } + else if( ::com::sun::star::chart::ChartAxisType::DATE == nType ) + { + if( aScaleData.AxisType == AxisType::CATEGORY ) + aScaleData.AxisType = AxisType::DATE; + } + bSetScaleData = true; + } + break; + } + case SCALE_PROP_DATE_INCREMENT: + { + TimeIncrement aTimeIncrement; + rOuterValue >>= aTimeIncrement; + aScaleData.TimeIncrement = aTimeIncrement; + bSetScaleData = true; + break; + } + case SCALE_PROP_EXPLICIT_DATE_INCREMENT: + //read only property + break; case SCALE_PROP_LOGARITHMIC: { if( rOuterValue >>= bBool ) @@ -319,8 +368,8 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const chart2::ScaleData aScaleData( xAxis->getScaleData() ); - chart2::ExplicitScaleData aExplicitScale; - chart2::ExplicitIncrementData aExplicitIncrement; + ExplicitScaleData aExplicitScale; + ExplicitIncrementData aExplicitIncrement; switch( eScaleProperty ) { @@ -400,7 +449,8 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const { m_spChart2ModelContact->getExplicitValuesForAxis( xAxis, aExplicitScale, aExplicitIncrement ); - if( aExplicitIncrement.SubIncrements.getLength() > 0 && + + if( !aExplicitIncrement.SubIncrements.empty() && aExplicitIncrement.SubIncrements[ 0 ].IntervalCount > 0 ) { if( bLogarithmic ) @@ -439,7 +489,7 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const if( bNeedToCalculateExplicitValues ) { m_spChart2ModelContact->getExplicitValuesForAxis( xAxis, aExplicitScale, aExplicitIncrement ); - if( aExplicitIncrement.SubIncrements.getLength() > 0 ) + if( !aExplicitIncrement.SubIncrements.empty() ) nIntervalCount = aExplicitIncrement.SubIncrements[ 0 ].IntervalCount; } aRet = uno::makeAny( nIntervalCount ); @@ -485,6 +535,46 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const aRet <<= !hasDoubleValue(aScaleData.Origin); break; } + case SCALE_PROP_AXIS_TYPE: + { + sal_Int32 nType = ::com::sun::star::chart::ChartAxisType::AUTOMATIC; + if( aScaleData.AxisType == AxisType::DATE ) + { + nType = ::com::sun::star::chart::ChartAxisType::DATE; + } + else if( aScaleData.AxisType == AxisType::CATEGORY ) + { + if( !aScaleData.AutoDateAxis ) + nType = ::com::sun::star::chart::ChartAxisType::CATEGORY; + } + aRet = uno::makeAny( nType ); + break; + } + case SCALE_PROP_DATE_INCREMENT: + { + if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis ) + aRet = uno::makeAny( aScaleData.TimeIncrement ); + break; + } + case SCALE_PROP_EXPLICIT_DATE_INCREMENT: + { + if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis ) + { + m_spChart2ModelContact->getExplicitValuesForAxis( xAxis, aExplicitScale, aExplicitIncrement ); + if( aExplicitScale.AxisType == AxisType::DATE ) + { + TimeIncrement aTimeIncrement; + aTimeIncrement.MajorTimeInterval = uno::makeAny( aExplicitIncrement.MajorTimeInterval ); + aTimeIncrement.MinorTimeInterval = uno::makeAny( aExplicitIncrement.MinorTimeInterval ); + aTimeIncrement.TimeResolution = uno::makeAny( aExplicitScale.TimeResolution ); + aRet = uno::makeAny(aTimeIncrement); + } + } + + if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis ) + aRet = uno::makeAny( aScaleData.TimeIncrement ); + break; + } case SCALE_PROP_LOGARITHMIC: { aRet <<= static_cast< sal_Bool >( AxisHelper::isLogarithmic(aScaleData.Scaling) ); @@ -506,5 +596,5 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const } } // namespace wrapper -} //namespace chart +} // namespace chart //............................................................................. diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx index 4d29bc009777..8df55339a46e 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx +++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx @@ -55,6 +55,9 @@ public: , SCALE_PROP_AUTO_ORIGIN , SCALE_PROP_AUTO_STEPMAIN , SCALE_PROP_AUTO_STEPHELP + , SCALE_PROP_AXIS_TYPE + , SCALE_PROP_DATE_INCREMENT + , SCALE_PROP_EXPLICIT_DATE_INCREMENT , SCALE_PROP_LOGARITHMIC , SCALE_PROP_REVERSEDIRECTION }; |