1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DataSeriesHelper.hxx,v $
10 * $Revision: 1.7.24.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef CHART2_DATASERIESHELPER_HXX
31 #define CHART2_DATASERIESHELPER_HXX
33 #include <com/sun/star/chart2/data/XDataSequence.hpp>
34 #include <com/sun/star/chart2/data/XDataSource.hpp>
35 #include <com/sun/star/chart2/XDataSeries.hpp>
36 #include <com/sun/star/chart2/XDiagram.hpp>
37 #include <com/sun/star/chart2/XCoordinateSystem.hpp>
38 #include <com/sun/star/chart2/XChartType.hpp>
40 #include "StackMode.hxx"
41 #include "charttoolsdllapi.hxx"
50 namespace DataSeriesHelper
53 ::rtl::OUString
GetRole(
54 const ::com::sun::star::uno::Reference
<
55 ::com::sun::star::chart2::data::XLabeledDataSequence
>& xLabeledDataSequence
);
57 /** Retrieves the data sequence in the given data source that matches the
58 given role. If more than one sequences match the role, the first match
59 is returned. If no sequence matches, an empty reference is returned.
62 The data source containing all data sequences to be searched through.
65 The role that is to be filtered out.
67 OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XLabeledDataSequence
>
68 getDataSequenceByRole( const ::com::sun::star::uno::Reference
<
69 ::com::sun::star::chart2::data::XDataSource
> & xSource
,
70 ::rtl::OUString aRole
,
71 bool bMatchPrefix
= false );
73 /** Retrieves all data sequences in the given data source that match the given
77 The data source containing all data sequences to be searched through.
80 The role that is to be filtered out.
82 OOO_DLLPUBLIC_CHARTTOOLS ::std::vector
<
83 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XLabeledDataSequence
> >
84 getAllDataSequencesByRole( const ::com::sun::star::uno::Sequence
<
85 ::com::sun::star::uno::Reference
<
86 ::com::sun::star::chart2::data::XLabeledDataSequence
> > & aDataSequences
,
87 ::rtl::OUString aRole
,
88 bool bMatchPrefix
= false );
90 /** Retrieves all data sequences found in the given data series and puts them
91 into a data source. The order of sequences will match the order of the data
94 OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference
<
95 ::com::sun::star::chart2::data::XDataSource
>
96 getDataSource( const ::com::sun::star::uno::Sequence
<
97 ::com::sun::star::uno::Reference
<
98 ::com::sun::star::chart2::XDataSeries
> > & aSeries
);
101 /** Get the label of a series (e.g. for the legend)
103 @param rLabelSequenceRole
104 The data sequence contained in xSeries that has this role will be used
107 OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString
getDataSeriesLabel(
108 const ::com::sun::star::uno::Reference
<
109 ::com::sun::star::chart2::XDataSeries
> & xSeries
,
110 const ::rtl::OUString
& rLabelSequenceRole
);
112 /** Get the label of a labeled sequence including neccessary automatic generation
114 OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString
getLabelForLabeledDataSequence(
115 const ::com::sun::star::uno::Reference
<
116 ::com::sun::star::chart2::data::XLabeledDataSequence
> & xLabeledSeq
);
118 OOO_DLLPUBLIC_CHARTTOOLS
void setStackModeAtSeries(
119 const ::com::sun::star::uno::Sequence
<
120 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> > & aSeries
,
121 const ::com::sun::star::uno::Reference
<
122 ::com::sun::star::chart2::XCoordinateSystem
> & xCorrespondingCoordinateSystem
,
123 StackMode eStackMode
);
125 OOO_DLLPUBLIC_CHARTTOOLS sal_Int32
getAttachedAxisIndex(
126 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> & xSeries
);
128 /// @param nAxisIndex, if -1 it is determined by the given data series via getAttachedAxisIndex
129 OOO_DLLPUBLIC_CHARTTOOLS sal_Int32
getNumberFormatKeyFromAxis(
130 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> & xSeries
,
131 const ::com::sun::star::uno::Reference
<
132 ::com::sun::star::chart2::XCoordinateSystem
> & xCorrespondingCoordinateSystem
,
133 sal_Int32 nDimensionIndex
,
134 sal_Int32 nAxisIndex
= -1 );
136 OOO_DLLPUBLIC_CHARTTOOLS
137 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XCoordinateSystem
>
138 getCoordinateSystemOfSeries(
139 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> & xSeries
,
140 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> & xDiagram
);
142 OOO_DLLPUBLIC_CHARTTOOLS
143 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartType
>
144 getChartTypeOfSeries(
145 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> & xSeries
,
146 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> & xDiagram
);
148 OOO_DLLPUBLIC_CHARTTOOLS
void deleteSeries(
149 const ::com::sun::star::uno::Reference
<
150 ::com::sun::star::chart2::XDataSeries
> & xSeries
,
151 const ::com::sun::star::uno::Reference
<
152 ::com::sun::star::chart2::XChartType
> & xChartType
);
154 OOO_DLLPUBLIC_CHARTTOOLS
void switchSymbolsOnOrOff(
155 const ::com::sun::star::uno::Reference
<
156 ::com::sun::star::beans::XPropertySet
> & xSeriesProperties
,
157 bool bSymbolsOn
, sal_Int32 nSeriesIndex
);
159 OOO_DLLPUBLIC_CHARTTOOLS
void switchLinesOnOrOff(
160 const ::com::sun::star::uno::Reference
<
161 ::com::sun::star::beans::XPropertySet
> & xSeriesProperties
,
164 OOO_DLLPUBLIC_CHARTTOOLS
165 void makeLinesThickOrThin( const ::com::sun::star::uno::Reference
<
166 ::com::sun::star::beans::XPropertySet
> & xSeriesProperties
, bool bThick
);
168 OOO_DLLPUBLIC_CHARTTOOLS
void setPropertyAlsoToAllAttributedDataPoints(
169 const ::com::sun::star::uno::Reference
<
170 ::com::sun::star::chart2::XDataSeries
>& xSeries
,
171 const ::rtl::OUString
& rPropertyName
,
172 const ::com::sun::star::uno::Any
& rPropertyValue
);
174 OOO_DLLPUBLIC_CHARTTOOLS
bool hasAttributedDataPointDifferentValue(
175 const ::com::sun::star::uno::Reference
<
176 ::com::sun::star::chart2::XDataSeries
>& xSeries
,
177 const ::rtl::OUString
& rPropertyName
,
178 const ::com::sun::star::uno::Any
& rPropertyValue
);
180 OOO_DLLPUBLIC_CHARTTOOLS
bool areAllSeriesAttachedToSameAxis(
181 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartType
>& xChartType
,
182 sal_Int32
& rOutAxisIndex
);
184 OOO_DLLPUBLIC_CHARTTOOLS
bool hasUnhiddenData( const ::com::sun::star::uno::Reference
<
185 ::com::sun::star::chart2::XDataSeries
>& xSeries
);
187 OOO_DLLPUBLIC_CHARTTOOLS
188 sal_Int32
translateIndexFromHiddenToFullSequence( sal_Int32 nClippedIndex
, const ::com::sun::star::uno::Reference
<
189 ::com::sun::star::chart2::data::XDataSequence
>& xDataSequence
, bool bTranslate
);
191 OOO_DLLPUBLIC_CHARTTOOLS
bool hasDataLabelsAtSeries( const ::com::sun::star::uno::Reference
<
192 ::com::sun::star::chart2::XDataSeries
>& xSeries
);
194 OOO_DLLPUBLIC_CHARTTOOLS
bool hasDataLabelsAtPoints( const ::com::sun::star::uno::Reference
<
195 ::com::sun::star::chart2::XDataSeries
>& xSeries
);
197 OOO_DLLPUBLIC_CHARTTOOLS
bool hasDataLabelAtPoint( const ::com::sun::star::uno::Reference
<
198 ::com::sun::star::chart2::XDataSeries
>& xSeries
, sal_Int32 nPointIndex
);
200 OOO_DLLPUBLIC_CHARTTOOLS
void insertDataLabelsToSeriesAndAllPoints( const ::com::sun::star::uno::Reference
<
201 ::com::sun::star::chart2::XDataSeries
>& xSeries
);
203 OOO_DLLPUBLIC_CHARTTOOLS
void insertDataLabelToPoint( const ::com::sun::star::uno::Reference
<
204 ::com::sun::star::beans::XPropertySet
>& xPointPropertySet
);
206 OOO_DLLPUBLIC_CHARTTOOLS
void deleteDataLabelsFromSeriesAndAllPoints( const ::com::sun::star::uno::Reference
<
207 ::com::sun::star::chart2::XDataSeries
>& xSeries
);
209 OOO_DLLPUBLIC_CHARTTOOLS
void deleteDataLabelsFromPoint( const ::com::sun::star::uno::Reference
<
210 ::com::sun::star::beans::XPropertySet
>& xPointPropertySet
);
212 } // namespace DataSeriesHelper
215 // CHART2_DATASERIESHELPER_HXX