summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-04-26 11:59:02 +0100
committerMichael Meeks <michael.meeks@suse.com>2012-04-26 12:54:26 +0100
commitb269dced445494891a8e6e8d1d62b931a31dddbd (patch)
tree9f7c1ece6987fc6955a274713fba6e2edd1c2f50
parent8df3fdd63548bebedfd0f5378783b6e3261e4f9a (diff)
fdo#46805 - special-case appending items to autocorrect lists
-rw-r--r--editeng/source/misc/svxacorr.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index f459af070691..ce5c71c67f67 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -68,6 +68,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)
@@ -233,15 +234,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;
@@ -2169,6 +2182,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