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/.
13 #include "address.hxx"
14 #include "columnset.hxx"
16 #include <unordered_map>
17 #include <unordered_set>
23 struct ColumnBlockPosition
;
24 class ColumnBlockPositionSet
;
27 * Keep track of all named expressions that have been updated during
30 * Can also be used to collect any set of named expressions / ranges.
32 class UpdatedRangeNames
35 typedef std::unordered_set
<sal_uInt16
> NameIndicesType
;
37 void setUpdatedName(SCTAB nTab
, sal_uInt16 nIndex
);
38 bool isNameUpdated(SCTAB nTab
, sal_uInt16 nIndex
) const;
39 NameIndicesType
getUpdatedNames(SCTAB nTab
) const;
40 bool isEmpty(SCTAB nTab
) const;
43 typedef std::unordered_map
<SCTAB
, NameIndicesType
> UpdatedNamesType
;
45 UpdatedNamesType maUpdatedNames
;
49 * Context for reference update during shifting, moving or copying of cell
52 struct RefUpdateContext
57 * update mode - insert/delete, copy, or move. The reorder mode (which
58 * corresponds with the reordering of sheets) is not used with this
64 * Range of cells that are about to be moved for insert/delete/move modes.
65 * For copy mode, it's the destination range of cells that are about to be
66 * pasted. When moving a range of cells, it's the destination range, not
71 /** Are the data transposed? */
74 /** Amount and direction of movement in the column direction. */
76 /** Amount and direction of movement in the row direction. */
78 /** Amount and direction of movement in the sheet direction. */
81 UpdatedRangeNames maUpdatedNames
;
82 ColumnSet maRegroupCols
;
84 ColumnBlockPositionSet
* mpBlockPos
; // not owning
86 RefUpdateContext(ScDocument
& rDoc
, ScDocument
* pClipdoc
= nullptr);
88 bool isInserted() const;
89 bool isDeleted() const;
91 void setBlockPositionReference(ColumnBlockPositionSet
* blockPos
);
92 ColumnBlockPosition
* getBlockPosition(SCTAB nTab
, SCCOL nCol
);
95 struct RefUpdateResult
98 * When this flag is true, the result of the formula needs to be
99 * re-calculated either because it contains a reference that's been
100 * deleted, or the size of a range reference has changed.
105 * This flag indicates whether any reference in the token array has been
108 bool mbReferenceModified
;
111 * When this flag is true, it indicates that the token array contains a
112 * range name that's been updated.
119 struct SC_DLLPUBLIC RefUpdateInsertTabContext
124 UpdatedRangeNames maUpdatedNames
;
126 RefUpdateInsertTabContext(ScDocument
& rDoc
, SCTAB nInsertPos
, SCTAB nSheets
);
129 struct SC_DLLPUBLIC RefUpdateDeleteTabContext
134 UpdatedRangeNames maUpdatedNames
;
136 RefUpdateDeleteTabContext(ScDocument
& rDoc
, SCTAB nInsertPos
, SCTAB nSheets
);
139 struct RefUpdateMoveTabContext
144 UpdatedRangeNames maUpdatedNames
;
146 RefUpdateMoveTabContext(ScDocument
& rDoc
, SCTAB nOldPos
, SCTAB nNewPos
);
148 SCTAB
getNewTab(SCTAB nOldTab
) const;
151 struct SetFormulaDirtyContext
153 SCTAB mnTabDeletedStart
;
154 SCTAB mnTabDeletedEnd
;
157 * When true, go through all reference tokens and clears "sheet deleted"
158 * flag if its corresponding index falls within specified sheet range.
160 bool mbClearTabDeletedFlag
;
162 SetFormulaDirtyContext();
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */