[Libreoffice-commits] core.git: editeng/source include/editeng

Ricardo Montania ricardo at linuxafundo.com.br
Sun May 19 20:34:44 PDT 2013


 editeng/source/misc/svxacorr.cxx   |   20 ++++++++------------
 editeng/source/outliner/outlvw.cxx |   10 ++++------
 include/editeng/svxacorr.hxx       |    2 +-
 3 files changed, 13 insertions(+), 19 deletions(-)

New commits:
commit c9c2fbe485de2bb831bd2e58faef87a19ceff622
Author: Ricardo Montania <ricardo at linuxafundo.com.br>
Date:   Thu May 16 13:08:34 2013 -0300

    Drop String.AppendAscii in editeng
    
    Change-Id: I25df0e20e2da50e91139cefba74af2741e5fffb5
    Reviewed-on: https://gerrit.libreoffice.org/3923
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index eebf87c..bb8f089 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1604,9 +1604,7 @@ sal_Bool SvxAutoCorrect::CreateLanguageFile( LanguageType eLang, sal_Bool bNewFi
 {
     OSL_ENSURE(pLangTable->find(eLang) == pLangTable->end(), "Language already exists ");
 
-    String sUserDirFile( GetAutoCorrFileName( eLang, sal_True, sal_False ));
-    String sShareDirFile( sUserDirFile );
-
+    OUString sShareDirFile( GetAutoCorrFileName( eLang, sal_True, sal_False ));
     SvxAutoCorrectLanguageListsPtr pLists = 0;
 
     Time nMinTime( 0, 2 ), nAktTime( Time::SYSTEM ), nLastCheckTime( Time::EMPTY );
@@ -1620,18 +1618,17 @@ sal_Bool SvxAutoCorrect::CreateLanguageFile( LanguageType eLang, sal_Bool bNewFi
         // 2 minutes.
         if( bNewFile )
         {
-            sShareDirFile = sUserDirFile;
-            pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sUserDirFile );
+            pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sShareDirFile );
             pLangTable->insert(eLang, pLists);
             aLastFileTable.erase(nFndPos);
         }
     }
-    else if( ( FStatHelper::IsDocument( sUserDirFile ) ||
+    else if( ( FStatHelper::IsDocument( sShareDirFile ) ||
                 FStatHelper::IsDocument( sShareDirFile =
                               GetAutoCorrFileName( eLang, sal_False, sal_False ) ) ) ||
-        ( sShareDirFile = sUserDirFile, bNewFile ))
+        ( sShareDirFile = sShareDirFile, bNewFile ))
     {
-        pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sUserDirFile );
+        pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sShareDirFile );
         pLangTable->insert(eLang, pLists);
         if (nFndPos != aLastFileTable.end())
             aLastFileTable.erase(nFndPos);
@@ -1909,13 +1906,12 @@ sal_Bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
     return sal_False;
 }
 
-String SvxAutoCorrect::GetAutoCorrFileName( LanguageType eLang,
+OUString SvxAutoCorrect::GetAutoCorrFileName( LanguageType eLang,
                                             sal_Bool bNewFile, sal_Bool bTst ) const
 {
-    String sRet, sExt( LanguageTag( eLang ).getBcp47() );
+    OUString sRet, sExt( LanguageTag( eLang ).getBcp47() );
 
-    sExt.Insert('_', 0);
-    sExt.AppendAscii( ".dat" );
+    sExt = "_" + sExt + ".dat";
     if( bNewFile )
         ( sRet = sUserAutoCorrFile )  += sExt;
     else if( !bTst )
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index a76419e..2229857 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -1312,7 +1312,7 @@ bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext(
     const EditView &rEditView )
 {
     // get text and locale for thesaurus look up
-    String aText;
+    OUString aText;
     EditEngine *pEditEngine = rEditView.GetEditEngine();
     ESelection aTextSel( rEditView.GetSelection() );
     if (!aTextSel.HasRange())
@@ -1320,17 +1320,15 @@ bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext(
     aText = pEditEngine->GetText( aTextSel );
     aTextSel.Adjust();
     LanguageType nLang = pEditEngine->GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos );
-    String aLangText( LanguageTag( nLang ).getBcp47() );
+    OUString aLangText( LanguageTag( nLang ).getBcp47() );
 
     // set word and locale to look up as status value
-    String aStatusVal( aText );
-    aStatusVal.AppendAscii( "#" );
-    aStatusVal += aLangText;
+    OUString aStatusVal= aText + "#" + aLangText;
 
     rStatusVal  = aStatusVal;
     rLang       = nLang;
 
-    return aText.Len() > 0;
+    return aText.getLength() > 0;
 }
 
 
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
index 4f54d8f..9d5774a 100644
--- a/include/editeng/svxacorr.hxx
+++ b/include/editeng/svxacorr.hxx
@@ -327,7 +327,7 @@ public:
 
     // Query/Set the name of the AutoCorrect file
     // the default is "autocorr.dat"
-    String GetAutoCorrFileName( LanguageType eLang = LANGUAGE_SYSTEM,
+    OUString GetAutoCorrFileName( LanguageType eLang = LANGUAGE_SYSTEM,
                                 sal_Bool bNewFile = sal_False,
                                 sal_Bool bTstUserExist = sal_False ) const;
 


More information about the Libreoffice-commits mailing list