summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2013-08-22 20:51:25 +0200
committerMichael Stahl <mstahl@redhat.com>2013-08-25 13:12:12 +0000
commit8b0864c4b9a3392dea34658ac0368f9a1e4f66ed (patch)
tree3e3647b244e88260ff0f18c277f3ceef0be696d9 /sw
parentString to OUString (diff)
downloadcore-8b0864c4b9a3392dea34658ac0368f9a1e4f66ed.tar.gz
core-8b0864c4b9a3392dea34658ac0368f9a1e4f66ed.zip
String to OUString
Change-Id: Ice893d6ae25791d9a825cd95f60d1edb5e7e33d7 Reviewed-on: https://gerrit.libreoffice.org/5609 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/calc.hxx4
-rw-r--r--sw/source/core/bastyp/calc.cxx15
-rw-r--r--sw/source/ui/fldui/fldvar.cxx8
-rw-r--r--sw/source/ui/frmdlg/cption.cxx11
4 files changed, 19 insertions, 19 deletions
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index 4e2a665a3099..1411f43d731a 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -226,8 +226,8 @@ public:
static bool Str2Double( const String& rStr, xub_StrLen& rPos,
double& rVal, SwDoc *const pDoc );
- SW_DLLPUBLIC static sal_Bool IsValidVarName( const String& rStr,
- String* pValidName = 0 );
+ SW_DLLPUBLIC static sal_Bool IsValidVarName( const OUString& rStr,
+ OUString* pValidName = 0 );
};
#endif
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 5d013e3b000d..2d6bebcfce19 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -1541,28 +1541,27 @@ bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
return bRet;
}
-sal_Bool SwCalc::IsValidVarName( const String& rStr, String* pValidName )
+sal_Bool SwCalc::IsValidVarName( const OUString& rStr, OUString* pValidName )
{
sal_Bool bRet = sal_False;
using namespace ::com::sun::star::i18n;
{
// Parse any token.
ParseResult aRes = GetAppCharClass().parseAnyToken( rStr, 0,
- coStartFlags, aEmptyStr,
- coContFlags, aEmptyStr );
+ coStartFlags, OUString(),
+ coContFlags, OUString() );
if( aRes.TokenType & KParseType::IDENTNAME )
{
- bRet = aRes.EndPos == rStr.Len();
+ bRet = aRes.EndPos == rStr.getLength();
if( pValidName )
{
- xub_StrLen nRealStt = (xub_StrLen)aRes.LeadingWhiteSpace;
- *pValidName = rStr.Copy( nRealStt,
- static_cast<xub_StrLen>(aRes.EndPos) - nRealStt );
+ *pValidName = rStr.copy( aRes.LeadingWhiteSpace,
+ aRes.EndPos - aRes.LeadingWhiteSpace );
}
}
else if( pValidName )
- pValidName->Erase();
+ *pValidName = OUString();
}
return bRet;
}
diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
index df43475b0ab3..cbf808fbfbc3 100644
--- a/sw/source/ui/fldui/fldvar.cxx
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -804,8 +804,8 @@ IMPL_LINK_NOARG(SwFldVarPage, ModifyHdl)
sal_uInt16 nTypeId = (sal_uInt16)(sal_uLong)m_pTypeLB->GetEntryData(GetTypeSel());
bool bInsert = false, bApply = false, bDelete = false;
- String sName( m_pNameED->GetText() );
- xub_StrLen nLen = sName.Len();
+ OUString sName( m_pNameED->GetText() );
+ sal_Int32 nLen = sName.getLength();
switch( nTypeId )
{
@@ -814,9 +814,9 @@ IMPL_LINK_NOARG(SwFldVarPage, ModifyHdl)
case TYP_SETFLD:
case TYP_SEQFLD:
SwCalc::IsValidVarName( sName, &sName );
- if( sName.Len() != nLen )
+ if ( sName.getLength() != nLen )
{
- nLen = sName.Len();
+ nLen = sName.getLength();
Selection aSel(m_pNameED->GetSelection());
m_pNameED->SetText( sName );
m_pNameED->SetSelection( aSel ); // restore Cursorpos
diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index 3645a9cc8f5a..201b1c7f4f51 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -508,13 +508,14 @@ long CategoryBox::PreNotify( NotifyEvent& rNEvt )
if(nTmpCode != KEY_BACKSPACE && nTmpCode != KEY_RETURN
&& nTmpCode != KEY_TAB && nTmpCode != KEY_ESCAPE)
{
- OUString sKey( pEvent->GetCharCode() );
- String sName( GetText() );
+ const OUString sText( GetText() );
Selection aSel( GetSelection() );
aSel.Justify();
- if( aSel.Len() )
- sName.Erase( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() );
- sName.Insert( sKey, (xub_StrLen)aSel.Min() );
+
+ const OUString sName = sText.copy(0, aSel.Min())
+ + OUString( pEvent->GetCharCode() )
+ + sText.copy(aSel.Max());
+
if( !SwCalc::IsValidVarName( sName ))
nHandled = 1;
}