From 71ebe4404b6e7c78a7d2e352f6af88d57209680a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 20 May 2013 10:11:46 +0100 Subject: Related: fdo#61186 always operate on printer settings paper format scenario 2: with attached test document a file->printer settings->properties->paper set a paper size, ideally something not used in the test doc, e.g. Executive b file->print->properties the paper size here should now still be what was selected in a and *not* what happened to be the current page format shown in the preview which is legal Change-Id: Ie2f440621201d309eb20a650122f9ff7bff441da --- vcl/source/gdi/print3.cxx | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'vcl') diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index f230214e8e76..cea6bc379a25 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -781,26 +781,46 @@ bool PrinterController::setupPrinter( Window* i_pParent ) bool bRet = false; if( mpImplData->mpPrinter.get() ) { - // get old data - Size aPaperSize( mpImplData->mpPrinter->PixelToLogic( - mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); + mpImplData->mpPrinter->Push(); + mpImplData->mpPrinter->SetMapMode(MapMode(MAP_100TH_MM)); + + // get current data + Size aPaperSize(mpImplData->mpPrinter->GetPaperSize()); sal_uInt16 nPaperBin = mpImplData->mpPrinter->GetPaperBin(); + // reset paper size back to last configured size, not + // whatever happens to be the current page + resetPaperToLastConfigured(); + // call driver setup bRet = mpImplData->mpPrinter->Setup( i_pParent ); - if( bRet ) + Size aNewPaperSize(mpImplData->mpPrinter->GetPaperSize()); + if (bRet) { - // was papersize or bin overridden ? if so we need to take action - Size aNewPaperSize( mpImplData->mpPrinter->PixelToLogic( - mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); + // was papersize or bin overridden ? if so we need to take action + if( aNewPaperSize != aPaperSize ) + { + mpImplData->maFixedPageSize = aNewPaperSize; + } + sal_uInt16 nNewPaperBin = mpImplData->mpPrinter->GetPaperBin(); + if( nNewPaperBin != nPaperBin ) + { + mpImplData->mnFixedPaperBin = nNewPaperBin; + } + if( aNewPaperSize != aPaperSize || nNewPaperBin != nPaperBin ) { - mpImplData->maFixedPageSize = aNewPaperSize; mpImplData->maPageCache.invalidate(); - mpImplData->mnFixedPaperBin = nNewPaperBin; } } + else + { + //restore to whatever it was before we entered this method + if (aPaperSize != aNewPaperSize) + mpImplData->mpPrinter->SetPaperSizeUser(aPaperSize, !mpImplData->isFixedPageSize()); + } + mpImplData->mpPrinter->Pop(); } return bRet; } -- cgit