simplify CreateColumnIfNotExists
if "if (aOldColSize==0)" check can never be hit since we pre-allocate these columns to some size. Also move the cold part of the function out-of-line, doesn't seem useful to have all of it in a header Change-Id: If8675ca17d70ee55dde8418ff75e2ddb3c931c58 Reviewed-on: https://gerrit.libreoffice.org/68506 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -276,18 +276,11 @@ public:
|
|||||||
ScColumn& CreateColumnIfNotExists( const SCCOL nScCol )
|
ScColumn& CreateColumnIfNotExists( const SCCOL nScCol )
|
||||||
{
|
{
|
||||||
if ( nScCol >= aCol.size() )
|
if ( nScCol >= aCol.size() )
|
||||||
{
|
CreateColumnIfNotExistsImpl(nScCol);
|
||||||
const SCCOL aOldColSize = aCol.size();
|
|
||||||
bool bUseEmptyAttrArray = false;
|
|
||||||
if ( aOldColSize == 0 )
|
|
||||||
bUseEmptyAttrArray = true;
|
|
||||||
aCol.resize( static_cast< size_t >( nScCol + 1 ) );
|
|
||||||
for (SCCOL i = aOldColSize; i <= nScCol; i++)
|
|
||||||
aCol[i].Init( i, nTab, pDocument, bUseEmptyAttrArray );
|
|
||||||
|
|
||||||
}
|
|
||||||
return aCol[nScCol];
|
return aCol[nScCol];
|
||||||
}
|
}
|
||||||
|
// out-of-line the cold part of the function
|
||||||
|
void CreateColumnIfNotExistsImpl( const SCCOL nScCol );
|
||||||
sal_uLong GetCellCount() const;
|
sal_uLong GetCellCount() const;
|
||||||
sal_uLong GetWeightedCount() const;
|
sal_uLong GetWeightedCount() const;
|
||||||
sal_uLong GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const;
|
sal_uLong GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const;
|
||||||
|
@@ -2533,4 +2533,12 @@ ScColumnsRange ScTable::GetColumnsRange(SCCOL nColBegin, SCCOL nColEnd) const
|
|||||||
ScColumnsRange::Iterator( aCol.begin() + nEffEnd));
|
ScColumnsRange::Iterator( aCol.begin() + nEffEnd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// out-of-line the cold part of the CreateColumnIfNotExists function
|
||||||
|
void ScTable::CreateColumnIfNotExistsImpl( const SCCOL nScCol )
|
||||||
|
{
|
||||||
|
const SCCOL aOldColSize = aCol.size();
|
||||||
|
aCol.resize( static_cast< size_t >( nScCol + 1 ) );
|
||||||
|
for (SCCOL i = aOldColSize; i <= nScCol; i++)
|
||||||
|
aCol[i].Init( i, nTab, pDocument, false );
|
||||||
|
}
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
Reference in New Issue
Block a user