summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-04-25 18:54:41 +0200
committerCaolán McNamara <caolanm@redhat.com>2016-05-03 09:30:38 +0000
commit947cd18108ca03abe79895fa38520338da159aa6 (patch)
treeffd6411265208e9da6d43462c0bfc7e78af31b1c /sc
parentfd45334b49c09538598f82f5ffa2f61f6bdd9d24 (diff)
Resolves: tdf#99461 reverse logic of TokenPointers::skipToken()
... so that all code tokens are adjusted even if shared with another flat copied token array, but RPN not if shared. Was vice versa. ScConditionEntry has shared token arrays for pFormula1|pFCell1 respectively pFormula2|pFCell2 hence the references weren't updated. Change-Id: I52256b5ea20da753a2a29ff437f09c921566e070 (cherry picked from commit 03124f5be5466c7f7cac012de05ef387b9718c4a) Reviewed-on: https://gerrit.libreoffice.org/24375 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/token.cxx44
1 files changed, 25 insertions, 19 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 29e629bf2744..d73d8d71da1c 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -139,27 +139,33 @@ namespace
bool skipToken( size_t i, const FormulaToken* const * pp )
{
- // Handle all tokens in RPN, and code tokens only if they have a
- // reference count of 1, which means they are not referenced in
- // RPN.
- if (i == 0)
- return (*pp)->GetRef() > 1;
-
- if (mbSkipRelName)
+ // Handle all code tokens, and tokens in RPN only if they have a
+ // reference count of 1, which means they are not referenced in the
+ // code array. Doing it the other way would skip code tokens that
+ // are held by flat copied token arrays and thus are shared. For
+ // flat copy arrays the caller has to know what it does and should
+ // discard all RPN, update only one array and regenerate all RPN.
+ if (i == 1)
{
- // Skip (do not adjust) relative references resulting from
- // named expressions.
- switch ((*pp)->GetType())
+ if ((*pp)->GetRef() > 1)
+ return true;
+
+ if (mbSkipRelName)
{
- case svSingleRef:
- return (*pp)->GetSingleRef()->IsRelName();
- case svDoubleRef:
- {
- const ScComplexRefData& rRef = *(*pp)->GetDoubleRef();
- return rRef.Ref1.IsRelName() || rRef.Ref2.IsRelName();
- }
- default:
- ; // nothing
+ // Skip (do not adjust) relative references resulting from
+ // named expressions. Resolved expressions are only in RPN.
+ switch ((*pp)->GetType())
+ {
+ case svSingleRef:
+ return (*pp)->GetSingleRef()->IsRelName();
+ case svDoubleRef:
+ {
+ const ScComplexRefData& rRef = *(*pp)->GetDoubleRef();
+ return rRef.Ref1.IsRelName() || rRef.Ref2.IsRelName();
+ }
+ default:
+ ; // nothing
+ }
}
}