[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - vcl/source

Kelemen Gábor (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 11 12:22:29 UTC 2020


 vcl/source/gdi/print3.cxx      |   21 +++++++++++++++++++++
 vcl/source/window/printdlg.cxx |    4 ++--
 2 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit e70069d370bedcb09b515842e4c80f58b27f4454
Author:     Kelemen Gábor <kelemeng at ubuntu.com>
AuthorDate: Fri Feb 7 12:39:12 2020 +0100
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Thu Jun 11 14:21:56 2020 +0200

    tdf#126744 Transfer paper size and orientation to new printer
    
    when selected from the Printer dropdown list
    
    Change-Id: Iedd53575c2e9146b663cf21b42b495473abe5165
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88373
    Tested-by: Jenkins
    Reviewed-by: Katarina Behrens <bubli at bubli.org>
    (cherry picked from commit 5c283b86cd1f57d82b8d2c4d2fa355b50bd39e3b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96130
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 50b20930cf19..29a084011ce3 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -780,6 +780,20 @@ weld::Window* PrinterController::getWindow() const
 
 void PrinterController::setPrinter( const VclPtr<Printer>& i_rPrinter )
 {
+    VclPtr<Printer> xPrinter = mpImplData->mxPrinter;
+
+    Size aPaperSize;          // Save current paper size
+    Orientation eOrientation = Orientation::Portrait; // Save current paper orientation
+    bool bSavedSizeOrientation = false;
+
+    // #tdf 126744 Transfer paper size and orientation settings to newly selected printer
+    if ( xPrinter.get() )
+    {
+        aPaperSize = xPrinter->GetPaperSize();
+        eOrientation = xPrinter->GetOrientation();
+        bSavedSizeOrientation = true;
+    }
+
     mpImplData->mxPrinter = i_rPrinter;
     setValue( "Name",
               css::uno::makeAny( i_rPrinter->GetName() ) );
@@ -787,6 +801,13 @@ void PrinterController::setPrinter( const VclPtr<Printer>& i_rPrinter )
     mpImplData->mxPrinter->Push();
     mpImplData->mxPrinter->SetMapMode(MapMode(MapUnit::Map100thMM));
     mpImplData->maDefaultPageSize = mpImplData->mxPrinter->GetPaperSize();
+
+    if ( bSavedSizeOrientation )
+    {
+          mpImplData->mxPrinter->SetPaperSizeUser(aPaperSize, !mpImplData->isFixedPageSize());
+          mpImplData->mxPrinter->SetOrientation(eOrientation);
+    }
+
     mpImplData->mbPapersizeFromUser = false;
     mpImplData->mxPrinter->Pop();
     mpImplData->mnFixedPaperBin = -1;
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 7d340559806a..d96ad8f3997e 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -1909,7 +1909,7 @@ IMPL_LINK( PrintDialog, SelectHdl, weld::ComboBox&, rBox, void )
             mxOKButton->set_label(maPrintText);
             updatePrinterText();
             setPaperSizes();
-            preparePreview(false);
+            preparePreview(true);
         }
         else // print to file
         {
@@ -1964,7 +1964,7 @@ IMPL_LINK( PrintDialog, SelectHdl, weld::ComboBox&, rBox, void )
         checkPaperSize( aPaperSize );
         maPController->setPaperSizeFromUser( aPaperSize );
 
-        preparePreview(false);
+        preparePreview(true);
     }
 }
 


More information about the Libreoffice-commits mailing list