Switch script type storage from unsigned short to unsigned char.
This will save quite a bit of storage. It requires the next version
of mdds (probably will be 0.8.0).
Change-Id: I11e972c043ad58e8b76e241d3312b5a1de952cf7
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 2933e9f..be9e5d6 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -75,13 +75,13 @@ ScNeededSizeOptions::ScNeededSizeOptions() :
void ScColumn::SwapScriptTypes( ScriptType& rSrc, SCROW nSrcRow, ScriptType& rDest, SCROW nDestRow )
{
unsigned short nSrcVal = 0;
unsigned short nDestVal = 0;
unsigned char nSrcVal = 0;
unsigned char nDestVal = 0;
if (!rSrc.is_empty(nSrcRow))
nSrcVal = rSrc.get<unsigned short>(nSrcRow);
nSrcVal = rSrc.get<unsigned char>(nSrcRow);
if (!rDest.is_empty(nDestRow))
nDestVal = rDest.get<unsigned short>(nDestRow);
nDestVal = rDest.get<unsigned char>(nDestRow);
if (nDestVal)
rSrc.set(nSrcRow, nDestVal);
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index c93e043..bad84e9 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1469,7 +1469,7 @@ void ScColumn::CopyScriptTypesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDe
nRowPos = static_cast<size_t>(nRow2); // End row position.
// Keep copying until we hit the end row position.
mdds::mtv::ushort_element_block::const_iterator itData, itDataEnd;
mdds::mtv::uchar_element_block::const_iterator itData, itDataEnd;
for (; itBlk != itBlkEnd; ++itBlk, nBlockStart = nBlockEnd, nOffsetInBlock = 0)
{
nBlockEnd = nBlockStart + itBlk->size;
@@ -1486,15 +1486,15 @@ void ScColumn::CopyScriptTypesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDe
}
// Non-empty block.
itData = mdds::mtv::ushort_element_block::begin(*itBlk->data);
itDataEnd = mdds::mtv::ushort_element_block::end(*itBlk->data);
itData = mdds::mtv::uchar_element_block::begin(*itBlk->data);
itDataEnd = mdds::mtv::uchar_element_block::end(*itBlk->data);
std::advance(itData, nOffsetInBlock);
if (nBlockStart <= nRowPos && nRowPos <= nBlockEnd)
{
// This block contains the end row. Only copy partially.
size_t nOffset = nRowPos - nBlockStart + 1;
itDataEnd = mdds::mtv::ushort_element_block::begin(*itBlk->data);
itDataEnd = mdds::mtv::uchar_element_block::begin(*itBlk->data);
std::advance(itDataEnd, nOffset);
rDestCol.maScriptTypes.set(nBlockStart + nOffsetInBlock, itData, itDataEnd);
@@ -1545,7 +1545,7 @@ void ScColumn::SetCell(SCROW nRow, ScBaseCell* pNewCell)
}
maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
maScriptTypes.set<unsigned short>(nRow, SC_SCRIPTTYPE_UNKNOWN);
maScriptTypes.set<unsigned char>(nRow, SC_SCRIPTTYPE_UNKNOWN);
CellStorageModified();
}
}
@@ -1565,7 +1565,7 @@ sal_uInt8 ScColumn::GetScriptType( SCROW nRow ) const
if (!ValidRow(nRow) || maScriptTypes.is_empty(nRow))
return 0;
return maScriptTypes.get<unsigned short>(nRow);
return maScriptTypes.get<unsigned char>(nRow);
}
void ScColumn::SetScriptType( SCROW nRow, sal_uInt8 nType )
@@ -1576,7 +1576,7 @@ void ScColumn::SetScriptType( SCROW nRow, sal_uInt8 nType )
if (!nType)
maScriptTypes.set_empty(nRow, nRow);
else
maScriptTypes.set<unsigned short>(nRow, nType);
maScriptTypes.set<unsigned char>(nRow, nType);
}
size_t ScColumn::GetFormulaHash( SCROW nRow ) const
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 63b3a5f..2334330 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -104,7 +104,7 @@ void ScColumn::Append( SCROW nRow, ScBaseCell* pCell )
maItems.back().nRow = nRow;
maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
maScriptTypes.set<unsigned short>(nRow, SC_SCRIPTTYPE_UNKNOWN);
maScriptTypes.set<unsigned char>(nRow, SC_SCRIPTTYPE_UNKNOWN);
CellStorageModified();
}
@@ -1415,7 +1415,7 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
pOldCell->Delete();
maItems[i].pCell = pNewCell; // Replace
maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
maScriptTypes.set<unsigned short>(nRow, SC_SCRIPTTYPE_UNKNOWN);
maScriptTypes.set<unsigned char>(nRow, SC_SCRIPTTYPE_UNKNOWN);
CellStorageModified();
if ( pNewCell->GetCellType() == CELLTYPE_FORMULA )