summaryrefslogtreecommitdiff
path: root/lingucomponent
diff options
context:
space:
mode:
authorKay Schenk <kschenk@apache.org>2016-01-28 22:19:30 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-02-02 09:35:29 +0000
commit6691d78f1df044877fdfa30dd08f0821569efc92 (patch)
tree6122c4360dde6f467cedc6a728241c00414e3621 /lingucomponent
parent11d605cc5a0c221d2423b6e63f502db660d085d2 (diff)
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
Diffstat (limited to 'lingucomponent')
-rw-r--r--lingucomponent/source/spellcheck/spell/sspellimp.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 00e8e50a21a0..e8ec4e8dd346 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