automation/source/testtool/objtest.cxx | 5 +- comphelper/inc/comphelper/string.hxx | 20 ++++++++++ comphelper/qa/string/test_string.cxx | 22 +++++++++++ comphelper/source/misc/string.cxx | 10 +++++ connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx | 3 + connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx | 2 - l10ntools/source/export2.cxx | 4 +- l10ntools/source/helpmerge.cxx | 6 --- l10ntools/source/merge.cxx | 2 - linguistic/source/dicimp.cxx | 3 + sc/inc/rangenam.hxx | 2 - sc/source/core/data/dpobject.cxx | 6 +-- sc/source/core/tool/rangenam.cxx | 15 ------- sc/source/filter/html/htmlpars.cxx | 4 +- sc/source/filter/rtf/eeimpars.cxx | 4 +- sc/source/ui/cctrl/editfield.cxx | 8 ++-- sc/source/ui/dbgui/validate.cxx | 3 + sc/source/ui/formdlg/dwfunctr.cxx | 6 +-- sc/source/ui/miscdlgs/conflictsdlg.cxx | 4 +- shell/source/tools/lngconvex/lngconvex.cxx | 3 + shell/source/tools/lngconvex/makefile.mk | 8 ++-- starmath/source/cursor.cxx | 2 - starmath/source/node.cxx | 4 +- svl/source/misc/lngmisc.cxx | 2 - svtools/source/misc/sampletext.cxx | 15 +++---- svx/source/dialog/fntctrl.cxx | 10 ++++- sw/source/core/frmedt/fetab.cxx | 4 +- sw/source/filter/rtf/rtffld.cxx | 2 - sw/source/filter/ww8/ww8par5.cxx | 4 +- sw/source/filter/ww8/ww8scan.cxx | 2 - tools/inc/tools/string.hxx | 1 tools/source/inet/inetstrm.cxx | 4 +- unusedcode.easy | 2 - vcl/source/control/combobox.cxx | 7 ++- vcl/source/control/field.cxx | 2 - vcl/source/control/longcurr.cxx | 3 + vcl/source/window/toolbox2.cxx | 3 + 37 files changed, 127 insertions(+), 80 deletions(-)
New commits: commit 52e04a433149d110a4a738ec6f8b7fa40c54e23c Author: Caolán McNamara <[email protected]> Date: Wed Nov 23 23:11:17 2011 +0000 fix some stray typos diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index e7c6ebc..4feb13d 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -1700,7 +1700,7 @@ void SmBraceNode::CreateTextFromNode(String &rText) { String aStr; GetSubNode(2)->CreateTextFromNode(aStr); - aStr = comphelper::string:strip(aStr, ' '); + aStr = comphelper::string::strip(aStr, ' '); aStr = comphelper::string::stripStart(aStr, '\\'); if (aStr.Len()) { diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index edf4c7c..ec53c7e 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -3447,7 +3447,7 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, String& rStr ) //HYPERLINK "filename" [switches] bool bOptions=false; - rStr = comphelper::strip::stripEnd(rStr, 1); + rStr = comphelper::string::stripEnd(rStr, 1); if (!bDataImport) { diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 032bf4a..e6fdcac 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -6251,7 +6251,7 @@ void lcl_checkFontname( String& sString ) if( bFound ) { sString = comphelper::string::remove(sString, 1); - sString = comphelper::string::strip(aString, ';'); + sString = comphelper::string::strip(sString, ';'); } } commit 94566b08a3a26230d4aed86a6834fc1cd9f67909 Author: Caolán McNamara <[email protected]> Date: Wed Nov 23 22:28:19 2011 +0000 IniParser::Dump uncalled, but potentially useful for debugging diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx index f56df91..ce8235e 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx @@ -110,7 +110,8 @@ IniParser::IniParser(OUString const & rIniName) throw(com::sun::star::io::IOExce } #endif } -#if OSL_DEBUG_LEVEL > 0 + +#if OSL_DEBUG_LEVEL > 1 void IniParser::Dump() { IniSectionMap::iterator iBegin = mAllSection.begin(); diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx index 57ff622..3064bea 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx @@ -76,7 +76,7 @@ class IniParser public: IniSectionMap * getAllSection(){return &mAllSection;}; IniParser(OUString const & rIniName) throw(com::sun::star::io::IOException ); -#if OSL_DEBUG_LEVEL > 0 +#if OSL_DEBUG_LEVEL > 1 void Dump(); #endif diff --git a/unusedcode.easy b/unusedcode.easy index d1ec66b..4eef24b 100644 --- a/unusedcode.easy +++ b/unusedcode.easy @@ -176,7 +176,6 @@ ImplImageList::GetImageCount() const ImplListBox::GetEntryFlags(unsigned short) const ImplRegionBand::IsInside(long, long) ImplRegionBand::IsOver(long, long) -IniParser::Dump() InsCapOptArr::Insert(InsCapOptArr const*, unsigned short, unsigned short) InsCapOptArr::Insert(InsCaptionOpt* const&, unsigned short&) InsCapOptArr::Insert(InsCaptionOpt* const*, unsigned short) commit 709c1f365b3bdd0d46ec4f1ddc244580a0dfa637 Author: Caolán McNamara <[email protected]> Date: Wed Nov 23 22:17:24 2011 +0000 remove various EraseLeadingAndTrailingChars diff --git a/automation/source/testtool/objtest.cxx b/automation/source/testtool/objtest.cxx index 6659f66..7da2f47 100644 --- a/automation/source/testtool/objtest.cxx +++ b/automation/source/testtool/objtest.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/frame/XDesktop.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <com/sun/star/bridge/XBridgeFactory.hpp> #include <com/sun/star/connection/XConnector.hpp> #include <com/sun/star/connection/XConnection.hpp> @@ -2897,8 +2898,8 @@ HACK("Ich gestehe alles: Ich war zu faul das richtig zu machen.") do { nOldLen = aSuffix.Len(); - aSuffix.EraseLeadingAndTrailingChars( ' ' ); - aSuffix.EraseLeadingAndTrailingChars( 0x09 ); + aSuffix = comphelper::string::strip(aSuffix, ' '); + aSuffix = comphelper::string::strip(aSuffix, 0x09); } while ( nOldLen != aSuffix.Len() ); aSource.Erase(nTestCase,nTcEnd-nTestCase); aSource.Insert(CUniString("Sub ").Append(aSuffix).AppendAscii(" CaseLog \"").Append(aSuffix).AppendAscii("\" : on error goto endcse : TestEnter "),nTestCase); diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 9c0663d..afa8148 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -73,6 +73,7 @@ #include <com/sun/star/sheet/XDrillDownDataSupplier.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <comphelper/types.hxx> #include <sal/macros.h> #include <tools/debug.hxx> @@ -1210,7 +1211,7 @@ bool lcl_ParseFunction( const String& rList, xub_StrLen nStartPos, xub_StrLen& r if ( bParsed ) { - aFuncStr.EraseLeadingAndTrailingChars( ' ' ); + aFuncStr = comphelper::string::strip(aFuncStr, ' '); const sal_Int32 nFuncCount = SAL_N_ELEMENTS(aFunctions); for ( sal_Int32 nFunc=0; nFunc<nFuncCount && !bFound; nFunc++ ) @@ -1429,8 +1430,7 @@ bool ScDPObject::ParseFilters( ScDPGetPivotDataField& rTarget, bool bError = false; bool bHasData = false; - String aRemaining( rFilterList ); - aRemaining.EraseLeadingAndTrailingChars( ' ' ); + String aRemaining(comphelper::string::strip(rFilterList, ' ')); while ( aRemaining.Len() && !bError ) { bool bUsed = false; diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index ec64e46..a2486a1 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -30,6 +30,7 @@ #include "precompiled_sc.hxx" #include <boost/shared_ptr.hpp> +#include <comphelper/string.hxx> #define SC_HTMLPARS_CXX #include "scitems.hxx" @@ -3052,8 +3053,7 @@ void ScHTMLQueryParser::FontOn( const ImportInfo& rInfo ) while( nPos != STRING_NOTFOUND ) { // font list separator: VCL = ';' HTML = ',' - String aFName = rFace.GetToken( 0, ',', nPos ); - aFName.EraseLeadingAndTrailingChars(); + String aFName = comphelper::string::strip(rFace.GetToken(0, ',', nPos), ' '); ScGlobal::AddToken( aFontName, aFName, ';' ); } if ( aFontName.Len() ) diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index 983e88c..050ac57 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -53,6 +53,7 @@ #include <vcl/svapp.hxx> #include <unotools/syslocale.hxx> #include <unotools/charclass.hxx> +#include <comphelper/string.hxx> #include "eeimport.hxx" #include "global.hxx" @@ -358,8 +359,7 @@ void ScEEImport::WriteToDocument( sal_Bool bSizeColsRows, double nOutputFactor, } else { - aStr = mpEngine->GetText( pE->aSel ); - aStr.EraseLeadingAndTrailingChars(); + aStr = comphelper::string::strip(mpEngine->GetText(pE->aSel), ' '); } bool bTextFormat = false; diff --git a/sc/source/ui/cctrl/editfield.cxx b/sc/source/ui/cctrl/editfield.cxx index d52ccef..7859712 100644 --- a/sc/source/ui/cctrl/editfield.cxx +++ b/sc/source/ui/cctrl/editfield.cxx @@ -33,6 +33,7 @@ #undef SC_DLLIMPLEMENTATION #endif #include "editfield.hxx" +#include <comphelper/string.hxx> #include <rtl/math.hxx> #include <unotools/localedatawrapper.hxx> #include "global.hxx" @@ -62,15 +63,14 @@ ScDoubleField::ScDoubleField( Window* pParent, const ResId& rResId ) : bool ScDoubleField::GetValue( double& rfValue ) const { - String aStr( GetText() ); - aStr.EraseLeadingAndTrailingChars( ' ' ); - bool bOk = aStr.Len() > 0; + rtl::OUString aStr(comphelper::string::strip(GetText(), ' ')); + bool bOk = aStr.getLength() > 0; if( bOk ) { rtl_math_ConversionStatus eStatus; sal_Int32 nEnd; rfValue = rtl::math::stringToDouble( aStr, lclGetDecSep(), lclGetGroupSep(), &eStatus, &nEnd ); - bOk = (eStatus == rtl_math_ConversionStatus_Ok) && (nEnd == static_cast< sal_Int32 >( aStr.Len() )); + bOk = (eStatus == rtl_math_ConversionStatus_Ok) && (nEnd == aStr.getLength() ); } return bOk; } diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index deafffa..b1eec39 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -33,6 +33,7 @@ #undef SC_DLLIMPLEMENTATION #endif +#include <comphelper/string.hxx> #include <vcl/svapp.hxx> #include <svl/aeitem.hxx> #include <svl/stritem.hxx> @@ -293,7 +294,7 @@ bool lclGetStringListFromFormula( String& rStringList, const String& rFmlaStr, s for( xub_StrLen nToken = 0, nStringIx = 0; bIsStringList && (nToken < nTokenCnt); ++nToken ) { String aToken( rFmlaStr.GetQuotedToken( 0, aQuotes, cFmlaSep, nStringIx ) ); - aToken.EraseLeadingAndTrailingChars(); + aToken = comphelper::string::strip(aToken, ' '); if( aToken.Len() ) // ignore empty tokens, i.e. "a";;"b" { bIsStringList = ScGlobal::IsQuoted( aToken, '"' ); diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index e923f66..6c619a6 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -29,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" -// INCLUDE --------------------------------------------------------------- +#include <comphelper/string.hxx> #include <editeng/editview.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> @@ -877,7 +877,7 @@ void ScFunctionDockWin::DoEnter(sal_Bool /* bOk */) //@@ ??? // NOTE: Theoretically the first parameter could have the // suppress flag as well, but practically it doesn't. aFirstArgStr = *(pDesc->ppDefArgNames[0]); - aFirstArgStr.EraseLeadingAndTrailingChars(); + aFirstArgStr = comphelper::string::strip(aFirstArgStr, ' '); aFirstArgStr.SearchAndReplaceAll(' ', '_'); aArgStr = aFirstArgStr; if ( nArgs != VAR_ARGS ) @@ -891,7 +891,7 @@ void ScFunctionDockWin::DoEnter(sal_Bool /* bOk */) //@@ ??? { aArgStr += aArgSep; String sTmp(*(pDesc->ppDefArgNames[nArg])); - sTmp.EraseLeadingAndTrailingChars(); + sTmp = comphelper::string::strip(sTmp, ' '); sTmp.SearchAndReplaceAll(' ', '_'); aArgStr += sTmp; } diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx index b2bfe04..1b617e0 100644 --- a/sc/source/ui/miscdlgs/conflictsdlg.cxx +++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx @@ -31,6 +31,7 @@ //----------------------------------------------------------------------------- +#include <comphelper/string.hxx> #include <vcl/msgbox.hxx> #include "conflictsdlg.hxx" @@ -503,8 +504,7 @@ String ScConflictsDlg::GetActionString( const ScChangeAction* pAction, ScDocumen aString += aDesc; aString += '\t'; - String aUser = pAction->GetUser(); - aUser.EraseLeadingAndTrailingChars(); + String aUser = comphelper::string::strip(pAction->GetUser(), ' '); if ( aUser.Len() == 0 ) { aUser = maStrUnknownUser; diff --git a/shell/source/tools/lngconvex/lngconvex.cxx b/shell/source/tools/lngconvex/lngconvex.cxx index 8ba8653..005c8c7 100644 --- a/shell/source/tools/lngconvex/lngconvex.cxx +++ b/shell/source/tools/lngconvex/lngconvex.cxx @@ -57,6 +57,7 @@ typedef unsigned short WORD; #include "cmdline.hxx" +#include <comphelper/string.hxx> #include "osl/thread.h" #include "osl/process.h" #include "osl/file.hxx" @@ -347,7 +348,7 @@ void add_group_entries( { Substitutor.set_language(iso_lang_identifier(iso_lang)); - key_value_utf8.EraseLeadingAndTrailingChars('\"'); + key_value_utf8 = comphelper::string::strip(key_value_utf8, '\"'); OUString key_value_utf16 = rtl::OStringToOUString(key_value_utf8, RTL_TEXTENCODING_UTF8); diff --git a/shell/source/tools/lngconvex/makefile.mk b/shell/source/tools/lngconvex/makefile.mk index bf71152..4d3971b 100644 --- a/shell/source/tools/lngconvex/makefile.mk +++ b/shell/source/tools/lngconvex/makefile.mk @@ -54,9 +54,11 @@ APP1TARGET=$(TARGET) APP1OBJS=$(OBJ)$/$(TARGET).obj\ $(OBJ)$/cmdline.obj APP1RPATH = NONE -APP1STDLIBS= $(SALLIB)\ - $(TOOLSLIB)\ - $(I18NISOLANGLIB) +APP1STDLIBS= \ + $(COMPHELPERLIB)\ + $(SALLIB)\ + $(TOOLSLIB)\ + $(I18NISOLANGLIB) # --- Targets ------------------------------------------------------ diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index 72ba885..1b66fa1 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -1112,7 +1112,7 @@ void SmCursor::InsertSpecial(XubString aString) { BeginEdit(); Delete(); - aString.EraseLeadingAndTrailingChars(); + aString = comphelper::string::strip(aString, ' '); aString = comphelper::string::stripStart(aString, '%'); //Create instance of special node diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 156537a..e7c6ebc 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -1677,7 +1677,7 @@ void SmBraceNode::CreateTextFromNode(String &rText) { String aStr; GetSubNode(0)->CreateTextFromNode(aStr); - aStr.EraseLeadingAndTrailingChars(); + aStr = comphelper::string::strip(aStr, ' '); aStr = comphelper::string::stripStart(aStr, '\\'); if (aStr.Len()) { @@ -1700,7 +1700,7 @@ void SmBraceNode::CreateTextFromNode(String &rText) { String aStr; GetSubNode(2)->CreateTextFromNode(aStr); - aStr.EraseLeadingAndTrailingChars(); + aStr = comphelper::string:strip(aStr, ' '); aStr = comphelper::string::stripStart(aStr, '\\'); if (aStr.Len()) { diff --git a/svl/source/misc/lngmisc.cxx b/svl/source/misc/lngmisc.cxx index 768dc4c..ca1b68a 100644 --- a/svl/source/misc/lngmisc.cxx +++ b/svl/source/misc/lngmisc.cxx @@ -157,7 +157,7 @@ String GetThesaurusReplaceText( const String &rText ) // remove any possible remaining ' ' that may confuse the thesaurus // when it gets called with the text - aText.EraseLeadingAndTrailingChars( sal_Unicode(' ') ); + aText = comphelper::string::strip(aText, ' '); return aText; } diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx index 44563d0..43af254 100644 --- a/sw/source/filter/rtf/rtffld.cxx +++ b/sw/source/filter/rtf/rtffld.cxx @@ -408,7 +408,7 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr ) case RTFFLD_IMPORT: { - aSaveStr.EraseLeadingAndTrailingChars(); + aSaveStr = comphelper::string::strip(aSaveStr, ' '); if( aSaveStr.Len() ) { sal_Unicode c = aSaveStr.GetChar( 0 ); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 6287d8c..edf4c7c 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -3444,10 +3444,10 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, String& rStr ) String sURL, sTarget, sMark; bool bDataImport = false; - //HYPERLINk "filename" [switches] + //HYPERLINK "filename" [switches] bool bOptions=false; - rStr.EraseTrailingChars( 1 ); + rStr = comphelper::strip::stripEnd(rStr, 1); if (!bDataImport) { diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 1d0d189..032bf4a 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -6251,7 +6251,7 @@ void lcl_checkFontname( String& sString ) if( bFound ) { sString = comphelper::string::remove(sString, 1); - sString.EraseLeadingAndTrailingChars( sal_Unicode( ';' ) ); + sString = comphelper::string::strip(aString, ';'); } } diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 0f551bf..23141b6 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" +#include <comphelper/string.hxx> #include <tools/table.hxx> #include <tools/debug.hxx> #include <tools/rc.h> @@ -58,7 +59,7 @@ static void lcl_GetSelectedEntries( Table& rSelectedPos, const XubString& rText, for( xub_StrLen n = rText.GetTokenCount( cTokenSep ); n; ) { XubString aToken = rText.GetToken( --n, cTokenSep ); - aToken.EraseLeadingAndTrailingChars( ' ' ); + aToken = comphelper::string::strip(aToken, ' '); sal_uInt16 nPos = pEntryList->FindEntry( aToken ); if ( nPos != LISTBOX_ENTRY_NOTFOUND ) rSelectedPos.Insert( ImplCreateKey( nPos ), (void*)sal_IntPtr(1L) ); @@ -402,7 +403,7 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG ) xub_StrLen nPrevIndex = nIndex; XubString aToken = aText.GetToken( 0, mcMultiSep, nIndex ); xub_StrLen nTokenLen = aToken.Len(); - aToken.EraseLeadingAndTrailingChars( ' ' ); + aToken = comphelper::string::strip(aToken, ' '); sal_uInt16 nP = mpImplLB->GetEntryList()->FindEntry( aToken ); if ( (nP != LISTBOX_ENTRY_NOTFOUND) && (!mpImplLB->GetEntryList()->IsEntryPosSelected( nP )) ) { @@ -414,7 +415,7 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG ) nIndex--; } } - aText.EraseLeadingAndTrailingChars( ' ' ); + aText = comphelper::string::strip(aText, ' '); } // Fehlende Eintraege anhaengen... diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 4f56bad..6721913 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -119,7 +119,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue, return sal_False; // Fuehrende und nachfolgende Leerzeichen entfernen - aStr.EraseLeadingAndTrailingChars( ' ' ); + aStr = comphelper::string::strip(aStr, ' '); // Position des Dezimalpunktes suchen nDecPos = aStr.Search( rLocaleDataWrappper.getNumDecimalSep() ); diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx index 34048a1..e43e746 100644 --- a/vcl/source/control/longcurr.cxx +++ b/vcl/source/control/longcurr.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" +#include <comphelper/string.hxx> #include <sot/object.hxx> #define _TOOLS_BIGINT #include <sot/factory.hxx> @@ -154,7 +155,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, BigInt& rValue, return sal_False; // Fuehrende und nachfolgende Leerzeichen entfernen - aStr.EraseLeadingAndTrailingChars( ' ' ); + aStr = comphelper::string::strip(aStr, ' '); // Position des Dezimalpunktes suchen nDecPos = aStr.Search( rLocaleDataWrapper.getNumDecimalSep() ); diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 3e32f5d..3be4896 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" +#include <comphelper/string.hxx> #include <tools/debug.hxx> #include <tools/rc.h> @@ -405,7 +406,7 @@ const XubString& ToolBox::ImplConvertMenuString( const XubString& rStr ) { maCvtStr = rStr; if ( mbMenuStrings ) - maCvtStr.EraseTrailingChars( '.' ); + maCvtStr = comphelper::string::stripEnd(maCvtStr, '.'); maCvtStr = MnemonicGenerator::EraseAllMnemonicChars( maCvtStr ); return maCvtStr; } commit 868bd3b778b6c7b970c67d1dacc469967f69e551 Author: Caolán McNamara <[email protected]> Date: Wed Nov 23 22:14:53 2011 +0000 fix for pesky pre-language-defect-fix gcc 4.0.1 diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index d3585d3..74c81b5 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -2346,8 +2346,8 @@ sal_Bool lcl_IsFormulaSelBoxes( const SwTable& rTbl, const SwTblBoxFormula& rFml { SwTblBoxFormula aTmp( rFml ); SwSelBoxes aBoxes; - aTmp.GetBoxesOfFormula( rTbl,aBoxes ); - for( SwSelBoxes::const_reverse_iterator it = aBoxes.rbegin(); it != aBoxes.rend(); ++it ) + aTmp.GetBoxesOfFormula( rTbl, aBoxes ); + for( SwSelBoxes::reverse_iterator it = aBoxes.rbegin(); it != aBoxes.rend(); ++it ) { SwTableBox* pBox = it->second; sal_uInt16 i; commit 0dbc4fa3efdea90ba23e17e12c2bfe15d763acbf Author: Caolán McNamara <[email protected]> Date: Wed Nov 23 17:24:38 2011 +0000 add string::strip, can replace EraseLeadingAndTrailingChars diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx index c1f5649..878b557 100644 --- a/comphelper/inc/comphelper/string.hxx +++ b/comphelper/inc/comphelper/string.hxx @@ -260,6 +260,26 @@ COMPHELPER_DLLPUBLIC rtl::OString stripEnd(const rtl::OString &rIn, COMPHELPER_DLLPUBLIC rtl::OUString stripEnd(const rtl::OUString &rIn, sal_Unicode c); +/** Strips occurrences of a character from the start and end of the source string + + @param rIn The input OString + @param c The character to be stripped from the start and end + + @return The resulting OString + */ +COMPHELPER_DLLPUBLIC rtl::OString strip(const rtl::OString &rIn, + sal_Char c); + +/** Strips occurrences of a character from the start and end of the source string + + @param rIn The input OUString + @param c The character to be stripped from the start and end + + @return The resulting OUString + */ +COMPHELPER_DLLPUBLIC rtl::OUString strip(const rtl::OUString &rIn, + sal_Unicode c); + /** Returns a token in the OString @param token the number of the token to return diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx index 1e89408..5c161a2 100644 --- a/comphelper/qa/string/test_string.cxx +++ b/comphelper/qa/string/test_string.cxx @@ -51,6 +51,7 @@ public: void testRemove(); void testStripStart(); void testStripEnd(); + void testStrip(); void testToken(); void testDecimalStringToNumber(); void testIsdigitAsciiString(); @@ -66,6 +67,7 @@ public: CPPUNIT_TEST(testRemove); CPPUNIT_TEST(testStripStart); CPPUNIT_TEST(testStripEnd); + CPPUNIT_TEST(testStrip); CPPUNIT_TEST(testToken); CPPUNIT_TEST(testDecimalStringToNumber); CPPUNIT_TEST(testIsdigitAsciiString); @@ -474,6 +476,26 @@ void TestString::testStripEnd() CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("ab"))); } +void TestString::testStrip() +{ + ::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("abc")); + ::rtl::OString aOut; + + aOut = ::comphelper::string::strip(aIn, 'b'); + CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("abc"))); + + aOut = ::comphelper::string::strip(aIn, 'c'); + CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("ab"))); + + aIn = rtl::OString(RTL_CONSTASCII_STRINGPARAM("aaa")); + aOut = ::comphelper::string::strip(aIn, 'a'); + CPPUNIT_ASSERT(aOut.isEmpty()); + + aIn = rtl::OString(RTL_CONSTASCII_STRINGPARAM("aba")); + aOut = ::comphelper::string::strip(aIn, 'a'); + CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("b"))); +} + void TestString::testToken() { ::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("10.11.12")); diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index 02d1cd4..2e8d631 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -231,6 +231,16 @@ rtl::OUString stripEnd(const rtl::OUString &rIn, sal_Unicode c) return tmpl_stripEnd<rtl::OUString, sal_Unicode>(rIn, c); } +rtl::OString strip(const rtl::OString &rIn, sal_Char c) +{ + return stripEnd(stripStart(rIn, c), c); +} + +rtl::OUString strip(const rtl::OUString &rIn, sal_Unicode c) +{ + return stripEnd(stripStart(rIn, c), c); +} + sal_uInt32 decimalStringToNumber( ::rtl::OUString const & str ) { diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx index 72ffde0..020e67a 100644 --- a/l10ntools/source/export2.cxx +++ b/l10ntools/source/export2.cxx @@ -354,7 +354,7 @@ void Export::InitLanguages( bool bMergeMode ){ ByteStringBoolHashMap aEnvLangs; for ( sal_uInt16 x = 0; x < sLanguages.GetTokenCount( ',' ); x++ ){ sTmp = getToken(getToken(sLanguages, x, ','), 0, '='); - sTmp.EraseLeadingAndTrailingChars(); + sTmp = comphelper::string::strip(sTmp, ' '); if( bMergeMode && !isAllowed( sTmp ) ){} else if( !( (sTmp.GetChar(0)=='x' || sTmp.GetChar(0)=='X') && sTmp.GetChar(1)=='-' ) ){ aLanguages.push_back( sTmp ); @@ -371,7 +371,7 @@ void Export::InitForcedLanguages( bool bMergeMode ){ ByteStringBoolHashMap aEnvLangs; for ( sal_uInt16 x = 0; x < sForcedLanguages.GetTokenCount( ',' ); x++ ){ sTmp = getToken(getToken(sForcedLanguages, x, ','), 0, '='); - sTmp.EraseLeadingAndTrailingChars(); + sTmp = comphelper::string::strip(sTmp, ' '); if( bMergeMode && isAllowed( sTmp ) ){} else if( !( (sTmp.GetChar(0)=='x' || sTmp.GetChar(0)=='X') && sTmp.GetChar(1)=='-' ) ) aForcedLanguages.push_back( sTmp ); diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index a42f058..8c409f4 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -216,7 +216,7 @@ MergeDataFile::MergeDataFile( ByteString sPFO = sLine.GetToken( 1, '\t', rIdx ); // 7 sPFO = sHACK; ByteString nLANG = sLine.GetToken( 1, '\t', rIdx ); // 9 - nLANG.EraseLeadingAndTrailingChars(); + nLANG = comphelper::string::strip(nLANG, ' '); const ByteString sTEXT = sLine.GetToken( 0, '\t', rIdx ); // 10 const ByteString sQHTEXT = sLine.GetToken( 1, '\t', rIdx ); // 12 const ByteString sTITLE = sLine.GetToken( 0, '\t', rIdx ); // 13 diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index 22927eb..8ebb011 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -41,6 +41,7 @@ #include <tools/string.hxx> #include <tools/urlobj.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <unotools/ucbstreamhelper.hxx> #include <com/sun/star/ucb/XSimpleFileAccess.hpp> @@ -88,7 +89,7 @@ static sal_Bool getTag(const ByteString &rLine, if (nPos == STRING_NOTFOUND) return sal_False; - rTagValue = rLine.Copy( nPos + sal::static_int_cast< xub_StrLen >(strlen( pTagName )) ).EraseLeadingAndTrailingChars(); + rTagValue = comphelper::string::strip(rLine.Copy(nPos + sal::static_int_cast< xub_StrLen >(strlen( pTagName ))), ' '); return sal_True; } diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index 73f60c4..a40474d 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -682,7 +682,15 @@ void SvxFontPrevWindow::Paint( const Rectangle& ) if ( !pImpl->bSelection || pImpl->bUseFontNameAsText ) { using namespace com::sun::star::i18n::ScriptType; - pImpl->aText = rFont.GetName(); + + //If we're showing multiple sample texts, then they're all + //sample texts. If only showing Latin, continue to use + //the fontname as the preview + if ((pImpl->m_bCJKEnabled) || (pImpl->m_bCTLEnabled)) + pImpl->aText = makeRepresentativeTextForFont(LATIN, rFont); + else + pImpl->aText = rFont.GetName(); + if (pImpl->m_bCJKEnabled) { if (pImpl->aText.Len()) commit 2dba28faae2266e72c05d8f3d55bfbc3e5771adb Author: Caolán McNamara <[email protected]> Date: Wed Nov 23 17:24:35 2011 +0000 add string::strip, can replace EraseLeadingAndTrailingChars diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index fb373b2..c9258be 100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -237,6 +237,7 @@ public: ByteString& EraseLeadingChars( sal_Char c = ' ' ); ByteString& EraseTrailingChars( sal_Char c = ' ' ); ByteString& EraseLeadingAndTrailingChars( sal_Char c = ' ' ); + ByteString& ConvertLineEnd( LineEnd eLineEnd ); ByteString& ConvertLineEnd() { return ConvertLineEnd( GetSystemLineEnd() ); } diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx index a11f22d..eadeec5 100644 --- a/tools/source/inet/inetstrm.cxx +++ b/tools/source/inet/inetstrm.cxx @@ -1620,8 +1620,8 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) sal_uInt16 nPos = aLowerType.Search ("boundary="); ByteString aBoundary(aType.copy(nPos + 9)); - aBoundary.EraseLeadingAndTrailingChars (' '); - aBoundary.EraseLeadingAndTrailingChars ('"'); + aBoundary = comphelper::string::strip(aBoundary, ' '); + aBoundary = comphelper::string::strip(aBoundary, '"'); // Save boundary. pMsg->SetMultipartBoundary (aBoundary); commit 3869e10a30a22a8cf47986d4216d9edd8e501c5f Author: Caolán McNamara <[email protected]> Date: Wed Nov 23 17:22:57 2011 +0000 for mixed script mode use sample latin text diff --git a/svtools/source/misc/sampletext.cxx b/svtools/source/misc/sampletext.cxx index 7c2be7b..8ea0295 100644 --- a/svtools/source/misc/sampletext.cxx +++ b/svtools/source/misc/sampletext.cxx @@ -425,6 +425,9 @@ rtl::OUString makeShortRepresentativeTextForScript(UScriptCode eScript) sSampleText = rtl::OUString(aTale, SAL_N_ELEMENTS(aTale)); break; } + case USCRIPT_LATIN: + sSampleText = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Lorem ipsum")); + break; default: break; } @@ -1010,17 +1013,11 @@ namespace return aMask; } - boost::dynamic_bitset<sal_uInt32> getGenericMask() - { - static boost::dynamic_bitset<sal_uInt32> aMask(getWeakMask() & getCommonLatnSubsetMask()); - return aMask; - } - UScriptCode getScript(const vcl::FontCapabilities &rFontCapabilities) { using vcl::UnicodeCoverage::UnicodeCoverageEnum; - boost::dynamic_bitset<sal_uInt32> aMasked = rFontCapabilities.maUnicodeRange & getGenericMask(); + boost::dynamic_bitset<sal_uInt32> aMasked = rFontCapabilities.maUnicodeRange & getWeakMask(); if (aMasked.count() == 1) return otCoverageToScript(static_cast<UnicodeCoverageEnum>(aMasked.find_first())); @@ -1160,7 +1157,7 @@ rtl::OUString makeShortRepresentativeTextForSelectedFont(OutputDevice &rDevice) lcl_dump_codepage_coverage(aFontCapabilities.maCodePageRange); #endif - aFontCapabilities.maUnicodeRange &= getGenericMask(); + aFontCapabilities.maUnicodeRange &= getCommonLatnSubsetMask(); //If this font is probably tuned to display a single non-Latin //script and the font name is itself in Latin, then show a small @@ -1551,6 +1548,8 @@ rtl::OUString makeRepresentativeTextForFont(sal_Int16 nScriptType, const Font &r sRet = makeRepresentativeTextForScript(USCRIPT_ARABIC); } } + else if (nScriptType == com::sun::star::i18n::ScriptType::LATIN) + sRet = makeRepresentativeTextForScript(USCRIPT_LATIN); } } commit 7fb2fdff429c84e12f892f1de65598b1f222346e Author: Caolán McNamara <[email protected]> Date: Wed Nov 23 16:06:24 2011 +0000 unused local string diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx index 5a9f82e..262af63 100644 --- a/l10ntools/source/helpmerge.cxx +++ b/l10ntools/source/helpmerge.cxx @@ -174,7 +174,7 @@ bool HelpParser::CreateSDF( if( pXMLElement != NULL ) { OUString data = pXMLElement->ToOUString(); - String sTmp = String(data.getStr()); + String sTmp = String(data.getStr()); sTmp.SearchAndReplaceAll(ret,ret_char); // Remove \n sTmp.SearchAndReplaceAll(tab,tab_char); // Remove \t @@ -385,10 +385,6 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile static ResData pResData( "","",""); pResData.sResTyp = "help"; - ByteString sTmp = Export::sLanguages; - - sTmp.EraseLeadingAndTrailingChars(); - for(XMLHashMap::iterator pos=aXMLStrHM->begin();pos!=aXMLStrHM->end();++pos) // Merge every l10n related string { commit 402ad3989d68f3576012c41724a351956e45d0da Author: Caolán McNamara <[email protected]> Date: Wed Nov 23 15:46:49 2011 +0000 unused ScRangeName::copyLocalNames diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx index 4214af3..608680e 100644 --- a/sc/inc/rangenam.hxx +++ b/sc/inc/rangenam.hxx @@ -193,8 +193,6 @@ public: /// Map that stores non-managed pointers to ScRangeName instances. typedef ::std::map<SCTAB, const ScRangeName*> TabNameCopyMap; - static void copyLocalNames(const TabNameMap& rNames, TabNameCopyMap& rCopy); - typedef DataType::const_iterator const_iterator; typedef DataType::iterator iterator; diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index 1d2d99c..a6398f8 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -759,21 +759,6 @@ public: } -void ScRangeName::copyLocalNames(const TabNameMap& rNames, TabNameCopyMap& rCopy) -{ - TabNameMap::const_iterator itr = rNames.begin(), itrEnd = rNames.end(); - for (; itr != itrEnd; ++itr) - { - const ScRangeName* p = itr->second; - if (!p || p->empty()) - // Skip empty ones. - continue; - - rCopy.insert( - TabNameCopyMap::value_type(itr->first, p)); - } -} - ScRangeName::ScRangeName() {} ScRangeName::ScRangeName(const ScRangeName& r) : diff --git a/unusedcode.easy b/unusedcode.easy index 77d915b..d1ec66b 100644 --- a/unusedcode.easy +++ b/unusedcode.easy @@ -423,7 +423,6 @@ ScRTFColTwips_SAR::Replace(unsigned long const&, unsigned short) ScRTFColTwips_SAR::Replace(unsigned long const*, unsigned short, unsigned short) ScRTFColTwips_SAR::_ForEach(unsigned short, unsigned short, unsigned char (*)(unsigned long const&, void*), void*) ScRangeData::ScRangeData(unsigned short) -ScRangeName::copyLocalNames(boost::ptr_map<short, ScRangeName, std::less<short>, boost::heap_clone_allocator, std::allocator<std::pair<short const, void*> > > const&, std::__debug::map<short, ScRangeName const*, std::less<short>, std::allocator<std::pair<short const, ScRangeName const*> > >&) ScRightFooterEditPage::GetRanges() ScRightHeaderEditPage::GetRanges() ScSheetSourceDesc::GetCacheId() const
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
