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
24#ifndef __com_sun_star_awt_grid_XMutableGridDataModel_idl__
25#define __com_sun_star_awt_grid_XMutableGridDataModel_idl__
26
27#include <com/sun/star/awt/grid/XGridDataModel.idl>
28#include <com/sun/star/lang/IllegalArgumentException.idl>
29#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
30
31//==================================================================================================================
32
33module com { module sun { module star { module awt { module grid {
34
35//==================================================================================================================
36
37/** allows to modify the data represented by a <type>XGridDataModel</type>
38 */
39published interface XMutableGridDataModel : XGridDataModel
40{
41	/** appends a row to the model.
42
43		@param Heading
44            denotes the heading of the row.
45		@param Data
46            specifies the content of the row.
47	*/
48	void addRow( [in] any Heading, [in] sequence< any > Data );
49
50    /** appends multiple rows of data to the model.
51        @param Headings
52            denotes the headings of the to-be-added rows.
53        @param Data
54            specifies the data of the rows to be added.
55        @throws ::com::sun::star::lang::IllegalArgumentException
56            if <code>Titles</code> and <code>Data</code> are of different length.
57    */
58    void addRows( [in] sequence< any > Headings, [in] sequence< sequence< any > > Data )
59        raises ( ::com::sun::star::lang::IllegalArgumentException );
60
61	/** inserts a row into the set of data rows
62
63        @param Index
64            denotes the position at which the row is to be inserted
65		@param Heading
66            denotes the heading of the row.
67		@param Data
68            specifies the content of the row.
69        @throws ::com::sun::star::lang::IndexOutOfBoundsException
70            if <code>Index</code> is smaller than <code>0</code> or greater than the number of
71            rows in the model.
72	*/
73	void insertRow( [in] long Index, [in] any Heading, [in] sequence< any > Data )
74        raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
75
76    /** inserts multiple rows of data into the model.
77        @param Index
78            denotes the position at which the rows are to be inserted
79        @param Headings
80            denotes the headings of the to-be-added rows.
81        @param Data
82            specifies the data of the rows to be added.
83        @throws ::com::sun::star::lang::IllegalArgumentException
84            if <code>Titles</code> and <code>Data</code> are of different length.
85        @throws ::com::sun::star::lang::IndexOutOfBoundsException
86            if <code>Index</code> is smaller than <code>0</code> or greater than the number of
87            rows in the model.
88    */
89    void insertRows( [in] long Index, [in] sequence< any > Headings, [in] sequence< sequence< any > > Data )
90        raises ( ::com::sun::star::lang::IndexOutOfBoundsException
91               , ::com::sun::star::lang::IllegalArgumentException );
92
93	/** removes a row of data from the model
94
95		@param RowIndex
96            the index of the row that should be removed.
97        @throws ::com::sun::star::lang::IndexOutOfBoundsException
98            if the given index is invalid
99	*/
100	void removeRow( [in] long RowIndex )
101        raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
102
103	/** Removes all rows from the model.
104	*/
105	void removeAllRows();
106
107	/** updates the content of the given cell
108		@param ColumnIndex
109			the column index of the to-be-updated cell
110		@param RowIndex
111			the row index of the to-be-updated cell
112		@param Value
113			the new value of the cell.
114        @throws ::com::sun::star::lang::IndexOutOfBoundsException
115            if the row or column index is invalid
116	*/
117	void updateCellData( [in] long ColumnIndex, [in] long RowIndex, [in] any Value )
118        raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
119
120	/** updates the content of a given row.
121
122        <p>The change in the data model will be notified to registered listeners via
123        <member">XGridDataListener::dataChanged</member>. The <member>GridDataEvent::FirstColumn</member> and
124        <member>GridDataEvent::LastColumn</member> will denote the smallest respectively largest column
125        index from <argColumnIndexes</arg>.</p>
126
127		@param ColumnIndexes
128			contains the column indexes of the cells, which should be updated
129        @param RowIndex
130			contains the index of the row whose data is to be updated
131		@param Values
132			specifies the new values of the cells.
133        @throws ::com::sun::star::lang::IndexOutOfBoundsException
134            if one of the row indexes or the column index is invalid
135        @throws ::com::sun::star::lang::IndexOutOfBoundsException
136            if the lengths of the <code>ColumnIndexes</code> and <code>Values</code> sequences are not equal.
137	*/
138	void updateRowData( [in] sequence< long > ColumnIndexes, [in] long RowIndex, [in] sequence< any > Values )
139            raises ( ::com::sun::star::lang::IndexOutOfBoundsException
140                   , ::com::sun::star::lang::IllegalArgumentException);
141
142    /** sets a new title for a given row.
143
144        @throws ::com::sun::star::lang::IndexOutOfBoundsException
145            if the given index does not denote a valid row.
146    */
147    void
148        updateRowHeading( [in] long RowIndex, [in] any Heading )
149            raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
150
151    /** updates the tooltip to be displayed for a given cell
152
153        @see XGridDataModel::getCellToolTip
154    */
155    void updateCellToolTip( [in] long ColumnIndex, [in] long RowIndex, [in] any Value )
156        raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
157
158    /** updates the tooltip for all cells of a given row
159
160        <p>Effectively this method is a shortcut for calling <member>updateCellToolTip</member> multiple
161        times in a row, for all cells of a given row.</p>
162
163        @see XGridDataModel::getCellToolTip
164        @see updateCellToolTip
165    */
166    void updateRowToolTip( [in] long RowIndex, [in] any Value )
167        raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
168
169	//-------------------------------------------------------------------------
170
171	/** registers listener to be notified of data changes in the model
172        @param Listener
173            specifies the listener to register
174	*/
175	void addGridDataListener( [in] XGridDataListener Listener );
176
177	//-------------------------------------------------------------------------
178
179	/** revokes a listener which was previously registered via <member>addGridDataListener</member>
180		@param Listener
181			specifies the listener to revoke.
182	*/
183    void removeGridDataListener( [in] XGridDataListener Listener );
184};
185
186//==================================================================================================================
187
188}; }; }; }; };
189
190//==================================================================================================================
191
192#endif
193