1 --- oo_1.1rc3_src/psprint/source/helper/ppdparser.cxx.psprint-cups-PPD 2003-04-15 12:14:50.000000000 -0400
2 +++ oo_1.1rc3_src/psprint/source/helper/ppdparser.cxx 2003-08-25 07:27:23.000000000 -0400
10 #ifndef __SGI_STL_HASH_MAP
13 @@ -83,6 +86,9 @@ struct std::hash< const psp::PPDKey* >
14 #include <osl/file.hxx>
15 #include <osl/process.h>
16 #include <osl/thread.h>
17 +#include <tools/fsys.hxx>
18 +#include <rtl/bootstrap.hxx>
19 +#include <cups/cups.h>
21 #define PRINTER_PPDDIR "driver"
23 @@ -173,6 +179,52 @@ void PPDParser::initPPDFiles()
27 +static String GetPPDFileFromCUPS ( const String& rPrinter )
30 + const char *pPPDFile;
32 + // Try to get the PPD file from a CUPS server
33 + pPPDFile = cupsGetPPD( OString( rPrinter.GetBuffer(),
35 + RTL_TEXTENCODING_UTF8 ).getStr() );
37 + // If found, cache it immediately to the user psprint/drivers directory
40 + // Get user psprint directory name
41 + static OUString aUserPath;
42 + static bOnce = false;
48 + osl_getExecutableFile( &aIni.pData );
49 + aIni = aIni.copy( 0, aIni.lastIndexOf( SAL_PATHDELIMITER )+1 );
50 + aIni += OUString( RTL_CONSTASCII_USTRINGPARAM( SAL_CONFIGFILE( "bootstrap" ) ) );
51 + Bootstrap aBootstrap( aIni );
52 + aBootstrap.getFrom( OUString( RTL_CONSTASCII_USTRINGPARAM( "UserInstallation" ) ), aUserPath );
54 + if( ! aUserPath.compareToAscii( "file://", 7 ) )
55 + aUserPath = aUserPath.copy( 7 );
57 + // The directory is bound to exist since it is created at installation time
58 + aUserPath += OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/psprint/" PRINTER_PPDDIR "/" ) );
61 + // Copy and remove temporary PPD file
62 + DirEntry aSrcPath( String::CreateFromAscii( pPPDFile ) );
63 + DirEntry aDstPath( aUserPath + rPrinter + String::CreateFromAscii( ".PPD" ) );
64 + aSrcPath.CopyTo( aDstPath, FSYS_ACTION_COPYFILE );
67 + aPPDFile = aDstPath.GetFull();
73 String PPDParser::getPPDFile( const String& rFile )
75 INetURLObject aPPD( rFile, INET_PROT_FILE, INetURLObject::ENCODE_ALL );
76 @@ -195,6 +247,17 @@ String PPDParser::getPPDFile( const Stri
77 if( it != pAllPPDFiles->end() )
78 aStream.Open( it->second, STREAM_READ );
80 + if ( ! aStream.IsOpen() )
82 + // Try to get the PPD file from a CUPS server
83 + String aFile( GetPPDFileFromCUPS( rFile ) );
87 + aPPD = INetURLObject( aFile, INET_PROT_FILE, INetURLObject::ENCODE_ALL );
88 + aStream.Open( aPPD.PathToFileName(), STREAM_READ );
93 if( aStream.IsOpen() )
94 --- oo_1.1rc3_src/psprint/source/printer/printerinfomanager.cxx.psprint-cups-PPD 2003-08-25 07:29:03.000000000 -0400
95 +++ oo_1.1rc3_src/psprint/source/printer/printerinfomanager.cxx 2003-08-25 07:24:49.000000000 -0400
96 @@ -536,6 +536,37 @@ void PrinterInfoManager::initialize()
97 aPrinter.m_bModified = false;
98 aPrinter.m_aGroup = ByteString( aPrinterName, aEncoding ); //provide group name in case user makes this one permanent in padmin
100 + const PPDParser* pParser = PPDParser::getParser( *it );
103 + aPrinter.m_bModified = true;
104 + aPrinter.m_aInfo.m_aDriverName = *it;
105 + aPrinter.m_aInfo.m_pParser = pParser;
106 + aPrinter.m_aInfo.m_aContext.setParser( pParser );
108 + fillFontSubstitutions( aPrinter.m_aInfo );
109 + // merge PPD values with merge defaults
110 + for( int nPPDValueModified = 0; nPPDValueModified < aMergeInfo.m_aContext.countValuesModified(); nPPDValueModified++ )
112 + const PPDKey* pDefKey = aMergeInfo.m_aContext.getModifiedKey( nPPDValueModified );
113 + const PPDValue* pDefValue = aMergeInfo.m_aContext.getValue( pDefKey );
114 + const PPDKey* pPrinterKey = pDefKey ? aPrinter.m_aInfo.m_pParser->getKey( pDefKey->getKey() ) : NULL;
115 + if( pDefKey && pPrinterKey )
116 + // at least the options exist in both PPDs
120 + const PPDValue* pPrinterValue = pPrinterKey->getValue( pDefValue->m_aOption );
121 + if( pPrinterValue )
122 + // the printer has a corresponding option for the key
123 + aPrinter.m_aInfo.m_aContext.setValue( pPrinterKey, pPrinterValue );
126 + aPrinter.m_aInfo.m_aContext.setValue( pPrinterKey, NULL );
131 m_aPrinters[ aPrinterName ] = aPrinter;
134 --- oo_1.1rc3_src/psprint/util/makefile.mk.orig 2004-03-30 02:07:00.000000000 +0000
135 +++ oo_1.1rc3_src/psprint/util/makefile.mk 2004-03-30 02:07:14.000000000 +0000
137 SHL1STDLIBS=$(UNOTOOLSLIB) \
142 .IF "$(SOLAR_JAVA)"!=""
143 SHL1STDLIBS+=$(JVMACCESSLIB)