sc/inc/column.hxx               |    1 +
 sc/source/core/data/column3.cxx |   13 +++++++++++++
 sc/source/core/data/table1.cxx  |    2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit f54144639568e51fb6f95e62966f664f35b90c7e
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Apr 1 18:48:04 2024 +0200
Commit:     Ilmari Lauhakangas <[email protected]>
CommitDate: Fri Jun 14 10:00:15 2024 +0200

    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 <[email protected]>
    (cherry picked from commit 2ad14abcf790002ac6fe09afbc5a2cae46f62085)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168802
    Reviewed-by: Ilmari Lauhakangas <[email protected]>

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 69850197bdaa..2d8663318afa 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 5a1582e560d7..787bfc3216d6 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 4df5d92ec5e5..968a63026bcf 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)

Reply via email to