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

New commits:
commit 5f8b834eef1565a0523aabd6dd8af5f1b0fd4c75
Author:     Tor Lillqvist <[email protected]>
AuthorDate: Wed Nov 3 14:58:45 2021 +0200
Commit:     Tor Lillqvist <[email protected]>
CommitDate: Wed Nov 3 16:30:58 2021 +0100

    tdf#145354: Don't claim random paper sizes from the system are "User 
Defined"
    
    For instance, the driver for my printer (or maybe Windows itself, no
    idea where the list of sizes comes from originally) says it supports
    215 x 345 mm. Which apparently is an obscure paper size called "India
    Legal". It is confusing if the Print dialog claims that it is "User
    Defined" when I have never even heard of such a size, and the document
    does not specify it either.
    
    Change-Id: I44196fd21fd83a94d255ebb909e5d63e35c5d1e8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124649
    Reviewed-by: Tor Lillqvist <[email protected]>
    Tested-by: Tor Lillqvist <[email protected]>

diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index bf4fdf1519eb..25f8483076c9 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -886,7 +886,14 @@ void PrintDialog::setPaperSizes()
             OUString aWidth( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits 
) );
             OUString aHeight( rLocWrap.getNum( aLogicPaperSize.Height(), 
nDigits ) );
             OUString aUnit = eUnit == MapUnit::MapMM ? OUString("mm") : 
OUString("in");
-            OUString aPaperName = Printer::GetPaperName( ePaper ) + " " + 
aWidth + aUnit + " x " + aHeight + aUnit;
+            OUString aPaperName;
+
+            // Paper sizes that we don't know of but the system printer driver 
lists are not "User
+            // Defined". Displaying them as such is just confusing.
+            if (ePaper != PAPER_USER)
+                aPaperName = Printer::GetPaperName( ePaper ) + " ";
+
+            aPaperName += aWidth + aUnit + " x " + aHeight + aUnit;
 
             mxPaperSizeBox->append_text(aPaperName);
 

Reply via email to