Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


forgot to attach the patch.
From bae6b73a56cf4fcfffe21aa9f3f9ccce87e890cd Mon Sep 17 00:00:00 2001
From: Ivan Timofeev <timofeev.i.s@gmail.com>
Date: Fri, 13 Jan 2012 21:50:55 +0400
Subject: [PATCH] fdo#43932: try to fix paper tray settings

---
 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


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.