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#ifndef __com_sun_star_awt_grid_XGridColumnModel_idl__ 24#define __com_sun_star_awt_grid_XGridColumnModel_idl__ 25 26#include <com/sun/star/uno/XInterface.idl> 27#include <com/sun/star/lang/XComponent.idl> 28#include <com/sun/star/util/XCloneable.idl> 29 30#include <com/sun/star/awt/grid/XGridColumn.idl> 31#include <com/sun/star/container/XContainer.idl> 32#include <com/sun/star/lang/IndexOutOfBoundsException.idl> 33#include <com/sun/star/lang/IllegalArgumentException.idl> 34 35//============================================================================= 36 37module com { module sun { module star { module awt { module grid { 38 39//============================================================================= 40 41/** An instance of this interface is used by the <type>UnoControlGrid</type> to 42 retrieve the column structure that is displayed in the actual control. 43 44 If you do not need your own model implementation, you can also use the <type>DefaultGridColumnModel</type>. 45 46 @since OpenOffice 3.3 47*/ 48published interface XGridColumnModel 49{ 50 /** implements life time control for the component 51 */ 52 interface ::com::sun::star::lang::XComponent; 53 54 /** allows to register listeners to be notified when columns are inserted or removed 55 */ 56 interface ::com::sun::star::container::XContainer; 57 58 /** allows cloning the complete column model 59 */ 60 interface ::com::sun::star::util::XCloneable; 61 62 /** Returns the number of columns. 63 64 @returns 65 the number of columns. 66 */ 67 long getColumnCount(); 68 69 /** creates a new column for use with the column model. 70 71 <p>The newly created column is not yet inserted into the column container, you need to call <member>addColumn</member> 72 after you initialized the column object.</p> 73 */ 74 XGridColumn 75 createColumn(); 76 77 /** Adds a column to the model. 78 79 <p>You should use the <member>createColumn</member> member to create a new column. This gives 80 implementations of the <code>XGridColumnModel</code> interface the possibility to provide own column 81 implementations which extend the basic <type>GridColumn</type> type.</p> 82 83 <p>As soon as the column has been inserted into the model, the model takes ownership of it. This means when the 84 column is removed, or when the column model is disposed, the grid column is disposed as well.</p> 85 86 @param column 87 the column to add to the model. 88 @returns 89 the index of new created column. 90 91 @throws ::com::sun::star::lang::IllegalArgumentException 92 if the given column is not a valid element for the column container, or if it is <NULL/>. 93 */ 94 long addColumn( [in] XGridColumn column ) 95 raises ( ::com::sun::star::lang::IllegalArgumentException ); 96 97 /** removes a column from the model 98 99 <p>The column object will be disposed upon removal.</p> 100 101 @param ColumnIndex 102 denotes the index of the column to remove 103 @throws ::com::sun::star::lang::IndexOutOfBoundsException 104 if <code>ColumnIndex</code> does not denote a valid column index. 105 */ 106 void removeColumn( [in] long ColumnIndex ) 107 raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); 108 109 /** Returns all columns of the model. 110 @returns 111 all columns associated with the model in a sequence of <type>XGridColumn</type>. 112 */ 113 sequence<XGridColumn> getColumns(); 114 115 /** Returns a specific column. 116 @param index 117 the position of the requested column. 118 @returns 119 the requested column. 120 */ 121 XGridColumn getColumn( [in] long index) 122 raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); 123 124 /** Fills the model with the given number of default columns 125 126 <p>Existing columns will be removed before adding new columns. Listeners at the column model will 127 be notified one <member scope="com::sun::star::container">XContainerListener::elementRemoved</member> event 128 for each removed column, and one <member scope="com::sun::star::container">XContainerListener::elementInserted</member> 129 event for each insertion.</p> 130 131 @param elements 132 the number of default columns that should be set. 133 */ 134 void setDefaultColumns([in] long elements); 135}; 136 137//============================================================================= 138 139}; }; }; }; }; 140 141#endif 142