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_chart2_data_XDataProvider_idl
24cdf0e10cSrcweir#define com_sun_star_chart2_data_XDataProvider_idl
25cdf0e10cSrcweir
26cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
27cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
28cdf0e10cSrcweir
29cdf0e10cSrcweir#include <com/sun/star/chart2/data/XDataSource.idl>
30cdf0e10cSrcweir
31cdf0e10cSrcweir#include <com/sun/star/beans/PropertyValue.idl>
32cdf0e10cSrcweir
33cdf0e10cSrcweir#include <com/sun/star/sheet/XRangeSelection.idl>
34cdf0e10cSrcweir
35cdf0e10cSrcweirmodule com
36cdf0e10cSrcweir{
37cdf0e10cSrcweirmodule sun
38cdf0e10cSrcweir{
39cdf0e10cSrcweirmodule star
40cdf0e10cSrcweir{
41cdf0e10cSrcweirmodule chart2
42cdf0e10cSrcweir{
43cdf0e10cSrcweirmodule data
44cdf0e10cSrcweir{
45cdf0e10cSrcweir
46cdf0e10cSrcweir/** An application that provides data for a chart must implement this
47cdf0e10cSrcweir    interface.
48cdf0e10cSrcweir */
49cdf0e10cSrcweirinterface XDataProvider  : ::com::sun::star::uno::XInterface
50cdf0e10cSrcweir{
51cdf0e10cSrcweir    /** If <TRUE/> is returned, a call to createDataSource with the
52cdf0e10cSrcweir        same arguments must return a valid XDataSequence object.  If
53cdf0e10cSrcweir        <FALSE/> is returned, createDataSource throws an exception.
54cdf0e10cSrcweir     */
55cdf0e10cSrcweir    boolean createDataSourcePossible( [in] sequence< com::sun::star::beans::PropertyValue > aArguments );
56cdf0e10cSrcweir
57cdf0e10cSrcweir    /** Creates a data source object that matches the given range
58cdf0e10cSrcweir        representation string.
59cdf0e10cSrcweir
60cdf0e10cSrcweir        <p>This can be used for creating the necessary data for a new
61cdf0e10cSrcweir        chart out of a previously selected range of cells in a
62cdf0e10cSrcweir        spreadsheet.</p>
63cdf0e10cSrcweir
64cdf0e10cSrcweir        @param aArguments
65cdf0e10cSrcweir            Arguments that tell the data provider how to slice the
66cdf0e10cSrcweir            given range.  The properties should be defined in a
67cdf0e10cSrcweir            separate service.
68cdf0e10cSrcweir
69cdf0e10cSrcweir            <p>For spreadsheets and textdocument tables there exists a
70cdf0e10cSrcweir            service <type>TabularDataProviderArguments</type>
71cdf0e10cSrcweir            describing valid values for this list.</p>
72cdf0e10cSrcweir
73cdf0e10cSrcweir        @return
74cdf0e10cSrcweir            a data source containing <type>DataSequence</type>s that
75cdf0e10cSrcweir            span the entire region given in <code>aArguments</code>.
76cdf0e10cSrcweir
77cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
78cdf0e10cSrcweir            may be raised by the <type>XDataProvider</type> if it is
79cdf0e10cSrcweir            unable to interpret the arguments passed in
80cdf0e10cSrcweir	 		<code>aArguments</code> appropriately.
81cdf0e10cSrcweir     */
82cdf0e10cSrcweir    XDataSource createDataSource(
83cdf0e10cSrcweir        [in] sequence< com::sun::star::beans::PropertyValue > aArguments )
84cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException );
85cdf0e10cSrcweir
86cdf0e10cSrcweir    /** Tries to find out with what parameters the passed
87cdf0e10cSrcweir        <type>DataSource</type> most probably was created.
88cdf0e10cSrcweir
89cdf0e10cSrcweir        <p>if xDataSource is a data source that was created with
90cdf0e10cSrcweir        <member>createDataSource</member>, the arguments returned here
91cdf0e10cSrcweir	 	should be the same than the ones passed to the function.
92cdf0e10cSrcweir	 	Of course, this cannot be guaranteed.  However, if detection
93cdf0e10cSrcweir	 	is ambiguous, the returned arguments should be empty. </p>
94cdf0e10cSrcweir
95cdf0e10cSrcweir        <p>This method may merge representation strings together if
96cdf0e10cSrcweir        adjacent ranges appear successively in the range identifiers.
97cdf0e10cSrcweir        E.g., if the first range refers to "$Sheet1.$A$1:$A$8" and the
98cdf0e10cSrcweir        second range refers to "$Sheet1.$B$1:$B$8", those should be
99cdf0e10cSrcweir        merged together to "$Sheet1.$A$1:$B$8".</p>
100cdf0e10cSrcweir
101cdf0e10cSrcweir        @param xDataSource
102cdf0e10cSrcweir            A data source containing all data used in a chart.
103cdf0e10cSrcweir
104cdf0e10cSrcweir        @return
105cdf0e10cSrcweir            Arguments that when being passed to
106cdf0e10cSrcweir            <member>createDataSource</member> should in an ideal case
107cdf0e10cSrcweir            return the same data source as <code>xDataSource</code>.
108cdf0e10cSrcweir     */
109cdf0e10cSrcweir    sequence< com::sun::star::beans::PropertyValue > detectArguments(
110cdf0e10cSrcweir        [in] XDataSource xDataSource );
111cdf0e10cSrcweir
112cdf0e10cSrcweir    /** If <TRUE/> is returned, a call to
113cdf0e10cSrcweir        createDataSequenceByRangeRepresentation with the same argument must
114cdf0e10cSrcweir        return a valid XDataSequence object.  If <FALSE/> is returned,
115cdf0e10cSrcweir        createDataSequenceByRangeRepresentation throws an exception.
116cdf0e10cSrcweir     */
117cdf0e10cSrcweir    boolean createDataSequenceByRangeRepresentationPossible( [in] string aRangeRepresentation );
118cdf0e10cSrcweir
119cdf0e10cSrcweir    /** creates a single data sequence for the given data range.
120cdf0e10cSrcweir
121cdf0e10cSrcweir        @param aRangeRepresentation
122cdf0e10cSrcweir            is a string that can be interpreted by the component that
123cdf0e10cSrcweir	 		implements this interface.  The representation string is
124cdf0e10cSrcweir	 		of a form that may be used in the user interface.
125cdf0e10cSrcweir
126cdf0e10cSrcweir        @see createDataSource
127cdf0e10cSrcweir
128cdf0e10cSrcweir        @throws com::sun::star::lang::IllegalArgumentException
129cdf0e10cSrcweir            if the given range does not contain a valid range
130cdf0e10cSrcweir            representation for a one-dimensional range of data.
131cdf0e10cSrcweir     */
132cdf0e10cSrcweir    XDataSequence createDataSequenceByRangeRepresentation(
133cdf0e10cSrcweir        [in] string aRangeRepresentation )
134cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException );
135cdf0e10cSrcweir
136cdf0e10cSrcweir    /** Returns a component that is able to change a given range
137cdf0e10cSrcweir        representation to another one.  This usually is a
138cdf0e10cSrcweir        controller-component that uses the GUI to allow a user to
139cdf0e10cSrcweir        select a new range.
140cdf0e10cSrcweir
141cdf0e10cSrcweir        <p>This method may return nothing, if it does not support
142cdf0e10cSrcweir        range selection or if there is no current controller available
143cdf0e10cSrcweir        that offers the functionality.</p>
144cdf0e10cSrcweir
145cdf0e10cSrcweir        @return
146cdf0e10cSrcweir            The component for selecting a new range.  It must support
147cdf0e10cSrcweir            <type>XComponent</type>, in order to inform the receiver
148cdf0e10cSrcweir            about its lifetime.</p>
149cdf0e10cSrcweir     */
150cdf0e10cSrcweir    com::sun::star::sheet::XRangeSelection getRangeSelection();
151cdf0e10cSrcweir};
152cdf0e10cSrcweir
153cdf0e10cSrcweir} ; // data
154cdf0e10cSrcweir} ; // chart2
155cdf0e10cSrcweir} ; // com
156cdf0e10cSrcweir} ; // sun
157cdf0e10cSrcweir} ; // star
158cdf0e10cSrcweir
159cdf0e10cSrcweir
160cdf0e10cSrcweir#endif
161