tdf#156230: Drop PDFDevice handling
Change-Id: I53759eb6025a4fc7e1319d0d1e7b3072edde93c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154975
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
diff --git a/vcl/inc/jobdata.hxx b/vcl/inc/jobdata.hxx
index 7b8f4a4..ceb7a8b 100644
--- a/vcl/inc/jobdata.hxx
+++ b/vcl/inc/jobdata.hxx
@@ -41,7 +41,6 @@ struct VCL_DLLPUBLIC JobData
int m_nColorDepth;
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: no override, -1 PostScript, +1: Automatically PDF, +2: Explicitly PDF
orientation m_eOrientation;
OUString m_aPrinterName;
bool m_bPapersizeFromSetup;
@@ -58,7 +57,6 @@ struct VCL_DLLPUBLIC JobData
m_nColorDepth( 24 ),
m_nPSLevel( 0 ),
m_nColorDevice( 0 ),
m_nPDFDevice( 1 ),
m_eOrientation( orientation::Portrait ),
m_bPapersizeFromSetup( false ),
m_pParser( nullptr ) {}
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index b217349..84de26e 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -771,26 +771,11 @@ sal_uInt32 PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, Pr
}
case PrinterCapType::PDF:
if( PrinterInfoManager::get().checkFeatureToken( pJobSetup->GetPrinterName(), "pdf" ) )
return 1;
else
{
// see if the PPD contains a value to set PDF device
JobData aData = PrinterInfoManager::get().getPrinterInfo( pJobSetup->GetPrinterName() );
if( pJobSetup->GetDriverData() )
JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(), pJobSetup->GetDriverDataLen(), aData );
return aData.m_nPDFDevice > 0 ? 1 : 0;
}
return 1;
case PrinterCapType::ExternalDialog:
return PrinterInfoManager::get().checkFeatureToken( pJobSetup->GetPrinterName(), "external_dialog" ) ? 1 : 0;
case PrinterCapType::UsePullModel:
{
// see if the PPD contains a value to set PDF device
JobData aData = PrinterInfoManager::get().getPrinterInfo( pJobSetup->GetPrinterName() );
if( pJobSetup->GetDriverData() )
JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(), pJobSetup->GetDriverDataLen(), aData );
return aData.m_nPDFDevice > 0 ? 1 : 0;
}
return 1;
default: break;
}
return 0;
@@ -972,9 +957,6 @@ bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i_rJo
if( i_pSetupData )
JobData::constructFromStreamBuffer( i_pSetupData->GetDriverData(), i_pSetupData->GetDriverDataLen(), m_aJobData );
OSL_ASSERT( m_aJobData.m_nPDFDevice > 0 );
m_aJobData.m_nPDFDevice = 1;
// possibly create one job for collated output
int nCopies = i_rController.getPrinter()->GetCopyCount();
bool bCollate = i_rController.getPrinter()->IsCollateCopy();
diff --git a/vcl/unx/generic/printer/cpdmgr.cxx b/vcl/unx/generic/printer/cpdmgr.cxx
index 851df73..3955a02 100644
--- a/vcl/unx/generic/printer/cpdmgr.cxx
+++ b/vcl/unx/generic/printer/cpdmgr.cxx
@@ -644,7 +644,7 @@ void CPDManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner,
}
}
}
if( rJob.m_nPDFDevice > 0 && rJob.m_nCopies > 1 )
if( rJob.m_nCopies > 1 )
{
OString aVal( OString::number( rJob.m_nCopies ) );
g_variant_builder_add(builder, "(ss)", "copies", aVal.getStr());
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index 460dfb5..051023c 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -685,7 +685,7 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner
}
}
if( rJob.m_nPDFDevice > 0 && rJob.m_nCopies > 1 )
if( rJob.m_nCopies > 1 )
{
OString aVal( OString::number( rJob.m_nCopies ) );
rNumOptions = cupsAddOption( "copies", aVal.getStr(), rNumOptions, reinterpret_cast<cups_option_t**>(rOptions) );
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx
index 5883159..bb2dded 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -46,7 +46,6 @@ JobData& JobData::operator=(const JobData& rRight)
m_pParser = rRight.m_pParser;
m_aContext = rRight.m_aContext;
m_nPSLevel = rRight.m_nPSLevel;
m_nPDFDevice = rRight.m_nPDFDevice;
m_nColorDevice = rRight.m_nColorDevice;
if( !m_pParser && !m_aPrinterName.isEmpty() )
@@ -59,29 +58,8 @@ JobData& JobData::operator=(const JobData& rRight)
void JobData::setCollate( bool bCollate )
{
if (m_nPDFDevice > 0)
{
m_bCollate = bCollate;
return;
}
const PPDParser* pParser = m_aContext.getParser();
if( !pParser )
return;
const PPDKey* pKey = pParser->getKey( "Collate" );
if( !pKey )
return;
const PPDValue* pVal = nullptr;
if( bCollate )
pVal = pKey->getValue( "True" );
else
{
pVal = pKey->getValue( "False" );
if( ! pVal )
pVal = pKey->getValue( "None" );
}
m_aContext.setValue( pKey, pVal );
m_bCollate = bCollate;
return;
}
void JobData::setPaper( int i_nWidth, int i_nHeight )
@@ -138,11 +116,7 @@ bool JobData::getStreamBuffer( void*& pData, sal_uInt32& bytes )
aLine.setLength(0);
aStream.WriteLine(Concat2View("copies=" + OString::number(static_cast<sal_Int32>(m_nCopies))));
if (m_nPDFDevice > 0)
{
aStream.WriteLine(Concat2View("collate=" + OString::boolean(m_bCollate)));
}
aStream.WriteLine(Concat2View("collate=" + OString::boolean(m_bCollate)));
aStream.WriteLine(Concat2View(
"marginadjustment="
@@ -158,8 +132,6 @@ bool JobData::getStreamBuffer( void*& pData, sal_uInt32& bytes )
aStream.WriteLine(Concat2View("pslevel=" + OString::number(static_cast<sal_Int32>(m_nPSLevel))));
aStream.WriteLine(Concat2View("pdfdevice=" + OString::number(static_cast<sal_Int32>(m_nPDFDevice))));
aStream.WriteLine(Concat2View("colordevice=" + OString::number(static_cast<sal_Int32>(m_nColorDevice))));
// now append the PPDContext stream buffer
@@ -190,7 +162,6 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo
bool bColorDepth = false;
bool bColorDevice = false;
bool bPSLevel = false;
bool bPDFDevice = false;
const char printerEquals[] = "printer=";
const char orientatationEquals[] = "orientation=";
@@ -200,7 +171,6 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo
const char colordepthEquals[] = "colordepth=";
const char colordeviceEquals[] = "colordevice=";
const char pslevelEquals[] = "pslevel=";
const char pdfdeviceEquals[] = "pdfdevice=";
while( ! aStream.eof() )
{
@@ -250,11 +220,6 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo
bPSLevel = true;
rJobData.m_nPSLevel = o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pslevelEquals)));
}
else if (aLine.startsWith(pdfdeviceEquals))
{
bPDFDevice = true;
rJobData.m_nPDFDevice = o3tl::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pdfdeviceEquals)));
}
else if (aLine == "PPDContextData" && bPrinter)
{
PrinterInfoManager& rManager = PrinterInfoManager::get();
@@ -277,7 +242,7 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo
}
}
return bVersion && bPrinter && bOrientation && bCopies && bContext && bMargin && bPSLevel && bPDFDevice && bColorDevice && bColorDepth;
return bVersion && bPrinter && bOrientation && bCopies && bContext && bMargin && bPSLevel && bColorDevice && bColorDepth;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index e3afc43..3957e36 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -244,10 +244,6 @@ void PrinterInfoManager::initialize()
if (!aValue.isEmpty())
m_aGlobalDefaults.m_nPSLevel = aValue.toInt32();
aValue = aConfig.ReadKey( "PDFDevice" );
if (!aValue.isEmpty())
m_aGlobalDefaults.m_nPDFDevice = aValue.toInt32();
// get the PPDContext of global JobData
for( int nKey = 0; nKey < aConfig.GetKeyCount(); ++nKey )
{
@@ -428,10 +424,6 @@ void PrinterInfoManager::initialize()
if (!aValue.isEmpty())
aPrinter.m_aInfo.m_nPSLevel = aValue.toInt32();
aValue = aConfig.ReadKey( "PDFDevice" );
if (!aValue.isEmpty())
aPrinter.m_aInfo.m_nPDFDevice = aValue.toInt32();
// now iterate over all keys to extract multi key information:
// 1. PPDContext information
for( int nKey = 0; nKey < aConfig.GetKeyCount(); ++nKey )