vcl/osx/salprn.cxx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
New commits: commit 1c6414dde0122f2418f7948263ee1813078d40c8 Author: Patrick Luby <guibmac...@gmail.com> AuthorDate: Thu Jan 9 15:05:42 2025 -0500 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Mon Jan 13 00:35:13 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 (cherry picked from commit 0dfecee85589abfb94d9fa0cc8129c4fdbaf696c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180071 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/vcl/osx/salprn.cxx b/vcl/osx/salprn.cxx index 673d114a3663..cf26ca6c0dd4 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. - const rtl::OString &rPaperName( PaperInfo::toPSName( pPaper->getPaper() ) ); + // 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 ); }