diff options
-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); } } |