summaryrefslogtreecommitdiff
path: root/sc/source/core/tool
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/tool')
-rw-r--r--sc/source/core/tool/token.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 8816b87df833..89a33e6f2fce 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1412,6 +1412,33 @@ bool ScTokenArray::ImplGetReference( ScRange& rRange, const ScAddress& rPos, boo
return bIs;
}
+sal_Int32 ScTokenArray::GetWeight() const
+{
+ sal_Int32 result(0);
+
+ FormulaToken** p = pCode;
+ FormulaToken** pEnd = p + static_cast<size_t>(nLen);
+ for (; p != pEnd; ++p)
+ {
+ switch ((*p)->GetType())
+ {
+ case svDoubleRef :
+ case svExternalDoubleRef:
+ {
+ const ScComplexRefData& rRef = *(*p)->GetDoubleRef();
+ result += ( (rRef.Ref2.Row() - rRef.Ref1.Row() + 1) * (rRef.Ref2.Col() - rRef.Ref1.Col() + 1) );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ // Just print out the this pointer. It turns out to be quite complicated to get
+ // a symbolic printout of the ScTokenArray here.
+ SAL_INFO("sc.token", "GetWeight(" << this << "): " << result);
+ return result;
+}
+
namespace {
// we want to compare for similar not identical formulae