LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/svtools/table - tablecontrolinterface.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 11 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 2 0.0 %

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

Generated by: LCOV version 1.10