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.grandin@collabora.co.uk>
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 2b6685b..59e4984 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));