tdf#160399 speed up print preview
shave about 2-5% off the cycles here
Change-Id: I23adffa4715d3dd28a92d48603a236115fb7d680
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165647
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 2ad14abcf790002ac6fe09afbc5a2cae46f62085)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168802
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 6985019..2d86633 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -465,6 +465,7 @@ public:
ScFormulaCell * const * GetFormulaCellBlockAddress( SCROW nRow, size_t& rBlockSize ) const;
CellType GetCellType( SCROW nRow ) const;
SCSIZE GetCellCount() const;
bool IsCellCountZero() const;
sal_uInt64 GetWeightedCount() const;
sal_uInt64 GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const;
sal_uInt64 GetCodeCount() const; // RPN-Code in formulas
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 5a1582e..787bfc32 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -3282,6 +3282,19 @@ SCSIZE ScColumn::GetCellCount() const
return aFunc.getCount();
}
bool ScColumn::IsCellCountZero() const
{
auto it = maCells.begin();
auto itEnd = maCells.end();
for (; it != itEnd; ++it)
{
const sc::CellStoreType::value_type& node = *it;
if (node.size != 0)
return false;
}
return true;
}
FormulaError ScColumn::GetErrCode( SCROW nRow ) const
{
std::pair<sc::CellStoreType::const_iterator,size_t> aPos = maCells.position(nRow);
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 4df5d92..968a630 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -2097,7 +2097,7 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev,
{
if ( j >= aCol.size() )
break;
if (aCol[j].GetCellCount() == 0) // empty
if (aCol[j].IsCellCountZero()) // empty
nEmptyCount++;
}
if (nEmptyCount)