Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates-src > by-pkgid > cd8ce32c919af60229fca1d7f792c60e > files > 118

openoffice.org-3.2.0-12.35.fc13.src.rpm

--- vcl/inc/vcl/printerjob.hxx
+++ vcl/inc/vcl/printerjob.hxx
@@ -99,7 +99,7 @@ private:            // private methods
 
     bool			writeFeatureList( osl::File* pFile, const JobData&, bool bDocumentSetup );
     bool            writeSetup( osl::File* pFile, const JobData& );
-    bool            writePageSetup( osl::File* pFile, const JobData& );
+    bool            writePageSetup( osl::File* pFile, const JobData&, bool bWriteFeatures = true );
     void			writeJobPatch( osl::File* File, const JobData& );
     bool            writeProlog (osl::File* pFile, const JobData& );
 
--- vcl/unx/source/printergfx/printerjob.cxx
+++ vcl/unx/source/printergfx/printerjob.cxx
@@ -1047,14 +1047,6 @@ PrinterJob::StartPage (const JobData& rJ
     if( ! (pPageHeader && pPageBody) )
         return sal_False;
 
-    /* #i7262# write setup only before first page
-     *  don't do this in StartJob since the jobsetup there may be
-     *  different.
-     */ 
-    bool bSuccess =  true;
-    if( 1 == maPageList.size() )
-        m_aDocumentJobData = rJobSetup;
-
     // write page header according to Document Structuring Conventions (DSC)
     WritePS (pPageHeader, "%%Page: ");
     WritePS (pPageHeader, aPageNo); 
@@ -1077,13 +1069,25 @@ PrinterJob::StartPage (const JobData& rJ
 
     WritePS (pPageHeader, pBBox);
 
-    if (bSuccess)
-        bSuccess = writePageSetup ( pPageHeader, rJobSetup );
-    if(bSuccess)
-        m_aLastJobData = rJobSetup;
+    /* #i7262# #i65491# write setup only before first page
+     *  (to %%Begin(End)Setup, instead of %%Begin(End)PageSetup)
+     *  don't do this in StartJob since the jobsetup there may be
+     *  different.
+     */ 
+    bool bWriteFeatures = true;
+    if( 1 == maPageList.size() )
+    {
+        m_aDocumentJobData = rJobSetup;
+        bWriteFeatures = false;
+    }
 
+    if ( writePageSetup( pPageHeader, rJobSetup, bWriteFeatures ) )
+    {
+        m_aLastJobData = rJobSetup;
+        return true;
+    }
         
-    return bSuccess;
+    return false;
 }
 
 sal_Bool
@@ -1174,12 +1178,9 @@ bool PrinterJob::writeFeatureList( osl::
                 if( pKey->getSetupType()    == PPDKey::DocumentSetup )
                     bEmit = true;
             }
-            else
-            {
-                if( pKey->getSetupType()    == PPDKey::PageSetup        ||
-                    pKey->getSetupType()    == PPDKey::AnySetup )
-                    bEmit = true;
-            }
+            if( pKey->getSetupType()    == PPDKey::PageSetup        ||
+                pKey->getSetupType()    == PPDKey::AnySetup )
+                bEmit = true;
             if( bEmit )
             {
                 const PPDValue* pValue = rJob.m_aContext.getValue( pKey );
@@ -1213,13 +1214,13 @@ bool PrinterJob::writeFeatureList( osl::
     return bSuccess;
 }
 
-bool PrinterJob::writePageSetup( osl::File* pFile, const JobData& rJob )
+bool PrinterJob::writePageSetup( osl::File* pFile, const JobData& rJob, bool bWriteFeatures )
 {
     bool bSuccess = true;
 
     WritePS (pFile, "%%BeginPageSetup\n%\n");
-
-    bSuccess = writeFeatureList( pFile, rJob, false );
+    if ( bWriteFeatures )
+        bSuccess = writeFeatureList( pFile, rJob, false );
     WritePS (pFile, "%%EndPageSetup\n");
 
     sal_Char  pTranslate [128];