1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #ifndef INCLUDED_SC_INC_REFUPDATECONTEXT_HXX
11 #define INCLUDED_SC_INC_REFUPDATECONTEXT_HXX
14 #include "address.hxx"
15 #include "columnset.hxx"
17 #include <boost/unordered_map.hpp>
18 #include <boost/unordered_set.hpp>
25 * Keep track of all named expressions that have been updated during
28 class UpdatedRangeNames
30 typedef boost::unordered_set
<sal_uInt16
> NameIndicesType
;
31 typedef boost::unordered_map
<SCTAB
, NameIndicesType
> UpdatedNamesType
;
33 UpdatedNamesType maUpdatedNames
;
36 void setUpdatedName(SCTAB nTab
, sal_uInt16 nIndex
);
37 bool isNameUpdated(SCTAB nTab
, sal_uInt16 nIndex
) const;
41 * Context for reference update during shifting, moving or copying of cell
44 struct RefUpdateContext
49 * update mode - insert/delete, copy, or move. The reorder mode (which
50 * corresponds with the reordering of sheets) is not used with this
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
63 /** Amount and direction of movement in the column direction. */
65 /** Amount and direction of movement in the row direction. */
67 /** Amount and direction of movement in the sheet direction. */
70 UpdatedRangeNames maUpdatedNames
;
71 ColumnSet maRegroupCols
;
73 RefUpdateContext(ScDocument
& rDoc
);
75 bool isInserted() const;
76 bool isDeleted() const;
79 struct RefUpdateResult
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.
89 * This flag indicates whether any reference in the token array has been
92 bool mbReferenceModified
;
95 * When this flag is true, it indicates that the token array contains a
96 * range name that's been updated.
101 RefUpdateResult(const RefUpdateResult
& r
);
104 struct RefUpdateInsertTabContext
108 UpdatedRangeNames maUpdatedNames
;
110 RefUpdateInsertTabContext(SCTAB nInsertPos
, SCTAB nSheets
);
113 struct RefUpdateDeleteTabContext
117 UpdatedRangeNames maUpdatedNames
;
119 RefUpdateDeleteTabContext(SCTAB nInsertPos
, SCTAB nSheets
);
122 struct RefUpdateMoveTabContext
126 UpdatedRangeNames maUpdatedNames
;
128 RefUpdateMoveTabContext(SCTAB nOldPos
, SCTAB nNewPos
);
130 SCTAB
getNewTab(SCTAB nOldTab
) const;
133 struct SetFormulaDirtyContext
135 SCTAB mnTabDeletedStart
;
136 SCTAB mnTabDeletedEnd
;
139 * When true, go through all reference tokens and clears "sheet deleted"
140 * flag if its corresponding index falls within specified sheet range.
142 bool mbClearTabDeletedFlag
;
144 SetFormulaDirtyContext();
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */