Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / inc / refupdatecontext.hxx
blobba0beedbc161c03a7b1c5e492d15b10e6966fdd9
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 SC_REFUPDATECONTEXT_HXX
11 #define SC_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.
60 ScRange maRange;
62 /** Amount and direction of movement in the column direction. */
63 SCCOL mnColDelta;
64 /** Amount and direction of movement in the row direction. */
65 SCROW mnRowDelta;
66 /** Amount and direction of movement in the sheet direction. */
67 SCTAB mnTabDelta;
69 UpdatedRangeNames maUpdatedNames;
70 ColumnSet maRegroupCols;
72 RefUpdateContext(ScDocument& rDoc);
74 bool isInserted() const;
75 bool isDeleted() const;
78 struct RefUpdateResult
80 bool mbValueChanged;
81 bool mbReferenceModified;
82 bool mbNameModified;
84 RefUpdateResult();
85 RefUpdateResult(const RefUpdateResult& r);
88 struct RefUpdateInsertTabContext
90 SCTAB mnInsertPos;
91 SCTAB mnSheets;
92 UpdatedRangeNames maUpdatedNames;
94 RefUpdateInsertTabContext(SCTAB nInsertPos, SCTAB nSheets);
97 struct RefUpdateDeleteTabContext
99 SCTAB mnDeletePos;
100 SCTAB mnSheets;
101 UpdatedRangeNames maUpdatedNames;
103 RefUpdateDeleteTabContext(SCTAB nInsertPos, SCTAB nSheets);
106 struct RefUpdateMoveTabContext
108 SCTAB mnOldPos;
109 SCTAB mnNewPos;
110 UpdatedRangeNames maUpdatedNames;
112 RefUpdateMoveTabContext(SCTAB nOldPos, SCTAB nNewPos);
114 SCTAB getNewTab(SCTAB nOldTab) const;
119 #endif
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */