[Libreoffice-commits] .: 3 commits - vcl/inc vcl/unx vcl/util
Caolán McNamara
caolan at kemper.freedesktop.org
Fri Dec 17 04:49:40 PST 2010
vcl/inc/vcl/salinst.hxx | 5
vcl/unx/gtk/window/gtkframe.cxx | 10
vcl/unx/headless/svpinst.hxx | 4
vcl/unx/headless/svpprn.cxx | 736 +------------------------------------
vcl/unx/headless/svpprn.hxx | 82 ----
vcl/unx/inc/salinst.h | 3
vcl/unx/inc/salprn.h | 21 -
vcl/unx/source/gdi/salprnpsp.cxx | 55 ++
vcl/unx/source/window/salframe.cxx | 2
vcl/util/linksvp/makefile.mk | 5
10 files changed, 117 insertions(+), 806 deletions(-)
New commits:
commit 8787fb26e773fda01e3320c6ec3ad49c1945faf1
Author: Joachim <joachim.tremouroux at gmail.com>
Date: Fri Dec 17 12:40:24 2010 +0000
remove duplicate printer code
diff --git a/vcl/unx/headless/svpprn.cxx b/vcl/unx/headless/svpprn.cxx
index 19a49ce..a4dc148 100644
--- a/vcl/unx/headless/svpprn.cxx
+++ b/vcl/unx/headless/svpprn.cxx
@@ -169,144 +169,6 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
}
}
-static bool passFileToCommandLine( const String& rFilename, const String& rCommandLine, bool bRemoveFile = true )
-{
- bool bSuccess = false;
-
- rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
- ByteString aCmdLine( rCommandLine, aEncoding );
- ByteString aFilename( rFilename, aEncoding );
-
- bool bPipe = aCmdLine.Search( "(TMP)" ) != STRING_NOTFOUND ? false : true;
-
- // setup command line for exec
- if( ! bPipe )
- while( aCmdLine.SearchAndReplace( "(TMP)", aFilename ) != STRING_NOTFOUND )
- ;
-
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "%s commandline: \"%s\"\n",
- bPipe ? "piping to" : "executing",
- aCmdLine.GetBuffer() );
- struct stat aStat;
- if( stat( aFilename.GetBuffer(), &aStat ) )
- fprintf( stderr, "stat( %s ) failed\n", aFilename.GetBuffer() );
- fprintf( stderr, "Tmp file %s has modes: 0%03lo\n", aFilename.GetBuffer(), (long)aStat.st_mode );
-#endif
- const char* argv[4];
- if( ! ( argv[ 0 ] = getenv( "SHELL" ) ) )
- argv[ 0 ] = "/bin/sh";
- argv[ 1 ] = "-c";
- argv[ 2 ] = aCmdLine.GetBuffer();
- argv[ 3 ] = 0;
-
- bool bHavePipes = false;
- int pid, fd[2];
-
- if( bPipe )
- bHavePipes = pipe( fd ) ? false : true;
- if( ( pid = fork() ) > 0 )
- {
- if( bPipe && bHavePipes )
- {
- close( fd[0] );
- char aBuffer[ 2048 ];
- FILE* fp = fopen( aFilename.GetBuffer(), "r" );
- while( fp && ! feof( fp ) )
- {
- int nBytes = fread( aBuffer, 1, sizeof( aBuffer ), fp );
- if( nBytes )
- write( fd[ 1 ], aBuffer, nBytes );
- }
- fclose( fp );
- close( fd[ 1 ] );
- }
- int status = 0;
- waitpid( pid, &status, 0 );
- if( ! status )
- bSuccess = true;
- }
- else if( ! pid )
- {
- if( bPipe && bHavePipes )
- {
- close( fd[1] );
- if( fd[0] != STDIN_FILENO ) // not probable, but who knows :)
- dup2( fd[0], STDIN_FILENO );
- }
- execv( argv[0], const_cast<char**>(argv) );
- fprintf( stderr, "failed to execute \"%s\"\n", aCmdLine.GetBuffer() );
- _exit( 1 );
- }
- else
- fprintf( stderr, "failed to fork\n" );
-
- // clean up the mess
- if( bRemoveFile )
- unlink( aFilename.GetBuffer() );
-
- return bSuccess;
-}
-
-static bool sendAFax( const String& rFaxNumber, const String& rFileName, const String& rCommand )
-{
- std::list< OUString > aFaxNumbers;
-
- if( ! rFaxNumber.Len() )
- return false;
-
- sal_Int32 nIndex = 0;
- OUString aFaxes( rFaxNumber );
- OUString aBeginToken( RTL_CONSTASCII_USTRINGPARAM("<Fax#>") );
- OUString aEndToken( RTL_CONSTASCII_USTRINGPARAM("</Fax#>") );
- while( nIndex != -1 )
- {
- nIndex = aFaxes.indexOf( aBeginToken, nIndex );
- if( nIndex != -1 )
- {
- sal_Int32 nBegin = nIndex + aBeginToken.getLength();
- nIndex = aFaxes.indexOf( aEndToken, nIndex );
- if( nIndex != -1 )
- {
- aFaxNumbers.push_back( aFaxes.copy( nBegin, nIndex-nBegin ) );
- nIndex += aEndToken.getLength();
- }
- }
- }
-
- bool bSuccess = true;
- if( aFaxNumbers.begin() != aFaxNumbers.end() )
- {
- while( aFaxNumbers.begin() != aFaxNumbers.end() && bSuccess )
- {
- String aCmdLine( rCommand );
- String aFaxNumber( aFaxNumbers.front() );
- aFaxNumbers.pop_front();
- while( aCmdLine.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "(PHONE)" ) ), aFaxNumber ) != STRING_NOTFOUND )
- ;
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "sending fax to \"%s\"\n", OUStringToOString( aFaxNumber, osl_getThreadTextEncoding() ).getStr() );
-#endif
- bSuccess = passFileToCommandLine( rFileName, aCmdLine, false );
- }
- }
- else
- bSuccess = false;
-
- // clean up temp file
- unlink( ByteString( rFileName, osl_getThreadTextEncoding() ).GetBuffer() );
-
- return bSuccess;
-}
-
-static bool createPdf( const String& rToFile, const String& rFromFile, const String& rCommandLine )
-{
- String aCommandLine( rCommandLine );
- while( aCommandLine.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "(OUTFILE)" ) ), rToFile ) != STRING_NOTFOUND )
- ;
- return passFileToCommandLine( rFromFile, aCommandLine );
-}
-
/*
* SalInstance
*/
@@ -436,87 +298,6 @@ String SvpSalInstance::GetDefaultPrinter()
return rManager.getDefaultPrinter();
}
-// =======================================================================
-
-SvpSalInfoPrinter::SvpSalInfoPrinter()
-{
- m_pGraphics = NULL;
- m_bPapersInit = false;
-}
-
-// -----------------------------------------------------------------------
-
-SvpSalInfoPrinter::~SvpSalInfoPrinter()
-{
- if( m_pGraphics )
- {
- delete m_pGraphics;
- m_pGraphics = NULL;
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SvpSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
-{
- m_aPaperFormats.clear();
- m_bPapersInit = true;
-
- if( m_aJobData.m_pParser )
- {
- const PPDKey* pKey = m_aJobData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) );
- if( pKey )
- {
- int nValues = pKey->countValues();
- for( int i = 0; i < nValues; i++ )
- {
- const PPDValue* pValue = pKey->getValue( i );
- int nWidth = 0, nHeight = 0;
- m_aJobData.m_pParser->getPaperDimension( pValue->m_aOption, nWidth, nHeight );
- PaperInfo aInfo(PtTo10Mu( nWidth ), PtTo10Mu( nHeight ));
- m_aPaperFormats.push_back( aInfo );
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
-int SvpSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* )
-{
- return 900;
-}
-
-// -----------------------------------------------------------------------
-
-SalGraphics* SvpSalInfoPrinter::GetGraphics()
-{
- // return a valid pointer only once
- // the reasoning behind this is that we could have different
- // SalGraphics that can run in multiple threads
- // (future plans)
- SalGraphics* pRet = NULL;
- if( ! m_pGraphics )
- {
- m_pGraphics = new PspGraphics( &m_aJobData, &m_aPrinterGfx, NULL, false, this );
- m_pGraphics->SetLayout( 0 );
- pRet = m_pGraphics;
- }
- return pRet;
-}
-
-// -----------------------------------------------------------------------
-
-void SvpSalInfoPrinter::ReleaseGraphics( SalGraphics* pGraphics )
-{
- if( pGraphics == m_pGraphics )
- {
- delete pGraphics;
- m_pGraphics = NULL;
- }
- return;
-}
-
// -----------------------------------------------------------------------
BOOL SvpSalInfoPrinter::Setup( SalFrame*, ImplJobSetup* )
@@ -524,478 +305,6 @@ BOOL SvpSalInfoPrinter::Setup( SalFrame*, ImplJobSetup* )
return FALSE;
}
-// -----------------------------------------------------------------------
-
-// This function gets the driver data and puts it into pJobSetup
-// If pJobSetup->mpDriverData is NOT NULL, then the independend
-// data should be merged into the driver data
-// If pJobSetup->mpDriverData IS NULL, then the driver defaults
-// should be merged into the independent data
-BOOL SvpSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup )
-{
- if( pJobSetup->mpDriverData )
- return SetData( ~0, pJobSetup );
-
- copyJobDataToJobSetup( pJobSetup, m_aJobData );
-
- // set/clear backwards compatibility flag
- bool bStrictSO52Compatibility = false;
- std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
- pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) );
- if( compat_it != pJobSetup->maValueMap.end() )
- {
- if( compat_it->second.equalsIgnoreAsciiCaseAscii( "true" ) )
- bStrictSO52Compatibility = true;
- }
- m_aPrinterGfx.setStrictSO52Compatibility( bStrictSO52Compatibility );
-
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-
-// This function merges the independ driver data
-// and sets the new independ data in pJobSetup
-// Only the data must be changed, where the bit
-// in nGetDataFlags is set
-BOOL SvpSalInfoPrinter::SetData(
- ULONG nSetDataFlags,
- ImplJobSetup* pJobSetup )
-{
- JobData aData;
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
-
- if( aData.m_pParser )
- {
- const PPDKey* pKey;
- const PPDValue* pValue;
-
- // merge papersize if necessary
- if( nSetDataFlags & SAL_JOBSET_PAPERSIZE )
- {
- int nWidth, nHeight;
- if( pJobSetup->meOrientation == ORIENTATION_PORTRAIT )
- {
- nWidth = pJobSetup->mnPaperWidth;
- nHeight = pJobSetup->mnPaperHeight;
- }
- else
- {
- nWidth = pJobSetup->mnPaperHeight;
- nHeight = pJobSetup->mnPaperWidth;
- }
- String aPaper;
-
- if( pJobSetup->mePaperFormat == PAPER_USER )
- aPaper = aData.m_pParser->matchPaper(
- TenMuToPt( pJobSetup->mnPaperWidth ),
- TenMuToPt( pJobSetup->mnPaperHeight ) );
- else
- aPaper = rtl::OStringToOUString(PaperInfo::toPSName(pJobSetup->mePaperFormat), RTL_TEXTENCODING_ISO_8859_1);
-
- pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) );
- pValue = pKey ? pKey->getValue( aPaper ) : NULL;
- if( ! ( pKey && pValue && aData.m_aContext.setValue( pKey, pValue, false ) == pValue ) )
- return FALSE;
- }
-
- // merge paperbin if necessary
- if( nSetDataFlags & SAL_JOBSET_PAPERBIN )
- {
- pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) );
- if( pKey )
- {
- int nPaperBin = pJobSetup->mnPaperBin;
- if( nPaperBin == 0xffff )
- pValue = pKey->getDefaultValue();
- else
- pValue = pKey->getValue( pJobSetup->mnPaperBin );
-
- // may fail due to constraints;
- // real paper bin is copied back to jobsetup in that case
- aData.m_aContext.setValue( pKey, pValue );
- }
- // if printer has no InputSlot key simply ignore this setting
- // (e.g. SGENPRT has no InputSlot)
- }
-
- // merge orientation if necessary
- 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;
- }
-
- return FALSE;
-}
-
-// -----------------------------------------------------------------------
-
-void SvpSalInfoPrinter::GetPageInfo(
- const ImplJobSetup* pJobSetup,
- long& rOutWidth, long& rOutHeight,
- long& rPageOffX, long& rPageOffY,
- long& rPageWidth, long& rPageHeight )
-{
- if( ! pJobSetup )
- return;
-
- JobData aData;
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
-
- // get the selected page size
- if( aData.m_pParser )
- {
-
- String aPaper;
- int width, height;
- int left = 0, top = 0, right = 0, bottom = 0;
- int nDPI = aData.m_aContext.getRenderResolution();
-
-
- if( aData.m_eOrientation == psp::orientation::Portrait )
- {
- aData.m_aContext.getPageSize( aPaper, width, height );
- aData.m_pParser->getMargins( aPaper, left, right, top, bottom );
- }
- else
- {
- aData.m_aContext.getPageSize( aPaper, height, width );
- aData.m_pParser->getMargins( aPaper, top, bottom, right, left );
- }
-
- rPageWidth = width * nDPI / 72;
- rPageHeight = height * nDPI / 72;
- rPageOffX = left * nDPI / 72;
- rPageOffY = top * nDPI / 72;
- rOutWidth = ( width - left - right ) * nDPI / 72;
- rOutHeight = ( height - top - bottom ) * nDPI / 72;
- }
-}
-
-// -----------------------------------------------------------------------
-
-ULONG SvpSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup )
-{
- if( ! pJobSetup )
- return 0;
-
- JobData aData;
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
-
- const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) ): NULL;
- return pKey ? pKey->countValues() : 0;
-}
-
-// -----------------------------------------------------------------------
-
-String SvpSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, ULONG nPaperBin )
-{
- JobData aData;
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
-
- String aRet;
- if( aData.m_pParser )
- {
- const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) ): NULL;
- if( nPaperBin == 0xffff || ! pKey )
- aRet = aData.m_pParser->getDefaultInputSlot();
- else
- {
- const PPDValue* pValue = pKey->getValue( nPaperBin );
- if( pValue )
- aRet = aData.m_pParser->translateOption( pKey->getKey(), pValue->m_aOption );
- }
- }
-
- return aRet;
-}
-
-// -----------------------------------------------------------------------
-
-ULONG SvpSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT nType )
-{
- switch( nType )
- {
- case PRINTER_CAPABILITIES_SUPPORTDIALOG:
- return 1;
- case PRINTER_CAPABILITIES_COPIES:
- return 0xffff;
- case PRINTER_CAPABILITIES_COLLATECOPIES:
- {
- // 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:
- return 1;
- case PRINTER_CAPABILITIES_SETPAPER:
- return 0;
- case PRINTER_CAPABILITIES_FAX:
- {
- PrinterInfoManager& rManager = PrinterInfoManager::get();
- PrinterInfo aInfo( rManager.getPrinterInfo( pJobSetup->maPrinterName ) );
- String aFeatures( aInfo.m_aFeatures );
- int nTokenCount = aFeatures.GetTokenCount( ',' );
- for( int i = 0; i < nTokenCount; i++ )
- {
- if( aFeatures.GetToken( i ).CompareToAscii( "fax", 3 ) == COMPARE_EQUAL )
- return 1;
- }
- return 0;
- }
- case PRINTER_CAPABILITIES_PDF:
- {
- PrinterInfoManager& rManager = PrinterInfoManager::get();
- PrinterInfo aInfo( rManager.getPrinterInfo( pJobSetup->maPrinterName ) );
- String aFeatures( aInfo.m_aFeatures );
- int nTokenCount = aFeatures.GetTokenCount( ',' );
- for( int i = 0; i < nTokenCount; i++ )
- {
- if( aFeatures.GetToken( i ).CompareToAscii( "pdf=", 4 ) == COMPARE_EQUAL )
- return 1;
- }
- return 0;
- }
- default: break;
- };
- return 0;
-}
-
-// =======================================================================
-
-/*
- * SalPrinter
- */
-
-SvpSalPrinter::SvpSalPrinter( SalInfoPrinter* pInfoPrinter )
- : m_bFax( false ),
- m_bPdf( false ),
- m_bSwallowFaxNo( false ),
- m_pGraphics( NULL ),
- m_nCopies( 1 ),
- m_bCollate( false ),
- m_pInfoPrinter( pInfoPrinter )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SvpSalPrinter::~SvpSalPrinter()
-{
-}
-
-// -----------------------------------------------------------------------
-
-static String getTmpName()
-{
- rtl::OUString aTmp, aSys;
- osl_createTempFile( NULL, NULL, &aTmp.pData );
- osl_getSystemPathFromFileURL( aTmp.pData, &aSys.pData );
-
- return aSys;
-}
-
-BOOL SvpSalPrinter::StartJob(
- const XubString* pFileName,
- const XubString& rJobName,
- const XubString& rAppName,
- ULONG nCopies,
- bool bCollate,
- bool /*bDirect*/,
- ImplJobSetup* pJobSetup )
-{
- SvpSalInstance::s_pDefaultInstance->jobStartedPrinterUpdate();
-
- m_bFax = false;
- m_bPdf = false;
- m_aFileName = pFileName ? *pFileName : String();
- m_aTmpFile = String();
- 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;
- const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) );
- sal_Int32 nIndex = 0;
- while( nIndex != -1 )
- {
- OUString aToken( rInfo.m_aFeatures.getToken( 0, ',', nIndex ) );
- if( ! aToken.compareToAscii( "fax", 3 ) )
- {
- m_bFax = true;
- m_aTmpFile = getTmpName();
- nMode = S_IRUSR | S_IWUSR;
-
- ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it;
- it = pJobSetup->maValueMap.find( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAX#")) );
- if( it != pJobSetup->maValueMap.end() )
- m_aFaxNr = it->second;
-
- sal_Int32 nPos = 0;
- m_bSwallowFaxNo = ! aToken.getToken( 1, '=', nPos ).compareToAscii( "swallow", 7 ) ? true : false;
-
- break;
- }
- if( ! aToken.compareToAscii( "pdf=", 4 ) )
- {
- m_bPdf = true;
- m_aTmpFile = getTmpName();
- nMode = S_IRUSR | S_IWUSR;
-
- if( ! m_aFileName.Len() )
- {
- m_aFileName = getPdfDir( rInfo );
- m_aFileName.Append( '/' );
- m_aFileName.Append( rJobName );
- m_aFileName.AppendAscii( ".pdf" );
- }
- break;
- }
- }
- m_aPrinterGfx.Init( m_aJobData );
-
- // set/clear backwards compatibility flag
- bool bStrictSO52Compatibility = false;
- std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it =
- pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictSO52Compatibility" ) ) );
- if( compat_it != pJobSetup->maValueMap.end() )
- {
- if( compat_it->second.equalsIgnoreAsciiCaseAscii( "true" ) )
- bStrictSO52Compatibility = true;
- }
- m_aPrinterGfx.setStrictSO52Compatibility( bStrictSO52Compatibility );
-
- return m_aPrintJob.StartJob( m_aTmpFile.Len() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, false ) ? TRUE : FALSE;
-}
-
-// -----------------------------------------------------------------------
-
-BOOL SvpSalPrinter::EndJob()
-{
- BOOL bSuccess = m_aPrintJob.EndJob();
-
- if( bSuccess )
- {
- // check for fax
- if( m_bFax )
- {
-
- const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) );
- // sendAFax removes the file after use
- bSuccess = sendAFax( m_aFaxNr, m_aTmpFile, rInfo.m_aCommand );
- }
- else if( m_bPdf )
- {
- const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) );
- bSuccess = createPdf( m_aFileName, m_aTmpFile, rInfo.m_aCommand );
- }
- }
- SvpSalInstance::s_pDefaultInstance->jobEndedPrinterUpdate();
- return bSuccess;
-}
-
-// -----------------------------------------------------------------------
-
-BOOL SvpSalPrinter::AbortJob()
-{
- BOOL bAbort = m_aPrintJob.AbortJob() ? TRUE : FALSE;
- SvpSalInstance::s_pDefaultInstance->jobEndedPrinterUpdate();
- return bAbort;
-}
-
-// -----------------------------------------------------------------------
-
-SalGraphics* SvpSalPrinter::StartPage( ImplJobSetup* pJobSetup, BOOL )
-{
- JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData );
- 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 );
-
- return m_pGraphics;
-}
-
-// -----------------------------------------------------------------------
-
-BOOL SvpSalPrinter::EndPage()
-{
- sal_Bool bResult = m_aPrintJob.EndPage();
- m_aPrinterGfx.Clear();
- return bResult ? TRUE : FALSE;
-}
-
-// -----------------------------------------------------------------------
-
-ULONG SvpSalPrinter::GetErrorCode()
-{
- return 0;
-}
-
/*
* svp::PrinterUpdate
*/
diff --git a/vcl/unx/headless/svpprn.hxx b/vcl/unx/headless/svpprn.hxx
index 0a7ae37..e1ad8a7 100644
--- a/vcl/unx/headless/svpprn.hxx
+++ b/vcl/unx/headless/svpprn.hxx
@@ -33,70 +33,27 @@
#include "vcl/printergfx.hxx"
#include "vcl/printerjob.hxx"
#include "vcl/salprn.hxx"
+#include "salprn.h"
class PspGraphics;
-class SvpSalInfoPrinter : public SalInfoPrinter
+class SvpSalInfoPrinter : public PspSalInfoPrinter
{
public:
- PspGraphics* m_pGraphics;
- psp::JobData m_aJobData;
- psp::PrinterGfx m_aPrinterGfx;
-
- SvpSalInfoPrinter();
- virtual ~SvpSalInfoPrinter();
-
- // overload all pure virtual methods
- virtual SalGraphics* GetGraphics();
- virtual void ReleaseGraphics( SalGraphics* pGraphics );
virtual BOOL Setup( SalFrame* pFrame, ImplJobSetup* pSetupData );
- virtual BOOL SetPrinterData( ImplJobSetup* pSetupData );
- virtual BOOL SetData( ULONG nFlags, ImplJobSetup* pSetupData );
- virtual void GetPageInfo( const ImplJobSetup* pSetupData,
- long& rOutWidth, long& rOutHeight,
- long& rPageOffX, long& rPageOffY,
- long& rPageWidth, long& rPageHeight );
- virtual ULONG GetCapabilities( const ImplJobSetup* pSetupData, USHORT nType );
- virtual ULONG GetPaperBinCount( const ImplJobSetup* pSetupData );
- virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin );
- virtual void InitPaperFormats( const ImplJobSetup* pSetupData );
- virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData );
};
-class SvpSalPrinter : public SalPrinter
+class SvpSalPrinter : public PspSalPrinter
{
public:
- String m_aFileName;
- String m_aTmpFile;
- String m_aFaxNr;
- bool m_bFax:1;
- bool m_bPdf:1;
- bool m_bSwallowFaxNo:1;
- PspGraphics* m_pGraphics;
- psp::PrinterJob m_aPrintJob;
- psp::JobData m_aJobData;
- psp::PrinterGfx m_aPrinterGfx;
- ULONG m_nCopies;
- bool m_bCollate;
- SalInfoPrinter* m_pInfoPrinter;
-
- SvpSalPrinter( SalInfoPrinter* );
- virtual ~SvpSalPrinter();
-
- // overload all pure virtual methods
- using SalPrinter::StartJob;
- virtual BOOL StartJob( const XubString* pFileName,
- const XubString& rJobName,
- const XubString& rAppName,
- ULONG nCopies,
- bool bCollate,
- bool bDirect,
- ImplJobSetup* pSetupData );
- virtual BOOL EndJob();
- virtual BOOL AbortJob();
- virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData );
- virtual BOOL EndPage();
- virtual ULONG GetErrorCode();
+ SvpSalPrinter( SalInfoPrinter* pInfoPrinter ) : PspSalPrinter(pInfoPrinter) {}
+
+ virtual BOOL StartJob( const XubString* pFileName, const XubString& rJobName,
+ const XubString& rAppName, ULONG nCopies, bool bCollate,
+ bool /*bDirect*/, ImplJobSetup* pSetupData )
+ {
+ return SvpSalPrinter::StartJob( pFileName, rJobName, rAppName, nCopies, bCollate, false, pSetupData );
+ }
};
#endif // _SVP_SVPPRN_HXX
diff --git a/vcl/unx/inc/salprn.h b/vcl/unx/inc/salprn.h
index 391463e..648a7dc 100644
--- a/vcl/unx/inc/salprn.h
+++ b/vcl/unx/inc/salprn.h
@@ -36,7 +36,7 @@
class PspGraphics;
-class PspSalInfoPrinter : public SalInfoPrinter
+class VCL_DLLPUBLIC PspSalInfoPrinter : public SalInfoPrinter
{
public:
PspGraphics* m_pGraphics;
@@ -63,7 +63,7 @@ public:
virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData );
};
-class PspSalPrinter : public SalPrinter
+class VCL_DLLPUBLIC PspSalPrinter : public SalPrinter
{
public:
String m_aFileName;
diff --git a/vcl/util/linksvp/makefile.mk b/vcl/util/linksvp/makefile.mk
index 86bbf50..d11aa2c 100644
--- a/vcl/util/linksvp/makefile.mk
+++ b/vcl/util/linksvp/makefile.mk
@@ -47,9 +47,12 @@ LIB1FILES= $(SLB)$/svpplug.lib \
SHL1TARGET=vclplug_svp$(DLLPOSTFIX)
SHL1IMPLIB=isvpplug
SHL1LIBS=$(LIB1TARGET)
-SHL1DEPN=$(LB)$/libvcl$(DLLPOSTFIX)$(DLLPOST)
+SHL1DEPN=\
+ $(LB)$/libvcl$(DLLPOSTFIX)$(DLLPOST) \
+ $(LB)$/libvclplug_gen$(DLLPOSTFIX)$(DLLPOST)
SHL1STDLIBS=\
$(VCLLIB)\
+ -lvclplug_gen$(DLLPOSTFIX) \
$(I18NPAPERLIB)\
$(BASEBMPLIB)\
$(BASEGFXLIB)\
commit 15d191ed79cd8f99af744101841bf6dd003ad888
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Dec 17 11:55:16 2010 +0000
rename the Svp printer stuff from PspSal to SvpSal
diff --git a/vcl/unx/headless/svpprn.cxx b/vcl/unx/headless/svpprn.cxx
index a113f1f..19a49ce 100644
--- a/vcl/unx/headless/svpprn.cxx
+++ b/vcl/unx/headless/svpprn.cxx
@@ -317,7 +317,7 @@ SalInfoPrinter* SvpSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueIn
ImplJobSetup* pJobSetup )
{
// create and initialize SalInfoPrinter
- PspSalInfoPrinter* pPrinter = new PspSalInfoPrinter;
+ SvpSalInfoPrinter* pPrinter = new SvpSalInfoPrinter;
if( pJobSetup )
{
@@ -362,8 +362,8 @@ void SvpSalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter )
SalPrinter* SvpSalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter )
{
// create and initialize SalPrinter
- PspSalPrinter* pPrinter = new PspSalPrinter( pInfoPrinter );
- pPrinter->m_aJobData = static_cast<PspSalInfoPrinter*>(pInfoPrinter)->m_aJobData;
+ SvpSalPrinter* pPrinter = new SvpSalPrinter( pInfoPrinter );
+ pPrinter->m_aJobData = static_cast<SvpSalInfoPrinter*>(pInfoPrinter)->m_aJobData;
return pPrinter;
}
@@ -438,7 +438,7 @@ String SvpSalInstance::GetDefaultPrinter()
// =======================================================================
-PspSalInfoPrinter::PspSalInfoPrinter()
+SvpSalInfoPrinter::SvpSalInfoPrinter()
{
m_pGraphics = NULL;
m_bPapersInit = false;
@@ -446,7 +446,7 @@ PspSalInfoPrinter::PspSalInfoPrinter()
// -----------------------------------------------------------------------
-PspSalInfoPrinter::~PspSalInfoPrinter()
+SvpSalInfoPrinter::~SvpSalInfoPrinter()
{
if( m_pGraphics )
{
@@ -457,7 +457,7 @@ PspSalInfoPrinter::~PspSalInfoPrinter()
// -----------------------------------------------------------------------
-void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
+void SvpSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
{
m_aPaperFormats.clear();
m_bPapersInit = true;
@@ -482,14 +482,14 @@ void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
// -----------------------------------------------------------------------
-int PspSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* )
+int SvpSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* )
{
return 900;
}
// -----------------------------------------------------------------------
-SalGraphics* PspSalInfoPrinter::GetGraphics()
+SalGraphics* SvpSalInfoPrinter::GetGraphics()
{
// return a valid pointer only once
// the reasoning behind this is that we could have different
@@ -507,7 +507,7 @@ SalGraphics* PspSalInfoPrinter::GetGraphics()
// -----------------------------------------------------------------------
-void PspSalInfoPrinter::ReleaseGraphics( SalGraphics* pGraphics )
+void SvpSalInfoPrinter::ReleaseGraphics( SalGraphics* pGraphics )
{
if( pGraphics == m_pGraphics )
{
@@ -519,7 +519,7 @@ void PspSalInfoPrinter::ReleaseGraphics( SalGraphics* pGraphics )
// -----------------------------------------------------------------------
-BOOL PspSalInfoPrinter::Setup( SalFrame*, ImplJobSetup* )
+BOOL SvpSalInfoPrinter::Setup( SalFrame*, ImplJobSetup* )
{
return FALSE;
}
@@ -531,7 +531,7 @@ BOOL PspSalInfoPrinter::Setup( SalFrame*, ImplJobSetup* )
// data should be merged into the driver data
// If pJobSetup->mpDriverData IS NULL, then the driver defaults
// should be merged into the independent data
-BOOL PspSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup )
+BOOL SvpSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup )
{
if( pJobSetup->mpDriverData )
return SetData( ~0, pJobSetup );
@@ -558,7 +558,7 @@ BOOL PspSalInfoPrinter::SetPrinterData( ImplJobSetup* pJobSetup )
// and sets the new independ data in pJobSetup
// Only the data must be changed, where the bit
// in nGetDataFlags is set
-BOOL PspSalInfoPrinter::SetData(
+BOOL SvpSalInfoPrinter::SetData(
ULONG nSetDataFlags,
ImplJobSetup* pJobSetup )
{
@@ -664,7 +664,7 @@ BOOL PspSalInfoPrinter::SetData(
// -----------------------------------------------------------------------
-void PspSalInfoPrinter::GetPageInfo(
+void SvpSalInfoPrinter::GetPageInfo(
const ImplJobSetup* pJobSetup,
long& rOutWidth, long& rOutHeight,
long& rPageOffX, long& rPageOffY,
@@ -708,7 +708,7 @@ void PspSalInfoPrinter::GetPageInfo(
// -----------------------------------------------------------------------
-ULONG PspSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup )
+ULONG SvpSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup )
{
if( ! pJobSetup )
return 0;
@@ -722,7 +722,7 @@ ULONG PspSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup )
// -----------------------------------------------------------------------
-String PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, ULONG nPaperBin )
+String SvpSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, ULONG nPaperBin )
{
JobData aData;
JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
@@ -746,7 +746,7 @@ String PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, ULONG
// -----------------------------------------------------------------------
-ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT nType )
+ULONG SvpSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT nType )
{
switch( nType )
{
@@ -814,7 +814,7 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT
* SalPrinter
*/
-PspSalPrinter::PspSalPrinter( SalInfoPrinter* pInfoPrinter )
+SvpSalPrinter::SvpSalPrinter( SalInfoPrinter* pInfoPrinter )
: m_bFax( false ),
m_bPdf( false ),
m_bSwallowFaxNo( false ),
@@ -827,7 +827,7 @@ PspSalPrinter::PspSalPrinter( SalInfoPrinter* pInfoPrinter )
// -----------------------------------------------------------------------
-PspSalPrinter::~PspSalPrinter()
+SvpSalPrinter::~SvpSalPrinter()
{
}
@@ -842,7 +842,7 @@ static String getTmpName()
return aSys;
}
-BOOL PspSalPrinter::StartJob(
+BOOL SvpSalPrinter::StartJob(
const XubString* pFileName,
const XubString& rJobName,
const XubString& rAppName,
@@ -926,7 +926,7 @@ BOOL PspSalPrinter::StartJob(
// -----------------------------------------------------------------------
-BOOL PspSalPrinter::EndJob()
+BOOL SvpSalPrinter::EndJob()
{
BOOL bSuccess = m_aPrintJob.EndJob();
@@ -952,7 +952,7 @@ BOOL PspSalPrinter::EndJob()
// -----------------------------------------------------------------------
-BOOL PspSalPrinter::AbortJob()
+BOOL SvpSalPrinter::AbortJob()
{
BOOL bAbort = m_aPrintJob.AbortJob() ? TRUE : FALSE;
SvpSalInstance::s_pDefaultInstance->jobEndedPrinterUpdate();
@@ -961,7 +961,7 @@ BOOL PspSalPrinter::AbortJob()
// -----------------------------------------------------------------------
-SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, BOOL )
+SalGraphics* SvpSalPrinter::StartPage( ImplJobSetup* pJobSetup, BOOL )
{
JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData );
m_pGraphics = new PspGraphics( &m_aJobData, &m_aPrinterGfx, m_bFax ? &m_aFaxNr : NULL, m_bSwallowFaxNo, m_pInfoPrinter );
@@ -982,7 +982,7 @@ SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, BOOL )
// -----------------------------------------------------------------------
-BOOL PspSalPrinter::EndPage()
+BOOL SvpSalPrinter::EndPage()
{
sal_Bool bResult = m_aPrintJob.EndPage();
m_aPrinterGfx.Clear();
@@ -991,7 +991,7 @@ BOOL PspSalPrinter::EndPage()
// -----------------------------------------------------------------------
-ULONG PspSalPrinter::GetErrorCode()
+ULONG SvpSalPrinter::GetErrorCode()
{
return 0;
}
diff --git a/vcl/unx/headless/svpprn.hxx b/vcl/unx/headless/svpprn.hxx
index 24ae203..0a7ae37 100644
--- a/vcl/unx/headless/svpprn.hxx
+++ b/vcl/unx/headless/svpprn.hxx
@@ -36,15 +36,15 @@
class PspGraphics;
-class PspSalInfoPrinter : public SalInfoPrinter
+class SvpSalInfoPrinter : public SalInfoPrinter
{
public:
PspGraphics* m_pGraphics;
psp::JobData m_aJobData;
psp::PrinterGfx m_aPrinterGfx;
- PspSalInfoPrinter();
- virtual ~PspSalInfoPrinter();
+ SvpSalInfoPrinter();
+ virtual ~SvpSalInfoPrinter();
// overload all pure virtual methods
virtual SalGraphics* GetGraphics();
@@ -63,7 +63,7 @@ public:
virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData );
};
-class PspSalPrinter : public SalPrinter
+class SvpSalPrinter : public SalPrinter
{
public:
String m_aFileName;
@@ -80,8 +80,8 @@ public:
bool m_bCollate;
SalInfoPrinter* m_pInfoPrinter;
- PspSalPrinter( SalInfoPrinter* );
- virtual ~PspSalPrinter();
+ SvpSalPrinter( SalInfoPrinter* );
+ virtual ~SvpSalPrinter();
// overload all pure virtual methods
using SalPrinter::StartJob;
commit 86cf96d8be4df788f7ed50e2da39b79f0ff8d29e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Dec 17 11:51:54 2010 +0000
Move the PrinterUpdate stuff to be SalInstance specific
diff --git a/vcl/inc/vcl/salinst.hxx b/vcl/inc/vcl/salinst.hxx
index 9fac6d4..cc9f90b 100644
--- a/vcl/inc/vcl/salinst.hxx
+++ b/vcl/inc/vcl/salinst.hxx
@@ -181,6 +181,11 @@ public:
virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDragSource();
virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget();
virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) = 0;
+
+ // callbacks for printer updates
+ virtual void updatePrinterUpdate() {}
+ virtual void jobStartedPrinterUpdate() {}
+ virtual void jobEndedPrinterUpdate() {}
};
// called from SVMain
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 9ed4385..cb8e542 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -2842,8 +2842,11 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
GTK_YIELD_GRAB();
+ X11SalInstance *pSalInstance =
+ static_cast< X11SalInstance* >(GetSalData()->m_pInstance);
+
// check if printers have changed (analogous to salframe focus handler)
- vcl_sal::PrinterUpdate::update();
+ pSalInstance->updatePrinterUpdate();
if( !pEvent->in )
{
@@ -2856,9 +2859,8 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
pThis->m_pIMHandler->focusChanged( pEvent->in );
// ask for changed printers like generic implementation
- if( pEvent->in )
- if( static_cast< X11SalInstance* >(GetSalData()->m_pInstance)->isPrinterInit() )
- vcl_sal::PrinterUpdate::update();
+ if( pEvent->in && pSalInstance->isPrinterInit() )
+ pSalInstance->updatePrinterUpdate();
// FIXME: find out who the hell steals the focus from our frame
// while we have the pointer grabbed, this should not come from
diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx
index ac4e936..1a8f21c 100644
--- a/vcl/unx/headless/svpinst.hxx
+++ b/vcl/unx/headless/svpinst.hxx
@@ -198,6 +198,10 @@ public:
virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes );
virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
+
+ virtual void updatePrinterUpdate();
+ virtual void jobStartedPrinterUpdate();
+ virtual void jobEndedPrinterUpdate();
};
#endif // _SV_SALINST_HXX
diff --git a/vcl/unx/headless/svpprn.cxx b/vcl/unx/headless/svpprn.cxx
index 5d7e67c..a113f1f 100644
--- a/vcl/unx/headless/svpprn.cxx
+++ b/vcl/unx/headless/svpprn.cxx
@@ -851,7 +851,7 @@ BOOL PspSalPrinter::StartJob(
bool /*bDirect*/,
ImplJobSetup* pJobSetup )
{
- vcl_sal::PrinterUpdate::jobStarted();
+ SvpSalInstance::s_pDefaultInstance->jobStartedPrinterUpdate();
m_bFax = false;
m_bPdf = false;
@@ -946,7 +946,7 @@ BOOL PspSalPrinter::EndJob()
bSuccess = createPdf( m_aFileName, m_aTmpFile, rInfo.m_aCommand );
}
}
- vcl_sal::PrinterUpdate::jobEnded();
+ SvpSalInstance::s_pDefaultInstance->jobEndedPrinterUpdate();
return bSuccess;
}
@@ -955,7 +955,7 @@ BOOL PspSalPrinter::EndJob()
BOOL PspSalPrinter::AbortJob()
{
BOOL bAbort = m_aPrintJob.AbortJob() ? TRUE : FALSE;
- vcl_sal::PrinterUpdate::jobEnded();
+ SvpSalInstance::s_pDefaultInstance->jobEndedPrinterUpdate();
return bAbort;
}
@@ -997,13 +997,29 @@ ULONG PspSalPrinter::GetErrorCode()
}
/*
- * vcl::PrinterUpdate
+ * svp::PrinterUpdate
*/
-Timer* vcl_sal::PrinterUpdate::pPrinterUpdateTimer = NULL;
-int vcl_sal::PrinterUpdate::nActiveJobs = 0;
+namespace svp
+{
+ class PrinterUpdate
+ {
+ static Timer* pPrinterUpdateTimer;
+ static int nActiveJobs;
+
+ static void doUpdate();
+ DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* );
+ public:
+ static void update();
+ static void jobStarted() { nActiveJobs++; }
+ static void jobEnded();
+ };
+}
-void vcl_sal::PrinterUpdate::doUpdate()
+Timer* svp::PrinterUpdate::pPrinterUpdateTimer = NULL;
+int svp::PrinterUpdate::nActiveJobs = 0;
+
+void svp::PrinterUpdate::doUpdate()
{
::psp::PrinterInfoManager& rManager( ::psp::PrinterInfoManager::get() );
if( rManager.checkPrintersChanged( false ) && SvpSalInstance::s_pDefaultInstance )
@@ -1017,7 +1033,7 @@ void vcl_sal::PrinterUpdate::doUpdate()
// -----------------------------------------------------------------------
-IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, )
+IMPL_STATIC_LINK_NOINSTANCE( svp::PrinterUpdate, UpdateTimerHdl, void*, )
{
if( nActiveJobs < 1 )
{
@@ -1033,7 +1049,7 @@ IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, )
// -----------------------------------------------------------------------
-void vcl_sal::PrinterUpdate::update()
+void svp::PrinterUpdate::update()
{
if( Application::GetSettings().GetMiscSettings().GetDisablePrinting() )
return;
@@ -1053,14 +1069,19 @@ void vcl_sal::PrinterUpdate::update()
{
pPrinterUpdateTimer = new Timer();
pPrinterUpdateTimer->SetTimeout( 500 );
- pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, vcl_sal::PrinterUpdate, UpdateTimerHdl ) );
+ pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, svp::PrinterUpdate, UpdateTimerHdl ) );
pPrinterUpdateTimer->Start();
}
}
+void SvpSalInstance::updatePrinterUpdate()
+{
+ svp::PrinterUpdate::update();
+}
+
// -----------------------------------------------------------------------
-void vcl_sal::PrinterUpdate::jobEnded()
+void svp::PrinterUpdate::jobEnded()
{
nActiveJobs--;
if( nActiveJobs < 1 )
@@ -1075,4 +1096,14 @@ void vcl_sal::PrinterUpdate::jobEnded()
}
}
+void SvpSalInstance::jobStartedPrinterUpdate()
+{
+ svp::PrinterUpdate::jobStarted();
+}
+
+void SvpSalInstance::jobEndedPrinterUpdate()
+{
+ svp::PrinterUpdate::jobEnded();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/headless/svpprn.hxx b/vcl/unx/headless/svpprn.hxx
index 7535917..24ae203 100644
--- a/vcl/unx/headless/svpprn.hxx
+++ b/vcl/unx/headless/svpprn.hxx
@@ -99,23 +99,6 @@ public:
virtual ULONG GetErrorCode();
};
-class Timer;
-
-namespace vcl_sal {
-class VCL_DLLPUBLIC PrinterUpdate
-{
- static Timer* pPrinterUpdateTimer;
- static int nActiveJobs;
-
- static void doUpdate();
- DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* );
-public:
- static void update();
- static void jobStarted() { nActiveJobs++; }
- static void jobEnded();
-};
-}
-
#endif // _SVP_SVPPRN_HXX
diff --git a/vcl/unx/inc/salinst.h b/vcl/unx/inc/salinst.h
index 1d74199..cd41043 100644
--- a/vcl/unx/inc/salinst.h
+++ b/vcl/unx/inc/salinst.h
@@ -117,6 +117,9 @@ public:
virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget();
virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
+ virtual void updatePrinterUpdate();
+ virtual void jobStartedPrinterUpdate();
+ virtual void jobEndedPrinterUpdate();
bool isPrinterInit() const
{
diff --git a/vcl/unx/inc/salprn.h b/vcl/unx/inc/salprn.h
index 6740534..391463e 100644
--- a/vcl/unx/inc/salprn.h
+++ b/vcl/unx/inc/salprn.h
@@ -99,23 +99,6 @@ public:
virtual ULONG GetErrorCode();
};
-class Timer;
-
-namespace vcl_sal {
-class VCL_DLLPUBLIC PrinterUpdate
-{
- static Timer* pPrinterUpdateTimer;
- static int nActiveJobs;
-
- static void doUpdate();
- DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* );
-public:
- static void update();
- static void jobStarted() { nActiveJobs++; }
- static void jobEnded();
-};
-}
-
#endif // _SV_SALPRN_H
diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx
index dbb43fa..16872f9 100644
--- a/vcl/unx/source/gdi/salprnpsp.cxx
+++ b/vcl/unx/source/gdi/salprnpsp.cxx
@@ -944,7 +944,7 @@ BOOL PspSalPrinter::StartJob(
bool bDirect,
ImplJobSetup* pJobSetup )
{
- vcl_sal::PrinterUpdate::jobStarted();
+ GetSalData()->m_pInstance->jobStartedPrinterUpdate();
m_bFax = false;
m_bPdf = false;
@@ -1040,7 +1040,7 @@ BOOL PspSalPrinter::EndJob()
bSuccess = createPdf( m_aFileName, m_aTmpFile, rInfo.m_aCommand );
}
}
- vcl_sal::PrinterUpdate::jobEnded();
+ GetSalData()->m_pInstance->jobEndedPrinterUpdate();
return bSuccess;
}
@@ -1049,7 +1049,7 @@ BOOL PspSalPrinter::EndJob()
BOOL PspSalPrinter::AbortJob()
{
BOOL bAbort = m_aPrintJob.AbortJob() ? TRUE : FALSE;
- vcl_sal::PrinterUpdate::jobEnded();
+ GetSalData()->m_pInstance->jobEndedPrinterUpdate();
return bAbort;
}
@@ -1090,14 +1090,30 @@ ULONG PspSalPrinter::GetErrorCode()
return 0;
}
+namespace x11
+{
+ class PrinterUpdate
+ {
+ static Timer* pPrinterUpdateTimer;
+ static int nActiveJobs;
+
+ static void doUpdate();
+ DECL_STATIC_LINK( PrinterUpdate, UpdateTimerHdl, void* );
+ public:
+ static void update(X11SalInstance &rInstance);
+ static void jobStarted() { nActiveJobs++; }
+ static void jobEnded();
+ };
+}
+
/*
- * vcl::PrinterUpdate
+ * x11::PrinterUpdate
*/
-Timer* vcl_sal::PrinterUpdate::pPrinterUpdateTimer = NULL;
-int vcl_sal::PrinterUpdate::nActiveJobs = 0;
+Timer* x11::PrinterUpdate::pPrinterUpdateTimer = NULL;
+int x11::PrinterUpdate::nActiveJobs = 0;
-void vcl_sal::PrinterUpdate::doUpdate()
+void x11::PrinterUpdate::doUpdate()
{
::psp::PrinterInfoManager& rManager( ::psp::PrinterInfoManager::get() );
if( rManager.checkPrintersChanged( false ) )
@@ -1112,7 +1128,7 @@ void vcl_sal::PrinterUpdate::doUpdate()
// -----------------------------------------------------------------------
-IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, EMPTYARG )
+IMPL_STATIC_LINK_NOINSTANCE( x11::PrinterUpdate, UpdateTimerHdl, void*, EMPTYARG )
{
if( nActiveJobs < 1 )
{
@@ -1128,12 +1144,12 @@ IMPL_STATIC_LINK_NOINSTANCE( vcl_sal::PrinterUpdate, UpdateTimerHdl, void*, EMPT
// -----------------------------------------------------------------------
-void vcl_sal::PrinterUpdate::update()
+void x11::PrinterUpdate::update(X11SalInstance &rInstance)
{
if( Application::GetSettings().GetMiscSettings().GetDisablePrinting() )
return;
- if( ! static_cast< X11SalInstance* >(GetSalData()->m_pInstance)->isPrinterInit() )
+ if( ! rInstance.isPrinterInit() )
{
// #i45389# start background printer detection
psp::PrinterInfoManager::get();
@@ -1146,14 +1162,24 @@ void vcl_sal::PrinterUpdate::update()
{
pPrinterUpdateTimer = new Timer();
pPrinterUpdateTimer->SetTimeout( 500 );
- pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, vcl_sal::PrinterUpdate, UpdateTimerHdl ) );
+ pPrinterUpdateTimer->SetTimeoutHdl( STATIC_LINK( NULL, x11::PrinterUpdate, UpdateTimerHdl ) );
pPrinterUpdateTimer->Start();
}
}
+void X11SalInstance::updatePrinterUpdate()
+{
+ x11::PrinterUpdate::update(*this);
+}
+
+void X11SalInstance::jobStartedPrinterUpdate()
+{
+ x11::PrinterUpdate::jobStarted();
+}
+
// -----------------------------------------------------------------------
-void vcl_sal::PrinterUpdate::jobEnded()
+void x11::PrinterUpdate::jobEnded()
{
nActiveJobs--;
if( nActiveJobs < 1 )
@@ -1168,4 +1194,9 @@ void vcl_sal::PrinterUpdate::jobEnded()
}
}
+void X11SalInstance::jobEndedPrinterUpdate()
+{
+ x11::PrinterUpdate::jobEnded();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx
index 839bd03..e033cfd 100644
--- a/vcl/unx/source/window/salframe.cxx
+++ b/vcl/unx/source/window/salframe.cxx
@@ -3500,7 +3500,7 @@ long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent )
if( FocusIn == pEvent->type )
{
#ifndef _USE_PRINT_EXTENSION_
- vcl_sal::PrinterUpdate::update();
+ GetSalData()->m_pInstance->updatePrinterUpdate();
#endif
mbInputFocus = True;
ImplSVData* pSVData = ImplGetSVData();
More information about the Libreoffice-commits
mailing list