[Libreoffice-commits] .: Branch 'libreoffice-3-6' - editeng/source

Michael Stahl mst at kemper.freedesktop.org
Thu Aug 2 09:12:37 PDT 2012


 editeng/source/misc/svxacorr.cxx |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

New commits:
commit c247613d2f19b01702520d837e55529fd3c0b021
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Aug 2 17:30:09 2012 +0200

    Related fdo#53006 Make CApitals correction work without dictionary
    
    In a language for which there is no dictionary available (no "ABC" check in
    front of the current item in Writer's "Format - Character... - Font - Language"
    list), "Correct TWo INitial CApitals" (from Writer's "Tools - AutoCorrect
    Options... - Options") did not work (i.e., typing "FOo" followed by a space
    would not change it to "Foo").  That was apparently a regression introduced with
    51efaa592d4f54133c74e38cf294526bc78dffcd "Double-capital autocor takes
    spellcheck in account."  (I verified that with this fix words like "MPs" in
    "English (UK)" are still left as "MPs.")  Thanks to Caolán for help.
    
    Change-Id: Ia76286e4ca73138ce3571145b9c40b031a4553ba
    (cherry picked from commit 566bcf64ad9092ba6e55ba3de514226ae6b10c10)
    
    Signed-off-by: Michael Stahl <mstahl at redhat.com>
    
    Conflicts:
    
    	editeng/source/misc/svxacorr.cxx

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index fa9c7af..6d2440b 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -427,25 +427,27 @@ sal_Bool SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const String& rTxt,
         String sWord( rTxt.Copy( nSttPos - 1, nEndPos - nSttPos + 1 ));
         if( !FindInWrdSttExceptList(eLang, sWord) )
         {
+            // Check that word isn't correctly spelled before correcting:
             ::com::sun::star::uno::Reference<
                 ::com::sun::star::linguistic2::XSpellChecker1 > xSpeller =
                 SvxGetSpellChecker();
-            Sequence< ::com::sun::star::beans::PropertyValue > aEmptySeq;
-            // Check that word isn't correctly spelled before correcting
-            ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives > xSpellAlt
-                = xSpeller->spell(sWord, eLang, aEmptySeq);
-            if(xSpellAlt.is())
+            if( xSpeller->hasLanguage(eLang) )
             {
-                sal_Unicode cSave = rTxt.GetChar( nSttPos );
-                String sChar( cSave );
-                sChar = rCC.lowercase( sChar );
-                if( sChar.GetChar(0) != cSave && rDoc.ReplaceRange( nSttPos, 1, sChar ))
+                Sequence< ::com::sun::star::beans::PropertyValue > aEmptySeq;
+                if (!xSpeller->spell(sWord, eLang, aEmptySeq).is())
                 {
-                    if( SaveWordWrdSttLst & nFlags )
-                        rDoc.SaveCpltSttWord( CptlSttWrd, nSttPos, sWord, cSave );
-                    bRet = sal_True;
+                    return false;
                 }
             }
+            sal_Unicode cSave = rTxt.GetChar( nSttPos );
+            String sChar( cSave );
+            sChar = rCC.lowercase( sChar );
+            if( sChar.GetChar(0) != cSave && rDoc.ReplaceRange( nSttPos, 1, sChar ))
+            {
+                if( SaveWordWrdSttLst & nFlags )
+                    rDoc.SaveCpltSttWord( CptlSttWrd, nSttPos, sWord, cSave );
+                bRet = sal_True;
+            }
         }
     }
     return bRet;


More information about the Libreoffice-commits mailing list