summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-11-30 14:04:12 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-11-30 14:10:07 +0000
commit08597f2897e5ac752147c8f2c4a91bb557ed4580 (patch)
tree6683adaa350a63f8608fdde7137ab74f8974005a
parent13436397d2494505d68d8dacc98d2c49ba4f3b36 (diff)
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
-rw-r--r--padmin/source/prtsetup.cxx30
-rw-r--r--padmin/source/rtsetup.src1
-rw-r--r--vcl/inc/vcl/jobdata.hxx4
3 files changed, 29 insertions, 6 deletions
diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx
index 936322baa421..3862cde35605 100644
--- a/padmin/source/prtsetup.cxx
+++ b/padmin/source/prtsetup.cxx
@@ -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
}
// ------------------------------------------------------------------
diff --git a/padmin/source/rtsetup.src b/padmin/source/rtsetup.src
index 0e5e1d3cdfe7..b75a1a32b905 100644
--- a/padmin/source/rtsetup.src
+++ b/padmin/source/rtsetup.src
@@ -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; > ;
diff --git a/vcl/inc/vcl/jobdata.hxx b/vcl/inc/vcl/jobdata.hxx
index 5485e018ec15..577e0fadb6a7 100644
--- a/vcl/inc/vcl/jobdata.hxx
+++ b/vcl/inc/vcl/jobdata.hxx
@@ -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;