summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx13
-rw-r--r--vcl/unx/headless/svpprn.cxx114
-rw-r--r--vcl/unx/headless/svpprn.hxx6
-rw-r--r--vcl/unx/inc/salprn.h6
-rw-r--r--vcl/unx/source/app/saldisp.cxx6
-rw-r--r--vcl/unx/source/gdi/salprnpsp.cxx125
-rw-r--r--vcl/unx/source/plugadapt/salplug.cxx4
-rw-r--r--vcl/unx/source/printer/jobdata.cxx22
-rw-r--r--vcl/unx/source/printergfx/printerjob.cxx45
9 files changed, 237 insertions, 104 deletions
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index f922552ce923..654f39c51a92 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -1091,6 +1091,19 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
rNativeContentRegion = Region( aIndicatorRect );
returnVal = TRUE;
}
+ if( (nType == CTRL_EDITBOX || nType == CTRL_SPINBOX) && nPart == PART_ENTIRE_CONTROL )
+ {
+ NWEnsureGTKEditBox( m_nScreen );
+ GtkWidget* widget = gWidgetData[m_nScreen].gEditBoxWidget;
+ GtkRequisition aReq;
+ gtk_widget_size_request( widget, &aReq );
+ Rectangle aEditRect = rControlRegion.GetBoundRect();
+ aEditRect = Rectangle( aEditRect.TopLeft(),
+ Size( aEditRect.GetWidth(), aReq.height+1 ) );
+ rNativeBoundingRegion = Region( aEditRect );
+ rNativeContentRegion = rNativeBoundingRegion;
+ returnVal = TRUE;
+ }
return( returnVal );
}
diff --git a/vcl/unx/headless/svpprn.cxx b/vcl/unx/headless/svpprn.cxx
index 1882b50e6ad7..75d86959b2b5 100644
--- a/vcl/unx/headless/svpprn.cxx
+++ b/vcl/unx/headless/svpprn.cxx
@@ -123,6 +123,32 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
pJobSetup->mnPaperBin = 0xffff;
}
+ // copy duplex
+ pKey = NULL;
+ pValue = NULL;
+
+ pJobSetup->meDuplexMode = DUPLEX_UNKNOWN;
+ if( rData.m_pParser )
+ pKey = rData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
+ if( pKey )
+ pValue = rData.m_aContext.getValue( pKey );
+ if( pKey && pValue )
+ {
+ if( pValue->m_aOption.EqualsIgnoreCaseAscii( "None" ) ||
+ pValue->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 )
+ )
+ {
+ pJobSetup->meDuplexMode = DUPLEX_OFF;
+ }
+ else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexNoTumble" ) )
+ {
+ pJobSetup->meDuplexMode = DUPLEX_LONGEDGE;
+ }
+ else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexTumble" ) )
+ {
+ pJobSetup->meDuplexMode = DUPLEX_SHORTEDGE;
+ }
+ }
// copy the whole context
if( pJobSetup->mpDriverData )
@@ -455,34 +481,6 @@ void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
// -----------------------------------------------------------------------
-DuplexMode PspSalInfoPrinter::GetDuplexMode( const ImplJobSetup* pJobSetup )
-{
- DuplexMode aRet = DUPLEX_UNKNOWN;
- PrinterInfo aInfo( PrinterInfoManager::get().getPrinterInfo( pJobSetup->maPrinterName ) );
- if ( pJobSetup->mpDriverData )
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aInfo );
- if( aInfo.m_pParser )
- {
- const PPDKey * pKey = aInfo.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
- if( pKey )
- {
- const PPDValue* pVal = aInfo.m_aContext.getValue( pKey );
- if( pVal && (
- pVal->m_aOption.EqualsIgnoreCaseAscii( "None" ) ||
- pVal->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 )
- ) )
- {
- aRet = DUPLEX_OFF;
- }
- else
- aRet = DUPLEX_ON;
- }
- }
- return aRet;
-}
-
-// -----------------------------------------------------------------------
-
int PspSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* )
{
return 900;
@@ -624,6 +622,37 @@ BOOL PspSalInfoPrinter::SetData(
if( nSetDataFlags & SAL_JOBSET_ORIENTATION )
aData.m_eOrientation = pJobSetup->meOrientation == ORIENTATION_LANDSCAPE ? orientation::Landscape : orientation::Portrait;
+ // merge duplex if necessary
+ if( nSetDataFlags & SAL_JOBSET_DUPLEXMODE )
+ {
+ pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
+ if( pKey )
+ {
+ pValue = NULL;
+ switch( pJobSetup->meDuplexMode )
+ {
+ case DUPLEX_OFF:
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
+ if( pValue == NULL )
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "SimplexNoTumble" ) ) );
+ break;
+ case DUPLEX_SHORTEDGE:
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexTumble" ) ) );
+ break;
+ case DUPLEX_LONGEDGE:
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexNoTumble" ) ) );
+ break;
+ case DUPLEX_UNKNOWN:
+ default:
+ pValue = 0;
+ break;
+ }
+ if( ! pValue )
+ pValue = pKey->getDefaultValue();
+ aData.m_aContext.setValue( pKey, pValue );
+ }
+ }
+
m_aJobData = aData;
copyJobDataToJobSetup( pJobSetup, aData );
return TRUE;
@@ -725,9 +754,22 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT
case PRINTER_CAPABILITIES_COPIES:
return 0xffff;
case PRINTER_CAPABILITIES_COLLATECOPIES:
- return 0;
+ {
+ // see if the PPD contains a value to set Collate to True
+ JobData aData;
+ JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
+
+ const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) ) : NULL;
+ const PPDValue* pVal = pKey ? pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "True" ) ) ) : NULL;
+
+ // PPDs don't mention the number of possible collated copies.
+ // so let's guess as many as we want ?
+ return pVal ? 0xffff : 0;
+ }
case PRINTER_CAPABILITIES_SETORIENTATION:
return 1;
+ case PRINTER_CAPABILITIES_SETDUPLEX:
+ return 1;
case PRINTER_CAPABILITIES_SETPAPERBIN:
return 1;
case PRINTER_CAPABILITIES_SETPAPERSIZE:
@@ -777,6 +819,7 @@ PspSalPrinter::PspSalPrinter( SalInfoPrinter* pInfoPrinter )
m_bSwallowFaxNo( false ),
m_pGraphics( NULL ),
m_nCopies( 1 ),
+ m_bCollate( false ),
m_pInfoPrinter( pInfoPrinter )
{
}
@@ -802,7 +845,9 @@ BOOL PspSalPrinter::StartJob(
const XubString* pFileName,
const XubString& rJobName,
const XubString& rAppName,
- ULONG nCopies, BOOL /*bCollate*/,
+ ULONG nCopies,
+ bool bCollate,
+ bool /*bDirect*/,
ImplJobSetup* pJobSetup )
{
vcl_sal::PrinterUpdate::jobStarted();
@@ -811,13 +856,17 @@ BOOL PspSalPrinter::StartJob(
m_bPdf = false;
m_aFileName = pFileName ? *pFileName : String();
m_aTmpFile = String();
- m_nCopies = nCopies;
+ m_nCopies = nCopies;
+ m_bCollate = bCollate;
JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData );
if( m_nCopies > 1 )
+ {
// in case user did not do anything (m_nCopies=1)
// take the default from jobsetup
m_aJobData.m_nCopies = m_nCopies;
+ m_aJobData.setCollate( bCollate );
+ }
// check wether this printer is configured as fax
int nMode = 0;
@@ -917,9 +966,12 @@ SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, BOOL )
m_pGraphics = new PspGraphics( &m_aJobData, &m_aPrinterGfx, m_bFax ? &m_aFaxNr : NULL, m_bSwallowFaxNo, m_pInfoPrinter );
m_pGraphics->SetLayout( 0 );
if( m_nCopies > 1 )
+ {
// in case user did not do anything (m_nCopies=1)
// take the default from jobsetup
m_aJobData.m_nCopies = m_nCopies;
+ m_aJobData.setCollate( m_nCopies > 1 && m_bCollate );
+ }
m_aPrintJob.StartPage( m_aJobData );
m_aPrinterGfx.Init( m_aPrintJob );
diff --git a/vcl/unx/headless/svpprn.hxx b/vcl/unx/headless/svpprn.hxx
index c2d85c054fce..8f5a47fed118 100644
--- a/vcl/unx/headless/svpprn.hxx
+++ b/vcl/unx/headless/svpprn.hxx
@@ -63,7 +63,6 @@ public:
virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin );
virtual void InitPaperFormats( const ImplJobSetup* pSetupData );
virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData );
- virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData );
};
class PspSalPrinter : public SalPrinter
@@ -80,6 +79,7 @@ public:
psp::JobData m_aJobData;
psp::PrinterGfx m_aPrinterGfx;
ULONG m_nCopies;
+ bool m_bCollate;
SalInfoPrinter* m_pInfoPrinter;
PspSalPrinter( SalInfoPrinter* );
@@ -90,7 +90,9 @@ public:
virtual BOOL StartJob( const XubString* pFileName,
const XubString& rJobName,
const XubString& rAppName,
- ULONG nCopies, BOOL bCollate,
+ ULONG nCopies,
+ bool bCollate,
+ bool bDirect,
ImplJobSetup* pSetupData );
virtual BOOL EndJob();
virtual BOOL AbortJob();
diff --git a/vcl/unx/inc/salprn.h b/vcl/unx/inc/salprn.h
index 452fa5a89387..59a5c3eef56a 100644
--- a/vcl/unx/inc/salprn.h
+++ b/vcl/unx/inc/salprn.h
@@ -63,7 +63,6 @@ public:
virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin );
virtual void InitPaperFormats( const ImplJobSetup* pSetupData );
virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData );
- virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData );
};
class PspSalPrinter : public SalPrinter
@@ -80,6 +79,7 @@ public:
psp::JobData m_aJobData;
psp::PrinterGfx m_aPrinterGfx;
ULONG m_nCopies;
+ bool m_bCollate;
SalInfoPrinter* m_pInfoPrinter;
PspSalPrinter( SalInfoPrinter* );
@@ -90,7 +90,9 @@ public:
virtual BOOL StartJob( const XubString* pFileName,
const XubString& rJobName,
const XubString& rAppName,
- ULONG nCopies, BOOL bCollate,
+ ULONG nCopies,
+ bool bCollate,
+ bool bDirect,
ImplJobSetup* pSetupData );
virtual BOOL EndJob();
virtual BOOL AbortJob();
diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx
index cfd568ac9b6c..558ae3714358 100644
--- a/vcl/unx/source/app/saldisp.cxx
+++ b/vcl/unx/source/app/saldisp.cxx
@@ -2304,11 +2304,7 @@ long SalX11Display::Dispatch( XEvent *pEvent )
return 0;
SalInstance* pInstance = GetSalData()->m_pInstance;
- if( pInstance->GetEventCallback() )
- {
- YieldMutexReleaser aReleaser;
- pInstance->CallEventCallback( pEvent, sizeof( XEvent ) );
- }
+ pInstance->CallEventCallback( pEvent, sizeof( XEvent ) );
switch( pEvent->type )
{
diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx
index 2cf4e3baedd3..d47e30a89633 100644
--- a/vcl/unx/source/gdi/salprnpsp.cxx
+++ b/vcl/unx/source/gdi/salprnpsp.cxx
@@ -177,6 +177,32 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
pJobSetup->mnPaperBin = 0;
}
+ // copy duplex
+ pKey = NULL;
+ pValue = NULL;
+
+ pJobSetup->meDuplexMode = DUPLEX_UNKNOWN;
+ if( rData.m_pParser )
+ pKey = rData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
+ if( pKey )
+ pValue = rData.m_aContext.getValue( pKey );
+ if( pKey && pValue )
+ {
+ if( pValue->m_aOption.EqualsIgnoreCaseAscii( "None" ) ||
+ pValue->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 )
+ )
+ {
+ pJobSetup->meDuplexMode = DUPLEX_OFF;
+ }
+ else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexNoTumble" ) )
+ {
+ pJobSetup->meDuplexMode = DUPLEX_LONGEDGE;
+ }
+ else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexTumble" ) )
+ {
+ pJobSetup->meDuplexMode = DUPLEX_SHORTEDGE;
+ }
+ }
// copy the whole context
if( pJobSetup->mpDriverData )
@@ -525,34 +551,6 @@ void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
// -----------------------------------------------------------------------
-DuplexMode PspSalInfoPrinter::GetDuplexMode( const ImplJobSetup* pJobSetup )
-{
- DuplexMode aRet = DUPLEX_UNKNOWN;
- PrinterInfo aInfo( PrinterInfoManager::get().getPrinterInfo( pJobSetup->maPrinterName ) );
- if ( pJobSetup->mpDriverData )
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aInfo );
- if( aInfo.m_pParser )
- {
- const PPDKey * pKey = aInfo.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
- if( pKey )
- {
- const PPDValue* pVal = aInfo.m_aContext.getValue( pKey );
- if( pVal && (
- pVal->m_aOption.EqualsIgnoreCaseAscii( "None" ) ||
- pVal->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 )
- ) )
- {
- aRet = DUPLEX_OFF;
- }
- else
- aRet = DUPLEX_ON;
- }
- }
- return aRet;
-}
-
-// -----------------------------------------------------------------------
-
int PspSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* )
{
return 900;
@@ -727,6 +725,37 @@ BOOL PspSalInfoPrinter::SetData(
if( nSetDataFlags & SAL_JOBSET_ORIENTATION )
aData.m_eOrientation = pJobSetup->meOrientation == ORIENTATION_LANDSCAPE ? orientation::Landscape : orientation::Portrait;
+ // merge duplex if necessary
+ if( nSetDataFlags & SAL_JOBSET_DUPLEXMODE )
+ {
+ pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) );
+ if( pKey )
+ {
+ pValue = NULL;
+ switch( pJobSetup->meDuplexMode )
+ {
+ case DUPLEX_OFF:
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
+ if( pValue == NULL )
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "SimplexNoTumble" ) ) );
+ break;
+ case DUPLEX_SHORTEDGE:
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexTumble" ) ) );
+ break;
+ case DUPLEX_LONGEDGE:
+ pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexNoTumble" ) ) );
+ break;
+ case DUPLEX_UNKNOWN:
+ default:
+ pValue = 0;
+ break;
+ }
+ if( ! pValue )
+ pValue = pKey->getDefaultValue();
+ aData.m_aContext.setValue( pKey, pValue );
+ }
+ }
+
m_aJobData = aData;
copyJobDataToJobSetup( pJobSetup, aData );
return TRUE;
@@ -828,9 +857,22 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT
case PRINTER_CAPABILITIES_COPIES:
return 0xffff;
case PRINTER_CAPABILITIES_COLLATECOPIES:
- return 0;
+ {
+ // see if the PPD contains a value to set Collate to True
+ JobData aData;
+ JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
+
+ const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) ) : NULL;
+ const PPDValue* pVal = pKey ? pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "True" ) ) ) : NULL;
+
+ // PPDs don't mention the number of possible collated copies.
+ // so let's guess as many as we want ?
+ return pVal ? 0xffff : 0;
+ }
case PRINTER_CAPABILITIES_SETORIENTATION:
return 1;
+ case PRINTER_CAPABILITIES_SETDUPLEX:
+ return 1;
case PRINTER_CAPABILITIES_SETPAPERBIN:
return 1;
case PRINTER_CAPABILITIES_SETPAPERSIZE:
@@ -860,6 +902,7 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT
m_bSwallowFaxNo( false ),
m_pGraphics( NULL ),
m_nCopies( 1 ),
+ m_bCollate( false ),
m_pInfoPrinter( pInfoPrinter )
{
}
@@ -885,7 +928,9 @@ BOOL PspSalPrinter::StartJob(
const XubString* pFileName,
const XubString& rJobName,
const XubString& rAppName,
- ULONG nCopies, BOOL /*bCollate*/,
+ ULONG nCopies,
+ bool bCollate,
+ bool bDirect,
ImplJobSetup* pJobSetup )
{
vcl_sal::PrinterUpdate::jobStarted();
@@ -894,13 +939,17 @@ BOOL PspSalPrinter::StartJob(
m_bPdf = false;
m_aFileName = pFileName ? *pFileName : String();
m_aTmpFile = String();
- m_nCopies = nCopies;
+ m_nCopies = nCopies;
+ m_bCollate = bCollate;
JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData );
if( m_nCopies > 1 )
+ {
// in case user did not do anything (m_nCopies=1)
// take the default from jobsetup
m_aJobData.m_nCopies = m_nCopies;
+ m_aJobData.setCollate( bCollate );
+ }
// check wether this printer is configured as fax
int nMode = 0;
@@ -943,15 +992,6 @@ BOOL PspSalPrinter::StartJob(
}
m_aPrinterGfx.Init( m_aJobData );
- bool bIsQuickJob = false;
- std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator quick_it =
- pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ) );
- if( quick_it != pJobSetup->maValueMap.end() )
- {
- if( quick_it->second.equalsIgnoreAsciiCaseAscii( "true" ) )
- bIsQuickJob = true;
- }
-
// set/clear backwards compatibility flag
bool bStrictSO52Compatibility = false;
std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
@@ -964,7 +1004,7 @@ BOOL PspSalPrinter::StartJob(
}
m_aPrinterGfx.setStrictSO52Compatibility( bStrictSO52Compatibility );
- return m_aPrintJob.StartJob( m_aTmpFile.Len() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bIsQuickJob ) ? TRUE : FALSE;
+ return m_aPrintJob.StartJob( m_aTmpFile.Len() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bDirect ) ? TRUE : FALSE;
}
// -----------------------------------------------------------------------
@@ -1010,9 +1050,12 @@ SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, BOOL )
m_pGraphics = new PspGraphics( &m_aJobData, &m_aPrinterGfx, m_bFax ? &m_aFaxNr : NULL, m_bSwallowFaxNo, m_pInfoPrinter );
m_pGraphics->SetLayout( 0 );
if( m_nCopies > 1 )
+ {
// in case user did not do anything (m_nCopies=1)
// take the default from jobsetup
m_aJobData.m_nCopies = m_nCopies;
+ m_aJobData.setCollate( m_nCopies > 1 && m_bCollate );
+ }
m_aPrintJob.StartPage( m_aJobData );
m_aPrinterGfx.Init( m_aPrintJob );
diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx
index f1c63b8abee7..08820b2cb7f9 100644
--- a/vcl/unx/source/plugadapt/salplug.cxx
+++ b/vcl/unx/source/plugadapt/salplug.cxx
@@ -219,8 +219,10 @@ SalInstance *CreateSalInstance()
if( !(pUsePlugin && *pUsePlugin) )
pInst = check_headless_plugin();
+ else
+ pInst = tryInstance( OUString::createFromAscii( pUsePlugin ) );
- if( ! pInst && !(pUsePlugin && *pUsePlugin) )
+ if( ! pInst )
pInst = autodetect_plugin();
// fallback to gen
diff --git a/vcl/unx/source/printer/jobdata.cxx b/vcl/unx/source/printer/jobdata.cxx
index 51e171d578d9..0410b349c93b 100644
--- a/vcl/unx/source/printer/jobdata.cxx
+++ b/vcl/unx/source/printer/jobdata.cxx
@@ -64,6 +64,28 @@ JobData& JobData::operator=(const JobData& rRight)
return *this;
}
+void JobData::setCollate( bool bCollate )
+{
+ const PPDParser* pParser = m_aContext.getParser();
+ if( pParser )
+ {
+ const PPDKey* pKey = pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) );
+ if( pKey )
+ {
+ const PPDValue* pVal = NULL;
+ if( bCollate )
+ pVal = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "True" ) ) );
+ else
+ {
+ pVal = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "False" ) ) );
+ if( ! pVal )
+ pVal = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
+ }
+ m_aContext.setValue( pKey, pVal );
+ }
+ }
+}
+
bool JobData::getStreamBuffer( void*& pData, int& bytes )
{
// consistency checks
diff --git a/vcl/unx/source/printergfx/printerjob.cxx b/vcl/unx/source/printergfx/printerjob.cxx
index 783dd5ff2b47..1c42cafa4cb9 100644
--- a/vcl/unx/source/printergfx/printerjob.cxx
+++ b/vcl/unx/source/printergfx/printerjob.cxx
@@ -681,14 +681,6 @@ PrinterJob::StartPage (const JobData& rJobSetup)
if( ! (pPageHeader && pPageBody) )
return sal_False;
- /* #i7262# write setup only before first page
- * don't do this in StartJob since the jobsetup there may be
- * different.
- */
- bool bSuccess = true;
- if( 1 == maPageList.size() )
- m_aDocumentJobData = rJobSetup;
-
// write page header according to Document Structuring Conventions (DSC)
WritePS (pPageHeader, "%%Page: ");
WritePS (pPageHeader, aPageNo);
@@ -722,13 +714,25 @@ PrinterJob::StartPage (const JobData& rJobSetup)
WritePS (pPageHeader, pBBox);
- if (bSuccess)
- bSuccess = writePageSetup ( pPageHeader, rJobSetup );
- if(bSuccess)
- m_aLastJobData = rJobSetup;
+ /* #i7262# #i65491# write setup only before first page
+ * (to %%Begin(End)Setup, instead of %%Begin(End)PageSetup)
+ * don't do this in StartJob since the jobsetup there may be
+ * different.
+ */
+ bool bWriteFeatures = true;
+ if( 1 == maPageList.size() )
+ {
+ m_aDocumentJobData = rJobSetup;
+ bWriteFeatures = false;
+ }
+ if ( writePageSetup( pPageHeader, rJobSetup, bWriteFeatures ) )
+ {
+ m_aLastJobData = rJobSetup;
+ return true;
+ }
- return bSuccess;
+ return false;
}
sal_Bool
@@ -828,12 +832,9 @@ bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool b
if( pKey->getSetupType() == PPDKey::DocumentSetup )
bEmit = true;
}
- else
- {
- if( pKey->getSetupType() == PPDKey::PageSetup ||
- pKey->getSetupType() == PPDKey::AnySetup )
- bEmit = true;
- }
+ if( pKey->getSetupType() == PPDKey::PageSetup ||
+ pKey->getSetupType() == PPDKey::AnySetup )
+ bEmit = true;
if( bEmit )
{
const PPDValue* pValue = rJob.m_aContext.getValue( pKey );
@@ -866,13 +867,13 @@ bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool b
return bSuccess;
}
-bool PrinterJob::writePageSetup( osl::File* pFile, const JobData& rJob )
+bool PrinterJob::writePageSetup( osl::File* pFile, const JobData& rJob, bool bWriteFeatures )
{
bool bSuccess = true;
WritePS (pFile, "%%BeginPageSetup\n%\n");
-
- bSuccess = writeFeatureList( pFile, rJob, false );
+ if ( bWriteFeatures )
+ bSuccess = writeFeatureList( pFile, rJob, false );
WritePS (pFile, "%%EndPageSetup\n");
sal_Char pTranslate [128];