1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir#ifndef com_sun_star_chart2_data_XDataProvider_idl
28*cdf0e10cSrcweir#define com_sun_star_chart2_data_XDataProvider_idl
29*cdf0e10cSrcweir
30*cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
31*cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
32*cdf0e10cSrcweir
33*cdf0e10cSrcweir#include <com/sun/star/chart2/data/XDataSource.idl>
34*cdf0e10cSrcweir
35*cdf0e10cSrcweir#include <com/sun/star/beans/PropertyValue.idl>
36*cdf0e10cSrcweir
37*cdf0e10cSrcweir#include <com/sun/star/sheet/XRangeSelection.idl>
38*cdf0e10cSrcweir
39*cdf0e10cSrcweirmodule com
40*cdf0e10cSrcweir{
41*cdf0e10cSrcweirmodule sun
42*cdf0e10cSrcweir{
43*cdf0e10cSrcweirmodule star
44*cdf0e10cSrcweir{
45*cdf0e10cSrcweirmodule chart2
46*cdf0e10cSrcweir{
47*cdf0e10cSrcweirmodule data
48*cdf0e10cSrcweir{
49*cdf0e10cSrcweir
50*cdf0e10cSrcweir/** An application that provides data for a chart must implement this
51*cdf0e10cSrcweir    interface.
52*cdf0e10cSrcweir */
53*cdf0e10cSrcweirinterface XDataProvider  : ::com::sun::star::uno::XInterface
54*cdf0e10cSrcweir{
55*cdf0e10cSrcweir    /** If <TRUE/> is returned, a call to createDataSource with the
56*cdf0e10cSrcweir        same arguments must return a valid XDataSequence object.  If
57*cdf0e10cSrcweir        <FALSE/> is returned, createDataSource throws an exception.
58*cdf0e10cSrcweir     */
59*cdf0e10cSrcweir    boolean createDataSourcePossible( [in] sequence< com::sun::star::beans::PropertyValue > aArguments );
60*cdf0e10cSrcweir
61*cdf0e10cSrcweir    /** Creates a data source object that matches the given range
62*cdf0e10cSrcweir        representation string.
63*cdf0e10cSrcweir
64*cdf0e10cSrcweir        <p>This can be used for creating the necessary data for a new
65*cdf0e10cSrcweir        chart out of a previously selected range of cells in a
66*cdf0e10cSrcweir        spreadsheet.</p>
67*cdf0e10cSrcweir
68*cdf0e10cSrcweir        @param aArguments
69*cdf0e10cSrcweir            Arguments that tell the data provider how to slice the
70*cdf0e10cSrcweir            given range.  The properties should be defined in a
71*cdf0e10cSrcweir            separate service.
72*cdf0e10cSrcweir
73*cdf0e10cSrcweir            <p>For spreadsheets and textdocument tables there exists a
74*cdf0e10cSrcweir            service <type>TabularDataProviderArguments</type>
75*cdf0e10cSrcweir            describing valid values for this list.</p>
76*cdf0e10cSrcweir
77*cdf0e10cSrcweir        @return
78*cdf0e10cSrcweir            a data source containing <type>DataSequence</type>s that
79*cdf0e10cSrcweir            span the entire region given in <code>aArguments</code>.
80*cdf0e10cSrcweir
81*cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
82*cdf0e10cSrcweir            may be raised by the <type>XDataProvider</type> if it is
83*cdf0e10cSrcweir            unable to interpret the arguments passed in
84*cdf0e10cSrcweir	 		<code>aArguments</code> appropriately.
85*cdf0e10cSrcweir     */
86*cdf0e10cSrcweir    XDataSource createDataSource(
87*cdf0e10cSrcweir        [in] sequence< com::sun::star::beans::PropertyValue > aArguments )
88*cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException );
89*cdf0e10cSrcweir
90*cdf0e10cSrcweir    /** Tries to find out with what parameters the passed
91*cdf0e10cSrcweir        <type>DataSource</type> most probably was created.
92*cdf0e10cSrcweir
93*cdf0e10cSrcweir        <p>if xDataSource is a data source that was created with
94*cdf0e10cSrcweir        <member>createDataSource</member>, the arguments returned here
95*cdf0e10cSrcweir	 	should be the same than the ones passed to the function.
96*cdf0e10cSrcweir	 	Of course, this cannot be guaranteed.  However, if detection
97*cdf0e10cSrcweir	 	is ambiguous, the returned arguments should be empty. </p>
98*cdf0e10cSrcweir
99*cdf0e10cSrcweir        <p>This method may merge representation strings together if
100*cdf0e10cSrcweir        adjacent ranges appear successively in the range identifiers.
101*cdf0e10cSrcweir        E.g., if the first range refers to "$Sheet1.$A$1:$A$8" and the
102*cdf0e10cSrcweir        second range refers to "$Sheet1.$B$1:$B$8", those should be
103*cdf0e10cSrcweir        merged together to "$Sheet1.$A$1:$B$8".</p>
104*cdf0e10cSrcweir
105*cdf0e10cSrcweir        @param xDataSource
106*cdf0e10cSrcweir            A data source containing all data used in a chart.
107*cdf0e10cSrcweir
108*cdf0e10cSrcweir        @return
109*cdf0e10cSrcweir            Arguments that when being passed to
110*cdf0e10cSrcweir            <member>createDataSource</member> should in an ideal case
111*cdf0e10cSrcweir            return the same data source as <code>xDataSource</code>.
112*cdf0e10cSrcweir     */
113*cdf0e10cSrcweir    sequence< com::sun::star::beans::PropertyValue > detectArguments(
114*cdf0e10cSrcweir        [in] XDataSource xDataSource );
115*cdf0e10cSrcweir
116*cdf0e10cSrcweir    /** If <TRUE/> is returned, a call to
117*cdf0e10cSrcweir        createDataSequenceByRangeRepresentation with the same argument must
118*cdf0e10cSrcweir        return a valid XDataSequence object.  If <FALSE/> is returned,
119*cdf0e10cSrcweir        createDataSequenceByRangeRepresentation throws an exception.
120*cdf0e10cSrcweir     */
121*cdf0e10cSrcweir    boolean createDataSequenceByRangeRepresentationPossible( [in] string aRangeRepresentation );
122*cdf0e10cSrcweir
123*cdf0e10cSrcweir    /** creates a single data sequence for the given data range.
124*cdf0e10cSrcweir
125*cdf0e10cSrcweir        @param aRangeRepresentation
126*cdf0e10cSrcweir            is a string that can be interpreted by the component that
127*cdf0e10cSrcweir	 		implements this interface.  The representation string is
128*cdf0e10cSrcweir	 		of a form that may be used in the user interface.
129*cdf0e10cSrcweir
130*cdf0e10cSrcweir        @see createDataSource
131*cdf0e10cSrcweir
132*cdf0e10cSrcweir        @throws com::sun::star::lang::IllegalArgumentException
133*cdf0e10cSrcweir            if the given range does not contain a valid range
134*cdf0e10cSrcweir            representation for a one-dimensional range of data.
135*cdf0e10cSrcweir     */
136*cdf0e10cSrcweir    XDataSequence createDataSequenceByRangeRepresentation(
137*cdf0e10cSrcweir        [in] string aRangeRepresentation )
138*cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException );
139*cdf0e10cSrcweir
140*cdf0e10cSrcweir    /** Returns a component that is able to change a given range
141*cdf0e10cSrcweir        representation to another one.  This usually is a
142*cdf0e10cSrcweir        controller-component that uses the GUI to allow a user to
143*cdf0e10cSrcweir        select a new range.
144*cdf0e10cSrcweir
145*cdf0e10cSrcweir        <p>This method may return nothing, if it does not support
146*cdf0e10cSrcweir        range selection or if there is no current controller available
147*cdf0e10cSrcweir        that offers the functionality.</p>
148*cdf0e10cSrcweir
149*cdf0e10cSrcweir        @return
150*cdf0e10cSrcweir            The component for selecting a new range.  It must support
151*cdf0e10cSrcweir            <type>XComponent</type>, in order to inform the receiver
152*cdf0e10cSrcweir            about its lifetime.</p>
153*cdf0e10cSrcweir     */
154*cdf0e10cSrcweir    com::sun::star::sheet::XRangeSelection getRangeSelection();
155*cdf0e10cSrcweir};
156*cdf0e10cSrcweir
157*cdf0e10cSrcweir} ; // data
158*cdf0e10cSrcweir} ; // chart2
159*cdf0e10cSrcweir} ; // com
160*cdf0e10cSrcweir} ; // sun
161*cdf0e10cSrcweir} ; // star
162*cdf0e10cSrcweir
163*cdf0e10cSrcweir
164*cdf0e10cSrcweir#endif
165