diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/calc.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/bastyp/calc.cxx | 15 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldvar.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/cption.cxx | 11 |
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; } |