vcl/source/window/printdlg.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 9a8dcf797dd277079e5b58947d7281645aa0389e
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Tue Nov 9 13:37:33 2021 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Tue Nov 9 14:09:48 2021 +0100

    tdf#145354: Don't let an arbitrary paper size match any other arbitrary size
    
    Don't preselect whatever random paper size the printer driver offers
    last if the document is asking for some other random paper size.
    
    Change-Id: I57af245f28f0d61541da698844f2527be5ec004e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124911
    Tested-by: Jenkins
    Reviewed-by: Tor Lillqvist <t...@collabora.com>

diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 25f8483076c9..c7a8e50fa2c1 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -859,6 +859,7 @@ void PrintDialog::setPaperSizes()
 
     VclPtr<Printer> aPrt( maPController->getPrinter() );
     mePaper = aPrt->GetPaper();
+    Size aSizeOfPaper = aPrt->GetSizeOfPaper();
 
     if ( isPrintToFile() )
     {
@@ -897,8 +898,9 @@ void PrintDialog::setPaperSizes()
 
             mxPaperSizeBox->append_text(aPaperName);
 
-            if ( ePaper == mePaper )
-                mxPaperSizeBox->set_active( nPaper );
+            if ( (ePaper != PAPER_USER && ePaper == mePaper) ||
+                 (ePaper == PAPER_USER && aInfo.sloppyEqual( 
PaperInfo(aSizeOfPaper.getWidth(), aSizeOfPaper.getHeight())) ) )
+                 mxPaperSizeBox->set_active( nPaper );
         }
 
         mxPaperSizeBox->set_sensitive( true );

Reply via email to