summaryrefslogtreecommitdiff
path: root/svtools/inc/table
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-05-06 15:29:12 +0300
committerTor Lillqvist <tml@collabora.com>2014-05-06 15:30:05 +0300
commit9124f7e8bc2b9b718d82e3734b4d4799ed1fcff1 (patch)
treed1c3f965d1bf4964083807dfa0657361de513d3b /svtools/inc/table
parentf4d3558334c5b403c2f1298f2ef831607778dae5 (diff)
Move headers included only in svtools to svtools
Change-Id: I66e443b5b641aaf16e1918f139a6b6a173ef7d4c
Diffstat (limited to 'svtools/inc/table')
-rw-r--r--svtools/inc/table/defaultinputhandler.hxx65
-rw-r--r--svtools/inc/table/gridtablerenderer.hxx121
-rw-r--r--svtools/inc/table/tablecontrol.hxx218
-rw-r--r--svtools/inc/table/tablecontrolinterface.hxx257
4 files changed, 661 insertions, 0 deletions
diff --git a/svtools/inc/table/defaultinputhandler.hxx b/svtools/inc/table/defaultinputhandler.hxx
new file mode 100644
index 000000000000..24945278a4c0
--- /dev/null
+++ b/svtools/inc/table/defaultinputhandler.hxx
@@ -0,0 +1,65 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_TABLE_DEFAULTINPUTHANDLER_HXX
+#define INCLUDED_SVTOOLS_TABLE_DEFAULTINPUTHANDLER_HXX
+
+#include <svtools/table/tableinputhandler.hxx>
+#include <svtools/table/tabletypes.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+
+namespace svt { namespace table
+{
+
+
+ struct DefaultInputHandler_Impl;
+
+
+ //= DefaultInputHandler
+
+ class DefaultInputHandler : public ITableInputHandler
+ {
+ private:
+ ::boost::scoped_ptr< DefaultInputHandler_Impl > m_pImpl;
+
+ public:
+ DefaultInputHandler();
+ virtual ~DefaultInputHandler();
+
+ virtual bool MouseMove ( ITableControl& _rControl, const MouseEvent& rMEvt ) SAL_OVERRIDE;
+ virtual bool MouseButtonDown ( ITableControl& _rControl, const MouseEvent& rMEvt ) SAL_OVERRIDE;
+ virtual bool MouseButtonUp ( ITableControl& _rControl, const MouseEvent& rMEvt ) SAL_OVERRIDE;
+ virtual bool KeyInput ( ITableControl& _rControl, const KeyEvent& rKEvt ) SAL_OVERRIDE;
+ virtual bool GetFocus ( ITableControl& _rControl ) SAL_OVERRIDE;
+ virtual bool LoseFocus ( ITableControl& _rControl ) SAL_OVERRIDE;
+ virtual bool RequestHelp ( ITableControl& _rControl, const HelpEvent& rHEvt ) SAL_OVERRIDE;
+ virtual bool Command ( ITableControl& _rControl, const CommandEvent& rCEvt ) SAL_OVERRIDE;
+ virtual bool PreNotify ( ITableControl& _rControl, NotifyEvent& rNEvt ) SAL_OVERRIDE;
+ virtual bool Notify ( ITableControl& _rControl, NotifyEvent& rNEvt ) SAL_OVERRIDE;
+ };
+
+
+} } // namespace svt::table
+
+
+#endif // INCLUDED_SVTOOLS_TABLE_DEFAULTINPUTHANDLER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/table/gridtablerenderer.hxx b/svtools/inc/table/gridtablerenderer.hxx
new file mode 100644
index 000000000000..c06f0baadd15
--- /dev/null
+++ b/svtools/inc/table/gridtablerenderer.hxx
@@ -0,0 +1,121 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_TABLE_GRIDTABLERENDERER_HXX
+#define INCLUDED_SVTOOLS_TABLE_GRIDTABLERENDERER_HXX
+
+#include <svtools/table/tablemodel.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+
+namespace svt { namespace table
+{
+
+
+ struct GridTableRenderer_Impl;
+
+
+ //= GridTableRenderer
+
+ /** a default implementation for the ->ITableRenderer interface
+
+ This class is able to paint a table grid, table headers, and cell
+ backgrounds according to the selected/active state of cells.
+ */
+ class GridTableRenderer : public ITableRenderer
+ {
+ private:
+ ::boost::scoped_ptr< GridTableRenderer_Impl > m_pImpl;
+
+ public:
+ /** creates a table renderer associated with the given model
+
+ @param _rModel
+ the model which should be rendered. The caller is responsible
+ for lifetime control, that is, the model instance must live
+ at least as long as the renderer instance lives
+ */
+ GridTableRenderer( ITableModel& _rModel );
+ virtual ~GridTableRenderer();
+
+ /** determines whether or not to paint grid lines
+ */
+ bool useGridLines() const;
+
+ /** controls whether or not to paint grid lines
+ */
+ void useGridLines( bool const i_use );
+
+ public:
+ // ITableRenderer overridables
+ virtual void PaintHeaderArea(
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ bool _bIsColHeaderArea, bool _bIsRowHeaderArea,
+ const StyleSettings& _rStyle ) SAL_OVERRIDE;
+ virtual void PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ const StyleSettings& _rStyle ) SAL_OVERRIDE;
+ virtual void PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rRowArea,
+ const StyleSettings& _rStyle ) SAL_OVERRIDE;
+ virtual void PaintRowHeader(
+ bool i_hasControlFocus, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ const StyleSettings& _rStyle ) SAL_OVERRIDE;
+ virtual void PaintCell( ColPos const i_col,
+ bool i_hasControlFocus, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ const StyleSettings& _rStyle ) SAL_OVERRIDE;
+ virtual void ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect) SAL_OVERRIDE;
+ virtual void HideCellCursor( Window& _rView, const Rectangle& _rCursorRect) SAL_OVERRIDE;
+ virtual bool FitsIntoCell(
+ ::com::sun::star::uno::Any const & i_cellContent,
+ ColPos const i_colPos, RowPos const i_rowPos,
+ bool const i_active, bool const i_selected,
+ OutputDevice& i_targetDevice, Rectangle const & i_targetArea
+ ) const SAL_OVERRIDE;
+ virtual bool GetFormattedCellString(
+ ::com::sun::star::uno::Any const & i_cellValue,
+ ColPos const i_colPos, RowPos const i_rowPos,
+ OUString & o_cellString
+ ) const SAL_OVERRIDE;
+
+ private:
+ struct CellRenderContext;
+
+ void impl_paintCellContent(
+ CellRenderContext const & i_context
+ );
+ void impl_paintCellImage(
+ CellRenderContext const & i_context,
+ Image const & i_image
+ );
+ void impl_paintCellText(
+ CellRenderContext const & i_context,
+ OUString const & i_text
+ );
+ };
+
+} } // namespace svt::table
+
+
+#endif // INCLUDED_SVTOOLS_TABLE_GRIDTABLERENDERER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/table/tablecontrol.hxx b/svtools/inc/table/tablecontrol.hxx
new file mode 100644
index 000000000000..4d05ee2d8371
--- /dev/null
+++ b/svtools/inc/table/tablecontrol.hxx
@@ -0,0 +1,218 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_TABLE_TABLECONTROL_HXX
+#define INCLUDED_SVTOOLS_TABLE_TABLECONTROL_HXX
+
+#include <svtools/svtdllapi.h>
+#include <svtools/table/tablemodel.hxx>
+#include <svtools/accessibletable.hxx>
+#include <svtools/accessiblefactory.hxx>
+
+#include <vcl/ctrl.hxx>
+#include <vcl/seleng.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+
+
+
+namespace svt { namespace table
+{
+
+
+ class TableControl_Impl;
+
+
+ //= TableControl
+
+ /** a basic control which manages table-like data, i.e. a number of cells
+ organized in <code>m</code> rows and <code>n</code> columns.
+
+ The control itself does not do any assumptions about the concrete data
+ it displays, this is encapsulated in an instance supporting the
+ ->ITableModel interface.
+
+ Also, the control does not do any assumptions about how the model's
+ content is rendered. This is the responsibility of a component
+ supporting the ->ITableRenderer interface (the renderer is obtained from
+ the model).
+
+ The control supports the concept of a <em>current</em> (or <em>active</em>
+ cell).
+ The control supports accessibility, this is encapsulated in IAccessibleTable
+ */
+ class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable
+ {
+ private:
+ ::boost::shared_ptr< TableControl_Impl > m_pImpl;
+
+
+ public:
+ TableControl( Window* _pParent, WinBits _nStyle );
+ virtual ~TableControl();
+
+ /// sets a new table model
+ void SetModel( PTableModel _pModel );
+ /// retrieves the current table model
+ PTableModel GetModel() const;
+
+ /** retrieves the current row
+
+ The current row is the one which contains the active cell.
+
+ @return
+ the row index of the active cell, or ->ROW_INVALID
+ if there is no active cell, e.g. because the table does
+ not contain any rows or columns.
+ */
+ sal_Int32 GetCurrentRow() const SAL_OVERRIDE;
+
+ ITableControl&
+ getTableControlInterface();
+
+ /** retrieves the current column
+
+ The current col is the one which contains the active cell.
+
+ @return
+ the column index of the active cell, or ->COL_INVALID
+ if there is no active cell, e.g. because the table does
+ not contain any rows or columns.
+ */
+ sal_Int32 GetCurrentColumn() const SAL_OVERRIDE;
+
+ /** activates the cell at the given position
+
+ @return
+ <sal_True/> if the move was successful, <FALSE/> otherwise. Usual
+ failure conditions include some other instance vetoing the move,
+ or impossibility to execute the move at all (for instance because
+ of invalid coordinates).
+ */
+ bool GoTo( ColPos _nColumnPos, RowPos _nRow);
+
+ /** moves the active cell to the given column, by keeping the active row
+
+ @return
+ <sal_True/> if the move was successful, <FALSE/> otherwise. Usual
+ failure conditions include some other instance vetoing the move,
+ or impossibility to execute the move at all (for instance because
+ of invalid coordinates).
+ */
+ inline bool GoToColumn( ColPos _nColumn )
+ {
+ return GoTo( _nColumn, GetCurrentRow() );
+ }
+
+ /** moves the active cell to the given row, by keeping the active column
+
+ @return
+ <sal_True/> if the move was successful, <FALSE/> otherwise. Usual
+ failure conditions include some other instance vetoing the move,
+ or impossibility to execute the move at all (for instance because
+ of invalid coordinates).
+ */
+ bool GoToRow( RowPos _nRow )
+ {
+ return GoTo( GetCurrentColumn(), _nRow );
+ }
+
+ SVT_DLLPRIVATE virtual void Resize() SAL_OVERRIDE;
+ virtual void Select();
+
+ /**after removing a row, updates the vector which contains the selected rows
+ if the row, which should be removed, is selected, it will be erased from the vector
+ */
+ SelectionEngine* getSelEngine();
+ Window& getDataWindow();
+
+ // Window overridables
+ virtual void GetFocus() SAL_OVERRIDE;
+ virtual void LoseFocus() SAL_OVERRIDE;
+ virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
+ virtual void StateChanged( StateChangedType i_nStateChange ) SAL_OVERRIDE;
+
+ /** Creates and returns the accessible object of the whole GridControl. */
+ SVT_DLLPRIVATE virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
+ SVT_DLLPRIVATE virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) SAL_OVERRIDE;
+ SVT_DLLPRIVATE virtual OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const SAL_OVERRIDE;
+ SVT_DLLPRIVATE virtual bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ) SAL_OVERRIDE;
+ SVT_DLLPRIVATE virtual OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const SAL_OVERRIDE;
+ SVT_DLLPRIVATE virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet, AccessibleTableControlObjType eObjType ) const SAL_OVERRIDE;
+
+ // temporary methods
+ // Those do not really belong into the public API - they're intended for firing A11Y-related events. However,
+ // firing those events should be an implementation internal to the TableControl resp. TableControl_Impl,
+ // instead of something triggered externally.
+ void commitCellEventIfAccessibleAlive( sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue );
+ void commitTableEventIfAccessibleAlive( sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue );
+
+
+ // IAccessibleTable
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const SAL_OVERRIDE;
+ virtual void GrabFocus() SAL_OVERRIDE;
+ virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( bool bCreate = true ) SAL_OVERRIDE;
+ virtual Window* GetAccessibleParentWindow() const SAL_OVERRIDE;
+ virtual Window* GetWindowInstance() SAL_OVERRIDE;
+ virtual sal_Int32 GetAccessibleControlCount() const SAL_OVERRIDE;
+ virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) SAL_OVERRIDE;
+ virtual long GetRowCount() const SAL_OVERRIDE;
+ virtual long GetColumnCount() const SAL_OVERRIDE;
+ virtual bool HasRowHeader() const SAL_OVERRIDE;
+ virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint ) SAL_OVERRIDE;
+ virtual Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) SAL_OVERRIDE;
+ virtual Rectangle calcHeaderCellRect( bool _bIsColumnBar, sal_Int32 nPos) SAL_OVERRIDE;
+ virtual Rectangle calcTableRect( bool _bOnScreen = true ) SAL_OVERRIDE;
+ virtual Rectangle calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos ) SAL_OVERRIDE;
+ virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) SAL_OVERRIDE;
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) SAL_OVERRIDE;
+ virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const SAL_OVERRIDE;
+ virtual OUString GetRowDescription( sal_Int32 _nRow ) const SAL_OVERRIDE;
+ virtual OUString GetRowName(sal_Int32 _nIndex) const SAL_OVERRIDE;
+ virtual OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const SAL_OVERRIDE;
+ virtual OUString GetColumnName( sal_Int32 _nIndex ) const SAL_OVERRIDE;
+ virtual css::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const SAL_OVERRIDE;
+ virtual bool HasRowHeader() SAL_OVERRIDE;
+ virtual bool HasColHeader() SAL_OVERRIDE;
+ virtual OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const SAL_OVERRIDE;
+
+ virtual sal_Int32 GetSelectedRowCount() const SAL_OVERRIDE;
+ virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const SAL_OVERRIDE;
+ virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const SAL_OVERRIDE;
+ virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select ) SAL_OVERRIDE;
+ virtual void SelectAllRows( bool const i_select ) SAL_OVERRIDE;
+
+
+ private:
+ DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* );
+
+ private:
+ TableControl(); // never implemented
+ TableControl( const TableControl& ); // never implemented
+ TableControl& operator=( const TableControl& ); // never implemented
+ };
+
+
+} } // namespace svt::table
+
+
+#endif // INCLUDED_SVTOOLS_TABLE_TABLECONTROL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/table/tablecontrolinterface.hxx b/svtools/inc/table/tablecontrolinterface.hxx
new file mode 100644
index 000000000000..553ce4078729
--- /dev/null
+++ b/svtools/inc/table/tablecontrolinterface.hxx
@@ -0,0 +1,257 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_SVTOOLS_TABLE_TABLECONTROLINTERFACE_HXX
+#define INCLUDED_SVTOOLS_TABLE_TABLECONTROLINTERFACE_HXX
+
+#include <sal/types.h>
+#include <vcl/event.hxx>
+#include <vcl/seleng.hxx>
+
+#include <svtools/table/tabletypes.hxx>
+#include <svtools/table/tablemodel.hxx>
+
+class Pointer;
+
+
+namespace svt { namespace table
+{
+
+
+
+ //= TableControlAction
+
+ enum TableControlAction
+ {
+ /// moves the cursor in the table control one row up, if possible, by keeping the current column
+ cursorUp,
+ /// moves the cursor in the table control one row down, if possible, by keeping the current column
+ cursorDown,
+ /// moves the cursor in the table control one column to the left, if possible, by keeping the current row
+ cursorLeft,
+ /// moves the cursor in the table control one column to the right, if possible, by keeping the current row
+ cursorRight,
+ /// moves the cursor to the beginning of the current line
+ cursorToLineStart,
+ /// moves the cursor to the end of the current line
+ cursorToLineEnd,
+ /// moves the cursor to the first row, keeping the current column
+ cursorToFirstLine,
+ /// moves the cursor to the last row, keeping the current column
+ cursorToLastLine,
+ /// moves the cursor one page up, keeping the current column
+ cursorPageUp,
+ /// moves the cursor one page down, keeping the current column
+ cursorPageDown,
+ /// moves the cursor to the top-most, left-most cell
+ cursorTopLeft,
+ /// moves the cursor to the bottom-most, right-most cell
+ cursorBottomRight,
+ /// selects the row, where the actual cursor is
+ cursorSelectRow,
+ /// selects the rows, above the actual cursor is
+ cursorSelectRowUp,
+ /// selects the row, beneath the actual cursor is
+ cursorSelectRowDown,
+ /// selects the row, from the actual cursor till top
+ cursorSelectRowAreaTop,
+ /// selects the row, from the actual cursor till bottom
+ cursorSelectRowAreaBottom,
+
+ /// invalid and final enumeration value, not to be actually used
+ invalidTableControlAction
+ };
+
+
+ //= TableCellArea
+
+ enum TableCellArea
+ {
+ CellContent,
+ ColumnDivider
+ };
+
+
+ //= TableCell
+
+ struct TableCell
+ {
+ ColPos nColumn;
+ RowPos nRow;
+ TableCellArea eArea;
+
+ TableCell()
+ :nColumn( COL_INVALID )
+ ,nRow( ROW_INVALID )
+ ,eArea( CellContent )
+ {
+ }
+
+ TableCell( ColPos const i_column, RowPos const i_row )
+ :nColumn( i_column )
+ ,nRow( i_row )
+ ,eArea( CellContent )
+ {
+ }
+ };
+
+
+ //= ColumnMetrics
+
+ struct ColumnMetrics
+ {
+ /** the start of the column, in pixels. Might be negative, in case the column is scrolled out of the visible
+ area. Note: see below.
+ */
+ long nStartPixel;
+
+ /** the end of the column, in pixels, plus 1. Effectively, this is the accumulated width of a all columns
+ up to the current one.
+
+ Huh? Earlier you said that the nStartPixel of columns
+ scrolled out (to the left) of the visible area is
+ negative. Also, where is the promise that there is no gap
+ between columns? The above claim would be true only if the
+ first column always started at zero, and there is never a
+ gap. So these doc comments are inconsistent. How
+ surprising.
+ */
+ long nEndPixel;
+
+ ColumnMetrics()
+ :nStartPixel(0)
+ ,nEndPixel(0)
+ {
+ }
+
+ ColumnMetrics( long const i_start, long const i_end )
+ :nStartPixel( i_start )
+ ,nEndPixel( i_end )
+ {
+ }
+ };
+
+
+ //= TableArea
+
+ enum TableArea
+ {
+ TableAreaColumnHeaders,
+ TableAreaRowHeaders,
+ TableAreaDataArea,
+ TableAreaAll
+ };
+
+
+ //= ITableControl
+
+ /** defines a callback interface to be implemented by a concrete table control
+ */
+ class SAL_NO_VTABLE ITableControl
+ {
+ public:
+ /** hides the cell cursor
+
+ The method cares for successive calls, that is, for every call to
+ ->hideCursor(), you need one call to ->showCursor. Only if the number
+ of both calls matches, the cursor is really shown.
+
+ @see showCursor
+ */
+ virtual void hideCursor() = 0;
+
+ /** shows the cell cursor
+
+ @see hideCursor
+ */
+ virtual void showCursor() = 0;
+
+ /** dispatches an action to the table control
+
+ @return
+ <TRUE/> if the action could be dispatched successfully, <FALSE/> otherwise. Usual
+ failure conditions include some other instance vetoing the action, or impossibility
+ to execute the action at all (for instance moving up one row when already positioned
+ on the very first row).
+
+ @see TableControlAction
+ */
+ virtual bool dispatchAction( TableControlAction _eAction ) = 0;
+
+ /** returns selection engine*/
+ virtual SelectionEngine* getSelEngine() = 0;
+
+ /** returns the table model
+
+ The returned model is guaranteed to not be <NULL/>.
+ */
+ virtual PTableModel getModel() const = 0;
+
+ /// returns the index of the currently active column
+ virtual ColPos getCurrentColumn() const = 0;
+
+ /// returns the index of the currently active row
+ virtual RowPos getCurrentRow() const = 0;
+
+ /// activates the given cell
+ virtual bool activateCell( ColPos const i_col, RowPos const i_row ) = 0;
+
+ /// retrieves the size of the table window, in pixels
+ virtual ::Size getTableSizePixel() const = 0;
+
+ /// sets a new mouse pointer for the table window
+ virtual void setPointer( Pointer const & i_pointer ) = 0;
+
+ /// captures the mouse to the table window
+ virtual void captureMouse() = 0;
+
+ /// releases the mouse, after it had previously been captured
+ virtual void releaseMouse() = 0;
+
+ /// invalidates the table window
+ virtual void invalidate( TableArea const i_what ) = 0;
+
+ /// calculates a width, given in pixels, into a AppFont-based width
+ virtual long pixelWidthToAppFont( long const i_pixels ) const = 0;
+
+ /// shows a trackign rectangle
+ virtual void showTracking( Rectangle const & i_location, sal_uInt16 const i_flags ) = 0;
+
+ /// hides a prviously shown tracking rectangle
+ virtual void hideTracking() = 0;
+
+ /// does a hit test for the given pixel coordinates
+ virtual TableCell hitTest( const Point& rPoint ) const = 0;
+
+ /// retrieves the metrics for a given column
+ virtual ColumnMetrics getColumnMetrics( ColPos const i_column ) const = 0;
+
+ /// determines whether a given row is selected
+ virtual bool isRowSelected( RowPos _nRow ) const = 0;
+
+ virtual ~ITableControl() {};
+ };
+
+
+} } // namespace svt::table
+
+
+#endif // INCLUDED_SVTOOLS_TABLE_TABLECONTROLINTERFACE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */