vcl/inc/printdlg.hxx           |    1 +
 vcl/source/window/printdlg.cxx |   13 +++++--------
 2 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 85fb61fbbf3ee5b786e73a66ec1e1ce06500bbcc
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Sat Dec 4 21:53:45 2021 +0200
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Sat Dec 11 07:39:02 2021 +0100

    Revert "tdf#145354: Ensure displayed paper name matches displayed paper ..."
    
    It causes tdf#146045.
    
    This reverts commit 65081542d2dabdf17820d62abdc5a22d3734e52d
    
    Change-Id: Id980701b1a823c8bf7cfb57e0b32cf5d672c3bfa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126373
    Tested-by: Jenkins
    Reviewed-by: Tor Lillqvist <t...@collabora.com>
    (cherry picked from commit d2ca15952de167b6236139d53f6757a7c0d22d0a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126526
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index d2ce1670a845..21aab3667d4e 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -65,6 +65,7 @@ namespace vcl
             virtual void Resize() override;
 
             void setPreview( const GDIMetaFile&, const Size& i_rPaperSize,
+                             std::u16string_view i_rPaperName,
                              const OUString& i_rNoPageString,
                              sal_Int32 i_nDPIX, sal_Int32 i_nDPIY,
                              bool i_bGreyscale
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 12aa14628887..46cb72752bbf 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -207,6 +207,7 @@ bool PrintDialog::PrintPreviewWindow::Command( const 
CommandEvent& rEvt )
 
 void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& 
i_rNewPreview,
                                                   const Size& i_rOrigSize,
+                                                  std::u16string_view 
i_rPaperName,
                                                   const OUString& 
i_rReplacement,
                                                   sal_Int32 i_nDPIX,
                                                   sal_Int32 i_nDPIY,
@@ -234,18 +235,12 @@ void PrintDialog::PrintPreviewWindow::setPreview( const 
GDIMetaFile& i_rNewPrevi
     OUStringBuffer aBuf;
     aBuf.append( aNumText + " " );
     aBuf.appendAscii( eUnit == MapUnit::MapMM ? "mm" : "in" );
-
-    // Look up the paper name from the dimensions
-    PaperInfo aPaperInfoFromSize(i_rOrigSize.getWidth(), 
i_rOrigSize.getHeight());
-    aPaperInfoFromSize.doSloppyFit( true );
-
-    if (aPaperInfoFromSize.getPaper() != PAPER_USER)
+    if( !i_rPaperName.empty() )
     {
         aBuf.append( " (" );
-        aBuf.append( Printer::GetPaperName(aPaperInfoFromSize.getPaper()) );
+        aBuf.append( i_rPaperName );
         aBuf.append( ')' );
     }
-
     maHorzText = aBuf.makeStringAndClear();
 
     aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits );
@@ -959,6 +954,7 @@ void PrintDialog::preparePreview( bool i_bMayUseCache )
     if ( !hasPreview() )
     {
         mxPreview->setPreview( aMtf, aCurPageSize,
+                            Printer::GetPaperName( mePaper ),
                             maNoPreviewStr,
                             aPrt->GetDPIX(), aPrt->GetDPIY(),
                             aPrt->GetPrinterOptions().IsConvertToGreyscales()
@@ -994,6 +990,7 @@ void PrintDialog::preparePreview( bool i_bMayUseCache )
     }
 
     mxPreview->setPreview( aMtf, aCurPageSize,
+                                Printer::GetPaperName( mePaper ),
                                 nPages > 0 ? OUString() : maNoPageStr,
                                 aPrt->GetDPIX(), aPrt->GetDPIY(),
                                 
aPrt->GetPrinterOptions().IsConvertToGreyscales()

Reply via email to