vcl/source/gdi/print3.cxx | 21 +++++++++++++++++++++ vcl/source/window/printdlg.cxx | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-)
New commits: commit 5c283b86cd1f57d82b8d2c4d2fa355b50bd39e3b Author: Kelemen Gábor <kelem...@ubuntu.com> AuthorDate: Fri Feb 7 12:39:12 2020 +0100 Commit: Katarina Behrens <bu...@bubli.org> CommitDate: Tue Feb 11 15:41:45 2020 +0100 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 <bu...@bubli.org> diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 7c3a1ec5056a..dc8409ecd55a 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -788,6 +788,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() ) ); @@ -795,6 +809,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 1f88e9d2140e..0564ffa1a39d 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -1918,7 +1918,7 @@ IMPL_LINK( PrintDialog, SelectHdl, weld::ComboBox&, rBox, void ) mxOKButton->set_label(maPrintText); updatePrinterText(); setPaperSizes(); - preparePreview(false); + preparePreview(true); } else // print to file { @@ -1973,7 +1973,7 @@ IMPL_LINK( PrintDialog, SelectHdl, weld::ComboBox&, rBox, void ) checkPaperSize( aPaperSize ); maPController->setPaperSizeFromUser( aPaperSize ); - preparePreview(false); + preparePreview(true); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits