summaryrefslogtreecommitdiff
path: root/svtools/inc/table
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-02-06 14:52:43 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-02-07 14:23:01 +0100
commit18403a20e709ff2d256fbc300db647c9f1ee2e15 (patch)
tree5f30db4783a20686b1770f9d94227802a59fb70c /svtools/inc/table
parent0093d310dc7ecc8206bfcf6ad802a5c389f006e4 (diff)
move some headers inside svtools module
Change-Id: I62fe3345aebe148010971bc8c487d96fa601d420 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88164 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools/inc/table')
-rw-r--r--svtools/inc/table/defaultinputhandler.hxx2
-rw-r--r--svtools/inc/table/gridtablerenderer.hxx2
-rw-r--r--svtools/inc/table/tablecontrol.hxx2
-rw-r--r--svtools/inc/table/tablecontrolinterface.hxx4
-rw-r--r--svtools/inc/table/tableinputhandler.hxx63
-rw-r--r--svtools/inc/table/tablemodel.hxx454
-rw-r--r--svtools/inc/table/tablerenderer.hxx249
-rw-r--r--svtools/inc/table/tablesort.hxx80
-rw-r--r--svtools/inc/table/tabletypes.hxx52
9 files changed, 903 insertions, 5 deletions
diff --git a/svtools/inc/table/defaultinputhandler.hxx b/svtools/inc/table/defaultinputhandler.hxx
index 3b27d86fc268..6bcf4ecd731f 100644
--- a/svtools/inc/table/defaultinputhandler.hxx
+++ b/svtools/inc/table/defaultinputhandler.hxx
@@ -19,7 +19,7 @@
#pragma once
-#include <svtools/table/tableinputhandler.hxx>
+#include <table/tableinputhandler.hxx>
#include <memory>
diff --git a/svtools/inc/table/gridtablerenderer.hxx b/svtools/inc/table/gridtablerenderer.hxx
index 3c92c340202f..21e354e767ab 100644
--- a/svtools/inc/table/gridtablerenderer.hxx
+++ b/svtools/inc/table/gridtablerenderer.hxx
@@ -19,7 +19,7 @@
#pragma once
-#include <svtools/table/tablemodel.hxx>
+#include <table/tablemodel.hxx>
#include <vcl/image.hxx>
#include <memory>
diff --git a/svtools/inc/table/tablecontrol.hxx b/svtools/inc/table/tablecontrol.hxx
index 6f4d1c43cde2..62f1261069b3 100644
--- a/svtools/inc/table/tablecontrol.hxx
+++ b/svtools/inc/table/tablecontrol.hxx
@@ -20,7 +20,7 @@
#pragma once
#include <svtools/svtdllapi.h>
-#include <svtools/table/tablemodel.hxx>
+#include <table/tablemodel.hxx>
#include <vcl/accessibletable.hxx>
#include <vcl/ctrl.hxx>
diff --git a/svtools/inc/table/tablecontrolinterface.hxx b/svtools/inc/table/tablecontrolinterface.hxx
index 3ceb5a8dbc60..bb8e8a701b96 100644
--- a/svtools/inc/table/tablecontrolinterface.hxx
+++ b/svtools/inc/table/tablecontrolinterface.hxx
@@ -22,8 +22,8 @@
#include <sal/types.h>
#include <vcl/seleng.hxx>
-#include <svtools/table/tabletypes.hxx>
-#include <svtools/table/tablemodel.hxx>
+#include <table/tabletypes.hxx>
+#include <table/tablemodel.hxx>
namespace svt { namespace table
diff --git a/svtools/inc/table/tableinputhandler.hxx b/svtools/inc/table/tableinputhandler.hxx
new file mode 100644
index 000000000000..fec472eeb2a5
--- /dev/null
+++ b/svtools/inc/table/tableinputhandler.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <memory>
+
+class MouseEvent;
+class KeyEvent;
+
+
+namespace svt { namespace table
+{
+
+
+ class ITableControl;
+
+
+ //= ITableInputHandler
+
+ /** interface for components handling input in a ->TableControl
+ */
+ class ITableInputHandler
+ {
+ public:
+ // all those methods have the same semantics as the equal-named methods of ->Window,
+ // with the additional option to return a boolean value indicating whether
+ // the event should be further processed by the ->Window implementations (<FALSE/>),
+ // or whether it has been sufficiently handled by the ->ITableInputHandler instance
+ // (<FALSE/>).
+
+ virtual bool MouseMove ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0;
+ virtual bool MouseButtonDown ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0;
+ virtual bool MouseButtonUp ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0;
+ virtual bool KeyInput ( ITableControl& _rControl, const KeyEvent& rKEvt ) = 0;
+ virtual bool GetFocus ( ITableControl& _rControl ) = 0;
+ virtual bool LoseFocus ( ITableControl& _rControl ) = 0;
+
+ virtual ~ITableInputHandler() { }
+ };
+ typedef std::shared_ptr< ITableInputHandler > PTableInputHandler;
+
+
+} } // namespace svt::table
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/table/tablemodel.hxx b/svtools/inc/table/tablemodel.hxx
new file mode 100644
index 000000000000..4f87580c7981
--- /dev/null
+++ b/svtools/inc/table/tablemodel.hxx
@@ -0,0 +1,454 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svtools/svtdllapi.h>
+#include <table/tabletypes.hxx>
+#include <table/tablerenderer.hxx>
+#include <table/tableinputhandler.hxx>
+
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
+
+#include <sal/types.h>
+
+#include <o3tl/optional.hxx>
+#include <memory>
+#include <vector>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace svt { namespace table { class ITableDataSort; } }
+
+class Color;
+
+enum class ColumnAttributeGroup
+{
+ NONE = 0x00,
+ /// denotes column attributes related to the width of the column
+ WIDTH = 0x01,
+ /// denotes column attributes related to the appearance of the column, i.e. those relevant for rendering
+ APPEARANCE = 0x02,
+ /// denotes the entirety of column attributes
+ ALL = 0x03,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ColumnAttributeGroup> : is_typed_flags<ColumnAttributeGroup, 0x03> {};
+}
+
+
+namespace svt { namespace table
+{
+ //= ScrollbarVisibility
+ enum ScrollbarVisibility
+ {
+ /** enumeration value denoting that a scrollbar should never be visible, even
+ if needed normally
+ */
+ ScrollbarShowNever,
+ /** enumeration value denoting that a scrollbar should be visible when needed only
+ */
+ ScrollbarShowSmart,
+ /** enumeration value denoting that a scrollbar should always be visible, even
+ if not needed normally
+ */
+ ScrollbarShowAlways
+ };
+
+
+ //= ITableModelListener
+
+ /** declares an interface to be implemented by components interested in
+ changes in an ->ITableModel
+ */
+ class SAL_NO_VTABLE ITableModelListener : public std::enable_shared_from_this< ITableModelListener >
+ {
+ public:
+ /** notifies the listener that one or more rows have been inserted into
+ the table
+
+ @param first
+ the index of the first newly inserted row
+ @param last
+ the index of the last newly inserted row. Must not be smaller
+ than ->first
+ */
+ virtual void rowsInserted( RowPos first, RowPos last ) = 0;
+
+ /** notifies the listener that one or more rows have been removed from
+ the table
+
+ @param first
+ the old index of the first removed row. If this is <code>-1</code>, then all
+ rows have been removed from the model.
+ @param last
+ the old index of the last removed row. Must not be smaller
+ than ->first
+ */
+ virtual void rowsRemoved( RowPos first, RowPos last ) = 0;
+
+ /** notifies the listener that one or more columns have been inserted into
+ the table
+ */
+ virtual void columnInserted() = 0;
+
+ /** notifies the listener that one or more columns have been removed from
+ the table
+ */
+ virtual void columnRemoved() = 0;
+
+ /** notifies the listener that all columns have been removed from the model
+ */
+ virtual void allColumnsRemoved() = 0;
+
+ /** notifies the listener that a rectangular cell range in the table
+ has been updated
+
+ Listeners are required to discard any possibly cached information
+ they have about the cells in question, in particular any possibly
+ cached cell values.
+ */
+ virtual void cellsUpdated( RowPos const i_firstRow, RowPos const i_lastRow ) = 0;
+
+ /** notifies the listener that attributes of a given column changed
+
+ @param i_column
+ the position of the column whose attributes changed
+ @param i_attributeGroup
+ a combination of one or more <code>COL_ATTRS_*</code> flags, denoting the attribute group(s)
+ in which changes occurred.
+ */
+ virtual void columnChanged( ColPos const i_column, ColumnAttributeGroup const i_attributeGroup ) = 0;
+
+ /** notifies the listener that the metrics of the table changed.
+
+ Metrics here include the column header height, the row header width, the row height, and the presence
+ of both the row and column header.
+ */
+ virtual void tableMetricsChanged() = 0;
+
+ /// deletes the listener instance
+ virtual ~ITableModelListener(){};
+ };
+ typedef std::shared_ptr< ITableModelListener > PTableModelListener;
+
+
+ //= IColumnModel
+
+ /** interface to be implemented by table column models
+ */
+ class SAL_NO_VTABLE IColumnModel
+ {
+ public:
+ /** returns the name of the column
+
+ Column names should be human-readable, but not necessarily unique
+ within a given table.
+
+ @see setName
+ */
+ virtual OUString getName() const = 0;
+
+ /** retrieves the help text to be displayed for the column.
+ */
+ virtual OUString getHelpText() const = 0;
+
+ /** determines whether the column can be interactively resized
+
+ @see getMinWidth
+ @see getMaxWidth
+ @see getWidth
+ */
+ virtual bool isResizable() const = 0;
+
+ /** denotes the relative flexibility of the column
+
+ This flexibility is taken into account when a table control auto-resizes its columns, because the available
+ space changed. In this case, the columns grow or shrink according to their flexibility.
+
+ A value of 0 means the column is not auto-resized at all.
+ */
+ virtual sal_Int32 getFlexibility() const = 0;
+
+ /** returns the width of the column, in app-font units
+
+ The returned value must be a positive ->TableMetrics value.
+
+ @see setWidth
+ @see getMinWidth
+ @see getMaxWidth
+ */
+ virtual TableMetrics getWidth() const = 0;
+
+ /** sets a new width for the column
+
+ @param _nWidth
+ the new width, app-font units
+
+ @see getWidth
+ */
+ virtual void setWidth( TableMetrics _nWidth ) = 0;
+
+ /** returns the minimum width of the column, in app-font units, or 0 if the column
+ does not have a minimal width
+
+ @see setMinWidth
+ @see getMaxWidth
+ @see getWidth
+ */
+ virtual TableMetrics getMinWidth() const = 0;
+
+ /** returns the maximum width of the column, in app-font units, or 0 if the column
+ does not have a minimal width
+
+ @see setMaxWidth
+ @see getMinWidth
+ @see getWidth
+ */
+ virtual TableMetrics getMaxWidth() const = 0;
+
+ /** retrieves the horizontal alignment to be used for content in this cell
+ */
+ virtual css::style::HorizontalAlignment getHorizontalAlign() = 0;
+
+ /// deletes the column model instance
+ virtual ~IColumnModel() { }
+ };
+ typedef std::shared_ptr< IColumnModel > PColumnModel;
+
+
+ //= ITableModel
+
+ /** declares the interface to implement by an abstract table model
+ */
+ class SAL_NO_VTABLE SVT_DLLPUBLIC ITableModel
+ {
+ public:
+ /** returns the number of columns in the table
+ */
+ virtual TableSize getColumnCount() const = 0;
+
+ /** returns the number of rows in the table
+ */
+ virtual TableSize getRowCount() const = 0;
+
+ /** determines whether the table has column headers
+
+ If this method returns <TRUE/>, the renderer returned by
+ ->getRenderer must be able to render column headers.
+
+ @see IColumnRenderer
+ */
+ virtual bool hasColumnHeaders() const = 0;
+
+ /** determines whether the table has row headers
+
+ If this method returns <TRUE/>, the renderer returned by
+ ->getRenderer must be able to render row headers.
+
+ @see IColumnRenderer
+ */
+ virtual bool hasRowHeaders() const = 0;
+
+ /** returns a model for a certain column
+
+ @param column
+ the index of the column in question. Must be greater than or
+ equal 0, and smaller than the return value of ->getColumnCount()
+
+ @return
+ the model of the column in question. Must not be <NULL/>
+ */
+ virtual PColumnModel getColumnModel( ColPos column ) = 0;
+
+ /** returns a renderer which is able to paint the table represented
+ by this table model
+
+ @return the renderer to use. Must not be <NULL/>
+ */
+ virtual PTableRenderer getRenderer() const = 0;
+
+ /** returns the component handling input in a view associated with the model
+ */
+ virtual PTableInputHandler getInputHandler() const = 0;
+
+ /** determines the height of rows in the table.
+
+ @return
+ the logical height of rows in the table, in app-font units. The height must be
+ greater 0.
+ */
+ virtual TableMetrics getRowHeight() const = 0;
+
+ /** determines the height of the column header row
+
+ This method is not to be called if ->hasColumnHeaders()
+ returned <FALSE/>.
+
+ @return
+ the logical height of the column header row, in app-font units.
+ Must be greater than 0.
+ */
+ virtual TableMetrics getColumnHeaderHeight() const = 0;
+
+ /** determines the width of the row header column
+
+ This method is not to be called if ->hasRowHeaders()
+ returned <FALSE/>.
+
+ @return
+ the logical width of the row header column, in app-font units.
+ Must be greater than 0.
+ */
+ virtual TableMetrics getRowHeaderWidth() const = 0;
+
+ /** returns the visibilit mode of the vertical scrollbar
+ */
+ virtual ScrollbarVisibility getVerticalScrollbarVisibility() const = 0;
+
+ /** returns the visibilit mode of the horizontal scrollbar
+ */
+ virtual ScrollbarVisibility getHorizontalScrollbarVisibility() const = 0;
+
+ /** adds a listener to be notified of changes in the table model
+ */
+ virtual void addTableModelListener( const PTableModelListener& i_listener ) = 0;
+
+ /** remove a listener to be notified of changes in the table model
+ */
+ virtual void removeTableModelListener( const PTableModelListener& i_listener ) = 0;
+
+ /** retrieves the content of the given cell
+ */
+ virtual void getCellContent( ColPos const i_col, RowPos const i_row, css::uno::Any& o_cellContent ) = 0;
+
+ /** returns an object which should be displayed as tooltip for the given cell
+
+ At the moment, only string-convertible values are supported here. In the future, one might imagine displaying
+ scaled-down versions of a graphic in a cell, and a larger version of that very graphic as tooltip.
+
+ If no tooltip object is provided, then the cell content is used, and displayed as tooltip for the cell
+ if and only if it doesn't fit into the cell's space itself.
+
+ @param i_col
+ The column index of the cell in question. COL_ROW_HEADERS is a valid argument here.
+ @param i_row
+ The row index of the cell in question.
+ @param o_cellToolTip
+ takes the tooltip object upon return.
+ */
+ virtual void getCellToolTip( ColPos const i_col, RowPos const i_row, css::uno::Any & o_cellToolTip ) = 0;
+
+ /** retrieves title of a given row
+ */
+ virtual css::uno::Any getRowHeading( RowPos const i_rowPos ) const = 0;
+
+ /** returns the color to be used for rendering the grid lines.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::o3tl::optional< ::Color > getLineColor() const = 0;
+
+ /** returns the color to be used for rendering the header background.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::o3tl::optional< ::Color > getHeaderBackgroundColor() const = 0;
+
+ /** returns the color to be used for rendering the header text.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::o3tl::optional< ::Color > getHeaderTextColor() const = 0;
+
+ /** returns the color to be used for the background of selected cells, when the control has the focus
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::o3tl::optional< ::Color > getActiveSelectionBackColor() const = 0;
+
+ /** returns the color to be used for the background of selected cells, when the control does not have the focus
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::o3tl::optional< ::Color > getInactiveSelectionBackColor() const = 0;
+
+ /** returns the color to be used for the text of selected cells, when the control has the focus
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::o3tl::optional< ::Color > getActiveSelectionTextColor() const = 0;
+
+ /** returns the color to be used for the text of selected cells, when the control does not have the focus
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::o3tl::optional< ::Color > getInactiveSelectionTextColor() const = 0;
+
+ /** returns the color to be used for rendering cell texts.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::o3tl::optional< ::Color > getTextColor() const = 0;
+
+ /** returns the color to be used for text lines (underline, strikethrough) when rendering cell text.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::o3tl::optional< ::Color > getTextLineColor() const = 0;
+
+ /** returns the colors to be used for the row backgrounds.
+
+ If this value is not set, every second row will have a background color derived from the style settings's
+ selection color, the other rows will not have a special background at all.
+
+ If this value is an empty sequence, the rows will not have a special background at all, instead the
+ normal background of the complete control will be used.
+
+ If value is a non-empty sequence, then rows will have the background colors as specified in the sequence,
+ in alternating order.
+ */
+ virtual ::o3tl::optional< ::std::vector< ::Color > >
+ getRowBackgroundColors() const = 0;
+
+ /** determines the vertical alignment of content within a cell
+ */
+ virtual css::style::VerticalAlignment getVerticalAlign() const = 0;
+
+ /** returns an adapter to the sorting functionality of the model
+
+ It is legitimate to return <NULL/> here, in this case, the table model does not support sorting.
+ */
+ virtual ITableDataSort* getSortAdapter() = 0;
+
+ /** returns enabled state.
+ */
+ virtual bool isEnabled() const = 0;
+
+ /// destroys the table model instance
+ virtual ~ITableModel() { }
+ };
+ typedef std::shared_ptr< ITableModel > PTableModel;
+
+
+} } // namespace svt::table
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/table/tablerenderer.hxx b/svtools/inc/table/tablerenderer.hxx
new file mode 100644
index 000000000000..564250155621
--- /dev/null
+++ b/svtools/inc/table/tablerenderer.hxx
@@ -0,0 +1,249 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <table/tabletypes.hxx>
+
+#include <rtl/ustring.hxx>
+
+#include <memory>
+
+namespace com :: sun :: star :: uno { class Any; }
+namespace tools { class Rectangle; }
+namespace vcl { class Window; }
+
+class OutputDevice;
+class StyleSettings;
+namespace vcl {
+ typedef OutputDevice RenderContext;
+};
+
+
+namespace svt { namespace table
+{
+
+
+ //= ITableRenderer
+
+ /** interface to implement by components rendering a ->TableControl
+ */
+ class SAL_NO_VTABLE ITableRenderer
+ {
+ public:
+
+ /** paints a (part of) header area
+
+ There are two header areas in a table control:
+ <ul><li>The row containing all column headers, i.e. <em>above</em> all rows containing the data</li>
+ <li>The column containing all row headers. i.e. <em>left of</em> all columns containing the data</li>
+ </ul>
+
+ A header area is more than the union of the single column/row headers.
+
+ First, there might be less columns than fit into the view - in this case, right
+ beside the right-most column, there's still room which belongs to the column header
+ area, but is not occupied by any particular column header.<br/>
+ An equivalent statement holds for the row header area, if there are fewer rows than
+ fit into the view.
+
+ Second, if the table control has both a row header and a column header,
+ the intersection between those both belongs to both the column header area and the
+ row header area, but not to any particular column or row header.
+
+ There are two flags specifying whether the to-be-painted area is part of the column
+ and/or row header area.
+ <ul><li>If both are <TRUE/>, the intersection of both areas is to be painted.</li>
+ <li>If ->_bIsColHeaderArea is <TRUE/> and ->_bIsRowHeaderArea is <FALSE/>,
+ then ->_rArea denotes the column header area <em>excluding</em> the
+ intersection between row and column header area.</li>
+ <li>Equivalently for ->_bIsColHeaderArea being <FALSE/> and ->_bIsRowHeaderArea
+ being <TRUE/></li>
+ </ul>
+ Note that it's not possible for both ->_bIsColHeaderArea and ->_bIsRowHeaderArea
+ to be <FALSE/> at the same time.
+
+ @param _rDevice
+ the device to paint onto
+ @param _rArea
+ the area to paint into
+ @param _bIsColHeaderArea
+ <TRUE/> if and only if ->_rArea is part of the column header area.
+ @param _bIsRowHeaderArea
+ <TRUE/> if and only if ->_rArea is part of the row header area.
+ @param _rStyle
+ the style to be used for drawing
+ */
+ virtual void PaintHeaderArea(
+ vcl::RenderContext& _rDevice, const tools::Rectangle& _rArea,
+ bool _bIsColHeaderArea, bool _bIsRowHeaderArea,
+ const StyleSettings& _rStyle ) = 0;
+
+ /** paints the header for a given column
+
+ @param _nCol
+ the index of the column to paint
+ @param _rDevice
+ denotes the device to paint onto
+ @param _rArea
+ the are into which the column header should be painted
+ @param _rStyle
+ the style to be used for drawing
+ */
+ virtual void PaintColumnHeader( ColPos _nCol,
+ vcl::RenderContext& _rDevice, const tools::Rectangle& _rArea,
+ const StyleSettings& _rStyle ) = 0;
+
+ /** prepares a row for painting
+
+ Painting a table means painting rows as necessary, in an increasing
+ order. The assumption is that retrieving data for two different rows
+ is (potentially) more expensive than retrieving data for two different
+ columns. Thus, the renderer will get the chance to "seek" to a certain
+ row, and then has to render all cells in this row, before another
+ row is going to be painted.
+
+ @param _nRow
+ the row which is going to be painted. The renderer should
+ at least remember this row, since subsequent calls to
+ ->PaintRowHeader(), ->PaintCell(), and ->FinishRow() will
+ not pass this parameter again.
+
+ However, the renderer is also allowed to render any
+ cell-independent content of this row.
+
+ @param i_hasControlFocus
+ <TRUE/> if and only if the table control currently has the focus
+ @param _bSelected
+ <TRUE/> if and only if the row to be prepared is
+ selected currently.
+ @param _rDevice
+ denotes the device to paint onto
+ @param _rRowArea
+ the are into which the row should be painted. This excludes
+ the row header area, if applicable.
+ @param _rStyle
+ the style to be used for drawing
+ */
+ virtual void PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected,
+ vcl::RenderContext& _rDevice, const tools::Rectangle& _rRowArea,
+ const StyleSettings& _rStyle ) = 0;
+
+ /** paints the header of a row
+
+ The row to be painted is denoted by the most recent call to
+ ->PrepareRow.
+
+ @param _rDevice
+ denotes the device to paint onto
+ @param _rArea
+ the are into which the row header should be painted
+ @param _rStyle
+ the style to be used for drawing
+ */
+ virtual void PaintRowHeader(
+ vcl::RenderContext& _rDevice, tools::Rectangle const & _rArea,
+ StyleSettings const & _rStyle ) = 0;
+
+ /** paints a certain cell
+
+ The row to be painted is denoted by the most recent call to
+ ->PrepareRow.
+
+ @param _bSelected
+ <TRUE/> if and only if the cell to be painted is
+ selected currently. This is the case if either
+ the row or the column of the cell is currently selected.
+ <br/>
+ Note that this flag is equal to the respective flag in the
+ previous ->PrepareRow call, it's passed here for convenience
+ only.
+ @param i_hasControlFocus
+ <TRUE/> if and only if the table control currently has the focus
+ <br/>
+ Note that this flag is equal to the respective flag in the
+ previous ->PrepareRow call, it's passed here for convenience
+ only.
+ @param _rDevice
+ denotes the device to paint onto
+ @param _rArea
+ the are into which the cell should be painted
+ @param _rStyle
+ the style to be used for drawing
+ */
+ virtual void PaintCell( ColPos const i_col,
+ bool i_hasControlFocus, bool _bSelected,
+ vcl::RenderContext& _rDevice, const tools::Rectangle& _rArea,
+ const StyleSettings& _rStyle ) = 0;
+
+ /** draws a cell cursor in the given rectangle
+
+ The cell cursor is used to indicate the active/current cell
+ of a table control.
+ */
+ virtual void ShowCellCursor( vcl::Window& _rView, const tools::Rectangle& _rCursorRect) = 0;
+
+ /** hides the cell cursor previously drawn into the given rectangle
+
+ The cell cursor is used to indicate the active/current cell
+ of a table control.
+ */
+ virtual void HideCellCursor( vcl::Window& _rView ) = 0;
+
+ /** checks whether a given cell content fits into a given target area on a given device.
+
+ @param i_targetDevice
+ denotes the target device for the assumed rendering operation
+
+ @param i_targetArea
+ denotes the area within the target device for the assumed rendering operation.
+
+ @return
+ <TRUE/> if and only if the given cell content could be rendered into the given device and the
+ given area.
+ */
+ virtual bool FitsIntoCell(
+ css::uno::Any const & i_cellContent,
+ OutputDevice& i_targetDevice, tools::Rectangle const & i_targetArea
+ ) const = 0;
+
+ /** attempts to format the content of the given cell as string
+
+ @param i_cellValue
+ the value for which an attempt for a string conversion should be made
+ @param o_cellString
+ the cell content, formatted as string
+ @return
+ <TRUE/> if and only if the content could be formatted as string
+ */
+ virtual bool GetFormattedCellString(
+ css::uno::Any const & i_cellValue,
+ OUString & o_cellString
+ ) const = 0;
+
+ /// deletes the renderer instance
+ virtual ~ITableRenderer() { }
+ };
+ typedef std::shared_ptr< ITableRenderer > PTableRenderer;
+
+
+} } // namespace svt::table
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/table/tablesort.hxx b/svtools/inc/table/tablesort.hxx
new file mode 100644
index 000000000000..c92011cb0d5f
--- /dev/null
+++ b/svtools/inc/table/tablesort.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <table/tabletypes.hxx>
+
+
+namespace svt { namespace table
+{
+
+
+ //= ColumnSortDirection
+
+ enum ColumnSortDirection
+ {
+ ColumnSortAscending,
+ ColumnSortDescending
+ };
+
+
+ //= ColumnSort
+
+ struct ColumnSort
+ {
+ ColPos nColumnPos;
+ ColumnSortDirection eSortDirection;
+
+ ColumnSort()
+ :nColumnPos( COL_INVALID )
+ ,eSortDirection( ColumnSortAscending )
+ {
+ }
+
+ };
+
+
+ //= ITableDataSort
+
+ /** provides sorting functionality for the data underlying an ITableModel
+ */
+ class SAL_NO_VTABLE ITableDataSort
+ {
+ public:
+ /** sorts the rows in the model by the given column's data, in the given direction.
+ */
+ virtual void sortByColumn( ColPos const i_column, ColumnSortDirection const i_sortDirection ) = 0;
+
+ /** retrieves the current sort order of the data
+
+ If the <code>nColumnIndex</code> member of the returned structure is <code>COL_INVALID</code>, then
+ the data is currently not sorted.
+ */
+ virtual ColumnSort getCurrentSortOrder() const = 0;
+
+ protected:
+ ~ITableDataSort() {}
+ };
+
+
+} } // namespace svt::table
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/table/tabletypes.hxx b/svtools/inc/table/tabletypes.hxx
new file mode 100644
index 000000000000..1e18786f7ff0
--- /dev/null
+++ b/svtools/inc/table/tabletypes.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/types.h>
+
+
+namespace svt { namespace table
+{
+
+ /// a value denoting the size of a table
+ typedef sal_Int32 TableSize;
+
+ /// a value denoting a column position within a table
+ typedef sal_Int32 ColPos;
+ /// a value denoting a row position within a table
+ typedef sal_Int32 RowPos;
+
+ typedef sal_Int32 TableMetrics;
+
+/// denotes the column containing the row headers
+#define COL_ROW_HEADERS (::svt::table::ColPos(-1))
+/// denotes the row containing the column headers
+#define ROW_COL_HEADERS (::svt::table::RowPos(-1))
+
+/// denotes an invalid column index
+#define COL_INVALID (::svt::table::ColPos(-2))
+/// denotes an invalid row index
+#define ROW_INVALID (::svt::table::RowPos(-2))
+
+
+} } // namespace svt::table
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */