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

Caolán McNamara caolan at kemper.freedesktop.org
Tue May 1 05:45:33 PDT 2012


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

New commits:
commit a617eecdb6b2f8d6bb1b20674f8be8ce4d60f2d1
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Thu Apr 26 11:59:02 2012 +0100

    fdo#46805 - special-case appending items to autocorrect lists
    
    Signed-off-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index f044d6a..d7b2bc9 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -75,6 +75,7 @@
 #include <com/sun/star/ucb/NameClash.hpp>
 #include <xmloff/xmltoken.hxx>
 #include <vcl/help.hxx>
+#include <rtl/logfile.hxx>
 
 #define CHAR_HARDBLANK      ((sal_Unicode)0x00A0)
 
@@ -246,15 +247,27 @@ void SvxAutocorrWordList::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL )
 }
 
 
+// Keep the list sorted ...
 sal_Bool SvxAutocorrWordList::Seek_Entry( const SvxAutocorrWordPtr aE, sal_uInt16* pP ) const
 {
     register sal_uInt16 nO  = SvxAutocorrWordList_SAR::Count(),
             nM,
             nU = 0;
+
     if( nO > 0 )
     {
         CollatorWrapper& rCmp = ::GetCollatorWrapper();
         nO--;
+
+        // quick check of the end of the list
+        if (rCmp.compareString( aE->GetShort(),
+                                (*((SvxAutocorrWordPtr*)pData + nO))->GetShort() ) > 0)
+        {
+            if( pP ) *pP = nO + 1;
+            return sal_False;
+        }
+
+        // Incredibly crude sort algorithm, should use some partitioning search.
         while( nU <= nO )
         {
             nM = nU + ( nO - nU ) / 2;
@@ -2216,6 +2229,7 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList()
         OSL_ENSURE( xXMLParser.is(), "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" );
         if( xXMLParser.is() )
         {
+            RTL_LOGFILE_PRODUCT_CONTEXT( aLog, "AutoCorrect Import" );
             uno::Reference< xml::sax::XDocumentHandler > xFilter = new SvXMLAutoCorrectImport( xServiceFactory, pAutocorr_List, rAutoCorrect, xStg );
 
             // connect parser and filter


More information about the Libreoffice-commits mailing list