vcl/osx/salprn.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
New commits: commit 0dfecee85589abfb94d9fa0cc8129c4fdbaf696c Author: Patrick Luby <guibmac...@gmail.com> AuthorDate: Thu Jan 9 15:05:42 2025 -0500 Commit: Patrick Luby <guibomac...@gmail.com> CommitDate: Fri Jan 10 13:14:59 2025 +0100 Related: tdf#163126 fix failure to restart print job Commit 09484a1befd41681276cc9909b3228e5bf28a76e caused restarting a print job to fail when either the "Print selection only" or the "Brochure" checkboxes were changed. Also, that same commit added logic to handle empty paper names but setting the paper size would sometimes fail for standard paper names so always set the paper size if the width and height parameters are valid no matter what the paper name is. Change-Id: Ia6bcbffca1152ba0c47309d0c208686d2d1b30e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180036 Reviewed-by: Patrick Luby <guibomac...@gmail.com> Tested-by: Jenkins diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index 1c45b71eb384..9baababcc146 100644 --- a/vcl/osx/salprn.cxx +++ b/vcl/osx/salprn.cxx @@ -216,21 +216,17 @@ void AquaSalInfoPrinter::setPaperSize( tools::Long i_nWidth, tools::Long i_nHeig Orientation ePaperOrientation = Orientation::Portrait; const PaperInfo* pPaper = matchPaper( i_nWidth, i_nHeight, ePaperOrientation ); - bool bPaperSet = false; - if( pPaper ) { - // If the paper name is empty, fallback to setting the paper size - // using the specified width and height. + // Don't set the print info's paper name if it is empty const rtl::OString rPaperName( PaperInfo::toPSName( pPaper->getPaper() ) ); if( !rPaperName.isEmpty() ) { NSString* pPaperName = [CreateNSString( OStringToOUString( rPaperName, RTL_TEXTENCODING_ASCII_US ) ) autorelease]; [mpPrintInfo setPaperName: pPaperName]; - bPaperSet = true; } } - if( !bPaperSet && i_nWidth > 0 && i_nHeight > 0 ) + if( i_nWidth > 0 && i_nHeight > 0 ) { NSSize aPaperSize = { static_cast<CGFloat>(TenMuToPt(i_nWidth)), static_cast<CGFloat>(TenMuToPt(i_nHeight)) }; [mpPrintInfo setPaperSize: aPaperSize]; @@ -522,7 +518,8 @@ bool AquaSalInfoPrinter::StartJob( const OUString* i_pFileName, // When the last page has a page size change, one more loop // still needs to run so set mnCurPageRangeCount to zero. - mnCurPageRangeStart += mnCurPageRangeCount; + if( !aAccViewState.bNeedRestart ) + mnCurPageRangeStart += mnCurPageRangeCount; mnCurPageRangeCount = 0; } while( ( !bWasAborted || aAccViewState.bNeedRestart ) && mnCurPageRangeStart + mnCurPageRangeCount < nAllPages ); }