[Libreoffice-commits] core.git: sw/inc sw/source
Matteo Casalin
matteo.casalin at yahoo.com
Sun Aug 25 06:12:38 PDT 2013
sw/inc/calc.hxx | 4 ++--
sw/source/core/bastyp/calc.cxx | 15 +++++++--------
sw/source/ui/fldui/fldvar.cxx | 8 ++++----
sw/source/ui/frmdlg/cption.cxx | 11 ++++++-----
4 files changed, 19 insertions(+), 19 deletions(-)
New commits:
commit 8b0864c4b9a3392dea34658ac0368f9a1e4f66ed
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Thu Aug 22 20:51:25 2013 +0200
String to OUString
Change-Id: Ice893d6ae25791d9a825cd95f60d1edb5e7e33d7
Reviewed-on: https://gerrit.libreoffice.org/5609
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index 4e2a665..1411f43 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 5d013e3..2d6bebc 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 df43475..cbf808f 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 3645a9c..201b1c7 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;
}
More information about the Libreoffice-commits
mailing list