Kaydet (Commit) 3d6b2fb2 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

add way to handle update refs for addresses, related tdf#107289

Change-Id: I97d1724d7aa1652619edda1cbe6a4ae4db277563
Reviewed-on: https://gerrit.libreoffice.org/39316Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 87fa0167
......@@ -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: */
......@@ -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;
......
......@@ -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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment