LCOV - code coverage report
Current view: top level - sc/inc - refupdatecontext.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 5 100.0 %
Date: 2015-06-13 12:38:46 Functions: 6 6 100.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             : #ifndef INCLUDED_SC_INC_REFUPDATECONTEXT_HXX
      11             : #define INCLUDED_SC_INC_REFUPDATECONTEXT_HXX
      12             : 
      13             : #include "global.hxx"
      14             : #include "address.hxx"
      15             : #include "columnset.hxx"
      16             : 
      17             : #include <unordered_map>
      18             : #include <unordered_set>
      19             : 
      20             : class ScDocument;
      21             : 
      22             : namespace sc {
      23             : 
      24             : /**
      25             :  * Keep track of all named expressions that have been updated during
      26             :  * reference update.
      27             :  */
      28         882 : class UpdatedRangeNames
      29             : {
      30             :     typedef std::unordered_set<sal_uInt16> NameIndicesType;
      31             :     typedef std::unordered_map<SCTAB, NameIndicesType> UpdatedNamesType;
      32             : 
      33             :     UpdatedNamesType maUpdatedNames;
      34             : 
      35             : public:
      36             :     void setUpdatedName(SCTAB nTab, sal_uInt16 nIndex);
      37             :     bool isNameUpdated(SCTAB nTab, sal_uInt16 nIndex) const;
      38             : };
      39             : 
      40             : /**
      41             :  * Context for reference update during shifting, moving or copying of cell
      42             :  * ranges.
      43             :  */
      44         258 : struct RefUpdateContext
      45             : {
      46             :     ScDocument& mrDoc;
      47             : 
      48             :     /**
      49             :      * update mode - insert/delete, copy, or move. The reorder mode (which
      50             :      * corresponds with the reordering of sheets) is not used with this
      51             :      * context.
      52             :      */
      53             :     UpdateRefMode meMode;
      54             : 
      55             :     /**
      56             :      * Range of cells that are about to be moved for insert/delete/move modes.
      57             :      * For copy mode, it's the destination range of cells that are about to be
      58             :      * pasted.  When moving a range of cells, it's the destination range, not
      59             :      * the source range.
      60             :      */
      61             :     ScRange maRange;
      62             : 
      63             :     /** Amount and direction of movement in the column direction. */
      64             :     SCCOL mnColDelta;
      65             :     /** Amount and direction of movement in the row direction. */
      66             :     SCROW mnRowDelta;
      67             :     /** Amount and direction of movement in the sheet direction. */
      68             :     SCTAB mnTabDelta;
      69             : 
      70             :     UpdatedRangeNames maUpdatedNames;
      71             :     ColumnSet maRegroupCols;
      72             : 
      73             :     RefUpdateContext(ScDocument& rDoc);
      74             : 
      75             :     bool isInserted() const;
      76             :     bool isDeleted() const;
      77             : };
      78             : 
      79             : struct RefUpdateResult
      80             : {
      81             :     /**
      82             :      * When this flag is true, the result of the formula needs to be
      83             :      * re-calculated either because it contains a reference that's been
      84             :      * deleted, or the size of a range reference has changed.
      85             :      */
      86             :     bool mbValueChanged;
      87             : 
      88             :     /**
      89             :      * This flag indicates whether any reference in the token array has been
      90             :      * modified.
      91             :      */
      92             :     bool mbReferenceModified;
      93             : 
      94             :     /**
      95             :      * When this flag is true, it indicates that the token array contains a
      96             :      * range name that's been updated.
      97             :      */
      98             :     bool mbNameModified;
      99             : 
     100             :     RefUpdateResult();
     101             :     RefUpdateResult(const RefUpdateResult& r);
     102             : };
     103             : 
     104          69 : struct RefUpdateInsertTabContext
     105             : {
     106             :     ScDocument& mrDoc;
     107             :     SCTAB mnInsertPos;
     108             :     SCTAB mnSheets;
     109             :     UpdatedRangeNames maUpdatedNames;
     110             : 
     111             :     RefUpdateInsertTabContext(ScDocument& rDoc, SCTAB nInsertPos, SCTAB nSheets);
     112             : };
     113             : 
     114         100 : struct RefUpdateDeleteTabContext
     115             : {
     116             :     ScDocument& mrDoc;
     117             :     SCTAB mnDeletePos;
     118             :     SCTAB mnSheets;
     119             :     UpdatedRangeNames maUpdatedNames;
     120             : 
     121             :     RefUpdateDeleteTabContext(ScDocument& rDoc, SCTAB nInsertPos, SCTAB nSheets);
     122             : };
     123             : 
     124          14 : struct RefUpdateMoveTabContext
     125             : {
     126             :     ScDocument& mrDoc;
     127             :     SCTAB mnOldPos;
     128             :     SCTAB mnNewPos;
     129             :     UpdatedRangeNames maUpdatedNames;
     130             : 
     131             :     RefUpdateMoveTabContext(ScDocument& rDoc, SCTAB nOldPos, SCTAB nNewPos);
     132             : 
     133             :     SCTAB getNewTab(SCTAB nOldTab) const;
     134             : };
     135             : 
     136             : struct SetFormulaDirtyContext
     137             : {
     138             :     SCTAB mnTabDeletedStart;
     139             :     SCTAB mnTabDeletedEnd;
     140             : 
     141             :     /**
     142             :      * When true, go through all reference tokens and clears "sheet deleted"
     143             :      * flag if its corresponding index falls within specified sheet range.
     144             :      */
     145             :     bool mbClearTabDeletedFlag;
     146             : 
     147             :     SetFormulaDirtyContext();
     148             : };
     149             : 
     150             : }
     151             : 
     152             : #endif
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11