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