LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/inc - lotrange.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 19 0.0 %
Date: 2012-12-27 Functions: 0 6 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 SC_LOTRANGE_HXX
      21             : #define SC_LOTRANGE_HXX
      22             : 
      23             : #include <tools/solar.h>
      24             : #include <compiler.hxx>
      25             : 
      26             : // --------------------------------------------------------- class LotusRange -
      27             : 
      28             : class LotusRangeList;
      29             : 
      30             : typedef sal_uInt16  LR_ID;
      31             : #define ID_FAIL 0xFFFF
      32             : 
      33             : class LotusRange
      34             : {
      35             :     friend class LotusRangeList;
      36             : private:
      37             :     sal_uInt32              nHash;
      38             :     SCCOL               nColStart;
      39             :     SCROW               nRowStart;
      40             :     SCCOL               nColEnd;
      41             :     SCROW               nRowEnd;
      42             :     LR_ID               nId;
      43             :     void                MakeHash( void );
      44             :     inline void         Copy( const LotusRange& );
      45             :     inline void         SetId( LR_ID nId );
      46             : public:
      47             :                         LotusRange( SCCOL nCol, SCROW nRow );
      48             :                         LotusRange( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE );
      49             :                         LotusRange( const LotusRange& );
      50             :     inline LotusRange   &operator =( const LotusRange& );
      51             :     inline sal_Bool         operator ==( const LotusRange& ) const;
      52             :     inline sal_Bool         operator !=( const LotusRange& ) const;
      53             :     inline sal_Bool         IsSingle( void ) const;
      54             : };
      55             : 
      56             : 
      57           0 : inline void LotusRange::Copy( const LotusRange& rCpy )
      58             : {
      59           0 :     nColStart = rCpy.nColStart;
      60           0 :     nRowStart = rCpy.nRowStart;
      61           0 :     nColEnd = rCpy.nColEnd;
      62           0 :     nRowEnd = rCpy.nRowEnd;
      63           0 : }
      64             : 
      65             : 
      66           0 : inline void LotusRange::SetId( LR_ID nNewId )
      67             : {
      68           0 :     nId = nNewId;
      69           0 : }
      70             : 
      71             : 
      72             : inline LotusRange &LotusRange::operator =( const LotusRange& rCpy )
      73             : {
      74             :     Copy( rCpy );
      75             :     return *this;
      76             : }
      77             : 
      78             : 
      79           0 : inline sal_Bool LotusRange::operator ==( const LotusRange& rRef ) const
      80             : {
      81             :     return ( nHash == rRef.nHash && nColStart == rRef.nColStart &&
      82             :         nRowStart == rRef.nRowStart && nColEnd == rRef.nColEnd &&
      83           0 :         nRowEnd == rRef.nRowEnd );
      84             : }
      85             : 
      86             : 
      87             : inline sal_Bool LotusRange::operator !=( const LotusRange& rRef ) const
      88             : {
      89             :     return ( nHash != rRef.nHash || nColStart != rRef.nColStart ||
      90             :         nRowStart != rRef.nRowStart || nColEnd != rRef.nColEnd ||
      91             :         nRowEnd != rRef.nRowEnd );
      92             : }
      93             : 
      94             : 
      95           0 : inline sal_Bool LotusRange::IsSingle( void ) const
      96             : {
      97           0 :     return ( nColStart == nColEnd && nRowStart == nRowEnd );
      98             : }
      99             : 
     100             : 
     101             : 
     102             : // ----------------------------------------------------- class LotusRangeList -
     103             : 
     104             : class LotusRangeList
     105             : {
     106             : private:
     107             :     LR_ID               nIdCnt;
     108             :     ScComplexRefData        aComplRef;
     109             :     static SCCOL        nEingCol;
     110             :     static SCROW        nEingRow;
     111             :     std::vector<LotusRange*> maRanges;
     112             : 
     113             : public:
     114             :                         LotusRangeList( void );
     115             :                         ~LotusRangeList( void );
     116             :     inline sal_uInt16       GetIndex( SCCOL nCol, SCROW nRow );
     117             :     inline sal_uInt16       GetIndex( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE );
     118             :     sal_uInt16              GetIndex( const LotusRange& );
     119             :     inline void         Append( SCCOL nCol, SCROW nRow, const String& );
     120             :     inline void         Append( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE, const String& );
     121             :     void                Append( LotusRange* pLR, const String& rName );
     122             :     inline static void  SetEing( const SCCOL nCol, const SCROW nRow );
     123             : };
     124             : 
     125             : 
     126           0 : inline LR_ID LotusRangeList::GetIndex( SCCOL nCol, SCROW nRow )
     127             : {
     128           0 :     LotusRange aRef( nCol, nRow );
     129           0 :     return GetIndex( aRef );
     130             : }
     131             : 
     132             : 
     133           0 : inline LR_ID LotusRangeList::GetIndex( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE )
     134             : {
     135           0 :     LotusRange aRef( nColS, nRowS, nColE, nRowE );
     136           0 :     return GetIndex( aRef );
     137             : }
     138             : 
     139             : 
     140             : inline void LotusRangeList::Append( SCCOL nCol, SCROW nRow, const String& rName )
     141             : {
     142             :     Append( new LotusRange( nCol, nRow ), rName );
     143             : }
     144             : 
     145             : 
     146             : inline void LotusRangeList::Append( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE, const String& r )
     147             : {
     148             :     Append( new LotusRange( nColS, nRowS, nColE, nRowE ), r );
     149             : }
     150             : 
     151             : 
     152             : inline void LotusRangeList::SetEing( const SCCOL nCol, const SCROW nRow )
     153             : {
     154             :     nEingCol = nCol;
     155             :     nEingRow = nRow;
     156             : }
     157             : 
     158             : #endif
     159             : 
     160             : 
     161             : 
     162             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10