summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2016-01-19 14:05:37 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2016-03-24 22:40:37 +0100
commitdea0abc58c558d3c62e806d06035b1a30420264e (patch)
treee6f5be01ca0d6e922e8fc1d243ac5645e54f2ce4 /vcl/unx
parent4ba9bf6ad0e7383e0af421a5fea79e3b9d34fce6 (diff)
tdf#93236 Revert "support fast MM printing in...
non-single-file mode only for CUPS" This reverts commit 138d29aa09417eba4d15ade4c9f4dab2620b6326. The patch breaks all print opions affecting multiple pages, i.e. page range selection, pages per sheet, blank pages, reverse page order and copies. Conflicts: configure.ac sw/source/uibase/dbui/dbmgr.cxx vcl/inc/cupsmgr.hxx vcl/unx/generic/printer/cupsmgr.cxx Change-Id: I8c39e7f0e71ef9688254c0a0dba049e1836b733c
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/generic/printer/cupsmgr.cxx105
-rw-r--r--vcl/unx/generic/printer/jobdata.cxx18
-rw-r--r--vcl/unx/generic/printer/printerinfomanager.cxx15
3 files changed, 15 insertions, 123 deletions
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index 71464d7e9157..2da3bf90e4fc 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -183,8 +183,7 @@ CUPSManager::CUPSManager() :
m_nDests( 0 ),
m_pDests( nullptr ),
m_bNewDests( false ),
- m_bPPDThreadRunning( false ),
- batchMode( false )
+ m_bPPDThreadRunning( false )
{
m_aDestThread = osl_createThread( run_dest_thread_stub, this );
}
@@ -626,6 +625,8 @@ bool CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTi
rDocumentJobData.m_nCopies
);
+ int nJobID = 0;
+
osl::MutexGuard aGuard( m_aCUPSMutex );
std::unordered_map< OUString, int, OUStringHash >::iterator dest_it =
@@ -637,106 +638,32 @@ bool CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTi
}
std::unordered_map< FILE*, OString, FPtrHash >::const_iterator it = m_aSpoolFiles.find( pFile );
- if( it == m_aSpoolFiles.end() )
- return false;
- fclose( pFile );
- PendingJob job( rPrintername, rJobTitle, rDocumentJobData, bBanner, rFaxNumber, it->second );
- m_aSpoolFiles.erase( pFile );
- pendingJobs.push_back( job );
- if( !batchMode ) // process immediately, otherwise will be handled by flushBatchPrint()
- return processPendingJobs();
- return true;
-}
-
-bool CUPSManager::startBatchPrint()
-{
- batchMode = true;
- return true;
-}
-
-bool CUPSManager::supportsBatchPrint() const
-{
- return true;
-}
-
-bool CUPSManager::flushBatchPrint()
-{
- osl::MutexGuard aGuard( m_aCUPSMutex );
- batchMode = false; // reset the batch print mode
- return processPendingJobs();
-}
-
-bool CUPSManager::processPendingJobs()
-{
- // Print all jobs that have the same data using one CUPS call (i.e. merge all jobs that differ only in files to print).
- PendingJob currentJobData;
- bool first = true;
- std::vector< OString > files;
- bool ok = true;
- while( !pendingJobs.empty())
- {
- if( first )
- {
- currentJobData = pendingJobs.front();
- first = false;
- }
- else if( currentJobData.printerName != pendingJobs.front().printerName
- || currentJobData.jobTitle != pendingJobs.front().jobTitle
- || currentJobData.jobData != pendingJobs.front().jobData
- || currentJobData.banner != pendingJobs.front().banner )
- {
- if( !printJobs( currentJobData, files ))
- ok = false;
- files.clear();
- currentJobData = pendingJobs.front();
- }
- files.push_back( pendingJobs.front().file );
- pendingJobs.pop_front();
- }
- if( !first )
+ if( it != m_aSpoolFiles.end() )
{
- if( !printJobs( currentJobData, files )) // print the last batch
- ok = false;
- }
- return ok;
-}
-
-bool CUPSManager::printJobs( const PendingJob& job, const std::vector< OString >& files )
-{
- std::unordered_map< OUString, int, OUStringHash >::iterator dest_it =
- m_aCUPSDestMap.find( job.printerName );
-
+ fclose( pFile );
rtl_TextEncoding aEnc = osl_getThreadTextEncoding();
// setup cups options
int nNumOptions = 0;
cups_option_t* pOptions = nullptr;
- getOptionsFromDocumentSetup( job.jobData, job.banner, nNumOptions, reinterpret_cast<void**>(&pOptions) );
+ getOptionsFromDocumentSetup( rDocumentJobData, bBanner, nNumOptions, reinterpret_cast<void**>(&pOptions) );
- OString sJobName(OUStringToOString(job.jobTitle, aEnc));
+ OString sJobName(OUStringToOString(rJobTitle, aEnc));
//fax4CUPS, "the job name will be dialled for you"
//so override the jobname with the desired number
- if (!job.faxNumber.isEmpty())
+ if (!rFaxNumber.isEmpty())
{
- sJobName = OUStringToOString(job.faxNumber, aEnc);
+ sJobName = OUStringToOString(rFaxNumber, aEnc);
}
cups_dest_t* pDest = static_cast<cups_dest_t*>(m_pDests) + dest_it->second;
-
- std::vector< const char* > fnames;
- for( std::vector< OString >::const_iterator it = files.begin();
- it != files.end();
- ++it )
- fnames.push_back( it->getStr());
-
- int nJobID = cupsPrintFiles(pDest->name,
- fnames.size(),
- fnames.data(),
+ nJobID = cupsPrintFile(pDest->name,
+ it->second.getStr(),
sJobName.getStr(),
nNumOptions, pOptions);
SAL_INFO("vcl.unx.print", "cupsPrintFile( " << pDest->name << ", "
- << ( fnames.size() == 1 ? files.front() : OString::number( fnames.size()) ).getStr() << ", " << sJobName << ", " << nNumOptions
+ << it->second << ", " << rJobTitle << ", " << nNumOptions
<< ", " << pOptions << " ) returns " << nJobID);
for( int n = 0; n < nNumOptions; n++ )
SAL_INFO("vcl.unx.print",
@@ -748,13 +675,11 @@ bool CUPSManager::printJobs( const PendingJob& job, const std::vector< OString >
system( aCmd.getStr() );
#endif
- for( std::vector< OString >::const_iterator it = files.begin();
- it != files.end();
- ++it )
- unlink( it->getStr());
-
+ unlink( it->second.getStr() );
+ m_aSpoolFiles.erase( pFile );
if( pOptions )
cupsFreeOptions( nNumOptions, pOptions );
+ }
return nJobID != 0;
}
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx
index f52e577bf31b..aead34c96eb1 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -52,24 +52,6 @@ JobData& JobData::operator=(const JobData& rRight)
return *this;
}
-bool psp::operator==(const psp::JobData& rLeft, const psp::JobData& rRight)
-{
- return rLeft.m_nCopies == rRight.m_nCopies
-// && rLeft.m_bCollate == rRight.m_bCollate
- && rLeft.m_nLeftMarginAdjust == rRight.m_nLeftMarginAdjust
- && rLeft.m_nRightMarginAdjust == rRight.m_nRightMarginAdjust
- && rLeft.m_nTopMarginAdjust == rRight.m_nTopMarginAdjust
- && rLeft.m_nBottomMarginAdjust == rRight.m_nBottomMarginAdjust
- && rLeft.m_nColorDepth == rRight.m_nColorDepth
- && rLeft.m_eOrientation == rRight.m_eOrientation
- && rLeft.m_aPrinterName == rRight.m_aPrinterName
- && rLeft.m_pParser == rRight.m_pParser
-// && rLeft.m_aContext == rRight.m_aContext
- && rLeft.m_nPSLevel == rRight.m_nPSLevel
- && rLeft.m_nPDFDevice == rRight.m_nPDFDevice
- && rLeft.m_nColorDevice == rRight.m_nColorDevice;
-}
-
void JobData::setCollate( bool bCollate )
{
if (m_nPDFDevice > 0)
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index c61a04c52aa4..993c898d068a 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -934,21 +934,6 @@ void PrinterInfoManager::setDefaultPaper( PPDContext& rContext ) const
}
}
-bool PrinterInfoManager::startBatchPrint()
-{
- return false; // not implemented
-}
-
-bool PrinterInfoManager::supportsBatchPrint() const
-{
- return false;
-}
-
-bool PrinterInfoManager::flushBatchPrint()
-{
- return false;
-}
-
SystemQueueInfo::SystemQueueInfo() :
m_bChanged( false )
{