summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2013-12-16 21:11:14 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2014-10-06 10:52:42 +0200
commit1307cc546d13305cbdea0fe893ca4a90e4634f2b (patch)
treeff516f279e6976f94992f1e22515c29f434f7c00
parented3e9a4b5345f47e883e74903b8ca043c1a3492e (diff)
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. Change-Id: I10f6f5a10268c452847f032e204df8f363be99a1
-rw-r--r--vcl/source/gdi/print3.cxx21
1 files changed, 18 insertions, 3 deletions
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index e20c79e00725..7aeeddd95068 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.
@@ -779,6 +782,7 @@ void PrinterController::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter
mpImplData->maDefaultPageSize = mpImplData->mpPrinter->GetPaperSize();
mpImplData->mpPrinter->Pop();
mpImplData->mnFixedPaperBin = -1;
+ mpImplData->maFixedPageSize = Size();
}
void PrinterController::resetPrinterOptions( bool i_bFileOutput )
@@ -799,6 +803,9 @@ bool PrinterController::setupPrinter( Window* i_pParent )
// 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();
// reset paper size back to last configured size, not
// whatever happens to be the current page
@@ -815,7 +822,7 @@ bool PrinterController::setupPrinter( Window* i_pParent )
// configured to use the driver papersize
if (aNewPaperSize != mpImplData->maDefaultPageSize)
{
- mpImplData->maDefaultPageSize = aNewPaperSize;
+ mpImplData->maFixedPageSize = aNewPaperSize;
bInvalidateCache = getPapersizeFromSetup();
}
@@ -831,6 +838,11 @@ bool PrinterController::setupPrinter( Window* i_pParent )
{
mpImplData->maPageCache.invalidate();
}
+
+ if( aNewPaperSize != aPaperSize || nNewPaperBin != nPaperBin )
+ {
+ mpImplData->maPageCache.invalidate();
+ }
}
else
{
@@ -915,11 +927,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;
mpPrinter->Push();
mpPrinter->SetMapMode(MapMode(MAP_100TH_MM));
Size aCurSize(mpPrinter->GetPaperSize());
- if (aCurSize != maDefaultPageSize)
- mpPrinter->SetPaperSizeUser(maDefaultPageSize, !isFixedPageSize());
+ if (aPaperSize != aCurSize)
+ mpPrinter->SetPaperSizeUser(aPaperSize, !isFixedPageSize());
mpPrinter->Pop();
}