#i126762# patch by: hanya
Ignore dictionary not in specified location.
git-svn-id: https://svn.apache.org/repos/asf/openoffice/trunk@1727441 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/main/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/main/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index ee85691..2d99755 100644
--- a/main/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/main/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -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 @@
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 @@
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