diff options
author | Ingrid Halama <iha@openoffice.org> | 2010-03-15 13:09:41 +0100 |
---|---|---|
committer | Ingrid Halama <iha@openoffice.org> | 2010-03-15 13:09:41 +0100 |
commit | 8195643ff81f7a60e46522767c6b6483713f4af1 (patch) | |
tree | 42e3e2502b344817a441aa114b404cfbf2e676ef /chart2/source/tools/DiagramHelper.cxx | |
parent | 590a1a5225623eb922e63b02b62e711d153e9d55 (diff) | |
parent | f2cf0b3fde3d8577260c8b12e380d23a27dbae17 (diff) |
chart43: merge with DEV300_m75
Diffstat (limited to 'chart2/source/tools/DiagramHelper.cxx')
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 66 |
1 files changed, 19 insertions, 47 deletions
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index a0863a288005..b95e7522943e 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -35,7 +35,9 @@ #include "AxisHelper.hxx" #include "ContainerHelper.hxx" #include "ChartTypeHelper.hxx" +#include "ChartModelHelper.hxx" #include "CommonConverters.hxx" +#include "ExplicitCategoriesProvider.hxx" #include "servicenames_charttypes.hxx" #include <com/sun/star/chart/MissingValueTreatment.hpp> @@ -961,8 +963,7 @@ Reference< data::XLabeledDataSequence > return xResult; } -//static -void DiagramHelper::generateAutomaticCategoriesFromChartType( +void lcl_generateAutomaticCategoriesFromChartType( Sequence< rtl::OUString >& rRet, const Reference< XChartType >& xChartType ) { @@ -992,64 +993,35 @@ void DiagramHelper::generateAutomaticCategoriesFromChartType( } } -//static -Sequence< rtl::OUString > DiagramHelper::generateAutomaticCategories( - const Reference< XChartDocument >& xChartDoc ) +Sequence< rtl::OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( const Reference< XCoordinateSystem > & xCooSys ) { Sequence< rtl::OUString > aRet; - if(xChartDoc.is()) + + Reference< XChartTypeContainer > xTypeCntr( xCooSys, uno::UNO_QUERY ); + if( xTypeCntr.is() ) { - uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram() ); - if(xDia.is()) + Sequence< Reference< XChartType > > aChartTypes( xTypeCntr->getChartTypes() ); + for( sal_Int32 nN=0; nN<aChartTypes.getLength(); nN++ ) { - Reference< data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDia ) ); - if( xCategories.is() ) - aRet = DataSequenceToStringSequence(xCategories->getValues()); - if( !aRet.getLength() ) - { - /* - //unused ranges are very problematic as they bear the risk to damage the rectangular structure completly - if( bUseUnusedDataAlso ) - { - Sequence< Reference< chart2::data::XLabeledDataSequence > > aUnusedSequences( xDia->getUnusedData() ); - ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aUnusedCategoryVector( - DataSeriesHelper::getAllDataSequencesByRole( aUnusedSequences, C2U("categories") ) ); - if( aUnusedCategoryVector.size() && aUnusedCategoryVector[0].is() ) - aRet = DataSequenceToStringSequence(aUnusedCategoryVector[0]->getValues()); - } - */ - if( !aRet.getLength() ) - { - Reference< XCoordinateSystemContainer > xCooSysCnt( xDia, uno::UNO_QUERY ); - if( xCooSysCnt.is() ) - { - Sequence< Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() ); - if( aCooSysSeq.getLength() ) - aRet = DiagramHelper::generateAutomaticCategories( aCooSysSeq[0] ); - } - } - } + lcl_generateAutomaticCategoriesFromChartType( aRet, aChartTypes[nN] ); + if( aRet.getLength() ) + return aRet; } } return aRet; } //static -Sequence< rtl::OUString > DiagramHelper::generateAutomaticCategories( - const Reference< XCoordinateSystem > & xCooSys ) +Sequence< rtl::OUString > DiagramHelper::getExplicitSimpleCategories( + const Reference< XChartDocument >& xChartDoc ) { Sequence< rtl::OUString > aRet; - - Reference< XChartTypeContainer > xTypeCntr( xCooSys, uno::UNO_QUERY ); - if( xTypeCntr.is() ) + uno::Reference< frame::XModel > xChartModel( xChartDoc, uno::UNO_QUERY ); + if(xChartModel.is()) { - Sequence< Reference< XChartType > > aChartTypes( xTypeCntr->getChartTypes() ); - for( sal_Int32 nN=0; nN<aChartTypes.getLength(); nN++ ) - { - DiagramHelper::generateAutomaticCategoriesFromChartType( aRet, aChartTypes[nN] ); - if( aRet.getLength() ) - return aRet; - } + uno::Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartModel ) ); + ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, xChartModel ); + aRet = aExplicitCategoriesProvider.getSimpleCategories(); } return aRet; } |