LCOV - code coverage report
Current view: top level - sc/source/core/data - refupdatecontext.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 43 0.0 %
Date: 2014-04-14 Functions: 0 12 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             : 
      10             : #include "refupdatecontext.hxx"
      11             : 
      12             : namespace sc {
      13             : 
      14           0 : void UpdatedRangeNames::setUpdatedName(SCTAB nTab, sal_uInt16 nIndex)
      15             : {
      16           0 :     UpdatedNamesType::iterator it = maUpdatedNames.find(nTab);
      17           0 :     if (it == maUpdatedNames.end())
      18             :     {
      19             :         // Insert a new container for this sheet index.
      20           0 :         NameIndicesType aIndices;
      21             :         std::pair<UpdatedNamesType::iterator,bool> r =
      22           0 :             maUpdatedNames.insert(UpdatedNamesType::value_type(nTab, aIndices));
      23             : 
      24           0 :         if (!r.second)
      25             :             // Insertion failed for whatever reason.
      26           0 :             return;
      27             : 
      28           0 :         it = r.first;
      29             :     }
      30             : 
      31           0 :     NameIndicesType& rIndices = it->second;
      32           0 :     rIndices.insert(nIndex);
      33             : }
      34             : 
      35           0 : bool UpdatedRangeNames::isNameUpdated(SCTAB nTab, sal_uInt16 nIndex) const
      36             : {
      37           0 :     UpdatedNamesType::const_iterator it = maUpdatedNames.find(nTab);
      38           0 :     if (it == maUpdatedNames.end())
      39           0 :         return false;
      40             : 
      41           0 :     const NameIndicesType& rIndices = it->second;
      42           0 :     return rIndices.count(nIndex) > 0;
      43             : }
      44             : 
      45           0 : RefUpdateContext::RefUpdateContext(ScDocument& rDoc) :
      46           0 :     mrDoc(rDoc), meMode(URM_INSDEL), mnColDelta(0), mnRowDelta(0), mnTabDelta(0) {}
      47             : 
      48           0 : bool RefUpdateContext::isInserted() const
      49             : {
      50           0 :     return (meMode == URM_INSDEL) && (mnColDelta > 0 || mnRowDelta > 0 || mnTabDelta > 0);
      51             : }
      52             : 
      53           0 : bool RefUpdateContext::isDeleted() const
      54             : {
      55           0 :     return (meMode == URM_INSDEL) && (mnColDelta < 0 || mnRowDelta < 0 || mnTabDelta < 0);
      56             : }
      57             : 
      58           0 : RefUpdateResult::RefUpdateResult() : mbValueChanged(false), mbReferenceModified(false), mbNameModified(false) {}
      59           0 : RefUpdateResult::RefUpdateResult(const RefUpdateResult& r) :
      60             :     mbValueChanged(r.mbValueChanged),
      61             :     mbReferenceModified(r.mbReferenceModified),
      62           0 :     mbNameModified(r.mbNameModified) {}
      63             : 
      64           0 : RefUpdateInsertTabContext::RefUpdateInsertTabContext(SCTAB nInsertPos, SCTAB nSheets) :
      65           0 :     mnInsertPos(nInsertPos), mnSheets(nSheets) {}
      66             : 
      67           0 : RefUpdateDeleteTabContext::RefUpdateDeleteTabContext(SCTAB nDeletePos, SCTAB nSheets) :
      68           0 :     mnDeletePos(nDeletePos), mnSheets(nSheets) {}
      69             : 
      70           0 : RefUpdateMoveTabContext::RefUpdateMoveTabContext(SCTAB nOldPos, SCTAB nNewPos) :
      71           0 :     mnOldPos(nOldPos), mnNewPos(nNewPos) {}
      72             : 
      73           0 : SCTAB RefUpdateMoveTabContext::getNewTab(SCTAB nOldTab) const
      74             : {
      75             :     // Sheets below the lower bound or above the uppper bound will not change.
      76           0 :     SCTAB nLowerBound = std::min(mnOldPos, mnNewPos);
      77           0 :     SCTAB nUpperBound = std::max(mnOldPos, mnNewPos);
      78             : 
      79           0 :     if (nOldTab < nLowerBound || nUpperBound < nOldTab)
      80             :         // Outside the boundary. Nothing to adjust.
      81           0 :         return nOldTab;
      82             : 
      83           0 :     if (nOldTab == mnOldPos)
      84           0 :         return mnNewPos;
      85             : 
      86             :     // It's somewhere in between.
      87           0 :     if (mnOldPos < mnNewPos)
      88             :     {
      89             :         // Moving a sheet to the right. The rest of the sheets shifts to the left.
      90           0 :         return nOldTab - 1;
      91             :     }
      92             : 
      93             :     // Moving a sheet to the left. The rest of the sheets shifts to the right.
      94           0 :     return nOldTab + 1;
      95             : }
      96             : 
      97           0 : SetFormulaDirtyContext::SetFormulaDirtyContext() :
      98           0 :     mnTabDeletedStart(-1), mnTabDeletedEnd(-1), mbClearTabDeletedFlag(false) {}
      99             : 
     100             : }
     101             : 
     102             : 
     103             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10