summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-03-22 14:24:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-03-23 12:00:27 +0000
commitc80fe3937b94df56d7f0dedc85ddf11b48b5e8b5 (patch)
treef51724ae3d3ca35a6b6e12faaba1401927a4beac
parent8ab1fe71f546dd5f8d3ec8f53a0fb31e24d55adc (diff)
convert ScMatrixMode to scoped enum
and fix a bug in ScChangeActionContent::SetValueString where it was passing the grammar as the ScMatrixMode to the ScFormulaCell constructor. Change-Id: I7c1a174cdd8365dedc30cff0b26e3079bb8b84f3 Reviewed-on: https://gerrit.libreoffice.org/35552 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/inc/chgtrack.hxx2
-rw-r--r--sc/inc/formulacell.hxx20
-rw-r--r--sc/qa/unit/ucalc.cxx9
-rw-r--r--sc/qa/unit/ucalc_formula.cxx9
-rw-r--r--sc/source/core/data/column.cxx10
-rw-r--r--sc/source/core/data/column3.cxx2
-rw-r--r--sc/source/core/data/column4.cxx8
-rw-r--r--sc/source/core/data/documen4.cxx8
-rw-r--r--sc/source/core/data/documentimport.cxx8
-rw-r--r--sc/source/core/data/formulacell.cxx59
-rw-r--r--sc/source/core/data/table4.cxx6
-rw-r--r--sc/source/core/data/table6.cxx10
-rw-r--r--sc/source/core/data/validat.cxx2
-rw-r--r--sc/source/core/tool/chgtrack.cxx18
-rw-r--r--sc/source/core/tool/interpr4.cxx4
-rw-r--r--sc/source/filter/excel/xetable.cxx61
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx6
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx8
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx5
-rw-r--r--sc/source/filter/xml/XMLTrackedChangesContext.cxx16
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx2
-rw-r--r--sc/source/ui/docshell/docsh3.cxx8
-rw-r--r--sc/source/ui/docshell/impex.cxx10
-rw-r--r--sc/source/ui/unoobj/funcuno.cxx2
-rw-r--r--sc/source/ui/view/viewfun4.cxx2
-rw-r--r--sc/source/ui/view/viewfunc.cxx4
26 files changed, 156 insertions, 143 deletions
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 0c6b3c79d09d..c2eb57f3ff52 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -903,7 +903,7 @@ class ScChangeTrack : public utl::ConfigurationListener
static SCROW InitContentRowsPerSlot();
- // true if one is MM_FORMULA and the other is
+ // true if one is ScMatrixMode::Formula and the other is
// not, or if both are and range differs
static bool IsMatrixFormulaRangeDifferent(
const ScCellValue& rOldCell, const ScCellValue& rNewCell );
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 71812a2aab15..148ab9572619 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -98,10 +98,10 @@ inline void intrusive_ptr_release(const ScFormulaCellGroup *p)
delete p;
}
-enum ScMatrixMode {
- MM_NONE = 0, // No matrix formula
- MM_FORMULA = 1, // Upper left matrix formula cell
- MM_REFERENCE = 2 // Remaining cells, via ocMatRef reference token
+enum class ScMatrixMode : sal_uInt8 {
+ NONE = 0, // No matrix formula
+ Formula = 1, // Upper left matrix formula cell
+ Reference = 2 // Remaining cells, via ocMatRef reference token
};
class SC_DLLPUBLIC ScFormulaCell : public SvtListener
@@ -118,7 +118,7 @@ private:
ScFormulaCell* pNextTrack;
sal_uInt16 nSeenInIteration; // Iteration cycle in which the cell was last encountered
short nFormatType;
- sal_uInt8 cMatrixFlag : 2; // One of ScMatrixMode
+ ScMatrixMode cMatrixFlag;
bool bDirty : 1; // Must be (re)calculated
bool bChanged : 1; // Whether something changed regarding display/representation
bool bRunning : 1; // Already interpreting right now
@@ -171,15 +171,15 @@ public:
*/
ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, ScTokenArray* pArray,
const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT,
- sal_uInt8 cMatInd = MM_NONE );
+ ScMatrixMode cMatInd = ScMatrixMode::NONE );
ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, const ScTokenArray& rArray,
const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT,
- sal_uInt8 cMatInd = MM_NONE );
+ ScMatrixMode cMatInd = ScMatrixMode::NONE );
ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, const ScFormulaCellGroupRef& xGroup,
const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT,
- sal_uInt8 = MM_NONE );
+ ScMatrixMode = ScMatrixMode::NONE );
/** With formula string and grammar to compile with.
formula::FormulaGrammar::GRAM_DEFAULT effectively isformula::FormulaGrammar::GRAM_NATIVE_UI that
@@ -188,7 +188,7 @@ public:
ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
const OUString& rFormula,
const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT,
- sal_uInt8 cMatInd = MM_NONE );
+ ScMatrixMode cMatInd = ScMatrixMode::NONE );
ScFormulaCell(const ScFormulaCell& rCell, ScDocument& rDoc, const ScAddress& rPos, ScCloneFlags nCloneFlags = ScCloneFlags::Default);
@@ -307,7 +307,7 @@ public:
bool GetErrorOrValue( FormulaError& rErr, double& rVal );
sc::FormulaResultValue GetResult();
sc::FormulaResultValue GetResult() const;
- sal_uInt8 GetMatrixFlag() const { return cMatrixFlag;}
+ ScMatrixMode GetMatrixFlag() const { return cMatrixFlag;}
ScTokenArray* GetCode() { return pCode;}
const ScTokenArray* GetCode() const { return pCode;}
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index b7a3be681357..8a0b48508017 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -94,6 +94,11 @@
#include <utility>
#include <vector>
+static std::ostream& operator<<(std::ostream& os, ScMatrixMode mode)
+{
+ os << (int) mode; return os;
+}
+
struct TestImpl
{
ScDocShellRef m_xDocShell;
@@ -1955,12 +1960,12 @@ void Test::testMatrixEditable()
ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(0,2,0));
CPPUNIT_ASSERT(pFC);
CPPUNIT_ASSERT_EQUAL_MESSAGE("A3 should be matrix origin.",
- MM_FORMULA, static_cast<ScMatrixMode>(pFC->GetMatrixFlag()));
+ ScMatrixMode::Formula, pFC->GetMatrixFlag());
pFC = m_pDoc->GetFormulaCell(ScAddress(0,3,0));
CPPUNIT_ASSERT(pFC);
CPPUNIT_ASSERT_EQUAL_MESSAGE("A4 should be matrix reference.",
- MM_REFERENCE, static_cast<ScMatrixMode>(pFC->GetMatrixFlag()));
+ ScMatrixMode::Reference, pFC->GetMatrixFlag());
// Check to make sure A3:A4 combined is editable.
ScEditableTester aTester;
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index c11ecab06628..ea3eea69cc96 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -86,6 +86,11 @@ ScRange getCachedRange(const ScExternalRefCache::TableTypeRef& pCacheTab)
}
+static std::ostream& operator<<(std::ostream& os, ScMatrixMode mode)
+{
+ os << (int) mode; return os;
+}
+
void Test::testFormulaCreateStringFromTokens()
{
// Insert sheets.
@@ -3845,7 +3850,7 @@ void Test::testFuncMIN()
// Formula cell in C1:C2 should be a 1x2 matrix array.
ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(2,0,0));
CPPUNIT_ASSERT(pFC);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("This formula should be an array.", MM_FORMULA, static_cast<ScMatrixMode>(pFC->GetMatrixFlag()));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("This formula should be an array.", ScMatrixMode::Formula, pFC->GetMatrixFlag());
SCCOL nCols;
SCROW nRows;
@@ -4392,7 +4397,7 @@ void Test::testFuncLEN()
ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1,0,0));
CPPUNIT_ASSERT(pFC);
CPPUNIT_ASSERT_EQUAL_MESSAGE("This formula should be a matrix origin.",
- MM_FORMULA, static_cast<ScMatrixMode>(pFC->GetMatrixFlag()));
+ ScMatrixMode::Formula, pFC->GetMatrixFlag());
// This should be a 1x3 matrix.
SCCOL nCols = -1;
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index bb8d3783c122..c8a450e5aca0 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -135,7 +135,7 @@ sc::MatrixEdge ScColumn::GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sc::Matr
return MatrixEdge::Nothing;
const ScFormulaCell* pCell = sc::formula_block::at(*aPos.first->data, aPos.second);
- if (!pCell->GetMatrixFlag())
+ if (pCell->GetMatrixFlag() == ScMatrixMode::NONE)
return MatrixEdge::Nothing;
return pCell->GetMatrixEdge(aOrigin);
@@ -165,7 +165,7 @@ sc::MatrixEdge ScColumn::GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sc::Matr
{
// Loop inside the formula block.
const ScFormulaCell* pCell = *itCell;
- if (!pCell->GetMatrixFlag())
+ if (pCell->GetMatrixFlag() == ScMatrixMode::NONE)
continue;
nEdges = pCell->GetMatrixEdge(aOrigin);
@@ -239,7 +239,7 @@ bool ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const
{
// Loop inside the formula block.
const ScFormulaCell* pCell = *itCell;
- if (!pCell->GetMatrixFlag())
+ if (pCell->GetMatrixFlag() == ScMatrixMode::NONE)
// cell is not a part of a matrix.
continue;
@@ -275,7 +275,7 @@ bool ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const
{ // new matrix to check?
aCurOrigin = aOrigin;
const ScFormulaCell* pFCell;
- if (pCell->GetMatrixFlag() == MM_REFERENCE)
+ if (pCell->GetMatrixFlag() == ScMatrixMode::Reference)
pFCell = pDocument->GetFormulaCell(aOrigin);
else
pFCell = pCell;
@@ -2891,7 +2891,7 @@ public:
else if (pCell->NeedsNumberFormat())
pCell->SetDirtyVar();
- if (pCell->GetMatrixFlag())
+ if (pCell->GetMatrixFlag() != ScMatrixMode::NONE)
pCell->SetDirtyVar();
pCell->CompileXML(mrCxt, mrProgress);
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index e378dd0384b8..a864f66958e9 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1715,7 +1715,7 @@ bool ScColumn::ParseString(
new ScFormulaCell(
pDocument, ScAddress(nCol, nRow, nTabP), rString,
formula::FormulaGrammar::mergeToGrammar(formula::FormulaGrammar::GRAM_DEFAULT, eConv),
- MM_NONE));
+ ScMatrixMode::NONE));
}
else if ( cFirstChar == '\'') // 'Text
{
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 3e08a7fea028..e848ceb86343 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -491,8 +491,8 @@ void ScColumn::CloneFormulaCell(
SCCOL nMatrixCols = 0;
SCROW nMatrixRows = 0;
- sal_uInt8 nMatrixFlag = rSrc.GetMatrixFlag();
- if (nMatrixFlag == MM_FORMULA)
+ ScMatrixMode nMatrixFlag = rSrc.GetMatrixFlag();
+ if (nMatrixFlag == ScMatrixMode::Formula)
{
rSrc.GetMatColsRows( nMatrixCols, nMatrixRows);
SAL_WARN_IF( nMatrixCols != 1 || nMatrixRows != 1, "sc.core",
@@ -526,7 +526,7 @@ void ScColumn::CloneFormulaCell(
for (size_t i = 0; i < nLen; ++i, aPos.IncRow())
{
ScFormulaCell* pCell = new ScFormulaCell(pDocument, aPos, xGroup, pDocument->GetGrammar(), nMatrixFlag);
- if (nMatrixFlag == MM_FORMULA)
+ if (nMatrixFlag == ScMatrixMode::Formula)
pCell->SetMatColsRows( nMatrixCols, nMatrixRows);
if (i == 0)
{
@@ -760,7 +760,7 @@ public:
// Get the formula string.
OUString aFormula = pTop->GetFormula(mrCompileFormulaCxt);
sal_Int32 n = aFormula.getLength();
- if (pTop->GetMatrixFlag() != MM_NONE && n > 0)
+ if (pTop->GetMatrixFlag() != ScMatrixMode::NONE && n > 0)
{
if (aFormula[0] == '{' && aFormula[n-1] == '}')
aFormula = aFormula.copy(1, n-2);
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 999363c51c5e..92df7a1c8f21 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -277,9 +277,9 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1,
ScFormulaCell* pCell;
ScAddress aPos( nCol1, nRow1, nTab1 );
if (pArr)
- pCell = new ScFormulaCell(this, aPos, *pArr, eGram, MM_FORMULA);
+ pCell = new ScFormulaCell(this, aPos, *pArr, eGram, ScMatrixMode::Formula);
else
- pCell = new ScFormulaCell( this, aPos, rFormula, eGram, MM_FORMULA );
+ pCell = new ScFormulaCell( this, aPos, rFormula, eGram, ScMatrixMode::Formula );
pCell->SetMatColsRows( nCol2 - nCol1 + 1, nRow2 - nRow1 + 1 );
ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
SCTAB nMax = static_cast<SCTAB>(maTabs.size());
@@ -340,7 +340,7 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1,
aRefData.SetAddress(aBasePos, aPos);
*t->GetSingleRef() = aRefData;
std::unique_ptr<ScTokenArray> pTokArr(aArr.Clone());
- pCell = new ScFormulaCell(this, aPos, *pTokArr, eGram, MM_REFERENCE);
+ pCell = new ScFormulaCell(this, aPos, *pTokArr, eGram, ScMatrixMode::Reference);
pTab->SetFormulaCell(nCol, nRow, pCell);
}
}
@@ -427,7 +427,7 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam, // multiple (repeate
aForString.append(ScCompiler::GetNativeSymbol( ocClose ));
ScFormulaCell aRefCell( this, ScAddress( nCol1, nRow1, nTab1 ), aForString.makeStringAndClear(),
- formula::FormulaGrammar::GRAM_NATIVE, MM_NONE );
+ formula::FormulaGrammar::GRAM_NATIVE, ScMatrixMode::NONE );
for( j = nCol1; j <= nCol2; j++ )
for( k = nRow1; k <= nRow2; k++ )
for (i = 0; i < static_cast<SCTAB>(maTabs.size()); i++)
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 98e0fafea951..5f0dc5a5c006 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -328,7 +328,7 @@ void ScDocumentImport::setMatrixCells(
sc::CellStoreType& rCells = pTab->aCol[rBasePos.Col()].maCells;
// Set the master cell.
- ScFormulaCell* pCell = new ScFormulaCell(&mpImpl->mrDoc, rBasePos, rArray, eGram, MM_FORMULA);
+ ScFormulaCell* pCell = new ScFormulaCell(&mpImpl->mrDoc, rBasePos, rArray, eGram, ScMatrixMode::Formula);
pBlockPos->miCellPos =
rCells.set(pBlockPos->miCellPos, rBasePos.Row(), pCell);
@@ -357,7 +357,7 @@ void ScDocumentImport::setMatrixCells(
aRefData.SetAddress(rBasePos, aPos);
*t->GetSingleRef() = aRefData;
std::unique_ptr<ScTokenArray> pTokArr(aArr.Clone());
- pCell = new ScFormulaCell(&mpImpl->mrDoc, aPos, *pTokArr, eGram, MM_REFERENCE);
+ pCell = new ScFormulaCell(&mpImpl->mrDoc, aPos, *pTokArr, eGram, ScMatrixMode::Reference);
pBlockPos->miCellPos =
rCells.set(pBlockPos->miCellPos, aPos.Row(), pCell);
}
@@ -377,7 +377,7 @@ void ScDocumentImport::setMatrixCells(
aRefData.SetAddress(rBasePos, aPos);
*t->GetSingleRef() = aRefData;
std::unique_ptr<ScTokenArray> pTokArr(aArr.Clone());
- pCell = new ScFormulaCell(&mpImpl->mrDoc, aPos, *pTokArr, eGram, MM_REFERENCE);
+ pCell = new ScFormulaCell(&mpImpl->mrDoc, aPos, *pTokArr, eGram, ScMatrixMode::Reference);
pBlockPos->miCellPos =
rColCells.set(pBlockPos->miCellPos, aPos.Row(), pCell);
}
@@ -451,7 +451,7 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam
ScFormulaCell aRefCell(
pDoc, ScAddress(nCol1, nRow1, nTab), aFormulaBuf.makeStringAndClear(),
- formula::FormulaGrammar::GRAM_NATIVE, MM_NONE);
+ formula::FormulaGrammar::GRAM_NATIVE, ScMatrixMode::NONE);
for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
{
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index f988de952c99..ec26a6942f67 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -613,7 +613,7 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos ) :
pNextTrack(nullptr),
nSeenInIteration(0),
nFormatType(css::util::NumberFormat::NUMBER),
- cMatrixFlag(MM_NONE),
+ cMatrixFlag(ScMatrixMode::NONE),
bDirty(false),
bChanged(false),
bRunning(false),
@@ -635,7 +635,7 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos ) :
ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
const OUString& rFormula,
const FormulaGrammar::Grammar eGrammar,
- sal_uInt8 cMatInd ) :
+ ScMatrixMode cMatInd ) :
eTempGrammar( eGrammar),
pCode( nullptr ),
pDocument( pDoc ),
@@ -671,7 +671,7 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
ScFormulaCell::ScFormulaCell(
ScDocument* pDoc, const ScAddress& rPos, ScTokenArray* pArray,
- const FormulaGrammar::Grammar eGrammar, sal_uInt8 cMatInd ) :
+ const FormulaGrammar::Grammar eGrammar, ScMatrixMode cMatInd ) :
eTempGrammar( eGrammar),
pCode(pArray),
pDocument( pDoc ),
@@ -722,7 +722,7 @@ ScFormulaCell::ScFormulaCell(
ScFormulaCell::ScFormulaCell(
ScDocument* pDoc, const ScAddress& rPos, const ScTokenArray& rArray,
- const FormulaGrammar::Grammar eGrammar, sal_uInt8 cMatInd ) :
+ const FormulaGrammar::Grammar eGrammar, ScMatrixMode cMatInd ) :
eTempGrammar( eGrammar),
pCode(new ScTokenArray(rArray)),
pDocument( pDoc ),
@@ -772,7 +772,7 @@ ScFormulaCell::ScFormulaCell(
ScFormulaCell::ScFormulaCell(
ScDocument* pDoc, const ScAddress& rPos, const ScFormulaCellGroupRef& xGroup,
- const FormulaGrammar::Grammar eGrammar, sal_uInt8 cInd ) :
+ const FormulaGrammar::Grammar eGrammar, ScMatrixMode cInd ) :
mxGroup(xGroup),
eTempGrammar( eGrammar),
pCode(xGroup->mpCode ? xGroup->mpCode : new ScTokenArray),
@@ -981,7 +981,7 @@ void ScFormulaCell::GetFormula( OUStringBuffer& rBuffer,
rBuffer = ScGlobal::GetErrorString(pCode->GetCodeError());
return;
}
- else if( cMatrixFlag == MM_REFERENCE )
+ else if( cMatrixFlag == ScMatrixMode::Reference )
{
// Reference to another cell that contains a matrix formula.
pCode->Reset();
@@ -1023,7 +1023,7 @@ void ScFormulaCell::GetFormula( OUStringBuffer& rBuffer,
}
rBuffer.insert( 0, '=');
- if( cMatrixFlag )
+ if( cMatrixFlag != ScMatrixMode::NONE )
{
rBuffer.insert( 0, '{');
rBuffer.append( '}');
@@ -1048,7 +1048,7 @@ OUString ScFormulaCell::GetFormula( sc::CompileFormulaContext& rCxt ) const
aComp.CreateStringFromTokenArray(aBuf);
return aBuf.makeStringAndClear();
}
- else if( cMatrixFlag == MM_REFERENCE )
+ else if( cMatrixFlag == ScMatrixMode::Reference )
{
// Reference to another cell that contains a matrix formula.
pCode->Reset();
@@ -1087,7 +1087,7 @@ OUString ScFormulaCell::GetFormula( sc::CompileFormulaContext& rCxt ) const
}
aBuf.insert( 0, '=');
- if( cMatrixFlag )
+ if( cMatrixFlag != ScMatrixMode::NONE )
{
aBuf.insert( 0, '{');
aBuf.append( '}');
@@ -1275,7 +1275,7 @@ void ScFormulaCell::CompileTokenArray( sc::CompileFormulaContext& rCxt, bool bNo
void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress )
{
- if ( cMatrixFlag == MM_REFERENCE )
+ if ( cMatrixFlag == ScMatrixMode::Reference )
{ // is already token code via ScDocFunc::EnterMatrix, ScDocument::InsertMatrixFormula
// just establish listeners
StartListeningTo( pDocument );
@@ -1438,9 +1438,9 @@ void ScFormulaCell::CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartL
// DoubleRefs for binary operators were always a Matrix before version v5.0.
// Now this is only the case when in an array formula, otherwise it's an implicit intersection
if ( pDocument->GetSrcVersion() < SC_MATRIX_DOUBLEREF &&
- GetMatrixFlag() == MM_NONE && pCode->HasMatrixDoubleRefOps() )
+ GetMatrixFlag() == ScMatrixMode::NONE && pCode->HasMatrixDoubleRefOps() )
{
- cMatrixFlag = MM_FORMULA;
+ cMatrixFlag = ScMatrixMode::Formula;
SetMatColsRows( 1, 1);
}
@@ -1963,7 +1963,7 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
// Don't set text format as hard format.
bSetFormat = false;
}
- else if (nFormatType == css::util::NumberFormat::LOGICAL && cMatrixFlag != MM_NONE)
+ else if (nFormatType == css::util::NumberFormat::LOGICAL && cMatrixFlag != ScMatrixMode::NONE)
{
// In a matrix range do not set an (inherited) logical format
// as hard format if the value does not represent a strict TRUE
@@ -1976,7 +1976,7 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
// some other elements should be. We'd need to transport type
// or format information on arrays.
StackVar eNewCellResultType = aNewResult.GetCellResultType();
- if (eNewCellResultType != svError || cMatrixFlag == MM_REFERENCE)
+ if (eNewCellResultType != svError || cMatrixFlag == ScMatrixMode::Reference)
{
double fVal;
if (eNewCellResultType != svDouble)
@@ -2089,7 +2089,7 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
{
// If the formula wasn't entered as a matrix formula, live on with
// the upper left corner and let reference counting delete the matrix.
- if( cMatrixFlag != MM_FORMULA && !pCode->IsHyperLink() )
+ if( cMatrixFlag != ScMatrixMode::Formula && !pCode->IsHyperLink() )
aResult.SetToken( aResult.GetCellResultToken().get());
}
if ( aResult.IsValue() && !::rtl::math::isFinite( aResult.GetDouble() ) )
@@ -2543,7 +2543,7 @@ bool ScFormulaCell::NeedsInterpret() const
if (!IsDirtyOrInTableOpDirty())
return false;
- return (pDocument->GetAutoCalc() || (cMatrixFlag != MM_NONE));
+ return (pDocument->GetAutoCalc() || (cMatrixFlag != ScMatrixMode::NONE));
}
void ScFormulaCell::MaybeInterpret()
@@ -2630,7 +2630,7 @@ const ScMatrix* ScFormulaCell::GetMatrix()
{
if( IsDirtyOrInTableOpDirty()
// Was stored !bDirty but an accompanying matrix cell was bDirty?
- || (!bDirty && cMatrixFlag == MM_FORMULA && !aResult.GetMatrix()))
+ || (!bDirty && cMatrixFlag == ScMatrixMode::Formula && !aResult.GetMatrix()))
Interpret();
}
return aResult.GetMatrix().get();
@@ -2640,10 +2640,10 @@ bool ScFormulaCell::GetMatrixOrigin( ScAddress& rPos ) const
{
switch ( cMatrixFlag )
{
- case MM_FORMULA :
+ case ScMatrixMode::Formula :
rPos = aPos;
return true;
- case MM_REFERENCE :
+ case ScMatrixMode::Reference :
{
pCode->Reset();
formula::FormulaToken* t = pCode->GetNextReferenceRPN();
@@ -2659,6 +2659,7 @@ bool ScFormulaCell::GetMatrixOrigin( ScAddress& rPos ) const
}
}
break;
+ default: break;
}
return false;
}
@@ -2667,8 +2668,8 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const
{
switch ( cMatrixFlag )
{
- case MM_FORMULA :
- case MM_REFERENCE :
+ case ScMatrixMode::Formula :
+ case ScMatrixMode::Reference :
{
static SCCOL nC;
static SCROW nR;
@@ -2679,12 +2680,12 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const
{ // First time or a different matrix than last time.
rOrgPos = aOrg;
const ScFormulaCell* pFCell;
- if ( cMatrixFlag == MM_REFERENCE )
+ if ( cMatrixFlag == ScMatrixMode::Reference )
pFCell = pDocument->GetFormulaCell(aOrg);
else
- pFCell = this; // this MM_FORMULA
+ pFCell = this; // this ScMatrixMode::Formula
// There's only one this, don't compare pFCell==this.
- if (pFCell && pFCell->cMatrixFlag == MM_FORMULA)
+ if (pFCell && pFCell->cMatrixFlag == ScMatrixMode::Formula)
{
pFCell->GetMatColsRows( nC, nR );
if ( nC == 0 || nR == 0 )
@@ -2700,7 +2701,7 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const
do
{
pCell = pDocument->GetFormulaCell(aAdr);
- if (pCell && pCell->cMatrixFlag == MM_REFERENCE &&
+ if (pCell && pCell->cMatrixFlag == ScMatrixMode::Reference &&
pCell->GetMatrixOrigin(aTmpOrg) && aTmpOrg == aOrg)
{
nC++;
@@ -2715,7 +2716,7 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const
do
{
pCell = pDocument->GetFormulaCell(aAdr);
- if (pCell && pCell->cMatrixFlag == MM_REFERENCE &&
+ if (pCell && pCell->cMatrixFlag == ScMatrixMode::Reference &&
pCell->GetMatrixOrigin(aTmpOrg) && aTmpOrg == aOrg)
{
nR++;
@@ -3047,7 +3048,7 @@ bool checkCompileColRowName(
}
void setOldCodeToUndo(
- ScDocument* pUndoDoc, const ScAddress& aUndoPos, ScTokenArray* pOldCode, FormulaGrammar::Grammar eTempGrammar, sal_uInt8 cMatrixFlag)
+ ScDocument* pUndoDoc, const ScAddress& aUndoPos, ScTokenArray* pOldCode, FormulaGrammar::Grammar eTempGrammar, ScMatrixMode cMatrixFlag)
{
// Copy the cell to aUndoPos, which is its current position in the document,
// so this works when UpdateReference is called before moving the cells
@@ -3848,7 +3849,7 @@ void ScFormulaCell::SetCellGroup( const ScFormulaCellGroupRef &xRef )
ScFormulaCell::CompareState ScFormulaCell::CompareByTokenArray( ScFormulaCell& rOther ) const
{
// no Matrix formulae yet.
- if ( GetMatrixFlag() != MM_NONE )
+ if ( GetMatrixFlag() != ScMatrixMode::NONE )
return NotEqual;
// are these formulas at all similar ?
@@ -4095,7 +4096,7 @@ bool ScFormulaCell::InterpretFormulaGroup()
return false;
}
- if (cMatrixFlag != MM_NONE)
+ if (cMatrixFlag != ScMatrixMode::NONE)
{
mxGroup->meCalcState = sc::GroupCalcDisabled;
aScope.addMessage("matrix skipped");
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 693106d58999..ac6e5e04ddfb 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -481,7 +481,7 @@ void ScTable::FillFormula(
ScFormulaCell* pDestCell = new ScFormulaCell( *pSrcCell, *pDocument, aAddr );
aCol[nDestCol].SetFormulaCell(nDestRow, pDestCell);
- if ( bLast && pDestCell->GetMatrixFlag() )
+ if ( bLast && pDestCell->GetMatrixFlag() != ScMatrixMode::NONE )
{
ScAddress aOrg;
if ( pDestCell->GetMatrixOrigin( aOrg ) )
@@ -489,7 +489,7 @@ void ScTable::FillFormula(
if ( nDestCol >= aOrg.Col() && nDestRow >= aOrg.Row() )
{
ScFormulaCell* pOrgCell = pDocument->GetFormulaCell(aOrg);
- if (pOrgCell && pOrgCell->GetMatrixFlag() == MM_FORMULA)
+ if (pOrgCell && pOrgCell->GetMatrixFlag() == ScMatrixMode::Formula)
{
pOrgCell->SetMatColsRows(
nDestCol - aOrg.Col() + 1,
@@ -497,7 +497,7 @@ void ScTable::FillFormula(
}
else
{
- OSL_FAIL( "FillFormula: MatrixOrigin no formula cell with MM_FORMULA" );
+ OSL_FAIL( "FillFormula: MatrixOrigin no formula cell with ScMatrixMode::Formula" );
}
}
else
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 2d38b7b3b606..b442d5025b43 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -151,19 +151,19 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
return bFound;
}
- sal_uInt8 cMatrixFlag = MM_NONE;
+ ScMatrixMode cMatrixFlag = ScMatrixMode::NONE;
if ( bFound &&
( (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE)
||(rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL) ) &&
// Don't split the matrix, only replace Matrix formulas
!( (eCellType == CELLTYPE_FORMULA &&
- ((cMatrixFlag = aCell.mpFormula->GetMatrixFlag()) == MM_REFERENCE))
+ ((cMatrixFlag = aCell.mpFormula->GetMatrixFlag()) == ScMatrixMode::Reference))
// No UndoDoc => Matrix not restorable => don't replace
- || (cMatrixFlag != MM_NONE && !pUndoDoc) ) &&
+ || (cMatrixFlag != ScMatrixMode::NONE && !pUndoDoc) ) &&
IsBlockEditable(nCol, nRow, nCol, nRow)
)
{
- if ( cMatrixFlag == MM_NONE && rSearchItem.GetCommand() == SvxSearchCmd::REPLACE )
+ if ( cMatrixFlag == ScMatrixMode::NONE && rSearchItem.GetCommand() == SvxSearchCmd::REPLACE )
rUndoStr = aString;
else if (pUndoDoc)
{
@@ -235,7 +235,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
if (pNote)
pNote->SetText( ScAddress( nCol, nRow, nTab ), aString );
}
- else if ( cMatrixFlag != MM_NONE )
+ else if ( cMatrixFlag != ScMatrixMode::NONE )
{ // don't split Matrix
if ( aString.getLength() > 2 )
{ // remove {} here so that "{=" can be replaced by "{=..."
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index f7d921b530e7..1deed0551ae8 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -628,7 +628,7 @@ bool ScValidationData::GetSelectionFromFormula(
return false;
ScFormulaCell aValidationSrc(
- pDocument, rPos, rTokArr, formula::FormulaGrammar::GRAM_DEFAULT, MM_FORMULA);
+ pDocument, rPos, rTokArr, formula::FormulaGrammar::GRAM_DEFAULT, ScMatrixMode::Formula);
// Make sure the formula gets interpreted and a result is delivered,
// regardless of the AutoCalc setting.
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 1b34fe2982b0..91953cb46633 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1422,7 +1422,7 @@ void ScChangeActionContent::SetValueString(
rCell.meType = CELLTYPE_FORMULA;
rCell.mpFormula = new ScFormulaCell(
pDoc, aBigRange.aStart.MakeAddress(), rStr,
- formula::FormulaGrammar::GRAM_DEFAULT, pDoc->GetGrammar() );
+ pDoc->GetGrammar() );
rCell.mpFormula->SetInChangeTrack(true);
}
else
@@ -1652,11 +1652,11 @@ ScChangeActionContentCellType ScChangeActionContent::GetContentCellType( const S
case CELLTYPE_FORMULA :
switch (rCell.mpFormula->GetMatrixFlag())
{
- case MM_NONE :
+ case ScMatrixMode::NONE :
return SC_CACCT_NORMAL;
- case MM_FORMULA :
+ case ScMatrixMode::Formula :
return SC_CACCT_MATORG;
- case MM_REFERENCE :
+ case ScMatrixMode::Reference :
return SC_CACCT_MATREF;
}
return SC_CACCT_NORMAL;
@@ -1678,11 +1678,11 @@ ScChangeActionContentCellType ScChangeActionContent::GetContentCellType( const S
const ScFormulaCell* pCell = rCell.mpFormula;
switch (pCell->GetMatrixFlag())
{
- case MM_NONE :
+ case ScMatrixMode::NONE :
return SC_CACCT_NORMAL;
- case MM_FORMULA :
+ case ScMatrixMode::Formula :
return SC_CACCT_MATORG;
- case MM_REFERENCE :
+ case ScMatrixMode::Reference :
return SC_CACCT_MATREF;
}
return SC_CACCT_NORMAL;
@@ -2629,10 +2629,10 @@ bool ScChangeTrack::IsMatrixFormulaRangeDifferent(
nC1 = nC2 = 0;
nR1 = nR2 = 0;
- if (rOldCell.meType == CELLTYPE_FORMULA && rOldCell.mpFormula->GetMatrixFlag() == MM_FORMULA)
+ if (rOldCell.meType == CELLTYPE_FORMULA && rOldCell.mpFormula->GetMatrixFlag() == ScMatrixMode::Formula)
rOldCell.mpFormula->GetMatColsRows(nC1, nR1);
- if (rNewCell.meType == CELLTYPE_FORMULA && rNewCell.mpFormula->GetMatrixFlag() == MM_FORMULA)
+ if (rNewCell.meType == CELLTYPE_FORMULA && rNewCell.mpFormula->GetMatrixFlag() == ScMatrixMode::Formula)
rNewCell.mpFormula->GetMatColsRows(nC1, nR1);
return nC1 != nC2 || nR1 != nR2;
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 486aa51d72a1..f527a86e8627 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3786,8 +3786,8 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc,
if(pMyFormulaCell)
{
- sal_uInt8 cMatFlag = pMyFormulaCell->GetMatrixFlag();
- bMatrixFormula = ( cMatFlag == MM_FORMULA );
+ ScMatrixMode cMatFlag = pMyFormulaCell->GetMatrixFlag();
+ bMatrixFormula = ( cMatFlag == ScMatrixMode::Formula );
}
else
bMatrixFormula = false;
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 35edbba126fb..37a4d7a380e4 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -878,35 +878,36 @@ XclExpFormulaCell::XclExpFormulaCell(
mxAddRec = rTableopBfr.CreateOrExtendTableop( rScTokArr, aScPos );
// no multiple operation found - try to create matrix formula
- if( !mxAddRec ) switch( static_cast< ScMatrixMode >( mrScFmlaCell.GetMatrixFlag() ) )
- {
- case MM_FORMULA:
- {
- // origin of the matrix - find the used matrix range
- SCCOL nMatWidth;
- SCROW nMatHeight;
- mrScFmlaCell.GetMatColsRows( nMatWidth, nMatHeight );
- OSL_ENSURE( nMatWidth && nMatHeight, "XclExpFormulaCell::XclExpFormulaCell - empty matrix" );
- ScRange aMatScRange( aScPos );
- ScAddress& rMatEnd = aMatScRange.aEnd;
- rMatEnd.IncCol( static_cast< SCsCOL >( nMatWidth - 1 ) );
- rMatEnd.IncRow( static_cast< SCsROW >( nMatHeight - 1 ) );
- // reduce to valid range (range keeps valid, because start position IS valid)
- rRoot.GetAddressConverter().ValidateRange( aMatScRange, true );
- // create the ARRAY record
- mxAddRec = rArrayBfr.CreateArray( rScTokArr, aMatScRange );
- }
- break;
- case MM_REFERENCE:
+ if( !mxAddRec )
+ switch( mrScFmlaCell.GetMatrixFlag() )
{
- // other formula cell covered by a matrix - find the ARRAY record
- mxAddRec = rArrayBfr.FindArray(rScTokArr, aScPos);
- // should always be found, if Calc document is not broken
- OSL_ENSURE( mxAddRec, "XclExpFormulaCell::XclExpFormulaCell - no matrix found" );
+ case ScMatrixMode::Formula:
+ {
+ // origin of the matrix - find the used matrix range
+ SCCOL nMatWidth;
+ SCROW nMatHeight;
+ mrScFmlaCell.GetMatColsRows( nMatWidth, nMatHeight );
+ OSL_ENSURE( nMatWidth && nMatHeight, "XclExpFormulaCell::XclExpFormulaCell - empty matrix" );
+ ScRange aMatScRange( aScPos );
+ ScAddress& rMatEnd = aMatScRange.aEnd;
+ rMatEnd.IncCol( static_cast< SCsCOL >( nMatWidth - 1 ) );
+ rMatEnd.IncRow( static_cast< SCsROW >( nMatHeight - 1 ) );
+ // reduce to valid range (range keeps valid, because start position IS valid)
+ rRoot.GetAddressConverter().ValidateRange( aMatScRange, true );
+ // create the ARRAY record
+ mxAddRec = rArrayBfr.CreateArray( rScTokArr, aMatScRange );
+ }
+ break;
+ case ScMatrixMode::Reference:
+ {
+ // other formula cell covered by a matrix - find the ARRAY record
+ mxAddRec = rArrayBfr.FindArray(rScTokArr, aScPos);
+ // should always be found, if Calc document is not broken
+ OSL_ENSURE( mxAddRec, "XclExpFormulaCell::XclExpFormulaCell - no matrix found" );
+ }
+ break;
+ default:;
}
- break;
- default:;
- }
// no matrix found - try to create shared formula
if( !mxAddRec )
@@ -959,12 +960,12 @@ void XclExpFormulaCell::SaveXml( XclExpXmlStream& rStrm )
switch (mrScFmlaCell.GetMatrixFlag())
{
- case MM_NONE:
+ case ScMatrixMode::NONE:
break;
- case MM_REFERENCE:
+ case ScMatrixMode::Reference:
bWriteFormula = false;
break;
- case MM_FORMULA:
+ case ScMatrixMode::Formula:
{
// origin of the matrix - find the used matrix range
SCCOL nMatWidth;
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index a9d7230a8577..cf4b599caff8 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -318,10 +318,10 @@ void ScChangeTrackingExportHelper::WriteFormulaCell(const ScCellValue& rCell, co
sal_uInt16 nNamespacePrefix = (eGrammar == formula::FormulaGrammar::GRAM_ODFF ? XML_NAMESPACE_OF : XML_NAMESPACE_OOOC);
OUString sFormula;
pFormulaCell->GetFormula(sFormula, eGrammar);
- sal_uInt8 nMatrixFlag(pFormulaCell->GetMatrixFlag());
- if (nMatrixFlag)
+ ScMatrixMode nMatrixFlag(pFormulaCell->GetMatrixFlag());
+ if (nMatrixFlag != ScMatrixMode::NONE)
{
- if (nMatrixFlag == MM_FORMULA)
+ if (nMatrixFlag == ScMatrixMode::Formula)
{
SCCOL nColumns;
SCROW nRows;
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index 0051db3f1b2f..36d317623ec8 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -33,7 +33,7 @@
ScMyCellInfo::ScMyCellInfo(
const ScCellValue& rCell, const OUString& rFormulaAddress, const OUString& rFormula,
const formula::FormulaGrammar::Grammar eTempGrammar, const OUString& rInputString,
- const double& rValue, const sal_uInt16 nTempType, const sal_uInt8 nTempMatrixFlag, const sal_Int32 nTempMatrixCols,
+ const double& rValue, const sal_uInt16 nTempType, const ScMatrixMode nTempMatrixFlag, const sal_Int32 nTempMatrixCols,
const sal_Int32 nTempMatrixRows ) :
maCell(rCell),
sFormulaAddress(rFormulaAddress),
@@ -744,7 +744,7 @@ void ScXMLChangeTrackingImportHelper::SetNewCell(ScMyContentAction* pAction)
}
else
{
- sal_uInt8 nMatrixFlag = aCell.mpFormula->GetMatrixFlag();
+ ScMatrixMode nMatrixFlag = aCell.mpFormula->GetMatrixFlag();
OUString sFormula;
// With GRAM_ODFF reference detection is faster on compilation.
/* FIXME: new cell should be created with a clone
@@ -756,7 +756,7 @@ void ScXMLChangeTrackingImportHelper::SetNewCell(ScMyContentAction* pAction)
// FIXME: adjust ScFormulaCell::GetFormula(), so that the right formula string
// is returned and no further string handling is necessary
OUString sFormula2;
- if ( nMatrixFlag != MM_NONE )
+ if ( nMatrixFlag != ScMatrixMode::NONE )
{
sFormula2 = sFormula.copy( 2, sFormula.getLength() - 3 );
}
@@ -767,7 +767,7 @@ void ScXMLChangeTrackingImportHelper::SetNewCell(ScMyContentAction* pAction)
aNewCell.meType = CELLTYPE_FORMULA;
aNewCell.mpFormula = new ScFormulaCell(pDoc, aAddress, sFormula2,formula::FormulaGrammar::GRAM_ODFF, nMatrixFlag);
- if (nMatrixFlag == MM_FORMULA)
+ if (nMatrixFlag == ScMatrixMode::Formula)
{
SCCOL nCols;
SCROW nRows;
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx
index 81a9c542c195..4f4114fe498c 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx
@@ -26,6 +26,7 @@
class ScDocument;
class DateTime;
+enum class ScMatrixMode : sal_uInt8;
struct ScMyActionInfo
{
@@ -45,12 +46,12 @@ struct ScMyCellInfo
sal_Int32 nMatrixRows;
formula::FormulaGrammar::Grammar eGrammar;
sal_uInt16 nType;
- sal_uInt8 nMatrixFlag;
+ ScMatrixMode nMatrixFlag;
ScMyCellInfo(
const ScCellValue& rCell, const OUString& sFormulaAddress, const OUString& sFormula,
const formula::FormulaGrammar::Grammar eGrammar, const OUString& sInputString,
- const double& fValue, const sal_uInt16 nType, const sal_uInt8 nMatrixFlag,
+ const double& fValue, const sal_uInt16 nType, const ScMatrixMode nMatrixFlag,
const sal_Int32 nMatrixCols, const sal_Int32 nMatrixRows );
~ScMyCellInfo();
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index ce91d11ef089..315877586bfa 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -90,7 +90,7 @@ class ScXMLCellContentDeletionContext : public ScXMLImportContext
sal_Int32 nMatrixRows;
formula::FormulaGrammar::Grammar eGrammar;
sal_uInt16 nType;
- sal_uInt8 nMatrixFlag;
+ ScMatrixMode nMatrixFlag;
bool bBigRange;
bool bContainsCell;
@@ -220,7 +220,7 @@ public:
OUString& rFormula, OUString& rFormulaNmsp,
formula::FormulaGrammar::Grammar& rGrammar,
OUString& rInputString, double& fValue, sal_uInt16& nType,
- sal_uInt8& nMatrixFlag, sal_Int32& nMatrixCols, sal_Int32& nMatrixRows);
+ ScMatrixMode& nMatrixFlag, sal_Int32& nMatrixCols, sal_Int32& nMatrixRows);
virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
const OUString& rLocalName,
@@ -247,7 +247,7 @@ class ScXMLPreviousContext : public ScXMLImportContext
sal_Int32 nMatrixRows;
formula::FormulaGrammar::Grammar eGrammar;
sal_uInt16 nType;
- sal_uInt8 nMatrixFlag;
+ ScMatrixMode nMatrixFlag;
public:
ScXMLPreviousContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName,
@@ -628,7 +628,7 @@ ScXMLCellContentDeletionContext::ScXMLCellContentDeletionContext( ScXMLImport&
nMatrixRows(0),
eGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT),
nType(css::util::NumberFormat::ALL),
- nMatrixFlag(MM_NONE),
+ nMatrixFlag(ScMatrixMode::NONE),
bBigRange(false),
bContainsCell(false)
{
@@ -921,7 +921,7 @@ ScXMLChangeCellContext::ScXMLChangeCellContext( ScXMLImport& rImport,
OUString& rFormula, OUString& rFormulaNmsp,
formula::FormulaGrammar::Grammar& rGrammar,
OUString& rTempInputString, double& fDateTimeValue, sal_uInt16& nType,
- sal_uInt8& nMatrixFlag, sal_Int32& nMatrixCols, sal_Int32& nMatrixRows )
+ ScMatrixMode& nMatrixFlag, sal_Int32& nMatrixCols, sal_Int32& nMatrixRows )
: ScXMLImportContext( rImport, nPrfx, rLName )
, mrOldCell(rOldCell)
, rInputString(rTempInputString)
@@ -1009,9 +1009,9 @@ ScXMLChangeCellContext::ScXMLChangeCellContext( ScXMLImport& rImport,
}
}
if (bIsCoveredMatrix)
- nMatrixFlag = MM_REFERENCE;
+ nMatrixFlag = ScMatrixMode::Reference;
else if (bIsMatrix && nMatrixRows && nMatrixCols)
- nMatrixFlag = MM_FORMULA;
+ nMatrixFlag = ScMatrixMode::Formula;
}
SvXMLImportContext *ScXMLChangeCellContext::CreateChildContext( sal_uInt16 nPrefix,
@@ -1126,7 +1126,7 @@ ScXMLPreviousContext::ScXMLPreviousContext( ScXMLImport& rImport,
nMatrixRows(0),
eGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT),
nType(css::util::NumberFormat::ALL),
- nMatrixFlag(MM_NONE)
+ nMatrixFlag(ScMatrixMode::NONE)
{
sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0);
for( sal_Int16 i=0; i < nAttrCount; ++i )
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index bea1876f9870..d800c4bad8f1 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1377,7 +1377,7 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
}
}
- ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, rCellPos, pCode, eGrammar, MM_NONE);
+ ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, rCellPos, pCode, eGrammar, ScMatrixMode::NONE);
SetFormulaCell(pNewCell);
rDoc.setFormulaCell(rCellPos, pNewCell);
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 61b412bfd819..84489b6580e0 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -990,16 +990,16 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
ScAddress aPos = aSourceRange.aStart;
OUString aValue;
static_cast<const ScChangeActionContent*>(pSourceAction)->GetNewString( aValue, &aDocument );
- sal_uInt8 eMatrix = MM_NONE;
+ ScMatrixMode eMatrix = ScMatrixMode::NONE;
const ScCellValue& rCell = static_cast<const ScChangeActionContent*>(pSourceAction)->GetNewCell();
if (rCell.meType == CELLTYPE_FORMULA)
eMatrix = rCell.mpFormula->GetMatrixFlag();
switch ( eMatrix )
{
- case MM_NONE :
+ case ScMatrixMode::NONE :
pViewSh->EnterData( aPos.Col(), aPos.Row(), aPos.Tab(), aValue );
break;
- case MM_FORMULA :
+ case ScMatrixMode::Formula :
{
SCCOL nCols;
SCROW nRows;
@@ -1012,7 +1012,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
EMPTY_OUSTRING, formula::FormulaGrammar::GRAM_DEFAULT );
}
break;
- case MM_REFERENCE : // do nothing
+ case ScMatrixMode::Reference : // do nothing
break;
}
}
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 75ad60f1d60a..64dcf05b7a41 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1855,7 +1855,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
else
{
ScFormulaCell* pFCell = new ScFormulaCell(
- pDoc, aPos, *pCode, eGrammar, MM_NONE);
+ pDoc, aPos, *pCode, eGrammar, ScMatrixMode::NONE);
pDoc->SetFormulaCell(aPos, pFCell);
}
delete pCode; // ctor/InsertMatrixFormula did copy TokenArray
@@ -2034,7 +2034,7 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
const ScFormulaCell* pFCell = aCell.mpFormula;
switch ( pFCell->GetMatrixFlag() )
{
- case MM_REFERENCE :
+ case ScMatrixMode::Reference :
aCellStr.clear();
break;
default:
@@ -2047,7 +2047,7 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
* writes in SYLK, or even better
* GRAM_ENGLISH_XL_R1C1. */
}
- if ( pFCell->GetMatrixFlag() != MM_NONE &&
+ if ( pFCell->GetMatrixFlag() != ScMatrixMode::NONE &&
aCellStr.startsWith("{") &&
aCellStr.endsWith("}") )
{ // cut off matrix {} characters
@@ -2058,7 +2058,7 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
OUString aPrefix;
switch ( pFCell->GetMatrixFlag() )
{
- case MM_FORMULA :
+ case ScMatrixMode::Formula :
{ // diff expression with 'M' M$-extension
SCCOL nC;
SCROW nR;
@@ -2072,7 +2072,7 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
aPrefix += ";M";
}
break;
- case MM_REFERENCE :
+ case ScMatrixMode::Reference :
{ // diff expression with 'I' M$-extension
ScAddress aPos;
(void)pFCell->GetMatrixOrigin( aPos );
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index ce7e6d9e038a..2309993d6f57 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -591,7 +591,7 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName,
// other API compatibility grammars.
ScFormulaCell* pFormula = new ScFormulaCell(
pDoc, aFormulaPos, aTokenArr, formula::FormulaGrammar::GRAM_API,
- (sal_uInt8)(mbArray ? MM_FORMULA : MM_NONE) );
+ mbArray ? ScMatrixMode::Formula : ScMatrixMode::NONE );
pFormula = pDoc->SetFormulaCell(aFormulaPos, pFormula);
// call GetMatrix before GetErrCode because GetMatrix always recalculates
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 509bcff6a81e..02de4e9966a7 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -262,7 +262,7 @@ void ScViewFunc::DoRefConversion()
std::unique_ptr<ScTokenArray> pArr(aComp.CompileString(aNew));
ScFormulaCell* pNewCell =
new ScFormulaCell(
- pDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE);
+ pDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, ScMatrixMode::NONE);
pDoc->SetFormulaCell(aPos, pNewCell);
bOk = true;
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 3ab243850a20..150a923902ab 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -498,7 +498,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
}
}
- ScFormulaCell aCell(pDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE);
+ ScFormulaCell aCell(pDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, ScMatrixMode::NONE);
delete pArr;
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
@@ -749,7 +749,7 @@ void ScViewFunc::EnterMatrix( const OUString& rString, ::formula::FormulaGrammar
ScDocument* pDoc = rData.GetDocument();
SCTAB nTab = rData.GetTabNo();
- ScFormulaCell aFormCell( pDoc, ScAddress(nCol,nRow,nTab), rString, eGram, MM_FORMULA );
+ ScFormulaCell aFormCell( pDoc, ScAddress(nCol,nRow,nTab), rString, eGram, ScMatrixMode::Formula );
SCSIZE nSizeX;
SCSIZE nSizeY;