Kaydet (Commit) 6691d78f authored tarafından Kay Schenk's avatar Kay Schenk Kaydeden (comit) Caolán McNamara

Resolves: #i126762# Ignore dictionary not in specified location.

Damaged "registrymodifications.xcu" causing problems with backups and spell checker

(cherry picked from commit 983e71fa)

Change-Id: I279275e11fb2ee6a223c7905652165d1b7a2e0ac
üst 11d605cc
...@@ -21,11 +21,13 @@ ...@@ -21,11 +21,13 @@
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp> #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
#include <com/sun/star/linguistic2/SpellFailure.hpp> #include <com/sun/star/linguistic2/SpellFailure.hpp>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/registry/XRegistryKey.hpp> #include <com/sun/star/registry/XRegistryKey.hpp>
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <lingutil.hxx> #include <lingutil.hxx>
#include <hunspell.hxx> #include <hunspell.hxx>
...@@ -141,6 +143,8 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales() ...@@ -141,6 +143,8 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
if (!aDics.empty()) 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... // get supported locales from the dictionaries-to-use...
sal_Int32 k = 0; sal_Int32 k = 0;
std::set< OUString, lt_rtl_OUString > aLocaleNamesSet; std::set< OUString, lt_rtl_OUString > aLocaleNamesSet;
...@@ -148,10 +152,14 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales() ...@@ -148,10 +152,14 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
for (aDictIt = aDics.begin(); aDictIt != aDics.end(); ++aDictIt) for (aDictIt = aDics.begin(); aDictIt != aDics.end(); ++aDictIt)
{ {
uno::Sequence< OUString > aLocaleNames( aDictIt->aLocaleNames ); uno::Sequence< OUString > aLocaleNames( aDictIt->aLocaleNames );
uno::Sequence< OUString > aLocations( aDictIt->aLocations );
sal_Int32 nLen2 = aLocaleNames.getLength(); sal_Int32 nLen2 = aLocaleNames.getLength();
for (k = 0; k < nLen2; ++k) 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 // ... and add them to the resulting sequence
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment