From ca499d820321f938cd731a3a1616dae7180de26b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 4 Jul 2021 21:22:04 +0200 Subject: speed up exporting very large spreadsheets to pdf e.g. the one in tdf#102216 takes it from 27m16s to 6min28s Change-Id: If6cf7dd49cb43f1749da29da91dab6646d4a0626 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118382 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 8de4f0d77073a2a3850bbcdd09aa7f68c223da01) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118419 Reviewed-by: Xisco Fauli --- sc/source/ui/inc/printfun.hxx | 5 +++-- sc/source/ui/view/printfun.cxx | 16 ---------------- 2 files changed, 3 insertions(+), 18 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx index e9721837a57f..1a5eddea03cd 100644 --- a/sc/source/ui/inc/printfun.hxx +++ b/sc/source/ui/inc/printfun.hxx @@ -20,6 +20,7 @@ #pragma once #include +#include #include #include @@ -124,7 +125,7 @@ public: std::vector m_aPageEndX; std::vector m_aPageEndY; - std::vector m_aPageRows; + std::map m_aPageRows; size_t m_nPagesX; size_t m_nPagesY; @@ -166,7 +167,7 @@ struct ScPrintState // Save Variables from ScPrintFunc size_t nTotalY; std::vector aPageEndX; std::vector aPageEndY; - std::vector aPageRows; + std::map aPageRows; ScPrintState() : nPrintTab(0) diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index f099247cc2c6..77d58b12a7a2 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -2482,10 +2482,7 @@ tools::Long ScPrintFunc::CountPages() // sets also nPag CalcZoom(i); if ( aTableParam.bSkipEmpty ) for (nY=0; nY< m_aRanges.m_nPagesY; nY++) - { - OSL_ENSURE(nY < m_aRanges.m_aPageRows.size(), "vector access error for aPageRows"); nPages += m_aRanges.m_aPageRows[nY].CountVisible(); - } else nPages += static_cast(m_aRanges.m_nPagesX) * m_aRanges.m_nPagesY; if ( pPageData ) @@ -2497,10 +2494,7 @@ tools::Long ScPrintFunc::CountPages() // sets also nPag CalcZoom(RANGENO_NORANGE); // calculate Zoom if ( aTableParam.bSkipEmpty ) for (nY=0; nY(m_aRanges.m_nPagesX) * m_aRanges.m_nPagesY; if ( pPageData ) @@ -2695,7 +2689,6 @@ tools::Long ScPrintFunc::DoPrint( const MultiSelection& rPageRanges, nX2 = m_aRanges.m_aPageEndX[nCountX]; for (nCountY=0; nCountY