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

Generated by: LCOV version 1.10