summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-06-11 13:15:18 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-06-11 14:46:46 +0100
commit8f5629fd5aafc85e509a4160a11a285b0a66e7c0 (patch)
tree143883c85467b5ce9f5c665338e0f8a25067a0cd /sfx2
parent2106d8e648449d34b195068eef5f672a14ea64a8 (diff)
remove EraseLeadingChars and EraseTrailingChars
Change-Id: Ib9797fe97cd008cc6508ce8cec47dc5373416892
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/sfx2/doctdlg.hxx3
-rw-r--r--sfx2/source/appl/linkmgr2.cxx20
-rw-r--r--sfx2/source/appl/newhelp.cxx6
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx6
-rw-r--r--sfx2/source/dialog/mailmodel.cxx6
-rw-r--r--sfx2/source/dialog/mgetempl.cxx7
-rw-r--r--sfx2/source/dialog/srchdlg.cxx2
-rw-r--r--sfx2/source/doc/objmisc.cxx6
-rw-r--r--sfx2/source/inc/sfxtypes.hxx2
9 files changed, 35 insertions, 23 deletions
diff --git a/sfx2/inc/sfx2/doctdlg.hxx b/sfx2/inc/sfx2/doctdlg.hxx
index 1d9160c38847..c38451c01c31 100644
--- a/sfx2/inc/sfx2/doctdlg.hxx
+++ b/sfx2/inc/sfx2/doctdlg.hxx
@@ -28,6 +28,7 @@
#ifndef _SFXDOCTDLG_HXX
#define _SFXDOCTDLG_HXX
+#include <comphelper/string.hxx>
#include <sfx2/doctempl.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/edit.hxx>
@@ -73,7 +74,7 @@ public:
~SfxDocumentTemplateDlg();
String GetTemplateName() const
- { return aNameEd.GetText().EraseLeadingChars(); }
+ { return comphelper::string::stripStart(aNameEd.GetText(), ' '); }
sal_uInt16 GetRegion() const { return aRegionLb.GetSelectEntryPos(); }
String GetRegionName() const { return aRegionLb.GetSelectEntry(); }
};
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index 663e98e89168..be02f9fadafc 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -26,6 +26,7 @@
*
************************************************************************/
+#include <comphelper/string.hxx>
#include <sfx2/linkmgr.hxx>
#include <com/sun/star/document/UpdateDocMode.hpp>
#include <sfx2/objsh.hxx>
@@ -404,14 +405,25 @@ void MakeLnkName( String& rName, const String* pType, const String& rFile,
const String& rLink, const String* pFilter )
{
if( pType )
- (rName = *pType).EraseLeadingChars().EraseTrailingChars() += cTokenSeperator;
+ {
+ rName = comphelper::string::strip(*pType, ' ');
+ rName += cTokenSeperator;
+ }
else if( rName.Len() )
rName.Erase();
- ((rName += rFile).EraseLeadingChars().EraseTrailingChars() +=
- cTokenSeperator ).EraseLeadingChars().EraseTrailingChars() += rLink;
+ rName += rFile;
+
+ rName = comphelper::string::strip(rName, ' ');
+ rName += cTokenSeperator;
+ rName = comphelper::string::strip(rName, ' ');
+ rName += rLink;
if( pFilter )
- ((rName += cTokenSeperator ) += *pFilter).EraseLeadingChars().EraseTrailingChars();
+ {
+ rName += cTokenSeperator;
+ rName += *pFilter;
+ rName = comphelper::string::strip(rName, ' ');
+ }
}
void LinkManager::ReconnectDdeLink(SfxObjectShell& rServer)
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 1f4c69e2ef5c..1da4f36754b6 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1073,7 +1073,7 @@ void SearchTabPage_Impl::RememberSearchText( const String& rSearchText )
IMPL_LINK_NOARG(SearchTabPage_Impl, SearchHdl)
{
- String aSearchText = TRIM( aSearchED.GetText() );
+ String aSearchText = comphelper::string::strip(aSearchED.GetText(), ' ');
if ( aSearchText.Len() > 0 )
{
EnterWait();
@@ -1126,7 +1126,7 @@ IMPL_LINK_NOARG(SearchTabPage_Impl, OpenHdl)
IMPL_LINK_NOARG(SearchTabPage_Impl, ModifyHdl)
{
- String aSearchText = TRIM( aSearchED.GetText() );
+ String aSearchText = comphelper::string::strip(aSearchED.GetText(), ' ');
aSearchBtn.Enable( aSearchText.Len() > 0 );
return 0;
}
@@ -3163,7 +3163,7 @@ void SfxHelpWindow_Impl::openDone(const ::rtl::OUString& sURL ,
}
// When the SearchPage opens the help doc, then select all words, which are equal to its text
- String sSearchText = TRIM( pIndexWin->GetSearchText() );
+ String sSearchText = comphelper::string::strip(pIndexWin->GetSearchText(), ' ');
if ( sSearchText.Len() > 0 )
pTextWin->SelectSearchText( sSearchText, pIndexWin->IsFullWordSearch() );
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index ba0d0c29d4a6..d96b6d048135 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -68,6 +68,7 @@
#include <sfx2/objsh.hxx>
#include <sfx2/docfile.hxx>
#include <comphelper/storagehelper.hxx>
+#include <comphelper/string.hxx>
#include <sfx2/sfx.hrc>
#include "dinfdlg.hrc"
@@ -193,9 +194,8 @@ String ConvertDateTime_Impl( const String& rName,
String aStr( rWrapper.getDate( aD ) );
aStr += pDelim;
aStr += rWrapper.getTime( aT, sal_True, sal_False );
- String aAuthor = rName;
- aAuthor.EraseLeadingChars();
- if ( aAuthor.Len() )
+ rtl::OUString aAuthor = comphelper::string::stripStart(rName, ' ');
+ if (!aAuthor.isEmpty())
{
aStr += pDelim;
aStr += aAuthor;
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx
index 1cf9a2a3ee0d..79a4671c5e3a 100644
--- a/sfx2/source/dialog/mailmodel.cxx
+++ b/sfx2/source/dialog/mailmodel.cxx
@@ -972,12 +972,12 @@ sal_Bool CreateFromAddress_Impl( String& rFrom )
{
if ( aFirstName.Len() )
{
- rFrom = TRIM( aFirstName );
+ rFrom = comphelper::string::strip(aFirstName, ' ');
if ( aName.Len() )
rFrom += ' ';
}
- rFrom += TRIM( aName );
+ rFrom += comphelper::string::strip(aName, ' ');
// remove illegal characters
rFrom = comphelper::string::remove(rFrom, '<');
rFrom = comphelper::string::remove(rFrom, '>');
@@ -993,7 +993,7 @@ sal_Bool CreateFromAddress_Impl( String& rFrom )
{
if ( rFrom.Len() )
rFrom += ' ';
- ( ( rFrom += '<' ) += TRIM( aEmailName ) ) += '>';
+ ( ( rFrom += '<' ) += comphelper::string::strip(aEmailName, ' ') ) += '>';
}
else
rFrom.Erase();
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index d51ce3a8c693..7d7926df6824 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -26,6 +26,7 @@
*
************************************************************************/
+#include <comphelper/string.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/field.hxx>
#include <svl/eitem.hxx>
@@ -362,7 +363,7 @@ IMPL_LINK_INLINE_START( SfxManageStyleSheetPage, GetFocusHdl, Edit *, pEdit )
*/
{
- aBuf = pEdit->GetText().EraseLeadingChars();
+ aBuf = comphelper::string::stripStart(pEdit->GetText(), ' ');
return 0;
}
IMPL_LINK_INLINE_END( SfxManageStyleSheetPage, GetFocusHdl, Edit *, pEdit )
@@ -379,7 +380,7 @@ IMPL_LINK_INLINE_START( SfxManageStyleSheetPage, LoseFocusHdl, Edit *, pEdit )
*/
{
- const String aStr( pEdit->GetText().EraseLeadingChars() );
+ const String aStr(comphelper::string::stripStart(pEdit->GetText(), ' '));
pEdit->SetText( aStr );
// Update the Listbox of the base template if possible
if ( aStr != aBuf )
@@ -579,7 +580,7 @@ int SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
if ( aNameEd.HasFocus() )
LoseFocusHdl( &aNameEd );
- if ( !pStyle->SetName( aNameEd.GetText().EraseLeadingChars() ) )
+ if (!pStyle->SetName(comphelper::string::stripStart(aNameEd.GetText(), ' ')))
{
InfoBox aBox( this, SfxResId( MSG_TABPAGE_INVALIDNAME ) );
aBox.Execute();
diff --git a/sfx2/source/dialog/srchdlg.cxx b/sfx2/source/dialog/srchdlg.cxx
index 0d5528a7398b..b84a1bb6f490 100644
--- a/sfx2/source/dialog/srchdlg.cxx
+++ b/sfx2/source/dialog/srchdlg.cxx
@@ -127,7 +127,7 @@ void SearchDialog::SaveConfig()
sUserData += m_aSearchEdit.GetEntry(i);
sUserData += '\t';
}
- sUserData.EraseTrailingChars( '\t' );
+ sUserData = comphelper::string::stripStart(sUserData, '\t');
sUserData += ';';
sUserData += String::CreateFromInt32( m_aWholeWordsBox.IsChecked() ? 1 : 0 );
sUserData += ';';
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 3b44ed30cfdc..ff3510896a40 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -71,9 +71,10 @@
#include <com/sun/star/task/ErrorCodeRequest.hpp>
#include <unotools/securityoptions.hxx>
-#include <comphelper/processfactory.hxx>
#include <comphelper/componentcontext.hxx>
#include <comphelper/configurationhelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
#include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp>
@@ -1658,8 +1659,7 @@ void SfxHeaderAttributes_Impl::SetAttribute( const SvKeyValue& rKV )
if( rKV.GetKey().CompareIgnoreCaseToAscii( "refresh" ) == COMPARE_EQUAL && rKV.GetValue().Len() )
{
sal_uInt32 nTime = aValue.GetToken( 0, ';' ).ToInt32() ;
- String aURL = aValue.GetToken( 1, ';' );
- aURL.EraseTrailingChars().EraseLeadingChars();
+ String aURL = comphelper::string::strip(aValue.GetToken( 1, ';' ), ' ');
uno::Reference<document::XDocumentProperties> xDocProps(
pDoc->getDocProperties());
if( aURL.Copy(0, 4).CompareIgnoreCaseToAscii( "url=" ) == COMPARE_EQUAL )
diff --git a/sfx2/source/inc/sfxtypes.hxx b/sfx2/source/inc/sfxtypes.hxx
index c075f2ab8083..3d533b01ab2a 100644
--- a/sfx2/source/inc/sfxtypes.hxx
+++ b/sfx2/source/inc/sfxtypes.hxx
@@ -95,8 +95,6 @@ struct _Capper
#define DBG_OUTF(x)
#endif
-#define TRIM(s) s.EraseLeadingChars().EraseTrailingChars()
-
//------------------------------------------------------------------------
#if defined(DBG_UTIL) && defined(WNT)