diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-11-30 14:04:12 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-11-30 14:10:07 +0000 |
commit | 08597f2897e5ac752147c8f2c4a91bb557ed4580 (patch) | |
tree | 6683adaa350a63f8608fdde7137ab74f8974005a /padmin | |
parent | 13436397d2494505d68d8dacc98d2c49ba4f3b36 (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
Diffstat (limited to 'padmin')
-rw-r--r-- | padmin/source/prtsetup.cxx | 30 | ||||
-rw-r--r-- | padmin/source/rtsetup.src | 1 |
2 files changed, 27 insertions, 4 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; > ; |