Bump version to 5.0-14
[LibreOffice.git] / svtools / source / uno / unocontroltablemodel.hxx
blob6433511a43ab014bb4b22dc71e74061ea2dbbd52
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVTOOLS_SOURCE_UNO_UNOCONTROLTABLEMODEL_HXX
21 #define INCLUDED_SVTOOLS_SOURCE_UNO_UNOCONTROLTABLEMODEL_HXX
23 #include <svtools/table/tablemodel.hxx>
24 #include "table/tablecontrol.hxx"
26 #include <com/sun/star/awt/grid/XGridControl.hpp>
27 #include <com/sun/star/awt/grid/GridDataEvent.hpp>
28 #include <com/sun/star/awt/grid/XGridColumnModel.hpp>
29 #include <com/sun/star/awt/grid/XGridDataModel.hpp>
30 #include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
31 #include <com/sun/star/awt/grid/XGridColumn.hpp>
32 #include <com/sun/star/util/Color.hpp>
33 #include <com/sun/star/style/VerticalAlignment.hpp>
35 #include <cppuhelper/implbase2.hxx>
36 #include <rtl/ref.hxx>
38 #include <boost/noncopyable.hpp>
41 namespace svt { namespace table
46 //= UnoControlTableModel
48 class UnoGridColumnFacade;
49 struct UnoControlTableModel_Impl;
50 class UnoControlTableModel : public ITableModel, public ITableDataSort
52 private:
53 UnoControlTableModel_Impl* m_pImpl;
55 public:
56 UnoControlTableModel();
57 virtual ~UnoControlTableModel();
59 public:
60 // ITableModel overridables
61 virtual TableSize getColumnCount() const SAL_OVERRIDE;
62 virtual TableSize getRowCount() const SAL_OVERRIDE;
63 virtual bool hasColumnHeaders() const SAL_OVERRIDE;
64 virtual bool hasRowHeaders() const SAL_OVERRIDE;
65 virtual bool isCellEditable( ColPos col, RowPos row ) const SAL_OVERRIDE;
66 virtual PColumnModel getColumnModel( ColPos column ) SAL_OVERRIDE;
67 virtual PTableRenderer getRenderer() const SAL_OVERRIDE;
68 virtual PTableInputHandler getInputHandler() const SAL_OVERRIDE;
69 virtual TableMetrics getRowHeight() const SAL_OVERRIDE;
70 virtual TableMetrics getColumnHeaderHeight() const SAL_OVERRIDE;
71 virtual TableMetrics getRowHeaderWidth() const SAL_OVERRIDE;
72 virtual ScrollbarVisibility getVerticalScrollbarVisibility() const SAL_OVERRIDE;
73 virtual ScrollbarVisibility getHorizontalScrollbarVisibility() const SAL_OVERRIDE;
74 virtual void addTableModelListener( const PTableModelListener& i_listener ) SAL_OVERRIDE;
75 virtual void removeTableModelListener( const PTableModelListener& i_listener ) SAL_OVERRIDE;
76 virtual void getCellContent( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any& o_cellContent ) SAL_OVERRIDE;
77 virtual void getCellToolTip( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any & o_cellToolTip ) SAL_OVERRIDE;
78 virtual ::com::sun::star::uno::Any getRowHeading( RowPos const i_rowPos ) const SAL_OVERRIDE;
79 virtual ::boost::optional< ::Color > getLineColor() const SAL_OVERRIDE;
80 virtual ::boost::optional< ::Color > getHeaderBackgroundColor() const SAL_OVERRIDE;
81 virtual ::boost::optional< ::Color > getHeaderTextColor() const SAL_OVERRIDE;
82 virtual ::boost::optional< ::Color > getActiveSelectionBackColor() const SAL_OVERRIDE;
83 virtual ::boost::optional< ::Color > getInactiveSelectionBackColor() const SAL_OVERRIDE;
84 virtual ::boost::optional< ::Color > getActiveSelectionTextColor() const SAL_OVERRIDE;
85 virtual ::boost::optional< ::Color > getInactiveSelectionTextColor() const SAL_OVERRIDE;
86 virtual ::boost::optional< ::Color > getTextColor() const SAL_OVERRIDE;
87 virtual ::boost::optional< ::Color > getTextLineColor() const SAL_OVERRIDE;
88 virtual ::boost::optional< ::std::vector< ::Color > >
89 getRowBackgroundColors() const SAL_OVERRIDE;
90 virtual ::com::sun::star::style::VerticalAlignment
91 getVerticalAlign() const SAL_OVERRIDE;
92 virtual ITableDataSort* getSortAdapter() SAL_OVERRIDE;
93 virtual bool isEnabled() const SAL_OVERRIDE;
95 // ITableDataSort overridables
96 virtual void sortByColumn( ColPos const i_column, ColumnSortDirection const i_sortDirection ) SAL_OVERRIDE;
97 virtual ColumnSort getCurrentSortOrder() const SAL_OVERRIDE;
99 // column write access
100 void appendColumn( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > const & i_column );
101 void insertColumn( ColPos const i_position, ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > const & i_column );
102 void removeColumn( ColPos const i_position );
103 void removeAllColumns();
105 // other operations
106 void setVerticalScrollbarVisibility( ScrollbarVisibility const i_visibility ) const;
107 void setHorizontalScrollbarVisibility( ScrollbarVisibility const i_visibility ) const;
109 void setDataModel( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > const & i_gridDataModel );
110 bool hasDataModel() const;
111 ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >
112 getDataModel() const;
113 void setColumnModel( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > const & i_gridColumnModel );
114 bool hasColumnModel() const;
115 ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >
116 getColumnModel() const;
118 void setRowHeaders(bool _bRowHeaders);
119 void setColumnHeaders(bool _bColumnHeaders);
121 void setRowHeight( TableMetrics _nHeight );
122 void setRowHeaderWidth( TableMetrics _nWidth );
123 void setColumnHeaderHeight( TableMetrics _nHeight );
125 void setLineColor( ::com::sun::star::uno::Any const & i_color );
126 void setHeaderBackgroundColor( ::com::sun::star::uno::Any const & i_color );
127 void setHeaderTextColor( ::com::sun::star::uno::Any const & i_color );
128 void setActiveSelectionBackColor( ::com::sun::star::uno::Any const & i_color );
129 void setInactiveSelectionBackColor( ::com::sun::star::uno::Any const & i_color );
130 void setActiveSelectionTextColor( ::com::sun::star::uno::Any const & i_color );
131 void setInactiveSelectionTextColor( ::com::sun::star::uno::Any const & i_color );
132 void setTextColor( ::com::sun::star::uno::Any const & i_color );
133 void setTextLineColor( ::com::sun::star::uno::Any const & i_color );
134 void setRowBackgroundColors( ::com::sun::star::uno::Any const & i_APIValue );
136 void setVerticalAlign(::com::sun::star::style::VerticalAlignment _rAlign);
137 void setEnabled( bool _bEnabled );
139 // multiplexing of XGridDataListener events
140 void notifyRowsInserted( ::com::sun::star::awt::grid::GridDataEvent const & i_event ) const;
141 void notifyRowsRemoved( ::com::sun::star::awt::grid::GridDataEvent const & i_event ) const;
142 void notifyDataChanged( ::com::sun::star::awt::grid::GridDataEvent const & i_event ) const;
144 /// retrieves the index of a column within the model
145 ColPos getColumnPos( UnoGridColumnFacade const & i_column ) const;
147 /// notifies a change in a column belonging to the model
148 void notifyColumnChange( ColPos const i_columnPos, ColumnAttributeGroup const i_attributeGroup ) const;
150 /** notifies a change in all data represented by the model. To be used if you cannot specified the changed data
151 in more detail.
153 void notifyAllDataChanged() const;
155 private:
156 void impl_notifyTableMetricsChanged() const;
160 } } // svt::table
163 #endif // INCLUDED_SVTOOLS_SOURCE_UNO_UNOCONTROLTABLEMODEL_HXX
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */