diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx index f8dd29bcc8af..679c304cd17f 100644 --- a/chart2/source/inc/DataSeriesHelper.hxx +++ b/chart2/source/inc/DataSeriesHelper.hxx @@ -4,9 +4,9 @@ * * $RCSfile: DataSeriesHelper.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: rt $ $Date: 2005-09-08 00:39:11 $ + * last change: $Author: vg $ $Date: 2007-05-22 18:14:57 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -35,32 +35,171 @@ #ifndef CHART2_DATASERIESHELPER_HXX #define CHART2_DATASERIESHELPER_HXX -#ifndef _COM_SUN_STAR_CHART2_XDATASEQUENCE_HPP_ -#include +#ifndef _COM_SUN_STAR_CHART2_DATA_XDATASEQUENCE_HPP_ +#include #endif -#ifndef _COM_SUN_STAR_CHART2_XDATASOURCE_HPP_ -#include +#ifndef _COM_SUN_STAR_CHART2_DATA_XDATASOURCE_HPP_ +#include #endif +#ifndef _COM_SUN_STAR_CHART2_XDATASERIES_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_CHART2_XDIAGRAM_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_CHART2_XCOORDINATESYSTEM_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_CHART2_XCHARTTYPE_HPP_ +#include +#endif + +#include "StackMode.hxx" + +#include +#include namespace chart { namespace DataSeriesHelper { - /** Retrieves the data sequence in the given data source that matches the - given role. If more than one sequences match the role, the first match - is returned. If no sequence matches, an empty reference is returned. - @param aSource - The data source containing all data sequences to be searched through. +::rtl::OUString GetRole( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence >& xLabeledDataSequence ); - @param aRole - The role that is to be filtered out. - */ -::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSequence > +void SetRole( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence >& xLabeledDataSequence, + const ::rtl::OUString& rRole ); + +/** Retrieves the data sequence in the given data source that matches the + given role. If more than one sequences match the role, the first match + is returned. If no sequence matches, an empty reference is returned. + + @param aSource + The data source containing all data sequences to be searched through. + + @param aRole + The role that is to be filtered out. +*/ +::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > getDataSequenceByRole( const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XDataSource > & xSource, - ::rtl::OUString aRole ); + ::com::sun::star::chart2::data::XDataSource > & xSource, + ::rtl::OUString aRole, + bool bMatchPrefix = false ); + +/** Retrieves all data sequences in the given data source that match the given + role. + + @param aSource + The data source containing all data sequences to be searched through. + + @param aRole + The role that is to be filtered out. +*/ +::std::vector< + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > + getAllDataSequencesByRole( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > > & aDataSequences, + ::rtl::OUString aRole, + bool bMatchPrefix = false ); + +/** Retrieves all data sequences found in the given data series and puts them + into a data source. The order of sequences will match the order of the data + series. + */ +::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSource > + getDataSource( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > > & aSeries ); + + +/** Get the label of a series (e.g. for the legend) + + @param rLabelSequenceRole + The data sequence contained in xSeries that has this role will be used + to take its label. + */ +::rtl::OUString getDataSeriesLabel( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::rtl::OUString & rLabelSequenceRole ); + +/** Get the label of a labeled sequence including neccessary automatic generation + */ +::rtl::OUString getLabelForLabeledDataSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > & xLabeledSeq ); + +/** Retrieves the stackmode of a DataSeries. If the series have differing stack + modes, the StackMode StackMode_AMBIGUOUS is returned. + + @param xCorrespondingCoordinateSystem + The coordinate system in which the given data series are located. (This + is needed for determining percent stacking. If omitted, the result will + just indicate "not stacked", "stacked" or "ambiguous") + */ +StackMode getStackModeFromSeries( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > & aSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem = + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >() + ); + +void setStackModeAtSeries( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > & aSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem, + StackMode eStackMode ); + +sal_Int32 getAttachedAxisIndex( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries ); + +/// @param nAxisIndex, if -1 it is determined by the given data series via getAttachedAxisIndex +sal_Int32 getNumberFormatKeyFromAxis( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem, + sal_Int32 nDimensionIndex, + sal_Int32 nAxisIndex = -1 ); + +::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > + getCoordinateSystemOfSeries( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > & xDiagram ); + +::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > + getChartTypeOfSeries( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > & xDiagram ); + +void deleteSeries( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > & xChartType ); + +void switchSymbolsOnOrOff( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xSeriesProperties, + bool bSymbolsOn, sal_Int32 nSeriesIndex ); + +void switchLinesOnOrOff( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xSeriesProperties, + bool bLinesOn ); + +void setPropertyAlsoToAllAttributedDataPoints( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries, + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Any& rPropertyValue ); } // namespace DataSeriesHelper } // namespace chart