diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/column.hxx | 4 | ||||
-rw-r--r-- | sc/inc/table.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/column.cxx | 36 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 7 |
5 files changed, 56 insertions, 1 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 44b43df863e5..717da5ef3273 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -178,8 +178,12 @@ public: const sc::CellNoteStoreType& GetCellNoteStore() const { return maCellNotes; } ScRefCellValue GetCellValue( SCROW nRow ) const; + ScRefCellValue GetCellValue( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const; ScRefCellValue GetCellValue( const sc::CellStoreType::const_iterator& itPos, size_t nOffset ) const; + const sc::CellTextAttr* GetCellTextAttr( SCROW nRow ) const; + const sc::CellTextAttr* GetCellTextAttr( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const; + void Delete( SCROW nRow ); void FreeAll(); void SwapRow( SCROW nRow1, SCROW nRow2 ); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 0544b8bbfc91..ef4340c6316c 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -384,6 +384,8 @@ public: CellType GetCellType( SCCOL nCol, SCROW nRow ) const; ScRefCellValue GetCellValue( SCCOL nCol, SCROW nRow ) const; + const sc::CellTextAttr* GetCellTextAttr( SCCOL nCol, SCROW nRow ) const; + void GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const; void GetLastDataPos(SCCOL& rCol, SCROW& rRow) const; diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 2d2c44e5e5ce..192aa5bcb4be 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -771,6 +771,16 @@ ScRefCellValue ScColumn::GetCellValue( SCROW nRow ) const return GetCellValue(aPos.first, aPos.second); } +ScRefCellValue ScColumn::GetCellValue( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const +{ + std::pair<sc::CellStoreType::const_iterator,size_t> aPos = maCells.position(rBlockPos.miCellPos, nRow); + if (aPos.first == maCells.end()) + return ScRefCellValue(); + + rBlockPos.miCellPos = aPos.first; // Store this for next call. + return GetCellValue(aPos.first, aPos.second); +} + ScRefCellValue ScColumn::GetCellValue( const sc::CellStoreType::const_iterator& itPos, size_t nOffset ) const { ScRefCellValue aVal; // Defaults to empty cell. @@ -803,6 +813,32 @@ ScRefCellValue ScColumn::GetCellValue( const sc::CellStoreType::const_iterator& return aVal; } +const sc::CellTextAttr* ScColumn::GetCellTextAttr( SCROW nRow ) const +{ + sc::CellTextAttrStoreType::const_position_type aPos = maCellTextAttrs.position(nRow); + if (aPos.first == maCellTextAttrs.end()) + return NULL; + + if (aPos.first->type != sc::element_type_celltextattr) + return NULL; + + return &sc::celltextattr_block::at(*aPos.first->data, aPos.second); +} + +const sc::CellTextAttr* ScColumn::GetCellTextAttr( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const +{ + sc::CellTextAttrStoreType::const_position_type aPos = maCellTextAttrs.position(rBlockPos.miCellTextAttrPos, nRow); + if (aPos.first == maCellTextAttrs.end()) + return NULL; + + rBlockPos.miCellTextAttrPos = aPos.first; + + if (aPos.first->type != sc::element_type_celltextattr) + return NULL; + + return &sc::celltextattr_block::at(*aPos.first->data, aPos.second); +} + namespace { ScFormulaCell* cloneFormulaCell(ScDocument* pDoc, const ScAddress& rNewPos, ScFormulaCell& rOldCell) diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index d72a43617a73..af2492ea4e11 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1596,6 +1596,14 @@ ScRefCellValue ScTable::GetCellValue( SCCOL nCol, SCROW nRow ) const return aCol[nCol].GetCellValue(nRow); } +const sc::CellTextAttr* ScTable::GetCellTextAttr( SCCOL nCol, SCROW nRow ) const +{ + if (!ValidColRow(nCol, nRow)) + return NULL; + + return aCol[nCol].GetCellTextAttr(nRow); +} + void ScTable::GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const { rCol = 0; diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index a9dcd0311c9e..4b7bde22aece 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -206,6 +206,7 @@ short Compare( const OUString &sInput1, const OUString &sInput2, struct ScSortInfo { ScRefCellValue maCell; + const sc::CellTextAttr* mpTextAttr; SCCOLROW nOrg; DECL_FIXEDMEMPOOL_NEWDEL( ScSortInfo ); }; @@ -279,10 +280,13 @@ ScSortInfoArray* ScTable::CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 ) { SCCOL nCol = static_cast<SCCOL>(aSortParam.maKeyState[nSort].nField); ScColumn* pCol = &aCol[nCol]; + sc::ColumnBlockConstPosition aBlockPos; + pCol->InitBlockPosition(aBlockPos); for ( SCROW nRow = nInd1; nRow <= nInd2; nRow++ ) { ScSortInfo* pInfo = pArray->Get( nSort, nRow ); - pInfo->maCell = pCol->GetCellValue(nRow); + pInfo->maCell = pCol->GetCellValue(aBlockPos, nRow); + pInfo->mpTextAttr = pCol->GetCellTextAttr(aBlockPos, nRow); pInfo->nOrg = nRow; } } @@ -297,6 +301,7 @@ ScSortInfoArray* ScTable::CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 ) { ScSortInfo* pInfo = pArray->Get( nSort, nCol ); pInfo->maCell = GetCellValue(nCol, nRow); + pInfo->mpTextAttr = GetCellTextAttr(nCol, nRow); pInfo->nOrg = nCol; } } |