You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ks...@apache.org on 2016/01/28 23:19:31 UTC

svn commit: r1727441 - /openoffice/trunk/main/lingucomponent/source/spellcheck/spell/sspellimp.cxx

Author: kschenk
Date: Thu Jan 28 22:19:30 2016
New Revision: 1727441

URL: http://svn.apache.org/viewvc?rev=1727441&view=rev
Log:
#i126762# patch by: hanya
Ignore dictionary not in specified location.


Modified:
    openoffice/trunk/main/lingucomponent/source/spellcheck/spell/sspellimp.cxx

Modified: openoffice/trunk/main/lingucomponent/source/spellcheck/spell/sspellimp.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/lingucomponent/source/spellcheck/spell/sspellimp.cxx?rev=1727441&r1=1727440&r2=1727441&view=diff
==============================================================================
--- openoffice/trunk/main/lingucomponent/source/spellcheck/spell/sspellimp.cxx (original)
+++ openoffice/trunk/main/lingucomponent/source/spellcheck/spell/sspellimp.cxx Thu Jan 28 22:19:30 2016
@@ -33,6 +33,7 @@
 #include <tools/debug.hxx>
 #include <unotools/processfactory.hxx>
 #include <osl/mutex.hxx>
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
 
 #include <lingutil.hxx>
 #include <hunspell.hxx>
@@ -160,6 +161,18 @@ Sequence< Locale > SAL_CALL SpellChecker
         numdict = aDics.size();
         if (numdict)
         {
+            uno::Reference< lang::XMultiServiceFactory > xServiceFactory( utl::getProcessServiceFactory() );
+            uno::Reference< ucb::XSimpleFileAccess > xAccess;
+            try
+            {
+                xAccess.set( xServiceFactory->createInstance( 
+                        A2OU( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW );
+            }
+            catch (uno::Exception & e)
+            {
+                DBG_ASSERT( 0, "failed to get input stream" );
+                (void) e;
+            }
             // get supported locales from the dictionaries-to-use...
             sal_Int32 k = 0;
             std::set< rtl::OUString, lt_rtl_OUString > aLocaleNamesSet;
@@ -167,10 +180,14 @@ Sequence< Locale > SAL_CALL SpellChecker
             for (aDictIt = aDics.begin();  aDictIt != aDics.end();  ++aDictIt)
             {
                 uno::Sequence< rtl::OUString > aLocaleNames( aDictIt->aLocaleNames );
+                uno::Sequence< rtl::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