summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/column.hxx22
-rw-r--r--sc/inc/columniterator.hxx12
-rw-r--r--sc/source/core/data/column.cxx79
-rw-r--r--sc/source/core/data/column2.cxx60
-rw-r--r--sc/source/core/data/column3.cxx27
-rw-r--r--sc/source/core/data/columniterator.cxx28
-rw-r--r--sc/source/core/data/documentimport.cxx8
7 files changed, 95 insertions, 141 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index d46a16a37ba3..1fe289099577 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -122,16 +122,16 @@ class ScColumn
typedef mdds::mtv::custom_block_func1<sc::element_type_broadcaster, sc::custom_broadcaster_block> BCBlkFunc;
typedef mdds::multi_type_vector<BCBlkFunc> BCStoreType;
- typedef mdds::multi_type_vector<mdds::mtv::element_block_func> TextWidthType;
- typedef mdds::multi_type_vector<mdds::mtv::element_block_func> ScriptType;
+ // Cell text attribute container.
+ typedef mdds::mtv::custom_block_func1<sc::element_type_celltextattr, sc::custom_celltextattr_block> CTAttrFunc;
+ typedef mdds::multi_type_vector<CTAttrFunc> CTAttrStoreType;
- // Only stores empty or unsigned short values. Empty values correspond
- // with empty cells. All non-empty cell positions must have unsigned short
- // values; either the reall text widths or TEXTWIDTH_DIRTY.
- TextWidthType maTextWidths;
-
- // Script types are stored as unsigned char.
- ScriptType maScriptTypes;
+ // Empty values correspond with empty cells. All non-empty cell positions
+ // must have non-empty elements. For text width, the value should be
+ // either the real text width, or TEXTWIDTH_DIRTY in case it hasn't been
+ // calculated yet. For script type, it should be either the real script
+ // type value or SC_SCRIPTTYPE_UNKNOWN.
+ CTAttrStoreType maCellTextAttrs;
BCStoreType maBroadcasters;
@@ -165,8 +165,6 @@ friend class ScDocumentImport;
ScColumn(const ScColumn&); // disabled
ScColumn& operator= (const ScColumn&); // disabled
- static void SwapScriptTypes( ScriptType& rSrc, SCROW nSrcRow, ScriptType& rDest, SCROW nDestRow );
-
std::vector<ColEntry>::iterator Search( SCROW nRow );
std::vector<ColEntry>::const_iterator Search( SCROW nRow ) const;
@@ -494,7 +492,7 @@ private:
*/
void CellStorageModified();
- void CopyScriptTypesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) const;
+ void CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) const;
void SetCell(SCROW nRow, ScBaseCell* pNewCell);
};
diff --git a/sc/inc/columniterator.hxx b/sc/inc/columniterator.hxx
index 7bd645d71040..676f67585cf7 100644
--- a/sc/inc/columniterator.hxx
+++ b/sc/inc/columniterator.hxx
@@ -18,15 +18,15 @@ class ScColumn;
class ScColumnTextWidthIterator : boost::noncopyable
{
- typedef ScColumn::TextWidthType TextWidthType;
+ typedef ScColumn::CTAttrStoreType CTAttrStoreType;
- TextWidthType& mrTextWidths;
+ CTAttrStoreType& mrCellTextAttrs;
const size_t mnEnd;
size_t mnCurPos;
- TextWidthType::iterator miBlockCur;
- TextWidthType::iterator miBlockEnd;
- mdds::mtv::ushort_element_block::iterator miDataCur;
- mdds::mtv::ushort_element_block::iterator miDataEnd;
+ CTAttrStoreType::iterator miBlockCur;
+ CTAttrStoreType::iterator miBlockEnd;
+ sc::custom_celltextattr_block::iterator miDataCur;
+ sc::custom_celltextattr_block::iterator miDataEnd;
public:
ScColumnTextWidthIterator(ScColumn& rCol, SCROW nStartRow, SCROW nEndRow);
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index a4371f2fafa6..0e42ff146163 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -73,27 +73,6 @@ ScNeededSizeOptions::ScNeededSizeOptions() :
{
}
-void ScColumn::SwapScriptTypes( ScriptType& rSrc, SCROW nSrcRow, ScriptType& rDest, SCROW nDestRow )
-{
- unsigned char nSrcVal = 0;
- unsigned char nDestVal = 0;
-
- if (!rSrc.is_empty(nSrcRow))
- nSrcVal = rSrc.get<unsigned char>(nSrcRow);
- if (!rDest.is_empty(nDestRow))
- nDestVal = rDest.get<unsigned char>(nDestRow);
-
- if (nDestVal)
- rSrc.set(nSrcRow, nDestVal);
- else
- rSrc.set_empty(nSrcRow, nSrcRow);
-
- if (nSrcVal)
- rDest.set(nDestRow, nSrcVal);
- else
- rDest.set_empty(nDestRow, nDestRow);
-}
-
std::vector<ColEntry>::iterator ScColumn::Search( SCROW nRow )
{
// Find first cell whose position is equal or greater than nRow.
@@ -111,8 +90,7 @@ std::vector<ColEntry>::const_iterator ScColumn::Search( SCROW nRow ) const
}
ScColumn::ScColumn() :
- maTextWidths(MAXROWCOUNT),
- maScriptTypes(MAXROWCOUNT),
+ maCellTextAttrs(MAXROWCOUNT),
maBroadcasters(MAXROWCOUNT),
nCol( 0 ),
pAttrArray( NULL ),
@@ -897,14 +875,11 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
maItems[nIndex1].pCell = pCell2;
maItems[nIndex2].pCell = pCell1;
- // Swap text width values.
- unsigned short nVal1 = maTextWidths.get<unsigned short>(nRow1);
- unsigned short nVal2 = maTextWidths.get<unsigned short>(nRow2);
- maTextWidths.set<unsigned short>(nRow1, nVal2);
- maTextWidths.set<unsigned short>(nRow2, nVal1);
-
- // Swap script types.
- SwapScriptTypes(maScriptTypes, nRow1, maScriptTypes, nRow2);
+ // Swap text width values and script types.
+ sc::CellTextAttr aVal1 = maCellTextAttrs.get<sc::CellTextAttr>(nRow1);
+ sc::CellTextAttr aVal2 = maCellTextAttrs.get<sc::CellTextAttr>(nRow2);
+ maCellTextAttrs.set(nRow1, aVal2);
+ maCellTextAttrs.set(nRow2, aVal1);
CellStorageModified();
}
@@ -915,8 +890,7 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
// remove ColEntry at old position
maItems.erase( maItems.begin() + nIndex1 );
- maTextWidths.set_empty(nRow1, nRow1);
- maScriptTypes.set_empty(nRow1, nRow1);
+ maCellTextAttrs.set_empty(nRow1, nRow1);
// Empty text width at the cell 1 position. For now, we don't
// transfer the old value to the cell 2 position since Insert() is
@@ -1042,14 +1016,11 @@ void ScColumn::SwapCell( SCROW nRow, ScColumn& rCol)
pFmlaCell2->UpdateReference(URM_MOVE, aRange, -dx, 0, 0);
}
- // Swap the text widths.
- unsigned short nVal1 = maTextWidths.get<unsigned short>(nRow);
- unsigned short nVal2 = rCol.maTextWidths.get<unsigned short>(nRow);
- maTextWidths.set<unsigned short>(nRow, nVal2);
- rCol.maTextWidths.set<unsigned short>(nRow, nVal1);
-
- // Swap script types.
- SwapScriptTypes(maScriptTypes, nRow, rCol.maScriptTypes, nRow);
+ // Swap text width values and script types.
+ sc::CellTextAttr aVal1 = maCellTextAttrs.get<sc::CellTextAttr>(nRow);
+ sc::CellTextAttr aVal2 = rCol.maCellTextAttrs.get<sc::CellTextAttr>(nRow);
+ maCellTextAttrs.set(nRow, aVal2);
+ rCol.maCellTextAttrs.set(nRow, aVal1);
CellStorageModified();
rCol.CellStorageModified();
@@ -1069,8 +1040,7 @@ void ScColumn::SwapCell( SCROW nRow, ScColumn& rCol)
pFmlaCell1->UpdateReference(URM_MOVE, aRange, dx, 0, 0);
}
- maTextWidths.set_empty(nRow, nRow);
- maScriptTypes.set_empty(nRow, nRow);
+ maCellTextAttrs.set_empty(nRow, nRow);
CellStorageModified();
// We don't transfer the text width to the destination column because
@@ -1206,11 +1176,8 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize )
pDocument->SetAutoCalc( bOldAutoCalc );
- maTextWidths.insert_empty(nStartRow, nSize);
- maTextWidths.resize(MAXROWCOUNT);
- maScriptTypes.insert_empty(nStartRow, nSize);
- maScriptTypes.resize(MAXROWCOUNT);
-
+ maCellTextAttrs.insert_empty(nStartRow, nSize);
+ maCellTextAttrs.resize(MAXROWCOUNT);
CellStorageModified();
}
@@ -1296,7 +1263,7 @@ void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol
if (nRow1 > nRow2)
return;
- CopyScriptTypesToDocument(nRow1, nRow2, rDestCol);
+ CopyCellTextAttrsToDocument(nRow1, nRow2, rDestCol);
// First, clear the destination column for the row range specified.
std::vector<ColEntry>::iterator it, itEnd;
@@ -1307,7 +1274,6 @@ void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol
itEnd = std::find_if(it, rDestCol.maItems.end(), FindAboveRow(nRow2));
std::for_each(it, itEnd, DeleteCell());
rDestCol.maItems.erase(it, itEnd);
- rDestCol.maTextWidths.set_empty(nRow1, nRow2);
}
// Determine the range of cells in the original column that need to be copied.
@@ -1375,12 +1341,6 @@ void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol
// destination column shouldn't have any cells within the specified range.
it = std::find_if(rDestCol.maItems.begin(), rDestCol.maItems.end(), FindAboveRow(nRow2));
rDestCol.maItems.insert(it, aCopied.begin(), aCopied.end());
-
- // Set text width values dirty for all non-empty cell positions.
- it = aCopied.begin();
- itEnd = aCopied.end();
- for (; it != itEnd; ++it)
- rDestCol.maTextWidths.set<unsigned short>(it->nRow, TEXTWIDTH_DIRTY);
}
void ScColumn::CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol )
@@ -1635,8 +1595,7 @@ void ScColumn::MarkScenarioIn( ScMarkData& rDestMark ) const
void ScColumn::SwapCol(ScColumn& rCol)
{
maItems.swap(rCol.maItems);
- maTextWidths.swap(rCol.maTextWidths);
- maScriptTypes.swap(rCol.maScriptTypes);
+ maCellTextAttrs.swap(rCol.maCellTextAttrs);
CellStorageModified();
rCol.CellStorageModified();
@@ -1693,9 +1652,7 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol)
if (nStartPos < nStopPos)
{
// At least one cell gets copied to the destination column.
- maTextWidths.set_empty(nStartRow, nEndRow);
- maScriptTypes.set_empty(nStartRow, nEndRow);
-
+ maCellTextAttrs.set_empty(nStartRow, nEndRow);
CellStorageModified();
// Create list of ranges of cell entry positions.
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 6281360f5c1b..b58191f86444 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1371,16 +1371,16 @@ void ScColumn::CellStorageModified()
#if DEBUG_COLUMN_STORAGE
if (maItems.empty())
{
- if (maTextWidths.empty())
+ if (maCellTextAttrs.empty())
{
cout << "ScColumn::CellStorageModified: Text width array is empty, but shouldn't." << endl;
cout.flush();
abort();
}
- if (maTextWidths.block_size() != 1 || maTextWidths.begin()->type != mdds::mtv::element_type_empty)
+ if (maCellTextAttrs.block_size() != 1 || maCellTextAttrs.begin()->type != mdds::mtv::element_type_empty)
{
- cout << "ScColumn::CellStorageModified: When the cell array is empty, the text with array should consist of one empty block." << endl;
+ cout << "ScColumn::CellStorageModified: When the cell array is empty, the cell text attribute array should consist of one empty block." << endl;
cout.flush();
abort();
}
@@ -1410,11 +1410,11 @@ void ScColumn::CellStorageModified()
#endif
}
-void ScColumn::CopyScriptTypesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) const
+void ScColumn::CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) const
{
- rDestCol.maScriptTypes.set_empty(nRow1, nRow2); // Empty the destination range first.
+ rDestCol.maCellTextAttrs.set_empty(nRow1, nRow2); // Empty the destination range first.
- ScriptType::const_iterator itBlk = maScriptTypes.begin(), itBlkEnd = maScriptTypes.end();
+ CTAttrStoreType::const_iterator itBlk = maCellTextAttrs.begin(), itBlkEnd = maCellTextAttrs.end();
// Locate the top row position.
size_t nOffsetInBlock = 0;
@@ -1437,7 +1437,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::uchar_element_block::const_iterator itData, itDataEnd;
+ sc::custom_celltextattr_block::const_iterator itData, itDataEnd;
for (; itBlk != itBlkEnd; ++itBlk, nBlockStart = nBlockEnd, nOffsetInBlock = 0)
{
nBlockEnd = nBlockStart + itBlk->size;
@@ -1446,30 +1446,30 @@ void ScColumn::CopyScriptTypesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDe
// Empty block.
if (nBlockStart <= nRowPos && nRowPos <= nBlockEnd)
// This block contains the end row.
- rDestCol.maScriptTypes.set_empty(nBlockStart + nOffsetInBlock, nRowPos);
+ rDestCol.maCellTextAttrs.set_empty(nBlockStart + nOffsetInBlock, nRowPos);
else
- rDestCol.maScriptTypes.set_empty(nBlockStart + nOffsetInBlock, nBlockEnd-1);
+ rDestCol.maCellTextAttrs.set_empty(nBlockStart + nOffsetInBlock, nBlockEnd-1);
continue;
}
// Non-empty block.
- itData = mdds::mtv::uchar_element_block::begin(*itBlk->data);
- itDataEnd = mdds::mtv::uchar_element_block::end(*itBlk->data);
+ itData = sc::custom_celltextattr_block::begin(*itBlk->data);
+ itDataEnd = sc::custom_celltextattr_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::uchar_element_block::begin(*itBlk->data);
+ itDataEnd = sc::custom_celltextattr_block::begin(*itBlk->data);
std::advance(itDataEnd, nOffset);
- rDestCol.maScriptTypes.set(nBlockStart + nOffsetInBlock, itData, itDataEnd);
+ rDestCol.maCellTextAttrs.set(nBlockStart + nOffsetInBlock, itData, itDataEnd);
break;
}
- rDestCol.maScriptTypes.set(nBlockStart + nOffsetInBlock, itData, itDataEnd);
+ rDestCol.maCellTextAttrs.set(nBlockStart + nOffsetInBlock, itData, itDataEnd);
}
}
@@ -1502,8 +1502,7 @@ void ScColumn::SetCell(SCROW nRow, ScBaseCell* pNewCell)
maItems[nIndex].nRow = nRow;
}
- maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
- maScriptTypes.set<unsigned char>(nRow, SC_SCRIPTTYPE_UNKNOWN);
+ maCellTextAttrs.set(nRow, sc::CellTextAttr());
CellStorageModified();
}
}
@@ -1518,22 +1517,24 @@ const SvtBroadcaster* ScColumn::GetBroadcaster(SCROW nRow) const
return maBroadcasters.get<SvtBroadcaster*>(nRow);
}
-unsigned short ScColumn::GetTextWidth(SCROW nRow) const
+sal_uInt16 ScColumn::GetTextWidth(SCROW nRow) const
{
- return maTextWidths.get<unsigned short>(nRow);
+ return maCellTextAttrs.get<sc::CellTextAttr>(nRow).mnTextWidth;
}
-void ScColumn::SetTextWidth(SCROW nRow, unsigned short nWidth)
+void ScColumn::SetTextWidth(SCROW nRow, sal_uInt16 nWidth)
{
- maTextWidths.set(nRow, nWidth);
+ sc::CellTextAttr aVal = maCellTextAttrs.get<sc::CellTextAttr>(nRow);
+ aVal.mnTextWidth = nWidth;
+ maCellTextAttrs.set(nRow, aVal);
}
sal_uInt8 ScColumn::GetScriptType( SCROW nRow ) const
{
- if (!ValidRow(nRow) || maScriptTypes.is_empty(nRow))
+ if (!ValidRow(nRow) || maCellTextAttrs.is_empty(nRow))
return 0;
- return maScriptTypes.get<unsigned char>(nRow);
+ return maCellTextAttrs.get<sc::CellTextAttr>(nRow).mnScriptType;
}
void ScColumn::SetScriptType( SCROW nRow, sal_uInt8 nType )
@@ -1542,9 +1543,20 @@ void ScColumn::SetScriptType( SCROW nRow, sal_uInt8 nType )
return;
if (!nType)
- maScriptTypes.set_empty(nRow, nRow);
+ {
+ if (maCellTextAttrs.is_empty(nRow))
+ return;
+
+ sc::CellTextAttr aVal = maCellTextAttrs.get<sc::CellTextAttr>(nRow);
+ aVal.mnScriptType = nType;
+ maCellTextAttrs.set(nRow, aVal);
+ }
else
- maScriptTypes.set<unsigned char>(nRow, nType);
+ {
+ sc::CellTextAttr aVal = maCellTextAttrs.get<sc::CellTextAttr>(nRow);
+ aVal.mnScriptType = nType;
+ maCellTextAttrs.set(nRow, aVal);
+ }
}
size_t ScColumn::GetFormulaHash( SCROW nRow ) const
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 585f9ea51b53..dc26882f6cf4 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -117,8 +117,7 @@ void ScColumn::Append( SCROW nRow, ScBaseCell* pCell )
maItems.back().pCell = pCell;
maItems.back().nRow = nRow;
- maTextWidths.set<unsigned short>(nRow, TEXTWIDTH_DIRTY);
- maScriptTypes.set<unsigned char>(nRow, SC_SCRIPTTYPE_UNKNOWN);
+ maCellTextAttrs.set<sc::CellTextAttr>(nRow, sc::CellTextAttr());
CellStorageModified();
}
@@ -131,8 +130,7 @@ void ScColumn::Delete( SCROW nRow )
ScBaseCell* pCell = maItems[nIndex].pCell;
maItems.erase(maItems.begin() + nIndex);
- maTextWidths.set_empty(nRow, nRow);
- maScriptTypes.set_empty(nRow, nRow);
+ maCellTextAttrs.set_empty(nRow, nRow);
// Should we free memory here (delta)? It'll be slower!
if (pCell->GetCellType() == CELLTYPE_FORMULA)
static_cast<ScFormulaCell*>(pCell)->EndListeningTo(pDocument);
@@ -157,8 +155,7 @@ void ScColumn::DeleteAtIndex( SCSIZE nIndex )
pDocument->Broadcast(
ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab)));
- maTextWidths.set_empty(nRow, nRow);
- maScriptTypes.set_empty(nRow, nRow);
+ maCellTextAttrs.set_empty(nRow, nRow);
CellStorageModified();
}
@@ -170,10 +167,8 @@ void ScColumn::FreeAll()
maItems.clear();
// Text width should keep a logical empty range of 0-MAXROW when the cell array is empty.
- maTextWidths.clear();
- maTextWidths.resize(MAXROWCOUNT);
- maScriptTypes.clear();
- maScriptTypes.resize(MAXROWCOUNT);
+ maCellTextAttrs.clear();
+ maCellTextAttrs.resize(MAXROWCOUNT);
CellStorageModified();
}
@@ -233,10 +228,8 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize )
// There are cells below the deletion point. Shift their row positions.
// Shift the text width array too (before the broadcast).
- maTextWidths.erase(nStartRow, nEndRow);
- maTextWidths.resize(MAXROWCOUNT);
- maScriptTypes.erase(nStartRow, nEndRow);
- maScriptTypes.resize(MAXROWCOUNT);
+ maCellTextAttrs.erase(nStartRow, nEndRow);
+ maCellTextAttrs.resize(MAXROWCOUNT);
ScAddress aAdr( nCol, 0, nTab );
ScHint aHint(SC_HINT_DATACHANGED, aAdr); // only areas (ScBaseCell* == NULL)
@@ -438,8 +431,7 @@ void ScColumn::DeleteRange(
std::advance(itEraseEnd, nEndSegment);
maItems.erase(itErase, itEraseEnd);
- maTextWidths.set_empty(nStartRow, nEndRow);
- maScriptTypes.set_empty(nStartRow, nEndRow);
+ maCellTextAttrs.set_empty(nStartRow, nEndRow);
nEndSegment = nStartSegment;
}
@@ -1336,8 +1328,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 char>(nRow, SC_SCRIPTTYPE_UNKNOWN);
+ maCellTextAttrs.set<sc::CellTextAttr>(nRow, sc::CellTextAttr());
CellStorageModified();
if ( pNewCell->GetCellType() == CELLTYPE_FORMULA )
diff --git a/sc/source/core/data/columniterator.cxx b/sc/source/core/data/columniterator.cxx
index 24b8c054d76b..3380c0a6d1b5 100644
--- a/sc/source/core/data/columniterator.cxx
+++ b/sc/source/core/data/columniterator.cxx
@@ -13,21 +13,21 @@
#include "table.hxx"
ScColumnTextWidthIterator::ScColumnTextWidthIterator(ScColumn& rCol, SCROW nStartRow, SCROW nEndRow) :
- mrTextWidths(rCol.maTextWidths),
+ mrCellTextAttrs(rCol.maCellTextAttrs),
mnEnd(static_cast<size_t>(nEndRow)),
mnCurPos(0),
- miBlockCur(mrTextWidths.begin()),
- miBlockEnd(mrTextWidths.end())
+ miBlockCur(mrCellTextAttrs.begin()),
+ miBlockEnd(mrCellTextAttrs.end())
{
init(nStartRow, nEndRow);
}
ScColumnTextWidthIterator::ScColumnTextWidthIterator(ScDocument& rDoc, const ScAddress& rStartPos, SCROW nEndRow) :
- mrTextWidths(rDoc.maTabs[rStartPos.Tab()]->aCol[rStartPos.Col()].maTextWidths),
+ mrCellTextAttrs(rDoc.maTabs[rStartPos.Tab()]->aCol[rStartPos.Col()].maCellTextAttrs),
mnEnd(static_cast<size_t>(nEndRow)),
mnCurPos(0),
- miBlockCur(mrTextWidths.begin()),
- miBlockEnd(mrTextWidths.end())
+ miBlockCur(mrCellTextAttrs.begin()),
+ miBlockEnd(mrCellTextAttrs.end())
{
init(rStartPos.Row(), nEndRow);
}
@@ -47,7 +47,7 @@ void ScColumnTextWidthIterator::next()
// Move to the next block.
for (++miBlockCur; miBlockCur != miBlockEnd; ++miBlockCur)
{
- if (miBlockCur->type != mdds::mtv::element_type_ushort)
+ if (miBlockCur->type != sc::element_type_celltextattr)
{
// We don't iterator over this block.
mnCurPos += miBlockCur->size;
@@ -77,13 +77,13 @@ SCROW ScColumnTextWidthIterator::getPos() const
sal_uInt16 ScColumnTextWidthIterator::getValue() const
{
OSL_ASSERT(miBlockCur != miBlockEnd && miDataCur != miDataEnd);
- return *miDataCur;
+ return miDataCur->mnTextWidth;
}
void ScColumnTextWidthIterator::setValue(sal_uInt16 nVal)
{
OSL_ASSERT(miBlockCur != miBlockEnd && miDataCur != miDataEnd);
- *miDataCur = nVal;
+ miDataCur->mnTextWidth = nVal;
}
void ScColumnTextWidthIterator::init(SCROW nStartRow, SCROW nEndRow)
@@ -110,7 +110,7 @@ void ScColumnTextWidthIterator::init(SCROW nStartRow, SCROW nEndRow)
return;
// Locate the initial row position within this block.
- if (miBlockCur->type == mdds::mtv::element_type_ushort)
+ if (miBlockCur->type == sc::element_type_celltextattr)
{
// This block stores text widths for non-empty cells.
size_t nOffsetInBlock = nStart - nBlockStart;
@@ -128,7 +128,7 @@ void ScColumnTextWidthIterator::init(SCROW nStartRow, SCROW nEndRow)
for (; miBlockCur != miBlockEnd; ++miBlockCur, nBlockStart = nBlockEnd)
{
nBlockEnd = nBlockStart + miBlockCur->size; // non-inclusive end point.
- if (miBlockCur->type != mdds::mtv::element_type_ushort)
+ if (miBlockCur->type != sc::element_type_celltextattr)
continue;
// Found!
@@ -145,11 +145,11 @@ void ScColumnTextWidthIterator::init(SCROW nStartRow, SCROW nEndRow)
void ScColumnTextWidthIterator::getDataIterators(size_t nOffsetInBlock)
{
OSL_ENSURE(miBlockCur != miBlockEnd, "block is at end position");
- OSL_ENSURE(miBlockCur->type == mdds::mtv::element_type_ushort,
+ OSL_ENSURE(miBlockCur->type == sc::custom_celltextattr_block,
"wrong block type - unsigned short block expected.");
- miDataCur = mdds::mtv::ushort_element_block::begin(*miBlockCur->data);
- miDataEnd = mdds::mtv::ushort_element_block::end(*miBlockCur->data);
+ miDataCur = sc::custom_celltextattr_block::begin(*miBlockCur->data);
+ miDataEnd = sc::custom_celltextattr_block::end(*miBlockCur->data);
std::advance(miDataCur, nOffsetInBlock);
}
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index bb638af52dcb..0b68fedf71c7 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -109,14 +109,10 @@ void ScDocumentImport::finalize()
// Column has no cells. Skip it.
continue;
- ScColumn::TextWidthType::iterator itWidthPos = rCol.maTextWidths.begin();
- ScColumn::ScriptType::iterator itScriptPos = rCol.maScriptTypes.begin();
+ ScColumn::CTAttrStoreType::iterator itCTAPos = rCol.maCellTextAttrs.begin();
std::vector<ColEntry>::iterator itCell = rCol.maItems.begin(), itCellEnd = rCol.maItems.end();
for (; itCell != itCellEnd; ++itCell)
- {
- itWidthPos = rCol.maTextWidths.set<unsigned short>(itWidthPos, itCell->nRow, TEXTWIDTH_DIRTY);
- itScriptPos = rCol.maScriptTypes.set<unsigned char>(itScriptPos, itCell->nRow, SC_SCRIPTTYPE_UNKNOWN);
- }
+ itCTAPos = rCol.maCellTextAttrs.set<sc::CellTextAttr>(itCTAPos, itCell->nRow, sc::CellTextAttr());
}
}
}