sc/source/core/data/documen9.cxx |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

New commits:
commit 8f53eb5dc5cc7f90a2b134c5b5ad66988bcc9842
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Mar 28 13:25:10 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Apr 8 16:52:53 2024 +0200

    tdf#160399 speed up print preview
    
    takes time from 5s to 2.5s for me
    
    Change-Id: I7e62e4a47d5b2aae982273cc3ea38c5c9b04256d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165461
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit 3819e4f6f70ee60fc5c805f0d33c0062a396918c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165616
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index a9f04943c0d1..ee72637fa9da 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -440,13 +440,8 @@ bool ScDocument::IsPrintEmpty( SCCOL nStartCol, SCROW 
nStartRow,
         //  keep vertical part of aMMRect, only update horizontal position
         aMMRect = *pLastMM;
 
-        tools::Long nLeft = 0;
-        SCCOL i;
-        for (i=0; i<nStartCol; i++)
-            nLeft += GetColWidth(i,nTab);
-        tools::Long nRight = nLeft;
-        for (i=nStartCol; i<=nEndCol; i++)
-            nRight += GetColWidth(i,nTab);
+        tools::Long nLeft = GetColWidth(0, nStartCol-1, nTab);
+        tools::Long nRight = nLeft + GetColWidth(nStartCol,nEndCol, nTab);
 
         aMMRect.SetLeft(o3tl::convert(nLeft, o3tl::Length::twip, 
o3tl::Length::mm100));
         aMMRect.SetRight(o3tl::convert(nRight, o3tl::Length::twip, 
o3tl::Length::mm100));

Reply via email to