101aa44aaSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 301aa44aaSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 401aa44aaSAndrew Rist * or more contributor license agreements. See the NOTICE file 501aa44aaSAndrew Rist * distributed with this work for additional information 601aa44aaSAndrew Rist * regarding copyright ownership. The ASF licenses this file 701aa44aaSAndrew Rist * to you under the Apache License, Version 2.0 (the 801aa44aaSAndrew Rist * "License"); you may not use this file except in compliance 901aa44aaSAndrew Rist * with the License. You may obtain a copy of the License at 1001aa44aaSAndrew Rist * 1101aa44aaSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 1201aa44aaSAndrew Rist * 1301aa44aaSAndrew Rist * Unless required by applicable law or agreed to in writing, 1401aa44aaSAndrew Rist * software distributed under the License is distributed on an 1501aa44aaSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1601aa44aaSAndrew Rist * KIND, either express or implied. See the License for the 1701aa44aaSAndrew Rist * specific language governing permissions and limitations 1801aa44aaSAndrew Rist * under the License. 1901aa44aaSAndrew Rist * 2001aa44aaSAndrew Rist *************************************************************/ 2101aa44aaSAndrew Rist 2201aa44aaSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SVTOOLS_INC_TABLE_TABLEMODEL_HXX 25cdf0e10cSrcweir #define SVTOOLS_INC_TABLE_TABLEMODEL_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "svtools/svtdllapi.h" 28cdf0e10cSrcweir #include "svtools/table/tabletypes.hxx" 29cdf0e10cSrcweir #include "svtools/table/tablerenderer.hxx" 30cdf0e10cSrcweir #include "svtools/table/tableinputhandler.hxx" 31cdf0e10cSrcweir #include "svtools/table/tablesort.hxx" 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include <com/sun/star/util/Color.hpp> 34cdf0e10cSrcweir #include <com/sun/star/style/VerticalAlignment.hpp> 35cdf0e10cSrcweir #include <com/sun/star/style/HorizontalAlignment.hpp> 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include <rtl/ref.hxx> 38cdf0e10cSrcweir #include <sal/types.h> 39cdf0e10cSrcweir 40cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 41cdf0e10cSrcweir #include <boost/optional.hpp> 42cdf0e10cSrcweir #include <boost/enable_shared_from_this.hpp> 43cdf0e10cSrcweir 44cdf0e10cSrcweir //........................................................................ 45cdf0e10cSrcweir namespace svt { namespace table 46cdf0e10cSrcweir { 47cdf0e10cSrcweir //........................................................................ 48cdf0e10cSrcweir 49cdf0e10cSrcweir 50cdf0e10cSrcweir //==================================================================== 51cdf0e10cSrcweir //= ScrollbarVisibility 52cdf0e10cSrcweir //==================================================================== 53cdf0e10cSrcweir enum ScrollbarVisibility 54cdf0e10cSrcweir { 55cdf0e10cSrcweir /** enumeration value denoting that a scrollbar should never be visible, even 56cdf0e10cSrcweir if needed normally 57cdf0e10cSrcweir */ 58cdf0e10cSrcweir ScrollbarShowNever, 59cdf0e10cSrcweir /** enumeration value denoting that a scrollbar should be visible when needed only 60cdf0e10cSrcweir */ 61cdf0e10cSrcweir ScrollbarShowSmart, 62cdf0e10cSrcweir /** enumeration value denoting that a scrollbar should always be visible, even 63cdf0e10cSrcweir if not needed normally 64cdf0e10cSrcweir */ 65cdf0e10cSrcweir ScrollbarShowAlways 66cdf0e10cSrcweir }; 67cdf0e10cSrcweir 68cdf0e10cSrcweir //==================================================================== 69cdf0e10cSrcweir //= ITableModelListener 70cdf0e10cSrcweir //==================================================================== 71cdf0e10cSrcweir typedef sal_Int32 ColumnAttributeGroup; 72cdf0e10cSrcweir #define COL_ATTRS_NONE (0x00000000) 73cdf0e10cSrcweir /// denotes column attributes related to the width of the column 74cdf0e10cSrcweir #define COL_ATTRS_WIDTH (0x00000001) 75cdf0e10cSrcweir /// denotes column attributes related to the appearance of the column, i.e. those relevant for rendering 76cdf0e10cSrcweir #define COL_ATTRS_APPEARANCE (0x00000002) 77cdf0e10cSrcweir /// denotes the entirety of column attributes 78cdf0e10cSrcweir #define COL_ATTRS_ALL (0x7FFFFFFF) 79cdf0e10cSrcweir 80cdf0e10cSrcweir //==================================================================== 81cdf0e10cSrcweir //= ITableModelListener 82cdf0e10cSrcweir //==================================================================== 83cdf0e10cSrcweir /** declares an interface to be implemented by components interested in 84cdf0e10cSrcweir changes in an ->ITableModel 85cdf0e10cSrcweir */ 86cdf0e10cSrcweir class SAL_NO_VTABLE ITableModelListener : public ::boost::enable_shared_from_this< ITableModelListener > 87cdf0e10cSrcweir { 88cdf0e10cSrcweir public: 89cdf0e10cSrcweir /** notifies the listener that one or more rows have been inserted into 90cdf0e10cSrcweir the table 91cdf0e10cSrcweir 92cdf0e10cSrcweir @param first 93cdf0e10cSrcweir the index of the first newly inserted row 94cdf0e10cSrcweir @param last 95cdf0e10cSrcweir the index of the last newly inserted row. Must not be smaller 96cdf0e10cSrcweir than ->first 97cdf0e10cSrcweir */ 98cdf0e10cSrcweir virtual void rowsInserted( RowPos first, RowPos last ) = 0; 99cdf0e10cSrcweir 100cdf0e10cSrcweir /** notifies the listener that one or more rows have been removed from 101cdf0e10cSrcweir the table 102cdf0e10cSrcweir 103cdf0e10cSrcweir @param first 104cdf0e10cSrcweir the old index of the first removed row. If this is <code>-1</code>, then all 105cdf0e10cSrcweir rows have been removed from the model. 106cdf0e10cSrcweir @param last 107cdf0e10cSrcweir the old index of the last removed row. Must not be smaller 108cdf0e10cSrcweir than ->first 109cdf0e10cSrcweir */ 110cdf0e10cSrcweir virtual void rowsRemoved( RowPos first, RowPos last ) = 0; 111cdf0e10cSrcweir 112cdf0e10cSrcweir /** notifies the listener that one or more columns have been inserted into 113cdf0e10cSrcweir the table 114cdf0e10cSrcweir 115cdf0e10cSrcweir @param first 116cdf0e10cSrcweir the index of the first newly inserted row 117cdf0e10cSrcweir @param last 118cdf0e10cSrcweir the index of the last newly inserted row. Must not be smaller 119cdf0e10cSrcweir than ->first 120cdf0e10cSrcweir */ 121cdf0e10cSrcweir virtual void columnInserted( ColPos const i_colIndex ) = 0; 122cdf0e10cSrcweir 123cdf0e10cSrcweir /** notifies the listener that one or more columns have been removed from 124cdf0e10cSrcweir the table 125cdf0e10cSrcweir 126cdf0e10cSrcweir @param i_colIndex 127cdf0e10cSrcweir the old index of the removed column 128cdf0e10cSrcweir */ 129cdf0e10cSrcweir virtual void columnRemoved( ColPos const i_colIndex ) = 0; 130cdf0e10cSrcweir 131cdf0e10cSrcweir /** notifies the listener that all columns have been removed form the model 132cdf0e10cSrcweir */ 133cdf0e10cSrcweir virtual void allColumnsRemoved() = 0; 134cdf0e10cSrcweir 135cdf0e10cSrcweir /** notifies the listener that a rectangular cell range in the table 136cdf0e10cSrcweir has been updated 137cdf0e10cSrcweir 138cdf0e10cSrcweir Listeners are required to discard any possibly cached information 139cdf0e10cSrcweir they have about the cells in question, in particular any possibly 140cdf0e10cSrcweir cached cell values. 141cdf0e10cSrcweir */ 142cdf0e10cSrcweir virtual void cellsUpdated( ColPos const i_firstCol, ColPos i_lastCol, RowPos const i_firstRow, RowPos const i_lastRow ) = 0; 143cdf0e10cSrcweir 144cdf0e10cSrcweir /** notifies the listener that attributes of a given column changed 145cdf0e10cSrcweir 146cdf0e10cSrcweir @param i_column 147cdf0e10cSrcweir the position of the column whose attributes changed 148cdf0e10cSrcweir @param i_attributeGroup 149cdf0e10cSrcweir a combination of one or more <code>COL_ATTRS_*</code> flags, denoting the attribute group(s) 150cdf0e10cSrcweir in which changes occurred. 151cdf0e10cSrcweir */ 152cdf0e10cSrcweir virtual void columnChanged( ColPos const i_column, ColumnAttributeGroup const i_attributeGroup ) = 0; 153cdf0e10cSrcweir 154cdf0e10cSrcweir /** notifies the listener that the metrics of the table changed. 155cdf0e10cSrcweir 156cdf0e10cSrcweir Metrics here include the column header height, the row header width, the row height, and the presence 157cdf0e10cSrcweir of both the row and column header. 158cdf0e10cSrcweir */ 159cdf0e10cSrcweir virtual void tableMetricsChanged() = 0; 160cdf0e10cSrcweir 161cdf0e10cSrcweir /// deletes the listener instance ~ITableModelListener()162cdf0e10cSrcweir virtual ~ITableModelListener(){}; 163cdf0e10cSrcweir }; 164cdf0e10cSrcweir typedef ::boost::shared_ptr< ITableModelListener > PTableModelListener; 165cdf0e10cSrcweir 166cdf0e10cSrcweir //==================================================================== 167cdf0e10cSrcweir //= IColumnModel 168cdf0e10cSrcweir //==================================================================== 169cdf0e10cSrcweir /** interface to be implemented by table column models 170cdf0e10cSrcweir */ 171cdf0e10cSrcweir class SAL_NO_VTABLE IColumnModel 172cdf0e10cSrcweir { 173cdf0e10cSrcweir public: 174cdf0e10cSrcweir /** retrieves the ID of the column 175cdf0e10cSrcweir 176cdf0e10cSrcweir The semantics of a column id is not defined. It's up to the 177cdf0e10cSrcweir implementor of the ->IColumnModel, respectively the ->ITableModel 178cdf0e10cSrcweir which provides the column models, to define such a semantics. 179cdf0e10cSrcweir 180cdf0e10cSrcweir @return 181cdf0e10cSrcweir the ID of the column. May be 0 if the table which the column 182cdf0e10cSrcweir belongs to does not need and support column ids. 183cdf0e10cSrcweir 184cdf0e10cSrcweir @see setID 185cdf0e10cSrcweir */ 186cdf0e10cSrcweir virtual ::com::sun::star::uno::Any 187cdf0e10cSrcweir getID() const = 0; 188cdf0e10cSrcweir 189cdf0e10cSrcweir /** sets a new column ID 190cdf0e10cSrcweir 191cdf0e10cSrcweir @return 192cdf0e10cSrcweir <TRUE/> if setting the new ID was successfull. A possible error 193cdf0e10cSrcweir conditions is if you try to set an ID which is already used 194cdf0e10cSrcweir by another column within the same table. 195cdf0e10cSrcweir 196cdf0e10cSrcweir @see getID 197cdf0e10cSrcweir */ 198cdf0e10cSrcweir virtual void setID( const ::com::sun::star::uno::Any& _nID ) = 0; 199cdf0e10cSrcweir 200cdf0e10cSrcweir /** returns the name of the column 201cdf0e10cSrcweir 202cdf0e10cSrcweir Column names should be human-readable, but not necessarily unique 203cdf0e10cSrcweir within a given table. 204cdf0e10cSrcweir 205cdf0e10cSrcweir @see setName 206cdf0e10cSrcweir */ 207cdf0e10cSrcweir virtual String getName() const = 0; 208cdf0e10cSrcweir 209cdf0e10cSrcweir /** sets a new name for the column 210cdf0e10cSrcweir 211cdf0e10cSrcweir @see getName 212cdf0e10cSrcweir */ 213cdf0e10cSrcweir virtual void setName( const String& _rName ) = 0; 214cdf0e10cSrcweir 215cdf0e10cSrcweir /** retrieves the help text to be displayed for the column. 216cdf0e10cSrcweir */ 217cdf0e10cSrcweir virtual String getHelpText() const = 0; 218cdf0e10cSrcweir 219cdf0e10cSrcweir /** sets a new the help text to be displayed for the column. 220cdf0e10cSrcweir */ 221cdf0e10cSrcweir virtual void setHelpText( const String& i_helpText ) = 0; 222cdf0e10cSrcweir 223cdf0e10cSrcweir /** determines whether the column can be interactively resized 224cdf0e10cSrcweir 225cdf0e10cSrcweir @see getMinWidth 226cdf0e10cSrcweir @see getMaxWidth 227cdf0e10cSrcweir @see getWidth 228cdf0e10cSrcweir */ 229cdf0e10cSrcweir virtual bool isResizable() const = 0; 230cdf0e10cSrcweir 231cdf0e10cSrcweir /** declares the column as resizable or fixed in width 232cdf0e10cSrcweir 233cdf0e10cSrcweir @see getMinWidth 234cdf0e10cSrcweir @see getMaxWidth 235cdf0e10cSrcweir @see getWidth 236cdf0e10cSrcweir */ 237cdf0e10cSrcweir virtual void setResizable( bool _bResizable ) = 0; 238cdf0e10cSrcweir 239cdf0e10cSrcweir /** denotes the relative flexibility of the column 240cdf0e10cSrcweir 241cdf0e10cSrcweir This flexibility is taken into account when a table control auto-resizes its columns, because the available 242cdf0e10cSrcweir space changed. In this case, the columns grow or shrink according to their flexibility. 243cdf0e10cSrcweir 244cdf0e10cSrcweir A value of 0 means the column is not auto-resized at all. 245cdf0e10cSrcweir */ 246cdf0e10cSrcweir virtual sal_Int32 getFlexibility() const = 0; 247cdf0e10cSrcweir 248cdf0e10cSrcweir /** sets a new flexibility value for the column 249cdf0e10cSrcweir 250cdf0e10cSrcweir @see getFlexibility 251cdf0e10cSrcweir */ 252cdf0e10cSrcweir virtual void setFlexibility( sal_Int32 const i_flexibility ) = 0; 253cdf0e10cSrcweir 254cdf0e10cSrcweir /** returns the width of the column, in app-font unitss 255cdf0e10cSrcweir 256cdf0e10cSrcweir The returned value must be a positive ->TableMetrics value. 257cdf0e10cSrcweir 258cdf0e10cSrcweir @see setWidth 259cdf0e10cSrcweir @see getMinWidth 260cdf0e10cSrcweir @see getMaxWidth 261cdf0e10cSrcweir */ 262cdf0e10cSrcweir virtual TableMetrics getWidth() const = 0; 263cdf0e10cSrcweir 264cdf0e10cSrcweir /** sets a new width for the column 265cdf0e10cSrcweir 266cdf0e10cSrcweir @param _nWidth 267cdf0e10cSrcweir the new width, app-font units 268cdf0e10cSrcweir 269cdf0e10cSrcweir @see getWidth 270cdf0e10cSrcweir */ 271cdf0e10cSrcweir virtual void setWidth( TableMetrics _nWidth ) = 0; 272cdf0e10cSrcweir 273cdf0e10cSrcweir /** returns the minimum width of the column, in app-font units, or 0 if the column 274cdf0e10cSrcweir does not have a minimal width 275cdf0e10cSrcweir 276cdf0e10cSrcweir @see setMinWidth 277cdf0e10cSrcweir @see getMaxWidth 278cdf0e10cSrcweir @see getWidth 279cdf0e10cSrcweir */ 280cdf0e10cSrcweir virtual TableMetrics getMinWidth() const = 0; 281cdf0e10cSrcweir 282cdf0e10cSrcweir /** sets the minimum width of the column, in app-font units 283cdf0e10cSrcweir 284cdf0e10cSrcweir @see getMinWidth 285cdf0e10cSrcweir @see setMaxWidth 286cdf0e10cSrcweir @see setWidth 287cdf0e10cSrcweir */ 288cdf0e10cSrcweir virtual void setMinWidth( TableMetrics _nMinWidth ) = 0; 289cdf0e10cSrcweir 290cdf0e10cSrcweir /** returns the maximum width of the column, in app-font units, or 0 if the column 291cdf0e10cSrcweir does not have a minimal width 292cdf0e10cSrcweir 293cdf0e10cSrcweir @see setMaxWidth 294cdf0e10cSrcweir @see getMinWidth 295cdf0e10cSrcweir @see getWidth 296cdf0e10cSrcweir */ 297cdf0e10cSrcweir virtual TableMetrics getMaxWidth() const = 0; 298cdf0e10cSrcweir 299cdf0e10cSrcweir /** sets the maximum width of the column, in app-font units 300cdf0e10cSrcweir 301cdf0e10cSrcweir @see getMaxWidth 302cdf0e10cSrcweir @see setMinWidth 303cdf0e10cSrcweir @see setWidth 304cdf0e10cSrcweir */ 305cdf0e10cSrcweir virtual void setMaxWidth( TableMetrics _nMaxWidth ) = 0; 306cdf0e10cSrcweir 307cdf0e10cSrcweir /** retrieves the horizontal alignment to be used for content in this cell 308cdf0e10cSrcweir */ 309cdf0e10cSrcweir virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign() = 0; 310cdf0e10cSrcweir 311cdf0e10cSrcweir /** sets a new the horizontal alignment to be used for content in this cell 312cdf0e10cSrcweir */ 313cdf0e10cSrcweir virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign) = 0; 314cdf0e10cSrcweir 315cdf0e10cSrcweir /// deletes the column model instance ~IColumnModel()316cdf0e10cSrcweir virtual ~IColumnModel() { } 317cdf0e10cSrcweir }; 318cdf0e10cSrcweir typedef ::boost::shared_ptr< IColumnModel > PColumnModel; 319cdf0e10cSrcweir 320cdf0e10cSrcweir //==================================================================== 321cdf0e10cSrcweir //= ITableModel 322cdf0e10cSrcweir //==================================================================== 323cdf0e10cSrcweir /** declares the interface to implement by an abtract table model 324cdf0e10cSrcweir */ 325cdf0e10cSrcweir class SAL_NO_VTABLE SVT_DLLPUBLIC ITableModel 326cdf0e10cSrcweir { 327cdf0e10cSrcweir public: 328cdf0e10cSrcweir /** returns the number of columns in the table 329cdf0e10cSrcweir */ 330cdf0e10cSrcweir virtual TableSize getColumnCount() const = 0; 331cdf0e10cSrcweir 332cdf0e10cSrcweir /** returns the number of rows in the table 333cdf0e10cSrcweir */ 334cdf0e10cSrcweir virtual TableSize getRowCount() const = 0; 335cdf0e10cSrcweir 336cdf0e10cSrcweir /** determines whether the table has column headers 337cdf0e10cSrcweir 338cdf0e10cSrcweir If this method returns <TRUE/>, the renderer returned by 339cdf0e10cSrcweir ->getRenderer must be able to render column headers. 340cdf0e10cSrcweir 341cdf0e10cSrcweir @see IColumnRenderer 342cdf0e10cSrcweir */ 343cdf0e10cSrcweir virtual bool hasColumnHeaders() const = 0; 344cdf0e10cSrcweir 345cdf0e10cSrcweir /** determines whether the table has row headers 346cdf0e10cSrcweir 347cdf0e10cSrcweir If this method returns <TRUE/>, the renderer returned by 348cdf0e10cSrcweir ->getRenderer must be able to render row headers. 349cdf0e10cSrcweir 350cdf0e10cSrcweir @see IColumnRenderer 351cdf0e10cSrcweir */ 352cdf0e10cSrcweir virtual bool hasRowHeaders() const = 0; 353cdf0e10cSrcweir 354cdf0e10cSrcweir /** determines whether the given cell is editable 355cdf0e10cSrcweir 356cdf0e10cSrcweir @see ICellEditor 357cdf0e10cSrcweir @todo 358cdf0e10cSrcweir */ 359cdf0e10cSrcweir virtual bool isCellEditable( ColPos col, RowPos row ) const = 0; 360cdf0e10cSrcweir 361cdf0e10cSrcweir /** returns a model for a certain column 362cdf0e10cSrcweir 363cdf0e10cSrcweir @param column 364cdf0e10cSrcweir the index of the column in question. Must be greater than or 365cdf0e10cSrcweir equal 0, and smaller than the return value of ->getColumnCount() 366cdf0e10cSrcweir 367cdf0e10cSrcweir @return 368cdf0e10cSrcweir the model of the column in question. Must not be <NULL/> 369cdf0e10cSrcweir */ 370cdf0e10cSrcweir virtual PColumnModel getColumnModel( ColPos column ) = 0; 371cdf0e10cSrcweir 372cdf0e10cSrcweir /** returns a renderer which is able to paint the table represented 373cdf0e10cSrcweir by this table model 374cdf0e10cSrcweir 375cdf0e10cSrcweir @return the renderer to use. Must not be <NULL/> 376cdf0e10cSrcweir */ 377cdf0e10cSrcweir virtual PTableRenderer getRenderer() const = 0; 378cdf0e10cSrcweir 379cdf0e10cSrcweir /** returns the component handling input in a view associated with the model 380cdf0e10cSrcweir */ 381cdf0e10cSrcweir virtual PTableInputHandler getInputHandler() const = 0; 382cdf0e10cSrcweir 383cdf0e10cSrcweir /** determines the height of rows in the table. 384cdf0e10cSrcweir 385cdf0e10cSrcweir @return 386cdf0e10cSrcweir the logical height of rows in the table, in app-font units. The height must be 387cdf0e10cSrcweir greater 0. 388cdf0e10cSrcweir */ 389cdf0e10cSrcweir virtual TableMetrics getRowHeight() const = 0; 390cdf0e10cSrcweir 391cdf0e10cSrcweir /** determines the height of the column header row 392cdf0e10cSrcweir 393cdf0e10cSrcweir This method is not to be called if ->hasColumnHeaders() 394cdf0e10cSrcweir returned <FALSE/>. 395cdf0e10cSrcweir 396cdf0e10cSrcweir @return 397cdf0e10cSrcweir the logical height of the column header row, in app-font units. 398cdf0e10cSrcweir Must be greater than 0. 399cdf0e10cSrcweir */ 400cdf0e10cSrcweir virtual TableMetrics getColumnHeaderHeight() const = 0; 401cdf0e10cSrcweir 402cdf0e10cSrcweir /** determines the width of the row header column 403cdf0e10cSrcweir 404cdf0e10cSrcweir This method is not to be called if ->hasRowHeaders() 405cdf0e10cSrcweir returned <FALSE/>. 406cdf0e10cSrcweir 407cdf0e10cSrcweir @return 408cdf0e10cSrcweir the logical width of the row header column, in app-font units. 409cdf0e10cSrcweir Must be greater than 0. 410cdf0e10cSrcweir */ 411cdf0e10cSrcweir virtual TableMetrics getRowHeaderWidth() const = 0; 412cdf0e10cSrcweir 413cdf0e10cSrcweir /** returns the visibilit mode of the vertical scrollbar 414cdf0e10cSrcweir */ 415cdf0e10cSrcweir virtual ScrollbarVisibility getVerticalScrollbarVisibility() const = 0; 416cdf0e10cSrcweir 417cdf0e10cSrcweir /** returns the visibilit mode of the horizontal scrollbar 418cdf0e10cSrcweir */ 419cdf0e10cSrcweir virtual ScrollbarVisibility getHorizontalScrollbarVisibility() const = 0; 420cdf0e10cSrcweir 421cdf0e10cSrcweir /** adds a listener to be notified of changes in the table model 422cdf0e10cSrcweir */ 423cdf0e10cSrcweir virtual void addTableModelListener( const PTableModelListener& i_listener ) = 0; 424cdf0e10cSrcweir 425cdf0e10cSrcweir /** remove a listener to be notified of changes in the table model 426cdf0e10cSrcweir */ 427cdf0e10cSrcweir virtual void removeTableModelListener( const PTableModelListener& i_listener ) = 0; 428cdf0e10cSrcweir 429cdf0e10cSrcweir /** retrieves the content of the given cell 430cdf0e10cSrcweir */ 431cdf0e10cSrcweir virtual void getCellContent( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any& o_cellContent ) = 0; 432cdf0e10cSrcweir 433cdf0e10cSrcweir /** returns an object which should be displayed as tooltip for the given cell 434cdf0e10cSrcweir 435cdf0e10cSrcweir At the moment, only string-convertible values are supported here. In the future, one might imagine displaying 436cdf0e10cSrcweir scaled-down versions of a graphic in a cell, and a larger version of that very graphic as tooltip. 437cdf0e10cSrcweir 438cdf0e10cSrcweir If no tooltip object is provided, then the cell content is used, and displayed as tooltip for the cell 439cdf0e10cSrcweir if and only if it doesn't fit into the cell's space itself. 440cdf0e10cSrcweir 441cdf0e10cSrcweir @param i_col 442cdf0e10cSrcweir The column index of the cell in question. COL_ROW_HEADERS is a valid argument here. 443cdf0e10cSrcweir @param i_row 444cdf0e10cSrcweir The row index of the cell in question. 445cdf0e10cSrcweir @param o_cellToolTip 446cdf0e10cSrcweir takes the tooltip object upon return. 447cdf0e10cSrcweir */ 448cdf0e10cSrcweir virtual void getCellToolTip( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any & o_cellToolTip ) = 0; 449cdf0e10cSrcweir 450cdf0e10cSrcweir /** retrieves title of a given row 451cdf0e10cSrcweir */ 452cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getRowHeading( RowPos const i_rowPos ) const = 0; 453cdf0e10cSrcweir 454cdf0e10cSrcweir /** returns the color to be used for rendering the grid lines. 455cdf0e10cSrcweir 456cdf0e10cSrcweir If this value is not set, a default color from the style settings will be used. 457cdf0e10cSrcweir */ 458cdf0e10cSrcweir virtual ::boost::optional< ::Color > getLineColor() const = 0; 459cdf0e10cSrcweir 460cdf0e10cSrcweir /** returns the color to be used for rendering the header background. 461cdf0e10cSrcweir 462cdf0e10cSrcweir If this value is not set, a default color from the style settings will be used. 463cdf0e10cSrcweir */ 464cdf0e10cSrcweir virtual ::boost::optional< ::Color > getHeaderBackgroundColor() const = 0; 465cdf0e10cSrcweir 466cdf0e10cSrcweir /** returns the color to be used for rendering the header text. 467cdf0e10cSrcweir 468cdf0e10cSrcweir If this value is not set, a default color from the style settings will be used. 469cdf0e10cSrcweir */ 470cdf0e10cSrcweir virtual ::boost::optional< ::Color > getHeaderTextColor() const = 0; 471cdf0e10cSrcweir 472cdf0e10cSrcweir /** returns the color to be used for the background of selected cells, when the control has the focus 473cdf0e10cSrcweir 474cdf0e10cSrcweir If this value is not set, a default color from the style settings will be used. 475cdf0e10cSrcweir */ 476cdf0e10cSrcweir virtual ::boost::optional< ::Color > getActiveSelectionBackColor() const = 0; 477cdf0e10cSrcweir 478cdf0e10cSrcweir /** returns the color to be used for the background of selected cells, when the control does not have the focus 479cdf0e10cSrcweir 480cdf0e10cSrcweir If this value is not set, a default color from the style settings will be used. 481cdf0e10cSrcweir */ 482cdf0e10cSrcweir virtual ::boost::optional< ::Color > getInactiveSelectionBackColor() const = 0; 483cdf0e10cSrcweir 484cdf0e10cSrcweir /** returns the color to be used for the text of selected cells, when the control has the focus 485cdf0e10cSrcweir 486cdf0e10cSrcweir If this value is not set, a default color from the style settings will be used. 487cdf0e10cSrcweir */ 488cdf0e10cSrcweir virtual ::boost::optional< ::Color > getActiveSelectionTextColor() const = 0; 489cdf0e10cSrcweir 490cdf0e10cSrcweir /** returns the color to be used for the text of selected cells, when the control does not have the focus 491cdf0e10cSrcweir 492cdf0e10cSrcweir If this value is not set, a default color from the style settings will be used. 493cdf0e10cSrcweir */ 494cdf0e10cSrcweir virtual ::boost::optional< ::Color > getInactiveSelectionTextColor() const = 0; 495cdf0e10cSrcweir 496cdf0e10cSrcweir /** returns the color to be used for rendering cell texts. 497cdf0e10cSrcweir 498cdf0e10cSrcweir If this value is not set, a default color from the style settings will be used. 499cdf0e10cSrcweir */ 500cdf0e10cSrcweir virtual ::boost::optional< ::Color > getTextColor() const = 0; 501cdf0e10cSrcweir 502cdf0e10cSrcweir /** returns the color to be used for text lines (underline, strikethrough) when rendering cell text. 503cdf0e10cSrcweir 504cdf0e10cSrcweir If this value is not set, a default color from the style settings will be used. 505cdf0e10cSrcweir */ 506cdf0e10cSrcweir virtual ::boost::optional< ::Color > getTextLineColor() const = 0; 507cdf0e10cSrcweir 508cdf0e10cSrcweir /** returns the colors to be used for the row backgrounds. 509cdf0e10cSrcweir 510cdf0e10cSrcweir If this value is not set, every second row will have a background color derived from the style settings's 511cdf0e10cSrcweir selection color, the other rows will not have a special background at all. 512cdf0e10cSrcweir 513cdf0e10cSrcweir If this value is an empty sequence, the rows will not have a special background at all, instead the 514cdf0e10cSrcweir normal background of the complete control will be used. 515cdf0e10cSrcweir 516cdf0e10cSrcweir If value is a non-empty sequence, then rows will have the background colors as specified in the sequence, 517cdf0e10cSrcweir in alternating order. 518cdf0e10cSrcweir */ 519cdf0e10cSrcweir virtual ::boost::optional< ::std::vector< ::Color > > 520cdf0e10cSrcweir getRowBackgroundColors() const = 0; 521cdf0e10cSrcweir 522cdf0e10cSrcweir /** determines the vertical alignment of content within a cell 523cdf0e10cSrcweir */ 524cdf0e10cSrcweir virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() const = 0; 525cdf0e10cSrcweir 526cdf0e10cSrcweir /** returns an adapter to the sorting functionality of the model 527cdf0e10cSrcweir 528cdf0e10cSrcweir It is legitimate to return <NULL/> here, in this case, the table model does not support sorting. 529cdf0e10cSrcweir */ 530cdf0e10cSrcweir virtual ITableDataSort* getSortAdapter() = 0; 531*d5c88d43SJürgen Schmidt 532*d5c88d43SJürgen Schmidt /** returns enabled state. 533*d5c88d43SJürgen Schmidt */ 534*d5c88d43SJürgen Schmidt virtual bool isEnabled() const = 0; 535cdf0e10cSrcweir 536cdf0e10cSrcweir /// destroys the table model instance ~ITableModel()537cdf0e10cSrcweir virtual ~ITableModel() { } 538cdf0e10cSrcweir }; 539cdf0e10cSrcweir typedef ::boost::shared_ptr< ITableModel > PTableModel; 540cdf0e10cSrcweir 541cdf0e10cSrcweir //........................................................................ 542cdf0e10cSrcweir } } // namespace svt::table 543cdf0e10cSrcweir //........................................................................ 544cdf0e10cSrcweir 545cdf0e10cSrcweir #endif // SVTOOLS_INC_TABLE_TABLEMODEL_HXX 546