1*b1cdbd2cSJim Jagielski/**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski#ifndef com_sun_star_chart2_data_XDataProvider_idl
24*b1cdbd2cSJim Jagielski#define com_sun_star_chart2_data_XDataProvider_idl
25*b1cdbd2cSJim Jagielski
26*b1cdbd2cSJim Jagielski#include <com/sun/star/uno/XInterface.idl>
27*b1cdbd2cSJim Jagielski#include <com/sun/star/lang/IllegalArgumentException.idl>
28*b1cdbd2cSJim Jagielski
29*b1cdbd2cSJim Jagielski#include <com/sun/star/chart2/data/XDataSource.idl>
30*b1cdbd2cSJim Jagielski
31*b1cdbd2cSJim Jagielski#include <com/sun/star/beans/PropertyValue.idl>
32*b1cdbd2cSJim Jagielski
33*b1cdbd2cSJim Jagielski#include <com/sun/star/sheet/XRangeSelection.idl>
34*b1cdbd2cSJim Jagielski
35*b1cdbd2cSJim Jagielskimodule com
36*b1cdbd2cSJim Jagielski{
37*b1cdbd2cSJim Jagielskimodule sun
38*b1cdbd2cSJim Jagielski{
39*b1cdbd2cSJim Jagielskimodule star
40*b1cdbd2cSJim Jagielski{
41*b1cdbd2cSJim Jagielskimodule chart2
42*b1cdbd2cSJim Jagielski{
43*b1cdbd2cSJim Jagielskimodule data
44*b1cdbd2cSJim Jagielski{
45*b1cdbd2cSJim Jagielski
46*b1cdbd2cSJim Jagielski/** An application that provides data for a chart must implement this
47*b1cdbd2cSJim Jagielski    interface.
48*b1cdbd2cSJim Jagielski */
49*b1cdbd2cSJim Jagielskiinterface XDataProvider  : ::com::sun::star::uno::XInterface
50*b1cdbd2cSJim Jagielski{
51*b1cdbd2cSJim Jagielski    /** If <TRUE/> is returned, a call to createDataSource with the
52*b1cdbd2cSJim Jagielski        same arguments must return a valid XDataSequence object.  If
53*b1cdbd2cSJim Jagielski        <FALSE/> is returned, createDataSource throws an exception.
54*b1cdbd2cSJim Jagielski     */
55*b1cdbd2cSJim Jagielski    boolean createDataSourcePossible( [in] sequence< com::sun::star::beans::PropertyValue > aArguments );
56*b1cdbd2cSJim Jagielski
57*b1cdbd2cSJim Jagielski    /** Creates a data source object that matches the given range
58*b1cdbd2cSJim Jagielski        representation string.
59*b1cdbd2cSJim Jagielski
60*b1cdbd2cSJim Jagielski        <p>This can be used for creating the necessary data for a new
61*b1cdbd2cSJim Jagielski        chart out of a previously selected range of cells in a
62*b1cdbd2cSJim Jagielski        spreadsheet.</p>
63*b1cdbd2cSJim Jagielski
64*b1cdbd2cSJim Jagielski        @param aArguments
65*b1cdbd2cSJim Jagielski            Arguments that tell the data provider how to slice the
66*b1cdbd2cSJim Jagielski            given range.  The properties should be defined in a
67*b1cdbd2cSJim Jagielski            separate service.
68*b1cdbd2cSJim Jagielski
69*b1cdbd2cSJim Jagielski            <p>For spreadsheets and textdocument tables there exists a
70*b1cdbd2cSJim Jagielski            service <type>TabularDataProviderArguments</type>
71*b1cdbd2cSJim Jagielski            describing valid values for this list.</p>
72*b1cdbd2cSJim Jagielski
73*b1cdbd2cSJim Jagielski        @return
74*b1cdbd2cSJim Jagielski            a data source containing <type>DataSequence</type>s that
75*b1cdbd2cSJim Jagielski            span the entire region given in <code>aArguments</code>.
76*b1cdbd2cSJim Jagielski
77*b1cdbd2cSJim Jagielski        @throws ::com::sun::star::lang::IllegalArgumentException
78*b1cdbd2cSJim Jagielski            may be raised by the <type>XDataProvider</type> if it is
79*b1cdbd2cSJim Jagielski            unable to interpret the arguments passed in
80*b1cdbd2cSJim Jagielski	 		<code>aArguments</code> appropriately.
81*b1cdbd2cSJim Jagielski     */
82*b1cdbd2cSJim Jagielski    XDataSource createDataSource(
83*b1cdbd2cSJim Jagielski        [in] sequence< com::sun::star::beans::PropertyValue > aArguments )
84*b1cdbd2cSJim Jagielski        raises( com::sun::star::lang::IllegalArgumentException );
85*b1cdbd2cSJim Jagielski
86*b1cdbd2cSJim Jagielski    /** Tries to find out with what parameters the passed
87*b1cdbd2cSJim Jagielski        <type>DataSource</type> most probably was created.
88*b1cdbd2cSJim Jagielski
89*b1cdbd2cSJim Jagielski        <p>if xDataSource is a data source that was created with
90*b1cdbd2cSJim Jagielski        <member>createDataSource</member>, the arguments returned here
91*b1cdbd2cSJim Jagielski	 	should be the same than the ones passed to the function.
92*b1cdbd2cSJim Jagielski	 	Of course, this cannot be guaranteed.  However, if detection
93*b1cdbd2cSJim Jagielski	 	is ambiguous, the returned arguments should be empty. </p>
94*b1cdbd2cSJim Jagielski
95*b1cdbd2cSJim Jagielski        <p>This method may merge representation strings together if
96*b1cdbd2cSJim Jagielski        adjacent ranges appear successively in the range identifiers.
97*b1cdbd2cSJim Jagielski        E.g., if the first range refers to "$Sheet1.$A$1:$A$8" and the
98*b1cdbd2cSJim Jagielski        second range refers to "$Sheet1.$B$1:$B$8", those should be
99*b1cdbd2cSJim Jagielski        merged together to "$Sheet1.$A$1:$B$8".</p>
100*b1cdbd2cSJim Jagielski
101*b1cdbd2cSJim Jagielski        @param xDataSource
102*b1cdbd2cSJim Jagielski            A data source containing all data used in a chart.
103*b1cdbd2cSJim Jagielski
104*b1cdbd2cSJim Jagielski        @return
105*b1cdbd2cSJim Jagielski            Arguments that when being passed to
106*b1cdbd2cSJim Jagielski            <member>createDataSource</member> should in an ideal case
107*b1cdbd2cSJim Jagielski            return the same data source as <code>xDataSource</code>.
108*b1cdbd2cSJim Jagielski     */
109*b1cdbd2cSJim Jagielski    sequence< com::sun::star::beans::PropertyValue > detectArguments(
110*b1cdbd2cSJim Jagielski        [in] XDataSource xDataSource );
111*b1cdbd2cSJim Jagielski
112*b1cdbd2cSJim Jagielski    /** If <TRUE/> is returned, a call to
113*b1cdbd2cSJim Jagielski        createDataSequenceByRangeRepresentation with the same argument must
114*b1cdbd2cSJim Jagielski        return a valid XDataSequence object.  If <FALSE/> is returned,
115*b1cdbd2cSJim Jagielski        createDataSequenceByRangeRepresentation throws an exception.
116*b1cdbd2cSJim Jagielski     */
117*b1cdbd2cSJim Jagielski    boolean createDataSequenceByRangeRepresentationPossible( [in] string aRangeRepresentation );
118*b1cdbd2cSJim Jagielski
119*b1cdbd2cSJim Jagielski    /** creates a single data sequence for the given data range.
120*b1cdbd2cSJim Jagielski
121*b1cdbd2cSJim Jagielski        @param aRangeRepresentation
122*b1cdbd2cSJim Jagielski            is a string that can be interpreted by the component that
123*b1cdbd2cSJim Jagielski	 		implements this interface.  The representation string is
124*b1cdbd2cSJim Jagielski	 		of a form that may be used in the user interface.
125*b1cdbd2cSJim Jagielski
126*b1cdbd2cSJim Jagielski        @see createDataSource
127*b1cdbd2cSJim Jagielski
128*b1cdbd2cSJim Jagielski        @throws com::sun::star::lang::IllegalArgumentException
129*b1cdbd2cSJim Jagielski            if the given range does not contain a valid range
130*b1cdbd2cSJim Jagielski            representation for a one-dimensional range of data.
131*b1cdbd2cSJim Jagielski     */
132*b1cdbd2cSJim Jagielski    XDataSequence createDataSequenceByRangeRepresentation(
133*b1cdbd2cSJim Jagielski        [in] string aRangeRepresentation )
134*b1cdbd2cSJim Jagielski        raises( com::sun::star::lang::IllegalArgumentException );
135*b1cdbd2cSJim Jagielski
136*b1cdbd2cSJim Jagielski    /** Returns a component that is able to change a given range
137*b1cdbd2cSJim Jagielski        representation to another one.  This usually is a
138*b1cdbd2cSJim Jagielski        controller-component that uses the GUI to allow a user to
139*b1cdbd2cSJim Jagielski        select a new range.
140*b1cdbd2cSJim Jagielski
141*b1cdbd2cSJim Jagielski        <p>This method may return nothing, if it does not support
142*b1cdbd2cSJim Jagielski        range selection or if there is no current controller available
143*b1cdbd2cSJim Jagielski        that offers the functionality.</p>
144*b1cdbd2cSJim Jagielski
145*b1cdbd2cSJim Jagielski        @return
146*b1cdbd2cSJim Jagielski            The component for selecting a new range.  It must support
147*b1cdbd2cSJim Jagielski            <type>XComponent</type>, in order to inform the receiver
148*b1cdbd2cSJim Jagielski            about its lifetime.</p>
149*b1cdbd2cSJim Jagielski     */
150*b1cdbd2cSJim Jagielski    com::sun::star::sheet::XRangeSelection getRangeSelection();
151*b1cdbd2cSJim Jagielski};
152*b1cdbd2cSJim Jagielski
153*b1cdbd2cSJim Jagielski} ; // data
154*b1cdbd2cSJim Jagielski} ; // chart2
155*b1cdbd2cSJim Jagielski} ; // com
156*b1cdbd2cSJim Jagielski} ; // sun
157*b1cdbd2cSJim Jagielski} ; // star
158*b1cdbd2cSJim Jagielski
159*b1cdbd2cSJim Jagielski
160*b1cdbd2cSJim Jagielski#endif
161