summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx8
-rw-r--r--formula/source/core/api/token.cxx10
-rw-r--r--include/formula/tokenarray.hxx59
-rw-r--r--sc/inc/address.hxx2
-rw-r--r--sc/inc/formulacell.hxx2
-rw-r--r--sc/source/core/data/documen7.cxx2
-rw-r--r--sc/source/core/data/formulacell.cxx10
-rw-r--r--sc/source/filter/excel/excform.cxx2
-rw-r--r--sc/source/filter/lotus/lotimpop.cxx2
-rw-r--r--sc/source/filter/lotus/op.cxx4
-rw-r--r--sc/source/filter/qpro/qpro.cxx2
11 files changed, 55 insertions, 48 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index af4fcfae745c..78861b85f65e 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1198,12 +1198,12 @@ void FormulaCompiler::Factor()
// Functions recalculated on every document load.
// Don't use SetExclusiveRecalcModeOnLoad() which would
// override ModeAlways, use
- // AddRecalcMode(RECALCMODE_ONLOAD) instead.
+ // AddRecalcMode(ScRecalcMode::ONLOAD) instead.
case ocConvert :
case ocDde:
case ocMacro:
case ocExternal:
- pArr->AddRecalcMode( RECALCMODE_ONLOAD );
+ pArr->AddRecalcMode( ScRecalcMode::ONLOAD );
break;
// If the referred cell is moved the value changes.
case ocColumn :
@@ -1214,12 +1214,12 @@ void FormulaCompiler::Factor()
// and recalc mode on load, fdo#60646
case ocCell :
pArr->SetRecalcModeOnRefMove();
- pArr->AddRecalcMode( RECALCMODE_ONLOAD );
+ pArr->AddRecalcMode( ScRecalcMode::ONLOAD );
break;
case ocHyperLink :
// cell with hyperlink needs to be calculated on load to
// get its matrix result generated.
- pArr->AddRecalcMode( RECALCMODE_ONLOAD );
+ pArr->AddRecalcMode( ScRecalcMode::ONLOAD );
pArr->SetHyperLink( true);
break;
default:
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 39067e262e92..08a129a4ec3e 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -699,7 +699,7 @@ FormulaTokenArray::FormulaTokenArray() :
nRPN(0),
nIndex(0),
nError(0),
- nMode(RECALCMODE_NORMAL),
+ nMode(ScRecalcMode::NORMAL),
bHyperLink(false)
{
}
@@ -929,13 +929,13 @@ FormulaToken* FormulaTokenArray::AddStringXML( const OUString& rStr )
void FormulaTokenArray::AddRecalcMode( ScRecalcMode nBits )
{
//! Order is important.
- if ( nBits & RECALCMODE_ALWAYS )
+ if ( nBits & ScRecalcMode::ALWAYS )
SetExclusiveRecalcModeAlways();
else if ( !IsRecalcModeAlways() )
{
- if ( nBits & RECALCMODE_ONLOAD )
+ if ( nBits & ScRecalcMode::ONLOAD )
SetExclusiveRecalcModeOnLoad();
- else if ( nBits & RECALCMODE_ONLOAD_ONCE && !IsRecalcModeOnLoad() )
+ else if ( nBits & ScRecalcMode::ONLOAD_ONCE && !IsRecalcModeOnLoad() )
SetExclusiveRecalcModeOnLoadOnce();
}
SetCombinedBitsRecalcMode( nBits );
@@ -1357,7 +1357,7 @@ FormulaTokenArray * FormulaTokenArray::RewriteMissing( const MissingConvention &
int nOcas = 0;
FormulaTokenArray *pNewArr = new FormulaTokenArray;
- // At least RECALCMODE_ALWAYS needs to be set.
+ // At least ScRecalcMode::ALWAYS needs to be set.
pNewArr->AddRecalcMode( GetRecalcMode());
for ( FormulaToken *pCur = First(); pCur; pCur = Next() )
diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx
index c70e6c1db573..52edc66299e2 100644
--- a/include/formula/tokenarray.hxx
+++ b/include/formula/tokenarray.hxx
@@ -24,6 +24,7 @@
#include <formula/token.hxx>
#include <formula/ExternalReferenceHelper.hxx>
#include <o3tl/underlying_type.hxx>
+#include <o3tl/typed_flags_set.hxx>
#include <limits.h>
#include <unordered_set>
@@ -35,22 +36,28 @@ class SharedStringPool;
}
-namespace formula
-{
-
// RecalcMode access only via TokenArray SetRecalcMode / IsRecalcMode...
-typedef sal_uInt8 ScRecalcMode;
// Only one of the exclusive bits can be set,
// handled by TokenArray SetRecalcMode... methods
-#define RECALCMODE_NORMAL 0x01 // exclusive
-#define RECALCMODE_ALWAYS 0x02 // exclusive, always
-#define RECALCMODE_ONLOAD 0x04 // exclusive, always after load
-#define RECALCMODE_ONLOAD_ONCE 0x08 // exclusive, once after load
-#define RECALCMODE_FORCED 0x10 // combined, also if cell isn't visible
-#define RECALCMODE_ONREFMOVE 0x20 // combined, if reference was moved
-#define RECALCMODE_EMASK 0x0F // mask of exclusive bits
+enum class ScRecalcMode : sal_uInt8
+{
+ NORMAL = 0x01, // exclusive
+ ALWAYS = 0x02, // exclusive, always
+ ONLOAD = 0x04, // exclusive, always after load
+ ONLOAD_ONCE = 0x08, // exclusive, once after load
+ FORCED = 0x10, // combined, also if cell isn't visible
+ ONREFMOVE = 0x20, // combined, if reference was moved
+};
// If new bits are to be defined, AddRecalcMode has to be adjusted!
+namespace o3tl
+{
+ template<> struct typed_flags<ScRecalcMode> : is_typed_flags<ScRecalcMode, 0x3f> {};
+}
+#define RECALCMODE_EMASK (ScRecalcMode(ScRecalcMode::NORMAL | ScRecalcMode::ALWAYS | ScRecalcMode::ONLOAD | ScRecalcMode::ONLOAD_ONCE)) // mask of exclusive bits
+
+namespace formula
+{
class FormulaMissingContext;
@@ -191,35 +198,35 @@ public:
than one exclusive bit was set. */
void AddRecalcMode( ScRecalcMode nBits );
- inline void ClearRecalcMode() { nMode = RECALCMODE_NORMAL; }
+ inline void ClearRecalcMode() { nMode = ScRecalcMode::NORMAL; }
inline void SetExclusiveRecalcModeNormal()
- { SetMaskedRecalcMode( RECALCMODE_NORMAL ); }
+ { SetMaskedRecalcMode( ScRecalcMode::NORMAL ); }
inline void SetExclusiveRecalcModeAlways()
- { SetMaskedRecalcMode( RECALCMODE_ALWAYS ); }
+ { SetMaskedRecalcMode( ScRecalcMode::ALWAYS ); }
inline void SetExclusiveRecalcModeOnLoad()
- { SetMaskedRecalcMode( RECALCMODE_ONLOAD ); }
+ { SetMaskedRecalcMode( ScRecalcMode::ONLOAD ); }
inline void SetExclusiveRecalcModeOnLoadOnce()
- { SetMaskedRecalcMode( RECALCMODE_ONLOAD_ONCE ); }
+ { SetMaskedRecalcMode( ScRecalcMode::ONLOAD_ONCE ); }
inline void SetRecalcModeForced()
- { nMode |= RECALCMODE_FORCED; }
+ { nMode |= ScRecalcMode::FORCED; }
inline void ClearRecalcModeForced()
- { nMode &= ~RECALCMODE_FORCED; }
+ { nMode &= ~ScRecalcMode::FORCED; }
inline void SetRecalcModeOnRefMove()
- { nMode |= RECALCMODE_ONREFMOVE; }
+ { nMode |= ScRecalcMode::ONREFMOVE; }
inline void ClearRecalcModeOnRefMove()
- { nMode &= ~RECALCMODE_ONREFMOVE; }
+ { nMode &= ~ScRecalcMode::ONREFMOVE; }
inline bool IsRecalcModeNormal() const
- { return (nMode & RECALCMODE_NORMAL) != 0; }
+ { return bool(nMode & ScRecalcMode::NORMAL); }
inline bool IsRecalcModeAlways() const
- { return (nMode & RECALCMODE_ALWAYS) != 0; }
+ { return bool(nMode & ScRecalcMode::ALWAYS); }
inline bool IsRecalcModeOnLoad() const
- { return (nMode & RECALCMODE_ONLOAD) != 0; }
+ { return bool(nMode & ScRecalcMode::ONLOAD); }
inline bool IsRecalcModeOnLoadOnce() const
- { return (nMode & RECALCMODE_ONLOAD_ONCE) != 0; }
+ { return bool(nMode & ScRecalcMode::ONLOAD_ONCE); }
inline bool IsRecalcModeForced() const
- { return (nMode & RECALCMODE_FORCED) != 0; }
+ { return bool(nMode & ScRecalcMode::FORCED); }
inline bool IsRecalcModeOnRefMove() const
- { return (nMode & RECALCMODE_ONREFMOVE) != 0; }
+ { return bool(nMode & ScRecalcMode::ONREFMOVE); }
/** Get OpCode of the most outer function */
inline OpCode GetOuterFuncOpCode();
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index ecb5110af671..f6650d4e975f 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -840,7 +840,7 @@ inline bool ScRefAddress::operator==( const ScRefAddress& rRefAddress ) const
// Global functions
-// Special values for cells always broadcasting or listening (RECALCMODE_ALWAYS
+// Special values for cells always broadcasting or listening (ScRecalcMode::ALWAYS
// and the like).
#define BCA_BRDCST_ALWAYS ScAddress( 0, SCROW_MAX, 0 )
#define BCA_LISTEN_ALWAYS ScRange( BCA_BRDCST_ALWAYS, BCA_BRDCST_ALWAYS )
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 7b7ed096a678..8e84e00e4898 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -346,7 +346,7 @@ public:
bool IsInChangeTrack() const { return bInChangeTrack;}
// For import filters!
- void AddRecalcMode( formula::ScRecalcMode );
+ void AddRecalcMode( ScRecalcMode );
/** For import only: set a double result. */
void SetHybridDouble( double n );
/** For import only: set a string result.
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 36b02233752a..d89ea62aac82 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -452,7 +452,7 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet
while ( pCell )
{
// Interpret resets bDirty and calls Remove, also the referenced!
- // the Cell remains when RECALCMODE_ALWAYS.
+ // the Cell remains when ScRecalcMode::ALWAYS.
if ( bOnlyForced )
{
if ( pCell->GetCode()->IsRecalcModeForced() )
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 3ba5fc240e49..3e8e160bf9bd 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1397,7 +1397,7 @@ void ScFormulaCell::CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartL
}
// Do the cells need to be calculated? After Load cells can contain an error code, and then start
- // the listener and Recalculate (if needed) if not RECALCMODE_NORMAL
+ // the listener and Recalculate (if needed) if not ScRecalcMode::NORMAL
if( !bNewCompiled || !pCode->GetCodeError() )
{
if (bStartListening)
@@ -2101,7 +2101,7 @@ void ScFormulaCell::Notify( const SfxHint& rHint )
}
// Don't remove from FormulaTree to put in FormulaTrack to
// put in FormulaTree again and again, only if necessary.
- // Any other means except RECALCMODE_ALWAYS by which a cell could
+ // Any other means except ScRecalcMode::ALWAYS by which a cell could
// be in FormulaTree if it would notify other cells through
// FormulaTrack which weren't in FormulaTrack/FormulaTree before?!?
// Yes. The new TableOpDirty made it necessary to have a
@@ -2255,11 +2255,11 @@ void ScFormulaCell::SetResultError( sal_uInt16 n )
void ScFormulaCell::AddRecalcMode( ScRecalcMode nBits )
{
- if ( (nBits & RECALCMODE_EMASK) != RECALCMODE_NORMAL )
+ if ( (nBits & RECALCMODE_EMASK) != ScRecalcMode::NORMAL )
SetDirtyVar();
- if ( nBits & RECALCMODE_ONLOAD_ONCE )
+ if ( nBits & ScRecalcMode::ONLOAD_ONCE )
{ // OnLoadOnce nur zum Dirty setzen nach Filter-Import
- nBits = (nBits & ~RECALCMODE_EMASK) | RECALCMODE_NORMAL;
+ nBits = (nBits & ~RECALCMODE_EMASK) | ScRecalcMode::NORMAL;
}
pCode->AddRecalcMode( nBits );
}
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 20685513ab44..4e5ad522dc6d 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -165,7 +165,7 @@ void ImportExcel::Formula(
{
pCell = rDoc.getDoc().GetFormulaCell(aScPos);
if (pCell)
- pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
+ pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE );
}
if (pCell)
diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx
index 6c6d2ece628d..a8a3026165a4 100644
--- a/sc/source/filter/lotus/lotimpop.cxx
+++ b/sc/source/filter/lotus/lotimpop.cxx
@@ -282,7 +282,7 @@ ScFormulaCell *ImportLotus::Formulacell( sal_uInt16 n )
aConv.Convert( pErg, nRest );
ScFormulaCell* pCell = pErg ? new ScFormulaCell(pD, aAddr, *pErg) : new ScFormulaCell(pD, aAddr);
- pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
+ pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE );
pD->EnsureTable(aAddr.Tab());
pD->SetFormulaCell(aAddr, pCell);
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index 69a9214815c9..bc5b6901db91 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -157,7 +157,7 @@ void OP_Formula(LotusContext &rContext, SvStream& r, sal_uInt16 /*n*/)
if (ValidColRow(nCol, nRow))
{
ScFormulaCell* pCell = new ScFormulaCell(rContext.pLotusRoot->pDoc, aAddress, *pErg);
- pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
+ pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE );
rContext.pDoc->EnsureTable(0);
rContext.pDoc->SetFormulaCell(ScAddress(nCol, nRow, 0), pCell);
@@ -404,7 +404,7 @@ void OP_Formula123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
if (ValidColRow(nCol, nRow) && nTab <= rContext.pDoc->GetMaxTableNumber())
{
ScFormulaCell* pCell = new ScFormulaCell(rContext.pLotusRoot->pDoc, aAddress, *pErg);
- pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
+ pCell->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE );
rContext.pDoc->EnsureTable(nTab);
rContext.pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pCell);
}
diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx
index 0d8829b5fb53..7a73b2ee3bd3 100644
--- a/sc/source/filter/qpro/qpro.cxx
+++ b/sc/source/filter/qpro/qpro.cxx
@@ -115,7 +115,7 @@ FltError ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSt
{
ScFormulaCell* pFormula = new ScFormulaCell(pDoc, aAddr, *pArray);
nStyle = nStyle >> 3;
- pFormula->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
+ pFormula->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE );
pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
pDoc->EnsureTable(nTab);
pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pFormula);