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 <unordered_map>
18 #include <unordered_set>
25 * Keep track of all named expressions that have been updated during
28 class UpdatedRangeNames
30 typedef std::unordered_set
<sal_uInt16
> NameIndicesType
;
31 typedef std::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
109 UpdatedRangeNames maUpdatedNames
;
111 RefUpdateInsertTabContext(ScDocument
& rDoc
, SCTAB nInsertPos
, SCTAB nSheets
);
114 struct RefUpdateDeleteTabContext
119 UpdatedRangeNames maUpdatedNames
;
121 RefUpdateDeleteTabContext(ScDocument
& rDoc
, SCTAB nInsertPos
, SCTAB nSheets
);
124 struct RefUpdateMoveTabContext
129 UpdatedRangeNames maUpdatedNames
;
131 RefUpdateMoveTabContext(ScDocument
& rDoc
, SCTAB nOldPos
, SCTAB nNewPos
);
133 SCTAB
getNewTab(SCTAB nOldTab
) const;
136 struct SetFormulaDirtyContext
138 SCTAB mnTabDeletedStart
;
139 SCTAB mnTabDeletedEnd
;
142 * When true, go through all reference tokens and clears "sheet deleted"
143 * flag if its corresponding index falls within specified sheet range.
145 bool mbClearTabDeletedFlag
;
147 SetFormulaDirtyContext();
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */