1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23#ifndef com_sun_star_chart_XChartTypeTemplate_idl
24#define com_sun_star_chart_XChartTypeTemplate_idl
25
26#ifndef __com_sun_star_uno_XInterface_idl__
27#include <com/sun/star/uno/XInterface.idl>
28#endif
29
30#ifndef __com_sun_star_beans_PropertyValue_idl__
31#include <com/sun/star/beans/PropertyValue.idl>
32#endif
33#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
34#include <com/sun/star/lang/IllegalArgumentException.idl>
35#endif
36
37#include <com/sun/star/chart2/XDiagram.idl>
38#include <com/sun/star/chart2/data/XDataSource.idl>
39#include <com/sun/star/chart2/XChartType.idl>
40#include <com/sun/star/chart2/XDataInterpreter.idl>
41
42module com
43{
44module sun
45{
46module star
47{
48module chart2
49{
50
51interface XChartTypeTemplate : ::com::sun::star::uno::XInterface
52{
53    /** Creates a new diagram based upon the given data .
54
55        @param xDataSource
56            This data source will be interpreted in a chart-type
57            specific way and appropriate <type>DataSeries</type> will
58            be created which serve as input for the new diagram.
59
60        @param aArguments
61            Arguments that tell the template how to slice the given
62            range.  The properties should be defined in a separate
63            service.
64
65            <p>For standard parameters that may be used, see the
66            service <type>StandardDiagramCreationParameters</type>.
67            </p>
68
69        @return
70            The new diagram which represents this
71            <type>ChartTypeTemplate</type>.
72     */
73    XDiagram createDiagramByDataSource(
74        [in] data::XDataSource xDataSource,
75        [in] sequence< com::sun::star::beans::PropertyValue > aArguments );
76
77    /** @return
78            <TRUE/> if the template does support categories
79     */
80    boolean supportsCategories();
81
82    /** Analyses the given diagram and reinterprets its
83        <type>DataSeries</type> and <type>Categories</type> and
84        creates a new diagram based on these series.
85
86        <p>Note, that if <member>matchesTemplate</member> returns
87        <TRUE/> for the given <type>XDiagram</type>, the latter should
88        not be changed.</p>
89
90        @param xDiagram
91            The diagram given will be modified such that it represents
92            this <type>ChartTypeTemplate</type>.
93     */
94    void changeDiagram( [in] XDiagram xDiagram );
95
96    /** Changes the given diagram <code>xDiagram</code> by using the
97        new data given in <code>xDataSource</code>.
98
99        <p>Note that the data is interpreted in a way that fits this
100        template, but not necessarily the chart-types of the diagram.
101        This method should only be called if the data-format of the
102        diagram is compatible with the data-format of this
103        template.</p>
104
105        <p>Ideally a <member>matchesTemplate</member> call for the
106        given diagram should return <TRUE/> before this method is
107        called.</p>
108
109        @param xDataSource
110            This data source will be interpreted in a chart-type
111            specific way and the <type>DataSeries</type> found in
112            <code>xDiagram</code> will be adapted to the new data.
113            Missing data series will be created and unused ones will
114            be deleted in <code>xDiagram</code>.
115
116        @param aArguments
117            Arguments that tell the template how to slice the given
118            range.  The properties should be defined in a separate
119            service.
120
121            <p>For standard parameters that may be used, see the
122            service <type>StandardDiagramCreationParameters</type>.
123            </p>
124     */
125    void changeDiagramData(
126        [in] XDiagram xDiagram,
127        [in] data::XDataSource xDataSource,
128        [in] sequence< com::sun::star::beans::PropertyValue > aArguments );
129
130    /** States whether the given diagram could have been created by
131        the template.
132
133        <p>The template will parse the <type>DataSeriesTree</type> of
134        the diagram to determine if the structure matches the one
135        which would have been created by
136        <member>createDiagramByDataSource</member>.</p>
137
138        <p>For analysis all parts of the diagram may be used,
139        e.g. also properties set at the data series (like symbols)./p>
140
141        @param xDiagram
142            The diagram to be analyzed.
143
144        @param bAdaptProperties
145            If <TRUE/> the properties of the template are set, such
146            that the template matches more accurately.  E.g. for a
147            line-chart with symbols the property "Symbol" would be set
148            to <TRUE/>.  If this parameter is <FALSE/> the template
149            itselfs stays unmodified.
150
151        @return
152            <TRUE/> if the diagram given is structurally identical to
153            a diagram that was created using
154            <member>createDiagramByDataSource</member> or
155            <member>changeDiagram</member>.  If <FALSE/> is returned
156            the template stays unmodified even if
157            <code>bAdaptProperties</code> is <TRUE/>.
158     */
159    boolean matchesTemplate( [in] XDiagram xDiagram,
160                             [in] boolean bAdaptProperties );
161
162    /** Provides a chart type object that can be used to create new
163        series.
164
165        @param aFormerlyUsedChartTypes
166            The list can be used to copy some aspects from old charttypes during the creation of a new chart type.
167            The list might be empty.
168     */
169    XChartType getChartTypeForNewSeries( [in] sequence< XChartType > aFormerlyUsedChartTypes );
170
171    /**
172     */
173    XDataInterpreter getDataInterpreter();
174
175    /** Applies default styles to the given XDataSeries.
176
177        The default implementation assigns the system-wide chart-color defaults
178        as "Color" property to all series.
179
180        @param nIndex
181            The index of the series.  This is used to obtain a default style
182            (e.g. color) for the nth series.
183     */
184//     void applyDefaultStyle( [in] XDataSeries xSeries,
185//                             [in] long nSeriesIndex );
186
187    /** Applies a chart-type specific style (e.g. symbols) to all series in the
188        sequence aSeries.
189
190        @param xSeries
191            a single data series to which a style will be applied
192
193        @param nChartTypeGroupIndex
194            Denotes in which chart-type group the series lies, such this method
195            can apply different styles for different chart-type groups
196
197        @param nSeriesIndex
198            The index of the series inside the current chart-type group.
199            nSeriesIndex does not uniquely identify a data series alone, but
200            only together with nChartTypeGroupIndex
201
202        @param nSeriesCount
203            The number of series in the current chart-type group.
204
205        @todo In the future, this should only change the "Style" property and no
206              hard attributes.
207     */
208    void applyStyle( [in] XDataSeries xSeries,
209                     [in] long nChartTypeGroupIndex,
210                     [in] long nSeriesIndex,
211                     [in] long nSeriesCount );
212
213    /** Resets all styles that were changed from the default at any
214        object in the chart and have not been later modified.
215
216        <p>In <member>createDiagramByDataSource</member> or
217        <member>changeDiagram</member> a template might e.g. change
218        the page background color or the line style of all data
219        series.  This method should reset all objects that still have
220        the changed settings to the default.</p>
221
222        <p>If for example the template changed the
223        <type scope="com::sun::star::drawing">LineStyle</type> of all
224        series to NONE, this method should reset all series with
225        LineStyle NONE back to SOLID.  If a series has a style DASH,
226        it must not be changed.</p>
227     */
228    void resetStyles( [in] XDiagram xDiagram );
229};
230
231} ; // chart2
232} ; // com
233} ; // sun
234} ; // star
235
236#endif
237