LCOV - code coverage report
Current view: top level - sc/source/filter/inc - lotrange.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 6 23 26.1 %
Date: 2015-06-13 12:38:46 Functions: 2 6 33.3 %
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 INCLUDED_SC_SOURCE_FILTER_INC_LOTRANGE_HXX
      21             : #define INCLUDED_SC_SOURCE_FILTER_INC_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();
      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() const;
      52             : };
      53             : 
      54           0 : inline void LotusRange::Copy( const LotusRange& rCpy )
      55             : {
      56           0 :     nHash = rCpy.nHash;
      57           0 :     nColStart = rCpy.nColStart;
      58           0 :     nRowStart = rCpy.nRowStart;
      59           0 :     nColEnd = rCpy.nColEnd;
      60           0 :     nRowEnd = rCpy.nRowEnd;
      61           0 :     nId = rCpy.nId;
      62           0 : }
      63             : 
      64           0 : inline void LotusRange::SetId( LR_ID nNewId )
      65             : {
      66           0 :     nId = nNewId;
      67           0 : }
      68             : 
      69             : inline LotusRange &LotusRange::operator =( const LotusRange& rCpy )
      70             : {
      71             :     Copy( rCpy );
      72             :     return *this;
      73             : }
      74             : 
      75           0 : inline bool LotusRange::operator ==( const LotusRange& rRef ) const
      76             : {
      77           0 :     return ( nHash == rRef.nHash && nColStart == rRef.nColStart &&
      78           0 :         nRowStart == rRef.nRowStart && nColEnd == rRef.nColEnd &&
      79           0 :         nRowEnd == rRef.nRowEnd );
      80             : }
      81             : 
      82             : inline bool LotusRange::operator !=( const LotusRange& rRef ) const
      83             : {
      84             :     return ( nHash != rRef.nHash || nColStart != rRef.nColStart ||
      85             :         nRowStart != rRef.nRowStart || nColEnd != rRef.nColEnd ||
      86             :         nRowEnd != rRef.nRowEnd );
      87             : }
      88             : 
      89           0 : inline bool LotusRange::IsSingle() const
      90             : {
      91           0 :     return ( nColStart == nColEnd && nRowStart == nRowEnd );
      92             : }
      93             : 
      94             : class LotusRangeList
      95             : {
      96             : private:
      97             :     LOTUS_ROOT*         m_pLotRoot;
      98             :     LR_ID               nIdCnt;
      99             :     ScComplexRefData    aComplRef;
     100             :     static SCCOL        nEingCol;
     101             :     static SCROW        nEingRow;
     102             :     std::vector<LotusRange*> maRanges;
     103             : 
     104             : public:
     105             :     LotusRangeList(LOTUS_ROOT* pLotRoot);
     106             :     ~LotusRangeList();
     107             :     inline sal_uInt16       GetIndex( SCCOL nCol, SCROW nRow );
     108             :     inline sal_uInt16       GetIndex( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE );
     109             :     sal_uInt16              GetIndex( const LotusRange& );
     110             :     inline void         Append( SCCOL nCol, SCROW nRow, const OUString& );
     111             :     inline void         Append( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE, const OUString& );
     112             :     void                Append( LotusRange* pLR, const OUString& rName );
     113             :     inline static void  SetEing( const SCCOL nCol, const SCROW nRow );
     114             : };
     115             : 
     116           3 : inline LR_ID LotusRangeList::GetIndex( SCCOL nCol, SCROW nRow )
     117             : {
     118           3 :     LotusRange aRef( nCol, nRow );
     119           3 :     return GetIndex( aRef );
     120             : }
     121             : 
     122           2 : inline LR_ID LotusRangeList::GetIndex( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE )
     123             : {
     124           2 :     LotusRange aRef( nColS, nRowS, nColE, nRowE );
     125           2 :     return GetIndex( aRef );
     126             : }
     127             : 
     128             : inline void LotusRangeList::Append( SCCOL nCol, SCROW nRow, const OUString& rName )
     129             : {
     130             :     Append( new LotusRange( nCol, nRow ), rName );
     131             : }
     132             : 
     133             : inline void LotusRangeList::Append( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE, const OUString& r )
     134             : {
     135             :     Append( new LotusRange( nColS, nRowS, nColE, nRowE ), r );
     136             : }
     137             : 
     138             : inline void LotusRangeList::SetEing( const SCCOL nCol, const SCROW nRow )
     139             : {
     140             :     nEingCol = nCol;
     141             :     nEingRow = nRow;
     142             : }
     143             : 
     144             : #endif
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11