1d1766043SAndrew Rist/**************************************************************
2d1766043SAndrew Rist *
3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5d1766043SAndrew Rist * distributed with this work for additional information
6d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10d1766043SAndrew Rist *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12d1766043SAndrew Rist *
13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14d1766043SAndrew Rist * software distributed under the License is distributed on an
15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17d1766043SAndrew Rist * specific language governing permissions and limitations
18d1766043SAndrew Rist * under the License.
19d1766043SAndrew Rist *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_awt_grid_XGridColumnModel_idl__
24cdf0e10cSrcweir#define __com_sun_star_awt_grid_XGridColumnModel_idl__
25cdf0e10cSrcweir
26cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
27cdf0e10cSrcweir#include <com/sun/star/lang/XComponent.idl>
28cdf0e10cSrcweir#include <com/sun/star/util/XCloneable.idl>
29cdf0e10cSrcweir
30cdf0e10cSrcweir#include <com/sun/star/awt/grid/XGridColumn.idl>
31cdf0e10cSrcweir#include <com/sun/star/container/XContainer.idl>
32cdf0e10cSrcweir#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
33cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
34cdf0e10cSrcweir
35cdf0e10cSrcweir//=============================================================================
36cdf0e10cSrcweir
37cdf0e10cSrcweirmodule com {  module sun {  module star {  module awt { module grid {
38cdf0e10cSrcweir
39cdf0e10cSrcweir//=============================================================================
40cdf0e10cSrcweir
41cdf0e10cSrcweir/** An instance of this interface is used by the <type>UnoControlGrid</type> to
42cdf0e10cSrcweir    retrieve the column structure that is displayed in the actual control.
43cdf0e10cSrcweir
44cdf0e10cSrcweir    If you do not need your own model implementation, you can also use the <type>DefaultGridColumnModel</type>.
45cdf0e10cSrcweir
46*d1e7efc3SJürgen Schmidt    @since OpenOffice 3.3
47cdf0e10cSrcweir*/
48cdf0e10cSrcweirpublished interface XGridColumnModel
49cdf0e10cSrcweir{
50cdf0e10cSrcweir    /** implements life time control for the component
51cdf0e10cSrcweir    */
52cdf0e10cSrcweir    interface ::com::sun::star::lang::XComponent;
53cdf0e10cSrcweir
54cdf0e10cSrcweir    /** allows to register listeners to be notified when columns are inserted or removed
55cdf0e10cSrcweir    */
56cdf0e10cSrcweir    interface ::com::sun::star::container::XContainer;
57cdf0e10cSrcweir
58cdf0e10cSrcweir    /** allows cloning the complete column model
59cdf0e10cSrcweir    */
60cdf0e10cSrcweir    interface ::com::sun::star::util::XCloneable;
61cdf0e10cSrcweir
62cdf0e10cSrcweir    /** Returns the number of columns.
63cdf0e10cSrcweir
64cdf0e10cSrcweir        @returns
65cdf0e10cSrcweir                the number of columns.
66cdf0e10cSrcweir    */
67cdf0e10cSrcweir    long getColumnCount();
68cdf0e10cSrcweir
69cdf0e10cSrcweir    /** creates a new column for use with the column model.
70cdf0e10cSrcweir
71cdf0e10cSrcweir        <p>The newly created column is not yet inserted into the column container, you need to call <member>addColumn</member>
72cdf0e10cSrcweir        after you initialized the column object.</p>
73cdf0e10cSrcweir    */
74cdf0e10cSrcweir    XGridColumn
75cdf0e10cSrcweir        createColumn();
76cdf0e10cSrcweir
77cdf0e10cSrcweir    /** Adds a column to the model.
78cdf0e10cSrcweir
79cdf0e10cSrcweir        <p>You should use the <member>createColumn</member> member to create a new column. This gives
80cdf0e10cSrcweir        implementations of the <code>XGridColumnModel</code> interface the possibility to provide own column
81cdf0e10cSrcweir        implementations which extend the basic <type>GridColumn</type> type.</p>
82cdf0e10cSrcweir
83cdf0e10cSrcweir        <p>As soon as the column has been inserted into the model, the model takes ownership of it. This means when the
84cdf0e10cSrcweir        column is removed, or when the column model is disposed, the grid column is disposed as well.</p>
85cdf0e10cSrcweir
86cdf0e10cSrcweir        @param column
87cdf0e10cSrcweir            the column to add to the model.
88cdf0e10cSrcweir        @returns
89cdf0e10cSrcweir            the index of new created column.
90cdf0e10cSrcweir
91cdf0e10cSrcweir        @throws ::com::sun::star::lang::IllegalArgumentException
92cdf0e10cSrcweir            if the given column is not a valid element for the column container, or if it is <NULL/>.
93cdf0e10cSrcweir    */
94cdf0e10cSrcweir    long addColumn( [in] XGridColumn column )
95cdf0e10cSrcweir        raises ( ::com::sun::star::lang::IllegalArgumentException );
96cdf0e10cSrcweir
97cdf0e10cSrcweir    /** removes a column from the model
98cdf0e10cSrcweir
99cdf0e10cSrcweir        <p>The column object will be disposed upon removal.</p>
100cdf0e10cSrcweir
101cdf0e10cSrcweir        @param ColumnIndex
102cdf0e10cSrcweir            denotes the index of the column to remove
103cdf0e10cSrcweir        @throws ::com::sun::star::lang::IndexOutOfBoundsException
104cdf0e10cSrcweir            if <code>ColumnIndex</code> does not denote a valid column index.
105cdf0e10cSrcweir    */
106cdf0e10cSrcweir    void removeColumn( [in] long ColumnIndex )
107cdf0e10cSrcweir        raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
108cdf0e10cSrcweir
109cdf0e10cSrcweir    /** Returns all columns of the model.
110cdf0e10cSrcweir        @returns
111cdf0e10cSrcweir                 all columns associated with the model in a sequence of <type>XGridColumn</type>.
112cdf0e10cSrcweir    */
113cdf0e10cSrcweir    sequence<XGridColumn> getColumns();
114cdf0e10cSrcweir
115cdf0e10cSrcweir    /** Returns a specific column.
116cdf0e10cSrcweir        @param index
117cdf0e10cSrcweir                the position of the requested column.
118cdf0e10cSrcweir        @returns
119cdf0e10cSrcweir                 the requested column.
120cdf0e10cSrcweir    */
121cdf0e10cSrcweir    XGridColumn getColumn( [in] long index)
122cdf0e10cSrcweir        raises ( ::com::sun::star::lang::IndexOutOfBoundsException );
123cdf0e10cSrcweir
124cdf0e10cSrcweir    /** Fills the model with the given number of default columns
125cdf0e10cSrcweir
126cdf0e10cSrcweir        <p>Existing columns will be removed before adding new columns. Listeners at the column model will
127cdf0e10cSrcweir        be notified one <member scope="com::sun::star::container">XContainerListener::elementRemoved</member> event
128cdf0e10cSrcweir        for each removed column, and one <member scope="com::sun::star::container">XContainerListener::elementInserted</member>
129cdf0e10cSrcweir        event for each insertion.</p>
130cdf0e10cSrcweir
131cdf0e10cSrcweir        @param elements
132cdf0e10cSrcweir            the number of default columns that should be set.
133cdf0e10cSrcweir    */
134cdf0e10cSrcweir    void setDefaultColumns([in] long elements);
135cdf0e10cSrcweir};
136cdf0e10cSrcweir
137cdf0e10cSrcweir//=============================================================================
138cdf0e10cSrcweir
139cdf0e10cSrcweir}; }; }; }; };
140cdf0e10cSrcweir
141cdf0e10cSrcweir#endif
142