1/************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27#ifndef __com_sun_star_awt_grid_XGridColumnModel_idl__ 28#define __com_sun_star_awt_grid_XGridColumnModel_idl__ 29 30#include <com/sun/star/uno/XInterface.idl> 31#include <com/sun/star/lang/XComponent.idl> 32#include <com/sun/star/util/XCloneable.idl> 33 34#include <com/sun/star/awt/grid/XGridColumn.idl> 35#include <com/sun/star/container/XContainer.idl> 36#include <com/sun/star/lang/IndexOutOfBoundsException.idl> 37#include <com/sun/star/lang/IllegalArgumentException.idl> 38 39//============================================================================= 40 41module com { module sun { module star { module awt { module grid { 42 43//============================================================================= 44 45/** An instance of this interface is used by the <type>UnoControlGrid</type> to 46 retrieve the column structure that is displayed in the actual control. 47 48 If you do not need your own model implementation, you can also use the <type>DefaultGridColumnModel</type>. 49 50 @since OOo 3.3 51*/ 52published interface XGridColumnModel 53{ 54 /** implements life time control for the component 55 */ 56 interface ::com::sun::star::lang::XComponent; 57 58 /** allows to register listeners to be notified when columns are inserted or removed 59 */ 60 interface ::com::sun::star::container::XContainer; 61 62 /** allows cloning the complete column model 63 */ 64 interface ::com::sun::star::util::XCloneable; 65 66 /** Returns the number of columns. 67 68 @returns 69 the number of columns. 70 */ 71 long getColumnCount(); 72 73 /** creates a new column for use with the column model. 74 75 <p>The newly created column is not yet inserted into the column container, you need to call <member>addColumn</member> 76 after you initialized the column object.</p> 77 */ 78 XGridColumn 79 createColumn(); 80 81 /** Adds a column to the model. 82 83 <p>You should use the <member>createColumn</member> member to create a new column. This gives 84 implementations of the <code>XGridColumnModel</code> interface the possibility to provide own column 85 implementations which extend the basic <type>GridColumn</type> type.</p> 86 87 <p>As soon as the column has been inserted into the model, the model takes ownership of it. This means when the 88 column is removed, or when the column model is disposed, the grid column is disposed as well.</p> 89 90 @param column 91 the column to add to the model. 92 @returns 93 the index of new created column. 94 95 @throws ::com::sun::star::lang::IllegalArgumentException 96 if the given column is not a valid element for the column container, or if it is <NULL/>. 97 */ 98 long addColumn( [in] XGridColumn column ) 99 raises ( ::com::sun::star::lang::IllegalArgumentException ); 100 101 /** removes a column from the model 102 103 <p>The column object will be disposed upon removal.</p> 104 105 @param ColumnIndex 106 denotes the index of the column to remove 107 @throws ::com::sun::star::lang::IndexOutOfBoundsException 108 if <code>ColumnIndex</code> does not denote a valid column index. 109 */ 110 void removeColumn( [in] long ColumnIndex ) 111 raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); 112 113 /** Returns all columns of the model. 114 @returns 115 all columns associated with the model in a sequence of <type>XGridColumn</type>. 116 */ 117 sequence<XGridColumn> getColumns(); 118 119 /** Returns a specific column. 120 @param index 121 the position of the requested column. 122 @returns 123 the requested column. 124 */ 125 XGridColumn getColumn( [in] long index) 126 raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); 127 128 /** Fills the model with the given number of default columns 129 130 <p>Existing columns will be removed before adding new columns. Listeners at the column model will 131 be notified one <member scope="com::sun::star::container">XContainerListener::elementRemoved</member> event 132 for each removed column, and one <member scope="com::sun::star::container">XContainerListener::elementInserted</member> 133 event for each insertion.</p> 134 135 @param elements 136 the number of default columns that should be set. 137 */ 138 void setDefaultColumns([in] long elements); 139}; 140 141//============================================================================= 142 143}; }; }; }; }; 144 145#endif 146