LCOV - code coverage report
Current view: top level - libreoffice/sc/source/core/data - segmenttree.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 186 244 76.2 %
Date: 2012-12-27 Functions: 59 73 80.8 %
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             : 
      21             : #include "segmenttree.hxx"
      22             : 
      23             : #include <mdds/flat_segment_tree.hpp>
      24             : 
      25             : #include <limits>
      26             : 
      27             : using ::std::numeric_limits;
      28             : 
      29             : // ============================================================================
      30             : 
      31             : template<typename _ValueType, typename _ExtValueType = _ValueType>
      32             : class ScFlatSegmentsImpl
      33             : {
      34             : public:
      35             :     typedef _ValueType ValueType;
      36             :     typedef _ExtValueType ExtValueType;
      37             : 
      38             :     struct RangeData
      39             :     {
      40             :         SCCOLROW    mnPos1;
      41             :         SCCOLROW    mnPos2;
      42             :         ValueType   mnValue;
      43             :     };
      44             : 
      45             :     ScFlatSegmentsImpl(SCCOLROW nMax, ValueType nDefault);
      46             :     ScFlatSegmentsImpl(const ScFlatSegmentsImpl& r);
      47             :     ~ScFlatSegmentsImpl();
      48             : 
      49             :     bool setValue(SCCOLROW nPos1, SCCOLROW nPos2, ValueType nValue);
      50             :     ValueType getValue(SCCOLROW nPos);
      51             :     ExtValueType getSumValue(SCCOLROW nPos1, SCCOLROW nPos2);
      52             :     bool getRangeData(SCCOLROW nPos, RangeData& rData);
      53             :     bool getRangeDataLeaf(SCCOLROW nPos, RangeData& rData);
      54             :     void removeSegment(SCCOLROW nPos1, SCCOLROW nPos2);
      55             :     void insertSegment(SCCOLROW nPos, SCCOLROW nSize, bool bSkipStartBoundary);
      56             : 
      57             :     SCROW findLastNotOf(ValueType nValue) const;
      58             : 
      59             :     // range iteration
      60             :     bool getFirst(RangeData& rData);
      61             :     bool getNext(RangeData& rData);
      62             : 
      63         445 :     void enableTreeSearch(bool b)
      64             :     {
      65         445 :         mbTreeSearchEnabled = b;
      66         445 :     }
      67             : 
      68             : private:
      69             :     typedef ::mdds::flat_segment_tree<SCCOLROW, ValueType> fst_type;
      70             :     fst_type maSegments;
      71             :     typename fst_type::const_iterator maItr;
      72             : 
      73             :     bool mbTreeSearchEnabled:1;
      74             : };
      75             : 
      76             : template<typename _ValueType, typename _ExtValueType>
      77        3707 : ScFlatSegmentsImpl<_ValueType, _ExtValueType>::ScFlatSegmentsImpl(SCCOLROW nMax, ValueType nDefault) :
      78             :     maSegments(0, nMax+1, nDefault),
      79        3707 :     mbTreeSearchEnabled(true)
      80             : {
      81        3707 : }
      82             : 
      83             : template<typename _ValueType, typename _ExtValueType>
      84           0 : ScFlatSegmentsImpl<_ValueType, _ExtValueType>::ScFlatSegmentsImpl(const ScFlatSegmentsImpl<_ValueType, _ExtValueType>& r) :
      85             :     maSegments(r.maSegments),
      86           0 :     mbTreeSearchEnabled(r.mbTreeSearchEnabled)
      87             : {
      88           0 : }
      89             : 
      90             : template<typename _ValueType, typename _ExtValueType>
      91        3361 : ScFlatSegmentsImpl<_ValueType, _ExtValueType>::~ScFlatSegmentsImpl()
      92             : {
      93        3361 : }
      94             : 
      95             : template<typename _ValueType, typename _ExtValueType>
      96     1258989 : bool ScFlatSegmentsImpl<_ValueType, _ExtValueType>::setValue(SCCOLROW nPos1, SCCOLROW nPos2, ValueType nValue)
      97             : {
      98     1258989 :     ::std::pair<typename fst_type::const_iterator, bool> ret;
      99     1258989 :     ret = maSegments.insert(maItr, nPos1, nPos2+1, nValue);
     100     1258989 :     maItr = ret.first;
     101     1258989 :     return ret.second;
     102             : }
     103             : 
     104             : template<typename _ValueType, typename _ExtValueType>
     105           2 : typename ScFlatSegmentsImpl<_ValueType, _ExtValueType>::ValueType ScFlatSegmentsImpl<_ValueType, _ExtValueType>::getValue(SCCOLROW nPos)
     106             : {
     107           2 :     ValueType nValue = 0;
     108           2 :     if (!mbTreeSearchEnabled)
     109             :     {
     110           0 :         maSegments.search(nPos, nValue);
     111           0 :         return nValue;
     112             :     }
     113             : 
     114           2 :     if (!maSegments.is_tree_valid())
     115           0 :         maSegments.build_tree();
     116             : 
     117           2 :     maSegments.search_tree(nPos, nValue);
     118           2 :     return nValue;
     119             : }
     120             : 
     121             : template<typename _ValueType, typename _ExtValueType>
     122             : typename ScFlatSegmentsImpl<_ValueType, _ExtValueType>::ExtValueType
     123         450 : ScFlatSegmentsImpl<_ValueType, _ExtValueType>::getSumValue(SCCOLROW nPos1, SCCOLROW nPos2)
     124             : {
     125             :     RangeData aData;
     126         450 :     if (!getRangeData(nPos1, aData))
     127           0 :         return 0;
     128             : 
     129         450 :     sal_uInt32 nValue = 0;
     130             : 
     131         450 :     SCROW nCurPos = nPos1;
     132         450 :     SCROW nEndPos = aData.mnPos2;
     133        1963 :     while (nEndPos <= nPos2)
     134             :     {
     135        1274 :         nValue += aData.mnValue * (nEndPos - nCurPos + 1);
     136        1274 :         nCurPos = nEndPos + 1;
     137        1274 :         if (!getRangeData(nCurPos, aData))
     138         211 :             break;
     139             : 
     140        1063 :         nEndPos = aData.mnPos2;
     141             :     }
     142         450 :     if (nCurPos <= nPos2)
     143             :     {
     144         171 :         nEndPos = ::std::min(nEndPos, nPos2);
     145         171 :         nValue += aData.mnValue * (nEndPos - nCurPos + 1);
     146             :     }
     147         450 :     return nValue;
     148             : }
     149             : 
     150             : template<typename _ValueType, typename _ExtValueType>
     151      492901 : bool ScFlatSegmentsImpl<_ValueType, _ExtValueType>::getRangeData(SCCOLROW nPos, RangeData& rData)
     152             : {
     153      492901 :     if (!mbTreeSearchEnabled)
     154        2770 :         return getRangeDataLeaf(nPos, rData);
     155             : 
     156             :     ValueType nValue;
     157             :     SCCOLROW nPos1, nPos2;
     158             : 
     159      490131 :     if (!maSegments.is_tree_valid())
     160        2803 :         maSegments.build_tree();
     161             : 
     162      490131 :     if (!maSegments.search_tree(nPos, nValue, &nPos1, &nPos2))
     163         182 :         return false;
     164             : 
     165      489949 :     rData.mnPos1 = nPos1;
     166      489949 :     rData.mnPos2 = nPos2-1; // end point is not inclusive.
     167      489949 :     rData.mnValue = nValue;
     168      489949 :     return true;
     169             : }
     170             : 
     171             : template<typename _ValueType, typename _ExtValueType>
     172        2790 : bool ScFlatSegmentsImpl<_ValueType, _ExtValueType>::getRangeDataLeaf(SCCOLROW nPos, RangeData& rData)
     173             : {
     174             :     ValueType nValue;
     175             :     SCCOLROW nPos1, nPos2;
     176             : 
     177             :     // Conduct leaf-node only search.  Faster when searching between range insertion.
     178             :     ::std::pair<typename fst_type::const_iterator, bool> ret =
     179        2790 :         maSegments.search(maItr, nPos, nValue, &nPos1, &nPos2);
     180             : 
     181        2790 :     if (!ret.second)
     182          29 :         return false;
     183             : 
     184        2761 :     maItr = ret.first;
     185             : 
     186        2761 :     rData.mnPos1 = nPos1;
     187        2761 :     rData.mnPos2 = nPos2-1; // end point is not inclusive.
     188        2761 :     rData.mnValue = nValue;
     189        2761 :     return true;
     190             : }
     191             : 
     192             : template<typename _ValueType, typename _ExtValueType>
     193          13 : void ScFlatSegmentsImpl<_ValueType, _ExtValueType>::removeSegment(SCCOLROW nPos1, SCCOLROW nPos2)
     194             : {
     195          13 :     maSegments.shift_left(nPos1, nPos2);
     196          13 :     maItr = maSegments.begin();
     197          13 : }
     198             : 
     199             : template<typename _ValueType, typename _ExtValueType>
     200          17 : void ScFlatSegmentsImpl<_ValueType, _ExtValueType>::insertSegment(SCCOLROW nPos, SCCOLROW nSize, bool bSkipStartBoundary)
     201             : {
     202          17 :     maSegments.shift_right(nPos, nSize, bSkipStartBoundary);
     203          17 :     maItr = maSegments.begin();
     204          17 : }
     205             : 
     206             : template<typename _ValueType, typename _ExtValueType>
     207           8 : SCCOLROW ScFlatSegmentsImpl<_ValueType, _ExtValueType>::findLastNotOf(ValueType nValue) const
     208             : {
     209           8 :     SCCOLROW nPos = numeric_limits<SCCOLROW>::max(); // position not found.
     210           8 :     typename fst_type::const_reverse_iterator itr = maSegments.rbegin(), itrEnd = maSegments.rend();
     211             :     // Note that when searching in reverse direction, we need to skip the first
     212             :     // node, since the right-most leaf node does not store a valid value.
     213           8 :     for (++itr; itr != itrEnd; ++itr)
     214             :     {
     215           0 :         if (itr->second != nValue)
     216             :         {
     217           0 :             nPos = (--itr)->first - 1;
     218           0 :             break;
     219             :         }
     220             :     }
     221           8 :     return nPos;
     222             : }
     223             : 
     224             : template<typename _ValueType, typename _ExtValueType>
     225           0 : bool ScFlatSegmentsImpl<_ValueType, _ExtValueType>::getFirst(RangeData& rData)
     226             : {
     227           0 :     maItr = maSegments.begin();
     228           0 :     return getNext(rData);
     229             : }
     230             : 
     231             : template<typename _ValueType, typename _ExtValueType>
     232           0 : bool ScFlatSegmentsImpl<_ValueType, _ExtValueType>::getNext(RangeData& rData)
     233             : {
     234           0 :     typename fst_type::const_iterator itrEnd = maSegments.end();
     235           0 :     if (maItr == itrEnd)
     236           0 :         return false;
     237             : 
     238           0 :     rData.mnPos1 = maItr->first;
     239           0 :     rData.mnValue = maItr->second;
     240             : 
     241           0 :     ++maItr;
     242           0 :     if (maItr == itrEnd)
     243           0 :         return false;
     244             : 
     245           0 :     rData.mnPos2 = maItr->first - 1;
     246           0 :     return true;
     247             : }
     248             : 
     249             : // ============================================================================
     250             : 
     251         200 : class ScFlatUInt16SegmentsImpl : public ScFlatSegmentsImpl<sal_uInt16, sal_uInt32>
     252             : {
     253             : public:
     254         266 :     explicit ScFlatUInt16SegmentsImpl(SCCOLROW nMax, sal_uInt16 nDefault) :
     255         266 :         ScFlatSegmentsImpl<sal_uInt16, sal_uInt32>(nMax, nDefault)
     256             :     {
     257         266 :     }
     258             : };
     259             : 
     260             : // ----------------------------------------------------------------------------
     261             : 
     262        3161 : class ScFlatBoolSegmentsImpl : public ScFlatSegmentsImpl<bool>
     263             : {
     264             : public:
     265        3441 :     explicit ScFlatBoolSegmentsImpl(SCCOLROW nMax) :
     266        3441 :         ScFlatSegmentsImpl<bool>(nMax, false)
     267             :     {
     268        3441 :     }
     269             : 
     270             :     bool setTrue(SCCOLROW nPos1, SCCOLROW nPos2);
     271             :     bool setFalse(SCCOLROW nPos1, SCCOLROW nPos2);
     272             : };
     273             : 
     274     1253397 : bool ScFlatBoolSegmentsImpl::setTrue(SCCOLROW nPos1, SCCOLROW nPos2)
     275             : {
     276     1253397 :     return setValue(nPos1, nPos2, true);
     277             : }
     278             : 
     279        3130 : bool ScFlatBoolSegmentsImpl::setFalse(SCCOLROW nPos1, SCCOLROW nPos2)
     280             : {
     281        3130 :     return setValue(nPos1, nPos2, false);
     282             : }
     283             : 
     284             : // ============================================================================
     285             : 
     286         120 : ScFlatBoolRowSegments::ForwardIterator::ForwardIterator(ScFlatBoolRowSegments& rSegs) :
     287         120 :     mrSegs(rSegs), mnCurPos(0), mnLastPos(-1), mbCurValue(false)
     288             : {
     289         120 : }
     290             : 
     291     2329113 : bool ScFlatBoolRowSegments::ForwardIterator::getValue(SCROW nPos, bool& rVal)
     292             : {
     293     2329113 :     if (nPos >= mnCurPos)
     294             :         // It can only go in a forward direction.
     295     2329113 :         mnCurPos = nPos;
     296             : 
     297     2329113 :     if (mnCurPos > mnLastPos)
     298             :     {
     299             :         // position not in the current segment.  Update the current value.
     300             :         ScFlatBoolRowSegments::RangeData aData;
     301         120 :         if (!mrSegs.getRangeData(mnCurPos, aData))
     302           0 :             return false;
     303             : 
     304         120 :         mbCurValue = aData.mbValue;
     305         120 :         mnLastPos = aData.mnRow2;
     306             :     }
     307             : 
     308     2329113 :     rVal = mbCurValue;
     309     2329113 :     return true;
     310             : }
     311             : 
     312     2329113 : SCROW ScFlatBoolRowSegments::ForwardIterator::getLastPos() const
     313             : {
     314     2329113 :     return mnLastPos;
     315             : }
     316             : 
     317             : // ----------------------------------------------------------------------------
     318             : 
     319           0 : ScFlatBoolRowSegments::RangeIterator::RangeIterator(ScFlatBoolRowSegments& rSegs) :
     320           0 :     mrSegs(rSegs)
     321             : {
     322           0 : }
     323             : 
     324           0 : bool ScFlatBoolRowSegments::RangeIterator::getFirst(RangeData& rRange)
     325             : {
     326             :     ScFlatBoolSegmentsImpl::RangeData aData;
     327           0 :     if (!mrSegs.mpImpl->getFirst(aData))
     328           0 :         return false;
     329             : 
     330           0 :     rRange.mnRow1  = static_cast<SCROW>(aData.mnPos1);
     331           0 :     rRange.mnRow2  = static_cast<SCROW>(aData.mnPos2);
     332           0 :     rRange.mbValue = static_cast<bool>(aData.mnValue);
     333           0 :     return true;
     334             : }
     335             : 
     336           0 : bool ScFlatBoolRowSegments::RangeIterator::getNext(RangeData& rRange)
     337             : {
     338             :     ScFlatBoolSegmentsImpl::RangeData aData;
     339           0 :     if (!mrSegs.mpImpl->getNext(aData))
     340           0 :         return false;
     341             : 
     342           0 :     rRange.mnRow1  = static_cast<SCROW>(aData.mnPos1);
     343           0 :     rRange.mnRow2  = static_cast<SCROW>(aData.mnPos2);
     344           0 :     rRange.mbValue = static_cast<bool>(aData.mnValue);
     345           0 :     return true;
     346             : }
     347             : 
     348             : // ----------------------------------------------------------------------------
     349             : 
     350        2884 : ScFlatBoolRowSegments::ScFlatBoolRowSegments() :
     351        2884 :     mpImpl(new ScFlatBoolSegmentsImpl(static_cast<SCCOLROW>(MAXROW)))
     352             : {
     353        2884 : }
     354             : 
     355           0 : ScFlatBoolRowSegments::ScFlatBoolRowSegments(const ScFlatBoolRowSegments& r) :
     356           0 :     mpImpl(new ScFlatBoolSegmentsImpl(*r.mpImpl))
     357             : {
     358           0 : }
     359             : 
     360        2744 : ScFlatBoolRowSegments::~ScFlatBoolRowSegments()
     361             : {
     362        2744 : }
     363             : 
     364     1236048 : bool ScFlatBoolRowSegments::setTrue(SCROW nRow1, SCROW nRow2)
     365             : {
     366     1236048 :     return mpImpl->setTrue(static_cast<SCCOLROW>(nRow1), static_cast<SCCOLROW>(nRow2));
     367             : }
     368             : 
     369          35 : bool ScFlatBoolRowSegments::setFalse(SCROW nRow1, SCROW nRow2)
     370             : {
     371          35 :     return mpImpl->setFalse(static_cast<SCCOLROW>(nRow1), static_cast<SCCOLROW>(nRow2));
     372             : }
     373             : 
     374           0 : bool ScFlatBoolRowSegments::getValue(SCROW nRow)
     375             : {
     376           0 :     return mpImpl->getValue(static_cast<SCCOLROW>(nRow));
     377             : }
     378             : 
     379        9544 : bool ScFlatBoolRowSegments::getRangeData(SCROW nRow, RangeData& rData)
     380             : {
     381             :     ScFlatBoolSegmentsImpl::RangeData aData;
     382        9544 :     if (!mpImpl->getRangeData(static_cast<SCCOLROW>(nRow), aData))
     383           0 :         return false;
     384             : 
     385        9544 :     rData.mbValue = aData.mnValue;
     386        9544 :     rData.mnRow1  = static_cast<SCROW>(aData.mnPos1);
     387        9544 :     rData.mnRow2  = static_cast<SCROW>(aData.mnPos2);
     388        9544 :     return true;
     389             : }
     390             : 
     391          20 : bool ScFlatBoolRowSegments::getRangeDataLeaf(SCROW nRow, RangeData& rData)
     392             : {
     393             :     ScFlatBoolSegmentsImpl::RangeData aData;
     394          20 :     if (!mpImpl->getRangeDataLeaf(static_cast<SCCOLROW>(nRow), aData))
     395           0 :         return false;
     396             : 
     397          20 :     rData.mbValue = aData.mnValue;
     398          20 :     rData.mnRow1  = static_cast<SCROW>(aData.mnPos1);
     399          20 :     rData.mnRow2  = static_cast<SCROW>(aData.mnPos2);
     400          20 :     return true;
     401             : }
     402             : 
     403           6 : void ScFlatBoolRowSegments::removeSegment(SCROW nRow1, SCROW nRow2)
     404             : {
     405           6 :     mpImpl->removeSegment(static_cast<SCCOLROW>(nRow1), static_cast<SCCOLROW>(nRow2));
     406           6 : }
     407             : 
     408          10 : void ScFlatBoolRowSegments::insertSegment(SCROW nRow, SCROW nSize, bool bSkipStartBoundary)
     409             : {
     410          10 :     mpImpl->insertSegment(static_cast<SCCOLROW>(nRow), static_cast<SCCOLROW>(nSize), bSkipStartBoundary);
     411          10 : }
     412             : 
     413           6 : SCROW ScFlatBoolRowSegments::findLastNotOf(bool bValue) const
     414             : {
     415           6 :     return static_cast<SCROW>(mpImpl->findLastNotOf(bValue));
     416             : }
     417             : 
     418             : // ============================================================================
     419             : 
     420         557 : ScFlatBoolColSegments::ScFlatBoolColSegments() :
     421         557 :     mpImpl(new ScFlatBoolSegmentsImpl(static_cast<SCCOLROW>(MAXCOL)))
     422             : {
     423         557 : }
     424             : 
     425           0 : ScFlatBoolColSegments::ScFlatBoolColSegments(const ScFlatBoolColSegments& r) :
     426           0 :     mpImpl(new ScFlatBoolSegmentsImpl(*r.mpImpl))
     427             : {
     428           0 : }
     429             : 
     430         417 : ScFlatBoolColSegments::~ScFlatBoolColSegments()
     431             : {
     432         417 : }
     433             : 
     434       17349 : bool ScFlatBoolColSegments::setTrue(SCCOL nCol1, SCCOL nCol2)
     435             : {
     436       17349 :     return mpImpl->setTrue(static_cast<SCCOLROW>(nCol1), static_cast<SCCOLROW>(nCol2));
     437             : }
     438             : 
     439        3095 : bool ScFlatBoolColSegments::setFalse(SCCOL nCol1, SCCOL nCol2)
     440             : {
     441        3095 :     return mpImpl->setFalse(static_cast<SCCOLROW>(nCol1), static_cast<SCCOLROW>(nCol2));
     442             : }
     443             : 
     444      346548 : bool ScFlatBoolColSegments::getRangeData(SCCOL nCol, RangeData& rData)
     445             : {
     446             :     ScFlatBoolSegmentsImpl::RangeData aData;
     447      346548 :     if (!mpImpl->getRangeData(static_cast<SCCOLROW>(nCol), aData))
     448           0 :         return false;
     449             : 
     450      346548 :     rData.mbValue = aData.mnValue;
     451      346548 :     rData.mnCol1  = static_cast<SCCOL>(aData.mnPos1);
     452      346548 :     rData.mnCol2  = static_cast<SCCOL>(aData.mnPos2);
     453      346548 :     return true;
     454             : }
     455             : 
     456           4 : void ScFlatBoolColSegments::removeSegment(SCCOL nCol1, SCCOL nCol2)
     457             : {
     458           4 :     mpImpl->removeSegment(static_cast<SCCOLROW>(nCol1), static_cast<SCCOLROW>(nCol2));
     459           4 : }
     460             : 
     461           2 : void ScFlatBoolColSegments::insertSegment(SCCOL nCol, SCCOL nSize, bool bSkipStartBoundary)
     462             : {
     463           2 :     mpImpl->insertSegment(static_cast<SCCOLROW>(nCol), static_cast<SCCOLROW>(nSize), bSkipStartBoundary);
     464           2 : }
     465             : 
     466             : // ============================================================================
     467             : 
     468         463 : ScFlatUInt16RowSegments::ForwardIterator::ForwardIterator(ScFlatUInt16RowSegments& rSegs) :
     469         463 :     mrSegs(rSegs), mnCurPos(0), mnLastPos(-1), mnCurValue(0)
     470             : {
     471         463 : }
     472             : 
     473     2329460 : bool ScFlatUInt16RowSegments::ForwardIterator::getValue(SCROW nPos, sal_uInt16& rVal)
     474             : {
     475     2329460 :     if (nPos >= mnCurPos)
     476             :         // It can only go in a forward direction.
     477     2329460 :         mnCurPos = nPos;
     478             : 
     479     2329460 :     if (mnCurPos > mnLastPos)
     480             :     {
     481             :         // position not in the current segment.  Update the current value.
     482             :         ScFlatUInt16RowSegments::RangeData aData;
     483         852 :         if (!mrSegs.getRangeData(mnCurPos, aData))
     484           0 :             return false;
     485             : 
     486         852 :         mnCurValue = aData.mnValue;
     487         852 :         mnLastPos = aData.mnRow2;
     488             :     }
     489             : 
     490     2329460 :     rVal = mnCurValue;
     491     2329460 :     return true;
     492             : }
     493             : 
     494     2329348 : SCROW ScFlatUInt16RowSegments::ForwardIterator::getLastPos() const
     495             : {
     496     2329348 :     return mnLastPos;
     497             : }
     498             : 
     499             : // ----------------------------------------------------------------------------
     500             : 
     501         266 : ScFlatUInt16RowSegments::ScFlatUInt16RowSegments(sal_uInt16 nDefault) :
     502         266 :     mpImpl(new ScFlatUInt16SegmentsImpl(static_cast<SCCOLROW>(MAXROW), nDefault))
     503             : {
     504         266 : }
     505             : 
     506           0 : ScFlatUInt16RowSegments::ScFlatUInt16RowSegments(const ScFlatUInt16RowSegments& r) :
     507           0 :     mpImpl(new ScFlatUInt16SegmentsImpl(*r.mpImpl))
     508             : {
     509           0 : }
     510             : 
     511         200 : ScFlatUInt16RowSegments::~ScFlatUInt16RowSegments()
     512             : {
     513         200 : }
     514             : 
     515        2462 : void ScFlatUInt16RowSegments::setValue(SCROW nRow1, SCROW nRow2, sal_uInt16 nValue)
     516             : {
     517        2462 :     mpImpl->setValue(static_cast<SCCOLROW>(nRow1), static_cast<SCCOLROW>(nRow2), nValue);
     518        2462 : }
     519             : 
     520           2 : sal_uInt16 ScFlatUInt16RowSegments::getValue(SCROW nRow)
     521             : {
     522           2 :     return mpImpl->getValue(static_cast<SCCOLROW>(nRow));
     523             : }
     524             : 
     525         450 : sal_uInt32 ScFlatUInt16RowSegments::getSumValue(SCROW nRow1, SCROW nRow2)
     526             : {
     527         450 :     return mpImpl->getSumValue(static_cast<SCCOLROW>(nRow1), static_cast<SCCOLROW>(nRow2));
     528             : }
     529             : 
     530      135085 : bool ScFlatUInt16RowSegments::getRangeData(SCROW nRow, RangeData& rData)
     531             : {
     532             :     ScFlatUInt16SegmentsImpl::RangeData aData;
     533      135085 :     if (!mpImpl->getRangeData(static_cast<SCCOLROW>(nRow), aData))
     534           0 :         return false;
     535             : 
     536      135085 :     rData.mnRow1  = aData.mnPos1;
     537      135085 :     rData.mnRow2  = aData.mnPos2;
     538      135085 :     rData.mnValue = aData.mnValue;
     539      135085 :     return true;
     540             : }
     541             : 
     542           3 : void ScFlatUInt16RowSegments::removeSegment(SCROW nRow1, SCROW nRow2)
     543             : {
     544           3 :     mpImpl->removeSegment(static_cast<SCCOLROW>(nRow1), static_cast<SCCOLROW>(nRow2));
     545           3 : }
     546             : 
     547           5 : void ScFlatUInt16RowSegments::insertSegment(SCROW nRow, SCROW nSize, bool bSkipStartBoundary)
     548             : {
     549           5 :     mpImpl->insertSegment(static_cast<SCCOLROW>(nRow), static_cast<SCCOLROW>(nSize), bSkipStartBoundary);
     550           5 : }
     551             : 
     552           2 : SCROW ScFlatUInt16RowSegments::findLastNotOf(sal_uInt16 nValue) const
     553             : {
     554           2 :     return static_cast<SCROW>(mpImpl->findLastNotOf(nValue));
     555             : }
     556             : 
     557         445 : void ScFlatUInt16RowSegments::enableTreeSearch(bool bEnable)
     558             : {
     559         445 :     mpImpl->enableTreeSearch(bEnable);
     560         460 : }
     561             : 
     562             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10