Related: fdo#44664 spadmin support for forcing "postscript of driver level"

pdf of 0 and ps of 0 == automatically pick pdf if pdf is default backend.
Which means that spadmin wasn't able to disable pdf if one selected
"postscript of driver leve", though picking an explicit postscript level
would work.

So we need to tweak things to use the pdf flag to be either automatic,
explicitly pdf or explicitly ps

Change-Id: Ic5382a3eb9cbcff39d363723825e75851d73520e
This commit is contained in:
Caolán McNamara
2012-11-30 14:10:07 +00:00
parent 13436397d2
commit 08597f2897
3 changed files with 29 additions and 6 deletions
+26 -4
View File
@@ -26,6 +26,8 @@
#include "osl/thread.h"
#include <officecfg/Office/Common.hxx>
#define LSCAPE_STRING String( RTL_CONSTASCII_USTRINGPARAM( "Landscape" ) )
#define PORTRAIT_STRING String( RTL_CONSTASCII_USTRINGPARAM( "Portrait" ) )
@@ -381,11 +383,25 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent ) :
case 1: m_aSpaceBox.SelectEntry( m_aSpaceColor );break;
}
sal_uLong nLevelEntryData = 0;
if( m_pParent->m_aJobData.m_nPDFDevice > 0 )
sal_uLong nLevelEntryData = 0; //automatic
if( m_pParent->m_aJobData.m_nPDFDevice == 2 ) //explicitly PDF
nLevelEntryData = 10;
else
else if (m_pParent->m_aJobData.m_nPSLevel > 0) //explicit PS Level
nLevelEntryData = m_pParent->m_aJobData.m_nPSLevel+1;
else if (m_pParent->m_aJobData.m_nPDFDevice == 1) //automatically PDF
nLevelEntryData = 0;
else if (m_pParent->m_aJobData.m_nPDFDevice == -1) //explicitly PS from driver
nLevelEntryData = 1;
bool bAutoIsPDF = officecfg::Office::Common::Print::Option::Printer::PDFAsStandardPrintJobFormat::get();
assert(nLevelEntryData != 0 || bAutoIsPDF == m_pParent->m_aJobData.m_nPDFDevice);
OUString sStr = m_aLevelBox.GetEntry(0);
m_aLevelBox.InsertEntry(sStr.replaceAll("%s", bAutoIsPDF ? m_aLevelBox.GetEntry(5) : m_aLevelBox.GetEntry(1)), 0);
m_aLevelBox.SetEntryData(0, m_aLevelBox.GetEntryData(1));
m_aLevelBox.RemoveEntry(1);
for( sal_uInt16 i = 0; i < m_aLevelBox.GetEntryCount(); i++ )
{
if( (sal_uLong)m_aLevelBox.GetEntryData( i ) == nLevelEntryData )
@@ -435,6 +451,8 @@ void RTSDevicePage::update()
sal_uLong RTSDevicePage::getLevel()
{
sal_uLong nLevel = (sal_uLong)m_aLevelBox.GetEntryData( m_aLevelBox.GetSelectEntryPos() );
if (nLevel == 0)
return 0; //automatic
return nLevel < 10 ? nLevel-1 : 0;
}
@@ -443,7 +461,11 @@ sal_uLong RTSDevicePage::getLevel()
sal_uLong RTSDevicePage::getPDFDevice()
{
sal_uLong nLevel = (sal_uLong)m_aLevelBox.GetEntryData( m_aLevelBox.GetSelectEntryPos() );
return nLevel > 9 ? 1 : 0;
if (nLevel > 9)
return 2; //explictly PDF
else if (nLevel == 0)
return 0; //automatic
return -1; //explicitly PS
}
// ------------------------------------------------------------------
+1
View File
@@ -186,6 +186,7 @@ TabPage RID_RTS_DEVICEPAGE
Size = MAP_APPFONT( 105, 200 );
StringList [en-US] =
{
< "Automatic : %s" ; 0; > ;
< "PostScript (Level from driver)" ; 1; > ;
< "PostScript Level 1" ; 2; > ;
< "PostScript Level 2"; 3; > ;
+2 -2
View File
@@ -40,9 +40,9 @@ struct VCL_DLLPUBLIC JobData
int m_nBottomMarginAdjust;
// user overrides for PPD
int m_nColorDepth;
int m_nPSLevel; // 0: no override, else languaglevel to use
int m_nPSLevel; // 0: no override, else languagelevel to use
int m_nColorDevice; // 0: no override, -1 grey scale, +1 color
int m_nPDFDevice; // 0: PostScript, 1: PDF
int m_nPDFDevice; // 0: no override, -1 PostScript, +1: Automatically PDF, +2: Explicitly PDF
orientation::type m_eOrientation;
::rtl::OUString m_aPrinterName;
const PPDParser* m_pParser;