summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-06-27 01:45:46 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-06-27 21:58:41 +0200
commit3d6b2fb2cdfbe6c06af8138b443f44f1140e8af6 (patch)
tree516dba0b336e0410b9b520d19d762958c0ea259f
parent87fa01674b1418c060b20a7f5af1d0d6eebe99cd (diff)
add way to handle update refs for addresses, related tdf#107289
Change-Id: I97d1724d7aa1652619edda1cbe6a4ae4db277563 Reviewed-on: https://gerrit.libreoffice.org/39316 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/inc/rangeutl.hxx8
-rw-r--r--sc/inc/refupdatecontext.hxx4
-rw-r--r--sc/source/core/tool/rangeutl.cxx17
3 files changed, 27 insertions, 2 deletions
diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx
index 92ceaa99d84d..47cace7db2ad 100644
--- a/sc/inc/rangeutl.hxx
+++ b/sc/inc/rangeutl.hxx
@@ -269,6 +269,14 @@ public:
bool WasDBName() const { return !bFirstPass; }
};
+struct SC_DLLPUBLIC ScRangeUpdater
+{
+ ScRangeUpdater() = delete;
+
+ static void UpdateInsertTab(ScAddress& rAddr, const sc::RefUpdateInsertTabContext& rCxt);
+ static void UpdateDeleteTab(ScAddress& rAddr, const sc::RefUpdateDeleteTabContext& rCxt);
+};
+
#endif // INCLUDED_SC_INC_RANGEUTL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/refupdatecontext.hxx b/sc/inc/refupdatecontext.hxx
index 2c47563dd34c..167eb0bec2d3 100644
--- a/sc/inc/refupdatecontext.hxx
+++ b/sc/inc/refupdatecontext.hxx
@@ -107,7 +107,7 @@ struct RefUpdateResult
RefUpdateResult(const RefUpdateResult& r);
};
-struct RefUpdateInsertTabContext
+struct SC_DLLPUBLIC RefUpdateInsertTabContext
{
ScDocument& mrDoc;
SCTAB mnInsertPos;
@@ -117,7 +117,7 @@ struct RefUpdateInsertTabContext
RefUpdateInsertTabContext(ScDocument& rDoc, SCTAB nInsertPos, SCTAB nSheets);
};
-struct RefUpdateDeleteTabContext
+struct SC_DLLPUBLIC RefUpdateDeleteTabContext
{
ScDocument& mrDoc;
SCTAB mnDeletePos;
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 0d8ee77dd82d..872435378244 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -29,6 +29,7 @@
#include "convuno.hxx"
#include "externalrefmgr.hxx"
#include "compiler.hxx"
+#include "refupdatecontext.hxx"
using ::formula::FormulaGrammar;
using namespace ::com::sun::star;
@@ -1014,4 +1015,20 @@ bool ScAreaNameIterator::Next( OUString& rName, ScRange& rRange )
}
}
+void ScRangeUpdater::UpdateInsertTab(ScAddress& rAddr, const sc::RefUpdateInsertTabContext& rCxt)
+{
+ if (rCxt.mnInsertPos <= rAddr.Tab())
+ {
+ rAddr.IncTab(rCxt.mnSheets);
+ }
+}
+
+void ScRangeUpdater::UpdateDeleteTab(ScAddress& rAddr, const sc::RefUpdateDeleteTabContext& rCxt)
+{
+ if (rCxt.mnDeletePos <= rAddr.Tab())
+ {
+ rAddr.IncTab(-rCxt.mnSheets);
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */