summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2013-12-16 21:11:14 +0100
committerChristoph Lutz <christoph.lutz_ml@cib.de>2015-05-13 09:37:51 +0200
commit238a2fa0c862f486b1713a924495d107895ecda3 (patch)
treebfd3399af331799696a9a37c75afa722d24bb080
parentcc5baa41fee257498661320e24169bb3f05391fb (diff)
Handle fixed page size printer option. feature/propose-master-cib
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
-rw-r--r--vcl/source/gdi/print3.cxx18
1 files 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<Printer>& 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();
}