[Libreoffice-commits] core.git: 3 commits - sc/inc sc/source
Eike Rathke
erack at redhat.com
Tue Apr 7 14:23:45 PDT 2015
sc/inc/dbdata.hxx | 3 +++
sc/inc/token.hxx | 4 +---
sc/source/core/tool/compiler.cxx | 36 +++++++++++++++++++++++++++++-------
sc/source/core/tool/dbdata.cxx | 6 ++++++
4 files changed, 39 insertions(+), 10 deletions(-)
New commits:
commit c012af28e334c3f01430ec46e1d7b1ed87b55c54
Author: Eike Rathke <erack at redhat.com>
Date: Tue Apr 7 23:08:08 2015 +0200
TableRef: implement more keyword cases
Change-Id: Ib37bfb1b8721d3f6729ce5c312863ffa6a1f76d4
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 5512e382..f3b68f5 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4800,7 +4800,10 @@ bool ScCompiler::HandleTableRef()
break;
case ScTableRefToken::HEADERS:
{
- aRange.aEnd.SetRow( aRange.aStart.Row());
+ if (pDBData->HasHeader())
+ aRange.aEnd.SetRow( aRange.aStart.Row());
+ else
+ bAddRange = false;
bForwardToClose = true;
}
break;
@@ -4808,9 +4811,11 @@ bool ScCompiler::HandleTableRef()
{
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)
+ }
+ // fallthru
+ case ScTableRefToken::HEADERS_DATA:
+ {
+ if (pDBData->HasTotals())
aRange.aEnd.IncRow(-1);
if (aRange.aEnd.Row() < aRange.aStart.Row())
{
@@ -4823,14 +4828,31 @@ bool ScCompiler::HandleTableRef()
break;
case ScTableRefToken::TOTALS:
{
- aRange.aStart.SetRow( aRange.aEnd.Row());
+ if (pDBData->HasTotals())
+ aRange.aStart.SetRow( aRange.aEnd.Row());
+ else
+ bAddRange = false;
bForwardToClose = true;
}
break;
- default:
- /* TODO: implement all other cases. */
+ case ScTableRefToken::DATA_TOTALS:
+ {
+ if (pDBData->HasHeader())
+ aRange.aStart.IncRow();
+ if (aRange.aEnd.Row() < aRange.aStart.Row())
+ {
+ /* TODO: add RefData with deleted rows to generate
+ * #REF! error? */
+ bAddRange = false;
+ }
+ bForwardToClose = true;
+ }
+ break;
+ case ScTableRefToken::THIS_ROW:
+ /* TODO: implement this. */
SetError(errUnknownToken);
bAddRange = false;
+ break;
}
if (bAddRange)
{
commit 576b14ead012993b58a5217c9c8e863f59fc5088
Author: Eike Rathke <erack at redhat.com>
Date: Tue Apr 7 21:04:23 2015 +0200
TableRef: add Totals to ScDBData
Change-Id: Ie38eaba48abbfc4f54304b349f5d2b135f4f7046
diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index c2a8426..708bd85 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -53,6 +53,7 @@ private:
SCROW nEndRow;
bool bByRow;
bool bHasHeader;
+ bool bHasTotals;
bool bDoSize;
bool bKeepFmt;
bool bStripData;
@@ -97,6 +98,8 @@ public:
void SetByRow(bool bByR) { bByRow = bByR; }
bool HasHeader() const { return bHasHeader; }
void SetHeader(bool bHasH) { bHasHeader = bHasH; }
+ bool HasTotals() const { return bHasTotals; }
+ void SetTotals(bool bTotals) { bHasTotals = bTotals; }
void SetIndex(sal_uInt16 nInd) { nIndex = nInd; }
sal_uInt16 GetIndex() const { return nIndex; }
bool IsDoSize() const { return bDoSize; }
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index e9299e3..64bb384 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -65,6 +65,7 @@ ScDBData::ScDBData( const OUString& rName,
nEndRow (nRow2),
bByRow (bByR),
bHasHeader (bHasH),
+ bHasTotals (false),
bDoSize (false),
bKeepFmt (false),
bStripData (false),
@@ -92,6 +93,7 @@ ScDBData::ScDBData( const ScDBData& rData ) :
nEndRow (rData.nEndRow),
bByRow (rData.bByRow),
bHasHeader (rData.bHasHeader),
+ bHasTotals (rData.bHasTotals),
bDoSize (rData.bDoSize),
bKeepFmt (rData.bKeepFmt),
bStripData (rData.bStripData),
@@ -119,6 +121,7 @@ ScDBData::ScDBData( const OUString& rName, const ScDBData& rData ) :
nEndRow (rData.nEndRow),
bByRow (rData.bByRow),
bHasHeader (rData.bHasHeader),
+ bHasTotals (rData.bHasTotals),
bDoSize (rData.bDoSize),
bKeepFmt (rData.bKeepFmt),
bStripData (rData.bStripData),
@@ -148,6 +151,7 @@ ScDBData& ScDBData::operator= (const ScDBData& rData)
nEndRow = rData.nEndRow;
bByRow = rData.bByRow;
bHasHeader = rData.bHasHeader;
+ bHasTotals = rData.bHasTotals;
bDoSize = rData.bDoSize;
bKeepFmt = rData.bKeepFmt;
bStripData = rData.bStripData;
@@ -328,6 +332,7 @@ void ScDBData::GetSortParam( ScSortParam& rSortParam ) const
rSortParam.nRow2 = nEndRow;
rSortParam.bByRow = bByRow;
rSortParam.bHasHeader = bHasHeader;
+ /* TODO: add Totals to ScSortParam? */
}
void ScDBData::SetSortParam( const ScSortParam& rSortParam )
@@ -346,6 +351,7 @@ void ScDBData::GetQueryParam( ScQueryParam& rQueryParam ) const
rQueryParam.nTab = nTable;
rQueryParam.bByRow = bByRow;
rQueryParam.bHasHeader = bHasHeader;
+ /* TODO: add Totals to ScQueryParam? */
}
void ScDBData::SetQueryParam(const ScQueryParam& rQueryParam)
commit 6e3984f871b9b5035c7a928d401714dff7474fd7
Author: Eike Rathke <erack at redhat.com>
Date: Tue Apr 7 20:15:08 2015 +0200
TableRef: only #Headers,#Data or #Data,#Totals combinations allowed
According to https://msdn.microsoft.com/en-us/library/dd906358.aspx
Take them by their words.
Change-Id: I832c860695833ad04338ebd56c5b56805f1aa0a0
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx
index 899d163..6dfb236 100644
--- a/sc/inc/token.hxx
+++ b/sc/inc/token.hxx
@@ -222,9 +222,7 @@ public:
TOTALS = 8,
THIS_ROW = 16,
HEADERS_DATA = HEADERS | DATA,
- DATA_TOTALS = DATA | TOTALS,
- HEADERS_DATA_TOTALS = HEADERS | DATA | TOTALS,
- ALL_COLUMN = HEADERS_DATA_TOTALS | ALL // semantically the same, but just a [#All] item
+ DATA_TOTALS = DATA | TOTALS
};
ScTableRefToken( sal_uInt16 nIndex, Item eItem );
More information about the Libreoffice-commits
mailing list