LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/svtools/table - tablerenderer.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2 0.0 %
Date: 2012-12-27 Functions: 0 3 0.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 SVTOOLS_INC_TABLE_TABLERENDERER_HXX
      21             : #define SVTOOLS_INC_TABLE_TABLERENDERER_HXX
      22             : 
      23             : #include <svtools/table/tabletypes.hxx>
      24             : 
      25             : #include <vcl/outdev.hxx>
      26             : 
      27             : #include <boost/shared_ptr.hpp>
      28             : 
      29             : //........................................................................
      30             : namespace svt { namespace table
      31             : {
      32             : //........................................................................
      33             : 
      34             :     //====================================================================
      35             :     //= ITableRenderer
      36             :     //====================================================================
      37             :     /** interface to implement by components rendering a ->TableControl
      38             :     */
      39           0 :     class SAL_NO_VTABLE ITableRenderer
      40             :     {
      41             :         public:
      42             : 
      43             :         /** paints a (part of) header area
      44             : 
      45             :             There are two header areas in a table control:
      46             :             <ul><li>The row containing all column headers, i.e. <em>above</em> all rows containing the data</li>
      47             :                 <li>The column containing all row headers. i.e. <em>left of</em> all columns containing the data</li>
      48             :             </ul>
      49             : 
      50             :             A header area is more than the union of the single column/row headers.
      51             : 
      52             :             First, there might be less columns than fit into the view - in this case, right
      53             :             beside the right-most column, there's still room which belongs to the column header
      54             :             area, but is not occupied by any particular column header.<br/>
      55             :             An equivalent statement holds for the row header area, if there are less rows than
      56             :             fit into the view.
      57             : 
      58             :             Second, if the table control has both a row header and a column header,
      59             :             the intersection between those both belongs to both the column header area and the
      60             :             row header area, but not to any particular column or row header.
      61             : 
      62             :             There are two flags specifying whether the to-be-painted area is part of the column
      63             :             and/or row header area.
      64             :             <ul><li>If both are <TRUE/>, the intersection of both areas is to be painted.</li>
      65             :                 <li>If ->_bIsColHeaderArea is <TRUE/> and ->_bIsRowHeaderArea is <FALSE/>,
      66             :                     then ->_rArea denotes the column header area <em>excluding</em> the
      67             :                     intersection between row and column header area.</li>
      68             :                 <li>Equivalently for ->_bIsColHeaderArea being <FALSE/> and ->_bIsRowHeaderArea
      69             :                     being <TRUE/></li>
      70             :             </ul>
      71             :             Note that it's not possible for both ->_bIsColHeaderArea and ->_bIsRowHeaderArea
      72             :             to be <FALSE/> at the same time.
      73             : 
      74             :             @param _rDevice
      75             :                 the device to paint onto
      76             :             @param _rArea
      77             :                 the area to paint into
      78             :             @param _bIsColHeaderArea
      79             :                 <TRUE/> if and only if ->_rArea is part of the column header area.
      80             :             @param _bIsRowHeaderArea
      81             :                 <TRUE/> if and only if ->_rArea is part of the row header area.
      82             :             @param _rStyle
      83             :                 the style to be used for drawing
      84             :         */
      85             :         virtual void    PaintHeaderArea(
      86             :                             OutputDevice& _rDevice, const Rectangle& _rArea,
      87             :                             bool _bIsColHeaderArea, bool _bIsRowHeaderArea,
      88             :                             const StyleSettings& _rStyle ) = 0;
      89             : 
      90             :         /** paints the header for a given column
      91             : 
      92             :             @param _nCol
      93             :                 the index of the column to paint
      94             :             @param _bActive
      95             :                 <TRUE/> if and only if the column whose column is to be painted
      96             :                 contains the active cell.
      97             :             @param _bSelected
      98             :                 <TRUE/> if and only if the column whose column is to be painted
      99             :                 is selected currently.
     100             :             @param _rDevice
     101             :                 denotes the device to paint onto
     102             :             @param _rArea
     103             :                 the are into which the column header should be painted
     104             :             @param _rStyle
     105             :                 the style to be used for drawing
     106             :         */
     107             :         virtual void    PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected,
     108             :                             OutputDevice& _rDevice, const Rectangle& _rArea,
     109             :                             const StyleSettings& _rStyle ) = 0;
     110             : 
     111             :         /** prepares a row for painting
     112             : 
     113             :             Painting a table means painting rows as necessary, in an increasing
     114             :             order. The assumption is that retrieving data for two different rows
     115             :             is (potentially) more expensive than retrieving data for two different
     116             :             columns. Thus, the renderer will get the chance to "seek" to a certain
     117             :             row, and then has to render all cells in this row, before another
     118             :             row is going to be painted.
     119             : 
     120             :             @param _nRow
     121             :                 the row which is going to be painted. The renderer should
     122             :                 at least remember this row, since subsequent calls to
     123             :                 ->PaintRowHeader(), ->PaintCell(), and ->FinishRow() will
     124             :                 not pass this parameter again.
     125             : 
     126             :                 However, the renderer is also allowed to render any
     127             :                 cell-independent content of this row.
     128             : 
     129             :             @param i_hasControlFocus
     130             :                 <TRUE/> if and only if the table control currently has the focus
     131             :             @param _bSelected
     132             :                 <TRUE/> if and only if the row to be prepared is
     133             :                 selected currently.
     134             :             @param _rDevice
     135             :                 denotes the device to paint onto
     136             :             @param _rRowArea
     137             :                 the are into which the row should be painted. This excludes
     138             :                 the row header area, if applicable.
     139             :             @param _rStyle
     140             :                 the style to be used for drawing
     141             :         */
     142             :         virtual void    PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected,
     143             :                             OutputDevice& _rDevice, const Rectangle& _rRowArea,
     144             :                             const StyleSettings& _rStyle ) = 0;
     145             : 
     146             :         /** paints the header of a row
     147             : 
     148             :             The row to be painted is denoted by the most recent call to
     149             :             ->PrepareRow.
     150             : 
     151             :             @param i_hasControlFocus
     152             :                 <TRUE/> if and only if the table control currently has the focus
     153             :                 <br/>
     154             :                 Note that this flag is equal to the respective flag in the
     155             :                 previous ->PrepareRow call, it's passed here for convinience
     156             :                 only.
     157             :             @param _bSelected
     158             :                 <TRUE/> if and only if the row whose header cell is to be
     159             :                 painted is selected currently.
     160             :                 <br/>
     161             :                 Note that this flag is equal to the respective flag in the
     162             :                 previous ->PrepareRow call, it's passed here for convinience
     163             :                 only.
     164             :             @param _rDevice
     165             :                 denotes the device to paint onto
     166             :             @param _rArea
     167             :                 the are into which the row header should be painted
     168             :             @param _rStyle
     169             :                 the style to be used for drawing
     170             :         */
     171             :         virtual void    PaintRowHeader( bool i_hasControlFocus, bool _bSelected,
     172             :                             OutputDevice& _rDevice, Rectangle const & _rArea,
     173             :                             StyleSettings const & _rStyle ) = 0;
     174             : 
     175             :         /** paints a certain cell
     176             : 
     177             :             The row to be painted is denoted by the most recent call to
     178             :             ->PrepareRow.
     179             : 
     180             :             @param _bSelected
     181             :                 <TRUE/> if and only if the cell to be painted is
     182             :                 selected currently. This is the case if either
     183             :                 the row or the column of the cell is currently selected.
     184             :                 <br/>
     185             :                 Note that this flag is equal to the respective flag in the
     186             :                 previous ->PrepareRow call, it's passed here for convinience
     187             :                 only.
     188             :             @param i_hasControlFocus
     189             :                 <TRUE/> if and only if the table control currently has the focus
     190             :                 <br/>
     191             :                 Note that this flag is equal to the respective flag in the
     192             :                 previous ->PrepareRow call, it's passed here for convinience
     193             :                 only.
     194             :             @param _rDevice
     195             :                 denotes the device to paint onto
     196             :             @param _rArea
     197             :                 the are into which the cell should be painted
     198             :             @param _rStyle
     199             :                 the style to be used for drawing
     200             :         */
     201             :         virtual void    PaintCell( ColPos const i_col,
     202             :                             bool i_hasControlFocus, bool _bSelected,
     203             :                             OutputDevice& _rDevice, const Rectangle& _rArea,
     204             :                             const StyleSettings& _rStyle ) = 0;
     205             : 
     206             :         /** draws a cell cursor in the given rectangle
     207             : 
     208             :             The cell cursor is used to indicate the active/current cell
     209             :             of a table control.
     210             :         */
     211             :         virtual void    ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect) = 0;
     212             : 
     213             :         /** hides the cell cursor previously drawn into the given rectangle
     214             : 
     215             :             The cell cursor is used to indicate the active/current cell
     216             :             of a table control.
     217             :         */
     218             :         virtual void    HideCellCursor( Window& _rView, const Rectangle& _rCursorRect) = 0;
     219             : 
     220             :         /** checks whether a given cell content fits into a given target area on a given device.
     221             : 
     222             :             @param i_colPos
     223             :                 denotes the column which the cell content would be painted into. Your renderer implementation
     224             :                 would only need this parameter if rendering is done differently for different columns.
     225             : 
     226             :             @param i_rowPos
     227             :                 denotes the row which the cell content would be painted into. Your renderer implementation
     228             :                 would only need this parameter if rendering is done differently for different rows.
     229             : 
     230             :             @param i_active
     231             :                 is <TRUE/> if and only if the renderer should assume the cell content would be painted for the active
     232             :                 cell.
     233             : 
     234             :             @param i_selected
     235             :                 is <TRUE/> if and only if the renderer should assume the cell content would be painted for a selected
     236             :                 cell.
     237             : 
     238             :             @param i_targetDevice
     239             :                 denotes the target device for the assumed rendering operation
     240             : 
     241             :             @param i_targetArea
     242             :                 denotes the area within the target device for the assumed rendering operation.
     243             : 
     244             :             @return
     245             :                 <TRUE/> if and only if the given cell content could be rendered into the given device and the
     246             :                 given area.
     247             :         */
     248             :         virtual bool    FitsIntoCell(
     249             :                             ::com::sun::star::uno::Any const & i_cellContent,
     250             :                             ColPos const i_colPos, RowPos const i_rowPos,
     251             :                             bool const i_active, bool const i_selected,
     252             :                             OutputDevice& i_targetDevice, Rectangle const & i_targetArea
     253             :                         ) const = 0;
     254             : 
     255             :         /** attempts to format the content of the given cell as string
     256             : 
     257             :             @param i_cellValue
     258             :                 the value for which an attempt for a string conversion should be made
     259             :             @param  i_colPos
     260             :                 the column position of the cell in question
     261             :             @param  i_rowPos
     262             :                 the row position of the cell in question
     263             :             @param  o_cellString
     264             :                 the cell content, formatted as string
     265             :             @return
     266             :                 <TRUE/> if and only if the content could be formatted as string
     267             :         */
     268             :         virtual bool    GetFormattedCellString(
     269             :                             ::com::sun::star::uno::Any const & i_cellValue,
     270             :                             ColPos const i_colPos, RowPos const i_rowPos,
     271             :                             ::rtl::OUString & o_cellString
     272             :                         ) const = 0;
     273             : 
     274             :         /// deletes the renderer instance
     275           0 :         virtual ~ITableRenderer() { }
     276             :     };
     277             :     typedef ::boost::shared_ptr< ITableRenderer > PTableRenderer;
     278             : 
     279             : //........................................................................
     280             : } } // namespace svt::table
     281             : //........................................................................
     282             : 
     283             : #endif // SVTOOLS_INC_TABLE_TABLERENDERER_HXX
     284             : 
     285             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10