summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-11-27 20:37:42 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-11-28 09:55:03 +0000
commit6f33482f8f4329b6c9874397bdb67c1b958b69c2 (patch)
treeba19bc4bff6ddbd87354f90a61615cf5f4892c5a /svtools
parentc95a10ca2079cdc33d09189aef0a8788eab274ff (diff)
ByteString->rtl::OUStringToOString
Diffstat (limited to 'svtools')
-rw-r--r--svtools/bmpmaker/bmp.cxx18
-rw-r--r--svtools/bmpmaker/bmpcore.cxx3
-rw-r--r--svtools/bmpmaker/bmpsum.cxx6
-rw-r--r--svtools/bmpmaker/g2g.cxx20
-rw-r--r--svtools/source/filter/wmf/enhwmf.cxx7
-rw-r--r--svtools/source/filter/wmf/winwmf.cxx7
-rw-r--r--svtools/source/filter/wmf/wmfwr.cxx13
-rw-r--r--svtools/source/svhtml/htmlout.cxx2
8 files changed, 40 insertions, 36 deletions
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();
}