Author: orw
Date: Fri Apr 19 11:41:08 2013
New Revision: 1469788

URL: http://svn.apache.org/r1469788
Log:
120529: abort print controller job, if no pages will be printed

Modified:
    openoffice/trunk/main/vcl/source/gdi/print3.cxx

Modified: openoffice/trunk/main/vcl/source/gdi/print3.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/source/gdi/print3.cxx?rev=1469788&r1=1469787&r2=1469788&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/source/gdi/print3.cxx (original)
+++ openoffice/trunk/main/vcl/source/gdi/print3.cxx Fri Apr 19 11:41:08 2013
@@ -522,17 +522,17 @@ void Printer::ImplPrintJob( const boost:
 
 bool Printer::StartJob( const rtl::OUString& i_rJobName, 
boost::shared_ptr<vcl::PrinterController>& i_pController )
 {
-       mnError = PRINTER_OK;
+    mnError = PRINTER_OK;
 
-       if ( IsDisplayPrinter() )
-               return sal_False;
+    if ( IsDisplayPrinter() )
+        return sal_False;
 
-       if ( IsJobActive() || IsPrinting() )
-               return sal_False;
+    if ( IsJobActive() || IsPrinting() )
+        return sal_False;
     
-       sal_uLong   nCopies = mnCopyCount;
-       bool    bCollateCopy = mbCollateCopy;
-       bool    bUserCopy = sal_False;
+    sal_uLong   nCopies = mnCopyCount;
+    bool    bCollateCopy = mbCollateCopy;
+    bool    bUserCopy = sal_False;
 
     if ( nCopies > 1 )
     {
@@ -656,7 +656,13 @@ bool Printer::StartJob( const rtl::OUStr
             {
                 mbJobActive             = sal_True;
                 i_pController->createProgressDialog();
-                int nPages = i_pController->getFilteredPageCount();
+                const int nPages = i_pController->getFilteredPageCount();
+                // abort job, if no pages will be printed.
+                if ( nPages == 0 )
+                {
+                    i_pController->abortJob();
+                    bAborted = true;
+                }
                 for( int nOuterIteration = 0; nOuterIteration < 
nOuterRepeatCount && ! bAborted; nOuterIteration++ )
                 {
                     for( int nPage = 0; nPage < nPages && ! bAborted; nPage++ )
@@ -733,7 +739,7 @@ bool Printer::StartJob( const rtl::OUStr
                          );
     }
     
-       return true;
+    return true;
 }
 
 PrinterController::~PrinterController()


Reply via email to