diff options
author | Kelemen Gábor <kelemeng@ubuntu.com> | 2020-02-07 12:39:12 +0100 |
---|---|---|
committer | Katarina Behrens <bubli@bubli.org> | 2020-02-11 15:41:45 +0100 |
commit | 5c283b86cd1f57d82b8d2c4d2fa355b50bd39e3b (patch) | |
tree | 1808ae6d12b076cf53f04c879eb33d4965be3e92 /vcl | |
parent | f2f8a2ec10d87ffb23949338a9e4da1e1d704644 (diff) |
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@bubli.org>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/print3.cxx | 21 | ||||
-rw-r--r-- | vcl/source/window/printdlg.cxx | 4 |
2 files changed, 23 insertions, 2 deletions
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); } } |