[PATCH] fdo#43932: try to fix paper tray settings
Ivan Timofeev
timofeev.i.s at gmail.com
Fri Jan 13 09:50:55 PST 2012
---
vcl/source/gdi/print3.cxx | 25 ++++++++++---------------
1 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index d85321b..3dbee8b 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -172,8 +172,7 @@ public:
// set by user through printer config dialog
// if set, pages are centered and trimmed onto the fixed page
Size maFixedPageSize;
- sal_Int32 mnDefaultPaperBin;
- sal_Int32 mnFixedPaperBin;
+ sal_Int32 mnPaperBin;
ImplPrinterControllerData() :
mbFirstPage( sal_True ),
@@ -181,8 +180,7 @@ public:
mbReversePageOrder( sal_False ),
meJobState( view::PrintableState_JOB_STARTED ),
mpProgress( NULL ),
- mnDefaultPaperBin( -1 ),
- mnFixedPaperBin( -1 )
+ mnPaperBin( -1 )
{}
~ImplPrinterControllerData() { delete mpProgress; }
@@ -723,8 +721,7 @@ void PrinterController::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter
mpImplData->mpPrinter = i_rPrinter;
setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ),
makeAny( rtl::OUString( i_rPrinter->GetName() ) ) );
- mpImplData->mnDefaultPaperBin = mpImplData->mpPrinter->GetPaperBin();
- mpImplData->mnFixedPaperBin = -1;
+ mpImplData->mnPaperBin = mpImplData->mpPrinter->GetPaperBin();
}
void PrinterController:: resetPrinterOptions( bool i_bFileOutput )
@@ -742,8 +739,9 @@ bool PrinterController::setupPrinter( Window* i_pParent )
// get old data
Size aPaperSize( mpImplData->mpPrinter->PixelToLogic(
mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
- sal_uInt16 nPaperBin = mpImplData->mpPrinter->GetPaperBin();
+ // reset paper bin to the value that was set during the last setup call
+ mpImplData->mpPrinter->SetPaperBin(mpImplData->mnPaperBin);
// call driver setup
bRet = mpImplData->mpPrinter->Setup( i_pParent );
if( bRet )
@@ -752,7 +750,7 @@ bool PrinterController::setupPrinter( Window* i_pParent )
Size aNewPaperSize( mpImplData->mpPrinter->PixelToLogic(
mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
sal_uInt16 nNewPaperBin = mpImplData->mpPrinter->GetPaperBin();
- if( aNewPaperSize != aPaperSize || nNewPaperBin != nPaperBin )
+ if( aNewPaperSize != aPaperSize || nNewPaperBin != mpImplData->mnPaperBin )
{
mpImplData->maFixedPageSize = aNewPaperSize;
mpImplData->maPageCache.invalidate();
@@ -761,7 +759,7 @@ bool PrinterController::setupPrinter( Window* i_pParent )
aOverrideSize.Height = aNewPaperSize.Height();
setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OverridePageSize" ) ),
makeAny( aOverrideSize ) );
- mpImplData->mnFixedPaperBin = nNewPaperBin;
+ mpImplData->mnPaperBin = nNewPaperBin;
}
}
}
@@ -773,7 +771,7 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons
PrinterController::PageSize aPageSize;
aPageSize.aSize = mpPrinter->GetPaperSize();
awt::Size aSetSize, aIsSize;
- sal_Int32 nPaperBin = mnDefaultPaperBin;
+ sal_Int32 nPaperBin = mnPaperBin;
for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); nProperty < nPropertyCount; ++nProperty )
{
if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PreferredPageSize" ) ) )
@@ -1180,11 +1178,6 @@ void PrinterController::printFilteredPage( int i_nPage )
mpImplData->mpPrinter->SetMapMode( MAP_100TH_MM );
// aPageSize was filtered through mpImplData->getRealPaperSize already by getFilteredPageFile()
mpImplData->mpPrinter->SetPaperSizeUser( aPageSize.aSize, ! mpImplData->isFixedPageSize() );
- if( mpImplData->mnFixedPaperBin != -1 &&
- mpImplData->mpPrinter->GetPaperBin() != mpImplData->mnFixedPaperBin )
- {
- mpImplData->mpPrinter->SetPaperBin( mpImplData->mnFixedPaperBin );
- }
// if full paper is meant to be used, move the output to accomodate for pageoffset
if( aPageSize.bFullPaper )
@@ -1199,6 +1192,7 @@ void PrinterController::printFilteredPage( int i_nPage )
mpImplData->mpPrinter->EnableOutput( sal_True );
+ printf("page %d, bin %d\n", i_nPage, mpImplData->mpPrinter->GetPaperBin());
// actually print the page
mpImplData->mpPrinter->ImplStartPage();
@@ -1209,6 +1203,7 @@ void PrinterController::printFilteredPage( int i_nPage )
mpImplData->mpPrinter->ImplEndPage();
+ mpImplData->mpPrinter->SetPaperBin(mpImplData->mnPaperBin);
mpImplData->mpPrinter->SetDrawMode( nRestoreDrawMode );
}
--
1.7.8.3
--------------070202060309070000060402--
More information about the LibreOffice
mailing list