From 238a2fa0c862f486b1713a924495d107895ecda3 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Mon, 16 Dec 2013 21:11:14 +0100 Subject: Handle fixed page size printer option. Correctly handle the printer option "fixed page size". If set, pages are centered and trimmed onto the fixed page, regardless of the page size option. (cherry picked from commit b002226b5c9a970960de39be535e97e861860866) Conflicts: vcl/source/gdi/print3.cxx Change-Id: I10f6f5a10268c452847f032e204df8f363be99a1 --- vcl/source/gdi/print3.cxx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index b8ed8d5afb9d..047ddc8091c3 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -162,6 +162,9 @@ public: // set by user through printer properties subdialog of printer settings dialog Size maDefaultPageSize; + // set by user through printer properties subdialog of print dialog. + // if set, pages are centered and trimmed onto the fixed page + Size maFixedPageSize; // set by user through printer properties subdialog of printer settings dialog sal_Int32 mnDefaultPaperBin; // Set by user through printer properties subdialog of print dialog. @@ -792,6 +795,7 @@ void PrinterController::setPrinter( const VclPtr& i_rPrinter ) mpImplData->maDefaultPageSize = mpImplData->mxPrinter->GetPaperSize(); mpImplData->mxPrinter->Pop(); mpImplData->mnFixedPaperBin = -1; + mpImplData->maFixedPageSize = Size(); } void PrinterController::resetPrinterOptions( bool i_bFileOutput ) @@ -828,7 +832,7 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent ) // configured to use the driver papersize if (aNewPaperSize != mpImplData->maDefaultPageSize) { - mpImplData->maDefaultPageSize = aNewPaperSize; + mpImplData->maFixedPageSize = aNewPaperSize; bInvalidateCache = getPapersizeFromSetup(); } @@ -844,6 +848,11 @@ bool PrinterController::setupPrinter( vcl::Window* i_pParent ) { mpImplData->maPageCache.invalidate(); } + + if( aNewPaperSize != aPaperSize || nNewPaperBin != nPaperBin ) + { + mpImplData->maPageCache.invalidate(); + } } else { @@ -928,11 +937,14 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons //print dialog void vcl::ImplPrinterControllerData::resetPaperToLastConfigured() { + Size aPaperSize(maDefaultPageSize); + if (maFixedPageSize.Width() > 0 && maFixedPageSize.Height() > 0) + aPaperSize = maFixedPageSize; mxPrinter->Push(); mxPrinter->SetMapMode(MapMode(MAP_100TH_MM)); Size aCurSize(mxPrinter->GetPaperSize()); - if (aCurSize != maDefaultPageSize) - mxPrinter->SetPaperSizeUser(maDefaultPageSize, !isFixedPageSize()); + if (aPaperSize != aCurSize) + mxPrinter->SetPaperSizeUser(aPaperSize, !isFixedPageSize()); mxPrinter->Pop(); } -- cgit