diff options
-rw-r--r-- | include/vcl/ppdparser.hxx | 70 | ||||
-rw-r--r-- | padmin/source/padialog.cxx | 2 | ||||
-rw-r--r-- | padmin/source/prtsetup.cxx | 8 | ||||
-rw-r--r-- | vcl/generic/print/genprnpsp.cxx | 8 | ||||
-rw-r--r-- | vcl/generic/print/printerjob.cxx | 8 | ||||
-rw-r--r-- | vcl/headless/svpprn.cxx | 8 | ||||
-rw-r--r-- | vcl/unx/generic/printer/cupsmgr.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/printer/ppdparser.cxx | 232 | ||||
-rw-r--r-- | vcl/unx/generic/printer/printerinfomanager.cxx | 2 |
9 files changed, 170 insertions, 170 deletions
diff --git a/include/vcl/ppdparser.hxx b/include/vcl/ppdparser.hxx index 80fbeaf4728a..6ced633f31d9 100644 --- a/include/vcl/ppdparser.hxx +++ b/include/vcl/ppdparser.hxx @@ -43,8 +43,8 @@ enum PPDValueType { eInvocation, eQuoted, eSymbol, eString, eNo }; struct VCL_DLLPUBLIC PPDValue { PPDValueType m_eType; - String m_aOption; - String m_aValue; + OUString m_aOption; + OUString m_aValue; }; // ---------------------------------------------------------------------- @@ -60,7 +60,7 @@ class VCL_DLLPUBLIC PPDKey typedef ::boost::unordered_map< OUString, PPDValue, OUStringHash > hash_type; typedef ::std::vector< PPDValue* > value_type; - String m_aKey; + OUString m_aKey; hash_type m_aValues; value_type m_aOrderedValues; const PPDValue* m_pDefaultValue; @@ -77,22 +77,22 @@ private: int m_nOrderDependency; SetupType m_eSetupType; - void eraseValue( const String& rOption ); + void eraseValue( const OUString& rOption ); public: - PPDKey( const String& rKey ); + PPDKey( const OUString& rKey ); ~PPDKey(); - PPDValue* insertValue( const String& rOption ); + PPDValue* insertValue( const OUString& rOption ); int countValues() const { return m_aValues.size(); } // neither getValue will return the query option - const PPDValue* getValue( int n ) const; - const PPDValue* getValue( const String& rOption ) const; - const PPDValue* getValueCaseInsensitive( const String& rOption ) const; - const PPDValue* getDefaultValue() const { return m_pDefaultValue; } + const PPDValue* getValue( int n ) const; + const PPDValue* getValue( const OUString& rOption ) const; + const PPDValue* getValueCaseInsensitive( const OUString& rOption ) const; + const PPDValue* getDefaultValue() const { return m_pDefaultValue; } const PPDValue* getQueryValue() const { return m_bQueryValue ? &m_aQueryValue : NULL; } - const String& getKey() const { return m_aKey; } + const OUString& getKey() const { return m_aKey; } bool isUIKey() const { return m_bUIOption; } UIType getUIType() const { return m_eUIType; } SetupType getSetupType() const { return m_eSetupType; } @@ -124,7 +124,7 @@ class VCL_DLLPUBLIC PPDParser typedef ::boost::unordered_map< OUString, PPDKey*, OUStringHash > hash_type; typedef ::std::vector< PPDKey* > value_type; - void insertKey( const String& rKey, PPDKey* pKey ); + void insertKey( const OUString& rKey, PPDKey* pKey ); public: struct PPDConstraint { @@ -141,10 +141,10 @@ private: ::std::list< PPDConstraint > m_aConstraints; // some identifying fields - String m_aPrinterName; - String m_aNickName; + OUString m_aPrinterName; + OUString m_aNickName; // the full path of the PPD file - String m_aFile; + OUString m_aFile; // some basic attributes bool m_bColorDevice; bool m_bType42Capable; @@ -175,7 +175,7 @@ private: // translations PPDTranslator* m_pTranslator; - PPDParser( const String& rFile ); + PPDParser( const OUString& rFile ); ~PPDParser(); void parseOrderDependency(const OString& rLine); @@ -183,39 +183,39 @@ private: void parseConstraint(const OString& rLine); void parse( std::list< OString >& rLines ); - String handleTranslation(const OString& i_rString, bool i_bIsGlobalized); + OUString handleTranslation(const OString& i_rString, bool i_bIsGlobalized); - static void scanPPDDir( const String& rDir ); + static void scanPPDDir( const OUString& rDir ); static void initPPDFiles(); - static String getPPDFile( const String& rFile ); + static OUString getPPDFile( const OUString& rFile ); public: - static const PPDParser* getParser( const String& rFile ); - static String getPPDPrinterName( const String& rFile ); + static const PPDParser* getParser( const OUString& rFile ); + static OUString getPPDPrinterName( const OUString& rFile ); static void freeAll(); static void getKnownPPDDrivers( std::list< OUString >& o_rDrivers, bool bRefresh = false ); - const String& getFilename() const { return m_aFile; } + const OUString& getFilename() const { return m_aFile; } const PPDKey* getKey( int n ) const; - const PPDKey* getKey( const String& rKey ) const; + const PPDKey* getKey( const OUString& rKey ) const; int getKeys() const { return m_aKeys.size(); } bool hasKey( const PPDKey* ) const; const ::std::list< PPDConstraint >& getConstraints() const { return m_aConstraints; } - const String& getPrinterName() const - { return m_aPrinterName.Len() ? m_aPrinterName : m_aNickName; } - const String& getNickName() const - { return m_aNickName.Len() ? m_aNickName : m_aPrinterName; } + const OUString& getPrinterName() const + { return m_aPrinterName.isEmpty() ? m_aNickName : m_aPrinterName; } + const OUString& getNickName() const + { return m_aNickName.isEmpty() ? m_aPrinterName : m_aNickName; } bool isColorDevice() const { return m_bColorDevice; } bool isType42Capable() const { return m_bType42Capable; } - sal_uLong getLanguageLevel() const { return m_nLanguageLevel; } + sal_uLong getLanguageLevel() const { return m_nLanguageLevel; } - String getDefaultPaperDimension() const; + OUString getDefaultPaperDimension() const; void getDefaultPaperDimension( int& rWidth, int& rHeight ) const { getPaperDimension( getDefaultPaperDimension(), rWidth, rHeight ); } - bool getPaperDimension( const String& rPaperName, + bool getPaperDimension( const OUString& rPaperName, int& rWidth, int& rHeight ) const; // width and height in pt // returns false if paper not found @@ -223,9 +223,9 @@ public: { return m_pPaperDimensions ? m_pPaperDimensions->countValues() : 0; } // match the best paper for width and height - String matchPaper( int nWidth, int nHeight ) const; + OUString matchPaper( int nWidth, int nHeight ) const; - bool getMargins( const String& rPaperName, + bool getMargins( const OUString& rPaperName, int &rLeft, int& rRight, int &rUpper, int& rLower ) const; // values in pt @@ -233,13 +233,13 @@ public: // values int pt - String getDefaultInputSlot() const; + OUString getDefaultInputSlot() const; int getInputSlots() const { return m_pInputSlots ? m_pInputSlots->countValues() : 0; } void getDefaultResolution( int& rXRes, int& rYRes ) const; // values in dpi - void getResolutionFromString( const String&, int&, int& ) const; + void getResolutionFromString( const OUString&, int&, int& ) const; // helper function int getDuplexTypes() const @@ -247,7 +247,7 @@ public: int getFonts() const { return m_pFontList ? m_pFontList->countValues() : 0; } - String getFont( int ) const; + OUString getFont( int ) const; OUString translateKey( const OUString& i_rKey, diff --git a/padmin/source/padialog.cxx b/padmin/source/padialog.cxx index 5bf769a5d48c..9327d1eed1dd 100644 --- a/padmin/source/padialog.cxx +++ b/padmin/source/padialog.cxx @@ -455,7 +455,7 @@ void SpaPrinterController::printPage( int ) const if( pPrintParser ) aPrintText.append( pPrintParser->getPrinterName() ); aPrintText.appendAscii( "\n: " ); - INetURLObject aDriverPath( pPrintParser ? pPrintParser->getFilename() : String( "<undef>" ), + INetURLObject aDriverPath( pPrintParser ? pPrintParser->getFilename() : OUString( "<undef>" ), INET_PROT_FILE, INetURLObject::ENCODE_ALL ); aPrintText.append( aDriverPath.GetName() ); aPrintText.appendAscii( "\n: " ); diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx index 5ee49581c1da..c82a2375c915 100644 --- a/padmin/source/prtsetup.cxx +++ b/padmin/source/prtsetup.cxx @@ -389,10 +389,10 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent ) { const PPDKey* pKey = m_pParent->m_aJobData.m_pParser->getKey( i ); if( pKey->isUIKey() && - ! pKey->getKey().EqualsAscii( "PageSize" ) && - ! pKey->getKey().EqualsAscii( "InputSlot" ) && - ! pKey->getKey().EqualsAscii( "PageRegion" ) && - ! pKey->getKey().EqualsAscii( "Duplex" ) + ! pKey->getKey().equalsAscii( "PageSize" ) && + ! pKey->getKey().equalsAscii( "InputSlot" ) && + ! pKey->getKey().equalsAscii( "PageRegion" ) && + ! pKey->getKey().equalsAscii( "Duplex" ) ) { String aEntry( m_pParent->m_aJobData.m_pParser->translateKey( pKey->getKey() ) ); diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx index 25f0162143fe..62e7b79af2e8 100644 --- a/vcl/generic/print/genprnpsp.cxx +++ b/vcl/generic/print/genprnpsp.cxx @@ -183,17 +183,17 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) pValue = rData.m_aContext.getValue( pKey ); if( pKey && pValue ) { - if( pValue->m_aOption.EqualsIgnoreCaseAscii( "None" ) || - pValue->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 ) + if( pValue->m_aOption.equalsIgnoreAsciiCase( "None" ) || + pValue->m_aOption.startsWithIgnoreAsciiCase( "Simplex" ) ) { pJobSetup->meDuplexMode = DUPLEX_OFF; } - else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexNoTumble" ) ) + else if( pValue->m_aOption.equalsIgnoreAsciiCase( "DuplexNoTumble" ) ) { pJobSetup->meDuplexMode = DUPLEX_LONGEDGE; } - else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexTumble" ) ) + else if( pValue->m_aOption.equalsIgnoreAsciiCase( "DuplexTumble" ) ) { pJobSetup->meDuplexMode = DUPLEX_SHORTEDGE; } diff --git a/vcl/generic/print/printerjob.cxx b/vcl/generic/print/printerjob.cxx index 04c1739e601d..2af8923af271 100644 --- a/vcl/generic/print/printerjob.cxx +++ b/vcl/generic/print/printerjob.cxx @@ -760,9 +760,9 @@ bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool b if( GetPostscriptLevel( &rJob ) == 1 ) { bool bHavePS2 = - ( pValue->m_aValue.SearchAscii( "<<" ) != STRING_NOTFOUND ) + ( pValue->m_aValue.indexOf( "<<" ) != -1 ) || - ( pValue->m_aValue.SearchAscii( ">>" ) != STRING_NOTFOUND ); + ( pValue->m_aValue.indexOf( ">>" ) != -1 ); if( bHavePS2 ) continue; } @@ -843,8 +843,8 @@ void PrinterJob::writeJobPatch( osl::File* pFile, const JobData& rJobData ) for( int i = 0; i < nValueCount; i++ ) { const PPDValue* pVal = pKey->getValue( i ); - patch_order.push_back( pVal->m_aOption.ToInt32() ); - if( patch_order.back() == 0 && ! pVal->m_aOption.EqualsAscii( "0" ) ) + patch_order.push_back( pVal->m_aOption.toInt32() ); + if( patch_order.back() == 0 && ! pVal->m_aOption.equalsAscii( "0" ) ) { WritePS( pFile, "% Warning: left out JobPatchFile option \"" ); OString aOption = OUStringToOString( pVal->m_aOption, RTL_TEXTENCODING_ASCII_US ); diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx index b6a664839259..6ecba235d5e9 100644 --- a/vcl/headless/svpprn.cxx +++ b/vcl/headless/svpprn.cxx @@ -122,17 +122,17 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) pValue = rData.m_aContext.getValue( pKey ); if( pKey && pValue ) { - if( pValue->m_aOption.EqualsIgnoreCaseAscii( "None" ) || - pValue->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 ) + if( pValue->m_aOption.equalsIgnoreAsciiCase( "None" ) || + pValue->m_aOption.startsWithIgnoreAsciiCase( "Simplex" ) ) { pJobSetup->meDuplexMode = DUPLEX_OFF; } - else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexNoTumble" ) ) + else if( pValue->m_aOption.equalsIgnoreAsciiCase( "DuplexNoTumble" ) ) { pJobSetup->meDuplexMode = DUPLEX_LONGEDGE; } - else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexTumble" ) ) + else if( pValue->m_aOption.equalsIgnoreAsciiCase( "DuplexTumble" ) ) { pJobSetup->meDuplexMode = DUPLEX_SHORTEDGE; } diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index fe163bb4b35a..8510196462b1 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -618,7 +618,7 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner { const PPDKey* pKey = aKeys[i]; const PPDValue* pValue = rJob.m_aContext.getValue( pKey ); - if(pValue && pValue->m_eType == eInvocation && pValue->m_aValue.Len() ) + if(pValue && pValue->m_eType == eInvocation && !pValue->m_aValue.isEmpty() ) { OString aKey = OUStringToOString( pKey->getKey(), RTL_TEXTENCODING_ASCII_US ); OString aValue = OUStringToOString( pValue->m_aOption, RTL_TEXTENCODING_ASCII_US ); diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index a8eeb2a95016..10e5a354517c 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -399,7 +399,7 @@ static osl::FileBase::RC resolveLink( const OUString& i_rURL, OUString& o_rResol return aRet; } -void PPDParser::scanPPDDir( const String& rDir ) +void PPDParser::scanPPDDir( const OUString& rDir ) { static struct suffix_t { @@ -423,7 +423,7 @@ void PPDParser::scanPPDDir( const String& rDir ) osl::FileStatus aStatus( osl_FileStatus_Mask_FileName ); if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None ) { - OUStringBuffer aURLBuf( rDir.Len() + 64 ); + OUStringBuffer aURLBuf( rDir.getLength() + 64 ); aURLBuf.append( rDir ); aURLBuf.append( sal_Unicode( '/' ) ); aURLBuf.append( aStatus.getFileName() ); @@ -515,7 +515,7 @@ void PPDParser::getKnownPPDDrivers( std::list< OUString >& o_rDrivers, bool bRef o_rDrivers.push_back( it->first ); } -String PPDParser::getPPDFile( const String& rFile ) +OUString PPDParser::getPPDFile( const OUString& rFile ) { INetURLObject aPPD( rFile, INET_PROT_FILE, INetURLObject::ENCODE_ALL ); // someone might enter a full qualified name here @@ -557,7 +557,7 @@ String PPDParser::getPPDFile( const String& rFile ) aStream.Open( it->second ); } - String aRet; + OUString aRet; if( aStream.IsOpen() ) { OString aLine = aStream.ReadLine(); @@ -578,23 +578,23 @@ String PPDParser::getPPDFile( const String& rFile ) return aRet; } -String PPDParser::getPPDPrinterName( const String& rFile ) +OUString PPDParser::getPPDPrinterName( const OUString& rFile ) { - String aPath = getPPDFile( rFile ); - String aName; + OUString aPath = getPPDFile( rFile ); + OUString aName; // read in the file PPDDecompressStream aStream( aPath ); if( aStream.IsOpen() ) { - String aCurLine; + OUString aCurLine; while( ! aStream.IsEof() && aStream.IsOpen() ) { OString aByteLine = aStream.ReadLine(); aCurLine = OStringToOUString(aByteLine, RTL_TEXTENCODING_MS_1252); - if( aCurLine.CompareIgnoreCaseToAscii( "*include:", 9 ) == COMPARE_EQUAL ) + if( aCurLine.startsWithIgnoreAsciiCase( "*include:" ) ) { - aCurLine.Erase( 0, 9 ); + aCurLine.replaceAt( 0, 9, "" ); aCurLine = comphelper::string::stripStart(aCurLine, ' '); aCurLine = comphelper::string::stripEnd(aCurLine, ' '); aCurLine = comphelper::string::stripStart(aCurLine, '\t'); @@ -607,27 +607,27 @@ String PPDParser::getPPDPrinterName( const String& rFile ) aStream.Open( getPPDFile( aCurLine ) ); continue; } - if( aCurLine.CompareToAscii( "*ModelName:", 11 ) == COMPARE_EQUAL ) + if( aCurLine.startsWith( "*ModelName:" ) ) { - aName = aCurLine.GetToken( 1, '"' ); + aName = aCurLine.getToken( 1, '"' ); break; } - else if( aCurLine.CompareToAscii( "*NickName:", 10 ) == COMPARE_EQUAL ) - aName = aCurLine.GetToken( 1, '"' ); + else if( aCurLine.startsWith( "*NickName:" ) ) + aName = aCurLine.getToken( 1, '"' ); } } return aName; } -const PPDParser* PPDParser::getParser( const String& rFile ) +const PPDParser* PPDParser::getParser( const OUString& rFile ) { static ::osl::Mutex aMutex; ::osl::Guard< ::osl::Mutex > aGuard( aMutex ); - String aFile = rFile; - if( rFile.CompareToAscii( "CUPS:", 5 ) != COMPARE_EQUAL ) + OUString aFile = rFile; + if( !rFile.startsWith( "CUPS:" ) ) aFile = getPPDFile( rFile ); - if( ! aFile.Len() ) + if( aFile.isEmpty() ) { #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "Could not get printer PPD file \"%s\" !\n", OUStringToOString( rFile, osl_getThreadTextEncoding() ).getStr() ); @@ -641,7 +641,7 @@ const PPDParser* PPDParser::getParser( const String& rFile ) return *it; PPDParser* pNewParser = NULL; - if( aFile.CompareToAscii( "CUPS:", 5 ) != COMPARE_EQUAL ) + if( !aFile.startsWith( "CUPS:" ) ) pNewParser = new PPDParser( aFile ); else { @@ -664,7 +664,7 @@ const PPDParser* PPDParser::getParser( const String& rFile ) return pNewParser; } -PPDParser::PPDParser( const String& rFile ) : +PPDParser::PPDParser( const OUString& rFile ) : m_aFile( rFile ), m_bType42Capable( false ), m_aFileEncoding( RTL_TEXTENCODING_MS_1252 ), @@ -792,7 +792,7 @@ PPDParser::PPDParser( const String& rFile ) : // fill in shortcuts const PPDKey* pKey; - m_pImageableAreas = getKey( String( RTL_CONSTASCII_USTRINGPARAM( "ImageableArea" ) ) ); + m_pImageableAreas = getKey( OUString( "ImageableArea" ) ); if( m_pImageableAreas ) m_pDefaultImageableArea = m_pImageableAreas->getDefaultValue(); if (m_pImageableAreas == 0) { @@ -806,7 +806,7 @@ PPDParser::PPDParser( const String& rFile ) : OUStringToOString(m_aFile, RTL_TEXTENCODING_UTF8).getStr()); } - m_pPaperDimensions = getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PaperDimension" ) ) ); + m_pPaperDimensions = getKey( OUString( "PaperDimension" ) ); if( m_pPaperDimensions ) m_pDefaultPaperDimension = m_pPaperDimensions->getDefaultValue(); if (m_pPaperDimensions == 0) { @@ -820,7 +820,7 @@ PPDParser::PPDParser( const String& rFile ) : OUStringToOString(m_aFile, RTL_TEXTENCODING_UTF8).getStr()); } - m_pResolutions = getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Resolution" ) ) ); + m_pResolutions = getKey( OUString( "Resolution" ) ); if( m_pResolutions ) m_pDefaultResolution = m_pResolutions->getDefaultValue(); if (m_pResolutions == 0) { @@ -834,7 +834,7 @@ PPDParser::PPDParser( const String& rFile ) : OUStringToOString(m_aFile, RTL_TEXTENCODING_UTF8).getStr()); } - m_pInputSlots = getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) ); + m_pInputSlots = getKey( OUString( "InputSlot" ) ); if( m_pInputSlots ) m_pDefaultInputSlot = m_pInputSlots->getDefaultValue(); if (m_pInputSlots == 0) { @@ -848,11 +848,11 @@ PPDParser::PPDParser( const String& rFile ) : OUStringToOString(m_aFile, RTL_TEXTENCODING_UTF8).getStr()); } - m_pDuplexTypes = getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) ); + m_pDuplexTypes = getKey( OUString( "Duplex" ) ); if( m_pDuplexTypes ) m_pDefaultDuplexType = m_pDuplexTypes->getDefaultValue(); - m_pFontList = getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Font" ) ) ); + m_pFontList = getKey( OUString( "Font" ) ); if (m_pFontList == 0) { OSL_TRACE( OSL_LOG_PREFIX "Warning: no Font in %s\n", @@ -860,17 +860,17 @@ PPDParser::PPDParser( const String& rFile ) : } // fill in direct values - if( (pKey = getKey( String( RTL_CONSTASCII_USTRINGPARAM( "ModelName" ) ) )) ) + if( (pKey = getKey( OUString( "ModelName" ) )) ) m_aPrinterName = pKey->getValue( 0 )->m_aValue; - if( (pKey = getKey( String( RTL_CONSTASCII_USTRINGPARAM( "NickName" ) ) )) ) + if( (pKey = getKey( OUString( "NickName" ) )) ) m_aNickName = pKey->getValue( 0 )->m_aValue; - if( (pKey = getKey( String( RTL_CONSTASCII_USTRINGPARAM( "ColorDevice" ) ) )) ) - m_bColorDevice = pKey->getValue( 0 )->m_aValue.CompareIgnoreCaseToAscii( "true", 4 ) == COMPARE_EQUAL ? true : false; + if( (pKey = getKey( OUString( "ColorDevice" ) )) ) + m_bColorDevice = pKey->getValue( 0 )->m_aValue.startsWithIgnoreAsciiCase( "true" ); - if( (pKey = getKey( String( RTL_CONSTASCII_USTRINGPARAM( "LanguageLevel" ) ) )) ) - m_nLanguageLevel = pKey->getValue( 0 )->m_aValue.ToInt32(); - if( (pKey = getKey( String( RTL_CONSTASCII_USTRINGPARAM( "TTRasterizer" ) ) )) ) - m_bType42Capable = pKey->getValue( 0 )->m_aValue.EqualsIgnoreCaseAscii( "Type42" ) ? true : false; + if( (pKey = getKey( OUString( "LanguageLevel" ) )) ) + m_nLanguageLevel = pKey->getValue( 0 )->m_aValue.toInt32(); + if( (pKey = getKey( OUString( "TTRasterizer" ) )) ) + m_bType42Capable = pKey->getValue( 0 )->m_aValue.equalsIgnoreAsciiCase( "Type42" ); } PPDParser::~PPDParser() @@ -880,7 +880,7 @@ PPDParser::~PPDParser() delete m_pTranslator; } -void PPDParser::insertKey( const String& rKey, PPDKey* pKey ) +void PPDParser::insertKey( const OUString& rKey, PPDKey* pKey ) { m_aKeys[ rKey ] = pKey; m_aOrderedKeys.push_back( pKey ); @@ -891,7 +891,7 @@ const PPDKey* PPDParser::getKey( int n ) const return ((unsigned int)n < m_aOrderedKeys.size() && n >= 0) ? m_aOrderedKeys[n] : NULL; } -const PPDKey* PPDParser::getKey( const String& rKey ) const +const PPDKey* PPDParser::getKey( const OUString& rKey ) const { PPDParser::hash_type::const_iterator it = m_aKeys.find( rKey ); return it != m_aKeys.end() ? it->second : NULL; @@ -917,7 +917,7 @@ static sal_uInt8 getNibble( sal_Char cChar ) return nRet; } -String PPDParser::handleTranslation(const OString& i_rString, bool bIsGlobalized) +OUString PPDParser::handleTranslation(const OString& i_rString, bool bIsGlobalized) { sal_Int32 nOrigLen = i_rString.getLength(); OStringBuffer aTrans( nOrigLen ); @@ -970,7 +970,7 @@ void PPDParser::parse( ::std::list< OString >& rLines ) if( aCurrentLine[1] == '%' ) continue; - OString aKey = GetCommandLineToken( 0, comphelper::string::getToken(aCurrentLine, 0, ':') ); + OString aKey = GetCommandLineToken( 0, aCurrentLine.getToken(0, ':') ); sal_Int32 nPos = aKey.indexOf('/'); if (nPos != -1) aKey = aKey.copy(0, nPos); @@ -1017,45 +1017,45 @@ void PPDParser::parse( ::std::list< OString >& rLines ) bQuery = true; } - String aUniKey(OStringToOUString(aKey, RTL_TEXTENCODING_MS_1252)); + OUString aUniKey(OStringToOUString(aKey, RTL_TEXTENCODING_MS_1252)); // handle CUPS extension for globalized PPDs /* FIXME-BCP47: really only ISO 639-1 two character language codes? * goodnight.. */ bool bIsGlobalizedLine = false; com::sun::star::lang::Locale aTransLocale; - if( ( aUniKey.Len() > 3 && aUniKey.GetChar( 2 ) == '.' ) || - ( aUniKey.Len() > 5 && aUniKey.GetChar( 2 ) == '_' && aUniKey.GetChar( 5 ) == '.' ) ) + if( ( aUniKey.getLength() > 3 && aUniKey[ 2 ] == '.' ) || + ( aUniKey.getLength() > 5 && aUniKey[ 2 ] == '_' && aUniKey[ 5 ] == '.' ) ) { - if( aUniKey.GetChar( 2 ) == '.' ) + if( aUniKey[ 2 ] == '.' ) { - aTransLocale.Language = aUniKey.Copy( 0, 2 ); - aUniKey = aUniKey.Copy( 3 ); + aTransLocale.Language = aUniKey.copy( 0, 2 ); + aUniKey = aUniKey.copy( 3 ); } else { - aTransLocale.Language = aUniKey.Copy( 0, 2 ); - aTransLocale.Country = aUniKey.Copy( 3, 2 ); - aUniKey = aUniKey.Copy( 6 ); + aTransLocale.Language = aUniKey.copy( 0, 2 ); + aTransLocale.Country = aUniKey.copy( 3, 2 ); + aUniKey = aUniKey.copy( 6 ); } bIsGlobalizedLine = true; } - String aOption; + OUString aOption; nPos = aCurrentLine.indexOf(':'); if( nPos != -1 ) { aOption = OStringToOUString( aCurrentLine.copy( 1, nPos-1 ), RTL_TEXTENCODING_MS_1252 ); aOption = GetCommandLineToken( 1, aOption ); - int nTransPos = aOption.Search( '/' ); - if( nTransPos != STRING_NOTFOUND ) - aOption.Erase( nTransPos ); + sal_Int32 nTransPos = aOption.indexOf( '/' ); + if( nTransPos != -1 ) + aOption = aOption.replaceAt( nTransPos, 1, "" ); } PPDValueType eType = eNo; - String aValue; + OUString aValue; OUString aOptionTranslation; OUString aValueTranslation; - if( nPos != STRING_NOTFOUND ) + if( nPos != -1 ) { // found a colon, there may be an option OString aLine = aCurrentLine.copy( 1, nPos-1 ); @@ -1083,8 +1083,8 @@ void PPDParser::parse( ::std::list< OString >& rLines ) // #i100644# handle a missing value (actually a broken PPD) if( aLine.isEmpty() ) { - if( aOption.Len() && - aUniKey.CompareToAscii( "JCL", 3 ) != COMPARE_EQUAL ) + if( !aOption.isEmpty() && + !aUniKey.startsWith( "JCL" ) ) eType = eInvocation; else eType = eQuoted; @@ -1103,8 +1103,8 @@ void PPDParser::parse( ::std::list< OString >& rLines ) aValueTranslation = handleTranslation( aLine.copy( nTransPos+2 ), bIsGlobalizedLine ); } // check for quoted value - if( aOption.Len() && - aUniKey.CompareToAscii( "JCL", 3 ) != COMPARE_EQUAL ) + if( !aOption.isEmpty() && + !aUniKey.startsWith( "JCL" ) ) eType = eInvocation; else eType = eQuoted; @@ -1138,7 +1138,7 @@ void PPDParser::parse( ::std::list< OString >& rLines ) { // handle main key translations of form: // *ll_CC.Translation MainKeyword/translated text: "" - if( aUniKey.EqualsAscii( "Translation" ) ) + if( aUniKey.equalsAscii( "Translation" ) ) { m_pTranslator->insertKey( aOption, aOptionTranslation, aTransLocale ); } @@ -1190,11 +1190,11 @@ void PPDParser::parse( ::std::list< OString >& rLines ) OString aLine(*line); if (aLine.matchL(RTL_CONSTASCII_STRINGPARAM("*Default"))) { - String aKey(OStringToOUString(aLine.copy(8), RTL_TEXTENCODING_MS_1252)); - sal_uInt16 nPos = aKey.Search( ':' ); - if( nPos != STRING_NOTFOUND ) + OUString aKey(OStringToOUString(aLine.copy(8), RTL_TEXTENCODING_MS_1252)); + sal_Int32 nPos = aKey.indexOf( ':' ); + if( nPos != -1 ) { - aKey.Erase( nPos ); + aKey = aKey.replaceAt( nPos, 1, "" ); OUString aOption(OStringToOUString( WhitespaceToSpace(aLine.copy(nPos+9)), RTL_TEXTENCODING_MS_1252)); @@ -1229,7 +1229,7 @@ void PPDParser::parse( ::std::list< OString >& rLines ) void PPDParser::parseOpenUI(const OString& rLine) { - String aTranslation; + OUString aTranslation; OString aKey = rLine; sal_Int32 nPos = aKey.indexOf(':'); @@ -1244,7 +1244,7 @@ void PPDParser::parseOpenUI(const OString& rLine) aKey = GetCommandLineToken( 1, aKey ); aKey = aKey.copy(1); - String aUniKey(OStringToOUString(aKey, RTL_TEXTENCODING_MS_1252)); + OUString aUniKey(OStringToOUString(aKey, RTL_TEXTENCODING_MS_1252)); PPDParser::hash_type::const_iterator keyit = m_aKeys.find( aUniKey ); PPDKey* pKey; if( keyit == m_aKeys.end() ) @@ -1277,10 +1277,10 @@ void PPDParser::parseOrderDependency(const OString& rLine) sal_Int32 nOrder = GetCommandLineToken( 0, aLine ).toInt32(); OString aSetup = GetCommandLineToken( 1, aLine ); - String aKey(OStringToOUString(GetCommandLineToken(2, aLine), RTL_TEXTENCODING_MS_1252)); - if( aKey.GetChar( 0 ) != '*' ) + OUString aKey(OStringToOUString(GetCommandLineToken(2, aLine), RTL_TEXTENCODING_MS_1252)); + if( aKey[ 0 ] != '*' ) return; // invalid order depency - aKey.Erase( 0, 1 ); + aKey = aKey.replaceAt( 0, 1, "" ); PPDKey* pKey; PPDParser::hash_type::const_iterator keyit = m_aKeys.find( aKey ); @@ -1311,16 +1311,16 @@ void PPDParser::parseConstraint( const OString& rLine ) { bool bFailed = false; - String aLine(OStringToOUString(rLine, RTL_TEXTENCODING_MS_1252)); - aLine.Erase(0, rLine.indexOf(':') + 1); + OUString aLine(OStringToOUString(rLine, RTL_TEXTENCODING_MS_1252)); + aLine = aLine.replaceAt(0, rLine.indexOf(':') + 1, ""); PPDConstraint aConstraint; int nTokens = GetCommandLineTokenCount( aLine ); for( int i = 0; i < nTokens; i++ ) { - String aToken = GetCommandLineToken( i, aLine ); - if( aToken.GetChar( 0 ) == '*' ) + OUString aToken = GetCommandLineToken( i, aLine ); + if( aToken[ 0 ] == '*' ) { - aToken.Erase( 0, 1 ); + aToken = aToken.replaceAt( 0, 1, "" ); if( aConstraint.m_pKey1 ) aConstraint.m_pKey2 = getKey( aToken ); else @@ -1355,16 +1355,16 @@ void PPDParser::parseConstraint( const OString& rLine ) m_aConstraints.push_back( aConstraint ); } -String PPDParser::getDefaultPaperDimension() const +OUString PPDParser::getDefaultPaperDimension() const { if( m_pDefaultPaperDimension ) return m_pDefaultPaperDimension->m_aOption; - return String(); + return OUString(); } bool PPDParser::getMargins( - const String& rPaperName, + const OUString& rPaperName, int& rLeft, int& rRight, int& rUpper, int& rLower ) const { @@ -1383,7 +1383,7 @@ bool PPDParser::getMargins( double ImLLx, ImLLy, ImURx, ImURy; double PDWidth, PDHeight; - String aArea = m_pImageableAreas->getValue( nImArea )->m_aValue; + OUString aArea = m_pImageableAreas->getValue( nImArea )->m_aValue; ImLLx = StringToDouble( GetCommandLineToken( 0, aArea ) ); ImLLy = StringToDouble( GetCommandLineToken( 1, aArea ) ); ImURx = StringToDouble( GetCommandLineToken( 2, aArea ) ); @@ -1400,7 +1400,7 @@ bool PPDParser::getMargins( } bool PPDParser::getPaperDimension( - const String& rPaperName, + const OUString& rPaperName, int& rWidth, int& rHeight ) const { if( ! m_pPaperDimensions ) @@ -1414,7 +1414,7 @@ bool PPDParser::getPaperDimension( return false; double PDWidth, PDHeight; - String aArea = m_pPaperDimensions->getValue( nPDim )->m_aValue; + OUString aArea = m_pPaperDimensions->getValue( nPDim )->m_aValue; PDWidth = StringToDouble( GetCommandLineToken( 0, aArea ) ); PDHeight = StringToDouble( GetCommandLineToken( 1, aArea ) ); rHeight = (int)(PDHeight + 0.5); @@ -1423,10 +1423,10 @@ bool PPDParser::getPaperDimension( return true; } -String PPDParser::matchPaper( int nWidth, int nHeight ) const +OUString PPDParser::matchPaper( int nWidth, int nHeight ) const { if( ! m_pPaperDimensions ) - return String(); + return OUString(); int nPDim = -1; double PDWidth, PDHeight; @@ -1434,7 +1434,7 @@ String PPDParser::matchPaper( int nWidth, int nHeight ) const for( int i = 0; i < m_pPaperDimensions->countValues(); i++ ) { - String aArea = m_pPaperDimensions->getValue( i )->m_aValue; + OUString aArea = m_pPaperDimensions->getValue( i )->m_aValue; PDWidth = StringToDouble( GetCommandLineToken( 0, aArea ) ); PDHeight = StringToDouble( GetCommandLineToken( 1, aArea ) ); PDWidth /= (double)nWidth; @@ -1460,40 +1460,40 @@ String PPDParser::matchPaper( int nWidth, int nHeight ) const { // swap portrait/landscape and try again bDontSwap = true; - String rRet = matchPaper( nHeight, nWidth ); + OUString rRet = matchPaper( nHeight, nWidth ); bDontSwap = false; return rRet; } - return nPDim != -1 ? m_pPaperDimensions->getValue( nPDim )->m_aOption : String(); + return nPDim != -1 ? m_pPaperDimensions->getValue( nPDim )->m_aOption : OUString(); } -String PPDParser::getDefaultInputSlot() const +OUString PPDParser::getDefaultInputSlot() const { if( m_pDefaultInputSlot ) return m_pDefaultInputSlot->m_aValue; - return String(); + return OUString(); } void PPDParser::getResolutionFromString( - const String& rString, + const OUString& rString, int& rXRes, int& rYRes ) const { - int nDPIPos; + sal_Int32 nDPIPos; rXRes = rYRes = 300; - nDPIPos = rString.SearchAscii( "dpi" ); - if( nDPIPos != STRING_NOTFOUND ) + nDPIPos = rString.indexOf( "dpi" ); + if( nDPIPos != -1 ) { - int nPos = 0; - if( ( nPos = rString.Search( 'x' ) ) != STRING_NOTFOUND ) + sal_Int32 nPos = 0; + if( ( nPos = rString.indexOf( 'x' ) ) != -1 ) { - rXRes = rString.Copy( 0, nPos ).ToInt32(); - rYRes = rString.GetToken( 1, 'x' ).Erase( nDPIPos - nPos - 1 ).ToInt32(); + rXRes = rString.copy( 0, nPos ).toInt32(); + rYRes = rString.getToken( 1, 'x' ).replaceAt( nDPIPos - nPos - 1, 1, "" ).toInt32(); } else - rXRes = rYRes = rString.Copy( 0, nDPIPos ).ToInt32(); + rXRes = rYRes = rString.copy( 0, nDPIPos ).toInt32(); } } @@ -1509,14 +1509,14 @@ void PPDParser::getDefaultResolution( int& rXRes, int& rYRes ) const rYRes = 300; } -String PPDParser::getFont( int nFont ) const +OUString PPDParser::getFont( int nFont ) const { if( ! m_pFontList ) - return String(); + return OUString(); if( nFont >=0 && nFont < m_pFontList->countValues() ) return m_pFontList->getValue( nFont )->m_aOption; - return String(); + return OUString(); } OUString PPDParser::translateKey( const OUString& i_rKey, @@ -1542,7 +1542,7 @@ OUString PPDParser::translateOption( const OUString& i_rKey, * PPDKey */ -PPDKey::PPDKey( const String& rKey ) : +PPDKey::PPDKey( const OUString& rKey ) : m_aKey( rKey ), m_pDefaultValue( NULL ), m_bQueryValue( false ), @@ -1568,7 +1568,7 @@ const PPDValue* PPDKey::getValue( int n ) const // ------------------------------------------------------------------- -const PPDValue* PPDKey::getValue( const String& rOption ) const +const PPDValue* PPDKey::getValue( const OUString& rOption ) const { PPDKey::hash_type::const_iterator it = m_aValues.find( rOption ); return it != m_aValues.end() ? &it->second : NULL; @@ -1576,13 +1576,13 @@ const PPDValue* PPDKey::getValue( const String& rOption ) const // ------------------------------------------------------------------- -const PPDValue* PPDKey::getValueCaseInsensitive( const String& rOption ) const +const PPDValue* PPDKey::getValueCaseInsensitive( const OUString& rOption ) const { const PPDValue* pValue = getValue( rOption ); if( ! pValue ) { for( size_t n = 0; n < m_aOrderedValues.size() && ! pValue; n++ ) - if( m_aOrderedValues[n]->m_aOption.EqualsIgnoreCaseAscii( rOption ) ) + if( m_aOrderedValues[n]->m_aOption.equalsIgnoreAsciiCase( rOption ) ) pValue = m_aOrderedValues[n]; } @@ -1591,7 +1591,7 @@ const PPDValue* PPDKey::getValueCaseInsensitive( const String& rOption ) const // ------------------------------------------------------------------- -void PPDKey::eraseValue( const String& rOption ) +void PPDKey::eraseValue( const OUString& rOption ) { PPDKey::hash_type::iterator it = m_aValues.find( rOption ); if( it == m_aValues.end() ) @@ -1610,7 +1610,7 @@ void PPDKey::eraseValue( const String& rOption ) // ------------------------------------------------------------------- -PPDValue* PPDKey::insertValue( const String& rOption ) +PPDValue* PPDKey::insertValue( const OUString& rOption ) { if( m_aValues.find( rOption ) != m_aValues.end() ) return NULL; @@ -1774,9 +1774,9 @@ bool PPDContext::resetValue( const PPDKey* pKey, bool bDefaultable ) if( ! pKey || ! m_pParser || ! m_pParser->hasKey( pKey ) ) return false; - const PPDValue* pResetValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) ); + const PPDValue* pResetValue = pKey->getValue( OUString( "None" ) ); if( ! pResetValue ) - pResetValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "False" ) ) ); + pResetValue = pKey->getValue( OUString( "False" ) ); if( ! pResetValue && bDefaultable ) pResetValue = pKey->getDefaultValue(); @@ -1801,7 +1801,7 @@ bool PPDContext::checkConstraints( const PPDKey* pKey, const PPDValue* pNewValue // None / False and the default can always be set, but be careful ! // setting them might influence constrained values - if( pNewValue->m_aOption.EqualsAscii( "None" ) || pNewValue->m_aOption.EqualsAscii( "False" ) || + if( pNewValue->m_aOption.equalsAscii( "None" ) || pNewValue->m_aOption.equalsAscii( "False" ) || pNewValue == pKey->getDefaultValue() ) return true; @@ -1836,8 +1836,8 @@ bool PPDContext::checkConstraints( const PPDKey* pKey, const PPDValue* pNewValue continue; // this should not happen, PPD broken if( pKeyOption == pNewValue && - ! pOtherKeyOption->m_aOption.EqualsAscii( "None" ) && - ! pOtherKeyOption->m_aOption.EqualsAscii( "False" ) ) + ! pOtherKeyOption->m_aOption.equalsAscii( "None" ) && + ! pOtherKeyOption->m_aOption.equalsAscii( "False" ) ) { // check if the other value can be reset and // do so if possible @@ -1850,8 +1850,8 @@ bool PPDContext::checkConstraints( const PPDKey* pKey, const PPDValue* pNewValue else if( pOtherKeyOption ) { if( getValue( pOtherKey ) == pOtherKeyOption && - ! pNewValue->m_aOption.EqualsAscii( "None" ) && - ! pNewValue->m_aOption.EqualsAscii( "False" ) ) + ! pNewValue->m_aOption.equalsAscii( "None" ) && + ! pNewValue->m_aOption.equalsAscii( "False" ) ) return false; } else @@ -1863,10 +1863,10 @@ bool PPDContext::checkConstraints( const PPDKey* pKey, const PPDValue* pNewValue else { const PPDValue* pOtherValue = getValue( pOtherKey ); - if( ! pOtherValue->m_aOption.EqualsAscii( "None" ) && - ! pOtherValue->m_aOption.EqualsAscii( "False" ) && - ! pNewValue->m_aOption.EqualsAscii( "None" ) && - ! pNewValue->m_aOption.EqualsAscii( "False" ) ) + if( ! pOtherValue->m_aOption.equalsAscii( "None" ) && + ! pOtherValue->m_aOption.equalsAscii( "False" ) && + ! pNewValue->m_aOption.equalsAscii( "None" ) && + ! pNewValue->m_aOption.equalsAscii( "False" ) ) return false; } } @@ -1962,7 +1962,7 @@ int PPDContext::getRenderResolution() const if( m_pParser ) { int nDPIx = 300, nDPIy = 300; - const PPDKey* pKey = m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Resolution" ) ) ); + const PPDKey* pKey = m_pParser->getKey( OUString( "Resolution" ) ); if( pKey ) { const PPDValue* pValue = getValue( pKey ); @@ -1989,7 +1989,7 @@ void PPDContext::getPageSize( OUString& rPaper, int& rWidth, int& rHeight ) cons rHeight = 842; if( m_pParser ) { - const PPDKey* pKey = m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) ); + const PPDKey* pKey = m_pParser->getKey( OUString( "PageSize" ) ); if( pKey ) { const PPDValue* pValue = getValue( pKey ); diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index 7def80fd5564..f3e7dc8bf89f 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -1162,7 +1162,7 @@ void PrinterInfoManager::setDefaultPaper( PPDContext& rContext ) const for( int i = 0; i < nValues && ! pPaperVal; i++ ) { const PPDValue* pVal = pPageSizeKey->getValue( i ); - if( pVal->m_aOption.EqualsIgnoreCaseAscii( m_aSystemDefaultPaper.getStr() ) ) + if( pVal->m_aOption.equalsIgnoreAsciiCase( m_aSystemDefaultPaper ) ) pPaperVal = pVal; } if( pPaperVal ) |