diff options
69 files changed, 452 insertions, 405 deletions
diff --git a/automation/source/communi/communi.cxx b/automation/source/communi/communi.cxx index 802c07f3a9c0..4eb45a4b1071 100644 --- a/automation/source/communi/communi.cxx +++ b/automation/source/communi/communi.cxx @@ -394,7 +394,7 @@ CommunicationManagerClient::CommunicationManagerClient( sal_Bool bUseMultiChanne : MultiCommunicationManager( bUseMultiChannel ) { ByteString aApplication("Something inside "); - aApplication.Append( ByteString( DirEntry( Application::GetAppFileName() ).GetName(), osl_getThreadTextEncoding() ) ); + aApplication.Append( rtl::OUStringToOString( DirEntry( Application::GetAppFileName() ).GetName(), osl_getThreadTextEncoding() ) ); SetApplication( aApplication ); } diff --git a/automation/source/server/server.cxx b/automation/source/server/server.cxx index 46b25b0a7c66..7418e88b8ac5 100644 --- a/automation/source/server/server.cxx +++ b/automation/source/server/server.cxx @@ -206,7 +206,7 @@ sal_uLong RemoteControlCommunicationManager::GetPort() Config aConf(Config::GetConfigName( aIniFileDir, CUniString("testtool") )); aConf.SetGroup("Communication"); - ByteString aNoTesttoolKey( ByteString("Exclude_").Append( ByteString( Application::GetAppFileName(), RTL_TEXTENCODING_UTF8 ) ) ); + rtl::OString aNoTesttoolKey( ByteString("Exclude_").Append( rtl::OUStringToOString(Application::GetAppFileName(), RTL_TEXTENCODING_UTF8) ) ); // -notesttool for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ ) { diff --git a/automation/source/server/statemnt.cxx b/automation/source/server/statemnt.cxx index 310afe866b84..15c2c5357d1a 100644 --- a/automation/source/server/statemnt.cxx +++ b/automation/source/server/statemnt.cxx @@ -2502,10 +2502,10 @@ sal_Bool StatementCommand::Execute() case RC_Assert: { ByteString aAssertion( "Diese Assertion wurde vom Testtool per Befehl ausgel�st" ); - aAssertion = ByteString( String( aAssertion, RTL_TEXTENCODING_MS_1252 ), RTL_TEXTENCODING_UTF8 ); - DBG_ASSERT( !aString1.Len(), ByteString( aString1, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); + aAssertion = rtl::OUStringToOString(String(aAssertion, RTL_TEXTENCODING_MS_1252), RTL_TEXTENCODING_UTF8 ); + DBG_ASSERT( !aString1.Len(), rtl::OUStringToOString( aString1, RTL_TEXTENCODING_UTF8 ).getStr() ); DBG_ASSERT( aString1.Len(), aAssertion.GetBuffer() ); - OSL_ENSURE( !aString1.Len(), ByteString( aString1, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); + OSL_ENSURE( !aString1.Len(), rtl::OUStringToOString( aString1, RTL_TEXTENCODING_UTF8 ).getStr() ); OSL_ENSURE( aString1.Len(), aAssertion.GetBuffer() ); } break; diff --git a/automation/source/simplecm/simplecm.cxx b/automation/source/simplecm/simplecm.cxx index fd2c9d04d7a2..bd1e83a69554 100644 --- a/automation/source/simplecm/simplecm.cxx +++ b/automation/source/simplecm/simplecm.cxx @@ -195,7 +195,7 @@ ByteString SimpleCommunicationLinkViaSocket::GetCommunicationPartner( CM_NameTyp pStreamSocket->getPeerAddr( *pPeerAdr ); osl_getDottedInetAddrOfSocketAddr( pPeerAdr->getHandle(), &aDotted.pData); delete pPeerAdr; - return ByteString( UniString(aDotted), RTL_TEXTENCODING_UTF8 ); + return rtl::OUStringToOString(aDotted, RTL_TEXTENCODING_UTF8); } //break; case CM_FQDN: @@ -203,7 +203,7 @@ ByteString SimpleCommunicationLinkViaSocket::GetCommunicationPartner( CM_NameTyp if ( !aCommunicationPartner.Len() ) { rtl::OUString aFQDN( pStreamSocket->getPeerHost()); - aCommunicationPartner = ByteString( UniString(aFQDN), RTL_TEXTENCODING_UTF8 ); + aCommunicationPartner = rtl::OUStringToOString(aFQDN, RTL_TEXTENCODING_UTF8); } return aCommunicationPartner; } @@ -226,7 +226,7 @@ ByteString SimpleCommunicationLinkViaSocket::GetMyName( CM_NameType eType ) pStreamSocket->getPeerAddr( *pPeerAdr ); osl_getDottedInetAddrOfSocketAddr( pPeerAdr->getHandle(), &aDotted.pData); delete pPeerAdr; - return ByteString( UniString(aDotted), RTL_TEXTENCODING_UTF8 ); + return rtl::OUStringToOString(aDotted, RTL_TEXTENCODING_UTF8); } //break; case CM_FQDN: @@ -234,7 +234,7 @@ ByteString SimpleCommunicationLinkViaSocket::GetMyName( CM_NameType eType ) if ( !aMyName.Len() ) { rtl::OUString aFQDN(pStreamSocket->getLocalHost()); - aMyName = ByteString( UniString(aFQDN), RTL_TEXTENCODING_UTF8 ); + aMyName = rtl::OUStringToOString(aFQDN, RTL_TEXTENCODING_UTF8); } return aMyName; } @@ -368,8 +368,8 @@ sal_Bool CommunicationManager::StartCommunication( ByteString aHost, sal_uLong n ByteString CommunicationManager::GetMyName( CM_NameType ) { - rtl::OUString aHostname( osl::SocketAddr::getLocalHostname()); - return ByteString( UniString(aHostname), RTL_TEXTENCODING_UTF8 ); + rtl::OUString aHostname(osl::SocketAddr::getLocalHostname()); + return rtl::OUStringToOString(aHostname, RTL_TEXTENCODING_UTF8); } void CommunicationManager::CallConnectionOpened( CommunicationLink* pCL ) diff --git a/automation/source/testtool/comm_bas.cxx b/automation/source/testtool/comm_bas.cxx index ef011a793d44..7d52c681eb0b 100644 --- a/automation/source/testtool/comm_bas.cxx +++ b/automation/source/testtool/comm_bas.cxx @@ -334,7 +334,7 @@ void CommunicationWrapper::Events( String aType, CommunicationLink* pLink ) void CommunicationWrapper::MStartCommunication( SbxVariable* pVar, SbxArray* pPar, sal_Bool /*bWrite*/ ) { // CommunicationLink StartCommunication( Host, Port ) m_bCatchOpen = sal_True; - if ( m_pManager->StartCommunication( ByteString( pPar->Get( 1 )->GetString(), RTL_TEXTENCODING_UTF8 ), pPar->Get( 2 )->GetULong() ) ) + if ( m_pManager->StartCommunication( rtl::OUStringToOString( pPar->Get( 1 )->GetString(), RTL_TEXTENCODING_UTF8 ), pPar->Get( 2 )->GetULong() ) ) { while ( !m_pNewLink ) GetpApp()->Reschedule(); diff --git a/automation/source/testtool/objtest.cxx b/automation/source/testtool/objtest.cxx index 04d6799209b5..af677dc5e43f 100644 --- a/automation/source/testtool/objtest.cxx +++ b/automation/source/testtool/objtest.cxx @@ -330,7 +330,7 @@ void TestToolObj::LoadIniFile() NEWOLD( "LogBaseDir", "LogBasisverzeichnis" ) String aLFB; - GETSET( aLFB, "LogBaseDir", ByteString( aFB, RTL_TEXTENCODING_UTF8 ) ); + GETSET( aLFB, "LogBaseDir", rtl::OUStringToOString(aFB, RTL_TEXTENCODING_UTF8) ); pImpl->aLogFileBase = DirEntry(aLFB); NEWOLD( "HIDDir", "HIDVerzeichnis" ) @@ -2344,10 +2344,10 @@ void TestToolObj::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, String aSource,aDest; aSource = rPar->Get(1)->GetString(); #ifdef UNX - ByteString aByteSource( aSource, osl_getThreadTextEncoding() ); + rtl::OString aByteSource(rtl::OUStringToOString(aSource, osl_getThreadTextEncoding())); char cDest[1024]; int nLen = 0; - if ( ( nLen = readlink( aByteSource.GetBuffer(), cDest, sizeof(cDest) ) ) >= 0 ) + if ( ( nLen = readlink( aByteSource.getStr(), cDest, sizeof(cDest) ) ) >= 0 ) { aDest = String( cDest, nLen, osl_getThreadTextEncoding() ); } @@ -2391,7 +2391,7 @@ void TestToolObj::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, { if ( !pImpl->pHttpRequest ) pImpl->pHttpRequest = new HttpRequest; - pImpl->pHttpRequest->SetRequest( ByteString( rPar->Get(1)->GetString(), RTL_TEXTENCODING_ASCII_US ), ByteString( rPar->Get(2)->GetString(), RTL_TEXTENCODING_ASCII_US ), rPar->Get(3)->GetUShort() ); + pImpl->pHttpRequest->SetRequest( rtl::OUStringToOString( rPar->Get(1)->GetString(), RTL_TEXTENCODING_ASCII_US ), rtl::OUStringToOString( rPar->Get(2)->GetString(), RTL_TEXTENCODING_ASCII_US ), rPar->Get(3)->GetUShort() ); if ( pImpl->pHttpRequest->Execute() ) { @@ -2418,7 +2418,7 @@ void TestToolObj::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, { if ( !pImpl->pHttpRequest ) pImpl->pHttpRequest = new HttpRequest; - pImpl->pHttpRequest->SetProxy( ByteString( rPar->Get(1)->GetString(), RTL_TEXTENCODING_ASCII_US ), rPar->Get(2)->GetUShort() ); + pImpl->pHttpRequest->SetProxy( rtl::OUStringToOString( rPar->Get(1)->GetString(), RTL_TEXTENCODING_ASCII_US ), rPar->Get(2)->GetUShort() ); } else SetError( SbERR_BAD_NUMBER_OF_ARGS ); diff --git a/automation/source/testtool/tcommuni.cxx b/automation/source/testtool/tcommuni.cxx index 7cc85bfed891..2e0d7b8539ff 100644 --- a/automation/source/testtool/tcommuni.cxx +++ b/automation/source/testtool/tcommuni.cxx @@ -52,7 +52,7 @@ CommunicationManagerClientViaSocketTT::CommunicationManagerClientViaSocketTT() sal_Bool CommunicationManagerClientViaSocketTT::StartCommunication() { bApplicationStarted = sal_False; - return CommunicationManagerClientViaSocket::StartCommunication( ByteString( GetHostConfig(), RTL_TEXTENCODING_UTF8 ), GetTTPortConfig() ); + return CommunicationManagerClientViaSocket::StartCommunication( rtl::OUStringToOString( GetHostConfig(), RTL_TEXTENCODING_UTF8 ), GetTTPortConfig() ); } diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx index 14f96338faef..ac6d801004e9 100644 --- a/basic/source/app/app.cxx +++ b/basic/source/app/app.cxx @@ -326,9 +326,9 @@ int BasicApp::Main( ) RemoveAccel( pMainAccel ); } - catch(const class Exception & rEx) + catch (const class Exception & rEx) { - printf( "Exception not caught: %s\n", ByteString( String(rEx.Message), RTL_TEXTENCODING_ASCII_US ).GetBuffer() ); + printf( "Exception not caught: %s\n", rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US).getStr() ); String aMsg( String::CreateFromAscii( "Exception not caught: " ) ); aMsg.Append( String( rEx.Message ) ); InfoBox( NULL, aMsg ).Execute(); @@ -1078,7 +1078,7 @@ void BasicFrame::AddToLRU(String const& aFile) pPopup->SetItemText(IDM_FILE_LRU1 + i-1,FILENAME2MENU( i, MENU2FILENAME( pPopup->GetItemText(IDM_FILE_LRU1 + i-1-1) ) )); } } - aConfig.WriteKey(LRUNr(1), ByteString( aFile, RTL_TEXTENCODING_UTF8 ) ); + aConfig.WriteKey(LRUNr(1), rtl::OUStringToOString(aFile, RTL_TEXTENCODING_UTF8) ); if ( pPopup->GetItemPos( IDM_FILE_LRU1 ) == MENU_ITEM_NOTFOUND ) pPopup->InsertItem(IDM_FILE_LRU1,FILENAME2MENU( 1, aFile)); else @@ -1657,7 +1657,7 @@ class NewFileDialog : public FileDialog private: String aLastPath; public: - ByteString aFilterType; + rtl::OString aFilterType; NewFileDialog( Window* pParent, WinBits nWinStyle ):FileDialog( pParent, nWinStyle ){}; virtual short Execute(); virtual void FilterSelect(); @@ -1677,7 +1677,7 @@ void NewFileDialog::FilterSelect() { nFilterNr++; } - aFilterType = ByteString( GetFilterType( nFilterNr ), RTL_TEXTENCODING_UTF8 ); + aFilterType = rtl::OUStringToOString(GetFilterType(nFilterNr), RTL_TEXTENCODING_UTF8); Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); aConf.SetGroup( "Misc" ); @@ -1696,8 +1696,8 @@ short NewFileDialog::Execute() aConf.SetGroup( "Misc" ); ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); aConf.SetGroup( aCurrentProfile ); - aConf.WriteKey( aFilterType, ByteString( DirEntry( GetPath() ).GetPath().GetFull(), RTL_TEXTENCODING_UTF8 ) ); - aConf.WriteKey( "LastFilterName", ByteString( GetCurFilter(), RTL_TEXTENCODING_UTF8 ) ); + aConf.WriteKey( aFilterType, rtl::OUStringToOString(DirEntry(GetPath()).GetPath().GetFull(), RTL_TEXTENCODING_UTF8) ); + aConf.WriteKey( "LastFilterName", rtl::OUStringToOString(GetCurFilter(), RTL_TEXTENCODING_UTF8) ); } return bRet; } diff --git a/basic/source/app/appwin.cxx b/basic/source/app/appwin.cxx index 4a612a0880ce..d19da42822f0 100644 --- a/basic/source/app/appwin.cxx +++ b/basic/source/app/appwin.cxx @@ -459,7 +459,7 @@ sal_Bool AppWin::Load( const String& aName ) aMsg.AppendAscii("\""); if ( pFrame->IsAutoRun() ) { - printf( "%s\n", ByteString( aMsg, osl_getThreadTextEncoding() ).GetBuffer() ); + printf( "%s\n", rtl::OUStringToOString(aMsg, osl_getThreadTextEncoding()).getStr() ); } else { diff --git a/basic/source/app/brkpnts.cxx b/basic/source/app/brkpnts.cxx index fba13a28c8bb..bb9b3a0aa15d 100644 --- a/basic/source/app/brkpnts.cxx +++ b/basic/source/app/brkpnts.cxx @@ -225,9 +225,9 @@ void BreakpointWindow::SaveBreakpoints( String aFilename ) aConfig.SetGroup("Breakpoints"); if (aBreakpoints.getLength()) - aConfig.WriteKey( ByteString( aFilename, RTL_TEXTENCODING_UTF8 ), aBreakpoints.makeStringAndClear() ); + aConfig.WriteKey( rtl::OUStringToOString(aFilename, RTL_TEXTENCODING_UTF8), aBreakpoints.makeStringAndClear() ); else - aConfig.DeleteKey( ByteString( aFilename, RTL_TEXTENCODING_UTF8 ) ); + aConfig.DeleteKey( rtl::OUStringToOString(aFilename, RTL_TEXTENCODING_UTF8) ); } diff --git a/basic/source/app/dialogs.cxx b/basic/source/app/dialogs.cxx index 8b0ec2192002..ef59b25dda88 100644 --- a/basic/source/app/dialogs.cxx +++ b/basic/source/app/dialogs.cxx @@ -172,7 +172,7 @@ void ConfEdit::Save( Config &aConf ) aConf.SetGroup("Misc"); ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); aConf.SetGroup( aCurrentProfile ); - aConf.WriteKey( aKeyName, ByteString( aEdit.GetText(), RTL_TEXTENCODING_UTF8 ) ); + aConf.WriteKey( aKeyName, rtl::OUStringToOString(aEdit.GetText(), RTL_TEXTENCODING_UTF8) ); } void ConfEdit::Reload( Config &aConf ) @@ -408,7 +408,7 @@ IMPL_LINK( ProfileOptions, Select, ComboBox*, EMPTYARG ) if ( aCbProfile.GetEntryPos( aCbProfile.GetText() ) == LISTBOX_ENTRY_NOTFOUND ) return 1; Save(); - ByteString aProfileKey( ByteString( ProfilePrefix ).Append( ByteString( aCbProfile.GetText(), RTL_TEXTENCODING_UTF8 ) ) ); + ByteString aProfileKey( ByteString( ProfilePrefix ).Append( rtl::OUStringToOString(aCbProfile.GetText(), RTL_TEXTENCODING_UTF8) ) ); rConf.SetGroup( "Misc" ); rConf.WriteKey( "CurrentProfile", aProfileKey ); ReloadProfile(); @@ -439,7 +439,7 @@ void ProfileOptions::ReloadProfile() IMPL_LINK( ProfileOptions, DelProfile, Button*, EMPTYARG ) { String aProfile = aCbProfile.GetText(); - ByteString aProfileKey( ByteString( ProfilePrefix ).Append( ByteString( aProfile, RTL_TEXTENCODING_UTF8 ) ) ); + ByteString aProfileKey( ByteString( ProfilePrefix ).Append( rtl::OUStringToOString(aProfile, RTL_TEXTENCODING_UTF8) ) ); if ( aCbProfile.GetEntryPos( aProfile ) != COMBOBOX_ENTRY_NOTFOUND ) { aCbProfile.RemoveEntry( aProfile ); @@ -448,7 +448,7 @@ IMPL_LINK( ProfileOptions, DelProfile, Button*, EMPTYARG ) // Set first remaining profile as current profile aCbProfile.SetText( aCbProfile.GetEntry( 0 ) ); aProfile = aCbProfile.GetText(); - aProfileKey = ByteString( ProfilePrefix ).Append( ByteString( aProfile, RTL_TEXTENCODING_UTF8 ) ); + aProfileKey = ByteString( ProfilePrefix ).Append( rtl::OUStringToOString(aProfile, RTL_TEXTENCODING_UTF8) ); rConf.SetGroup( "Misc" ); rConf.WriteKey( "CurrentProfile", aProfileKey ); ReloadProfile(); @@ -460,7 +460,7 @@ IMPL_LINK( ProfileOptions, DelProfile, Button*, EMPTYARG ) IMPL_LINK( ProfileOptions, NewProfile, Button*, EMPTYARG ) { aCbProfile.InsertEntry( aCbProfile.GetText() ); - ByteString aProfileKey( ByteString( ProfilePrefix ).Append( ByteString( aCbProfile.GetText(), RTL_TEXTENCODING_UTF8 ) ) ); + ByteString aProfileKey( ByteString( ProfilePrefix ).Append( rtl::OUStringToOString(aCbProfile.GetText(), RTL_TEXTENCODING_UTF8) ) ); rConf.SetGroup( "Misc" ); rConf.WriteKey( "CurrentProfile", aProfileKey ); // save last profile as new data for new profile @@ -553,7 +553,7 @@ void CrashreportOptions::Save( Config &aConfig ) else aConfig.WriteKey( "UseProxy", "false" ); - aConfig.WriteKey( "ProxyServer", ByteString( aEDCRHost.GetText(), RTL_TEXTENCODING_UTF8 ) ); + aConfig.WriteKey( "ProxyServer", rtl::OUStringToOString(aEDCRHost.GetText(), RTL_TEXTENCODING_UTF8) ); aConfig.WriteKey("ProxyPort", rtl::OString::valueOf(static_cast<sal_Int64>(aNFCRPort.GetValue()))); @@ -562,7 +562,7 @@ void CrashreportOptions::Save( Config &aConfig ) else aConfig.WriteKey( "AllowContact", "false" ); - aConfig.WriteKey( "ReturnAddress", ByteString( aEDEMail.GetText(), RTL_TEXTENCODING_UTF8 ) ); + aConfig.WriteKey( "ReturnAddress", rtl::OUStringToOString(aEDEMail.GetText(), RTL_TEXTENCODING_UTF8) ); } IMPL_LINK( CrashreportOptions, CheckProxy, void*, EMPTYARG ) @@ -644,7 +644,7 @@ IMPL_LINK( MiscOptions, Click, void*, EMPTYARG ) void MiscOptions::Save( Config &aConfig ) { aConfig.SetGroup("Communication"); - aConfig.WriteKey( "Host", ByteString( aEDHost.GetText(), RTL_TEXTENCODING_UTF8 ) ); + aConfig.WriteKey( "Host", rtl::OUStringToOString(aEDHost.GetText(), RTL_TEXTENCODING_UTF8) ); aConfig.WriteKey("TTPort", rtl::OString::valueOf(static_cast<sal_Int64>(aNFTTPort.GetValue()))); aConfig.WriteKey("UnoPort", @@ -668,7 +668,7 @@ void MiscOptions::Save( Config &aConfig ) rtl::OString::valueOf(static_cast<sal_Int64>(aTFMaxLRU.GetValue()))); aConfig.SetGroup("OOoProgramDir"); - aConfig.WriteKey( C_KEY_AKTUELL, ByteString( aEDProgDir.GetText(), RTL_TEXTENCODING_UTF8 ) ); + aConfig.WriteKey( C_KEY_AKTUELL, rtl::OUStringToOString(aEDProgDir.GetText(), RTL_TEXTENCODING_UTF8) ); aConfig.WriteKey( C_KEY_TYPE, ByteString( "PATH" ) ); } @@ -743,9 +743,9 @@ void FontOptions::UpdatePreview() void FontOptions::Save( Config &aConfig ) { aConfig.SetGroup("Misc"); - aConfig.WriteKey( "ScriptFontName", ByteString(aFontName.GetText(), RTL_TEXTENCODING_UTF8) ); - aConfig.WriteKey( "ScriptFontStyle", ByteString(aFontStyle.GetText(), RTL_TEXTENCODING_UTF8) ); - aConfig.WriteKey( "ScriptFontSize", ByteString(aFontSize.GetText(), RTL_TEXTENCODING_UTF8) ); + aConfig.WriteKey( "ScriptFontName", rtl::OUStringToOString(aFontName.GetText(), RTL_TEXTENCODING_UTF8) ); + aConfig.WriteKey( "ScriptFontStyle", rtl::OUStringToOString(aFontStyle.GetText(), RTL_TEXTENCODING_UTF8) ); + aConfig.WriteKey( "ScriptFontSize", rtl::OUStringToOString(aFontSize.GetText(), RTL_TEXTENCODING_UTF8) ); } @@ -812,7 +812,7 @@ void GenericOptions::LoadData() for ( size_t i = 0, n = pGroups->size(); i < n; ++i ) { String* pGroup = pGroups->at( i ); - aConf.SetGroup( ByteString( *pGroup, RTL_TEXTENCODING_UTF8 ) ); + aConf.SetGroup( rtl::OUStringToOString(*pGroup, RTL_TEXTENCODING_UTF8) ); if ( aConf.ReadKey( C_KEY_AKTUELL ).getLength() > 0 ) aCbArea.InsertEntry( *pGroup ); delete pGroup; @@ -896,7 +896,7 @@ IMPL_LINK( GenericOptions, LoadGroup, ComboBox*, EMPTYARG ) } aConf.SetGroup( aLastGroupName ); - aConf.WriteKey( C_KEY_AKTUELL, ByteString( aCurrentValue, RTL_TEXTENCODING_UTF8 ) ); + aConf.WriteKey( C_KEY_AKTUELL, rtl::OUStringToOString(aCurrentValue, RTL_TEXTENCODING_UTF8) ); sal_uInt16 i; for ( i=0 ; i < aCbValue.GetEntryCount() ; i++ ) { @@ -904,12 +904,12 @@ IMPL_LINK( GenericOptions, LoadGroup, ComboBox*, EMPTYARG ) aAllValues += ';'; aAllValues += aCbValue.GetEntry( i ); } - aConf.WriteKey( C_KEY_ALLE, ByteString( aAllValues, RTL_TEXTENCODING_UTF8 ) ); + aConf.WriteKey( C_KEY_ALLE, rtl::OUStringToOString(aAllValues, RTL_TEXTENCODING_UTF8) ); } aCbValue.Clear(); - ByteString aGroupName = ByteString( aCbArea.GetText(), RTL_TEXTENCODING_UTF8 ); + rtl::OString aGroupName = rtl::OUStringToOString(aCbArea.GetText(), RTL_TEXTENCODING_UTF8); aCurrentValue = ReadKey( aGroupName, C_KEY_AKTUELL ); aAllValues = ReadKey( aGroupName, C_KEY_ALLE ); aType = ReadKey( aGroupName, C_KEY_TYPE ); @@ -934,7 +934,7 @@ IMPL_LINK( GenericOptions, DelGroup, Button*, EMPTYARG ) if ( aCbArea.GetEntryPos( aGroup ) != COMBOBOX_ENTRY_NOTFOUND ) { aCbArea.RemoveEntry( aGroup ); - ByteString aByteGroup( aGroup, RTL_TEXTENCODING_UTF8 ); + rtl::OString aByteGroup(rtl::OUStringToOString(aGroup, RTL_TEXTENCODING_UTF8)); aConf.DeleteGroup( aByteGroup ); } diff --git a/basic/source/app/msgedit.cxx b/basic/source/app/msgedit.cxx index 22badf679354..06e68bf7fa45 100644 --- a/basic/source/app/msgedit.cxx +++ b/basic/source/app/msgedit.cxx @@ -165,7 +165,7 @@ void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg ) { String aSave = VERSION_STRING.Append( UniString::CreateFromInt32( 3 ) ).AppendAscii("\n"); // Version 3 aSave.ConvertLineEnd(LINEEND_CRLF); - aStrm << ByteString( aSave, RTL_TEXTENCODING_IBM_850 ).GetBuffer(); + aStrm << rtl::OUStringToOString(aSave, RTL_TEXTENCODING_IBM_850).getStr(); } String aLogMsg = Impl_MakeSaveText( LogMsg->aDebugData ).AppendAscii("\n"); @@ -174,7 +174,7 @@ void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg ) { aLogMsg.ConvertLineEnd(LINEEND_CRLF); aStrm.Seek(STREAM_SEEK_TO_END); - aStrm << ByteString( aLogMsg, RTL_TEXTENCODING_UTF8 ).GetBuffer(); + aStrm << rtl::OUStringToOString(aLogMsg, RTL_TEXTENCODING_UTF8).getStr(); aStrm.Close(); } if ( !bFileWasChanged ) @@ -195,7 +195,7 @@ void MsgEdit::AddAnyMsg( TTLogMsg *LogMsg ) // restore Original Msg LogMsg->aDebugData.aMsg = aOriginalMsg; - printf( "%s", ByteString( aPrintMsg, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); + printf( "%s", rtl::OUStringToOString(aPrintMsg, RTL_TEXTENCODING_UTF8).getStr() ); } } } @@ -676,7 +676,7 @@ sal_Bool MsgEdit::Save( const String& aName ) { String aSave = GetText(); aSave.ConvertLineEnd(LINEEND_CRLF); - aStrm << ByteString( aSave, RTL_TEXTENCODING_UTF8 ).GetBuffer(); + aStrm << rtl::OUStringToOString(aSave, RTL_TEXTENCODING_UTF8).getStr(); } else { @@ -687,7 +687,7 @@ sal_Bool MsgEdit::Save( const String& aName ) pRun = aEditTree.NextSibling( pRun ); aSave.ConvertLineEnd(LINEEND_CRLF); - aStrm << ByteString( aSave, RTL_TEXTENCODING_IBM_850 ).GetBuffer(); + aStrm << rtl::OUStringToOString(aSave, RTL_TEXTENCODING_IBM_850).getStr(); SvLBoxEntry *pEntry; while ( pRun ) @@ -698,7 +698,7 @@ sal_Bool MsgEdit::Save( const String& aName ) aSave = Impl_MakeSaveText( pEntry ); aSave += '\n'; aSave.ConvertLineEnd(LINEEND_CRLF); - aStrm << ByteString( aSave, RTL_TEXTENCODING_UTF8 ).GetBuffer(); + aStrm << rtl::OUStringToOString(aSave, RTL_TEXTENCODING_UTF8).getStr(); pEntry = aEditTree.Next( pEntry ); } pRun = aEditTree.PrevSibling( pRun ); diff --git a/basic/source/app/textedit.cxx b/basic/source/app/textedit.cxx index 294b12e656be..ad66db90d856 100644 --- a/basic/source/app/textedit.cxx +++ b/basic/source/app/textedit.cxx @@ -818,7 +818,7 @@ DBG_CHKTHIS(TextEdit,0); } String aSave = GetText(); aSave.ConvertLineEnd(LINEEND_LF); - aStrm << ByteString( aSave, aFileEncoding ).GetBuffer(); + aStrm << rtl::OUStringToOString(aSave, aFileEncoding).getStr(); if( aStrm.GetError() != SVSTREAM_OK ) bOk = sal_False; else diff --git a/basic/source/classes/disas.cxx b/basic/source/classes/disas.cxx index 155720d036aa..2f31c59e6488 100644 --- a/basic/source/classes/disas.cxx +++ b/basic/source/classes/disas.cxx @@ -388,16 +388,16 @@ sal_Bool SbiDisas::DisasLine( String& rText ) if( cLabels[ nPC >> 3 ] & ( 1 << ( nPC & 7 ) ) ) { // Public? - ByteString aByteMethName; + rtl::OString aByteMethName; for( sal_uInt16 i = 0; i < pMod->GetMethods()->Count(); i++ ) { SbMethod* pMeth = PTR_CAST(SbMethod,pMod->GetMethods()->Get( i )); if( pMeth ) { - aByteMethName = ByteString( pMeth->GetName(), osl_getThreadTextEncoding() ); + aByteMethName = rtl::OUStringToOString(pMeth->GetName(), osl_getThreadTextEncoding()); if( pMeth->GetId() == nPC ) { - p = aByteMethName.GetBuffer(); + p = aByteMethName.getStr(); break; } if( pMeth->GetId() >= nPC ) @@ -446,8 +446,8 @@ sal_Bool SbiDisas::DisasLine( String& rText ) void SbiDisas::StrOp( String& rText ) { String aStr = rImg.GetString( (sal_uInt16)nOp1 ); - ByteString aByteString( aStr, RTL_TEXTENCODING_ASCII_US ); - const char* p = aByteString.GetBuffer(); + rtl::OString aByteString(rtl::OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US)); + const char* p = aByteString.getStr(); if( p ) { rText += '"'; diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index a797b3dab00a..08145f557ba4 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -358,8 +358,8 @@ sal_Bool SbiImage::Save( SvStream& r, sal_uInt32 nVer ) for( i = 0; i < nStrings; i++ ) { sal_uInt16 nOff = (sal_uInt16) pStringOff[ i ]; - ByteString aStr( pStrings + nOff, eCharSet ); - memcpy( pByteStrings + nOff, aStr.GetBuffer(), (aStr.Len() + 1) * sizeof( char ) ); + rtl::OString aStr(rtl::OUStringToOString(rtl::OUString(pStrings + nOff), eCharSet)); + memcpy( pByteStrings + nOff, aStr.getStr(), (aStr.getLength() + 1) * sizeof( char ) ); } r << (sal_uInt32) nStringSize; r.Write( pByteStrings, nStringSize ); diff --git a/basic/source/comp/buffer.cxx b/basic/source/comp/buffer.cxx index 42646320804a..4512dbf063ef 100644 --- a/basic/source/comp/buffer.cxx +++ b/basic/source/comp/buffer.cxx @@ -224,8 +224,8 @@ sal_Bool SbiBuffer::operator +=( const String& n ) sal_uInt16 l = n.Len() + 1; if( Check( l ) ) { - ByteString aByteStr( n, osl_getThreadTextEncoding() ); - memcpy( pCur, aByteStr.GetBuffer(), l ); + rtl::OString aByteStr(rtl::OUStringToOString(n, osl_getThreadTextEncoding())); + memcpy( pCur, aByteStr.getStr(), l ); pCur += l; nOff = nOff + l; return sal_True; diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index cbdc27f15a23..2b14640a0d43 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -913,7 +913,7 @@ void SbiIoSystem::ReadCon( ByteString& rIn ) String aPromptStr( aPrompt, osl_getThreadTextEncoding() ); SbiInputDialog aDlg( NULL, aPromptStr ); if( aDlg.Execute() ) - rIn = ByteString( aDlg.GetInput(), osl_getThreadTextEncoding() ); + rIn = rtl::OUStringToOString(aDlg.GetInput(), osl_getThreadTextEncoding()); else nError = SbERR_USER_ABORT; aPrompt.Erase(); diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 37c690609bd5..251454b2583b 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -1714,8 +1714,8 @@ RTLFUNC(Val) nRadix = 8; if ( nRadix != 10 ) { - ByteString aByteStr( aStr, osl_getThreadTextEncoding() ); - sal_Int16 nlResult = (sal_Int16)strtol( aByteStr.GetBuffer()+2, &pEndPtr, nRadix); + rtl::OString aByteStr(rtl::OUStringToOString(aStr, osl_getThreadTextEncoding())); + sal_Int16 nlResult = (sal_Int16)strtol( aByteStr.getStr()+2, &pEndPtr, nRadix); nResult = (double)nlResult; } } @@ -2838,8 +2838,9 @@ RTLFUNC(GetAttr) aEntry.ToAbs(); // #57064 extract the real-path for virtual URLs - ByteString aByteStrFullPath( aEntry.GetFull(), osl_getThreadTextEncoding() ); - DWORD nRealFlags = GetFileAttributes (aByteStrFullPath.GetBuffer()); + rtl::OString aByteStrFullPath(rtl::OUStringToOString(aEntry.GetFull(), + osl_getThreadTextEncoding())); + DWORD nRealFlags = GetFileAttributes (aByteStrFullPath.getStr()); if (nRealFlags != 0xffffffff) { if (nRealFlags == FILE_ATTRIBUTE_NORMAL) diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 23431c9c1cfa..f4bc91f44661 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -997,8 +997,8 @@ sal_Bool lcl_WriteSbxVariable( const SbxVariable& rVar, SvStream* pStrm, { // without any length information! without end-identifier! // What does that mean for Unicode?! Choosing conversion to ByteString... - ByteString aByteStr( rStr, osl_getThreadTextEncoding() ); - *pStrm << (const char*)aByteStr.GetBuffer(); + rtl::OString aByteStr(rtl::OUStringToOString(rStr, osl_getThreadTextEncoding())); + *pStrm << (const char*)aByteStr.getStr(); } } break; @@ -1252,8 +1252,9 @@ RTLFUNC(Environ) } String aResult; // should be ANSI but that's not possible under Win16 in the DLL - ByteString aByteStr( rPar.Get(1)->GetString(), osl_getThreadTextEncoding() ); - const char* pEnvStr = getenv( aByteStr.GetBuffer() ); + rtl::OString aByteStr(rtl::OUStringToOString(rPar.Get(1)->GetString(), + osl_getThreadTextEncoding())); + const char* pEnvStr = getenv(aByteStr.getStr()); if ( pEnvStr ) aResult = String::CreateFromAscii( pEnvStr ); rPar.Get(0)->PutString( aResult ); diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx index f96364a54026..4467322d0827 100644 --- a/basic/source/runtime/step0.cxx +++ b/basic/source/runtime/step0.cxx @@ -1285,7 +1285,7 @@ void SbiRuntime::StepPRINT() // print TOS if( p->GetType() >= SbxINTEGER && p->GetType() <= SbxDOUBLE ) s = ' '; // one blank before s += s1; - ByteString aByteStr( s, osl_getThreadTextEncoding() ); + rtl::OString aByteStr(rtl::OUStringToOString(s, osl_getThreadTextEncoding())); pIosys->Write( aByteStr ); Error( pIosys->GetError() ); } @@ -1299,7 +1299,7 @@ void SbiRuntime::StepPRINTF() // print TOS in field s = ' '; s += s1; s.Expand( 14, ' ' ); - ByteString aByteStr( s, osl_getThreadTextEncoding() ); + rtl::OString aByteStr(rtl::OUStringToOString(s, osl_getThreadTextEncoding())); pIosys->Write( aByteStr ); Error( pIosys->GetError() ); } @@ -1323,7 +1323,7 @@ void SbiRuntime::StepWRITE() // write TOS s += p->GetString(); if( ch ) s += ch; - ByteString aByteStr( s, osl_getThreadTextEncoding() ); + rtl::OString aByteStr(rtl::OUStringToOString(s, osl_getThreadTextEncoding())); pIosys->Write( aByteStr ); Error( pIosys->GetError() ); } @@ -1350,7 +1350,7 @@ void SbiRuntime::StepRENAME() // Rename Tos+1 to Tos void SbiRuntime::StepPROMPT() { SbxVariableRef p = PopVar(); - ByteString aStr( p->GetString(), osl_getThreadTextEncoding() ); + rtl::OString aStr(rtl::OUStringToOString(p->GetString(), osl_getThreadTextEncoding())); pIosys->SetPrompt( aStr ); } diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx index b18347dc3937..b3dcb6f1b27a 100644 --- a/basic/source/runtime/step2.cxx +++ b/basic/source/runtime/step2.cxx @@ -899,7 +899,7 @@ void SbiRuntime::StepOPEN( sal_uInt32 nOp1, sal_uInt32 nOp2 ) SbxVariableRef pLen = PopVar(); short nBlkLen = pLen->GetInteger(); short nChan = pChan->GetInteger(); - ByteString aName( pName->GetString(), osl_getThreadTextEncoding() ); + rtl::OString aName(rtl::OUStringToOString(pName->GetString(), osl_getThreadTextEncoding())); pIosys->Open( nChan, aName, static_cast<short>( nOp1 ), static_cast<short>( nOp2 ), nBlkLen ); Error( pIosys->GetError() ); diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index 7ad9727e52d3..10d24262569d 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -214,12 +214,12 @@ SbxVariable* SbxObject::Find( const XubString& rName, SbxClassType t ) static sal_uInt16 nLvl = 0; static const char* pCls[] = { "DontCare","Array","Value","Variable","Method","Property","Object" }; - ByteString aNameStr1( (const UniString&)rName, RTL_TEXTENCODING_ASCII_US ); - ByteString aNameStr2( (const UniString&)SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aNameStr1(rtl::OUStringToOString(rName, RTL_TEXTENCODING_ASCII_US)); + rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US)); DbgOutf( "SBX: Search %.*s %s %s in %s", nLvl++, " ", ( t >= SbxCLASS_DONTCARE && t <= SbxCLASS_OBJECT ) - ? pCls[ t-1 ] : "Unknown class", aNameStr1.GetBuffer(), aNameStr1.GetBuffer() ); + ? pCls[ t-1 ] : "Unknown class", aNameStr1.getStr(), aNameStr1.getStr() ); #endif if( !GetAll( t ) ) @@ -276,10 +276,10 @@ SbxVariable* SbxObject::Find( const XubString& rName, SbxClassType t ) nLvl--; if( pRes ) { - ByteString aNameStr3( (const UniString&)rName, RTL_TEXTENCODING_ASCII_US ); - ByteString aNameStr4( (const UniString&)SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aNameStr3(rtl::OUStringToOString(rName, RTL_TEXTENCODING_ASCII_US)); + rtl::OString aNameStr4(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US)); DbgOutf( "SBX: Found %.*s %s in %s", - nLvl, " ", aNameStr3.GetBuffer(), aNameStr4.GetBuffer() ); + nLvl, " ", aNameStr3.getStr(), aNameStr4.getStr() ); } #endif return pRes; @@ -489,12 +489,12 @@ void SbxObject::Insert( SbxVariable* pVar ) XubString aVarName( pVar->GetName() ); if ( !aVarName.Len() && pVar->ISA(SbxObject) ) aVarName = PTR_CAST(SbxObject,pVar)->GetClassName(); - ByteString aNameStr1( (const UniString&)aVarName, RTL_TEXTENCODING_ASCII_US ); - ByteString aNameStr2( (const UniString&)SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aNameStr1(rtl::OUStringToOString(aVarName, RTL_TEXTENCODING_ASCII_US)); + rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US)); DbgOutf( "SBX: Insert %s %s in %s", ( pVar->GetClass() >= SbxCLASS_DONTCARE && pVar->GetClass() <= SbxCLASS_OBJECT ) - ? pCls[ pVar->GetClass()-1 ] : "Unknown class", aNameStr1.GetBuffer(), aNameStr1.GetBuffer() ); + ? pCls[ pVar->GetClass()-1 ] : "Unknown class", aNameStr1.getStr(), aNameStr1.getStr() ); #endif } } @@ -529,12 +529,12 @@ void SbxObject::QuickInsert( SbxVariable* pVar ) XubString aVarName( pVar->GetName() ); if ( !aVarName.Len() && pVar->ISA(SbxObject) ) aVarName = PTR_CAST(SbxObject,pVar)->GetClassName(); - ByteString aNameStr1( (const UniString&)aVarName, RTL_TEXTENCODING_ASCII_US ); - ByteString aNameStr2( (const UniString&)SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aNameStr1(rtl::OUStringToOString(aVarName, RTL_TEXTENCODING_ASCII_US)); + rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US)); DbgOutf( "SBX: Insert %s %s in %s", ( pVar->GetClass() >= SbxCLASS_DONTCARE && pVar->GetClass() <= SbxCLASS_OBJECT ) - ? pCls[ pVar->GetClass()-1 ] : "Unknown class", aNameStr1.GetBuffer(), aNameStr1.GetBuffer() ); + ? pCls[ pVar->GetClass()-1 ] : "Unknown class", aNameStr1.getStr(), aNameStr1.getStr() ); #endif } } @@ -554,8 +554,8 @@ void SbxObject::Remove( SbxVariable* pVar ) XubString aVarName( pVar->GetName() ); if ( !aVarName.Len() && pVar->ISA(SbxObject) ) aVarName = PTR_CAST(SbxObject,pVar)->GetClassName(); - ByteString aNameStr1( (const UniString&)aVarName, RTL_TEXTENCODING_ASCII_US ); - ByteString aNameStr2( (const UniString&)SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aNameStr1(rtl::OUStringToOString(aVarName, RTL_TEXTENCODING_ASCII_US)); + rtl::OString aNameStr2(rtl::OUStringToOString(SbxVariable::GetName(), RTL_TEXTENCODING_ASCII_US)); #endif SbxVariableRef pVar_ = pArray->Get( nIdx ); if( pVar_->IsBroadcaster() ) @@ -766,38 +766,38 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill ) GetAll( SbxCLASS_DONTCARE ); // Output the data of the object itself - ByteString aNameStr( (const UniString&)GetName(), RTL_TEXTENCODING_ASCII_US ); - ByteString aClassNameStr( (const UniString&)aClassName, RTL_TEXTENCODING_ASCII_US ); + rtl::OString aNameStr(rtl::OUStringToOString(GetName(), RTL_TEXTENCODING_ASCII_US)); + rtl::OString aClassNameStr(rtl::OUStringToOString(aClassName, RTL_TEXTENCODING_ASCII_US)); rStrm << "Object( " << rtl::OString::valueOf(reinterpret_cast<sal_Int64>(this)).getStr()<< "=='" - << ( aNameStr.Len() ? aNameStr.GetBuffer() : "<unnamed>" ) << "', " - << "of class '" << aClassNameStr.GetBuffer() << "', " + << ( aNameStr.getLength() ? aNameStr.getStr() : "<unnamed>" ) << "', " + << "of class '" << aClassNameStr.getStr() << "', " << "counts " << rtl::OString::valueOf(static_cast<sal_Int64>(GetRefCount())).getStr() << " refs, "; if ( GetParent() ) { - ByteString aParentNameStr( (const UniString&)GetName(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aParentNameStr(rtl::OUStringToOString(GetName(), RTL_TEXTENCODING_ASCII_US)); rStrm << "in parent " << rtl::OString::valueOf(reinterpret_cast<sal_Int64>(GetParent())).getStr() - << "=='" << ( aParentNameStr.Len() ? aParentNameStr.GetBuffer() : "<unnamed>" ) << "'"; + << "=='" << ( aParentNameStr.getLength() ? aParentNameStr.getStr() : "<unnamed>" ) << "'"; } else rStrm << "no parent "; rStrm << " )" << endl; - ByteString aIndentNameStr( (const UniString&)aIndent, RTL_TEXTENCODING_ASCII_US ); - rStrm << aIndentNameStr.GetBuffer() << "{" << endl; + rtl::OString aIndentNameStr(rtl::OUStringToOString(aIndent, RTL_TEXTENCODING_ASCII_US)); + rStrm << aIndentNameStr.getStr() << "{" << endl; // Flags XubString aAttrs; if( CollectAttrs( this, aAttrs ) ) { - ByteString aAttrStr( (const UniString&)aAttrs, RTL_TEXTENCODING_ASCII_US ); - rStrm << aIndentNameStr.GetBuffer() << "- Flags: " << aAttrStr.GetBuffer() << endl; + rtl::OString aAttrStr(rtl::OUStringToOString(aAttrs, RTL_TEXTENCODING_ASCII_US)); + rStrm << aIndentNameStr.getStr() << "- Flags: " << aAttrStr.getStr() << endl; } // Methods - rStrm << aIndentNameStr.GetBuffer() << "- Methods:" << endl; + rStrm << aIndentNameStr.getStr() << "- Methods:" << endl; for( sal_uInt16 i = 0; i < pMethods->Count(); i++ ) { SbxVariableRef& r = pMethods->GetRef( i ); @@ -829,7 +829,7 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill ) } // Properties - rStrm << aIndentNameStr.GetBuffer() << "- Properties:" << endl; + rStrm << aIndentNameStr.getStr() << "- Properties:" << endl; { for( sal_uInt16 i = 0; i < pProps->Count(); i++ ) { @@ -863,7 +863,7 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill ) } // Objects - rStrm << aIndentNameStr.GetBuffer() << "- Objects:" << endl; + rStrm << aIndentNameStr.getStr() << "- Objects:" << endl; { for( sal_uInt16 i = 0; i < pObjs->Count(); i++ ) { @@ -871,7 +871,7 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill ) SbxVariable* pVar = r; if ( pVar ) { - rStrm << aIndentNameStr.GetBuffer() << " - Sub"; + rStrm << aIndentNameStr.getStr() << " - Sub"; if ( pVar->ISA(SbxObject) ) ((SbxObject*) pVar)->Dump( rStrm, bFill ); else if ( pVar->ISA(SbxVariable) ) @@ -880,7 +880,7 @@ void SbxObject::Dump( SvStream& rStrm, sal_Bool bFill ) } } - rStrm << aIndentNameStr.GetBuffer() << "}" << endl << endl; + rStrm << aIndentNameStr.getStr() << "}" << endl << endl; --nLevel; } diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index d2332a5c275b..b73532bd5bb9 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -136,8 +136,8 @@ void removeDimAsNewRecoverItem( SbxVariable* pVar ); SbxVariable::~SbxVariable() { #ifdef DBG_UTIL - ByteString aBStr( (const UniString&)maName, RTL_TEXTENCODING_ASCII_US ); - DbgOutf( "SbxVariable::Dtor %lx (%s)", (void*)this, aBStr.GetBuffer() ); + rtl::OString aBStr(rtl::OUStringToOString(maName, RTL_TEXTENCODING_ASCII_US)); + DbgOutf( "SbxVariable::Dtor %lx (%s)", (void*)this, aBStr.getStr() ); static sal_Char const aCellsStr[] = "Cells"; if ( maName.EqualsAscii( aCellsStr ) ) maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 ); @@ -390,8 +390,8 @@ void SbxVariable::SetParent( SbxObject* p ) aMsg.AppendAscii( "].SetParent([" ); aMsg += p->GetName(); aMsg.AppendAscii( "])" ); - ByteString aBStr( (const UniString&)aMsg, RTL_TEXTENCODING_ASCII_US ); - DbgOut( aBStr.GetBuffer(), DBG_OUT_WARNING, __FILE__, __LINE__); + rtl::OString aBStr(rtl::OUStringToOString(aMsg, RTL_TEXTENCODING_ASCII_US)); + DbgOut( aBStr.getStr(), DBG_OUT_WARNING, __FILE__, __LINE__); } } #endif @@ -637,13 +637,13 @@ void SbxAlias::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, void SbxVariable::Dump( SvStream& rStrm, sal_Bool bFill ) { - ByteString aBNameStr( (const UniString&)GetName( SbxNAME_SHORT_TYPES ), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aBNameStr(rtl::OUStringToOString(GetName( SbxNAME_SHORT_TYPES ), RTL_TEXTENCODING_ASCII_US)); rStrm << "Variable( " << rtl::OString::valueOf(reinterpret_cast<sal_Int64>(this)).getStr() << "==" - << aBNameStr.GetBuffer(); - ByteString aBParentNameStr( (const UniString&)GetParent()->GetName(), RTL_TEXTENCODING_ASCII_US ); + << aBNameStr.getStr(); + rtl::OString aBParentNameStr(rtl::OUStringToOString(GetParent()->GetName(), RTL_TEXTENCODING_ASCII_US)); if ( GetParent() ) - rStrm << " in parent '" << aBParentNameStr.GetBuffer() << "'"; + rStrm << " in parent '" << aBParentNameStr.getStr() << "'"; else rStrm << " no parent"; rStrm << " ) "; diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx index 99df624e5a94..0e22387bff3f 100644 --- a/connectivity/source/drivers/dbase/DIndex.cxx +++ b/connectivity/source/drivers/dbase/DIndex.cxx @@ -416,7 +416,7 @@ void ODbaseIndex::createINFEntry() } } } - aInfFile.WriteKey(aNewEntry,ByteString(sEntry,m_pTable->getConnection()->getTextEncoding())); + aInfFile.WriteKey(aNewEntry, rtl::OUStringToOString(sEntry, m_pTable->getConnection()->getTextEncoding())); } // ------------------------------------------------------------------------- sal_Bool ODbaseIndex::DropImpl() @@ -563,8 +563,8 @@ sal_Bool ODbaseIndex::CreateImpl() m_pFileStream->SetStreamSize(PAGE_SIZE); - ByteString aCol(aName,m_pTable->getConnection()->getTextEncoding()); - strncpy(m_aHeader.db_name,aCol.GetBuffer(),std::min((sal_uInt16)sizeof(m_aHeader.db_name), aCol.Len())); + rtl::OString aCol(rtl::OUStringToOString(aName, m_pTable->getConnection()->getTextEncoding())); + strncpy(m_aHeader.db_name, aCol.getStr(), std::min<size_t>(sizeof(m_aHeader.db_name), aCol.getLength())); m_aHeader.db_unique = m_IsUnique ? 1: 0; m_aHeader.db_keyrec = m_aHeader.db_keylen + 8; diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index 2c96d463c575..0b67e1d5c66f 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -710,8 +710,8 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const if (!aKey.getValue().isNull()) { ::rtl::OUString sValue = aKey.getValue(); - ByteString aText(sValue.getStr(), rIndex.m_pTable->getConnection()->getTextEncoding()); - strncpy(aData,aText.GetBuffer(),std::min(rIndex.getHeader().db_keylen, aText.Len())); + rtl::OString aText(rtl::OUStringToOString(sValue, rIndex.m_pTable->getConnection()->getTextEncoding())); + strncpy(aData, aText.getStr(), std::min<size_t>(rIndex.getHeader().db_keylen, aText.getLength())); } rStream.Write((sal_uInt8*)aData,rIndex.getHeader().db_keylen); } diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index 6408f4a8fa86..dab0dce628ed 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -412,11 +412,11 @@ sal_Bool ORTFImportExport::Write() m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= nColor; ::Color aColor(nColor); - ByteString aFonts(String(m_aFont.Name),eDestEnc); + ByteString aFonts(rtl::OUStringToOString(m_aFont.Name, eDestEnc)); if(!aFonts.Len()) { - String aName = Application::GetSettings().GetStyleSettings().GetAppFont().GetName(); - aFonts = ByteString (aName,eDestEnc); + rtl::OUString aName = Application::GetSettings().GetStyleSettings().GetAppFont().GetName(); + aFonts = rtl::OUStringToOString(aName, eDestEnc); } ByteString aFontNr; diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx index 715f90c80a67..b67a010b2d1f 100644 --- a/desktop/source/app/cmdlinehelp.cxx +++ b/desktop/source/app/cmdlinehelp.cxx @@ -164,8 +164,8 @@ namespace desktop fprintf(stdout, "%s", getToken(bsLeft, i, '\n').getStr()); fprintf(stdout, "%s\n", getToken(bsRight, i, '\n').getStr()); } - fprintf(stdout, "%s", ByteString(aHelpMessage_bottom, - RTL_TEXTENCODING_ASCII_US).GetBuffer()); + fprintf(stdout, "%s", rtl::OUStringToOString(aHelpMessage_bottom, + RTL_TEXTENCODING_ASCII_US).getStr()); #else // rest gets a dialog box CmdlineHelpDialog aDlg; diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index 45de038ae703..678f31abad56 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -1045,7 +1045,8 @@ void BinTextObject::StoreData( SvStream& rOStream ) const sal_uInt16 nParagraphs = GetContents().Count(); rOStream << nParagraphs; - char cFeatureConverted = ByteString( CH_FEATURE, eEncoding ).GetChar(0); + sal_Unicode nUniChar = CH_FEATURE; + char cFeatureConverted = rtl::OString(&nUniChar, 1, eEncoding).toChar(); // The individual paragraphs ... for ( sal_uInt16 nPara = 0; nPara < nParagraphs; nPara++ ) @@ -1053,7 +1054,7 @@ void BinTextObject::StoreData( SvStream& rOStream ) const ContentInfo* pC = GetContents().GetObject( nPara ); // Text... - ByteString aText( pC->GetText(), eEncoding ); + ByteString aText(rtl::OUStringToOString(pC->GetText(), eEncoding)); // Symbols? sal_Bool bSymbolPara = sal_False; @@ -1062,7 +1063,7 @@ void BinTextObject::StoreData( SvStream& rOStream ) const const SvxFontItem& rFontItem = (const SvxFontItem&)pC->GetParaAttribs().Get( EE_CHAR_FONTINFO ); if ( rFontItem.GetCharSet() == RTL_TEXTENCODING_SYMBOL ) { - aText = ByteString( pC->GetText(), RTL_TEXTENCODING_SYMBOL ); + aText = rtl::OUStringToOString(pC->GetText(), RTL_TEXTENCODING_SYMBOL); bSymbolPara = sal_True; } } @@ -1078,7 +1079,7 @@ void BinTextObject::StoreData( SvStream& rOStream ) const { // Not correctly converted String aPart( pC->GetText(), pAttr->GetStart(), pAttr->GetEnd() - pAttr->GetStart() ); - ByteString aNew( aPart, rFontItem.GetCharSet() ); + rtl::OString aNew(rtl::OUStringToOString(aPart, rFontItem.GetCharSet())); aText.Erase( pAttr->GetStart(), pAttr->GetEnd() - pAttr->GetStart() ); aText.Insert( aNew, pAttr->GetStart() ); } @@ -1133,7 +1134,7 @@ void BinTextObject::StoreData( SvStream& rOStream ) const rOStream.WriteByteString( aText ); // StyleName and Family... - rOStream.WriteByteString( ByteString( pC->GetStyle(), eEncoding ) ); + rOStream.WriteByteString( rtl::OUStringToOString(pC->GetStyle(), eEncoding) ); rOStream << (sal_uInt16)pC->GetFamily(); // Paragraph attributes ... diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 86cf0cc52b7e..cdf29dee1be1 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -3637,9 +3637,9 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { DELETEZ( pStrLink ); String sTmp( sLink ); - ByteString sId( sTmp.Copy( - sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX)-1), - RTL_TEXTENCODING_ASCII_US ); + rtl::OString sId(rtl::OUStringToOString(sTmp.Copy( + sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX)-1), + RTL_TEXTENCODING_ASCII_US)); GraphicObject *pOldGrfObj = pImpl->pGraphicObject; pImpl->pGraphicObject = new GraphicObject( sId ); ApplyGraphicTransparency_Impl(); diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 9deaf748c23e..1040ba8ed947 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1734,8 +1734,8 @@ void GeneratePackageName ( const String& rShort, String& rPackageName ) rPackageName = rShort; xub_StrLen nPos = 0; sal_Unicode pDelims[] = { '!', '/', ':', '.', '\\', 0 }; - ByteString sByte ( rPackageName, RTL_TEXTENCODING_UTF7); - rPackageName = String (sByte, RTL_TEXTENCODING_ASCII_US); + rtl::OString sByte(rtl::OUStringToOString(rPackageName, RTL_TEXTENCODING_UTF7)); + rPackageName = rtl::OStringToOUString(sByte, RTL_TEXTENCODING_ASCII_US); while( STRING_NOTFOUND != ( nPos = rPackageName.SearchChar( pDelims, nPos ))) { rPackageName.SetChar( nPos, '_' ); diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 5a7100326dcd..6853c139ebd2 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -4361,7 +4361,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons if( bLinkGrf && !bGrfRead ) // sj: #i55484# if the graphic was embedded ( bGrfRead == true ) then { // we do not need to set a link. TODO: not to lose the information where the graphic is linked from INetURLObject aAbsURL; - if ( !INetURLObject( maBaseURL ).GetNewAbsURL( ByteString( aFileName, RTL_TEXTENCODING_UTF8 ), &aAbsURL ) ) + if ( !INetURLObject( maBaseURL ).GetNewAbsURL( rtl::OUStringToOString(aFileName, RTL_TEXTENCODING_UTF8), &aAbsURL ) ) { String aValidURL; if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aFileName, aValidURL ) ) diff --git a/l10ntools/inc/gsicheck.hxx b/l10ntools/inc/gsicheck.hxx index 971f85016fbd..da78d3994132 100644 --- a/l10ntools/inc/gsicheck.hxx +++ b/l10ntools/inc/gsicheck.hxx @@ -70,7 +70,7 @@ public: ByteString const GetQuickHelpText() const { return aQuickHelpText; } ByteString const GetTitle() const { return aTitle; } - void SetUText( String &aNew ) { aText = ByteString( aNew, RTL_TEXTENCODING_UTF8 ); ReassembleLine(); } + void SetUText( String &aNew ) { aText = rtl::OUStringToOString(aNew, RTL_TEXTENCODING_UTF8); ReassembleLine(); } void SetText( ByteString &aNew ) { aText = aNew; ReassembleLine(); } void SetQuickHelpText( ByteString &aNew ) { aQuickHelpText = aNew; ReassembleLine(); } void SetTitle( ByteString &aNew ) { aTitle = aNew; ReassembleLine(); } diff --git a/l10ntools/inc/xmlparse.hxx b/l10ntools/inc/xmlparse.hxx index 75db02e77bfb..3e9906665226 100644 --- a/l10ntools/inc/xmlparse.hxx +++ b/l10ntools/inc/xmlparse.hxx @@ -245,7 +245,7 @@ protected: String sFileName; String sFullName; - const ByteString ID,OLDREF,XML_LANG; + const rtl::OString ID, OLDREF, XML_LANG; TagMap nodes_localize; XMLHashMap* XMLStrings; diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx index 9d513af9d878..f44c1a8cf00d 100644 --- a/l10ntools/source/cfgmerge.cxx +++ b/l10ntools/source/cfgmerge.cxx @@ -216,8 +216,8 @@ extern FILE *GetCfgFile() DirEntry aSourceFile( String( sInputFileName , RTL_TEXTENCODING_ASCII_US ) ); aSourceFile.CopyTo( aTempFile , FSYS_ACTION_COPYFILE ); String sTempFile = aTempFile.GetFull(); - Export::RemoveUTF8ByteOrderMarkerFromFile( ByteString( sTempFile , RTL_TEXTENCODING_ASCII_US ) ); - pFile = fopen( ByteString( sTempFile , RTL_TEXTENCODING_ASCII_US ).GetBuffer(), "r" ); + Export::RemoveUTF8ByteOrderMarkerFromFile( rtl::OUStringToOString(sTempFile , RTL_TEXTENCODING_ASCII_US) ); + pFile = fopen(rtl::OUStringToOString(sTempFile , RTL_TEXTENCODING_ASCII_US).getStr(), "r"); sUsedTempFile = sTempFile; }else{ // able to open file? @@ -234,15 +234,15 @@ extern FILE *GetCfgFile() // create path to project root DirEntry aEntry( String( sInputFileName, RTL_TEXTENCODING_ASCII_US )); aEntry.ToAbs(); - sFullEntry= ByteString( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); + sFullEntry = rtl::OUStringToOString(aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US); aEntry += DirEntry( String( "..", RTL_TEXTENCODING_ASCII_US )); aEntry += DirEntry( sPrjRoot ); - ByteString sPrjEntry( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString sPrjEntry(rtl::OUStringToOString(aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US)); // create file name, beginnig with project root // (e.g.: source\ui\src\menue.src) // printf("sFullEntry = %s\n",sFullEntry.GetBuffer()); - sActFileName = sFullEntry.Copy( sPrjEntry.Len() + 1 ); + sActFileName = sFullEntry.Copy( sPrjEntry.getLength() + 1 ); // printf("sActFileName = %s\n",sActFileName.GetBuffer()); sActFileName.SearchAndReplaceAll( "/", "\\" ); diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx index 37c26b67dc3f..2acbede53c4a 100644 --- a/l10ntools/source/export2.cxx +++ b/l10ntools/source/export2.cxx @@ -228,8 +228,8 @@ void Export::RemoveUTF8ByteOrderMarkerFromFile( const ByteString &rFilename ) if( hasUTF8ByteOrderMarker( sLine ) ) { DirEntry aTempFile = Export::GetTempFile(); - ByteString sTempFile = ByteString( aTempFile.GetFull() , RTL_TEXTENCODING_ASCII_US ); - SvFileStream aNewFile( String( sTempFile , RTL_TEXTENCODING_ASCII_US ) , STREAM_WRITE ); + rtl::OString sTempFile = rtl::OUStringToOString(aTempFile.GetFull() , RTL_TEXTENCODING_ASCII_US); + SvFileStream aNewFile(rtl::OStringToOUString(sTempFile , RTL_TEXTENCODING_ASCII_US) , STREAM_WRITE); // Remove header RemoveUTF8ByteOrderMarker( sLine ); aNewFile.WriteLine( sLine ); @@ -431,7 +431,7 @@ ByteString Export::GetNativeFile( ByteString sSource ) /*****************************************************************************/ { DirEntry aTemp( GetTempFile()); - ByteString sReturn( aTemp.GetFull(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString sReturn(rtl::OUStringToOString(aTemp.GetFull(), RTL_TEXTENCODING_ASCII_US)); for ( sal_uInt16 i = 0; i < 10; i++ ) if ( ConvertLineEnds( sSource, sReturn )) @@ -509,20 +509,24 @@ DirEntry Export::GetTempFile() INetURLObject::DecodeMechanism eMechanism = INetURLObject::DECODE_TO_IURI; String sDecodedStr = INetURLObject::decode( strTmp , '%' , eMechanism ); - ByteString sTmp( sDecodedStr , RTL_TEXTENCODING_UTF8 ); + rtl::OString sTmp(rtl::OUStringToOString(sDecodedStr , RTL_TEXTENCODING_UTF8)); #if defined(WNT) - sTmp.SearchAndReplace("file:///",""); - sTmp.SearchAndReplaceAll('/','\\'); + sTmp = comphelper::string::replace(sTmp, + rtl::OString(RTL_CONSTASCII_STRINGPARAM("file:///")), + rtl::OString()); + sTmp = sTmp.replace('/', '\\'); #else // Set file permission to 644 - const sal_uInt64 nPerm = osl_File_Attribute_OwnRead | osl_File_Attribute_OwnWrite | + const sal_uInt64 nPerm = osl_File_Attribute_OwnRead | osl_File_Attribute_OwnWrite | osl_File_Attribute_GrpRead | osl_File_Attribute_OthRead ; nRC = osl::File::setAttributes( *sTempFilename , nPerm ); if( nRC ) printf(" osl::File::setAttributes RC = %d",nRC); - sTmp.SearchAndReplace("file://",""); + sTmp = comphelper::string::replace(sTmp, + rtl::OString(RTL_CONSTASCII_STRINGPARAM("file://")), + rtl::OString()); #endif DirEntry aDirEntry( sTmp ); delete sTempFilename; diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx index 17b3d52ff940..56708290d9ad 100644 --- a/l10ntools/source/gsicheck.cxx +++ b/l10ntools/source/gsicheck.cxx @@ -124,7 +124,8 @@ void LazySvFileStream::LazyOpen() Open( aFileName, eOpenMode ); if ( !IsOpen()) { - fprintf( stderr, "\nERROR: Could not open Output-File %s!\n\n", ByteString( aFileName, RTL_TEXTENCODING_ASCII_US ).GetBuffer() ); + fprintf( stderr, "\nERROR: Could not open Output-File %s!\n\n", + rtl::OUStringToOString(aFileName, RTL_TEXTENCODING_ASCII_US).getStr() ); exit ( 4 ); } bOpened = sal_True; @@ -403,8 +404,8 @@ void GSIBlock::PrintList( ParserMessageList *pList, ByteString aPrefix, sal_Bool GSIBlock::IsUTF8( const ByteString &aTestee, sal_Bool bFixTags, sal_uInt16 &nErrorPos, ByteString &aErrorMsg, sal_Bool &bHasBeenFixed, ByteString &aFixed ) const /*****************************************************************************/ { - String aUTF8Tester( aTestee, RTL_TEXTENCODING_UTF8 ); - if ( STRING_MATCH != (nErrorPos = ByteString( aUTF8Tester, RTL_TEXTENCODING_UTF8 ).Match( aTestee )) ) + String aUTF8Tester(rtl::OStringToOUString(aTestee, RTL_TEXTENCODING_UTF8)); + if ( STRING_MATCH != (nErrorPos = ByteString(rtl::OUStringToOString(aUTF8Tester, RTL_TEXTENCODING_UTF8)).Match( aTestee )) ) { aUTF8Tester = String( aTestee.GetBuffer(), nErrorPos, RTL_TEXTENCODING_UTF8 ); nErrorPos = aUTF8Tester.Len(); @@ -446,23 +447,23 @@ sal_Bool GSIBlock::IsUTF8( const ByteString &aTestee, sal_Bool bFixTags, sal_uIn } } - ByteString aDelimiter( (String)String( sal_Unicode(0x2016) ), RTL_TEXTENCODING_UTF8 ); + rtl::OString aDelimiter(rtl::OUStringToOString(String( sal_Unicode(0x2016) ), RTL_TEXTENCODING_UTF8)); - if ( aID.Equals( aDelimiter, 6, aDelimiter.Len() ) ) + if ( aID.Equals( aDelimiter, 6, aDelimiter.getLength() ) ) { // New KeyId 6 Letters, digits and spechial chars followed by delimiter bNewId = sal_True; nErrorPos = 1; aID = aID.Copy( 0, 6 ); nAfterID += 6; - nAfterID = nAfterID + aDelimiter.Len(); + nAfterID = nAfterID + aDelimiter.getLength(); } - else if ( ( aID.GetChar(6) == '*' ) && aID.Equals( aDelimiter, 7, aDelimiter.Len() ) ) + else if ( ( aID.GetChar(6) == '*' ) && aID.Equals( aDelimiter, 7, aDelimiter.getLength() ) ) { // New KeyId 6 Letters, digits and spechial chars followed by '*delimiter' to indicate translation in progress bNewId = sal_True; nErrorPos = 1; aID = aID.Copy( 0, 6 ); nAfterID += 7; - nAfterID = nAfterID + aDelimiter.Len(); + nAfterID = nAfterID + aDelimiter.getLength(); } else if ( aID.GetTokenCount( '.' ) > 1 ) { // test for old KeyIDs 5 to 6 digits followed by a dot '44373.' diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx index 8461df7abf9a..9fae8083b2c5 100644 --- a/l10ntools/source/helpmerge.cxx +++ b/l10ntools/source/helpmerge.cxx @@ -95,15 +95,18 @@ bool HelpParser::CreateSDF( String sUsedTempFile; String sXmlFile; - if( Export::fileHasUTF8ByteOrderMarker( sHelpFile ) ){ + if( Export::fileHasUTF8ByteOrderMarker( sHelpFile ) ) + { DirEntry aTempFile = Export::GetTempFile(); DirEntry aSourceFile( String( sHelpFile , RTL_TEXTENCODING_ASCII_US ) ); aSourceFile.CopyTo( aTempFile , FSYS_ACTION_COPYFILE ); String sTempFile = aTempFile.GetFull(); - Export::RemoveUTF8ByteOrderMarkerFromFile( ByteString( sTempFile , RTL_TEXTENCODING_ASCII_US ) ); + Export::RemoveUTF8ByteOrderMarkerFromFile(rtl::OUStringToOString(sTempFile , RTL_TEXTENCODING_ASCII_US)); sUsedTempFile = sTempFile; sXmlFile = sTempFile; - }else{ + } + else + { sUsedTempFile = String::CreateFromAscii(""); sXmlFile = String( sHelpFile , RTL_TEXTENCODING_ASCII_US ); } @@ -121,8 +124,9 @@ bool HelpParser::CreateSDF( //printf( "%s\n", fullFilePath.GetBuffer() ); std::auto_ptr <XMLFile> file ( aParser.Execute( strFullPath , sXmlFile, pXmlFile ) ); - if(file.get() == NULL){ - printf("%s\n",ByteString(aParser.GetError().sMessage,RTL_TEXTENCODING_ASCII_US).GetBuffer()); + if(file.get() == NULL) + { + printf("%s\n", rtl::OUStringToOString(aParser.GetError().sMessage, RTL_TEXTENCODING_ASCII_US).getStr()); exit(-1); } file->Extract(); @@ -195,8 +199,9 @@ bool HelpParser::CreateSDF( sBuffer.append( data ); sBuffer.append( GSI_SEQUENCE4 ); //"\t\t\t\t"; sBuffer.append( sOUTimeStamp ); - ByteString sOut( sBuffer.makeStringAndClear().getStr() , RTL_TEXTENCODING_UTF8 ); - if( data.getLength() > 0 ) aSDFStream.WriteLine( sOut ); + rtl::OString sOut(rtl::OUStringToOString(sBuffer.makeStringAndClear().getStr() , RTL_TEXTENCODING_UTF8)); + if( data.getLength() > 0 ) + aSDFStream.WriteLine( sOut ); pXMLElement=NULL; }else fprintf(stdout,"\nDBG: NullPointer in HelpParser::CreateSDF , Language %s\n",sCur.GetBuffer() ); } @@ -213,18 +218,18 @@ bool HelpParser::CreateSDF( ByteString HelpParser::makeAbsolutePath( const ByteString& sHelpFile , const ByteString& rRoot_in ) { - DirEntry aEntry( String( sHelpFile, RTL_TEXTENCODING_ASCII_US )); + DirEntry aEntry( String( sHelpFile, RTL_TEXTENCODING_ASCII_US )); aEntry.ToAbs(); String sFullEntry = aEntry.GetFull(); aEntry += DirEntry( String( "..", RTL_TEXTENCODING_ASCII_US )); aEntry += DirEntry( rRoot_in ); - ByteString sPrjEntry( aEntry.GetFull(), osl_getThreadTextEncoding()); - ByteString sActFileName( - sFullEntry.Copy( sPrjEntry.Len() + 1 ), osl_getThreadTextEncoding()); + rtl::OString sPrjEntry(rtl::OUStringToOString(aEntry.GetFull(), osl_getThreadTextEncoding())); + rtl::OString sActFileName(rtl::OUStringToOString( + sFullEntry.Copy(sPrjEntry.getLength() + 1), osl_getThreadTextEncoding())); - sActFileName.SearchAndReplaceAll( "/", "\\" ); - return sActFileName; + return sActFileName.replace('/', '\\'); } + bool HelpParser::Merge( const ByteString &rSDFFile, const ByteString &rDestinationFile , ByteString& sLanguage , MergeDataFile& aMergeDataFile ) { @@ -242,7 +247,7 @@ bool HelpParser::Merge( const ByteString &rSDFFile, const ByteString &rDestinati DirEntry aSourceFile( String( sHelpFile , RTL_TEXTENCODING_ASCII_US ) ); aSourceFile.CopyTo( aTempFile , FSYS_ACTION_COPYFILE ); String sTempFile = aTempFile.GetFull(); - Export::RemoveUTF8ByteOrderMarkerFromFile( ByteString( sTempFile , RTL_TEXTENCODING_ASCII_US ) ); + Export::RemoveUTF8ByteOrderMarkerFromFile(rtl::OUStringToOString(sTempFile, RTL_TEXTENCODING_ASCII_US)); sUsedTempFile = sTempFile; sXmlFile = sTempFile; }else{ @@ -322,7 +327,7 @@ bool HelpParser::Merge( DirEntry aSourceFile( String( sHelpFile , RTL_TEXTENCODING_ASCII_US ) ); aSourceFile.CopyTo( aTempFile , FSYS_ACTION_COPYFILE ); String sTempFile = aTempFile.GetFull(); - Export::RemoveUTF8ByteOrderMarkerFromFile( ByteString( sTempFile , RTL_TEXTENCODING_ASCII_US ) ); + Export::RemoveUTF8ByteOrderMarkerFromFile(rtl::OUStringToOString(sTempFile , RTL_TEXTENCODING_ASCII_US)); sUsedTempFile = sTempFile; sXmlFile = sTempFile; } @@ -342,7 +347,7 @@ bool HelpParser::Merge( if( xmlfile == NULL) { - printf("%s\n",ByteString(aParser.GetError().sMessage,RTL_TEXTENCODING_UTF8).GetBuffer()); + printf("%s\n", rtl::OUStringToOString(aParser.GetError().sMessage, RTL_TEXTENCODING_UTF8).getStr()); exit(-1); } @@ -497,9 +502,10 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile return true; } -ByteString HelpParser::GetOutpath( const ByteString& rPathX , const ByteString& sCur , const ByteString& rPathY ){ +ByteString HelpParser::GetOutpath( const ByteString& rPathX , const ByteString& sCur , const ByteString& rPathY ) +{ ByteString testpath = rPathX; - static const ByteString sDelimiter( DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US ); + static const rtl::OString sDelimiter(rtl::OUStringToOString(DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US)); testpath = comphelper::string::stripEnd(testpath, '/'); testpath = comphelper::string::stripEnd(testpath, '\\'); testpath += sDelimiter; @@ -512,13 +518,15 @@ ByteString HelpParser::GetOutpath( const ByteString& rPathX , const ByteString& testpath += sDelimiter; return testpath; } -void HelpParser::MakeDir( const ByteString& sPath ){ + +void HelpParser::MakeDir( const ByteString& sPath ) +{ ByteString sTPath( sPath ); - ByteString sDelimiter( DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString sDelimiter(rtl::OUStringToOString(DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US)); sTPath.SearchAndReplaceAll( sDelimiter , rtl::OString('/') ); sal_uInt16 cnt = sTPath.GetTokenCount( '/' ); rtl::OStringBuffer sCreateDir; - for( sal_uInt16 i = 0 ; i < cnt ; i++ ) + for (sal_uInt16 i = 0; i < cnt; ++i) { sCreateDir.append(comphelper::string::getToken(sTPath, i , '/')); sCreateDir.append(sDelimiter); diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx index 0f2a5cf95c53..a641528c63fa 100644 --- a/l10ntools/source/lngmerge.cxx +++ b/l10ntools/source/lngmerge.cxx @@ -109,10 +109,11 @@ sal_Bool LngParser::CreateSDF( String sFullEntry = aEntry.GetFull(); aEntry += DirEntry( String( "..", RTL_TEXTENCODING_ASCII_US )); aEntry += DirEntry( rRoot ); - ByteString sPrjEntry( aEntry.GetFull(), osl_getThreadTextEncoding()); - ByteString sActFileName( - sFullEntry.Copy( sPrjEntry.Len() + 1 ), osl_getThreadTextEncoding()); - sActFileName.SearchAndReplaceAll( "/", "\\" ); + rtl::OString sPrjEntry(rtl::OUStringToOString(aEntry.GetFull(), + osl_getThreadTextEncoding())); + rtl::OString sActFileName(rtl::OUStringToOString( + sFullEntry.Copy( sPrjEntry.getLength() + 1 ), osl_getThreadTextEncoding())); + sActFileName = sActFileName.replace('/', '\\'); size_t nPos = 0; sal_Bool bStart = true; diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index 7325796fc23a..4969ba9d80a5 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -247,9 +247,9 @@ const ByteString SourceTreeLocalizer::GetProjectName( sal_Bool bAbs ) if ( aTest.Exists() ) { if ( bAbs ) - return ByteString( aCur.GetFull(), RTL_TEXTENCODING_ASCII_US ); + return rtl::OUStringToOString(aCur.GetFull(), RTL_TEXTENCODING_ASCII_US); else - return ByteString( aCur.GetName(), RTL_TEXTENCODING_ASCII_US ); + return rtl::OUStringToOString(aCur.GetName(), RTL_TEXTENCODING_ASCII_US); } } @@ -268,13 +268,13 @@ const ByteString SourceTreeLocalizer::GetProjectRootRel() ByteString sProjectRoot( GetProjectName( sal_True )); DirEntry aCur; aCur.ToAbs(); - ByteString sCur( aCur.GetFull(), RTL_TEXTENCODING_ASCII_US ); + ByteString sCur(rtl::OUStringToOString(aCur.GetFull(), RTL_TEXTENCODING_ASCII_US)); if( sCur.SearchAndReplace( sProjectRoot, "" ) == STRING_NOTFOUND ) return ""; - ByteString sDelimiter( - DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString sDelimiter(rtl::OUStringToOString( + DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US)); sCur.SearchAndReplaceAll( sDelimiter, "/" ); sCur = comphelper::string::stripStart(sCur, '/'); @@ -314,7 +314,7 @@ void SourceTreeLocalizer::WorkOnFile( { String sFull( rFileName, RTL_TEXTENCODING_ASCII_US ); DirEntry aEntry( sFull ); - ByteString sFileName( aEntry.GetName(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString sFileName(rtl::OUStringToOString(aEntry.GetName(), RTL_TEXTENCODING_ASCII_US)); // set current working directory DirEntry aPath( aEntry.GetPath()); @@ -327,7 +327,7 @@ void SourceTreeLocalizer::WorkOnFile( ByteString sRoot( GetProjectRootRel()); DirEntry aTemp( Export::GetTempFile()); - ByteString sTempFile( aTemp.GetFull(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString sTempFile(rtl::OUStringToOString(aTemp.GetFull(), RTL_TEXTENCODING_ASCII_US)); ByteString sDel; #if defined(WNT) @@ -395,8 +395,8 @@ sal_Bool SourceTreeLocalizer::CheckNegativeList( const ByteString &rFileName ) sal_uLong nIndex = 0; sal_Bool bReturn = sal_True; - ByteString sDelimiter( - DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString sDelimiter(rtl::OUStringToOString( + DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US)); ByteString sFileName( rFileName ); sFileName.ToLowerAscii(); @@ -424,8 +424,8 @@ sal_Bool SourceTreeLocalizer::CheckPositiveList( const ByteString &rFileName ) sal_uLong nIndex = 0; sal_Bool bReturn = sal_False; - ByteString sDelimiter( - DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString sDelimiter(rtl::OUStringToOString( + DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US)); ByteString sFileName( rFileName ); sFileName.ToLowerAscii(); @@ -462,9 +462,10 @@ void SourceTreeLocalizer::WorkOnFileType( DirEntry aEntry( sWild ); Dir aDir( sWild, FSYS_KIND_FILE ); - for ( sal_uInt16 i = 0; i < aDir.Count(); i++ ) { + for ( sal_uInt16 i = 0; i < aDir.Count(); i++ ) + { DirEntry aFile( aDir[ i ] ); - ByteString sFile( aFile.GetFull(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString sFile(rtl::OUStringToOString(aFile.GetFull(), RTL_TEXTENCODING_ASCII_US)); sal_Bool bAllowed = sal_True; @@ -603,7 +604,7 @@ int _cdecl main( int argc, char *argv[] ) DirEntry aEntry( String( sFileName , RTL_TEXTENCODING_ASCII_US )); aEntry.ToAbs(); String sFullEntry = aEntry.GetFull(); - ByteString sFileABS(aEntry.GetFull(), osl_getThreadTextEncoding()); + rtl::OString sFileABS(rtl::OUStringToOString(aEntry.GetFull(), osl_getThreadTextEncoding())); sFileName = sFileABS; string pwd; diff --git a/l10ntools/source/tagtest.cxx b/l10ntools/source/tagtest.cxx index 621e552d0177..58a1299917b3 100644 --- a/l10ntools/source/tagtest.cxx +++ b/l10ntools/source/tagtest.cxx @@ -223,7 +223,7 @@ void TokenInfo::SplitTag( ParserMessageList &rErrorList ) { if ( !IsPropertyValueValid( aName, aValue ) ) { - rErrorList.AddError( 25, ByteString("Property '").Append(aName).Append("' has invalid value '").Append(ByteString( aValue, RTL_TEXTENCODING_UTF8 )).Append("' "), *this ); + rErrorList.AddError( 25, ByteString("Property '").Append(aName).Append("' has invalid value '").Append(rtl::OUStringToOString(aValue, RTL_TEXTENCODING_UTF8)).Append("' "), *this ); bIsBroken = sal_True; } aProperties[ aName ] = aValue; @@ -334,7 +334,7 @@ void TokenInfo::SplitTag( ParserMessageList &rErrorList ) } else { - aName = ByteString( aPortion, RTL_TEXTENCODING_UTF8 ); + aName = rtl::OUStringToOString(aPortion, RTL_TEXTENCODING_UTF8); // "a-zA-Z_-.0-9" xub_StrLen nCount; sal_Bool bBroken = sal_False; @@ -364,7 +364,7 @@ void TokenInfo::SplitTag( ParserMessageList &rErrorList ) { if ( aPortion.Len() ) { - rErrorList.AddError( 25, ByteString("Found displaced characters '").Append(ByteString( aPortion, RTL_TEXTENCODING_UTF8 )).Append("' in Tag "), *this ); + rErrorList.AddError( 25, ByteString("Found displaced characters '").Append(rtl::OUStringToOString(aPortion, RTL_TEXTENCODING_UTF8)).Append("' in Tag "), *this ); bIsBroken = sal_True; } bCheckEmpty = sal_False; @@ -1323,7 +1323,7 @@ sal_Bool TokenParser::match( const TokenInfo &aCurrentToken, const TokenInfo &rE else { sTmp += ": "; - sTmp += ByteString( aParser.GetLexem( aExpectedToken ), RTL_TEXTENCODING_UTF8 ); + sTmp += rtl::OUStringToOString(aParser.GetLexem( aExpectedToken ), RTL_TEXTENCODING_UTF8); sTmp += " near "; ParseError( 7, sTmp, aCurrentToken ); } diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx index e253a7fcf4c2..382ab42ba409 100644 --- a/l10ntools/source/xmlparse.cxx +++ b/l10ntools/source/xmlparse.cxx @@ -160,23 +160,29 @@ int XMLParentNode::GetPosition( ByteString id ){ /*****************************************************************************/ XMLElement* a; - static const ByteString sEnusStr = ByteString(String::CreateFromAscii(ENGLISH_US_ISO).ToLowerAscii() , RTL_TEXTENCODING_ASCII_US ).ToLowerAscii(); - static const ByteString sDeStr = ByteString(String::CreateFromAscii(GERMAN_ISO2).ToLowerAscii() , RTL_TEXTENCODING_ASCII_US ).ToLowerAscii(); + static const rtl::OString sEnusStr = rtl::OString(RTL_CONSTASCII_STRINGPARAM(ENGLISH_US_ISO)).toAsciiLowerCase(); + static const rtl::OString sDeStr = rtl::OString(RTL_CONSTASCII_STRINGPARAM(GERMAN_ISO2)).toAsciiLowerCase(); - if ( pChildList ){ - for ( size_t i = 0; i < pChildList->size(); i++ ) { + if ( pChildList ) + { + for (size_t i = 0; i < pChildList->size(); ++i) + { XMLChildNode *pChild = (*pChildList)[ i ]; - if ( pChild->GetNodeType() == XML_NODE_TYPE_ELEMENT ){ + if ( pChild->GetNodeType() == XML_NODE_TYPE_ELEMENT ) + { a = static_cast<XMLElement* >(pChild); ByteString elemid( a->GetId() ); elemid.ToLowerAscii(); - if ( elemid.Equals( id.ToLowerAscii() ) ){ + if ( elemid.Equals( id.ToLowerAscii() ) ) + { ByteString elemLID( a->GetLanguageId() ); elemLID.ToLowerAscii(); - if( elemLID.Equals( sEnusStr) ) { + if( elemLID.Equals( sEnusStr) ) + { return i; } - else if( elemLID.Equals( sDeStr) ) { + else if( elemLID.Equals( sDeStr) ) + { return i; } } @@ -318,15 +324,12 @@ sal_Bool XMLFile::Write( ByteString &aFilename ) exit( -1 ); } - - void XMLFile::WriteString( ofstream &rStream, const String &sString ) { - ByteString sText( sString, RTL_TEXTENCODING_UTF8 ); - rStream << sText.GetBuffer(); + rtl::OString sText(rtl::OUStringToOString(sString, RTL_TEXTENCODING_UTF8)); + rStream << sText.getStr(); } - sal_Bool XMLFile::Write( ofstream &rStream , XMLNode *pCur ) { if ( !pCur ) @@ -408,41 +411,46 @@ void XMLFile::Print( XMLNode *pCur, sal_uInt16 nLevel ) case XML_NODE_TYPE_ELEMENT: { XMLElement *pElement = ( XMLElement * ) pCur; - fprintf( stdout, "<%s", ByteString( pElement->GetName(), RTL_TEXTENCODING_UTF8 ).GetBuffer()); + fprintf( stdout, "<%s", rtl::OUStringToOString(pElement->GetName(), RTL_TEXTENCODING_UTF8).getStr()); if ( pElement->GetAttributeList()) - for ( size_t j = 0; j < pElement->GetAttributeList()->size(); j++ ){ - ByteString aAttrName( *(*pElement->GetAttributeList())[ j ], RTL_TEXTENCODING_UTF8 ); - if( !aAttrName.EqualsIgnoreCaseAscii( XML_LANG ) ) { + { + for (size_t j = 0; j < pElement->GetAttributeList()->size(); ++j) + { + rtl::OString aAttrName(rtl::OUStringToOString(*(*pElement->GetAttributeList())[j], + RTL_TEXTENCODING_UTF8)); + if (!aAttrName.equalsIgnoreAsciiCase(XML_LANG)) + { fprintf( stdout, " %s=\"%s\"", - aAttrName.GetBuffer(), - ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(), - RTL_TEXTENCODING_UTF8 ).GetBuffer()); + aAttrName.getStr(), + rtl::OUStringToOString( (*pElement->GetAttributeList())[ j ]->GetValue(), + RTL_TEXTENCODING_UTF8).getStr()); } } + } if ( !pElement->GetChildList()) fprintf( stdout, "/>" ); else { fprintf( stdout, ">" ); for ( size_t k = 0; k < pElement->GetChildList()->size(); k++ ) Print( (*pElement->GetChildList())[ k ], nLevel + 1 ); - fprintf( stdout, "</%s>", ByteString( pElement->GetName(), RTL_TEXTENCODING_UTF8 ).GetBuffer()); + fprintf( stdout, "</%s>", rtl::OUStringToOString(pElement->GetName(), RTL_TEXTENCODING_UTF8).getStr()); } } break; case XML_NODE_TYPE_DATA: { XMLData *pData = ( XMLData * ) pCur; String sData = pData->GetData(); - fprintf( stdout, "%s", ByteString( sData, RTL_TEXTENCODING_UTF8 ).GetBuffer()); + fprintf( stdout, "%s", rtl::OUStringToOString(sData, RTL_TEXTENCODING_UTF8).getStr()); } break; case XML_NODE_TYPE_COMMENT: { XMLComment *pComment = ( XMLComment * ) pCur; - fprintf( stdout, "<!--%s-->", ByteString( pComment->GetComment(), RTL_TEXTENCODING_UTF8 ).GetBuffer()); + fprintf( stdout, "<!--%s-->", rtl::OUStringToOString(pComment->GetComment(), RTL_TEXTENCODING_UTF8).getStr()); } break; case XML_NODE_TYPE_DEFAULT: { XMLDefault *pDefault = ( XMLDefault * ) pCur; - fprintf( stdout, "%s", ByteString( pDefault->GetDefault(), RTL_TEXTENCODING_UTF8 ).GetBuffer()); + fprintf( stdout, "%s", rtl::OUStringToOString(pDefault->GetDefault(), RTL_TEXTENCODING_UTF8).getStr()); } break; } @@ -470,13 +478,13 @@ XMLFile::XMLFile( const String &rFileName ) // the file name, empty if created f XMLStrings ( NULL ) { - nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("bookmark"),RTL_TEXTENCODING_ASCII_US) , sal_True) ); - nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("variable"),RTL_TEXTENCODING_ASCII_US) , sal_True) ); - nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("paragraph"),RTL_TEXTENCODING_ASCII_US) , sal_True) ); - nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("alt"),RTL_TEXTENCODING_ASCII_US) , sal_True) ); - nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("caption"),RTL_TEXTENCODING_ASCII_US) , sal_True) ); - nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("title"),RTL_TEXTENCODING_ASCII_US) , sal_True) ); - nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("link"),RTL_TEXTENCODING_ASCII_US) , sal_True) ); + nodes_localize.insert( TagMap::value_type(rtl::OString(RTL_CONSTASCII_STRINGPARAM("bookmark")) , sal_True) ); + nodes_localize.insert( TagMap::value_type(rtl::OString(RTL_CONSTASCII_STRINGPARAM("variable")) , sal_True) ); + nodes_localize.insert( TagMap::value_type(rtl::OString(RTL_CONSTASCII_STRINGPARAM("paragraph")) , sal_True) ); + nodes_localize.insert( TagMap::value_type(rtl::OString(RTL_CONSTASCII_STRINGPARAM("alt")) , sal_True) ); + nodes_localize.insert( TagMap::value_type(rtl::OString(RTL_CONSTASCII_STRINGPARAM("caption")) , sal_True) ); + nodes_localize.insert( TagMap::value_type(rtl::OString(RTL_CONSTASCII_STRINGPARAM("title")) , sal_True) ); + nodes_localize.insert( TagMap::value_type(rtl::OString(RTL_CONSTASCII_STRINGPARAM("link")) , sal_True) ); } /*****************************************************************************/ void XMLFile::Extract( XMLFile *pCur ) @@ -501,13 +509,14 @@ void XMLFile::InsertL10NElement( XMLElement* pElement ){ LangHashMap* elem; if( pElement->GetAttributeList() != NULL ){ - for ( size_t j = 0; j < pElement->GetAttributeList()->size(); j++ ){ - tmpStr=ByteString( *(*pElement->GetAttributeList())[ j ], RTL_TEXTENCODING_UTF8 ); + for ( size_t j = 0; j < pElement->GetAttributeList()->size(); j++ ) + { + tmpStr=rtl::OUStringToOString(*(*pElement->GetAttributeList())[ j ], RTL_TEXTENCODING_UTF8); if( tmpStr.CompareTo(ID)==COMPARE_EQUAL ){ // Get the "id" Attribute - id = ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 ); + id = rtl::OUStringToOString((*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8); } if( tmpStr.CompareTo( XML_LANG ) == COMPARE_EQUAL ){ // Get the "xml-lang" Attribute - language = ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 ); + language = rtl::OUStringToOString((*pElement->GetAttributeList())[j]->GetValue(),RTL_TEXTENCODING_UTF8); } } @@ -528,7 +537,7 @@ void XMLFile::InsertL10NElement( XMLElement* pElement ){ elem=pos->second; if ( (*elem)[ language ] ) { - fprintf(stdout,"Error: Duplicated entry. ID = %s LANG = %s in File %s\n", id.GetBuffer(), language.GetBuffer(), ByteString( sFullName,RTL_TEXTENCODING_ASCII_US ).GetBuffer() ); + fprintf(stdout,"Error: Duplicated entry. ID = %s LANG = %s in File %s\n", id.GetBuffer(), language.GetBuffer(), rtl::OUStringToOString(sFullName, RTL_TEXTENCODING_ASCII_US).getStr() ); exit( -1 ); } (*elem)[ language ]=pElement; @@ -606,22 +615,24 @@ void XMLFile::SearchL10NElements( XMLParentNode *pCur , int pos) break; case XML_NODE_TYPE_ELEMENT: { XMLElement *pElement = ( XMLElement * ) pCur; - ByteString sName(pElement->GetName(),RTL_TEXTENCODING_ASCII_US); + rtl::OString sName(rtl::OUStringToOString(pElement->GetName(), RTL_TEXTENCODING_ASCII_US).toAsciiLowerCase()); ByteString language,tmpStrVal,oldref; - if ( pElement->GetAttributeList()){ - for ( size_t j = 0 , cnt = pElement->GetAttributeList()->size(); j < cnt && bInsert; j++ ){ - const ByteString tmpStr( *(*pElement->GetAttributeList())[ j ],RTL_TEXTENCODING_UTF8 ); + if ( pElement->GetAttributeList()) + { + for ( size_t j = 0 , cnt = pElement->GetAttributeList()->size(); j < cnt && bInsert; ++j ) + { + const ByteString tmpStr = rtl::OUStringToOString(*(*pElement->GetAttributeList())[j], RTL_TEXTENCODING_UTF8); if( tmpStr.CompareTo(THEID)==COMPARE_EQUAL ){ // Get the "id" Attribute - tmpStrVal=ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 ); + tmpStrVal=rtl::OUStringToOString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 ); } if( tmpStr.CompareTo(LOCALIZE)==COMPARE_EQUAL ){ // Get the "localize" Attribute bInsert=false; } if( tmpStr.CompareTo(XML_LANG)==COMPARE_EQUAL ){ // Get the "xml-lang" Attribute - language=ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 ); + language=rtl::OUStringToOString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 ); } if( tmpStr.CompareTo(OLDREF)==COMPARE_EQUAL ){ // Get the "oldref" Attribute - oldref=ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 ); + oldref=rtl::OUStringToOString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 ); } } pElement->SetLanguageId ( language ); @@ -630,7 +641,7 @@ void XMLFile::SearchL10NElements( XMLParentNode *pCur , int pos) pElement->SetPos( pos ); } - if ( bInsert && ( nodes_localize.find( sName.ToLowerAscii() ) != nodes_localize.end() ) ) + if ( bInsert && ( nodes_localize.find( sName ) != nodes_localize.end() ) ) InsertL10NElement(pElement); else if ( bInsert && pElement->GetChildList() ){ for ( size_t k = 0; k < pElement->GetChildList()->size(); k++ ) @@ -657,11 +668,11 @@ bool XMLFile::CheckExportStatus( XMLParentNode *pCur ) { static bool bStatusExport = true; const ByteString LOCALIZE("localize"); - const ByteString STATUS("status"); - const ByteString PUBLISH("PUBLISH"); - const ByteString DEPRECATED("DEPRECATED"); + const rtl::OString STATUS(RTL_CONSTASCII_STRINGPARAM("status")); + const rtl::OString PUBLISH(RTL_CONSTASCII_STRINGPARAM("PUBLISH")); + const rtl::OString DEPRECATED(RTL_CONSTASCII_STRINGPARAM("DEPRECATED")); + const rtl::OString TOPIC(RTL_CONSTASCII_STRINGPARAM("topic")); - const ByteString TOPIC("topic"); bool bInsert = true; if ( !pCur ) CheckExportStatus( this ); @@ -679,15 +690,22 @@ bool XMLFile::CheckExportStatus( XMLParentNode *pCur ) break; case XML_NODE_TYPE_ELEMENT: { XMLElement *pElement = ( XMLElement * ) pCur; - ByteString sName(pElement->GetName(),RTL_TEXTENCODING_ASCII_US); - if( sName.EqualsIgnoreCaseAscii( TOPIC ) ){ - if ( pElement->GetAttributeList()){ - for ( size_t j = 0 , cnt = pElement->GetAttributeList()->size(); j < cnt && bInsert; j++ ){ - const ByteString tmpStr( *(*pElement->GetAttributeList())[ j ],RTL_TEXTENCODING_UTF8 ); - if( tmpStr.EqualsIgnoreCaseAscii( STATUS ) ){ - ByteString tmpStrVal=ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 ); - if( !tmpStrVal.EqualsIgnoreCaseAscii( PUBLISH ) && - !tmpStrVal.EqualsIgnoreCaseAscii( DEPRECATED )){ + rtl::OString sName(rtl::OUStringToOString(pElement->GetName(), RTL_TEXTENCODING_ASCII_US)); + if (sName.equalsIgnoreAsciiCase(TOPIC)) + { + if ( pElement->GetAttributeList()) + { + for (size_t j = 0 , cnt = pElement->GetAttributeList()->size(); j < cnt && bInsert; ++j) + { + const rtl::OString tmpStr(rtl::OUStringToOString(*(*pElement->GetAttributeList())[j], + RTL_TEXTENCODING_UTF8)); + if (tmpStr.equalsIgnoreAsciiCase(STATUS)) + { + rtl::OString tmpStrVal(rtl::OUStringToOString( (*pElement->GetAttributeList())[j]->GetValue(), + RTL_TEXTENCODING_UTF8)); + if (!tmpStrVal.equalsIgnoreAsciiCase(PUBLISH) && + !tmpStrVal.equalsIgnoreAsciiCase(DEPRECATED)) + { bStatusExport = false; } } @@ -695,9 +713,10 @@ bool XMLFile::CheckExportStatus( XMLParentNode *pCur ) } } } - else if ( pElement->GetChildList() ){ - for ( size_t k = 0; k < pElement->GetChildList()->size(); k++ ) - CheckExportStatus( (XMLParentNode*)(*pElement->GetChildList())[ k ] ); + else if ( pElement->GetChildList() ) + { + for (size_t k = 0; k < pElement->GetChildList()->size(); ++k) + CheckExportStatus( (XMLParentNode*)(*pElement->GetChildList())[k] ); } } break; @@ -774,28 +793,32 @@ void XMLElement::AddAttribute( const String &rAttribute, const String &rValue ) } /*****************************************************************************/ -void XMLElement::ChangeLanguageTag( const String &rValue ){ -/*****************************************************************************/ +void XMLElement::ChangeLanguageTag( const String &rValue ) +{ static const String rName = String::CreateFromAscii("xml-lang"); - SetLanguageId( ByteString(rValue,RTL_TEXTENCODING_UTF8) ); - if ( pAttributes ){ - for ( size_t i = 0; i < pAttributes->size(); i++ ){ - if ( *(*pAttributes)[ i ] == rName ){ + SetLanguageId(rtl::OUStringToOString(rValue, RTL_TEXTENCODING_UTF8)); + if ( pAttributes ) + { + for (size_t i = 0; i < pAttributes->size(); ++i) + { + if ( *(*pAttributes)[ i ] == rName ) (*pAttributes)[ i ]->setValue(rValue); - } } } XMLChildNode* pNode = NULL; XMLElement* pElem = NULL; XMLChildNodeList* pCList = GetChildList(); - if( pCList != NULL ){ - for ( size_t i = 0; i < pCList->size(); i++ ){ + if( pCList != NULL ) + { + for ( size_t i = 0; i < pCList->size(); i++ ) + { pNode = (*pCList)[ i ]; - if( pNode != NULL && pNode->GetNodeType() == XML_NODE_TYPE_ELEMENT ){ + if( pNode != NULL && pNode->GetNodeType() == XML_NODE_TYPE_ELEMENT ) + { pElem = static_cast< XMLElement* >(pNode); pElem->ChangeLanguageTag( rValue ); - pElem->SetLanguageId( ByteString(rValue,RTL_TEXTENCODING_UTF8) ); + pElem->SetLanguageId(rtl::OUStringToOString(rValue, RTL_TEXTENCODING_UTF8)); pElem = NULL; pNode = NULL; } @@ -1339,10 +1362,12 @@ void XMLUtil::UnQuotHTML( String &rString ){ UnQuotData( rString ); } -void XMLUtil::UnQuotData( String &rString_in ){ +void XMLUtil::UnQuotData( String &rString_in ) +{ rtl::OStringBuffer sReturn; - ByteString sString( rString_in , RTL_TEXTENCODING_UTF8 ); - while ( sString.Len()) { + ByteString sString(rtl::OUStringToOString(rString_in , RTL_TEXTENCODING_UTF8)); + while (sString.Len()) + { if ( sString.Copy( 0, 1 ) == "\\" ) { sReturn.append("\\\\"); sString.Erase( 0, 1 ); diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index fbc0017b92f8..cc7d54003b63 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -210,8 +210,8 @@ extern FILE *GetXrmFile() DirEntry aSourceFile( String( sInputFileName , RTL_TEXTENCODING_ASCII_US ) ); aSourceFile.CopyTo( aTempFile , FSYS_ACTION_COPYFILE ); String sTempFile = aTempFile.GetFull(); - Export::RemoveUTF8ByteOrderMarkerFromFile( ByteString( sTempFile , RTL_TEXTENCODING_ASCII_US ) ); - pFile = fopen( ByteString( sTempFile , RTL_TEXTENCODING_ASCII_US ).GetBuffer(), "r" ); + Export::RemoveUTF8ByteOrderMarkerFromFile(rtl::OUStringToOString(sTempFile , RTL_TEXTENCODING_ASCII_US) ); + pFile = fopen(rtl::OUStringToOString(sTempFile , RTL_TEXTENCODING_ASCII_US).getStr(), "r"); sUsedTempFile = sTempFile; }else{ // able to open file? @@ -227,14 +227,14 @@ extern FILE *GetXrmFile() // create path to project root DirEntry aEntry( String( sInputFileName, RTL_TEXTENCODING_ASCII_US )); aEntry.ToAbs(); - ByteString sFullEntry( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString sFullEntry(rtl::OUStringToOString(aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US)); aEntry += DirEntry( String( "..", RTL_TEXTENCODING_ASCII_US )); aEntry += DirEntry( sPrjRoot ); - ByteString sPrjEntry( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString sPrjEntry(rtl::OUStringToOString(aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US)); // create file name, beginnig with project root // (e.g.: source\ui\src\menue.src) - sActFileName = sFullEntry.Copy( sPrjEntry.Len() + 1 ); + sActFileName = sFullEntry.copy(sPrjEntry.getLength() + 1); sActFileName.SearchAndReplaceAll( "/", "\\" ); @@ -529,7 +529,7 @@ void XRMResExport::WorkOnDesc( { DirEntry aEntry( String( sInputFileName, RTL_TEXTENCODING_ASCII_US )); aEntry.ToAbs(); - ByteString sDescFileName( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); + ByteString sDescFileName(rtl::OUStringToOString(aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US)); sDescFileName.SearchAndReplaceAll( "description.xml", "" ); sDescFileName += GetAttribute( rOpenTag, "xlink:href" ); int size; @@ -699,8 +699,8 @@ void XRMResMerge::WorkOnDesc( DirEntry aEntry( String( sOutputFile, RTL_TEXTENCODING_ASCII_US )); aEntry.ToAbs(); - ByteString sOutputDescFile( aEntry.GetPath().GetFull(), RTL_TEXTENCODING_ASCII_US ); - ByteString sDel( DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US ); + ByteString sOutputDescFile(rtl::OUStringToOString(aEntry.GetPath().GetFull(), RTL_TEXTENCODING_ASCII_US)); + rtl::OString sDel(rtl::OUStringToOString(DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US)); sOutputDescFile += sDel; sOutputDescFile += sLocDescFilename; sText.SearchAndReplaceAll( "\\n", "\n" ); diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index ba7e1f52fb5f..6d7d1c6672eb 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -395,18 +395,17 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL) return pStream->GetError(); } - -static ByteString formatForSave( - const uno::Reference< XDictionaryEntry > &xEntry, rtl_TextEncoding eEnc ) +static rtl::OString formatForSave(const uno::Reference< XDictionaryEntry > &xEntry, + rtl_TextEncoding eEnc ) { - ByteString aStr(xEntry->getDictionaryWord().getStr(), eEnc); + rtl::OStringBuffer aStr(rtl::OUStringToOString(xEntry->getDictionaryWord(), eEnc)); if (xEntry->isNegative()) { - aStr += "=="; - aStr += ByteString(xEntry->getReplacementText().getStr(), eEnc); + aStr.append(RTL_CONSTASCII_STRINGPARAM("==")); + aStr.append(rtl::OUStringToOString(xEntry->getReplacementText(), eEnc)); } - return aStr; + return aStr.makeStringAndClear(); } @@ -450,9 +449,9 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL) pStream->WriteLine(ByteString("lang: <none>")); else { - ByteString aLine("lang: "); - aLine += ByteString( String( MsLangId::convertLanguageToIsoString( nLanguage ) ), eEnc); - pStream->WriteLine( aLine ); + rtl::OStringBuffer aLine(RTL_CONSTASCII_STRINGPARAM("lang: ")); + aLine.append(rtl::OUStringToOString(MsLangId::convertLanguageToIsoString(nLanguage), eEnc)); + pStream->WriteLine(aLine.makeStringAndClear()); } if (0 != (nErr = pStream->GetError())) return nErr; @@ -468,7 +467,7 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL) const uno::Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray(); for (sal_Int32 i = 0; i < nCount; i++) { - ByteString aOutStr = formatForSave(pEntry[i], eEnc); + rtl::OString aOutStr = formatForSave(pEntry[i], eEnc); pStream->WriteLine (aOutStr); if (0 != (nErr = pStream->GetError())) return nErr; diff --git a/oox/inc/oox/export/utils.hxx b/oox/inc/oox/export/utils.hxx index d24a13787437..9dee58cafc4c 100644 --- a/oox/inc/oox/export/utils.hxx +++ b/oox/inc/oox/export/utils.hxx @@ -30,14 +30,13 @@ #define _OOX_EXPORT_UTILS_HXX_ #define S(x) String( RTL_CONSTASCII_USTRINGPARAM( x ) ) -#define US(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x )) -#define I32S(x) OString::valueOf( (sal_Int32) x ).getStr() -#define I64S(x) OString::valueOf( (sal_Int64) x ).getStr() -#define H32S(x) OString::valueOf( (sal_Int32) x, 16 ).getStr() -#define H64S(x) OString::valueOf( (sal_Int64) x, 16 ).getStr() -#define IS(x) OString::valueOf( x ).getStr() -#define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr() -#define ST(x) ByteString( x, RTL_TEXTENCODING_UTF8 ).GetBuffer() +#define US(x) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( x )) +#define I32S(x) rtl::OString::valueOf( (sal_Int32) x ).getStr() +#define I64S(x) rtl::OString::valueOf( (sal_Int64) x ).getStr() +#define H32S(x) rtl::OString::valueOf( (sal_Int32) x, 16 ).getStr() +#define H64S(x) rtl::OString::valueOf( (sal_Int64) x, 16 ).getStr() +#define IS(x) rtl::OString::valueOf( x ).getStr() +#define USS(x) rtl::OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr() #ifndef DBG # if OSL_DEBUG_LEVEL > 0 diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index aae031d63132..745c6c5def35 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -169,7 +169,7 @@ bool DrawingML::GetProperty( Reference< XPropertySet > rXPropSet, String aName ) mAny = rXPropSet->getPropertyValue( aName ); if ( mAny.hasValue() ) bRetValue = true; - } catch( const Exception& ) { /* printf ("exception when trying to get value of property: %s\n", ST(aName)); */ } + } catch( const Exception& ) { /* printf ("exception when trying to get value of property: %s\n", USS(aName)); */ } return bRetValue; } @@ -184,7 +184,7 @@ bool DrawingML::GetPropertyAndState( Reference< XPropertySet > rXPropSet, Refere bRetValue = true; eState = rXPropState->getPropertyState( aName ); } - } catch( const Exception& ) { /* printf ("exception when trying to get value of property: %s\n", ST(aName)); */ } + } catch( const Exception& ) { /* printf ("exception when trying to get value of property: %s\n", USS(aName)); */ } return bRetValue; } @@ -447,7 +447,7 @@ void DrawingML::WriteOutline( Reference< XPropertySet > rXPropSet ) OUString DrawingML::WriteImage( const OUString& rURL ) { - ByteString aURLBS( UniString( rURL ), RTL_TEXTENCODING_UTF8 ); + ByteString aURLBS(rtl::OUStringToOString(rURL, RTL_TEXTENCODING_UTF8)); const char aURLBegin[] = "vnd.sun.star.GraphicObject:"; int index = aURLBS.Search( aURLBegin ); @@ -805,7 +805,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIs mAny >>= usTypeface; String aSubstName( GetSubsFontName( usTypeface, SUBSFONT_ONLYONE | SUBSFONT_MS ) ); if( aSubstName.Len() ) - typeface = ST( aSubstName ); + typeface = USS( aSubstName ); else typeface = USS( usTypeface ); @@ -825,7 +825,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIs mAny >>= usTypeface; String aSubstName( GetSubsFontName( usTypeface, SUBSFONT_ONLYONE | SUBSFONT_MS ) ); if( aSubstName.Len() ) - typeface = ST( aSubstName ); + typeface = USS( aSubstName ); else typeface = USS( usTypeface ); @@ -870,7 +870,7 @@ const char* DrawingML::GetFieldType( ::com::sun::star::uno::Reference< ::com::su if( GETA( TextPortionType ) ) { aFieldType = String( *(::rtl::OUString*)mAny.getValue() ); - DBG(printf ("field type: %s\n", ST(aFieldType) )); + DBG(printf ("field type: %s\n", USS(aFieldType) )); } if( aFieldType == S( "TextField" ) ) { @@ -881,7 +881,7 @@ const char* DrawingML::GetFieldType( ::com::sun::star::uno::Reference< ::com::su rXPropSet.set( rXTextField, UNO_QUERY ); if( rXPropSet.is() ) { String aFieldKind( rXTextField->getPresentation( sal_True ) ); - DBG(printf ("field kind: %s\n", ST(aFieldKind) )); + DBG(printf ("field kind: %s\n", USS(aFieldKind) )); if( aFieldKind == S( "Page" ) ) { return "slidenum"; } diff --git a/padmin/source/adddlg.cxx b/padmin/source/adddlg.cxx index ec41d0e777ab..62a4f1417a89 100644 --- a/padmin/source/adddlg.cxx +++ b/padmin/source/adddlg.cxx @@ -295,8 +295,8 @@ IMPL_LINK( APChooseDriverPage, ClickBtnHdl, PushButton*, pButton ) int nPos = file->SearchBackward( '.' ); if( file->Copy( 0, nPos ) == String( aPPD ) ) { - ByteString aSysPath( aFile, aEncoding ); - if( unlink( aSysPath.GetBuffer() ) ) + rtl::OString aSysPath(rtl::OUStringToOString(aFile, aEncoding)); + if (unlink(aSysPath.getStr())) { String aText( PaResId( RID_ERR_REMOVEDRIVERFAILED ) ); aText.SearchAndReplace( String::CreateFromAscii( "%s1" ), m_aDriverBox.GetSelectEntry( i ) ); diff --git a/padmin/source/cmddlg.cxx b/padmin/source/cmddlg.cxx index 4303757628ba..5dc0864d276c 100644 --- a/padmin/source/cmddlg.cxx +++ b/padmin/source/cmddlg.cxx @@ -176,7 +176,7 @@ void CommandStore::setCommands( nWritten--; } for( nWritten = 0, it = aWriteList.begin(); it != aWriteList.end(); ++it, ++nWritten ) - rConfig.WriteKey( rtl::OString::valueOf(nWritten), ByteString( *it, RTL_TEXTENCODING_UTF8 ) ); + rConfig.WriteKey( rtl::OString::valueOf(nWritten), rtl::OUStringToOString(*it, RTL_TEXTENCODING_UTF8) ); } diff --git a/padmin/source/fontentry.cxx b/padmin/source/fontentry.cxx index 7e928665b5cd..f26283c04260 100644 --- a/padmin/source/fontentry.cxx +++ b/padmin/source/fontentry.cxx @@ -384,7 +384,7 @@ FontImportDialog::~FontImportDialog() { Config& rPadminRC( getPadminRC() ); rPadminRC.SetGroup( "FontImport" ); - rPadminRC.WriteKey( "FromPath", ByteString( m_aFromDirEdt.GetText(), RTL_TEXTENCODING_UTF8 ) ); + rPadminRC.WriteKey( "FromPath", rtl::OUStringToOString(m_aFromDirEdt.GetText(), RTL_TEXTENCODING_UTF8) ); } void FontImportDialog::importFontsFailed( ::psp::PrintFontManager::ImportFontCallback::FailCondition eReason ) diff --git a/padmin/source/newppdlg.cxx b/padmin/source/newppdlg.cxx index cde0720aae28..972e2b76cb7f 100644 --- a/padmin/source/newppdlg.cxx +++ b/padmin/source/newppdlg.cxx @@ -109,7 +109,7 @@ void PPDImportDialog::Import() Config& rConfig = getPadminRC(); rConfig.SetGroup( PPDIMPORT_GROUP ); - rConfig.WriteKey( "LastDir", ByteString( aImportPath, RTL_TEXTENCODING_UTF8 ) ); + rConfig.WriteKey( "LastDir", rtl::OUStringToOString(aImportPath, RTL_TEXTENCODING_UTF8) ); int nEntries = m_aPathBox.GetEntryCount(); while( nEntries-- ) @@ -118,7 +118,7 @@ void PPDImportDialog::Import() if( nEntries < 0 ) { sal_Int32 nNextEntry = rConfig.ReadKey("NextEntry").toInt32(); - rConfig.WriteKey( rtl::OString::valueOf(nNextEntry), ByteString( aImportPath, RTL_TEXTENCODING_UTF8 ) ); + rConfig.WriteKey( rtl::OString::valueOf(nNextEntry), rtl::OUStringToOString(aImportPath, RTL_TEXTENCODING_UTF8) ); nNextEntry = nNextEntry < 10 ? nNextEntry+1 : 0; rConfig.WriteKey( "NextEntry", rtl::OString::valueOf(nNextEntry) ); m_aPathBox.InsertEntry( aImportPath ); @@ -221,8 +221,8 @@ IMPL_LINK( PPDImportDialog, ModifyHdl, ComboBox*, pListBox ) { if( pListBox == &m_aPathBox ) { - ByteString aDir( m_aPathBox.GetText(), osl_getThreadTextEncoding() ); - if( ! access( aDir.GetBuffer(), F_OK ) ) + rtl::OString aDir(rtl::OUStringToOString(m_aPathBox.GetText(), osl_getThreadTextEncoding())); + if (!access( aDir.getStr(), F_OK)) Import(); } return 0; diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 4e89fe93a87f..1ff85ba6125b 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -708,14 +708,15 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, } if (bOk) { - ByteString aTmp( aStr, osl_getThreadTextEncoding() ); + rtl::OString aTmp(rtl::OUStringToOString(aStr, + osl_getThreadTextEncoding())); // In case the xub_StrLen will be longer than USHORT // one day, and room for pad byte check. - if ( aTmp.Len() > ((sal_uInt16)(~0)) - 2 ) + if ( aTmp.getLength() > ((sal_uInt16)(~0)) - 2 ) return false; // Append a 0-pad-byte if string length is not even //! MUST be sal_uInt16 and not xub_StrLen - sal_uInt16 nStrLen = (sal_uInt16) aTmp.Len(); + sal_uInt16 nStrLen = (sal_uInt16) aTmp.getLength(); sal_uInt16 nLen = ( nStrLen + 2 ) & ~1; if (((sal_uLong)nPos + (5 * sizeof(sal_uInt16)) + nLen) > MAXARRSIZE) @@ -725,7 +726,7 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, *p++ = static_cast<sal_uInt16>(nTab); *p++ = nErr; *p++ = nLen; - memcpy( p, aTmp.GetBuffer(), nStrLen + 1); + memcpy( p, aTmp.getStr(), nStrLen + 1); nPos += 10 + nStrLen + 1; sal_uInt8* q = ( pCellArr + nPos ); if( !nStrLen & 1 ) @@ -833,19 +834,20 @@ bool ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, } else { - ByteString aTmp( aStr, osl_getThreadTextEncoding() ); + rtl::OString aTmp(rtl::OUStringToOString(aStr, + osl_getThreadTextEncoding())); // In case the xub_StrLen will be longer than USHORT // one day, and room for pad byte check. - if ( aTmp.Len() > ((sal_uInt16)(~0)) - 2 ) + if ( aTmp.getLength() > ((sal_uInt16)(~0)) - 2 ) return false; // Append a 0-pad-byte if string length is not even //! MUST be sal_uInt16 and not xub_StrLen - sal_uInt16 nStrLen = (sal_uInt16) aTmp.Len(); + sal_uInt16 nStrLen = (sal_uInt16) aTmp.getLength(); sal_uInt16 nLen = ( nStrLen + 2 ) & ~1; if ( ((sal_uLong)nPos + 2 + nLen) > MAXARRSIZE) return false; *p++ = nLen; - memcpy( p, aTmp.GetBuffer(), nStrLen + 1); + memcpy( p, aTmp.getStr(), nStrLen + 1); nPos += 2 + nStrLen + 1; sal_uInt8* q = ( pCellArr + nPos ); if( !nStrLen & 1 ) @@ -2516,13 +2518,14 @@ void ScInterpreter::ScExternal() break; case PTR_STRING : { - ByteString aStr( GetString(), osl_getThreadTextEncoding() ); - if ( aStr.Len() >= ADDIN_MAXSTRLEN ) + rtl::OString aStr(rtl::OUStringToOString(GetString(), + osl_getThreadTextEncoding())); + if ( aStr.getLength() >= ADDIN_MAXSTRLEN ) SetError( errStringOverflow ); else { pStr[i-1] = new sal_Char[ADDIN_MAXSTRLEN]; - strncpy( pStr[i-1], aStr.GetBuffer(), ADDIN_MAXSTRLEN ); + strncpy( pStr[i-1], aStr.getStr(), ADDIN_MAXSTRLEN ); pStr[i-1][ADDIN_MAXSTRLEN-1] = 0; ppParam[i] = pStr[i-1]; } diff --git a/sc/source/filter/dif/difexp.cxx b/sc/source/filter/dif/difexp.cxx index 4caabd5c0f83..38c168a5b8a6 100644 --- a/sc/source/filter/dif/difexp.cxx +++ b/sc/source/filter/dif/difexp.cxx @@ -82,7 +82,7 @@ FltError ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc } else { - aStrDelimEncoded = ByteString( cStrDelim, eCharSet ); + aStrDelimEncoded = rtl::OString(&cStrDelim, 1, eCharSet); rtl_TextEncodingInfo aInfo; aInfo.StructSize = sizeof(aInfo); if ( rtl_getTextEncodingInfo( eCharSet, &aInfo ) ) @@ -261,9 +261,9 @@ FltError ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc else if ( bContextOrNotAsciiEncoding ) { // to byte encoding - ByteString aStrEnc( aTmpStr, eCharSet ); + rtl::OString aStrEnc(rtl::OUStringToOString(aTmpStr, eCharSet)); // back to Unicode - UniString aStrDec( aStrEnc, eCharSet ); + UniString aStrDec(rtl::OStringToOUString(aStrEnc, eCharSet)); // search on re-decoded string xub_StrLen nPos = aStrDec.Search( aStrDelimDecoded ); while ( nPos != STRING_NOTFOUND ) @@ -279,7 +279,7 @@ FltError ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc } else { - ByteString aStrEnc( aTmpStr, eCharSet ); + ByteString aStrEnc(rtl::OUStringToOString(aTmpStr, eCharSet)); // search on encoded string xub_StrLen nPos = aStrEnc.Search( aStrDelimEncoded ); while ( nPos != STRING_NOTFOUND ) diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 42caee58de22..24daab7b8f17 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1688,8 +1688,8 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt } else { - aStrDelimEncoded = ByteString( cStrDelim, eCharSet ); - aDelimEncoded = ByteString( cDelim, eCharSet ); + aStrDelimEncoded = rtl::OString(&cStrDelim, 1, eCharSet); + aDelimEncoded = rtl::OString(&cDelim, 1, eCharSet); rtl_TextEncodingInfo aInfo; aInfo.StructSize = sizeof(aInfo); if ( rtl_getTextEncodingInfo( eCharSet, &aInfo ) ) @@ -1965,9 +1965,9 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt if ( bContextOrNotAsciiEncoding ) { // to byte encoding - ByteString aStrEnc( aUniString, eCharSet ); + rtl::OString aStrEnc(rtl::OUStringToOString(aUniString, eCharSet)); // back to Unicode - UniString aStrDec( aStrEnc, eCharSet ); + UniString aStrDec(rtl::OStringToOUString(aStrEnc, eCharSet)); // search on re-decoded string xub_StrLen nPos = aStrDec.Search( aStrDelimDecoded ); bool bNeedQuotes = rAsciiOpt.bQuoteAllText || @@ -1989,7 +1989,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt } else { - ByteString aStrEnc( aUniString, eCharSet ); + ByteString aStrEnc(rtl::OUStringToOString(aUniString, eCharSet)); // search on encoded string xub_StrLen nPos = aStrEnc.Search( aStrDelimEncoded ); bool bNeedQuotes = rAsciiOpt.bQuoteAllText || diff --git a/svtools/bmpmaker/bmp.cxx b/svtools/bmpmaker/bmp.cxx index 7b02684b7b01..b33ebd889d2a 100644 --- a/svtools/bmpmaker/bmp.cxx +++ b/svtools/bmpmaker/bmp.cxx @@ -28,6 +28,7 @@ #include <rtl/math.hxx> +#include <rtl/strbuf.hxx> #include <math.h> #include <stdio.h> @@ -155,9 +156,9 @@ void BmpApp::Message( const String& rText, sal_uInt8 cExit ) if( EXIT_NOERROR != cExit ) SetExitCode( cExit ); - ByteString aText( rText, RTL_TEXTENCODING_UTF8 ); - aText.Append( "\r\n" ); - fprintf( stderr, "%s", aText.GetBuffer() ); + rtl::OStringBuffer aText(rtl::OUStringToOString(rText, RTL_TEXTENCODING_UTF8)); + aText.append(RTL_CONSTASCII_STRINGPARAM("\r\n")); + fprintf(stderr, "%s", aText.getStr()); } // ----------------------------------------------------------------------------- @@ -187,14 +188,13 @@ int BmpApp::Start( const ::std::vector< String >& rArgs ) sal_uInt16 nCurCmd = 0; const String aSrsName( rArgs[ nCurCmd++ ] ); ::std::vector< String > aInDirVector; - ByteString aLangDir; aOutName = rArgs[ nCurCmd++ ]; - aLangDir = ByteString( rArgs[ nCurCmd++ ], RTL_TEXTENCODING_ASCII_US ); + rtl::OString aLangDir(rtl::OUStringToOString(rArgs[nCurCmd++], RTL_TEXTENCODING_ASCII_US)); aLangInfo.mnLangNum = static_cast< sal_uInt16 >( rArgs[ nCurCmd++ ].ToInt32() ); - memcpy( aLangInfo.maLangDir, aLangDir.GetBuffer(), aLangDir.Len() + 1 ); + memcpy( aLangInfo.maLangDir, aLangDir.getStr(), aLangDir.getLength() + 1 ); GetCommandOption( rArgs, 'f', aOutputFileName ); GetCommandOptions( rArgs, 'i', aInDirVector ); @@ -210,9 +210,9 @@ int BmpApp::Start( const ::std::vector< String >& rArgs ) if( ( EXIT_NOERROR == cExitCode ) && aOutputFileName.Len() && aOutName.Len() ) { SvFileStream aOStm( aOutputFileName, STREAM_WRITE | STREAM_TRUNC ); - ByteString aStr( "Successfully generated ImageList(s) in: " ); - - aOStm.WriteLine( aStr.Append( ByteString( aOutName, RTL_TEXTENCODING_UTF8 ) ) ); + rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Successfully generated ImageList(s) in: ")); + aStr.append(rtl::OUStringToOString(aOutName, RTL_TEXTENCODING_UTF8)); + aOStm.WriteLine(aStr.makeStringAndClear()); aOStm.Close(); } diff --git a/svtools/bmpmaker/bmpcore.cxx b/svtools/bmpmaker/bmpcore.cxx index 4414e161f998..fd438ce980cb 100644 --- a/svtools/bmpmaker/bmpcore.cxx +++ b/svtools/bmpmaker/bmpcore.cxx @@ -196,7 +196,8 @@ void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs, if( pCollectStm && !aBmpEx.IsEmpty() ) { - const ByteString aCollectString( aFileName, RTL_TEXTENCODING_ASCII_US ); + const rtl::OString aCollectString(rtl::OUStringToOString( + aFileName, RTL_TEXTENCODING_ASCII_US)); pCollectStm->WriteLine( aCollectString ); } } diff --git a/svtools/bmpmaker/bmpsum.cxx b/svtools/bmpmaker/bmpsum.cxx index 9169f40b5d4e..6426e52654a7 100644 --- a/svtools/bmpmaker/bmpsum.cxx +++ b/svtools/bmpmaker/bmpsum.cxx @@ -133,9 +133,9 @@ void BmpSum::Message( const String& rText, sal_uInt8 nExitCode ) if( EXIT_NOERROR != nExitCode ) SetExitCode( nExitCode ); - ByteString aText( rText, RTL_TEXTENCODING_UTF8 ); - aText.Append( "\r\n" ); - fprintf( stderr, "%s", aText.GetBuffer() ); + rtl::OStringBuffer aText(rtl::OUStringToOString(rText, RTL_TEXTENCODING_UTF8)); + aText.append(RTL_CONSTASCII_STRINGPARAM("\r\n")); + fprintf(stderr, "%s", aText.getStr()); } // ----------------------------------------------------------------------------- diff --git a/svtools/bmpmaker/g2g.cxx b/svtools/bmpmaker/g2g.cxx index bcf930553900..6773a0f5d3ac 100644 --- a/svtools/bmpmaker/g2g.cxx +++ b/svtools/bmpmaker/g2g.cxx @@ -31,6 +31,7 @@ #include <signal.h> #include <ctype.h> +#include <rtl/strbuf.hxx> #include <tools/fsys.hxx> #include <tools/stream.hxx> #include <vcl/svapp.hxx> @@ -120,9 +121,9 @@ void G2GApp::Message( const String& rText, sal_uInt8 nExitCode ) if( EXIT_NOERROR != nExitCode ) SetExitCode( nExitCode ); - ByteString aText( rText, RTL_TEXTENCODING_UTF8 ); - aText.Append( "\r\n" ); - fprintf( stderr, "%s", aText.GetBuffer() ); + rtl::OStringBuffer aText(rtl::OUStringToOString(rText, RTL_TEXTENCODING_UTF8)); + aText.append(RTL_CONSTASCII_STRINGPARAM("\r\n")); + fprintf(stderr, "%s", aText.getStr()); } // ----------------------------------------------------------------------------- @@ -184,20 +185,19 @@ int G2GApp::Start( const ::std::vector< String >& rArgs ) if( ( aTransColStr.Len() == 6 ) && aFilter.IsExportPixelFormat( nExportFilter ) ) { - ByteString aHexStr( aTransColStr, RTL_TEXTENCODING_ASCII_US ); + rtl::OString aHexStr(rtl::OUStringToOString(aTransColStr, RTL_TEXTENCODING_ASCII_US). + toAsciiLowerCase()); sal_Bool bHex = sal_True; - aHexStr.ToLowerAscii(); - for( sal_uInt16 i = 0; ( i < 6 ) && bHex; i++ ) - if( !isxdigit( aHexStr.GetChar( i ) ) ) + if( !isxdigit( aHexStr[i] ) ) bHex = sal_False; if( bHex ) { - const sal_uInt8 cTransR = ( LOWERHEXTONUM( aHexStr.GetChar( 0 ) ) << 4 ) | LOWERHEXTONUM( aHexStr.GetChar( 1 ) ); - const sal_uInt8 cTransG = ( LOWERHEXTONUM( aHexStr.GetChar( 2 ) ) << 4 ) | LOWERHEXTONUM( aHexStr.GetChar( 3 ) ); - const sal_uInt8 cTransB = ( LOWERHEXTONUM( aHexStr.GetChar( 4 ) ) << 4 ) | LOWERHEXTONUM( aHexStr.GetChar( 5 ) ); + const sal_uInt8 cTransR = ( LOWERHEXTONUM( aHexStr[0] ) << 4 ) | LOWERHEXTONUM( aHexStr[1] ); + const sal_uInt8 cTransG = ( LOWERHEXTONUM( aHexStr[2] ) << 4 ) | LOWERHEXTONUM( aHexStr[3] ); + const sal_uInt8 cTransB = ( LOWERHEXTONUM( aHexStr[4] ) << 4 ) | LOWERHEXTONUM( aHexStr[5] ); BitmapEx aBmpEx( aGraphic.GetBitmapEx() ); Bitmap aOldBmp( aBmpEx.GetBitmap() ); diff --git a/svtools/source/filter/wmf/enhwmf.cxx b/svtools/source/filter/wmf/enhwmf.cxx index e72e73a59b00..97f1d5cc631c 100644 --- a/svtools/source/filter/wmf/enhwmf.cxx +++ b/svtools/source/filter/wmf/enhwmf.cxx @@ -1151,14 +1151,15 @@ sal_Bool EnhWMFReader::ReadEnhWMF() if ( aText.Len() != nLen ) { - sal_uInt16 i, j, k; + sal_uInt16 i, j; sal_Int32* pOldDx = pDX; pDX = new sal_Int32[ aText.Len() ]; for ( i = 0, j = 0; i < aText.Len(); i++ ) { - ByteString aCharacter( aText.GetChar( i ), pOut->GetCharSet() ); + sal_Unicode cUniChar = aText.GetChar(i); + rtl::OString aCharacter(&cUniChar, 1, pOut->GetCharSet()); pDX[ i ] = 0; - for ( k = 0; ( k < aCharacter.Len() ) && ( j < nLen ) && ( i < aText.Len() ); k++ ) + for (sal_Int32 k = 0; ( k < aCharacter.getLength() ) && ( j < nLen ) && ( i < aText.Len() ); ++k) pDX[ i ] += pOldDx[ j++ ]; } delete[] pOldDx; diff --git a/svtools/source/filter/wmf/winwmf.cxx b/svtools/source/filter/wmf/winwmf.cxx index ae50af7ee654..3b53cbaf5a22 100644 --- a/svtools/source/filter/wmf/winwmf.cxx +++ b/svtools/source/filter/wmf/winwmf.cxx @@ -487,10 +487,11 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) *pWMF >> nDx; if ( nNewTextLen != nOriginalTextLen ) { - ByteString aTmp( aText.GetChar( i ), pOut->GetCharSet() ); - if ( aTmp.Len() > 1 ) + sal_Unicode nUniChar = aText.GetChar(i); + rtl::OString aTmp(&nUniChar, 1, pOut->GetCharSet()); + if ( aTmp.getLength() > 1 ) { - sal_Int32 nDxCount = aTmp.Len() - 1; + sal_Int32 nDxCount = aTmp.getLength() - 1; if ( ( ( nDxCount * 2 ) + pWMF->Tell() ) > nMaxStreamPos ) break; while ( nDxCount-- ) diff --git a/svtools/source/filter/wmf/wmfwr.cxx b/svtools/source/filter/wmf/wmfwr.cxx index 0ec3f7332c00..06025f2aa8e6 100644 --- a/svtools/source/filter/wmf/wmfwr.cxx +++ b/svtools/source/filter/wmf/wmfwr.cxx @@ -557,7 +557,7 @@ sal_Bool WMFWriter::WMFRecord_Escape_Unicode( const Point& rPoint, const String& { const sal_Unicode* pBuf = rUniStr.GetBuffer(); const rtl_TextEncoding aTextEncodingOrg = aSrcFont.GetCharSet(); - ByteString aByteStr( rUniStr, aTextEncodingOrg ); + rtl::OString aByteStr(rtl::OUStringToOString(rUniStr, aTextEncodingOrg)); String aUniStr2( aByteStr, aTextEncodingOrg ); const sal_Unicode* pConversion = aUniStr2.GetBuffer(); // this is the unicode array after bytestring <-> unistring conversion for ( i = 0; i < nStringLen; i++ ) @@ -579,7 +579,7 @@ sal_Bool WMFWriter::WMFRecord_Escape_Unicode( const Point& rPoint, const String& aTextEncoding = getBestMSEncodingByChar(*pCheckChar); // try the next character } - aByteStr = ByteString ( rUniStr, aTextEncoding ); + aByteStr = rtl::OUStringToOString(rUniStr, aTextEncoding); aUniStr2 = String ( aByteStr, aTextEncoding ); pConversion = aUniStr2.GetBuffer(); // this is the unicode array after bytestring <-> unistring conversion for ( i = 0; i < nStringLen; i++ ) @@ -654,7 +654,7 @@ void WMFWriter::WMFRecord_ExtTextOut( const Point & rPoint, return; } rtl_TextEncoding eChrSet = aSrcFont.GetCharSet(); - ByteString aByteString(rString, eChrSet); + rtl::OString aByteString(rtl::OUStringToOString(rString, eChrSet)); TrueExtTextOut(rPoint,rString,aByteString,pDXAry); } @@ -686,8 +686,9 @@ void WMFWriter::TrueExtTextOut( const Point & rPoint, const String & rString, *pWMF << nDx; if ( nOriginalTextLen < nNewTextLen ) { - ByteString aTemp( rString.GetChar( i ), aSrcFont.GetCharSet()); - j = aTemp.Len(); + sal_Unicode nUniChar = rString.GetChar(i); + rtl::OString aTemp(&nUniChar, 1, aSrcFont.GetCharSet()); + j = aTemp.getLength(); while ( --j > 0 ) *pWMF << (sal_uInt16)0; } @@ -943,7 +944,7 @@ void WMFWriter::WMFRecord_StretchDIB( const Point & rPoint, const Size & rSize, void WMFWriter::WMFRecord_TextOut(const Point & rPoint, const String & rStr) { rtl_TextEncoding eChrSet = aSrcFont.GetCharSet(); - ByteString aString( rStr, eChrSet ); + rtl::OString aString(rtl::OUStringToOString(rStr, eChrSet)); TrueTextOut(rPoint, aString); } diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 7927af084c57..deb530ba0192 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -885,7 +885,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, { // Wir schreiben das Modul mm ANSI-Zeichensatz, aber mit // System-Zeilenumbruechen raus. - ByteString sSource( rSource, eDestEnc ); + ByteString sSource(rtl::OUStringToOString(rSource, eDestEnc)); sSource.ConvertLineEnd( GetSystemLineEnd() ); rStrm << sSource.GetBuffer(); } diff --git a/svx/source/dialog/sendreportunx.cxx b/svx/source/dialog/sendreportunx.cxx index b345ae6a2043..8586d497ca75 100644 --- a/svx/source/dialog/sendreportunx.cxx +++ b/svx/source/dialog/sendreportunx.cxx @@ -197,9 +197,9 @@ namespace svx{ { fprintf( fp, "[Options]\n" ); fprintf( fp, "UseProxy=%s\n", 2 == maParams.miHTTPConnectionType ? "true" : "false" ); - fprintf( fp, "ProxyServer=%s\n", ByteString( maParams.maHTTPProxyServer, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); - fprintf( fp, "ProxyPort=%s\n", ByteString( maParams.maHTTPProxyPort, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); - fprintf( fp, "ReturnAddress=%s\n", ByteString( GetEMailAddress(), RTL_TEXTENCODING_UTF8 ).GetBuffer() ); + fprintf( fp, "ProxyServer=%s\n", rtl::OUStringToOString( maParams.maHTTPProxyServer, RTL_TEXTENCODING_UTF8 ).getStr() ); + fprintf( fp, "ProxyPort=%s\n", rtl::OUStringToOString( maParams.maHTTPProxyPort, RTL_TEXTENCODING_UTF8 ).getStr() ); + fprintf( fp, "ReturnAddress=%s\n", rtl::OUStringToOString( GetEMailAddress(), RTL_TEXTENCODING_UTF8 ).getStr() ); fprintf( fp, "AllowContact=%s\n", IsContactAllowed() ? "true" : "false" ); fclose( fp ); } @@ -209,14 +209,14 @@ namespace svx{ bool ErrorRepSendDialog::SendReport() { - ByteString strSubject( GetDocType(), RTL_TEXTENCODING_UTF8 ); + rtl::OString strSubject(rtl::OUStringToOString(GetDocType(), RTL_TEXTENCODING_UTF8)); #if defined( LINUX ) || defined (MACOSX ) - setenv( "ERRORREPORT_SUBJECT", strSubject.GetBuffer(), 1 ); + setenv( "ERRORREPORT_SUBJECT", strSubject.getStr(), 1 ); #else - static ::rtl::OString strEnvSubject = "ERRORREPORT_SUBJECT"; + static ::rtl::OString strEnvSubject = "ERRORREPORT_SUBJECT"; strEnvSubject += "="; - strEnvSubject += strSubject.GetBuffer(); + strEnvSubject += strSubject; putenv( (char *)strEnvSubject.getStr() ); #endif @@ -225,10 +225,10 @@ namespace svx{ if ( fp ) { - ByteString strUTF8( GetUsing(), RTL_TEXTENCODING_UTF8 ); + rtl::OString strUTF8(rtl::OUStringToOString(GetUsing(), RTL_TEXTENCODING_UTF8)); - size_t nWritten = fwrite(strUTF8.GetBuffer(), 1, strUTF8.Len(), fp); - OSL_VERIFY(nWritten == strUTF8.Len()); + size_t nWritten = fwrite(strUTF8.getStr(), 1, strUTF8.getLength(), fp); + OSL_VERIFY(nWritten == static_cast<size_t>(strUTF8.getLength())); fclose( fp ); #if defined( LINUX ) || defined (MACOSX) setenv("ERRORREPORT_BODYFILE", szBodyFile, 1); diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 44ebfa22ffe1..1d039012a17a 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -1797,7 +1797,7 @@ void DbPatternField::implAdjustGenericFieldSetting( const Reference< XPropertySe _rxModel->getPropertyValue( FM_PROP_EDITMASK ) >>= aEditMask; _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) >>= bStrict; - ByteString aAsciiEditMask( aEditMask.getStr(), RTL_TEXTENCODING_ASCII_US ); + rtl::OString aAsciiEditMask(rtl::OUStringToOString(aEditMask, RTL_TEXTENCODING_ASCII_US)); static_cast< PatternField* >( m_pWindow )->SetMask( aAsciiEditMask, aLitMask ); static_cast< PatternField* >( m_pPainter )->SetMask( aAsciiEditMask, aLitMask ); diff --git a/svx/source/form/ParseContext.cxx b/svx/source/form/ParseContext.cxx index 37eb161c10a0..f1c50decc842 100644 --- a/svx/source/form/ParseContext.cxx +++ b/svx/source/form/ParseContext.cxx @@ -128,9 +128,9 @@ OSystemParseContext::~OSystemParseContext() OSL_ENSURE( nIndex < m_aLocalizedKeywords.size(), "OSystemParseContext::getIntlKeywordAscii: invalid index!" ); - ByteString sKeyword; + rtl::OString sKeyword; if ( nIndex < m_aLocalizedKeywords.size() ) - sKeyword = ByteString( m_aLocalizedKeywords[nIndex], RTL_TEXTENCODING_UTF8 ); + sKeyword = rtl::OUStringToOString(m_aLocalizedKeywords[nIndex], RTL_TEXTENCODING_UTF8); return sKeyword; } diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index d4c596b3d50f..773a03e43a06 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -132,16 +132,15 @@ void GalleryThemeEntry::SetId( sal_uInt32 nNewId, sal_Bool bResetThemeName ) SvStream& operator<<( SvStream& rOut, const GalleryImportThemeEntry& rEntry ) { - rOut.WriteByteString(ByteString(rEntry.aThemeName, RTL_TEXTENCODING_UTF8)); + rOut.WriteByteString(rtl::OUStringToOString(rEntry.aThemeName, RTL_TEXTENCODING_UTF8)); - rOut.WriteByteString(ByteString(rEntry.aUIName, RTL_TEXTENCODING_UTF8)); + rOut.WriteByteString(rtl::OUStringToOString(rEntry.aUIName, RTL_TEXTENCODING_UTF8)); - rOut.WriteByteString(ByteString(String(rEntry.aURL.GetMainURL( INetURLObject::NO_DECODE )), RTL_TEXTENCODING_UTF8)); + rOut.WriteByteString(rtl::OUStringToOString(String(rEntry.aURL.GetMainURL( INetURLObject::NO_DECODE )), RTL_TEXTENCODING_UTF8)); - rOut.WriteByteString(ByteString(rEntry.aImportName, RTL_TEXTENCODING_UTF8)); + rOut.WriteByteString(rtl::OUStringToOString(rEntry.aImportName, RTL_TEXTENCODING_UTF8)); - ByteString aDummy; - rOut.WriteByteString(aDummy); + rOut.WriteByteString(rtl::OUString()); return rOut; } diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index 7f84fc088229..1f03f1397b43 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -168,7 +168,7 @@ void SgaObject::WriteData( SvStream& rOut, const String& rDestDir ) const String aURLWithoutDestDir = String(aURL.GetMainURL( INetURLObject::NO_DECODE )); aURLWithoutDestDir.SearchAndReplace(rDestDir, String()); - rOut.WriteByteString(ByteString(aURLWithoutDestDir, RTL_TEXTENCODING_UTF8)); + rOut.WriteByteString(rtl::OUStringToOString(aURLWithoutDestDir, RTL_TEXTENCODING_UTF8)); } // ------------------------------------------------------------------------ diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index e96375908d21..3fc611c9658b 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -548,7 +548,8 @@ String SvXMLGraphicHelper::ImplGetGraphicMimeType( const String& rFileName ) con if( ( rFileName.Len() >= 4 ) && ( rFileName.GetChar( rFileName.Len() - 4 ) == '.' ) ) { - const ByteString aExt( rFileName.Copy( rFileName.Len() - 3 ), RTL_TEXTENCODING_ASCII_US ); + const ByteString aExt(rtl::OUStringToOString(rFileName.Copy(rFileName.Len() - 3), + RTL_TEXTENCODING_ASCII_US)); for( long i = 0, nCount = SAL_N_ELEMENTS( aMapper ); ( i < nCount ) && !aMimeType.Len(); i++ ) if( aExt == aMapper[ i ].pExt ) diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 722ed95120a7..0eb2d1ae46e6 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -365,10 +365,9 @@ sal_uInt16 ImplGetComponentType( const String& rServiceName ) ComponentInfo aSearch; - ByteString aServiceName( rServiceName, osl_getThreadTextEncoding() ); - aServiceName.ToLowerAscii(); - if ( aServiceName.Len() ) - aSearch.pName = aServiceName.GetBuffer(); + rtl::OString aServiceName(rtl::OUStringToOString(rServiceName, osl_getThreadTextEncoding()).toAsciiLowerCase()); + if ( aServiceName.getLength() ) + aSearch.pName = aServiceName.getStr(); else aSearch.pName = "window"; diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index efa39bc6cf01..2669f0f21dce 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -6457,7 +6457,7 @@ void VCLXPatternField::setMasks( const ::rtl::OUString& EditMask, const ::rtl::O PatternField* pPatternField = (PatternField*) GetWindow(); if ( pPatternField ) { - pPatternField->SetMask( ByteString( UniString( EditMask ), RTL_TEXTENCODING_ASCII_US ), LiteralMask ); + pPatternField->SetMask( rtl::OUStringToOString(EditMask, RTL_TEXTENCODING_ASCII_US), LiteralMask ); } } diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx index 35611f4f85e0..097550624ed1 100644 --- a/vcl/generic/print/genprnpsp.cxx +++ b/vcl/generic/print/genprnpsp.cxx @@ -235,8 +235,8 @@ static bool passFileToCommandLine( const String& rFilename, const String& rComma bool bSuccess = false; rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); - ByteString aCmdLine( rCommandLine, aEncoding ); - ByteString aFilename( rFilename, aEncoding ); + ByteString aCmdLine(rtl::OUStringToOString(rCommandLine, aEncoding)); + rtl::OString aFilename(rtl::OUStringToOString(rFilename, aEncoding)); bool bPipe = aCmdLine.Search( "(TMP)" ) != STRING_NOTFOUND ? false : true; @@ -250,9 +250,9 @@ static bool passFileToCommandLine( const String& rFilename, const String& rComma 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 ); + if( stat( aFilename.getStr(), &aStat ) ) + fprintf( stderr, "stat( %s ) failed\n", aFilename.getStr() ); + fprintf( stderr, "Tmp file %s has modes: 0%03lo\n", aFilename.getStr(), (long)aStat.st_mode ); #endif const char* argv[4]; if( ! ( argv[ 0 ] = getenv( "SHELL" ) ) ) @@ -272,7 +272,7 @@ static bool passFileToCommandLine( const String& rFilename, const String& rComma { close( fd[0] ); char aBuffer[ 2048 ]; - FILE* fp = fopen( aFilename.GetBuffer(), "r" ); + FILE* fp = fopen( aFilename.getStr(), "r" ); while (fp && !feof(fp)) { size_t nBytesRead = fread(aBuffer, 1, sizeof( aBuffer ), fp); @@ -309,7 +309,7 @@ static bool passFileToCommandLine( const String& rFilename, const String& rComma // clean up the mess if( bRemoveFile ) - unlink( aFilename.GetBuffer() ); + unlink( aFilename.getStr() ); return bSuccess; } @@ -372,7 +372,7 @@ static bool sendAFax( const String& rFaxNumber, const String& rFileName, const S bSuccess = false; // clean up temp file - unlink( ByteString( rFileName, osl_getThreadTextEncoding() ).GetBuffer() ); + unlink(rtl::OUStringToOString(rFileName, osl_getThreadTextEncoding()).getStr()); return bSuccess; #else |