sc/inc/pagepar.hxx | 1 + sc/source/core/data/pagepar.cxx | 2 +- sc/source/ui/view/printfun.cxx | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-)
New commits: commit a37092075791ccbe6081e3e01990df6d9e6cdce6 Author: Eilidh McAdam <[email protected]> Date: Sat Nov 2 21:05:12 2013 +0000 Fix for Calc page scaling - see #i54993# If a print range's manual breaks forced it over more pages than specified by the sheet scale settings, the zoom calculation wasn't able to converge on a zoom level, so it bottomed out at ZOOM_MIN. This issue only appears if the Calc/Print/Page/ForceBreaks option is selected and simply ensures the minimum number of pages is at least the number required by the breaks in the sheet. Change-Id: Iba36e850081718b1aa43e5c3db3c883530885853 Reviewed-on: https://gerrit.libreoffice.org/6532 Reviewed-by: Eike Rathke <[email protected]> Tested-by: Eike Rathke <[email protected]> diff --git a/sc/inc/pagepar.hxx b/sc/inc/pagepar.hxx index a898d5a..581d08a 100644 --- a/sc/inc/pagepar.hxx +++ b/sc/inc/pagepar.hxx @@ -41,6 +41,7 @@ struct ScPageTableParam sal_Bool bScaleAll; sal_Bool bScaleTo; sal_Bool bScalePageNum; + sal_Bool bForceBreaks; sal_uInt16 nScaleAll; sal_uInt16 nScaleWidth; sal_uInt16 nScaleHeight; diff --git a/sc/source/core/data/pagepar.cxx b/sc/source/core/data/pagepar.cxx index 7cce7c7..cf4ef92 100644 --- a/sc/source/core/data/pagepar.cxx +++ b/sc/source/core/data/pagepar.cxx @@ -43,7 +43,7 @@ void ScPageTableParam::Reset() bCellContent = sal_True; bNotes=bGrid=bHeaders=bDrawings= bLeftRight=bScaleAll=bScaleTo=bScalePageNum= - bFormulas=bNullVals=bSkipEmpty = false; + bFormulas=bNullVals=bSkipEmpty=bForceBreaks = false; bTopDown=bScaleNone=bCharts=bObjects = sal_True; nScaleAll = 100; nScalePageNum = nScaleWidth = nScaleHeight = 0; diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 6584bb8..6ab7d1e 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -924,6 +924,8 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions ) // If pPageData is set, only the breaks are interesting for the // pagebreak preview, empty pages are not addressed separately. + aTableParam.bForceBreaks = pOptions && pOptions->GetForceBreaks(); + //------------------------------------------------------ // TabPage "Parts": //------------------------------------------------------ @@ -2751,6 +2753,21 @@ void ScPrintFunc::CalcZoom( sal_uInt16 nRangeNo ) // calcu nZoom = 100; sal_uInt16 nPagesToFit = aTableParam.nScalePageNum; + // If manual breaks are forced, calculate minimum # pages required + if (aTableParam.bForceBreaks) + { + sal_uInt16 nMinPages = 0; + std::set<SCROW> aRowBreaks; + std::set<SCCOL> aColBreaks; + pDoc->GetAllRowBreaks(aRowBreaks, nPrintTab, false, true); + pDoc->GetAllColBreaks(aColBreaks, nPrintTab, false, true); + nMinPages = (aRowBreaks.size() + 1) * (aColBreaks.size() + 1); + + // #i54993# use min forced by breaks if it's > # pages in + // scale parameter to avoid bottoming out at <= ZOOM_MIN + nPagesToFit = nMinPages > nPagesToFit ? nMinPages : nPagesToFit; + } + sal_uInt16 nLastFitZoom = 0, nLastNonFitZoom = 0; while (true) { @@ -2793,6 +2810,23 @@ void ScPrintFunc::CalcZoom( sal_uInt16 nRangeNo ) // calcu sal_uInt16 nW = aTableParam.nScaleWidth; sal_uInt16 nH = aTableParam.nScaleHeight; + // If manual breaks are forced, calculate minimum # pages required + if (aTableParam.bForceBreaks) + { + sal_uInt16 nMinPagesW = 0, nMinPagesH = 0; + std::set<SCROW> aRowBreaks; + std::set<SCCOL> aColBreaks; + pDoc->GetAllRowBreaks(aRowBreaks, nPrintTab, false, true); + pDoc->GetAllColBreaks(aColBreaks, nPrintTab, false, true); + nMinPagesW = aColBreaks.size() + 1; + nMinPagesH = aRowBreaks.size() + 1; + + // #i54993# use min forced by breaks if it's > # pages in + // scale parameters to avoid bottoming out at <= ZOOM_MIN + nW = nMinPagesW > nW ? nMinPagesW : nW; + nH = nMinPagesH > nH ? nMinPagesH : nH; + } + sal_uInt16 nLastFitZoom = 0, nLastNonFitZoom = 0; while (true) { _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
