Skip to content

Commit

Permalink
#i126762# patch by: hanya
Browse files Browse the repository at this point in the history
Ignore dictionary not in specified location.



git-svn-id: https://svn.apache.org/repos/asf/openoffice/trunk@1727441 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Kay Schenk committed Jan 28, 2016
1 parent e6348c9 commit f47a949
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion main/lingucomponent/source/spellcheck/spell/sspellimp.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -160,17 +161,33 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
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;
std::list< SvtLinguConfigDictionaryEntry >::const_iterator aDictIt;
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
Expand Down

0 comments on commit f47a949

Please sign in to comment.