summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--formula/source/core/api/token.cxx14
-rw-r--r--include/formula/tokenarray.hxx2
2 files changed, 16 insertions, 0 deletions
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 978dc2e198b6..a451e2a6c107 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -600,6 +600,13 @@ void FormulaTokenArray::DelRPN()
nRPN = nIndex = 0;
}
+FormulaToken* FormulaTokenArray::FirstToken() const
+{
+ if (!pCode || nLen == 0)
+ return nullptr;
+ return pCode[0];
+}
+
FormulaToken* FormulaTokenArray::PeekPrev( sal_uInt16 & nIdx )
{
if (0 < nIdx && nIdx <= nLen)
@@ -647,6 +654,13 @@ FormulaToken* FormulaTokenArray::PeekPrevNoSpaces()
return nullptr;
}
+FormulaToken* FormulaTokenArray::FirstRPNToken() const
+{
+ if (!pRPN || nRPN == 0)
+ return nullptr;
+ return pRPN[0];
+}
+
bool FormulaTokenArray::HasReferences() const
{
for (sal_uInt16 i = 0; i < nLen; ++i)
diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx
index 575ead626286..109146c56b87 100644
--- a/include/formula/tokenarray.hxx
+++ b/include/formula/tokenarray.hxx
@@ -206,6 +206,7 @@ public:
void Clear();
void DelRPN();
FormulaToken* First() { nIndex = 0; return Next(); }
+ FormulaToken* FirstToken() const;
FormulaToken* Next();
FormulaToken* NextNoSpaces();
FormulaToken* GetNextName();
@@ -219,6 +220,7 @@ public:
FormulaToken* PeekPrevNoSpaces(); /// Only after Reset/First/Next/Last/Prev!
FormulaToken* PeekNextNoSpaces(); /// Only after Reset/First/Next/Last/Prev!
FormulaToken* FirstRPN() { nIndex = 0; return NextRPN(); }
+ FormulaToken* FirstRPNToken() const;
FormulaToken* NextRPN();
FormulaToken* LastRPN() { nIndex = nRPN; return PrevRPN(); }
FormulaToken* PrevRPN();