summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-09-23 14:56:27 +0200
committerNoel Grandin <noel@peralex.com>2016-09-26 08:29:38 +0200
commit5d944079fa264777293a869e38e38424edceedfa (patch)
tree1b0302a99799c101d5eb837a73c69e1b5b062eac /sc/source/core
parent8cde91ecce5664d1e58970d1ecd57817e63f34ec (diff)
convert SUBTOTAL constants to typed_flags_set
Change-Id: If3d7f874d11de1eac53dc37c3e86667236db493e
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/data/dociter.cxx22
-rw-r--r--sc/source/core/inc/interpre.hxx4
-rw-r--r--sc/source/core/tool/interpr1.cxx24
-rw-r--r--sc/source/core/tool/interpr4.cxx4
-rw-r--r--sc/source/core/tool/interpr6.cxx32
5 files changed, 43 insertions, 43 deletions
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index ed391238baac..325145abe9be 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -96,7 +96,7 @@ void ScAttrArray_IterGetNumberFormat( sal_uLong& nFormat, const ScAttrArray*& rp
}
ScValueIterator::ScValueIterator( ScDocument* pDocument, const ScRange& rRange,
- sal_uInt16 nSubTotalFlags, bool bTextZero )
+ SubtotalFlags nSubTotalFlags, bool bTextZero )
: pDoc(pDocument)
, pAttrArray(nullptr)
, nNumFormat(0) // Initialized in GetNumberFormat
@@ -190,9 +190,9 @@ bool ScValueIterator::GetThis(double& rValue, FormulaError& rErr)
SCROW nCurRow = GetRow();
SCROW nLastRow;
// Skip all filtered or hidden rows, depending on mnSubTotalFlags
- if ( ( ( mnSubTotalFlags & SUBTOTAL_IGN_FILTERED ) &&
+ if ( ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) &&
pDoc->RowFiltered( nCurRow, mnTab, nullptr, &nLastRow ) ) ||
- ( ( mnSubTotalFlags & SUBTOTAL_IGN_HIDDEN ) &&
+ ( ( mnSubTotalFlags & SubtotalFlags::IgnoreHidden ) &&
pDoc->RowHidden( nCurRow, mnTab, nullptr, &nLastRow ) ) )
{
SetPos(nLastRow+1);
@@ -218,7 +218,7 @@ bool ScValueIterator::GetThis(double& rValue, FormulaError& rErr)
case sc::element_type_formula:
{
ScFormulaCell& rCell = *sc::formula_block::at(*maCurPos.first->data, maCurPos.second);
- if ( ( mnSubTotalFlags & SUBTOTAL_IGN_NESTED_ST_AG ) && rCell.IsSubTotal() )
+ if ( ( mnSubTotalFlags & SubtotalFlags::IgnoreNestedStAg ) && rCell.IsSubTotal() )
{
// Skip subtotal formula cells.
IncPos();
@@ -227,7 +227,7 @@ bool ScValueIterator::GetThis(double& rValue, FormulaError& rErr)
if (rCell.GetErrorOrValue(rErr, rValue))
{
- if ( rErr != FormulaError::NONE && ( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) )
+ if ( rErr != FormulaError::NONE && ( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) )
{
IncPos();
break;
@@ -834,7 +834,7 @@ sc::FormulaGroupEntry* ScFormulaGroupIterator::next()
return &maEntries[mnIndex++];
}
-ScCellIterator::ScCellIterator( ScDocument* pDoc, const ScRange& rRange, sal_uInt16 nSubTotalFlags ) :
+ScCellIterator::ScCellIterator( ScDocument* pDoc, const ScRange& rRange, SubtotalFlags nSubTotalFlags ) :
mpDoc(pDoc),
maStartPos(rRange.aStart),
maEndPos(rRange.aEnd),
@@ -949,9 +949,9 @@ bool ScCellIterator::getCurrent()
SCROW nLastRow;
// Skip all filtered or hidden rows, depending on mSubTotalFlags
- if ( ( ( mnSubTotalFlags & SUBTOTAL_IGN_FILTERED ) &&
+ if ( ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) &&
pCol->GetDoc().RowFiltered(maCurPos.Row(), maCurPos.Tab(), nullptr, &nLastRow) ) ||
- ( ( mnSubTotalFlags & SUBTOTAL_IGN_HIDDEN ) &&
+ ( ( mnSubTotalFlags & SubtotalFlags::IgnoreHidden ) &&
pCol->GetDoc().RowHidden(maCurPos.Row(), maCurPos.Tab(), nullptr, &nLastRow) ) )
{
setPos(nLastRow+1);
@@ -960,12 +960,12 @@ bool ScCellIterator::getCurrent()
if (maCurColPos.first->type == sc::element_type_formula)
{
- if ( mnSubTotalFlags )
+ if ( mnSubTotalFlags != SubtotalFlags::NONE )
{
ScFormulaCell* pCell = sc::formula_block::at(*maCurColPos.first->data, maCurColPos.second);
// Skip formula cells with Subtotal formulae or errors, depending on mnSubTotalFlags
- if ( ( ( mnSubTotalFlags & SUBTOTAL_IGN_NESTED_ST_AG ) && pCell->IsSubTotal() ) ||
- ( ( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) && pCell->GetErrCode() != FormulaError::NONE ) )
+ if ( ( ( mnSubTotalFlags & SubtotalFlags::IgnoreNestedStAg ) && pCell->IsSubTotal() ) ||
+ ( ( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) && pCell->GetErrCode() != FormulaError::NONE ) )
{
incPos();
continue;
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index f4ea691457f1..dbe0a3c76e78 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -204,8 +204,8 @@ private:
short nFuncFmtType; // NumberFormatType of a function
short nCurFmtType; // current NumberFormatType
short nRetFmtType; // NumberFormatType of an expression
- FormulaError mnStringNoValueError; // the error set in ConvertStringToValue() if no value
- sal_uInt16 mnSubTotalFlags; // flags for subtotal and aggregate functions
+ FormulaError mnStringNoValueError; // the error set in ConvertStringToValue() if no value
+ SubtotalFlags mnSubTotalFlags; // flags for subtotal and aggregate functions
sal_uInt8 cPar; // current count of parameters
bool bCalcAsShown; // precision as shown
bool bMatrixFormula; // formula cell is a matrix formula
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index c40a6e2e2202..87da7230f60c 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -6646,12 +6646,12 @@ void ScInterpreter::ScSubTotal()
const FormulaToken* p = pStack[ sp - nParamCount ];
PushWithoutError( *p );
sal_Int32 nFunc = GetInt32();
- mnSubTotalFlags |= SUBTOTAL_IGN_NESTED_ST_AG | SUBTOTAL_IGN_FILTERED;
+ mnSubTotalFlags |= SubtotalFlags::IgnoreNestedStAg | SubtotalFlags::IgnoreFiltered;
if (nFunc > 100)
{
// For opcodes 101 through 111, we need to skip hidden cells.
// Other than that these opcodes are identical to 1 through 11.
- mnSubTotalFlags |= SUBTOTAL_IGN_HIDDEN;
+ mnSubTotalFlags |= SubtotalFlags::IgnoreHidden;
nFunc -= 100;
}
@@ -6676,7 +6676,7 @@ void ScInterpreter::ScSubTotal()
default : PushIllegalArgument(); break;
}
}
- mnSubTotalFlags = 0x00;
+ mnSubTotalFlags = SubtotalFlags::NONE;
// Get rid of the 1st (fished) parameter.
double nVal = GetDouble();
Pop();
@@ -6705,28 +6705,28 @@ void ScInterpreter::ScAggregate()
switch ( nOption)
{
case 0 : // ignore nested SUBTOTAL and AGGREGATE functions
- mnSubTotalFlags = SUBTOTAL_IGN_NESTED_ST_AG;
+ mnSubTotalFlags = SubtotalFlags::IgnoreNestedStAg;
break;
case 1 : // ignore hidden rows, nested SUBTOTAL and AGGREGATE functions
- mnSubTotalFlags = SUBTOTAL_IGN_HIDDEN | SUBTOTAL_IGN_NESTED_ST_AG;
+ mnSubTotalFlags = SubtotalFlags::IgnoreHidden | SubtotalFlags::IgnoreNestedStAg;
break;
case 2 : // ignore error values, nested SUBTOTAL and AGGREGATE functions
- mnSubTotalFlags = SUBTOTAL_IGN_ERR_VAL | SUBTOTAL_IGN_NESTED_ST_AG;
+ mnSubTotalFlags = SubtotalFlags::IgnoreErrVal | SubtotalFlags::IgnoreNestedStAg;
break;
case 3 : // ignore hidden rows, error values, nested SUBTOTAL and AGGREGATE functions
- mnSubTotalFlags = SUBTOTAL_IGN_HIDDEN | SUBTOTAL_IGN_ERR_VAL | SUBTOTAL_IGN_NESTED_ST_AG;
+ mnSubTotalFlags = SubtotalFlags::IgnoreHidden | SubtotalFlags::IgnoreErrVal | SubtotalFlags::IgnoreNestedStAg;
break;
case 4 : // ignore nothing
- mnSubTotalFlags = 0x00;
+ mnSubTotalFlags = SubtotalFlags::NONE;
break;
case 5 : // ignore hidden rows
- mnSubTotalFlags = SUBTOTAL_IGN_HIDDEN ;
+ mnSubTotalFlags = SubtotalFlags::IgnoreHidden ;
break;
case 6 : // ignore error values
- mnSubTotalFlags = SUBTOTAL_IGN_ERR_VAL ;
+ mnSubTotalFlags = SubtotalFlags::IgnoreErrVal ;
break;
case 7 : // ignore hidden rows and error values
- mnSubTotalFlags = SUBTOTAL_IGN_HIDDEN | SUBTOTAL_IGN_ERR_VAL ;
+ mnSubTotalFlags = SubtotalFlags::IgnoreHidden | SubtotalFlags::IgnoreErrVal ;
break;
default :
PushIllegalArgument();
@@ -6757,7 +6757,7 @@ void ScInterpreter::ScAggregate()
case AGGREGATE_FUNC_QRTEXC : ScQuartile( false ); break;
default : PushIllegalArgument(); break;
}
- mnSubTotalFlags = 0x00;
+ mnSubTotalFlags = SubtotalFlags::NONE;
}
double nVal = GetDouble();
// Get rid of the 1st and 2nd (fished) parameters.
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 2f1740c3a4bd..6bc8662e2072 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3732,7 +3732,7 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc,
, nCurFmtType(0)
, nRetFmtType(0)
, mnStringNoValueError(FormulaError::NoValue)
- , mnSubTotalFlags(0)
+ , mnSubTotalFlags(SubtotalFlags::NONE)
, cPar(0)
, bCalcAsShown(pDoc->GetDocOptions().IsCalcAsShown())
, meVolatileType(r.IsRecalcModeAlways() ? VOLATILE : NOT_VOLATILE)
@@ -3869,7 +3869,7 @@ StackVar ScInterpreter::Interpret()
nFuncFmtIndex = nCurFmtIndex = nRetFmtIndex = 0;
xResult = nullptr;
pJumpMatrix = nullptr;
- mnSubTotalFlags = 0x00;
+ mnSubTotalFlags = SubtotalFlags::NONE;
ScTokenMatrixMap::const_iterator aTokenMatrixMapIter;
// Once upon a time we used to have FP exceptions on, and there was a
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index ebf1a9b434d6..368ee2a157ee 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -470,7 +470,7 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
ScRange aRange;
size_t nRefInList = 0;
if ( nGlobalError != FormulaError::NONE && ( eFunc == ifCOUNT2 || eFunc == ifCOUNT ||
- ( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) ) )
+ ( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) ) )
nGlobalError = FormulaError::NONE;
while (nParamCount-- > 0)
{
@@ -550,10 +550,10 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
ScExternalRefCache::CellFormat aFmt;
PopExternalSingleRef(pToken, &aFmt);
if ( nGlobalError != FormulaError::NONE && ( eFunc == ifCOUNT2 || eFunc == ifCOUNT ||
- ( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) ) )
+ ( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) ) )
{
nGlobalError = FormulaError::NONE;
- if ( eFunc == ifCOUNT2 && !( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) )
+ if ( eFunc == ifCOUNT2 && !( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) )
++nCount;
break;
}
@@ -567,7 +567,7 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
if ( eType != formula::svEmptyCell &&
( ( pToken->GetOpCode() != ocSubTotal &&
pToken->GetOpCode() != ocAggregate ) ||
- ( mnSubTotalFlags & SUBTOTAL_IGN_NESTED_ST_AG ) ) )
+ ( mnSubTotalFlags & SubtotalFlags::IgnoreNestedStAg ) ) )
nCount++;
if (nGlobalError != FormulaError::NONE)
nGlobalError = FormulaError::NONE;
@@ -614,14 +614,14 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
{
PopSingleRef( aAdr );
if ( nGlobalError != FormulaError::NONE && ( eFunc == ifCOUNT2 || eFunc == ifCOUNT ||
- ( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) ) )
+ ( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) ) )
{
nGlobalError = FormulaError::NONE;
- if ( eFunc == ifCOUNT2 && !( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) )
+ if ( eFunc == ifCOUNT2 && !( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) )
++nCount;
break;
}
- if ( ( mnSubTotalFlags & SUBTOTAL_IGN_FILTERED ) &&
+ if ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) &&
pDok->RowFiltered( aAdr.Row(), aAdr.Tab() ) )
{
break;
@@ -677,10 +677,10 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
{
PopDoubleRef( aRange, nParamCount, nRefInList);
if ( nGlobalError != FormulaError::NONE && ( eFunc == ifCOUNT2 || eFunc == ifCOUNT ||
- ( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) ) )
+ ( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) ) )
{
nGlobalError = FormulaError::NONE;
- if ( eFunc == ifCOUNT2 && !( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) )
+ if ( eFunc == ifCOUNT2 && !( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) )
++nCount;
if ( eFunc == ifCOUNT2 || eFunc == ifCOUNT )
break;
@@ -699,7 +699,7 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
if ( nGlobalError != FormulaError::NONE )
nGlobalError = FormulaError::NONE;
}
- else if ( ( eFunc == ifSUM || eFunc == ifCOUNT ) && !mnSubTotalFlags )
+ else if ( ( eFunc == ifSUM || eFunc == ifCOUNT ) && mnSubTotalFlags == SubtotalFlags::NONE )
{
sc::ColumnSpanSet aSet( false );
aSet.set( aRange, true );
@@ -743,7 +743,7 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
{
case ifAVERAGE:
case ifSUM:
- if ( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL )
+ if ( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal )
{
do
{
@@ -774,7 +774,7 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
}
break;
case ifSUMSQ:
- if ( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL )
+ if ( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal )
{
do
{
@@ -801,7 +801,7 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
case ifPRODUCT:
do
{
- if ( !( nErr != FormulaError::NONE && ( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) ) )
+ if ( !( nErr != FormulaError::NONE && ( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) ) )
{
SetError(nErr);
fRes *= fVal;
@@ -829,7 +829,7 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
{
ScMatrixRef pMat;
PopExternalDoubleRef(pMat);
- if ( nGlobalError != FormulaError::NONE && !( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) )
+ if ( nGlobalError != FormulaError::NONE && !( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) )
break;
IterateMatrix( pMat, eFunc, bTextAsZero, nCount, nFuncFmtType, fRes, fMem );
@@ -845,11 +845,11 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
case svError:
{
PopError();
- if ( eFunc == ifCOUNT || ( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) )
+ if ( eFunc == ifCOUNT || ( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) )
{
nGlobalError = FormulaError::NONE;
}
- else if ( eFunc == ifCOUNT2 && !( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) )
+ else if ( eFunc == ifCOUNT2 && !( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) )
{
nCount++;
nGlobalError = FormulaError::NONE;