LCOV - code coverage report
Current view: top level - sc/source/ui/inc - prevloc.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 13 13 100.0 %
Date: 2012-08-25 Functions: 8 8 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef SC_PREVLOC_HXX
      30                 :            : #define SC_PREVLOC_HXX
      31                 :            : 
      32                 :            : #include <boost/ptr_container/ptr_list.hpp>
      33                 :            : 
      34                 :            : #include <sal/types.h>
      35                 :            : #include <vcl/mapmod.hxx>
      36                 :            : 
      37                 :            : #include "address.hxx"
      38                 :            : 
      39                 :            : #define SC_PREVIEW_MAXRANGES    4
      40                 :            : #define SC_PREVIEW_RANGE_EDGE   0
      41                 :            : #define SC_PREVIEW_RANGE_REPCOL 1
      42                 :            : #define SC_PREVIEW_RANGE_REPROW 2
      43                 :            : #define SC_PREVIEW_RANGE_TAB    3
      44                 :            : 
      45                 :            : class OutputDevice;
      46                 :            : class Rectangle;
      47                 :            : class ScAddress;
      48                 :            : class ScRange;
      49                 :            : class ScDocument;
      50                 :            : struct ScPreviewLocationEntry;
      51                 :            : 
      52                 :            : struct ScPreviewColRowInfo
      53                 :            : {
      54                 :            :     sal_Bool    bIsHeader;
      55                 :            :     SCCOLROW    nDocIndex;
      56                 :            :     long    nPixelStart;
      57                 :            :     long    nPixelEnd;
      58                 :            : 
      59                 :        206 :     void Set( sal_Bool bHeader, SCCOLROW nIndex, long nStart, long nEnd )
      60                 :            :     {
      61                 :        206 :         bIsHeader   = bHeader;
      62                 :        206 :         nDocIndex   = nIndex;
      63                 :        206 :         nPixelStart = nStart;
      64                 :        206 :         nPixelEnd   = nEnd;
      65                 :        206 :     }
      66                 :            : };
      67                 :            : 
      68                 :            : class ScPreviewTableInfo
      69                 :            : {
      70                 :            :     SCTAB                   nTab;
      71                 :            :     SCCOL                   nCols;
      72                 :            :     SCROW                   nRows;
      73                 :            :     ScPreviewColRowInfo*    pColInfo;
      74                 :            :     ScPreviewColRowInfo*    pRowInfo;
      75                 :            : 
      76                 :            : public:
      77                 :            :             ScPreviewTableInfo();
      78                 :            :             ~ScPreviewTableInfo();
      79                 :            : 
      80                 :         69 :     SCTAB                       GetTab() const      { return nTab; }
      81                 :        486 :     SCCOL                       GetCols() const     { return nCols; }
      82                 :        405 :     SCROW                       GetRows() const     { return nRows; }
      83                 :        404 :     const ScPreviewColRowInfo*  GetColInfo() const  { return pColInfo; }
      84                 :        404 :     const ScPreviewColRowInfo*  GetRowInfo() const  { return pRowInfo; }
      85                 :            : 
      86                 :            :     void    SetTab( SCTAB nNewTab );
      87                 :            :     void    SetColInfo( SCCOL nCount, ScPreviewColRowInfo* pNewInfo );
      88                 :            :     void    SetRowInfo( SCROW nCount, ScPreviewColRowInfo* pNewInfo );
      89                 :            :     void    LimitToArea( const Rectangle& rPixelArea );
      90                 :            : };
      91                 :            : 
      92                 :            : 
      93                 :            : class ScPreviewLocationData
      94                 :            : {
      95                 :            :     OutputDevice* pWindow;
      96                 :            :     ScDocument* pDoc;
      97                 :            :     MapMode     aCellMapMode;
      98                 :            :     MapMode     aDrawMapMode[SC_PREVIEW_MAXRANGES];
      99                 :            :     Rectangle   aDrawRectangle[SC_PREVIEW_MAXRANGES];
     100                 :            :         sal_uInt8       aDrawRangeId[SC_PREVIEW_MAXRANGES];
     101                 :            :     sal_uInt16      nDrawRanges;
     102                 :            :     SCTAB       nPrintTab;
     103                 :            :     boost::ptr_list<ScPreviewLocationEntry> aEntries;
     104                 :            : 
     105                 :            :     Rectangle   GetOffsetPixel( const ScAddress& rCellPos, const ScRange& rRange ) const;
     106                 :            : 
     107                 :            : public:
     108                 :            :             ScPreviewLocationData( ScDocument* pDocument, OutputDevice* pWin );
     109                 :            :             ~ScPreviewLocationData();
     110                 :            : 
     111                 :            :     void    SetCellMapMode( const MapMode& rMapMode );
     112                 :            :     void    SetPrintTab( SCTAB nNew );
     113                 :            :     void    Clear();
     114                 :            :     void    AddCellRange( const Rectangle& rRect, const ScRange& rRange, sal_Bool bRepCol, sal_Bool bRepRow,
     115                 :            :                             const MapMode& rDrawMap );
     116                 :            :     void    AddColHeaders( const Rectangle& rRect, SCCOL nStartCol, SCCOL nEndCol, sal_Bool bRepCol );
     117                 :            :     void    AddRowHeaders( const Rectangle& rRect, SCROW nStartRow, SCROW nEndRow, sal_Bool bRepRow );
     118                 :            :     void    AddHeaderFooter( const Rectangle& rRect, sal_Bool bHeader, sal_Bool bLeft );
     119                 :            :     void    AddNoteMark( const Rectangle& rRect, const ScAddress& rPos );
     120                 :            :     void    AddNoteText( const Rectangle& rRect, const ScAddress& rPos );
     121                 :            : 
     122                 :         70 :     SCTAB   GetPrintTab() const     { return nPrintTab; }
     123                 :            : 
     124                 :            :     //  Get info on visible columns/rows in the visible area
     125                 :            :     void    GetTableInfo( const Rectangle& rVisiblePixel, ScPreviewTableInfo& rInfo ) const;
     126                 :            : 
     127                 :         34 :     sal_uInt16  GetDrawRanges() const   { return nDrawRanges; }
     128                 :            :     void    GetDrawRange( sal_uInt16 nPos, Rectangle& rPixelRect, MapMode& rMapMode, sal_uInt8& rRangeId ) const;
     129                 :            : 
     130                 :            :     sal_Bool    GetHeaderPosition( Rectangle& rHeaderRect ) const;
     131                 :            :     sal_Bool    GetFooterPosition( Rectangle& rFooterRect ) const;
     132                 :            :     sal_Bool    IsHeaderLeft() const;
     133                 :            :     sal_Bool    IsFooterLeft() const;
     134                 :            : 
     135                 :            :     long    GetNoteCountInRange( const Rectangle& rVisiblePixel, sal_Bool bNoteMarks ) const;
     136                 :            :     sal_Bool    GetNoteInRange( const Rectangle& rVisiblePixel, long nIndex, sal_Bool bNoteMarks,
     137                 :            :                             ScAddress& rCellPos, Rectangle& rNoteRect ) const;
     138                 :            :     Rectangle GetNoteInRangeOutputRect(const Rectangle& rVisiblePixel, sal_Bool bNoteMarks,
     139                 :            :                             const ScAddress& aCellPos) const;
     140                 :            : 
     141                 :            :     //  Check if any cells (including column/row headers) are in the visible area
     142                 :            :     sal_Bool    HasCellsInRange( const Rectangle& rVisiblePixel ) const;
     143                 :            : 
     144                 :            :     sal_Bool    GetCellPosition( const ScAddress& rCellPos, Rectangle& rCellRect ) const;
     145                 :            : 
     146                 :            :     // returns the rectangle where the EditEngine draws the text of a Header Cell
     147                 :            :     // if bColHeader is true it returns the rectangle of the header of the column in rCellPos
     148                 :            :     // otherwise of the header of the row in rCellPos
     149                 :            :     Rectangle GetHeaderCellOutputRect(const Rectangle& rVisRect, const ScAddress& rCellPos, sal_Bool bColHeader) const;
     150                 :            :     Rectangle GetCellOutputRect(const ScAddress& rCellPos) const;
     151                 :            : 
     152                 :            :     // Query the range and rectangle of the main (non-repeat) cell range.
     153                 :            :     // Returns sal_False if not contained.
     154                 :            :     sal_Bool    GetMainCellRange( ScRange& rRange, Rectangle& rPixRect ) const;
     155                 :            : };
     156                 :            : 
     157                 :            : #endif
     158                 :            : 
     159                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10