[Libreoffice-commits] core.git: 2 commits - sc/source
Eike Rathke
erack at redhat.com
Thu Mar 26 05:54:14 PDT 2015
sc/source/core/tool/compiler.cxx | 70 +++++++++++++++++++++++++++++++--------
1 file changed, 57 insertions(+), 13 deletions(-)
New commits:
commit bca0b4fb2c8b32ce11c6aae12cc60b5f00fa9fcc
Author: Eike Rathke <erack at redhat.com>
Date: Wed Mar 25 22:32:03 2015 +0100
TableRef: generate token for #Data
Change-Id: I06d4789b92d9f6567dd87c8d3cb6186538269663
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 9ae82f3..a82596c 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4804,6 +4804,23 @@ bool ScCompiler::HandleTableRef()
bForwardToClose = true;
}
break;
+ case ScTableRefToken::DATA:
+ {
+ if (pDBData->HasHeader())
+ aRange.aStart.IncRow();
+ /* TODO: this assumes totals to be present, they need to
+ * be implemented at the table. */
+ if (aRange.aEnd.Row() - aRange.aStart.Row() >= 1)
+ aRange.aEnd.IncRow(-1);
+ if (aRange.aEnd.Row() < aRange.aStart.Row())
+ {
+ /* TODO: add RefData with deleted rows to generate
+ * #REF! error? */
+ bAddRange = false;
+ }
+ bForwardToClose = true;
+ }
+ break;
case ScTableRefToken::TOTALS:
{
aRange.aStart.SetRow( aRange.aEnd.Row());
commit 38c8e7e5317a90a96625e9d680fde18e3de89be8
Author: Eike Rathke <erack at redhat.com>
Date: Wed Mar 25 20:22:07 2015 +0000
TableRef: generate tokens for #Headers and #Totals
Change-Id: Ib28bae06022d151bc108ebb3062efe86cc3b8bb9
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 551f690..9ae82f3 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4780,26 +4780,53 @@ bool ScCompiler::HandleTableRef()
pDBData->GetArea(aRange);
aRange.aEnd.SetTab(aRange.aStart.Tab());
ScTokenArray* pNew = new ScTokenArray();
- ScTableRefToken::Item eItem = pTR->GetItem();
bool bGotToken = false;
- if (eItem == ScTableRefToken::TABLE || eItem == ScTableRefToken::ALL)
+ bool bAddRange = true;
+ bool bForwardToClose = false;
+ ScTableRefToken::Item eItem = pTR->GetItem();
+ switch (eItem)
+ {
+ case ScTableRefToken::TABLE:
+ case ScTableRefToken::ALL:
+ {
+ // Optional [] (or [#All]) may follow.
+ if ((bGotToken = GetToken()) && mpToken->GetOpCode() == ocTableRefOpen)
+ {
+ bool bAll = ((bGotToken = GetToken()) && mpToken->GetOpCode() == ocTableRefItemAll);
+ if (bGotToken && (!bAll || (bGotToken = GetToken())) && mpToken->GetOpCode() == ocTableRefClose)
+ bGotToken = false; // get next token below
+ }
+ }
+ break;
+ case ScTableRefToken::HEADERS:
+ {
+ aRange.aEnd.SetRow( aRange.aStart.Row());
+ bForwardToClose = true;
+ }
+ break;
+ case ScTableRefToken::TOTALS:
+ {
+ aRange.aStart.SetRow( aRange.aEnd.Row());
+ bForwardToClose = true;
+ }
+ break;
+ default:
+ /* TODO: implement all other cases. */
+ SetError(errUnknownToken);
+ bAddRange = false;
+ }
+ if (bAddRange)
{
ScComplexRefData aRefData;
aRefData.InitFlags();
- aRefData.SetRange(aRange, aPos);
+ aRefData.SetRange( aRange, aPos);
pNew->AddDoubleReference( aRefData );
- // Optional [] (or [#All]) may follow.
- if ((bGotToken = GetToken()) && mpToken->GetOpCode() == ocTableRefOpen)
- {
- bool bAll = ((bGotToken = GetToken()) && mpToken->GetOpCode() == ocTableRefItemAll);
- if (bGotToken && (!bAll || (bGotToken = GetToken())) && mpToken->GetOpCode() == ocTableRefClose)
- bGotToken = false; // get next token below
- }
}
- else
+ if (bForwardToClose)
{
- /* TODO: implement all other cases. */
- SetError(errUnknownToken);
+ while ((bGotToken = GetToken()) && mpToken->GetOpCode() != ocTableRefClose)
+ ;
+ bGotToken = false; // get next token below
}
PushTokenArray( pNew, true );
pNew->Reset();
More information about the Libreoffice-commits
mailing list