Bump version to 4.3-4
[LibreOffice.git] / sc / inc / refupdatecontext.hxx
blob393a85511406aa2071d657aa4f96d1e0f582e80e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #ifndef INCLUDED_SC_INC_REFUPDATECONTEXT_HXX
11 #define INCLUDED_SC_INC_REFUPDATECONTEXT_HXX
13 #include "global.hxx"
14 #include "address.hxx"
15 #include "columnset.hxx"
17 #include <boost/unordered_map.hpp>
18 #include <boost/unordered_set.hpp>
20 class ScDocument;
22 namespace sc {
24 /**
25 * Keep track of all named expressions that have been updated during
26 * reference update.
28 class UpdatedRangeNames
30 typedef boost::unordered_set<sal_uInt16> NameIndicesType;
31 typedef boost::unordered_map<SCTAB, NameIndicesType> UpdatedNamesType;
33 UpdatedNamesType maUpdatedNames;
35 public:
36 void setUpdatedName(SCTAB nTab, sal_uInt16 nIndex);
37 bool isNameUpdated(SCTAB nTab, sal_uInt16 nIndex) const;
40 /**
41 * Context for reference update during shifting, moving or copying of cell
42 * ranges.
44 struct RefUpdateContext
46 ScDocument& mrDoc;
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.
53 UpdateRefMode meMode;
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.
61 ScRange maRange;
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;
70 UpdatedRangeNames maUpdatedNames;
71 ColumnSet maRegroupCols;
73 RefUpdateContext(ScDocument& rDoc);
75 bool isInserted() const;
76 bool isDeleted() const;
79 struct RefUpdateResult
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.
86 bool mbValueChanged;
88 /**
89 * This flag indicates whether any reference in the token array has been
90 * modified.
92 bool mbReferenceModified;
94 /**
95 * When this flag is true, it indicates that the token array contains a
96 * range name that's been updated.
98 bool mbNameModified;
100 RefUpdateResult();
101 RefUpdateResult(const RefUpdateResult& r);
104 struct RefUpdateInsertTabContext
106 SCTAB mnInsertPos;
107 SCTAB mnSheets;
108 UpdatedRangeNames maUpdatedNames;
110 RefUpdateInsertTabContext(SCTAB nInsertPos, SCTAB nSheets);
113 struct RefUpdateDeleteTabContext
115 SCTAB mnDeletePos;
116 SCTAB mnSheets;
117 UpdatedRangeNames maUpdatedNames;
119 RefUpdateDeleteTabContext(SCTAB nInsertPos, SCTAB nSheets);
122 struct RefUpdateMoveTabContext
124 SCTAB mnOldPos;
125 SCTAB mnNewPos;
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();
149 #endif
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */