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