diff options
author | David Tardon <dtardon@redhat.com> | 2011-11-21 09:00:21 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2011-11-21 09:03:43 +0100 |
commit | 737f61ba4c202834e70bbaa746b4a9ce0137a891 (patch) | |
tree | 3ba0de5068dbd7972161af72c893204ecd5d36be /vcl/generic/print | |
parent | ee3ad385fb3ca476e57e80d7b77c1e184e52e1d8 (diff) |
Convert Sal to rtl::O(U)String
Diffstat (limited to 'vcl/generic/print')
-rw-r--r-- | vcl/generic/print/genprnpsp.cxx | 33 | ||||
-rw-r--r-- | vcl/generic/print/genpspgraphics.cxx | 40 |
2 files changed, 37 insertions, 36 deletions
diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx index cdae6506248f..2ad7c3f16097 100644 --- a/vcl/generic/print/genprnpsp.cxx +++ b/vcl/generic/print/genprnpsp.cxx @@ -508,7 +508,7 @@ void SalGenericInstance::GetPrinterQueueState( SalPrinterQueueInfo* ) mbPrinterInit = true; } -String SalGenericInstance::GetDefaultPrinter() +rtl::OUString SalGenericInstance::GetDefaultPrinter() { mbPrinterInit = true; PrinterInfoManager& rManager( PrinterInfoManager::get() ); @@ -811,7 +811,7 @@ sal_uLong PspSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup ) return pKey ? pKey->countValues() : 0; } -String PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, sal_uLong nPaperBin ) +rtl::OUString PspSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, sal_uLong nPaperBin ) { JobData aData; JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData ); @@ -911,7 +911,7 @@ PspSalPrinter::~PspSalPrinter() { } -static String getTmpName() +static rtl::OUString getTmpName() { rtl::OUString aTmp, aSys; osl_createTempFile( NULL, NULL, &aTmp.pData ); @@ -921,9 +921,9 @@ static String getTmpName() } sal_Bool PspSalPrinter::StartJob( - const XubString* pFileName, - const XubString& rJobName, - const XubString& rAppName, + const rtl::OUString* pFileName, + const rtl::OUString& rJobName, + const rtl::OUString& rAppName, sal_uLong nCopies, bool bCollate, bool bDirect, @@ -933,8 +933,8 @@ sal_Bool PspSalPrinter::StartJob( m_bFax = false; m_bPdf = false; - m_aFileName = pFileName ? *pFileName : String(); - m_aTmpFile = String(); + m_aFileName = pFileName ? *pFileName : rtl::OUString(); + m_aTmpFile = rtl::OUString(); m_nCopies = nCopies; m_bCollate = bCollate; @@ -977,12 +977,13 @@ sal_Bool PspSalPrinter::StartJob( m_aTmpFile = getTmpName(); nMode = S_IRUSR | S_IWUSR; - if( ! m_aFileName.Len() ) + if( m_aFileName.isEmpty() ) { - m_aFileName = getPdfDir( rInfo ); - m_aFileName.Append( '/' ); - m_aFileName.Append( rJobName ); - m_aFileName.AppendAscii( ".pdf" ); + rtl::OUStringBuffer aFileName( getPdfDir( rInfo ) ); + aFileName.append( '/' ); + aFileName.append( rJobName ); + aFileName.appendAscii( RTL_CONSTASCII_STRINGPARAM( ".pdf" ) ); + m_aFileName = aFileName.makeStringAndClear(); } break; } @@ -1002,7 +1003,7 @@ sal_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, bDirect ) ? sal_True : sal_False; + return m_aPrintJob.StartJob( ! m_aTmpFile.isEmpty() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bDirect ) ? sal_True : sal_False; } sal_Bool PspSalPrinter::EndJob() @@ -1107,7 +1108,7 @@ struct PDFPrintFile , maParameters( i_rNewParameters ) {} }; -sal_Bool PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJobName, const String& i_rAppName, +sal_Bool PspSalPrinter::StartJob( const rtl::OUString* i_pFileName, const rtl::OUString& i_rJobName, const rtl::OUString& i_rAppName, ImplJobSetup* i_pSetupData, vcl::PrinterController& i_rController ) { OSL_TRACE( "StartJob with controller: pFilename = %s", i_pFileName ? rtl::OUStringToOString( *i_pFileName, RTL_TEXTENCODING_UTF8 ).getStr() : "<nil>" ); @@ -1308,7 +1309,7 @@ sal_Bool PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJo break; } } while( nBytesRead == buffer.size() ); - rtl::OUStringBuffer aBuf( i_rJobName.Len() + 8 ); + rtl::OUStringBuffer aBuf( i_rJobName.getLength() + 8 ); aBuf.append( i_rJobName ); if( i > 0 || nCurJob > 0 ) { diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx index 8aae4c42a110..cdd8d89abbc3 100644 --- a/vcl/generic/print/genpspgraphics.cxx +++ b/vcl/generic/print/genpspgraphics.cxx @@ -286,7 +286,7 @@ GenPspGraphics::GenPspGraphics() } void GenPspGraphics::Init( psp::JobData* pJob, psp::PrinterGfx* pGfx, - String* pPhone, bool bSwallow, + rtl::OUString* pPhone, bool bSwallow, SalInfoPrinter* pInfoPrinter ) { m_pJobData = pJob; @@ -886,7 +886,7 @@ void GenPspGraphics::SetTextColor( SalColor nSalColor ) m_pPrinterGfx->SetTextColor (aColor); } -bool GenPspGraphics::AddTempDevFont( ImplDevFontList*, const String&,const String& ) +bool GenPspGraphics::AddTempDevFont( ImplDevFontList*, const rtl::OUString&,const rtl::OUString& ) { return false; } @@ -1231,7 +1231,7 @@ void GenPspGraphics::AnnounceFonts( ImplDevFontList* pFontList, const psp::FastP pFontList->Add( pFD ); } -bool GenPspGraphics::filterText( const String& rOrig, String& rNewText, xub_StrLen nIndex, xub_StrLen& rLen, xub_StrLen& rCutStart, xub_StrLen& rCutStop ) +bool GenPspGraphics::filterText( const rtl::OUString& rOrig, rtl::OUString& rNewText, xub_StrLen nIndex, xub_StrLen& rLen, xub_StrLen& rCutStart, xub_StrLen& rCutStop ) { if( ! m_pPhoneNr ) return false; @@ -1246,18 +1246,18 @@ bool GenPspGraphics::filterText( const String& rOrig, String& rNewText, xub_StrL bool bRet = false; bool bStarted = false; bool bStopped = false; - sal_uInt16 nPos; - sal_uInt16 nStart = 0; - sal_uInt16 nStop = rLen; - String aPhone = rOrig.Copy( nIndex, rLen ); + sal_Int32 nPos; + sal_Int32 nStart = 0; + sal_Int32 nStop = rLen; + rtl::OUString aPhone = rOrig.copy( nIndex, rLen ); if( ! m_bPhoneCollectionActive ) { - if( ( nPos = aPhone.SearchAscii( FAX_PHONE_TOKEN ) ) != STRING_NOTFOUND ) + if( ( nPos = aPhone.indexOfAsciiL( FAX_PHONE_TOKEN, FAX_PHONE_TOKEN_LENGTH ) ) != -1 ) { nStart = nPos; m_bPhoneCollectionActive = true; - m_aPhoneCollection.Erase(); + m_aPhoneCollection = rtl::OUString(); bRet = true; bStarted = true; } @@ -1266,7 +1266,7 @@ bool GenPspGraphics::filterText( const String& rOrig, String& rNewText, xub_StrL { bRet = true; nPos = bStarted ? nStart + FAX_PHONE_TOKEN_LENGTH : 0; - if( ( nPos = aPhone.SearchAscii( FAX_END_TOKEN, nPos ) ) != STRING_NOTFOUND ) + if( ( nPos = aPhone.indexOfAsciiL( FAX_END_TOKEN, FAX_END_TOKEN_LENGTH, nPos ) ) != -1 ) { m_bPhoneCollectionActive = false; nStop = nPos + FAX_END_TOKEN_LENGTH; @@ -1274,19 +1274,21 @@ bool GenPspGraphics::filterText( const String& rOrig, String& rNewText, xub_StrL } int nTokenStart = nStart + (bStarted ? FAX_PHONE_TOKEN_LENGTH : 0); int nTokenStop = nStop - (bStopped ? FAX_END_TOKEN_LENGTH : 0); - m_aPhoneCollection += aPhone.Copy( nTokenStart, nTokenStop - nTokenStart ); + m_aPhoneCollection += aPhone.copy( nTokenStart, nTokenStop - nTokenStart ); if( ! m_bPhoneCollectionActive ) { - m_pPhoneNr->AppendAscii( "<Fax#>" ); - m_pPhoneNr->Append( m_aPhoneCollection ); - m_pPhoneNr->AppendAscii( "</Fax#>" ); - m_aPhoneCollection.Erase(); + rtl::OUStringBuffer aPhoneNr; + aPhoneNr.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<Fax#>" ) ); + aPhoneNr.append( m_aPhoneCollection ); + aPhoneNr.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</Fax#>" ) ); + *m_pPhoneNr = aPhoneNr.makeStringAndClear(); + m_aPhoneCollection = rtl::OUString(); } } - if( m_aPhoneCollection.Len() > 1024 ) + if( m_aPhoneCollection.getLength() > 1024 ) { m_bPhoneCollectionActive = false; - m_aPhoneCollection.Erase(); + m_aPhoneCollection = rtl::OUString(); bRet = false; } @@ -1295,9 +1297,7 @@ bool GenPspGraphics::filterText( const String& rOrig, String& rNewText, xub_StrL rLen -= nStop - nStart; rCutStart = nStart+nIndex; rCutStop = nStop+nIndex; - if( rCutStart ) - rNewText = rOrig.Copy( 0, rCutStart ); - rNewText += rOrig.Copy( rCutStop ); + rNewText = ( rCutStart ? rOrig.copy( 0, rCutStart ) : rtl::OUString() ) + rOrig.copy( rCutStop ); } return bRet && m_bSwallowFaxNo; |