summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/gridwin4.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-01-06 10:31:50 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-01-07 16:50:58 +0100
commit8728eddf938c9c843ab72929cfd3947735ca8da2 (patch)
tree6211fcc978953515cc4bfc51f132c8b7d461f958 /sc/source/ui/view/gridwin4.cxx
parenta1c678bbb2d6b981b4c9ae346dba85d414c11c47 (diff)
tdf#129552 sc: avoid infinite invalidation loop when the print range is empty
Commit caeb7b141280a65e60525f11a7e6514b76e12e11 (tdf#124983 In calc make printable page borders also initially visible, 2019-07-10) added the ability to paint page breaks right after opening a document. The implementation calls ScPrintFunc::UpdatePages() whenever there are no calculated page breaks. The problem is that this is not only true when they are not calculated, but also happens when the print range is empty. This means that ScGridWindow::Paint() resulted in a vcl::Window::Invalidate() for the same window, and this happened again and again as the idle handler was invoked, resulting in flickering form controls. Fix the problem by only calculating page breaks when ScPrintFunc::HasPrintRange() confirms something will be calculated. This works because HasPrintRange() return false when ScTable::aPrintRanges is empty, and UpdatePages() also does nothing in that case. (cherry picked from commit e7e01efc56f7061d0a2e5142b4bae84dd403cc50) Change-Id: I14d8a728f4672e647e9009a3dc3e0dd5fb40c023 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86274 Tested-by: Jenkins Tested-by: Xisco Faulí <xiscofauli@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/view/gridwin4.cxx')
-rw-r--r--sc/source/ui/view/gridwin4.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 823fa87d7d4e..72926fd372a1 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -575,7 +575,12 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
{
ScDocShell* pDocSh = pViewData->GetDocShell();
ScPrintFunc aPrintFunc(pDocSh, pDocSh->GetPrinter(), nTab);
- aPrintFunc.UpdatePages();
+ if (aPrintFunc.HasPrintRange())
+ {
+ // We have a non-empty print range, so we can assume that calling UpdatePages() will
+ // result in non-empty col/row breaks next time we get here.
+ aPrintFunc.UpdatePages();
+ }
}
}