1/*************************************************************************
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * Copyright 2000, 2010 Oracle and/or its affiliates.
5 *
6 * OpenOffice.org - a multi-platform office productivity suite
7 *
8 * This file is part of OpenOffice.org.
9 *
10 * OpenOffice.org is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License version 3
12 * only, as published by the Free Software Foundation.
13 *
14 * OpenOffice.org is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU Lesser General Public License version 3 for more details
18 * (a copy is included in the LICENSE file that accompanied this code).
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * version 3 along with OpenOffice.org.  If not, see
22 * <http://www.openoffice.org/license.html>
23 * for a copy of the LGPLv3 License.
24 *
25 ************************************************************************/
26
27#ifndef __com_sun_star_awt_grid_XMutableGridDataModel_idl__
28#define __com_sun_star_awt_grid_XMutableGridDataModel_idl__
29
30#include <com/sun/star/awt/grid/XGridDataModel.idl>
31#include <com/sun/star/lang/IllegalArgumentException.idl>
32#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
33
34//==================================================================================================================
35
36module com { module sun { module star { module awt { module grid {
37
38//==================================================================================================================
39
40/** allows to modify the data represented by a <type>XGridDataModel</type>
41 */
42published interface XMutableGridDataModel : XGridDataModel
43{
44	/** appends a row to the model.
45
46		@param Heading
47            denotes the heading of the row.
48		@param Data
49            specifies the content of the row.
50	*/
51	void addRow( [in] any Heading, [in] sequence< any > Data );
52
53    /** appends multiple rows of data to the model.
54        @param Headings
55            denotes the headings of the to-be-added rows.
56        @param Data
57            specifies the data of the rows to be added.
58        @throws ::com::sun::star::lang::IllegalArgumentException
59            if <code>Titles</code> and <code>Data</code> are of different length.
60    */
61    void addRows( [in] sequence< any > Headings, [in] sequence< sequence< any > > Data )
62        raises ( ::com::sun::star::lang::IllegalArgumentException );
63
64	/** inserts a row into the set of data rows
65
66        @param Index
67            denotes the position at which the row is to be inserted
68		@param Heading
69            denotes the heading of the row.
70		@param Data
71            specifies the content of the row.
72        @throws ::com::sun::star::lang::IndexOutOfBoundsException
73            if <code>Index</code> is smaller than <code>0</code> or greater than the number of
74            rows in the model.
75	*/
76	void insertRow( [in] long Index, [in] any Heading, [in] sequence< any > Data )
77        raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
78
79    /** inserts multiple rows of data into the model.
80        @param Index
81            denotes the position at which the rows are to be inserted
82        @param Headings
83            denotes the headings of the to-be-added rows.
84        @param Data
85            specifies the data of the rows to be added.
86        @throws ::com::sun::star::lang::IllegalArgumentException
87            if <code>Titles</code> and <code>Data</code> are of different length.
88        @throws ::com::sun::star::lang::IndexOutOfBoundsException
89            if <code>Index</code> is smaller than <code>0</code> or greater than the number of
90            rows in the model.
91    */
92    void insertRows( [in] long Index, [in] sequence< any > Headings, [in] sequence< sequence< any > > Data )
93        raises ( ::com::sun::star::lang::IndexOutOfBoundsException
94               , ::com::sun::star::lang::IllegalArgumentException );
95
96	/** removes a row of data from the model
97
98		@param RowIndex
99            the index of the row that should be removed.
100        @throws ::com::sun::star::lang::IndexOutOfBoundsException
101            if the given index is invalid
102	*/
103	void removeRow( [in] long RowIndex )
104        raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
105
106	/** Removes all rows from the model.
107	*/
108	void removeAllRows();
109
110	/** updates the content of the given cell
111		@param ColumnIndex
112			the column index of the to-be-updated cell
113		@param RowIndex
114			the row index of the to-be-updated cell
115		@param Value
116			the new value of the cell.
117        @throws ::com::sun::star::lang::IndexOutOfBoundsException
118            if the row or column index is invalid
119	*/
120	void updateCellData( [in] long ColumnIndex, [in] long RowIndex, [in] any Value )
121        raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
122
123	/** updates the content of a given row.
124
125        <p>The change in the data model will be notified to registered listeners via
126        <member">XGridDataListener::dataChanged</member>. The <member>GridDataEvent::FirstColumn</member> and
127        <member>GridDataEvent::LastColumn</member> will denote the smallest respectively largest column
128        index from <argColumnIndexes</arg>.</p>
129
130		@param ColumnIndexes
131			contains the column indexes of the cells, which should be updated
132        @param RowIndex
133			contains the index of the row whose data is to be updated
134		@param Values
135			specifies the new values of the cells.
136        @throws ::com::sun::star::lang::IndexOutOfBoundsException
137            if one of the row indexes or the column index is invalid
138        @throws ::com::sun::star::lang::IndexOutOfBoundsException
139            if the lengths of the <code>ColumnIndexes</code> and <code>Values</code> sequences are not equal.
140	*/
141	void updateRowData( [in] sequence< long > ColumnIndexes, [in] long RowIndex, [in] sequence< any > Values )
142            raises ( ::com::sun::star::lang::IndexOutOfBoundsException
143                   , ::com::sun::star::lang::IllegalArgumentException);
144
145    /** sets a new title for a given row.
146
147        @throws ::com::sun::star::lang::IndexOutOfBoundsException
148            if the given index does not denote a valid row.
149    */
150    void
151        updateRowHeading( [in] long RowIndex, [in] any Heading )
152            raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
153
154    /** updates the tooltip to be displayed for a given cell
155
156        @see XGridDataModel::getCellToolTip
157    */
158    void updateCellToolTip( [in] long ColumnIndex, [in] long RowIndex, [in] any Value )
159        raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
160
161    /** updates the tooltip for all cells of a given row
162
163        <p>Effectively this method is a shortcut for calling <member>updateCellToolTip</member> multiple
164        times in a row, for all cells of a given row.</p>
165
166        @see XGridDataModel::getCellToolTip
167        @see updateCellToolTip
168    */
169    void updateRowToolTip( [in] long RowIndex, [in] any Value )
170        raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
171
172	//-------------------------------------------------------------------------
173
174	/** registers listener to be notified of data changes in the model
175        @param Listener
176            specifies the listener to register
177	*/
178	void addGridDataListener( [in] XGridDataListener Listener );
179
180	//-------------------------------------------------------------------------
181
182	/** revokes a listener which was previously registered via <member>addGridDataListener</member>
183		@param Listener
184			specifies the listener to revoke.
185	*/
186    void removeGridDataListener( [in] XGridDataListener Listener );
187};
188
189//==================================================================================================================
190
191}; }; }; }; };
192
193//==================================================================================================================
194
195#endif
196