diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-12-15 12:02:39 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-12-17 09:35:24 +0000 |
commit | 0d5644bbe90e87ccd646276bfc545c3201caa005 (patch) | |
tree | 3f8870ee1ce05184db0c71b1d8b7fc08fa581177 | |
parent | 2be589381e8e8969764e0de1ad079fca959afb8a (diff) |
UniString::Fill -> OUStringBuffer::padToLength
none of these strings starts out before "Fill" longer than the size they are
asked to be filled to so there are no trailing unfilled bits to consider
all of which means that we can get rid of UniString::Fill now
Change-Id: I8da21e9787017da9243a2c1d7118d3fbcca2a7fb
-rw-r--r-- | sc/source/core/data/table4.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/text/porglue.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 7 | ||||
-rw-r--r-- | tools/inc/tools/string.hxx | 2 | ||||
-rw-r--r-- | tools/source/string/tustring.cxx | 30 |
5 files changed, 13 insertions, 39 deletions
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 4aec7dfea954..1b9debb94074 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -23,6 +23,7 @@ #endif #include "scitems.hxx" +#include <comphelper/string.hxx> #include <svx/algitem.hxx> #include <editeng/boxitem.hxx> #include <editeng/brshitem.hxx> @@ -138,9 +139,9 @@ static String lcl_ValueString( sal_Int32 nValue, sal_uInt16 nMinDigits ) String aStr = String::CreateFromInt32( Abs( nValue ) ); if ( aStr.Len() < nMinDigits ) { - String aZero; - aZero.Fill( nMinDigits - aStr.Len(), '0' ); - aStr.Insert( aZero, 0 ); + OUStringBuffer aZero; + comphelper::string::padToLength(aZero, nMinDigits - aStr.Len(), '0'); + aStr.Insert(aZero.makeStringAndClear(), 0); } // nMinDigits doesn't include the '-' sign -> add after inserting zeros if ( nValue < 0 ) diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx index 1b55b92dc8fa..8e96901268ee 100644 --- a/sw/source/core/text/porglue.cxx +++ b/sw/source/core/text/porglue.cxx @@ -71,7 +71,9 @@ sal_Bool SwGluePortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) if( GetLen() && rInf.OnWin() && rInf.GetOpt().IsBlank() && rInf.IsNoSymbol() ) { - rTxt.Fill( GetLen(), CH_BULLET ); + OUStringBuffer aBuf; + comphelper::string::padToLength(aBuf, GetLen(), CH_BULLET); + rTxt = aBuf.makeStringAndClear(); return sal_True; } return sal_False; @@ -88,7 +90,7 @@ void SwGluePortion::Paint( const SwTxtPaintInfo &rInf ) const if( rInf.GetFont()->IsPaintBlank() ) { - rtl::OUStringBuffer aBuf; + OUStringBuffer aBuf; comphelper::string::padToLength(aBuf, GetFixWidth() / GetLen(), ' '); String aTxt(aBuf.makeStringAndClear()); SwTxtPaintInfo aInf( rInf, aTxt ); diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 49774bf92a0d..6eaf2d059957 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -18,6 +18,7 @@ */ #include <boost/scoped_ptr.hpp> +#include <comphelper/string.hxx> #include <tools/solar.h> #include <vcl/vclenum.hxx> #include <vcl/font.hxx> @@ -687,8 +688,10 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFmt &rNum, WW8_ANLV &rAV, if( bListSymbol ) { //cBulletChar benutzen, damit auf dem MAC richtig gemappt wird - sTxt.Fill( SVBT8ToByte( rAV.cbTextBefore ) - + SVBT8ToByte( rAV.cbTextAfter ), cBulletChar ); + OUStringBuffer aBuf; + comphelper::string::padToLength(aBuf, SVBT8ToByte(rAV.cbTextBefore) + + SVBT8ToByte(rAV.cbTextAfter), cBulletChar); + sTxt = aBuf.makeStringAndClear(); } } } diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index 674c36d46f65..03276c178c1d 100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -227,8 +227,6 @@ public: UniString& Erase( xub_StrLen nIndex = 0, xub_StrLen nCount = STRING_LEN ); UniString Copy( xub_StrLen nIndex = 0, xub_StrLen nCount = STRING_LEN ) const; - UniString& Fill( xub_StrLen nCount, sal_Unicode cFillChar = ' ' ); - UniString& ToLowerAscii(); UniString& ToUpperAscii(); diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx index 0beac79dba6a..f8fc18a0259f 100644 --- a/tools/source/string/tustring.cxx +++ b/tools/source/string/tustring.cxx @@ -237,36 +237,6 @@ StringCompare STRING::CompareIgnoreCaseToAscii( const STRING& rStr, return COMPARE_GREATER; } -STRING& STRING::Fill( xub_StrLen nCount, STRCODE cFillChar ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - if ( !nCount ) - return *this; - - // extend string if fill length is larger - if ( nCount > mpData->mnLen ) - { - // allocate string of new length - STRINGDATA* pNewData = ImplAllocData( nCount ); - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = pNewData; - } - else - ImplCopyData(); - - STRCODE* pStr = mpData->maStr; - do - { - *pStr = cFillChar; - ++pStr, - --nCount; - } - while ( nCount ); - - return *this; -} - STRCODE* STRING::GetBufferAccess() { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); |