summaryrefslogtreecommitdiff
path: root/sc/source/core/tool
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-05-06 17:15:12 +0200
committerAndras Timar <andras.timar@collabora.com>2015-05-08 15:00:31 +0200
commit7937ee7d2d2e445a809e3284af5a0d539ad8ae94 (patch)
tree57b7e4012f5a39899cb96e64fb20e93998a79b72 /sc/source/core/tool
parent63eb17da31b913d323c26041eee978bbb9c58c4b (diff)
Resolves: tdf#91078 check also DBData modified, not only named expressions
This adds ScDocument& to all RefUpdate...Context; another approach could had been to add an UpdatedDBData similar to UpdatedRangeNames and gather those in the ScDBData::Update...() methods, but as long as ScDBData::IsModified() works that isn't necessary. (cherry picked from commit 848dc76e76c1c4a9040be4a0088c4d4527af6f40) Conflicts: sc/source/core/tool/token.cxx assume modified if an index has no corresponding ScDBData (anymore) (cherry picked from commit 4a53021f0662e08b56fd076f78ac182634fcec4c) 16cbc7d772f39c8778b8ba21a629ced6b0dbedeb Change-Id: Iae3ec6c8b8356cbd8acb2445489e91e7d6922fb3 Reviewed-on: https://gerrit.libreoffice.org/15654 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/core/tool')
-rw-r--r--sc/source/core/tool/token.cxx32
1 files changed, 23 insertions, 9 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 1d2a0a63e798..9500a2841149 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -43,6 +43,7 @@
#include "types.hxx"
#include "globstr.hrc"
#include "addincol.hxx"
+#include "dbdata.hxx"
#include <svl/sharedstring.hxx>
using ::std::vector;
@@ -2588,9 +2589,6 @@ bool expandRangeByEdge( const sc::RefUpdateContext& rCxt, ScRange& rRefRange, co
bool isNameModified( const sc::UpdatedRangeNames& rUpdatedNames, SCTAB nOldTab, const formula::FormulaToken& rToken )
{
- if (rToken.GetOpCode() != ocName)
- return false;
-
SCTAB nTab = -1;
if (!rToken.IsGlobal())
nTab = nOldTab;
@@ -2599,6 +2597,16 @@ bool isNameModified( const sc::UpdatedRangeNames& rUpdatedNames, SCTAB nOldTab,
return rUpdatedNames.isNameUpdated(nTab, rToken.GetIndex());
}
+bool isDBDataModified( const ScDocument& rDoc, const formula::FormulaToken& rToken )
+{
+ // Check if this DBData has been modified.
+ const ScDBData* pDBData = rDoc.GetDBCollection()->getNamedDBs().findByIndex( rToken.GetIndex());
+ if (!pDBData)
+ return true;
+
+ return pDBData->IsModified();
+}
+
}
sc::RefUpdateResult ScTokenArray::AdjustReferenceOnShift( const sc::RefUpdateContext& rCxt, const ScAddress& rOldPos )
@@ -2737,7 +2745,8 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnShift( const sc::RefUpdateCon
break;
case svIndex:
{
- if (isNameModified(rCxt.maUpdatedNames, rOldPos.Tab(), **p))
+ if (((*p)->GetOpCode() == ocName && isNameModified(rCxt.maUpdatedNames, rOldPos.Tab(), **p)) ||
+ ((*p)->GetOpCode() == ocDBArea && isDBDataModified(rCxt.mrDoc, **p)))
aRes.mbNameModified = true;
}
break;
@@ -2805,7 +2814,8 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
break;
case svIndex:
{
- if (isNameModified(rCxt.maUpdatedNames, rOldPos.Tab(), **p))
+ if (((*p)->GetOpCode() == ocName && isNameModified(rCxt.maUpdatedNames, rOldPos.Tab(), **p)) ||
+ ((*p)->GetOpCode() == ocDBArea && isDBDataModified(rCxt.mrDoc, **p)))
aRes.mbNameModified = true;
}
break;
@@ -2860,7 +2870,8 @@ sc::RefUpdateResult ScTokenArray::MoveReference( const ScAddress& rPos, const sc
break;
case svIndex:
{
- if (isNameModified(rCxt.maUpdatedNames, aOldRange.aStart.Tab(), **p))
+ if (((*p)->GetOpCode() == ocName && isNameModified(rCxt.maUpdatedNames, aOldRange.aStart.Tab(), **p)) ||
+ ((*p)->GetOpCode() == ocDBArea && isDBDataModified(rCxt.mrDoc, **p)))
aRes.mbNameModified = true;
}
break;
@@ -3344,7 +3355,8 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnDeletedTab( sc::RefUpdateDele
break;
case svIndex:
{
- if (isNameModified(rCxt.maUpdatedNames, rOldPos.Tab(), **p))
+ if (((*p)->GetOpCode() == ocName && isNameModified(rCxt.maUpdatedNames, rOldPos.Tab(), **p)) ||
+ ((*p)->GetOpCode() == ocDBArea && isDBDataModified(rCxt.mrDoc, **p)))
aRes.mbNameModified = true;
}
break;
@@ -3388,7 +3400,8 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnInsertedTab( sc::RefUpdateIns
break;
case svIndex:
{
- if (isNameModified(rCxt.maUpdatedNames, rOldPos.Tab(), **p))
+ if (((*p)->GetOpCode() == ocName && isNameModified(rCxt.maUpdatedNames, rOldPos.Tab(), **p)) ||
+ ((*p)->GetOpCode() == ocDBArea && isDBDataModified(rCxt.mrDoc, **p)))
aRes.mbNameModified = true;
}
break;
@@ -3453,7 +3466,8 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMovedTab( sc::RefUpdateMoveTa
break;
case svIndex:
{
- if (isNameModified(rCxt.maUpdatedNames, rOldPos.Tab(), **p))
+ if (((*p)->GetOpCode() == ocName && isNameModified(rCxt.maUpdatedNames, rOldPos.Tab(), **p)) ||
+ ((*p)->GetOpCode() == ocDBArea && isDBDataModified(rCxt.mrDoc, **p)))
aRes.mbNameModified = true;
}
break;