LCOV - code coverage report
Current view: top level - svtools/inc/table - tablecontrolinterface.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 5 11 45.5 %
Date: 2014-11-03 Functions: 3 6 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SVTOOLS_INC_TABLE_TABLECONTROLINTERFACE_HXX
      21             : #define INCLUDED_SVTOOLS_INC_TABLE_TABLECONTROLINTERFACE_HXX
      22             : 
      23             : #include <sal/types.h>
      24             : #include <vcl/event.hxx>
      25             : #include <vcl/seleng.hxx>
      26             : 
      27             : #include <svtools/table/tabletypes.hxx>
      28             : #include <svtools/table/tablemodel.hxx>
      29             : 
      30             : class Pointer;
      31             : 
      32             : 
      33             : namespace svt { namespace table
      34             : {
      35             : 
      36             : 
      37             : 
      38             :     //= TableControlAction
      39             : 
      40             :     enum TableControlAction
      41             :     {
      42             :         /// moves the cursor in the table control one row up, if possible, by keeping the current column
      43             :         cursorUp,
      44             :         /// moves the cursor in the table control one row down, if possible, by keeping the current column
      45             :         cursorDown,
      46             :         /// moves the cursor in the table control one column to the left, if possible, by keeping the current row
      47             :         cursorLeft,
      48             :         /// moves the cursor in the table control one column to the right, if possible, by keeping the current row
      49             :         cursorRight,
      50             :         /// moves the cursor to the beginning of the current line
      51             :         cursorToLineStart,
      52             :         /// moves the cursor to the end of the current line
      53             :         cursorToLineEnd,
      54             :         /// moves the cursor to the first row, keeping the current column
      55             :         cursorToFirstLine,
      56             :         /// moves the cursor to the last row, keeping the current column
      57             :         cursorToLastLine,
      58             :         /// moves the cursor one page up, keeping the current column
      59             :         cursorPageUp,
      60             :         /// moves the cursor one page down, keeping the current column
      61             :         cursorPageDown,
      62             :         /// moves the cursor to the top-most, left-most cell
      63             :         cursorTopLeft,
      64             :         /// moves the cursor to the bottom-most, right-most cell
      65             :         cursorBottomRight,
      66             :         /// selects the row, where the actual cursor is
      67             :         cursorSelectRow,
      68             :         /// selects the rows, above the actual cursor is
      69             :         cursorSelectRowUp,
      70             :         /// selects the row, beneath the actual cursor is
      71             :         cursorSelectRowDown,
      72             :         /// selects the row, from the actual cursor till top
      73             :         cursorSelectRowAreaTop,
      74             :         /// selects the row, from the actual cursor till bottom
      75             :         cursorSelectRowAreaBottom,
      76             : 
      77             :         /// invalid and final enumeration value, not to be actually used
      78             :         invalidTableControlAction
      79             :     };
      80             : 
      81             : 
      82             :     //= TableCellArea
      83             : 
      84             :     enum TableCellArea
      85             :     {
      86             :         CellContent,
      87             :         ColumnDivider
      88             :     };
      89             : 
      90             : 
      91             :     //= TableCell
      92             : 
      93             :     struct TableCell
      94             :     {
      95             :         ColPos          nColumn;
      96             :         RowPos          nRow;
      97             :         TableCellArea   eArea;
      98             : 
      99             :         TableCell()
     100             :             :nColumn( COL_INVALID )
     101             :             ,nRow( ROW_INVALID )
     102             :             ,eArea( CellContent )
     103             :         {
     104             :         }
     105             : 
     106           0 :         TableCell( ColPos const i_column, RowPos const i_row )
     107             :             :nColumn( i_column )
     108             :             ,nRow( i_row )
     109           0 :             ,eArea( CellContent )
     110             :         {
     111           0 :         }
     112             :     };
     113             : 
     114             : 
     115             :     //= ColumnMetrics
     116             : 
     117             :     struct ColumnMetrics
     118             :     {
     119             :         /** the start of the column, in pixels. Might be negative, in case the column is scrolled out of the visible
     120             :             area. Note: see below.
     121             :         */
     122             :         long    nStartPixel;
     123             : 
     124             :         /** the end of the column, in pixels, plus 1. Effectively, this is the accumulated width of a all columns
     125             :             up to the current one.
     126             : 
     127             :             Huh? Earlier you said that the nStartPixel of columns
     128             :             scrolled out (to the left) of the visible area is
     129             :             negative. Also, where is the promise that there is no gap
     130             :             between columns? The above claim would be true only if the
     131             :             first column always started at zero, and there is never a
     132             :             gap. So these doc comments are inconsistent. How
     133             :             surprising.
     134             :         */
     135             :         long    nEndPixel;
     136             : 
     137           0 :         ColumnMetrics()
     138             :             :nStartPixel(0)
     139           0 :             ,nEndPixel(0)
     140             :         {
     141           0 :         }
     142             : 
     143          32 :         ColumnMetrics( long const i_start, long const i_end )
     144             :             :nStartPixel( i_start )
     145          32 :             ,nEndPixel( i_end )
     146             :         {
     147          32 :         }
     148             :     };
     149             : 
     150             : 
     151             :     //= TableArea
     152             : 
     153             :     enum TableArea
     154             :     {
     155             :         TableAreaColumnHeaders,
     156             :         TableAreaRowHeaders,
     157             :         TableAreaDataArea,
     158             :         TableAreaAll
     159             :     };
     160             : 
     161             : 
     162             :     //= ITableControl
     163             : 
     164             :     /** defines a callback interface to be implemented by a concrete table control
     165             :     */
     166           2 :     class SAL_NO_VTABLE ITableControl
     167             :     {
     168             :     public:
     169             :         /** hides the cell cursor
     170             : 
     171             :             The method cares for successive calls, that is, for every call to
     172             :             ->hideCursor(), you need one call to ->showCursor. Only if the number
     173             :             of both calls matches, the cursor is really shown.
     174             : 
     175             :             @see showCursor
     176             :         */
     177             :         virtual void    hideCursor() = 0;
     178             : 
     179             :         /** shows the cell cursor
     180             : 
     181             :             @see hideCursor
     182             :         */
     183             :         virtual void    showCursor() = 0;
     184             : 
     185             :         /** dispatches an action to the table control
     186             : 
     187             :             @return
     188             :                 <TRUE/> if the action could be dispatched successfully, <FALSE/> otherwise. Usual
     189             :                 failure conditions include some other instance vetoing the action, or impossibility
     190             :                 to execute the action at all (for instance moving up one row when already positioned
     191             :                 on the very first row).
     192             : 
     193             :             @see TableControlAction
     194             :         */
     195             :         virtual bool    dispatchAction( TableControlAction _eAction ) = 0;
     196             : 
     197             :         /** returns selection engine*/
     198             :         virtual SelectionEngine* getSelEngine() = 0;
     199             : 
     200             :         /** returns the table model
     201             : 
     202             :             The returned model is guaranteed to not be <NULL/>.
     203             :         */
     204             :         virtual PTableModel getModel() const = 0;
     205             : 
     206             :         /// returns the index of the currently active column
     207             :         virtual ColPos  getCurrentColumn() const = 0;
     208             : 
     209             :         /// returns the index of the currently active row
     210             :         virtual RowPos  getCurrentRow() const = 0;
     211             : 
     212             :         /// activates the given cell
     213             :         virtual bool    activateCell( ColPos const i_col, RowPos const i_row ) = 0;
     214             : 
     215             :         /// retrieves the size of the table window, in pixels
     216             :         virtual ::Size  getTableSizePixel() const = 0;
     217             : 
     218             :         /// sets a new mouse pointer for the table window
     219             :         virtual void    setPointer( Pointer const & i_pointer ) = 0;
     220             : 
     221             :         /// captures the mouse to the table window
     222             :         virtual void    captureMouse() = 0;
     223             : 
     224             :         /// releases the mouse, after it had previously been captured
     225             :         virtual void    releaseMouse() = 0;
     226             : 
     227             :         /// invalidates the table window
     228             :         virtual void    invalidate( TableArea const i_what ) = 0;
     229             : 
     230             :         /// calculates a width, given in pixels, into a AppFont-based width
     231             :         virtual long    pixelWidthToAppFont( long const i_pixels ) const = 0;
     232             : 
     233             :         /// shows a trackign rectangle
     234             :         virtual void    showTracking( Rectangle const & i_location, sal_uInt16 const i_flags ) = 0;
     235             : 
     236             :         /// hides a prviously shown tracking rectangle
     237             :         virtual void    hideTracking() = 0;
     238             : 
     239             :         /// does a hit test for the given pixel coordinates
     240             :         virtual TableCell       hitTest( const Point& rPoint ) const = 0;
     241             : 
     242             :         /// retrieves the metrics for a given column
     243             :         virtual ColumnMetrics   getColumnMetrics( ColPos const i_column ) const = 0;
     244             : 
     245             :         /// determines whether a given row is selected
     246             :         virtual bool isRowSelected( RowPos _nRow ) const = 0;
     247             : 
     248           2 :         virtual ~ITableControl() {};
     249             :     };
     250             : 
     251             : 
     252             : } } // namespace svt::table
     253             : 
     254             : 
     255             : #endif // INCLUDED_SVTOOLS_INC_TABLE_TABLECONTROLINTERFACE_HXX
     256             : 
     257             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10