[Libreoffice-commits] core.git: lingucomponent/source

Kay Schenk kschenk at apache.org
Tue Feb 2 09:35:59 UTC 2016


 lingucomponent/source/spellcheck/spell/sspellimp.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 6691d78f1df044877fdfa30dd08f0821569efc92
Author: Kay Schenk <kschenk at apache.org>
Date:   Thu Jan 28 22:19:30 2016 +0000

    Resolves: #i126762# Ignore dictionary not in specified location.
    
    Damaged "registrymodifications.xcu" causing problems with backups and spell checker
    
    (cherry picked from commit 983e71fa37e12fbae29eddc2b855ddaf6280cc0e)
    
    Change-Id: I279275e11fb2ee6a223c7905652165d1b7a2e0ac

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 00e8e50a..e8ec4e8 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -21,11 +21,13 @@
 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
 
 #include <com/sun/star/linguistic2/SpellFailure.hpp>
+#include <comphelper/processfactory.hxx>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/registry/XRegistryKey.hpp>
 #include <tools/debug.hxx>
 #include <osl/mutex.hxx>
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
 
 #include <lingutil.hxx>
 #include <hunspell.hxx>
@@ -141,6 +143,8 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 
         if (!aDics.empty())
         {
+            uno::Reference< lang::XMultiServiceFactory > xServiceFactory(comphelper::getProcessServiceFactory());
+            uno::Reference< ucb::XSimpleFileAccess > xAccess(xServiceFactory->createInstance("com.sun.star.ucb.SimpleFileAccess"), uno::UNO_QUERY);
             // get supported locales from the dictionaries-to-use...
             sal_Int32 k = 0;
             std::set< OUString, lt_rtl_OUString > aLocaleNamesSet;
@@ -148,10 +152,14 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
             for (aDictIt = aDics.begin();  aDictIt != aDics.end();  ++aDictIt)
             {
                 uno::Sequence< OUString > aLocaleNames( aDictIt->aLocaleNames );
+                uno::Sequence< OUString > aLocations( aDictIt->aLocations );
                 sal_Int32 nLen2 = aLocaleNames.getLength();
                 for (k = 0;  k < nLen2;  ++k)
                 {
-                    aLocaleNamesSet.insert( aLocaleNames[k] );
+                    if (xAccess.is() && xAccess->exists(aLocations[k]))
+                    {
+                        aLocaleNamesSet.insert( aLocaleNames[k] );
+                    }
                 }
             }
             // ... and add them to the resulting sequence


More information about the Libreoffice-commits mailing list