1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef CHART2_DATASERIESHELPER_HXX
29 #define CHART2_DATASERIESHELPER_HXX
31 #include <com/sun/star/chart2/data/XDataSequence.hpp>
32 #include <com/sun/star/chart2/data/XDataSource.hpp>
33 #include <com/sun/star/chart2/XDataSeries.hpp>
34 #include <com/sun/star/chart2/XDiagram.hpp>
35 #include <com/sun/star/chart2/XCoordinateSystem.hpp>
36 #include <com/sun/star/chart2/XChartType.hpp>
38 #include "StackMode.hxx"
39 #include "charttoolsdllapi.hxx"
43 #include <boost/unordered_map.hpp>
48 namespace DataSeriesHelper
51 ::rtl::OUString
GetRole(
52 const ::com::sun::star::uno::Reference
<
53 ::com::sun::star::chart2::data::XLabeledDataSequence
>& xLabeledDataSequence
);
55 /** Retrieves the data sequence in the given data source that matches the
56 given role. If more than one sequences match the role, the first match
57 is returned. If no sequence matches, an empty reference is returned.
60 The data source containing all data sequences to be searched through.
63 The role that is to be filtered out.
65 OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XLabeledDataSequence
>
66 getDataSequenceByRole( const ::com::sun::star::uno::Reference
<
67 ::com::sun::star::chart2::data::XDataSource
> & xSource
,
68 ::rtl::OUString aRole
,
69 bool bMatchPrefix
= false );
71 /** Retrieves all data sequences in the given data source that match the given
75 The data source containing all data sequences to be searched through.
78 The role that is to be filtered out.
80 OOO_DLLPUBLIC_CHARTTOOLS ::std::vector
<
81 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XLabeledDataSequence
> >
82 getAllDataSequencesByRole( const ::com::sun::star::uno::Sequence
<
83 ::com::sun::star::uno::Reference
<
84 ::com::sun::star::chart2::data::XLabeledDataSequence
> > & aDataSequences
,
85 ::rtl::OUString aRole
,
86 bool bMatchPrefix
= false );
88 /** Retrieves all data sequences found in the given data series and puts them
89 into a data source. The order of sequences will match the order of the data
92 OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference
<
93 ::com::sun::star::chart2::data::XDataSource
>
94 getDataSource( const ::com::sun::star::uno::Sequence
<
95 ::com::sun::star::uno::Reference
<
96 ::com::sun::star::chart2::XDataSeries
> > & aSeries
);
99 /** Get the label of a series (e.g. for the legend)
101 @param rLabelSequenceRole
102 The data sequence contained in xSeries that has this role will be used
105 OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString
getDataSeriesLabel(
106 const ::com::sun::star::uno::Reference
<
107 ::com::sun::star::chart2::XDataSeries
> & xSeries
,
108 const ::rtl::OUString
& rLabelSequenceRole
);
110 /** Get the label of a labeled sequence including neccessary automatic generation
112 OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString
getLabelForLabeledDataSequence(
113 const ::com::sun::star::uno::Reference
<
114 ::com::sun::star::chart2::data::XLabeledDataSequence
> & xLabeledSeq
);
116 OOO_DLLPUBLIC_CHARTTOOLS
void setStackModeAtSeries(
117 const ::com::sun::star::uno::Sequence
<
118 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> > & aSeries
,
119 const ::com::sun::star::uno::Reference
<
120 ::com::sun::star::chart2::XCoordinateSystem
> & xCorrespondingCoordinateSystem
,
121 StackMode eStackMode
);
123 OOO_DLLPUBLIC_CHARTTOOLS sal_Int32
getAttachedAxisIndex(
124 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> & xSeries
);
126 /// @param nAxisIndex, if -1 it is determined by the given data series via getAttachedAxisIndex
127 OOO_DLLPUBLIC_CHARTTOOLS sal_Int32
getNumberFormatKeyFromAxis(
128 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> & xSeries
,
129 const ::com::sun::star::uno::Reference
<
130 ::com::sun::star::chart2::XCoordinateSystem
> & xCorrespondingCoordinateSystem
,
131 sal_Int32 nDimensionIndex
,
132 sal_Int32 nAxisIndex
= -1 );
134 OOO_DLLPUBLIC_CHARTTOOLS
135 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XCoordinateSystem
>
136 getCoordinateSystemOfSeries(
137 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> & xSeries
,
138 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> & xDiagram
);
140 OOO_DLLPUBLIC_CHARTTOOLS
141 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartType
>
142 getChartTypeOfSeries(
143 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> & xSeries
,
144 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> & xDiagram
);
146 OOO_DLLPUBLIC_CHARTTOOLS
void deleteSeries(
147 const ::com::sun::star::uno::Reference
<
148 ::com::sun::star::chart2::XDataSeries
> & xSeries
,
149 const ::com::sun::star::uno::Reference
<
150 ::com::sun::star::chart2::XChartType
> & xChartType
);
152 OOO_DLLPUBLIC_CHARTTOOLS
void switchSymbolsOnOrOff(
153 const ::com::sun::star::uno::Reference
<
154 ::com::sun::star::beans::XPropertySet
> & xSeriesProperties
,
155 bool bSymbolsOn
, sal_Int32 nSeriesIndex
);
157 OOO_DLLPUBLIC_CHARTTOOLS
void switchLinesOnOrOff(
158 const ::com::sun::star::uno::Reference
<
159 ::com::sun::star::beans::XPropertySet
> & xSeriesProperties
,
162 OOO_DLLPUBLIC_CHARTTOOLS
163 void makeLinesThickOrThin( const ::com::sun::star::uno::Reference
<
164 ::com::sun::star::beans::XPropertySet
> & xSeriesProperties
, bool bThick
);
166 OOO_DLLPUBLIC_CHARTTOOLS
void setPropertyAlsoToAllAttributedDataPoints(
167 const ::com::sun::star::uno::Reference
<
168 ::com::sun::star::chart2::XDataSeries
>& xSeries
,
169 const ::rtl::OUString
& rPropertyName
,
170 const ::com::sun::star::uno::Any
& rPropertyValue
);
172 OOO_DLLPUBLIC_CHARTTOOLS
bool hasAttributedDataPointDifferentValue(
173 const ::com::sun::star::uno::Reference
<
174 ::com::sun::star::chart2::XDataSeries
>& xSeries
,
175 const ::rtl::OUString
& rPropertyName
,
176 const ::com::sun::star::uno::Any
& rPropertyValue
);
178 OOO_DLLPUBLIC_CHARTTOOLS
bool areAllSeriesAttachedToSameAxis(
179 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartType
>& xChartType
,
180 sal_Int32
& rOutAxisIndex
);
182 OOO_DLLPUBLIC_CHARTTOOLS
bool hasUnhiddenData( const ::com::sun::star::uno::Reference
<
183 ::com::sun::star::chart2::XDataSeries
>& xSeries
);
185 OOO_DLLPUBLIC_CHARTTOOLS
186 sal_Int32
translateIndexFromHiddenToFullSequence( sal_Int32 nClippedIndex
, const ::com::sun::star::uno::Reference
<
187 ::com::sun::star::chart2::data::XDataSequence
>& xDataSequence
, bool bTranslate
);
189 OOO_DLLPUBLIC_CHARTTOOLS
bool hasDataLabelsAtSeries( const ::com::sun::star::uno::Reference
<
190 ::com::sun::star::chart2::XDataSeries
>& xSeries
);
192 OOO_DLLPUBLIC_CHARTTOOLS
bool hasDataLabelsAtPoints( const ::com::sun::star::uno::Reference
<
193 ::com::sun::star::chart2::XDataSeries
>& xSeries
);
195 OOO_DLLPUBLIC_CHARTTOOLS
bool hasDataLabelAtPoint( const ::com::sun::star::uno::Reference
<
196 ::com::sun::star::chart2::XDataSeries
>& xSeries
, sal_Int32 nPointIndex
);
198 OOO_DLLPUBLIC_CHARTTOOLS
void insertDataLabelsToSeriesAndAllPoints( const ::com::sun::star::uno::Reference
<
199 ::com::sun::star::chart2::XDataSeries
>& xSeries
);
201 OOO_DLLPUBLIC_CHARTTOOLS
void insertDataLabelToPoint( const ::com::sun::star::uno::Reference
<
202 ::com::sun::star::beans::XPropertySet
>& xPointPropertySet
);
204 OOO_DLLPUBLIC_CHARTTOOLS
void deleteDataLabelsFromSeriesAndAllPoints( const ::com::sun::star::uno::Reference
<
205 ::com::sun::star::chart2::XDataSeries
>& xSeries
);
207 OOO_DLLPUBLIC_CHARTTOOLS
void deleteDataLabelsFromPoint( const ::com::sun::star::uno::Reference
<
208 ::com::sun::star::beans::XPropertySet
>& xPointPropertySet
);
210 } // namespace DataSeriesHelper
213 // CHART2_DATASERIESHELPER_HXX
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */