summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/qa/unit/ucalc.cxx111
-rw-r--r--sc/source/core/data/validat.cxx2
-rw-r--r--sc/source/core/tool/addincol.cxx6
-rw-r--r--sc/source/core/tool/ddelink.cxx2
-rw-r--r--sc/source/core/tool/interpr1.cxx6
-rw-r--r--sc/source/core/tool/interpr5.cxx7
-rw-r--r--sc/source/core/tool/rangeseq.cxx2
-rw-r--r--sc/source/core/tool/token.cxx2
-rw-r--r--sc/source/filter/excel/xihelper.cxx2
-rw-r--r--sc/source/filter/xml/XMLDDELinksContext.cxx2
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx3
11 files changed, 63 insertions, 82 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 7ea887cdb096..dd09aa880b5f 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1242,72 +1242,57 @@ struct PartiallyFilledEmptyMatrix
void Test::testMatrix()
{
ScMatrixRef pMat;
- ScMatrix::DensityType eDT[2];
- // First, test the zero matrix types.
- eDT[0] = ScMatrix::FILLED_ZERO;
- eDT[1] = ScMatrix::SPARSE_ZERO;
- for (int i = 0; i < 2; ++i)
- {
- pMat = new ScMatrix(0, 0, eDT[i]);
- SCSIZE nC, nR;
- pMat->GetDimensions(nC, nR);
- CPPUNIT_ASSERT_MESSAGE("matrix is not empty", nC == 0 && nR == 0);
- pMat->Resize(4, 10);
- pMat->GetDimensions(nC, nR);
- CPPUNIT_ASSERT_MESSAGE("matrix size is not as expected", nC == 4 && nR == 10);
- CPPUNIT_ASSERT_MESSAGE("both 'and' and 'or' should evaluate to false",
- !pMat->And() && !pMat->Or());
-
- // Resizing into a larger matrix should fill the void space with zeros.
- checkMatrixElements<AllZeroMatrix>(*pMat);
-
- pMat->FillDouble(3.0, 1, 2, 2, 8);
- checkMatrixElements<PartiallyFilledZeroMatrix>(*pMat);
- CPPUNIT_ASSERT_MESSAGE("matrix is expected to be numeric", pMat->IsNumeric());
- CPPUNIT_ASSERT_MESSAGE("partially non-zero matrix should evaluate false on 'and' and true on 'or",
- !pMat->And() && pMat->Or());
- pMat->FillDouble(5.0, 0, 0, nC-1, nR-1);
- CPPUNIT_ASSERT_MESSAGE("fully non-zero matrix should evaluate true both on 'and' and 'or",
- pMat->And() && pMat->Or());
- }
+ // First, test the zero matrix type.
+ pMat = new ScMatrix(0, 0, 0.0);
+ SCSIZE nC, nR;
+ pMat->GetDimensions(nC, nR);
+ CPPUNIT_ASSERT_MESSAGE("matrix is not empty", nC == 0 && nR == 0);
+ pMat->Resize(4, 10);
+ pMat->GetDimensions(nC, nR);
+ CPPUNIT_ASSERT_MESSAGE("matrix size is not as expected", nC == 4 && nR == 10);
+ CPPUNIT_ASSERT_MESSAGE("both 'and' and 'or' should evaluate to false",
+ !pMat->And() && !pMat->Or());
+
+ // Resizing into a larger matrix should fill the void space with zeros.
+ checkMatrixElements<AllZeroMatrix>(*pMat);
+
+ pMat->FillDouble(3.0, 1, 2, 2, 8);
+ checkMatrixElements<PartiallyFilledZeroMatrix>(*pMat);
+ CPPUNIT_ASSERT_MESSAGE("matrix is expected to be numeric", pMat->IsNumeric());
+ CPPUNIT_ASSERT_MESSAGE("partially non-zero matrix should evaluate false on 'and' and true on 'or",
+ !pMat->And() && pMat->Or());
+ pMat->FillDouble(5.0, 0, 0, nC-1, nR-1);
+ CPPUNIT_ASSERT_MESSAGE("fully non-zero matrix should evaluate true both on 'and' and 'or",
+ pMat->And() && pMat->Or());
// Test the AND and OR evaluations.
- for (int i = 0; i < 2; ++i)
- {
- pMat = new ScMatrix(2, 2, eDT[i]);
-
- // Only some of the elements are non-zero.
- pMat->PutBoolean(true, 0, 0);
- pMat->PutDouble(1.0, 1, 1);
- CPPUNIT_ASSERT_MESSAGE("incorrect OR result", pMat->Or());
- CPPUNIT_ASSERT_MESSAGE("incorrect AND result", !pMat->And());
-
- // All of the elements are non-zero.
- pMat->PutBoolean(true, 0, 1);
- pMat->PutDouble(2.3, 1, 0);
- CPPUNIT_ASSERT_MESSAGE("incorrect OR result", pMat->Or());
- CPPUNIT_ASSERT_MESSAGE("incorrect AND result", pMat->And());
- }
-
- // Now test the emtpy matrix types.
- eDT[0] = ScMatrix::FILLED_EMPTY;
- eDT[1] = ScMatrix::SPARSE_EMPTY;
- for (int i = 0; i < 2; ++i)
- {
- pMat = new ScMatrix(10, 20, eDT[i]);
- SCSIZE nC, nR;
- pMat->GetDimensions(nC, nR);
- CPPUNIT_ASSERT_MESSAGE("matrix size is not as expected", nC == 10 && nR == 20);
- checkMatrixElements<AllEmptyMatrix>(*pMat);
-
- pMat->PutBoolean(true, 1, 1);
- pMat->PutDouble(-12.5, 4, 5);
- rtl::OUString aStr("Test");
- pMat->PutString(aStr, 8, 2);
- pMat->PutEmptyPath(8, 11);
- checkMatrixElements<PartiallyFilledEmptyMatrix>(*pMat);
- }
+ pMat = new ScMatrix(2, 2, 0.0);
+
+ // Only some of the elements are non-zero.
+ pMat->PutBoolean(true, 0, 0);
+ pMat->PutDouble(1.0, 1, 1);
+ CPPUNIT_ASSERT_MESSAGE("incorrect OR result", pMat->Or());
+ CPPUNIT_ASSERT_MESSAGE("incorrect AND result", !pMat->And());
+
+ // All of the elements are non-zero.
+ pMat->PutBoolean(true, 0, 1);
+ pMat->PutDouble(2.3, 1, 0);
+ CPPUNIT_ASSERT_MESSAGE("incorrect OR result", pMat->Or());
+ CPPUNIT_ASSERT_MESSAGE("incorrect AND result", pMat->And());
+
+ // Now test the emtpy matrix type.
+ pMat = new ScMatrix(10, 20);
+ pMat->GetDimensions(nC, nR);
+ CPPUNIT_ASSERT_MESSAGE("matrix size is not as expected", nC == 10 && nR == 20);
+ checkMatrixElements<AllEmptyMatrix>(*pMat);
+
+ pMat->PutBoolean(true, 1, 1);
+ pMat->PutDouble(-12.5, 4, 5);
+ rtl::OUString aStr("Test");
+ pMat->PutString(aStr, 8, 2);
+ pMat->PutEmptyPath(8, 11);
+ checkMatrixElements<PartiallyFilledEmptyMatrix>(*pMat);
}
namespace {
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 4ccb551879dc..4dd8f2e4048c 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -628,7 +628,7 @@ bool ScValidationData::GetSelectionFromFormula(
// is stored as a single value.
// Use an interim matrix to create the TypedStrData below.
- xMatRef = new ScMatrix(1,1);
+ xMatRef = new ScMatrix(1, 1, 0.0);
sal_uInt16 nErrCode = aValidationSrc.GetErrCode();
if (nErrCode)
diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx
index ba2c9cbfa82e..33c92320c7b7 100644
--- a/sc/source/core/tool/addincol.cxx
+++ b/sc/source/core/tool/addincol.cxx
@@ -1650,7 +1650,7 @@ void ScUnoAddInCall::SetResult( const uno::Any& rNewRes )
{
xMatrix = new ScMatrix(
static_cast<SCSIZE>(nMaxColCount),
- static_cast<SCSIZE>(nRowCount) );
+ static_cast<SCSIZE>(nRowCount), 0.0);
for (nRow=0; nRow<nRowCount; nRow++)
{
long nColCount = pRowArr[nRow].getLength();
@@ -1692,7 +1692,7 @@ void ScUnoAddInCall::SetResult( const uno::Any& rNewRes )
{
xMatrix = new ScMatrix(
static_cast<SCSIZE>(nMaxColCount),
- static_cast<SCSIZE>(nRowCount) );
+ static_cast<SCSIZE>(nRowCount), 0.0);
for (nRow=0; nRow<nRowCount; nRow++)
{
long nColCount = pRowArr[nRow].getLength();
@@ -1734,7 +1734,7 @@ void ScUnoAddInCall::SetResult( const uno::Any& rNewRes )
{
xMatrix = new ScMatrix(
static_cast<SCSIZE>(nMaxColCount),
- static_cast<SCSIZE>(nRowCount) );
+ static_cast<SCSIZE>(nRowCount), 0.0);
for (nRow=0; nRow<nRowCount; nRow++)
{
long nColCount = pRowArr[nRow].getLength();
diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx
index 5bac102f9fb1..aef6b4981d68 100644
--- a/sc/source/core/tool/ddelink.cxx
+++ b/sc/source/core/tool/ddelink.cxx
@@ -166,7 +166,7 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged(
else // Daten aufteilen
{
// Matrix immer neu anlegen, damit bIsString nicht durcheinanderkommt
- pResult = new ScMatrix( nCols, nRows );
+ pResult = new ScMatrix(nCols, nRows, 0.0);
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 4b453b278b1a..b10aea70e75b 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5333,7 +5333,7 @@ void ScInterpreter::ScSumIf()
break;
case svExternalSingleRef:
{
- pSumExtraMatrix = new ScMatrix(1, 1);
+ pSumExtraMatrix = new ScMatrix(1, 1, 0.0);
ScExternalRefCache::TokenRef pToken;
PopExternalSingleRef(pToken);
if (!pToken)
@@ -5957,7 +5957,7 @@ void ScInterpreter::ScLookup()
ScMatrixRef pDataMat2;
if (bVertical)
{
- ScMatrixRef pTempMat(new ScMatrix(1, nR));
+ ScMatrixRef pTempMat(new ScMatrix(1, nR, 0.0));
for (SCSIZE i = 0; i < nR; ++i)
if (pDataMat->IsValue(0, i))
pTempMat->PutDouble(pDataMat->GetDouble(0, i), 0, i);
@@ -5967,7 +5967,7 @@ void ScInterpreter::ScLookup()
}
else
{
- ScMatrixRef pTempMat(new ScMatrix(nC, 1));
+ ScMatrixRef pTempMat(new ScMatrix(nC, 1, 0.0));
for (SCSIZE i = 0; i < nC; ++i)
if (pDataMat->IsValue(i, 0))
pTempMat->PutDouble(pDataMat->GetDouble(i, 0), i, 0);
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index eaa5a38241d1..ba868bc56f5d 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -326,7 +326,7 @@ void ScInterpreter:: ScLCM()
ScMatrixRef ScInterpreter::GetNewMat(SCSIZE nC, SCSIZE nR)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetNewMat" );
- ScMatrixRef pMat = new ScMatrix( nC, nR);
+ ScMatrixRef pMat = new ScMatrix(nC, nR, 0.0);
pMat->SetErrorInterpreter( this);
// A temporary matrix is mutable and ScMatrix::CloneIfConst() returns the
// very matrix.
@@ -556,18 +556,17 @@ ScMatrixRef ScInterpreter::GetMatrix()
}
if (pToken->GetType() == svDouble)
{
- pMat = new ScMatrix(1, 1);
+ pMat = new ScMatrix(1, 1, 0.0);
pMat->PutDouble(pToken->GetDouble(), 0, 0);
}
else if (pToken->GetType() == svString)
{
- pMat = new ScMatrix(1, 1);
+ pMat = new ScMatrix(1, 1, 0.0);
pMat->PutString(pToken->GetString(), 0, 0);
}
else
{
pMat = new ScMatrix(1, 1);
- pMat->PutEmpty(0, 0);
}
}
break;
diff --git a/sc/source/core/tool/rangeseq.cxx b/sc/source/core/tool/rangeseq.cxx
index 928505110a58..ff350188fab6 100644
--- a/sc/source/core/tool/rangeseq.cxx
+++ b/sc/source/core/tool/rangeseq.cxx
@@ -410,7 +410,7 @@ ScMatrixRef ScSequenceToMatrix::CreateMixedMatrix( const com::sun::star::uno::An
rtl::OUString aUStr;
xMatrix = new ScMatrix(
static_cast<SCSIZE>(nMaxColCount),
- static_cast<SCSIZE>(nRowCount) );
+ static_cast<SCSIZE>(nRowCount), 0.0);
SCSIZE nCols, nRows;
xMatrix->GetDimensions( nCols, nRows);
if (nCols != static_cast<SCSIZE>(nMaxColCount) || nRows != static_cast<SCSIZE>(nRowCount))
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 1d7f2a1e8761..00e17c092779 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1492,7 +1492,7 @@ FormulaToken* ScTokenArray::MergeArray( )
return NULL;
int nSign = 1;
- ScMatrix* pArray = new ScMatrix( nCol, nRow );
+ ScMatrix* pArray = new ScMatrix(nCol, nRow, 0.0);
for ( i = nStart, nCol = 0, nRow = 0 ; i < nLen ; i++ )
{
t = pCode[i];
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index 034a72738641..edac049e6d9e 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -861,7 +861,7 @@ ScMatrixRef XclImpCachedMatrix::CreateScMatrix() const
OSL_ENSURE( mnScCols * mnScRows == maValueList.size(), "XclImpCachedMatrix::CreateScMatrix - element count mismatch" );
if( mnScCols && mnScRows && static_cast< sal_uLong >( mnScCols * mnScRows ) <= maValueList.size() )
{
- xScMatrix = new ScMatrix( mnScCols, mnScRows );
+ xScMatrix = new ScMatrix(mnScCols, mnScRows, 0.0);
XclImpValueList::const_iterator itValue = maValueList.begin();
for( SCSIZE nScRow = 0; nScRow < mnScRows; ++nScRow )
{
diff --git a/sc/source/filter/xml/XMLDDELinksContext.cxx b/sc/source/filter/xml/XMLDDELinksContext.cxx
index 54eafd01ad47..4c3c4961ebcc 100644
--- a/sc/source/filter/xml/XMLDDELinksContext.cxx
+++ b/sc/source/filter/xml/XMLDDELinksContext.cxx
@@ -169,7 +169,7 @@ void ScXMLDDELinkContext::EndElement()
OSL_ENSURE( static_cast<size_t>(nColumns * nRows) == aDDELinkTable.size(),
"ScXMLDDELinkContext::EndElement: adapted matrix dimension doesn't match either");
}
- ScMatrixRef pMatrix = new ScMatrix( static_cast<SCSIZE>(nColumns), static_cast<SCSIZE>(nRows) );
+ ScMatrixRef pMatrix = new ScMatrix(static_cast<SCSIZE>(nColumns), static_cast<SCSIZE>(nRows), 0.0);
sal_Int32 nCol(0);
sal_Int32 nRow(-1);
sal_Int32 nIndex(0);
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 101a8ac06109..e1e18c124909 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1465,9 +1465,6 @@ static ScTokenArray* lcl_fillEmptyMatrix(const ScRange& rRange)
SCSIZE nC = static_cast<SCSIZE>(rRange.aEnd.Col()-rRange.aStart.Col()+1);
SCSIZE nR = static_cast<SCSIZE>(rRange.aEnd.Row()-rRange.aStart.Row()+1);
ScMatrixRef xMat = new ScMatrix(nC, nR);
- for (SCSIZE i = 0; i < nC; ++i)
- for (SCSIZE j = 0; j < nR; ++j)
- xMat->PutEmpty(i, j);
ScMatrixToken aToken(xMat);
SAL_WNODEPRECATED_DECLARATIONS_PUSH