Simplify Sequence iterations in lingucomponent..lotuswordpro
Use range-based loops, STL and comphelper functions. Change-Id: I975a9c09265976d5ce4a1d7ac2023cbb75bb7f28 Reviewed-on: https://gerrit.libreoffice.org/78242 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
This commit is contained in:
parent
cc4edc0f29
commit
760a377f71
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <com/sun/star/uno/Reference.h>
|
#include <com/sun/star/uno/Reference.h>
|
||||||
|
|
||||||
|
#include <comphelper/sequence.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>
|
||||||
@ -51,6 +52,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <numeric>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -113,11 +115,10 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
|
|||||||
uno::Sequence< OUString > aFormatList;
|
uno::Sequence< OUString > aFormatList;
|
||||||
aLinguCfg.GetSupportedDictionaryFormatsFor( "Hyphenators",
|
aLinguCfg.GetSupportedDictionaryFormatsFor( "Hyphenators",
|
||||||
"org.openoffice.lingu.LibHnjHyphenator", aFormatList );
|
"org.openoffice.lingu.LibHnjHyphenator", aFormatList );
|
||||||
sal_Int32 nLen = aFormatList.getLength();
|
for (const auto& rFormat : std::as_const(aFormatList))
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
std::vector< SvtLinguConfigDictionaryEntry > aTmpDic(
|
std::vector< SvtLinguConfigDictionaryEntry > aTmpDic(
|
||||||
aLinguCfg.GetActiveDictionariesByFormat( aFormatList[i] ) );
|
aLinguCfg.GetActiveDictionariesByFormat( rFormat ) );
|
||||||
aDics.insert( aDics.end(), aTmpDic.begin(), aTmpDic.end() );
|
aDics.insert( aDics.end(), aTmpDic.begin(), aTmpDic.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,57 +133,50 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
|
|||||||
// is not yet supported by the list of new style dictionaries
|
// is not yet supported by the list of new style dictionaries
|
||||||
MergeNewStyleDicsAndOldStyleDics( aDics, aOldStyleDics );
|
MergeNewStyleDicsAndOldStyleDics( aDics, aOldStyleDics );
|
||||||
|
|
||||||
sal_Int32 numdict = aDics.size();
|
if (!aDics.empty())
|
||||||
if (numdict)
|
|
||||||
{
|
{
|
||||||
// get supported locales from the dictionaries-to-use...
|
// get supported locales from the dictionaries-to-use...
|
||||||
sal_Int32 k = 0;
|
|
||||||
std::set<OUString> aLocaleNamesSet;
|
std::set<OUString> aLocaleNamesSet;
|
||||||
for (auto const& dict : aDics)
|
for (auto const& dict : aDics)
|
||||||
{
|
{
|
||||||
uno::Sequence< OUString > aLocaleNames( dict.aLocaleNames );
|
for (const auto& rLocaleName : dict.aLocaleNames)
|
||||||
sal_Int32 nLen2 = aLocaleNames.getLength();
|
|
||||||
for (k = 0; k < nLen2; ++k)
|
|
||||||
{
|
{
|
||||||
aLocaleNamesSet.insert( aLocaleNames[k] );
|
aLocaleNamesSet.insert( rLocaleName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ... and add them to the resulting sequence
|
// ... and add them to the resulting sequence
|
||||||
aSuppLocales.realloc( aLocaleNamesSet.size() );
|
std::vector<Locale> aLocalesVec;
|
||||||
k = 0;
|
aLocalesVec.reserve(aLocaleNamesSet.size());
|
||||||
for (auto const& localeName : aLocaleNamesSet)
|
|
||||||
{
|
std::transform(aLocaleNamesSet.begin(), aLocaleNamesSet.end(), std::back_inserter(aLocalesVec),
|
||||||
Locale aTmp( LanguageTag::convertToLocale(localeName));
|
[](const OUString& localeName) { return LanguageTag::convertToLocale(localeName); });
|
||||||
aSuppLocales[k++] = aTmp;
|
|
||||||
}
|
aSuppLocales = comphelper::containerToSequence(aLocalesVec);
|
||||||
|
|
||||||
//! For each dictionary and each locale we need a separate entry.
|
//! For each dictionary and each locale we need a separate entry.
|
||||||
//! If this results in more than one dictionary per locale than (for now)
|
//! If this results in more than one dictionary per locale than (for now)
|
||||||
//! it is undefined which dictionary gets used.
|
//! it is undefined which dictionary gets used.
|
||||||
//! In the future the implementation should support using several dictionaries
|
//! In the future the implementation should support using several dictionaries
|
||||||
//! for one locale.
|
//! for one locale.
|
||||||
numdict = 0;
|
sal_Int32 numdict = std::accumulate(aDics.begin(), aDics.end(), 0,
|
||||||
for (auto const& dict : aDics)
|
[](const sal_Int32 nSum, const SvtLinguConfigDictionaryEntry& dict) {
|
||||||
numdict = numdict + dict.aLocaleNames.getLength();
|
return nSum + dict.aLocaleNames.getLength(); });
|
||||||
|
|
||||||
// add dictionary information
|
// add dictionary information
|
||||||
mvDicts.resize(numdict);
|
mvDicts.resize(numdict);
|
||||||
|
|
||||||
k = 0;
|
sal_Int32 k = 0;
|
||||||
for (auto const& dict : aDics)
|
for (auto const& dict : aDics)
|
||||||
{
|
{
|
||||||
if (dict.aLocaleNames.hasElements() &&
|
if (dict.aLocaleNames.hasElements() &&
|
||||||
dict.aLocations.hasElements())
|
dict.aLocations.hasElements())
|
||||||
{
|
{
|
||||||
uno::Sequence< OUString > aLocaleNames(dict.aLocaleNames);
|
|
||||||
sal_Int32 nLocales = aLocaleNames.getLength();
|
|
||||||
|
|
||||||
// currently only one language per dictionary is supported in the actual implementation...
|
// currently only one language per dictionary is supported in the actual implementation...
|
||||||
// Thus here we work-around this by adding the same dictionary several times.
|
// Thus here we work-around this by adding the same dictionary several times.
|
||||||
// Once for each of its supported locales.
|
// Once for each of its supported locales.
|
||||||
for (sal_Int32 i = 0; i < nLocales; ++i)
|
for (const auto& rLocaleName : dict.aLocaleNames)
|
||||||
{
|
{
|
||||||
LanguageTag aLanguageTag(dict.aLocaleNames[i]);
|
LanguageTag aLanguageTag(rLocaleName);
|
||||||
mvDicts[k].aPtr = nullptr;
|
mvDicts[k].aPtr = nullptr;
|
||||||
mvDicts[k].eEnc = RTL_TEXTENCODING_DONTKNOW;
|
mvDicts[k].eEnc = RTL_TEXTENCODING_DONTKNOW;
|
||||||
mvDicts[k].aLoc = aLanguageTag.getLocale();
|
mvDicts[k].aLoc = aLanguageTag.getLocale();
|
||||||
@ -204,7 +198,6 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no dictionary found so register no dictionaries
|
// no dictionary found so register no dictionaries
|
||||||
numdict = 0;
|
|
||||||
mvDicts.clear();
|
mvDicts.clear();
|
||||||
aSuppLocales.realloc(0);
|
aSuppLocales.realloc(0);
|
||||||
}
|
}
|
||||||
@ -217,21 +210,10 @@ sal_Bool SAL_CALL Hyphenator::hasLocale(const Locale& rLocale)
|
|||||||
{
|
{
|
||||||
MutexGuard aGuard( GetLinguMutex() );
|
MutexGuard aGuard( GetLinguMutex() );
|
||||||
|
|
||||||
bool bRes = false;
|
|
||||||
if (!aSuppLocales.hasElements())
|
if (!aSuppLocales.hasElements())
|
||||||
getLocales();
|
getLocales();
|
||||||
|
|
||||||
const Locale *pLocale = aSuppLocales.getConstArray();
|
return comphelper::findValue(aSuppLocales, rLocale) != -1;
|
||||||
sal_Int32 nLen = aSuppLocales.getLength();
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
|
||||||
if (rLocale == pLocale[i])
|
|
||||||
{
|
|
||||||
bRes = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bRes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -270,15 +270,12 @@ void SAL_CALL LangGuess_Impl::disableLanguages(
|
|||||||
|
|
||||||
EnsureInitialized();
|
EnsureInitialized();
|
||||||
|
|
||||||
sal_Int32 nLanguages = rLanguages.getLength();
|
for (const Locale& rLanguage : rLanguages)
|
||||||
const Locale *pLanguages = rLanguages.getConstArray();
|
|
||||||
|
|
||||||
for (sal_Int32 i = 0; i < nLanguages; ++i)
|
|
||||||
{
|
{
|
||||||
string language;
|
string language;
|
||||||
|
|
||||||
OString l = OUStringToOString( pLanguages[i].Language, RTL_TEXTENCODING_ASCII_US );
|
OString l = OUStringToOString( rLanguage.Language, RTL_TEXTENCODING_ASCII_US );
|
||||||
OString c = OUStringToOString( pLanguages[i].Country, RTL_TEXTENCODING_ASCII_US );
|
OString c = OUStringToOString( rLanguage.Country, RTL_TEXTENCODING_ASCII_US );
|
||||||
|
|
||||||
language += l.getStr();
|
language += l.getStr();
|
||||||
language += "-";
|
language += "-";
|
||||||
@ -294,15 +291,12 @@ void SAL_CALL LangGuess_Impl::enableLanguages(
|
|||||||
|
|
||||||
EnsureInitialized();
|
EnsureInitialized();
|
||||||
|
|
||||||
sal_Int32 nLanguages = rLanguages.getLength();
|
for (const Locale& rLanguage : rLanguages)
|
||||||
const Locale *pLanguages = rLanguages.getConstArray();
|
|
||||||
|
|
||||||
for (sal_Int32 i = 0; i < nLanguages; ++i)
|
|
||||||
{
|
{
|
||||||
string language;
|
string language;
|
||||||
|
|
||||||
OString l = OUStringToOString( pLanguages[i].Language, RTL_TEXTENCODING_ASCII_US );
|
OString l = OUStringToOString( rLanguage.Language, RTL_TEXTENCODING_ASCII_US );
|
||||||
OString c = OUStringToOString( pLanguages[i].Country, RTL_TEXTENCODING_ASCII_US );
|
OString c = OUStringToOString( rLanguage.Country, RTL_TEXTENCODING_ASCII_US );
|
||||||
|
|
||||||
language += l.getStr();
|
language += l.getStr();
|
||||||
language += "-";
|
language += "-";
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
#include <rtl/textenc.h>
|
#include <rtl/textenc.h>
|
||||||
#include <sal/log.hxx>
|
#include <sal/log.hxx>
|
||||||
|
|
||||||
|
#include <numeric>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -189,9 +190,9 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
|
|||||||
//! it is undefined which dictionary gets used.
|
//! it is undefined which dictionary gets used.
|
||||||
//! In the future the implementation should support using several dictionaries
|
//! In the future the implementation should support using several dictionaries
|
||||||
//! for one locale.
|
//! for one locale.
|
||||||
sal_uInt32 nDictSize = 0;
|
sal_uInt32 nDictSize = std::accumulate(aDics.begin(), aDics.end(), sal_uInt32(0),
|
||||||
for (auto const& dict : aDics)
|
[](const sal_uInt32 nSum, const SvtLinguConfigDictionaryEntry& dict) {
|
||||||
nDictSize += dict.aLocaleNames.getLength();
|
return nSum + dict.aLocaleNames.getLength(); });
|
||||||
|
|
||||||
// add dictionary information
|
// add dictionary information
|
||||||
m_DictItems.reserve(nDictSize);
|
m_DictItems.reserve(nDictSize);
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <tools/debug.hxx>
|
#include <tools/debug.hxx>
|
||||||
#include <comphelper/lok.hxx>
|
#include <comphelper/lok.hxx>
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
|
#include <comphelper/sequence.hxx>
|
||||||
#include <osl/mutex.hxx>
|
#include <osl/mutex.hxx>
|
||||||
#include <osl/thread.h>
|
#include <osl/thread.h>
|
||||||
#include <unotools/pathoptions.hxx>
|
#include <unotools/pathoptions.hxx>
|
||||||
@ -48,6 +49,7 @@
|
|||||||
#include "nthesdta.hxx"
|
#include "nthesdta.hxx"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <numeric>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -113,11 +115,10 @@ Sequence< Locale > SAL_CALL Thesaurus::getLocales()
|
|||||||
uno::Sequence< OUString > aFormatList;
|
uno::Sequence< OUString > aFormatList;
|
||||||
aLinguCfg.GetSupportedDictionaryFormatsFor( "Thesauri",
|
aLinguCfg.GetSupportedDictionaryFormatsFor( "Thesauri",
|
||||||
"org.openoffice.lingu.new.Thesaurus", aFormatList );
|
"org.openoffice.lingu.new.Thesaurus", aFormatList );
|
||||||
sal_Int32 nLen = aFormatList.getLength();
|
for (const auto& rFormat : std::as_const(aFormatList))
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
std::vector< SvtLinguConfigDictionaryEntry > aTmpDic(
|
std::vector< SvtLinguConfigDictionaryEntry > aTmpDic(
|
||||||
aLinguCfg.GetActiveDictionariesByFormat( aFormatList[i] ) );
|
aLinguCfg.GetActiveDictionariesByFormat( rFormat ) );
|
||||||
aDics.insert( aDics.end(), aTmpDic.begin(), aTmpDic.end() );
|
aDics.insert( aDics.end(), aTmpDic.begin(), aTmpDic.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,61 +133,53 @@ Sequence< Locale > SAL_CALL Thesaurus::getLocales()
|
|||||||
// is not yet supported by the list of new style dictionaries
|
// is not yet supported by the list of new style dictionaries
|
||||||
MergeNewStyleDicsAndOldStyleDics( aDics, aOldStyleDics );
|
MergeNewStyleDicsAndOldStyleDics( aDics, aOldStyleDics );
|
||||||
|
|
||||||
sal_Int32 numthes = aDics.size();
|
if (!aDics.empty())
|
||||||
if (numthes)
|
|
||||||
{
|
{
|
||||||
// get supported locales from the dictionaries-to-use...
|
// get supported locales from the dictionaries-to-use...
|
||||||
sal_Int32 k = 0;
|
|
||||||
std::set<OUString> aLocaleNamesSet;
|
std::set<OUString> aLocaleNamesSet;
|
||||||
for (auto const& dict : aDics)
|
for (auto const& dict : aDics)
|
||||||
{
|
{
|
||||||
uno::Sequence< OUString > aLocaleNames(dict.aLocaleNames);
|
for (const auto& rLocaleName : dict.aLocaleNames)
|
||||||
sal_Int32 nLen2 = aLocaleNames.getLength();
|
|
||||||
for (k = 0; k < nLen2; ++k)
|
|
||||||
{
|
{
|
||||||
if (!comphelper::LibreOfficeKit::isWhitelistedLanguage(aLocaleNames[k]))
|
if (!comphelper::LibreOfficeKit::isWhitelistedLanguage(rLocaleName))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
aLocaleNamesSet.insert( aLocaleNames[k] );
|
aLocaleNamesSet.insert( rLocaleName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ... and add them to the resulting sequence
|
// ... and add them to the resulting sequence
|
||||||
aSuppLocales.realloc( aLocaleNamesSet.size() );
|
std::vector<Locale> aLocalesVec;
|
||||||
std::set<OUString>::const_iterator aItB;
|
aLocalesVec.reserve(aLocaleNamesSet.size());
|
||||||
k = 0;
|
|
||||||
for (auto const& localeName : aLocaleNamesSet)
|
std::transform(aLocaleNamesSet.begin(), aLocaleNamesSet.end(), std::back_inserter(aLocalesVec),
|
||||||
{
|
[](const OUString& localeName) -> Locale { return LanguageTag::convertToLocale(localeName); });
|
||||||
Locale aTmp( LanguageTag::convertToLocale(localeName));
|
|
||||||
aSuppLocales[k++] = aTmp;
|
aSuppLocales = comphelper::containerToSequence(aLocalesVec);
|
||||||
}
|
|
||||||
|
|
||||||
//! For each dictionary and each locale we need a separate entry.
|
//! For each dictionary and each locale we need a separate entry.
|
||||||
//! If this results in more than one dictionary per locale than (for now)
|
//! If this results in more than one dictionary per locale than (for now)
|
||||||
//! it is undefined which dictionary gets used.
|
//! it is undefined which dictionary gets used.
|
||||||
//! In the future the implementation should support using several dictionaries
|
//! In the future the implementation should support using several dictionaries
|
||||||
//! for one locale.
|
//! for one locale.
|
||||||
numthes = 0;
|
sal_Int32 numthes = std::accumulate(aDics.begin(), aDics.end(), 0,
|
||||||
for (auto const& dict : aDics)
|
[](const sal_Int32 nSum, const SvtLinguConfigDictionaryEntry& dict) {
|
||||||
numthes = numthes + dict.aLocaleNames.getLength();
|
return nSum + dict.aLocaleNames.getLength(); });
|
||||||
|
|
||||||
// add dictionary information
|
// add dictionary information
|
||||||
mvThesInfo.resize(numthes);
|
mvThesInfo.resize(numthes);
|
||||||
|
|
||||||
k = 0;
|
sal_Int32 k = 0;
|
||||||
for (auto const& dict : aDics)
|
for (auto const& dict : aDics)
|
||||||
{
|
{
|
||||||
if (dict.aLocaleNames.hasElements() &&
|
if (dict.aLocaleNames.hasElements() &&
|
||||||
dict.aLocations.hasElements())
|
dict.aLocations.hasElements())
|
||||||
{
|
{
|
||||||
uno::Sequence< OUString > aLocaleNames(dict.aLocaleNames);
|
|
||||||
sal_Int32 nLocales = aLocaleNames.getLength();
|
|
||||||
|
|
||||||
// currently only one language per dictionary is supported in the actual implementation...
|
// currently only one language per dictionary is supported in the actual implementation...
|
||||||
// Thus here we work-around this by adding the same dictionary several times.
|
// Thus here we work-around this by adding the same dictionary several times.
|
||||||
// Once for each of its supported locales.
|
// Once for each of its supported locales.
|
||||||
for (sal_Int32 i = 0; i < nLocales; ++i)
|
for (const auto& rLocaleName : dict.aLocaleNames)
|
||||||
{
|
{
|
||||||
LanguageTag aLanguageTag(dict.aLocaleNames[i]);
|
LanguageTag aLanguageTag(rLocaleName);
|
||||||
mvThesInfo[k].aEncoding = RTL_TEXTENCODING_DONTKNOW;
|
mvThesInfo[k].aEncoding = RTL_TEXTENCODING_DONTKNOW;
|
||||||
mvThesInfo[k].aLocale = aLanguageTag.getLocale();
|
mvThesInfo[k].aLocale = aLanguageTag.getLocale();
|
||||||
mvThesInfo[k].aCharSetInfo.reset( new CharClass( aLanguageTag ) );
|
mvThesInfo[k].aCharSetInfo.reset( new CharClass( aLanguageTag ) );
|
||||||
@ -219,20 +212,10 @@ sal_Bool SAL_CALL Thesaurus::hasLocale(const Locale& rLocale)
|
|||||||
{
|
{
|
||||||
MutexGuard aGuard( GetLinguMutex() );
|
MutexGuard aGuard( GetLinguMutex() );
|
||||||
|
|
||||||
bool bRes = false;
|
|
||||||
if (!aSuppLocales.hasElements())
|
if (!aSuppLocales.hasElements())
|
||||||
getLocales();
|
getLocales();
|
||||||
sal_Int32 nLen = aSuppLocales.getLength();
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
return comphelper::findValue(aSuppLocales, rLocale) != -1;
|
||||||
{
|
|
||||||
const Locale *pLocale = aSuppLocales.getConstArray();
|
|
||||||
if (rLocale == pLocale[i])
|
|
||||||
{
|
|
||||||
bRes = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bRes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryMeanings(
|
Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryMeanings(
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <tools/urlobj.hxx>
|
#include <tools/urlobj.hxx>
|
||||||
#include <ucbhelper/content.hxx>
|
#include <ucbhelper/content.hxx>
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
|
#include <comphelper/sequence.hxx>
|
||||||
#include <cppuhelper/supportsservice.hxx>
|
#include <cppuhelper/supportsservice.hxx>
|
||||||
#include <unotools/streamwrap.hxx>
|
#include <unotools/streamwrap.hxx>
|
||||||
#include <unotools/ucbstreamhelper.hxx>
|
#include <unotools/ucbstreamhelper.hxx>
|
||||||
@ -405,39 +406,17 @@ uno::Sequence< OUString > SAL_CALL ConvDic::getConversions(
|
|||||||
pair< ConvMap::iterator, ConvMap::iterator > aRange =
|
pair< ConvMap::iterator, ConvMap::iterator > aRange =
|
||||||
rConvMap.equal_range( aLookUpText );
|
rConvMap.equal_range( aLookUpText );
|
||||||
|
|
||||||
sal_Int32 nCount = 0;
|
std::vector<OUString> aRes;
|
||||||
ConvMap::iterator aIt;
|
auto nCount = static_cast<size_t>(std::distance(aRange.first, aRange.second));
|
||||||
for (aIt = aRange.first; aIt != aRange.second; ++aIt)
|
aRes.reserve(nCount);
|
||||||
++nCount;
|
|
||||||
|
|
||||||
uno::Sequence< OUString > aRes( nCount );
|
std::transform(aRange.first, aRange.second, std::back_inserter(aRes),
|
||||||
OUString *pRes = aRes.getArray();
|
[](ConvMap::const_reference rEntry) { return rEntry.second; });
|
||||||
sal_Int32 i = 0;
|
|
||||||
for (aIt = aRange.first; aIt != aRange.second; ++aIt)
|
|
||||||
pRes[i++] = (*aIt).second;
|
|
||||||
|
|
||||||
return aRes;
|
return comphelper::containerToSequence(aRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool lcl_SeqHasEntry(
|
|
||||||
const OUString *pSeqStart, // first element to check
|
|
||||||
sal_Int32 nToCheck, // number of elements to check
|
|
||||||
const OUString &rText)
|
|
||||||
{
|
|
||||||
bool bRes = false;
|
|
||||||
if (pSeqStart && nToCheck > 0)
|
|
||||||
{
|
|
||||||
const OUString *pDone = pSeqStart + nToCheck; // one behind last to check
|
|
||||||
while (!bRes && pSeqStart != pDone)
|
|
||||||
{
|
|
||||||
if (*pSeqStart++ == rText)
|
|
||||||
bRes = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bRes;
|
|
||||||
}
|
|
||||||
|
|
||||||
uno::Sequence< OUString > SAL_CALL ConvDic::getConversionEntries(
|
uno::Sequence< OUString > SAL_CALL ConvDic::getConversionEntries(
|
||||||
ConversionDirection eDirection )
|
ConversionDirection eDirection )
|
||||||
{
|
{
|
||||||
@ -451,9 +430,8 @@ uno::Sequence< OUString > SAL_CALL ConvDic::getConversionEntries(
|
|||||||
|
|
||||||
ConvMap &rConvMap = eDirection == ConversionDirection_FROM_LEFT ?
|
ConvMap &rConvMap = eDirection == ConversionDirection_FROM_LEFT ?
|
||||||
aFromLeft : *pFromRight;
|
aFromLeft : *pFromRight;
|
||||||
uno::Sequence< OUString > aRes( rConvMap.size() );
|
std::vector<OUString> aRes;
|
||||||
OUString *pRes = aRes.getArray();
|
aRes.reserve(rConvMap.size());
|
||||||
sal_Int32 nIdx = 0;
|
|
||||||
for (auto const& elem : rConvMap)
|
for (auto const& elem : rConvMap)
|
||||||
{
|
{
|
||||||
OUString aCurEntry( elem.first );
|
OUString aCurEntry( elem.first );
|
||||||
@ -461,12 +439,11 @@ uno::Sequence< OUString > SAL_CALL ConvDic::getConversionEntries(
|
|||||||
// respective to the evaluated side (FROM_LEFT or FROM_RIGHT).
|
// respective to the evaluated side (FROM_LEFT or FROM_RIGHT).
|
||||||
// Thus if FROM_LEFT is evaluated for pairs (A,B) and (A,C)
|
// Thus if FROM_LEFT is evaluated for pairs (A,B) and (A,C)
|
||||||
// only one entry for A will be returned in the result)
|
// only one entry for A will be returned in the result)
|
||||||
if (nIdx == 0 || !lcl_SeqHasEntry( pRes, nIdx, aCurEntry ))
|
if (std::find(aRes.begin(), aRes.end(), aCurEntry) == aRes.end())
|
||||||
pRes[ nIdx++ ] = aCurEntry;
|
aRes.push_back(aCurEntry);
|
||||||
}
|
}
|
||||||
aRes.realloc( nIdx );
|
|
||||||
|
|
||||||
return aRes;
|
return comphelper::containerToSequence(aRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -197,12 +197,13 @@ uno::Sequence< OUString > SAL_CALL ConvDicNameContainer::getElementNames( )
|
|||||||
{
|
{
|
||||||
MutexGuard aGuard( GetLinguMutex() );
|
MutexGuard aGuard( GetLinguMutex() );
|
||||||
|
|
||||||
sal_Int32 nLen = aConvDics.size();
|
std::vector<OUString> aRes;
|
||||||
uno::Sequence< OUString > aRes( nLen );
|
aRes.reserve(aConvDics.size());
|
||||||
OUString *pName = aRes.getArray();
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
std::transform(aConvDics.begin(), aConvDics.end(), std::back_inserter(aRes),
|
||||||
pName[i] = aConvDics[i]->getName();
|
[](const uno::Reference<XConversionDictionary>& rDic) { return rDic->getName(); });
|
||||||
return aRes;
|
|
||||||
|
return comphelper::containerToSequence(aRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Bool SAL_CALL ConvDicNameContainer::hasByName( const OUString& rName )
|
sal_Bool SAL_CALL ConvDicNameContainer::hasByName( const OUString& rName )
|
||||||
@ -281,13 +282,9 @@ void ConvDicNameContainer::AddConvDics(
|
|||||||
{
|
{
|
||||||
const Sequence< OUString > aDirCnt(
|
const Sequence< OUString > aDirCnt(
|
||||||
utl::LocalFileHelper::GetFolderContents( rSearchDirPathURL, false ) );
|
utl::LocalFileHelper::GetFolderContents( rSearchDirPathURL, false ) );
|
||||||
const OUString *pDirCnt = aDirCnt.getConstArray();
|
|
||||||
sal_Int32 nEntries = aDirCnt.getLength();
|
|
||||||
|
|
||||||
for (sal_Int32 i = 0; i < nEntries; ++i)
|
for (const OUString& aURL : aDirCnt)
|
||||||
{
|
{
|
||||||
OUString aURL( pDirCnt[i] );
|
|
||||||
|
|
||||||
sal_Int32 nPos = aURL.lastIndexOf('.');
|
sal_Int32 nPos = aURL.lastIndexOf('.');
|
||||||
OUString aExt( aURL.copy(nPos + 1).toAsciiLowerCase() );
|
OUString aExt( aURL.copy(nPos + 1).toAsciiLowerCase() );
|
||||||
OUString aSearchExt( rExtension.toAsciiLowerCase() );
|
OUString aSearchExt( rExtension.toAsciiLowerCase() );
|
||||||
@ -374,12 +371,10 @@ ConvDicNameContainer & ConvDicList::GetNameContainer()
|
|||||||
// access list of text conversion dictionaries to activate
|
// access list of text conversion dictionaries to activate
|
||||||
SvtLinguOptions aOpt;
|
SvtLinguOptions aOpt;
|
||||||
SvtLinguConfig().GetOptions( aOpt );
|
SvtLinguConfig().GetOptions( aOpt );
|
||||||
sal_Int32 nLen = aOpt.aActiveConvDics.getLength();
|
for (const OUString& rActiveConvDic : std::as_const(aOpt.aActiveConvDics))
|
||||||
const OUString *pActiveConvDics = aOpt.aActiveConvDics.getConstArray();
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
uno::Reference< XConversionDictionary > xDic =
|
uno::Reference< XConversionDictionary > xDic =
|
||||||
mxNameContainer->GetByName( pActiveConvDics[i] );
|
mxNameContainer->GetByName( rActiveConvDic );
|
||||||
if (xDic.is())
|
if (xDic.is())
|
||||||
xDic->setActive( true );
|
xDic->setActive( true );
|
||||||
}
|
}
|
||||||
@ -464,15 +459,10 @@ uno::Sequence< OUString > SAL_CALL ConvDicList::queryConversions(
|
|||||||
bSupported |= bMatch;
|
bSupported |= bMatch;
|
||||||
if (bMatch && xDic->isActive())
|
if (bMatch && xDic->isActive())
|
||||||
{
|
{
|
||||||
Sequence< OUString > aNewConv( xDic->getConversions(
|
const Sequence< OUString > aNewConv( xDic->getConversions(
|
||||||
rText, nStartPos, nLength,
|
rText, nStartPos, nLength,
|
||||||
eDirection, nTextConversionOptions ) );
|
eDirection, nTextConversionOptions ) );
|
||||||
sal_Int32 nNewLen = aNewConv.getLength();
|
std::copy(aNewConv.begin(), aNewConv.end(), std::back_inserter(aRes));
|
||||||
if (nNewLen > 0)
|
|
||||||
{
|
|
||||||
for (sal_Int32 k = 0; k < nNewLen; ++k)
|
|
||||||
aRes.push_back(aNewConv[k]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,12 +279,9 @@ void DicList::SearchForDictionaries(
|
|||||||
|
|
||||||
const uno::Sequence< OUString > aDirCnt( utl::LocalFileHelper::
|
const uno::Sequence< OUString > aDirCnt( utl::LocalFileHelper::
|
||||||
GetFolderContents( rDicDirURL, false ) );
|
GetFolderContents( rDicDirURL, false ) );
|
||||||
const OUString *pDirCnt = aDirCnt.getConstArray();
|
|
||||||
sal_Int32 nEntries = aDirCnt.getLength();
|
|
||||||
|
|
||||||
for (sal_Int32 i = 0; i < nEntries; ++i)
|
for (const OUString& aURL : aDirCnt)
|
||||||
{
|
{
|
||||||
OUString aURL( pDirCnt[i] );
|
|
||||||
LanguageType nLang = LANGUAGE_NONE;
|
LanguageType nLang = LANGUAGE_NONE;
|
||||||
bool bNeg = false;
|
bool bNeg = false;
|
||||||
OUString aDicTitle = "";
|
OUString aDicTitle = "";
|
||||||
@ -622,13 +619,11 @@ void DicList::CreateDicList()
|
|||||||
//! activation of the dictionaries
|
//! activation of the dictionaries
|
||||||
mxDicEvtLstnrHelper->BeginCollectEvents();
|
mxDicEvtLstnrHelper->BeginCollectEvents();
|
||||||
const uno::Sequence< OUString > aActiveDics( aOpt.GetActiveDics() );
|
const uno::Sequence< OUString > aActiveDics( aOpt.GetActiveDics() );
|
||||||
const OUString *pActiveDic = aActiveDics.getConstArray();
|
for (const OUString& rActiveDic : aActiveDics)
|
||||||
sal_Int32 nLen = aActiveDics.getLength();
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
if (!pActiveDic[i].isEmpty())
|
if (!rActiveDic.isEmpty())
|
||||||
{
|
{
|
||||||
uno::Reference< XDictionary > xDic( getDictionaryByName( pActiveDic[i] ) );
|
uno::Reference< XDictionary > xDic( getDictionaryByName( rActiveDic ) );
|
||||||
if (xDic.is())
|
if (xDic.is())
|
||||||
xDic->setActive( true );
|
xDic->setActive( true );
|
||||||
}
|
}
|
||||||
|
@ -417,10 +417,9 @@ void GrammarCheckingIterator::ProcessResult(
|
|||||||
text::TextMarkupDescriptor * pDescriptors = aDescriptors.getArray();
|
text::TextMarkupDescriptor * pDescriptors = aDescriptors.getArray();
|
||||||
|
|
||||||
// at pos 0 .. nErrors-1 -> all grammar errors
|
// at pos 0 .. nErrors-1 -> all grammar errors
|
||||||
for (sal_Int32 i = 0; i < nErrors; ++i)
|
for (const linguistic2::SingleProofreadingError &rError : rRes.aErrors)
|
||||||
{
|
{
|
||||||
const linguistic2::SingleProofreadingError &rError = rRes.aErrors[i];
|
text::TextMarkupDescriptor &rDesc = *pDescriptors++;
|
||||||
text::TextMarkupDescriptor &rDesc = aDescriptors[i];
|
|
||||||
|
|
||||||
rDesc.nType = rError.nErrorType;
|
rDesc.nType = rError.nErrorType;
|
||||||
rDesc.nOffset = rError.nErrorStart;
|
rDesc.nOffset = rError.nErrorStart;
|
||||||
@ -455,9 +454,9 @@ void GrammarCheckingIterator::ProcessResult(
|
|||||||
// at pos nErrors -> sentence markup
|
// at pos nErrors -> sentence markup
|
||||||
// nSentenceLength: includes the white-spaces following the sentence end...
|
// nSentenceLength: includes the white-spaces following the sentence end...
|
||||||
const sal_Int32 nSentenceLength = rRes.nStartOfNextSentencePosition - rRes.nStartOfSentencePosition;
|
const sal_Int32 nSentenceLength = rRes.nStartOfNextSentencePosition - rRes.nStartOfSentencePosition;
|
||||||
pDescriptors[ nErrors ].nType = text::TextMarkupType::SENTENCE;
|
pDescriptors->nType = text::TextMarkupType::SENTENCE;
|
||||||
pDescriptors[ nErrors ].nOffset = rRes.nStartOfSentencePosition;
|
pDescriptors->nOffset = rRes.nStartOfSentencePosition;
|
||||||
pDescriptors[ nErrors ].nLength = nSentenceLength;
|
pDescriptors->nLength = nSentenceLength;
|
||||||
|
|
||||||
xMulti->commitMultiTextMarkup( aDescriptors ) ;
|
xMulti->commitMultiTextMarkup( aDescriptors ) ;
|
||||||
}
|
}
|
||||||
@ -1081,20 +1080,18 @@ void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl()
|
|||||||
uno::Reference< container::XNameAccess > xNA( GetUpdateAccess(), uno::UNO_QUERY_THROW );
|
uno::Reference< container::XNameAccess > xNA( GetUpdateAccess(), uno::UNO_QUERY_THROW );
|
||||||
xNA.set( xNA->getByName( "GrammarCheckerList" ), uno::UNO_QUERY_THROW );
|
xNA.set( xNA->getByName( "GrammarCheckerList" ), uno::UNO_QUERY_THROW );
|
||||||
const uno::Sequence< OUString > aElementNames( xNA->getElementNames() );
|
const uno::Sequence< OUString > aElementNames( xNA->getElementNames() );
|
||||||
const OUString *pElementNames = aElementNames.getConstArray();
|
|
||||||
|
|
||||||
sal_Int32 nLen = aElementNames.getLength();
|
for (const OUString& rElementName : aElementNames)
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
uno::Sequence< OUString > aImplNames;
|
uno::Sequence< OUString > aImplNames;
|
||||||
uno::Any aTmp( xNA->getByName( pElementNames[i] ) );
|
uno::Any aTmp( xNA->getByName( rElementName ) );
|
||||||
if (aTmp >>= aImplNames)
|
if (aTmp >>= aImplNames)
|
||||||
{
|
{
|
||||||
if (aImplNames.hasElements())
|
if (aImplNames.hasElements())
|
||||||
{
|
{
|
||||||
// only the first entry is used, there should be only one grammar checker per language
|
// only the first entry is used, there should be only one grammar checker per language
|
||||||
const OUString aImplName( aImplNames[0] );
|
const OUString aImplName( aImplNames[0] );
|
||||||
const LanguageType nLang = LanguageTag::convertToLanguageType( pElementNames[i] );
|
const LanguageType nLang = LanguageTag::convertToLanguageType( rElementName );
|
||||||
aTmpGCImplNamesByLang[ nLang ] = aImplName;
|
aTmpGCImplNamesByLang[ nLang ] = aImplName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <tools/debug.hxx>
|
#include <tools/debug.hxx>
|
||||||
#include <svl/lngmisc.hxx>
|
#include <svl/lngmisc.hxx>
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
|
#include <comphelper/sequence.hxx>
|
||||||
#include <osl/mutex.hxx>
|
#include <osl/mutex.hxx>
|
||||||
|
|
||||||
#include "hyphdsp.hxx"
|
#include "hyphdsp.hxx"
|
||||||
@ -251,13 +252,13 @@ Sequence< Locale > SAL_CALL HyphenatorDispatcher::getLocales()
|
|||||||
{
|
{
|
||||||
MutexGuard aGuard( GetLinguMutex() );
|
MutexGuard aGuard( GetLinguMutex() );
|
||||||
|
|
||||||
Sequence< Locale > aLocales( static_cast< sal_Int32 >(aSvcMap.size()) );
|
std::vector<Locale> aLocales;
|
||||||
Locale *pLocales = aLocales.getArray();
|
aLocales.reserve(aSvcMap.size());
|
||||||
for (auto const& elem : aSvcMap)
|
|
||||||
{
|
std::transform(aSvcMap.begin(), aSvcMap.end(), std::back_inserter(aLocales),
|
||||||
*pLocales++ = LanguageTag::convertToLocale(elem.first);
|
[](HyphSvcByLangMap_t::const_reference elem) { return LanguageTag::convertToLocale(elem.first); });
|
||||||
}
|
|
||||||
return aLocales;
|
return comphelper::containerToSequence(aLocales);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -661,8 +662,7 @@ void HyphenatorDispatcher::SetServiceList( const Locale &rLocale,
|
|||||||
|
|
||||||
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
|
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
|
||||||
|
|
||||||
sal_Int32 nLen = rSvcImplNames.getLength();
|
if (!rSvcImplNames.hasElements())
|
||||||
if (0 == nLen)
|
|
||||||
// remove entry
|
// remove entry
|
||||||
aSvcMap.erase( nLanguage );
|
aSvcMap.erase( nLanguage );
|
||||||
else
|
else
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <tools/debug.hxx>
|
#include <tools/debug.hxx>
|
||||||
#include <unotools/lingucfg.hxx>
|
#include <unotools/lingucfg.hxx>
|
||||||
|
|
||||||
|
#include <comphelper/sequence.hxx>
|
||||||
#include <cppuhelper/factory.hxx>
|
#include <cppuhelper/factory.hxx>
|
||||||
#include <cppuhelper/supportsservice.hxx>
|
#include <cppuhelper/supportsservice.hxx>
|
||||||
#include <com/sun/star/container/XNameAccess.hpp>
|
#include <com/sun/star/container/XNameAccess.hpp>
|
||||||
@ -328,22 +329,16 @@ Sequence< PropertyValue > SAL_CALL
|
|||||||
{
|
{
|
||||||
MutexGuard aGuard( GetLinguMutex() );
|
MutexGuard aGuard( GetLinguMutex() );
|
||||||
|
|
||||||
sal_Int32 nLen = aPropertyMap.getSize();
|
|
||||||
Sequence< PropertyValue > aProps( nLen );
|
|
||||||
PropertyValue *pProp = aProps.getArray();
|
|
||||||
PropertyEntryVector_t aPropEntries = aPropertyMap.getPropertyEntries();
|
PropertyEntryVector_t aPropEntries = aPropertyMap.getPropertyEntries();
|
||||||
PropertyEntryVector_t::const_iterator aIt = aPropEntries.begin();
|
std::vector<PropertyValue> aProps;
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i, ++aIt)
|
aProps.reserve(aPropertyMap.getSize());
|
||||||
{
|
|
||||||
PropertyValue &rVal = pProp[i];
|
|
||||||
Any aAny( aConfig.GetProperty( aIt->nWID ) );
|
|
||||||
|
|
||||||
rVal.Name = aIt->sName;
|
std::transform(aPropEntries.begin(), aPropEntries.end(), std::back_inserter(aProps),
|
||||||
rVal.Handle = aIt->nWID;
|
[this](PropertyEntryVector_t::const_reference rPropEntry) {
|
||||||
rVal.Value = aAny;
|
return PropertyValue(rPropEntry.sName, rPropEntry.nWID,
|
||||||
rVal.State = PropertyState_DIRECT_VALUE ;
|
aConfig.GetProperty(rPropEntry.nWID),
|
||||||
}
|
css::beans::PropertyState_DIRECT_VALUE); });
|
||||||
return aProps;
|
return comphelper::containerToSequence(aProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL
|
void SAL_CALL
|
||||||
@ -351,11 +346,8 @@ void SAL_CALL
|
|||||||
{
|
{
|
||||||
MutexGuard aGuard( GetLinguMutex() );
|
MutexGuard aGuard( GetLinguMutex() );
|
||||||
|
|
||||||
sal_Int32 nLen = rProps.getLength();
|
for (const PropertyValue &rVal : rProps)
|
||||||
const PropertyValue *pVal = rProps.getConstArray();
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
const PropertyValue &rVal = pVal[i];
|
|
||||||
setPropertyValue( rVal.Name, rVal.Value );
|
setPropertyValue( rVal.Name, rVal.Value );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,21 +107,20 @@ void PropertyChgHelper::SetDefaultValues()
|
|||||||
|
|
||||||
void PropertyChgHelper::GetCurrentValues()
|
void PropertyChgHelper::GetCurrentValues()
|
||||||
{
|
{
|
||||||
sal_Int32 nLen = GetPropNames().getLength();
|
const auto& rPropNames = GetPropNames();
|
||||||
if (GetPropSet().is() && nLen)
|
if (GetPropSet().is() && rPropNames.hasElements())
|
||||||
{
|
{
|
||||||
const OUString *pPropName = GetPropNames().getConstArray();
|
for (const OUString& rPropName : rPropNames)
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
bool *pbVal = nullptr,
|
bool *pbVal = nullptr,
|
||||||
*pbResVal = nullptr;
|
*pbResVal = nullptr;
|
||||||
|
|
||||||
if ( pPropName[i] == UPN_IS_IGNORE_CONTROL_CHARACTERS )
|
if ( rPropName == UPN_IS_IGNORE_CONTROL_CHARACTERS )
|
||||||
{
|
{
|
||||||
pbVal = &bIsIgnoreControlCharacters;
|
pbVal = &bIsIgnoreControlCharacters;
|
||||||
pbResVal = &bResIsIgnoreControlCharacters;
|
pbResVal = &bResIsIgnoreControlCharacters;
|
||||||
}
|
}
|
||||||
else if ( pPropName[i] == UPN_IS_USE_DICTIONARY_LIST )
|
else if ( rPropName == UPN_IS_USE_DICTIONARY_LIST )
|
||||||
{
|
{
|
||||||
pbVal = &bIsUseDictionaryList;
|
pbVal = &bIsUseDictionaryList;
|
||||||
pbResVal = &bResIsUseDictionaryList;
|
pbResVal = &bResIsUseDictionaryList;
|
||||||
@ -129,7 +128,7 @@ void PropertyChgHelper::GetCurrentValues()
|
|||||||
|
|
||||||
if (pbVal && pbResVal)
|
if (pbVal && pbResVal)
|
||||||
{
|
{
|
||||||
GetPropSet()->getPropertyValue( pPropName[i] ) >>= *pbVal;
|
GetPropSet()->getPropertyValue( rPropName ) >>= *pbVal;
|
||||||
*pbResVal = *pbVal;
|
*pbResVal = *pbVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,14 +143,10 @@ void PropertyChgHelper::SetTmpPropVals( const PropertyValues &rPropVals )
|
|||||||
bResIsIgnoreControlCharacters = bIsIgnoreControlCharacters;
|
bResIsIgnoreControlCharacters = bIsIgnoreControlCharacters;
|
||||||
bResIsUseDictionaryList = bIsUseDictionaryList;
|
bResIsUseDictionaryList = bIsUseDictionaryList;
|
||||||
|
|
||||||
sal_Int32 nLen = rPropVals.getLength();
|
for (const PropertyValue& rVal : rPropVals)
|
||||||
if (nLen)
|
|
||||||
{
|
|
||||||
const PropertyValue *pVal = rPropVals.getConstArray();
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
bool *pbResVal = nullptr;
|
bool *pbResVal = nullptr;
|
||||||
switch (pVal[i].Handle)
|
switch (rVal.Handle)
|
||||||
{
|
{
|
||||||
case UPH_IS_IGNORE_CONTROL_CHARACTERS :
|
case UPH_IS_IGNORE_CONTROL_CHARACTERS :
|
||||||
pbResVal = &bResIsIgnoreControlCharacters; break;
|
pbResVal = &bResIsIgnoreControlCharacters; break;
|
||||||
@ -161,8 +156,7 @@ void PropertyChgHelper::SetTmpPropVals( const PropertyValues &rPropVals )
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
if (pbResVal)
|
if (pbResVal)
|
||||||
pVal[i].Value >>= *pbResVal;
|
rVal.Value >>= *pbResVal;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,12 +223,10 @@ void PropertyChgHelper::AddAsPropListener()
|
|||||||
{
|
{
|
||||||
if (xPropSet.is())
|
if (xPropSet.is())
|
||||||
{
|
{
|
||||||
sal_Int32 nLen = aPropNames.getLength();
|
for (const OUString& rPropName : std::as_const(aPropNames))
|
||||||
const OUString *pPropName = aPropNames.getConstArray();
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
if (!pPropName[i].isEmpty())
|
if (!rPropName.isEmpty())
|
||||||
xPropSet->addPropertyChangeListener( pPropName[i], this );
|
xPropSet->addPropertyChangeListener( rPropName, this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -243,12 +235,10 @@ void PropertyChgHelper::RemoveAsPropListener()
|
|||||||
{
|
{
|
||||||
if (xPropSet.is())
|
if (xPropSet.is())
|
||||||
{
|
{
|
||||||
sal_Int32 nLen = aPropNames.getLength();
|
for (const OUString& rPropName : std::as_const(aPropNames))
|
||||||
const OUString *pPropName = aPropNames.getConstArray();
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
if (!pPropName[i].isEmpty())
|
if (!rPropName.isEmpty())
|
||||||
xPropSet->removePropertyChangeListener( pPropName[i], this );
|
xPropSet->removePropertyChangeListener( rPropName, this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -367,26 +357,25 @@ void PropertyHelper_Spell::GetCurrentValues()
|
|||||||
{
|
{
|
||||||
PropertyChgHelper::GetCurrentValues();
|
PropertyChgHelper::GetCurrentValues();
|
||||||
|
|
||||||
sal_Int32 nLen = GetPropNames().getLength();
|
const auto& rPropNames = GetPropNames();
|
||||||
if (GetPropSet().is() && nLen)
|
if (GetPropSet().is() && rPropNames.hasElements())
|
||||||
{
|
{
|
||||||
const OUString *pPropName = GetPropNames().getConstArray();
|
for (const OUString& rPropName : rPropNames)
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
bool *pbVal = nullptr,
|
bool *pbVal = nullptr,
|
||||||
*pbResVal = nullptr;
|
*pbResVal = nullptr;
|
||||||
|
|
||||||
if ( pPropName[i] == UPN_IS_SPELL_UPPER_CASE )
|
if ( rPropName == UPN_IS_SPELL_UPPER_CASE )
|
||||||
{
|
{
|
||||||
pbVal = &bIsSpellUpperCase;
|
pbVal = &bIsSpellUpperCase;
|
||||||
pbResVal = &bResIsSpellUpperCase;
|
pbResVal = &bResIsSpellUpperCase;
|
||||||
}
|
}
|
||||||
else if ( pPropName[i] == UPN_IS_SPELL_WITH_DIGITS )
|
else if ( rPropName == UPN_IS_SPELL_WITH_DIGITS )
|
||||||
{
|
{
|
||||||
pbVal = &bIsSpellWithDigits;
|
pbVal = &bIsSpellWithDigits;
|
||||||
pbResVal = &bResIsSpellWithDigits;
|
pbResVal = &bResIsSpellWithDigits;
|
||||||
}
|
}
|
||||||
else if ( pPropName[i] == UPN_IS_SPELL_CAPITALIZATION )
|
else if ( rPropName == UPN_IS_SPELL_CAPITALIZATION )
|
||||||
{
|
{
|
||||||
pbVal = &bIsSpellCapitalization;
|
pbVal = &bIsSpellCapitalization;
|
||||||
pbResVal = &bResIsSpellCapitalization;
|
pbResVal = &bResIsSpellCapitalization;
|
||||||
@ -394,7 +383,7 @@ void PropertyHelper_Spell::GetCurrentValues()
|
|||||||
|
|
||||||
if (pbVal && pbResVal)
|
if (pbVal && pbResVal)
|
||||||
{
|
{
|
||||||
GetPropSet()->getPropertyValue( pPropName[i] ) >>= *pbVal;
|
GetPropSet()->getPropertyValue( rPropName ) >>= *pbVal;
|
||||||
*pbResVal = *pbVal;
|
*pbResVal = *pbVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -479,20 +468,16 @@ void PropertyHelper_Spell::SetTmpPropVals( const PropertyValues &rPropVals )
|
|||||||
bResIsSpellCapitalization = bIsSpellCapitalization;
|
bResIsSpellCapitalization = bIsSpellCapitalization;
|
||||||
bResIsSpellUpperCase = bIsSpellUpperCase;
|
bResIsSpellUpperCase = bIsSpellUpperCase;
|
||||||
|
|
||||||
sal_Int32 nLen = rPropVals.getLength();
|
for (const PropertyValue& rVal : rPropVals)
|
||||||
if (nLen)
|
|
||||||
{
|
{
|
||||||
const PropertyValue *pVal = rPropVals.getConstArray();
|
if ( rVal.Name == UPN_MAX_NUMBER_OF_SUGGESTIONS )
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
|
||||||
if ( pVal[i].Name == UPN_MAX_NUMBER_OF_SUGGESTIONS )
|
|
||||||
{
|
{
|
||||||
// special value that is not part of the property set and thus needs to be handled differently
|
// special value that is not part of the property set and thus needs to be handled differently
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool *pbResVal = nullptr;
|
bool *pbResVal = nullptr;
|
||||||
switch (pVal[i].Handle)
|
switch (rVal.Handle)
|
||||||
{
|
{
|
||||||
case UPH_IS_SPELL_UPPER_CASE : pbResVal = &bResIsSpellUpperCase; break;
|
case UPH_IS_SPELL_UPPER_CASE : pbResVal = &bResIsSpellUpperCase; break;
|
||||||
case UPH_IS_SPELL_WITH_DIGITS : pbResVal = &bResIsSpellWithDigits; break;
|
case UPH_IS_SPELL_WITH_DIGITS : pbResVal = &bResIsSpellWithDigits; break;
|
||||||
@ -501,8 +486,7 @@ void PropertyHelper_Spell::SetTmpPropVals( const PropertyValues &rPropVals )
|
|||||||
SAL_WARN( "linguistic", "unknown property" );
|
SAL_WARN( "linguistic", "unknown property" );
|
||||||
}
|
}
|
||||||
if (pbResVal)
|
if (pbResVal)
|
||||||
pVal[i].Value >>= *pbResVal;
|
rVal.Value >>= *pbResVal;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -545,26 +529,25 @@ void PropertyHelper_Hyphen::GetCurrentValues()
|
|||||||
{
|
{
|
||||||
PropertyChgHelper::GetCurrentValues();
|
PropertyChgHelper::GetCurrentValues();
|
||||||
|
|
||||||
sal_Int32 nLen = GetPropNames().getLength();
|
const auto& rPropNames = GetPropNames();
|
||||||
if (GetPropSet().is() && nLen)
|
if (GetPropSet().is() && rPropNames.hasElements())
|
||||||
{
|
{
|
||||||
const OUString *pPropName = GetPropNames().getConstArray();
|
for (const OUString& rPropName : rPropNames)
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
sal_Int16 *pnVal = nullptr,
|
sal_Int16 *pnVal = nullptr,
|
||||||
*pnResVal = nullptr;
|
*pnResVal = nullptr;
|
||||||
|
|
||||||
if ( pPropName[i] == UPN_HYPH_MIN_LEADING )
|
if ( rPropName == UPN_HYPH_MIN_LEADING )
|
||||||
{
|
{
|
||||||
pnVal = &nHyphMinLeading;
|
pnVal = &nHyphMinLeading;
|
||||||
pnResVal = &nResHyphMinLeading;
|
pnResVal = &nResHyphMinLeading;
|
||||||
}
|
}
|
||||||
else if ( pPropName[i] == UPN_HYPH_MIN_TRAILING )
|
else if ( rPropName == UPN_HYPH_MIN_TRAILING )
|
||||||
{
|
{
|
||||||
pnVal = &nHyphMinTrailing;
|
pnVal = &nHyphMinTrailing;
|
||||||
pnResVal = &nResHyphMinTrailing;
|
pnResVal = &nResHyphMinTrailing;
|
||||||
}
|
}
|
||||||
else if ( pPropName[i] == UPN_HYPH_MIN_WORD_LENGTH )
|
else if ( rPropName == UPN_HYPH_MIN_WORD_LENGTH )
|
||||||
{
|
{
|
||||||
pnVal = &nHyphMinWordLength;
|
pnVal = &nHyphMinWordLength;
|
||||||
pnResVal = &nResHyphMinWordLength;
|
pnResVal = &nResHyphMinWordLength;
|
||||||
@ -572,7 +555,7 @@ void PropertyHelper_Hyphen::GetCurrentValues()
|
|||||||
|
|
||||||
if (pnVal && pnResVal)
|
if (pnVal && pnResVal)
|
||||||
{
|
{
|
||||||
GetPropSet()->getPropertyValue( pPropName[i] ) >>= *pnVal;
|
GetPropSet()->getPropertyValue( rPropName ) >>= *pnVal;
|
||||||
*pnResVal = *pnVal;
|
*pnResVal = *pnVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -628,27 +611,21 @@ void PropertyHelper_Hyphen::SetTmpPropVals( const PropertyValues &rPropVals )
|
|||||||
nResHyphMinTrailing = nHyphMinTrailing;
|
nResHyphMinTrailing = nHyphMinTrailing;
|
||||||
nResHyphMinWordLength = nHyphMinWordLength;
|
nResHyphMinWordLength = nHyphMinWordLength;
|
||||||
|
|
||||||
sal_Int32 nLen = rPropVals.getLength();
|
for (const PropertyValue& rVal : rPropVals)
|
||||||
|
|
||||||
if (nLen)
|
|
||||||
{
|
|
||||||
const PropertyValue *pVal = rPropVals.getConstArray();
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
sal_Int16 *pnResVal = nullptr;
|
sal_Int16 *pnResVal = nullptr;
|
||||||
|
|
||||||
if ( pVal[i].Name == UPN_HYPH_MIN_LEADING )
|
if ( rVal.Name == UPN_HYPH_MIN_LEADING )
|
||||||
pnResVal = &nResHyphMinLeading;
|
pnResVal = &nResHyphMinLeading;
|
||||||
else if ( pVal[i].Name == UPN_HYPH_MIN_TRAILING )
|
else if ( rVal.Name == UPN_HYPH_MIN_TRAILING )
|
||||||
pnResVal = &nResHyphMinTrailing;
|
pnResVal = &nResHyphMinTrailing;
|
||||||
else if ( pVal[i].Name == UPN_HYPH_MIN_WORD_LENGTH )
|
else if ( rVal.Name == UPN_HYPH_MIN_WORD_LENGTH )
|
||||||
pnResVal = &nResHyphMinWordLength;
|
pnResVal = &nResHyphMinWordLength;
|
||||||
|
|
||||||
DBG_ASSERT( pnResVal, "unknown property" );
|
DBG_ASSERT( pnResVal, "unknown property" );
|
||||||
|
|
||||||
if (pnResVal)
|
if (pnResVal)
|
||||||
pVal[i].Value >>= *pnResVal;
|
rVal.Value >>= *pnResVal;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include <unotools/lingucfg.hxx>
|
#include <unotools/lingucfg.hxx>
|
||||||
#include <vcl/svapp.hxx>
|
#include <vcl/svapp.hxx>
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
|
#include <comphelper/sequence.hxx>
|
||||||
#include <i18nlangtag/lang.h>
|
#include <i18nlangtag/lang.h>
|
||||||
#include <i18nlangtag/languagetag.hxx>
|
#include <i18nlangtag/languagetag.hxx>
|
||||||
#include <cppuhelper/factory.hxx>
|
#include <cppuhelper/factory.hxx>
|
||||||
@ -60,19 +61,8 @@ uno::Sequence< OUString > static GetLangSvc( const uno::Any &rVal );
|
|||||||
|
|
||||||
static bool lcl_SeqHasString( const uno::Sequence< OUString > &rSeq, const OUString &rText )
|
static bool lcl_SeqHasString( const uno::Sequence< OUString > &rSeq, const OUString &rText )
|
||||||
{
|
{
|
||||||
bool bRes = false;
|
return !rText.isEmpty()
|
||||||
|
&& comphelper::findValue(rSeq, rText) != -1;
|
||||||
sal_Int32 nLen = rSeq.getLength();
|
|
||||||
if (nLen == 0 || rText.isEmpty())
|
|
||||||
return bRes;
|
|
||||||
|
|
||||||
const OUString *pSeq = rSeq.getConstArray();
|
|
||||||
for (sal_Int32 i = 0; i < nLen && !bRes; ++i)
|
|
||||||
{
|
|
||||||
if (rText == pSeq[i])
|
|
||||||
bRes = true;
|
|
||||||
}
|
|
||||||
return bRes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -82,8 +72,7 @@ static uno::Sequence< lang::Locale > GetAvailLocales(
|
|||||||
uno::Sequence< lang::Locale > aRes;
|
uno::Sequence< lang::Locale > aRes;
|
||||||
|
|
||||||
uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
|
uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
|
||||||
sal_Int32 nNames = rSvcImplNames.getLength();
|
if( rSvcImplNames.hasElements() )
|
||||||
if( nNames )
|
|
||||||
{
|
{
|
||||||
std::set< LanguageType > aLanguages;
|
std::set< LanguageType > aLanguages;
|
||||||
|
|
||||||
@ -94,16 +83,14 @@ static uno::Sequence< lang::Locale > GetAvailLocales(
|
|||||||
|
|
||||||
// check all services for the supported languages and new
|
// check all services for the supported languages and new
|
||||||
// languages to the result
|
// languages to the result
|
||||||
const OUString *pImplNames = rSvcImplNames.getConstArray();
|
|
||||||
sal_Int32 i;
|
|
||||||
|
|
||||||
for (i = 0; i < nNames; ++i)
|
for (const OUString& rImplName : rSvcImplNames)
|
||||||
{
|
{
|
||||||
uno::Reference< linguistic2::XSupportedLocales > xSuppLoc;
|
uno::Reference< linguistic2::XSupportedLocales > xSuppLoc;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
xSuppLoc.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
|
xSuppLoc.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
|
||||||
pImplNames[i], aArgs, xContext ),
|
rImplName, aArgs, xContext ),
|
||||||
uno::UNO_QUERY );
|
uno::UNO_QUERY );
|
||||||
}
|
}
|
||||||
catch (uno::Exception &)
|
catch (uno::Exception &)
|
||||||
@ -113,12 +100,10 @@ static uno::Sequence< lang::Locale > GetAvailLocales(
|
|||||||
|
|
||||||
if (xSuppLoc.is())
|
if (xSuppLoc.is())
|
||||||
{
|
{
|
||||||
uno::Sequence< lang::Locale > aLoc( xSuppLoc->getLocales() );
|
const uno::Sequence< lang::Locale > aLoc( xSuppLoc->getLocales() );
|
||||||
sal_Int32 nLoc = aLoc.getLength();
|
for (const lang::Locale& rLoc : aLoc)
|
||||||
for (sal_Int32 k = 0; k < nLoc; ++k)
|
|
||||||
{
|
{
|
||||||
const lang::Locale *pLoc = aLoc.getConstArray();
|
LanguageType nLang = LinguLocaleToLanguage( rLoc );
|
||||||
LanguageType nLang = LinguLocaleToLanguage( pLoc[k] );
|
|
||||||
|
|
||||||
// It's a set, so insertion fails if language was already added.
|
// It's a set, so insertion fails if language was already added.
|
||||||
aLanguages.insert( nLang );
|
aLanguages.insert( nLang );
|
||||||
@ -131,14 +116,13 @@ static uno::Sequence< lang::Locale > GetAvailLocales(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// build return sequence
|
// build return sequence
|
||||||
sal_Int32 nLanguages = static_cast< sal_Int32 >(aLanguages.size());
|
std::vector<lang::Locale> aVec;
|
||||||
aRes.realloc( nLanguages );
|
aVec.reserve(aLanguages.size());
|
||||||
lang::Locale *pRes = aRes.getArray();
|
|
||||||
i=0;
|
std::transform(aLanguages.begin(), aLanguages.end(), std::back_inserter(aVec),
|
||||||
for (auto const& language : aLanguages)
|
[](const LanguageType& rLang) -> lang::Locale { return LanguageTag::convertToLocale(rLang); });
|
||||||
{
|
|
||||||
pRes[i++] = LanguageTag::convertToLocale(language);
|
aRes = comphelper::containerToSequence(aVec);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return aRes;
|
return aRes;
|
||||||
@ -420,12 +404,12 @@ LngSvcMgr::LngSvcMgr()
|
|||||||
bDisposing = false;
|
bDisposing = false;
|
||||||
|
|
||||||
// request notify events when properties (i.e. something in the subtree) changes
|
// request notify events when properties (i.e. something in the subtree) changes
|
||||||
uno::Sequence< OUString > aNames(4);
|
uno::Sequence< OUString > aNames{
|
||||||
OUString *pNames = aNames.getArray();
|
"ServiceManager/SpellCheckerList",
|
||||||
pNames[0] = "ServiceManager/SpellCheckerList";
|
"ServiceManager/GrammarCheckerList",
|
||||||
pNames[1] = "ServiceManager/GrammarCheckerList";
|
"ServiceManager/HyphenatorList",
|
||||||
pNames[2] = "ServiceManager/HyphenatorList";
|
"ServiceManager/ThesaurusList"
|
||||||
pNames[3] = "ServiceManager/ThesaurusList";
|
};
|
||||||
EnableNotification( aNames );
|
EnableNotification( aNames );
|
||||||
|
|
||||||
UpdateAll();
|
UpdateAll();
|
||||||
@ -540,15 +524,12 @@ namespace
|
|||||||
|
|
||||||
bool lcl_FindEntry( const OUString &rEntry, const Sequence< OUString > &rCfgSvcs )
|
bool lcl_FindEntry( const OUString &rEntry, const Sequence< OUString > &rCfgSvcs )
|
||||||
{
|
{
|
||||||
sal_Int32 nRes = -1;
|
return comphelper::findValue(rCfgSvcs, rEntry) != -1;
|
||||||
sal_Int32 nEntries = rCfgSvcs.getLength();
|
|
||||||
const OUString *pEntry = rCfgSvcs.getConstArray();
|
|
||||||
for (sal_Int32 i = 0; i < nEntries && nRes == -1; ++i)
|
|
||||||
{
|
|
||||||
if (rEntry == pEntry[i])
|
|
||||||
nRes = i;
|
|
||||||
}
|
}
|
||||||
return nRes != -1;
|
|
||||||
|
bool lcl_FindEntry( const OUString &rEntry, const std::vector< OUString > &rCfgSvcs )
|
||||||
|
{
|
||||||
|
return std::find(rCfgSvcs.begin(), rCfgSvcs.end(), rEntry) != rCfgSvcs.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence< OUString > lcl_GetLastFoundSvcs(
|
Sequence< OUString > lcl_GetLastFoundSvcs(
|
||||||
@ -585,65 +566,47 @@ namespace
|
|||||||
const Sequence< OUString > &rCfgSvcs,
|
const Sequence< OUString > &rCfgSvcs,
|
||||||
const Sequence< OUString > &rAvailSvcs )
|
const Sequence< OUString > &rAvailSvcs )
|
||||||
{
|
{
|
||||||
Sequence< OUString > aRes( rCfgSvcs.getLength() );
|
std::vector<OUString> aRes;
|
||||||
OUString *pRes = aRes.getArray();
|
aRes.reserve(rCfgSvcs.getLength());
|
||||||
sal_Int32 nCnt = 0;
|
|
||||||
|
|
||||||
for (OUString const & entry : rCfgSvcs)
|
std::copy_if(rCfgSvcs.begin(), rCfgSvcs.end(), std::back_inserter(aRes),
|
||||||
{
|
[&rAvailSvcs](const OUString& entry) { return lcl_SeqHasString(rAvailSvcs, entry); });
|
||||||
if (!entry.isEmpty() && lcl_FindEntry( entry, rAvailSvcs ))
|
|
||||||
pRes[ nCnt++ ] = entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
aRes.realloc( nCnt );
|
return comphelper::containerToSequence(aRes);
|
||||||
return aRes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence< OUString > lcl_GetNewEntries(
|
Sequence< OUString > lcl_GetNewEntries(
|
||||||
const Sequence< OUString > &rLastFoundSvcs,
|
const Sequence< OUString > &rLastFoundSvcs,
|
||||||
const Sequence< OUString > &rAvailSvcs )
|
const Sequence< OUString > &rAvailSvcs )
|
||||||
{
|
{
|
||||||
sal_Int32 nLen = rAvailSvcs.getLength();
|
std::vector<OUString> aRes;
|
||||||
Sequence< OUString > aRes( nLen );
|
aRes.reserve(rAvailSvcs.getLength());
|
||||||
OUString *pRes = aRes.getArray();
|
|
||||||
sal_Int32 nCnt = 0;
|
|
||||||
|
|
||||||
const OUString *pEntry = rAvailSvcs.getConstArray();
|
std::copy_if(rAvailSvcs.begin(), rAvailSvcs.end(), std::back_inserter(aRes),
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
[&rLastFoundSvcs](const OUString& rEntry) {
|
||||||
{
|
return !rEntry.isEmpty() && !lcl_FindEntry( rEntry, rLastFoundSvcs ); });
|
||||||
if (!pEntry[i].isEmpty() && !lcl_FindEntry( pEntry[i], rLastFoundSvcs ))
|
|
||||||
pRes[ nCnt++ ] = pEntry[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
aRes.realloc( nCnt );
|
return comphelper::containerToSequence(aRes);
|
||||||
return aRes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence< OUString > lcl_MergeSeq(
|
Sequence< OUString > lcl_MergeSeq(
|
||||||
const Sequence< OUString > &rCfgSvcs,
|
const Sequence< OUString > &rCfgSvcs,
|
||||||
const Sequence< OUString > &rNewSvcs )
|
const Sequence< OUString > &rNewSvcs )
|
||||||
{
|
{
|
||||||
Sequence< OUString > aRes( rCfgSvcs.getLength() + rNewSvcs.getLength() );
|
std::vector<OUString> aRes;
|
||||||
OUString *pRes = aRes.getArray();
|
aRes.reserve(rCfgSvcs.getLength() + rNewSvcs.getLength());
|
||||||
sal_Int32 nCnt = 0;
|
|
||||||
|
auto lVecNotHasString = [&aRes](const OUString& rEntry)
|
||||||
|
{ return !rEntry.isEmpty() && !lcl_FindEntry(rEntry, aRes); };
|
||||||
|
|
||||||
for (sal_Int32 k = 0; k < 2; ++k)
|
|
||||||
{
|
|
||||||
// add previously configured service first and append
|
// add previously configured service first and append
|
||||||
// new found services at the end
|
// new found services at the end
|
||||||
const Sequence< OUString > &rSeq = k == 0 ? rCfgSvcs : rNewSvcs;
|
for (const Sequence< OUString > &rSeq : { rCfgSvcs, rNewSvcs })
|
||||||
|
|
||||||
sal_Int32 nLen = rSeq.getLength();
|
|
||||||
const OUString *pEntry = rSeq.getConstArray();
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
if (!pEntry[i].isEmpty() && !lcl_FindEntry( pEntry[i], aRes ))
|
std::copy_if(rSeq.begin(), rSeq.end(), std::back_inserter(aRes), lVecNotHasString);
|
||||||
pRes[ nCnt++ ] = pEntry[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aRes.realloc( nCnt );
|
return comphelper::containerToSequence(aRes);
|
||||||
return aRes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -672,23 +635,20 @@ void LngSvcMgr::UpdateAll()
|
|||||||
OUString aService( OUString::createFromAscii( apServices[k] ) );
|
OUString aService( OUString::createFromAscii( apServices[k] ) );
|
||||||
OUString aActiveList( OUString::createFromAscii( apCurLists[k] ) );
|
OUString aActiveList( OUString::createFromAscii( apCurLists[k] ) );
|
||||||
OUString aLastFoundList( OUString::createFromAscii( apLastFoundLists[k] ) );
|
OUString aLastFoundList( OUString::createFromAscii( apLastFoundLists[k] ) );
|
||||||
sal_Int32 i;
|
|
||||||
|
|
||||||
|
|
||||||
// remove configured but not available language/services entries
|
// remove configured but not available language/services entries
|
||||||
|
|
||||||
Sequence< OUString > aNodeNames( aCfg.GetNodeNames( aActiveList ) ); // list of configured locales
|
const Sequence< OUString > aNodeNames( aCfg.GetNodeNames( aActiveList ) ); // list of configured locales
|
||||||
sal_Int32 nNodeNames = aNodeNames.getLength();
|
for (const OUString& rNodeName : aNodeNames)
|
||||||
const OUString *pNodeName = aNodeNames.getConstArray();
|
|
||||||
for (i = 0; i < nNodeNames; ++i)
|
|
||||||
{
|
{
|
||||||
Locale aLocale( LanguageTag::convertToLocale( pNodeName[i]));
|
Locale aLocale( LanguageTag::convertToLocale( rNodeName));
|
||||||
Sequence< OUString > aCfgSvcs( getConfiguredServices( aService, aLocale ));
|
Sequence< OUString > aCfgSvcs( getConfiguredServices( aService, aLocale ));
|
||||||
Sequence< OUString > aAvailSvcs( getAvailableServices( aService, aLocale ));
|
Sequence< OUString > aAvailSvcs( getAvailableServices( aService, aLocale ));
|
||||||
|
|
||||||
aCfgSvcs = lcl_RemoveMissingEntries( aCfgSvcs, aAvailSvcs );
|
aCfgSvcs = lcl_RemoveMissingEntries( aCfgSvcs, aAvailSvcs );
|
||||||
|
|
||||||
aCurSvcs[k][ pNodeName[i] ] = aCfgSvcs;
|
aCurSvcs[k][ rNodeName ] = aCfgSvcs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -696,14 +656,12 @@ void LngSvcMgr::UpdateAll()
|
|||||||
// and
|
// and
|
||||||
// set last found services to currently available ones
|
// set last found services to currently available ones
|
||||||
|
|
||||||
Sequence< Locale > aAvailLocales( getAvailableLocales(aService) );
|
const Sequence< Locale > aAvailLocales( getAvailableLocales(aService) );
|
||||||
sal_Int32 nAvailLocales = aAvailLocales.getLength();
|
for (const Locale& rAvailLocale : aAvailLocales)
|
||||||
const Locale *pAvailLocale = aAvailLocales.getConstArray();
|
|
||||||
for (i = 0; i < nAvailLocales; ++i)
|
|
||||||
{
|
{
|
||||||
OUString aCfgLocaleStr( LanguageTag::convertToBcp47( pAvailLocale[i]));
|
OUString aCfgLocaleStr( LanguageTag::convertToBcp47( rAvailLocale));
|
||||||
|
|
||||||
Sequence< OUString > aAvailSvcs( getAvailableServices( aService, pAvailLocale[i] ));
|
Sequence< OUString > aAvailSvcs( getAvailableServices( aService, rAvailLocale ));
|
||||||
|
|
||||||
aLastFoundSvcs[k][ aCfgLocaleStr ] = aAvailSvcs;
|
aLastFoundSvcs[k][ aCfgLocaleStr ] = aAvailSvcs;
|
||||||
|
|
||||||
@ -741,7 +699,7 @@ void LngSvcMgr::UpdateAll()
|
|||||||
pNewValue->Value <<= elem.second;
|
pNewValue->Value <<= elem.second;
|
||||||
++pNewValue;
|
++pNewValue;
|
||||||
}
|
}
|
||||||
OSL_ENSURE( pNewValue - aNewValues.getArray() == nVals,
|
OSL_ENSURE( pNewValue - aNewValues.getConstArray() == nVals,
|
||||||
"possible mismatch of sequence size and property number" );
|
"possible mismatch of sequence size and property number" );
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -773,14 +731,11 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
|
|||||||
uno::Sequence< OUString > aNames( 1 );
|
uno::Sequence< OUString > aNames( 1 );
|
||||||
OUString *pNames = aNames.getArray();
|
OUString *pNames = aNames.getArray();
|
||||||
|
|
||||||
sal_Int32 nLen = rPropertyNames.getLength();
|
for (const OUString& rName : rPropertyNames)
|
||||||
const OUString *pPropertyNames = rPropertyNames.getConstArray();
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
// property names look like
|
// property names look like
|
||||||
// "ServiceManager/ThesaurusList/de-CH"
|
// "ServiceManager/ThesaurusList/de-CH"
|
||||||
|
|
||||||
const OUString &rName = pPropertyNames[i];
|
|
||||||
sal_Int32 nKeyStart;
|
sal_Int32 nKeyStart;
|
||||||
nKeyStart = rName.lastIndexOf( '/' );
|
nKeyStart = rName.lastIndexOf( '/' );
|
||||||
OUString aKeyText;
|
OUString aKeyText;
|
||||||
@ -1201,8 +1156,6 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp )
|
|||||||
|
|
||||||
OUString aNode("ServiceManager/SpellCheckerList");
|
OUString aNode("ServiceManager/SpellCheckerList");
|
||||||
uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
|
uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
|
||||||
OUString *pNames = aNames.getArray();
|
|
||||||
sal_Int32 nLen = aNames.getLength();
|
|
||||||
|
|
||||||
// append path prefix need for 'GetProperties' call below
|
// append path prefix need for 'GetProperties' call below
|
||||||
OUString aPrefix = aNode + "/";
|
OUString aPrefix = aNode + "/";
|
||||||
@ -1211,16 +1164,16 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp )
|
|||||||
name = aPrefix + name;
|
name = aPrefix + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
|
const uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
|
||||||
if (nLen && nLen == aValues.getLength())
|
if (aNames.hasElements() && aNames.getLength() == aValues.getLength())
|
||||||
{
|
{
|
||||||
const uno::Any *pValues = aValues.getConstArray();
|
const OUString *pNames = aNames.getConstArray();
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
for (const uno::Any& rValue : aValues)
|
||||||
{
|
{
|
||||||
uno::Sequence< OUString > aSvcImplNames;
|
uno::Sequence< OUString > aSvcImplNames;
|
||||||
if (pValues[i] >>= aSvcImplNames)
|
if (rValue >>= aSvcImplNames)
|
||||||
{
|
{
|
||||||
OUString aLocaleStr( pNames[i] );
|
OUString aLocaleStr( *pNames++ );
|
||||||
sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
|
sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
|
||||||
aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
|
aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
|
||||||
rSpellDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
|
rSpellDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
|
||||||
@ -1236,8 +1189,6 @@ void LngSvcMgr::SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp )
|
|||||||
|
|
||||||
OUString aNode("ServiceManager/GrammarCheckerList");
|
OUString aNode("ServiceManager/GrammarCheckerList");
|
||||||
uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
|
uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
|
||||||
OUString *pNames = aNames.getArray();
|
|
||||||
sal_Int32 nLen = aNames.getLength();
|
|
||||||
|
|
||||||
// append path prefix need for 'GetProperties' call below
|
// append path prefix need for 'GetProperties' call below
|
||||||
OUString aPrefix = aNode + "/";
|
OUString aPrefix = aNode + "/";
|
||||||
@ -1246,20 +1197,20 @@ void LngSvcMgr::SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp )
|
|||||||
name = aPrefix + name;
|
name = aPrefix + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
|
const uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
|
||||||
if (nLen && nLen == aValues.getLength())
|
if (aNames.hasElements() && aNames.getLength() == aValues.getLength())
|
||||||
{
|
{
|
||||||
const uno::Any *pValues = aValues.getConstArray();
|
const OUString *pNames = aNames.getConstArray();
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
for (const uno::Any& rValue : aValues)
|
||||||
{
|
{
|
||||||
uno::Sequence< OUString > aSvcImplNames;
|
uno::Sequence< OUString > aSvcImplNames;
|
||||||
if (pValues[i] >>= aSvcImplNames)
|
if (rValue >>= aSvcImplNames)
|
||||||
{
|
{
|
||||||
// there should only be one grammar checker in use per language...
|
// there should only be one grammar checker in use per language...
|
||||||
if (aSvcImplNames.getLength() > 1)
|
if (aSvcImplNames.getLength() > 1)
|
||||||
aSvcImplNames.realloc(1);
|
aSvcImplNames.realloc(1);
|
||||||
|
|
||||||
OUString aLocaleStr( pNames[i] );
|
OUString aLocaleStr( *pNames++ );
|
||||||
sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
|
sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
|
||||||
aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
|
aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
|
||||||
rGrammarDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
|
rGrammarDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
|
||||||
@ -1275,8 +1226,6 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp )
|
|||||||
|
|
||||||
OUString aNode("ServiceManager/HyphenatorList");
|
OUString aNode("ServiceManager/HyphenatorList");
|
||||||
uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
|
uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
|
||||||
OUString *pNames = aNames.getArray();
|
|
||||||
sal_Int32 nLen = aNames.getLength();
|
|
||||||
|
|
||||||
// append path prefix need for 'GetProperties' call below
|
// append path prefix need for 'GetProperties' call below
|
||||||
OUString aPrefix = aNode + "/";
|
OUString aPrefix = aNode + "/";
|
||||||
@ -1285,20 +1234,20 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp )
|
|||||||
name = aPrefix + name;
|
name = aPrefix + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
|
const uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
|
||||||
if (nLen && nLen == aValues.getLength())
|
if (aNames.hasElements() && aNames.getLength() == aValues.getLength())
|
||||||
{
|
{
|
||||||
const uno::Any *pValues = aValues.getConstArray();
|
const OUString *pNames = aNames.getConstArray();
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
for (const uno::Any& rValue : aValues)
|
||||||
{
|
{
|
||||||
uno::Sequence< OUString > aSvcImplNames;
|
uno::Sequence< OUString > aSvcImplNames;
|
||||||
if (pValues[i] >>= aSvcImplNames)
|
if (rValue >>= aSvcImplNames)
|
||||||
{
|
{
|
||||||
// there should only be one hyphenator in use per language...
|
// there should only be one hyphenator in use per language...
|
||||||
if (aSvcImplNames.getLength() > 1)
|
if (aSvcImplNames.getLength() > 1)
|
||||||
aSvcImplNames.realloc(1);
|
aSvcImplNames.realloc(1);
|
||||||
|
|
||||||
OUString aLocaleStr( pNames[i] );
|
OUString aLocaleStr( *pNames++ );
|
||||||
sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
|
sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
|
||||||
aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
|
aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
|
||||||
rHyphDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
|
rHyphDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
|
||||||
@ -1314,8 +1263,6 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp )
|
|||||||
|
|
||||||
OUString aNode("ServiceManager/ThesaurusList");
|
OUString aNode("ServiceManager/ThesaurusList");
|
||||||
uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
|
uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
|
||||||
OUString *pNames = aNames.getArray();
|
|
||||||
sal_Int32 nLen = aNames.getLength();
|
|
||||||
|
|
||||||
// append path prefix need for 'GetProperties' call below
|
// append path prefix need for 'GetProperties' call below
|
||||||
OUString aPrefix = aNode + "/";
|
OUString aPrefix = aNode + "/";
|
||||||
@ -1324,16 +1271,16 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp )
|
|||||||
name = aPrefix + name;
|
name = aPrefix + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
|
const uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
|
||||||
if (nLen && nLen == aValues.getLength())
|
if (aNames.hasElements() && aNames.getLength() == aValues.getLength())
|
||||||
{
|
{
|
||||||
const uno::Any *pValues = aValues.getConstArray();
|
const OUString *pNames = aNames.getConstArray();
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
for (const uno::Any& rValue : aValues)
|
||||||
{
|
{
|
||||||
uno::Sequence< OUString > aSvcImplNames;
|
uno::Sequence< OUString > aSvcImplNames;
|
||||||
if (pValues[i] >>= aSvcImplNames)
|
if (rValue >>= aSvcImplNames)
|
||||||
{
|
{
|
||||||
OUString aLocaleStr( pNames[i] );
|
OUString aLocaleStr( *pNames++ );
|
||||||
sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
|
sal_Int32 nSeparatorPos = aLocaleStr.lastIndexOf( '/' );
|
||||||
aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
|
aLocaleStr = aLocaleStr.copy( nSeparatorPos + 1 );
|
||||||
rThesDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
|
rThesDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames );
|
||||||
@ -1464,26 +1411,20 @@ uno::Sequence< OUString > SAL_CALL
|
|||||||
|
|
||||||
if (pInfoArray)
|
if (pInfoArray)
|
||||||
{
|
{
|
||||||
// resize to max number of entries
|
std::vector<OUString> aVec;
|
||||||
size_t nMaxCnt = pInfoArray->size();
|
aVec.reserve(pInfoArray->size());
|
||||||
aRes.realloc( nMaxCnt );
|
|
||||||
OUString *pImplName = aRes.getArray();
|
|
||||||
|
|
||||||
sal_uInt16 nCnt = 0;
|
|
||||||
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
|
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
|
||||||
for (size_t i = 0; i < nMaxCnt; ++i)
|
for (const auto& pInfo : *pInfoArray)
|
||||||
{
|
{
|
||||||
const SvcInfo &rInfo = *(*pInfoArray)[i].get();
|
|
||||||
if (LinguIsUnspecified( nLanguage )
|
if (LinguIsUnspecified( nLanguage )
|
||||||
|| rInfo.HasLanguage( nLanguage ))
|
|| pInfo->HasLanguage( nLanguage ))
|
||||||
{
|
{
|
||||||
pImplName[ nCnt++ ] = rInfo.aSvcImplName;
|
aVec.push_back(pInfo->aSvcImplName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// resize to actual number of entries
|
aRes = comphelper::containerToSequence(aVec);
|
||||||
if (nCnt != nMaxCnt)
|
|
||||||
aRes.realloc( nCnt );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return aRes;
|
return aRes;
|
||||||
@ -1523,22 +1464,9 @@ uno::Sequence< lang::Locale > SAL_CALL
|
|||||||
static bool IsEqSvcList( const uno::Sequence< OUString > &rList1,
|
static bool IsEqSvcList( const uno::Sequence< OUString > &rList1,
|
||||||
const uno::Sequence< OUString > &rList2 )
|
const uno::Sequence< OUString > &rList2 )
|
||||||
{
|
{
|
||||||
// returns true iff both sequences are equal
|
// returns true if both sequences are equal
|
||||||
|
return rList1.getLength() == rList2.getLength()
|
||||||
bool bRes = false;
|
&& std::equal(rList1.begin(), rList1.end(), rList2.begin(), rList2.end());
|
||||||
sal_Int32 nLen = rList1.getLength();
|
|
||||||
if (rList2.getLength() == nLen)
|
|
||||||
{
|
|
||||||
const OUString *pStr1 = rList1.getConstArray();
|
|
||||||
const OUString *pStr2 = rList2.getConstArray();
|
|
||||||
bRes = true;
|
|
||||||
for (sal_Int32 i = 0; i < nLen && bRes; ++i)
|
|
||||||
{
|
|
||||||
if (*pStr1++ != *pStr2++)
|
|
||||||
bRes = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bRes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1660,12 +1588,8 @@ bool LngSvcMgr::SaveCfgSvcs( const OUString &rServiceName )
|
|||||||
|
|
||||||
if (pDsp && aLocales.hasElements())
|
if (pDsp && aLocales.hasElements())
|
||||||
{
|
{
|
||||||
sal_Int32 nLen = aLocales.getLength();
|
uno::Sequence< beans::PropertyValue > aValues( aLocales.getLength() );
|
||||||
const lang::Locale *pLocale = aLocales.getConstArray();
|
beans::PropertyValue *pValue = aValues.getArray();
|
||||||
|
|
||||||
uno::Sequence< beans::PropertyValue > aValues( nLen );
|
|
||||||
beans::PropertyValue *pValues = aValues.getArray();
|
|
||||||
beans::PropertyValue *pValue = pValues;
|
|
||||||
|
|
||||||
// get node name to be used
|
// get node name to be used
|
||||||
const char *pNodeName = nullptr;
|
const char *pNodeName = nullptr;
|
||||||
@ -1683,9 +1607,9 @@ bool LngSvcMgr::SaveCfgSvcs( const OUString &rServiceName )
|
|||||||
}
|
}
|
||||||
OUString aNodeName( OUString::createFromAscii(pNodeName) );
|
OUString aNodeName( OUString::createFromAscii(pNodeName) );
|
||||||
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
for (const lang::Locale& rLocale : std::as_const(aLocales))
|
||||||
{
|
{
|
||||||
uno::Sequence< OUString > aSvcImplNames = pDsp->GetServiceList( pLocale[i] );
|
uno::Sequence< OUString > aSvcImplNames = pDsp->GetServiceList( rLocale );
|
||||||
|
|
||||||
// build value to be written back to configuration
|
// build value to be written back to configuration
|
||||||
uno::Any aCfgAny;
|
uno::Any aCfgAny;
|
||||||
@ -1694,7 +1618,7 @@ bool LngSvcMgr::SaveCfgSvcs( const OUString &rServiceName )
|
|||||||
aCfgAny <<= aSvcImplNames;
|
aCfgAny <<= aSvcImplNames;
|
||||||
DBG_ASSERT( aCfgAny.hasValue(), "missing value for 'Any' type" );
|
DBG_ASSERT( aCfgAny.hasValue(), "missing value for 'Any' type" );
|
||||||
|
|
||||||
OUString aCfgLocaleStr( LanguageTag::convertToBcp47( pLocale[i]));
|
OUString aCfgLocaleStr( LanguageTag::convertToBcp47( rLocale));
|
||||||
pValue->Value = aCfgAny;
|
pValue->Value = aCfgAny;
|
||||||
pValue->Name = aNodeName + "/" + aCfgLocaleStr;
|
pValue->Name = aNodeName + "/" + aCfgLocaleStr;
|
||||||
pValue++;
|
pValue++;
|
||||||
@ -1718,14 +1642,9 @@ static uno::Sequence< OUString > GetLangSvcList( const uno::Any &rVal )
|
|||||||
{
|
{
|
||||||
rVal >>= aRes;
|
rVal >>= aRes;
|
||||||
#if OSL_DEBUG_LEVEL > 0
|
#if OSL_DEBUG_LEVEL > 0
|
||||||
sal_Int32 nSvcs = aRes.getLength();
|
for (const OUString& rSvcName : std::as_const(aRes))
|
||||||
if (nSvcs)
|
|
||||||
{
|
{
|
||||||
const OUString *pSvcName = aRes.getConstArray();
|
SAL_WARN_IF( rSvcName.isEmpty(), "linguistic", "service impl-name missing" );
|
||||||
for (sal_Int32 j = 0; j < nSvcs; ++j)
|
|
||||||
{
|
|
||||||
SAL_WARN_IF( pSvcName[j].isEmpty(), "linguistic", "service impl-name missing" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include <com/sun/star/uno/Sequence.hxx>
|
#include <com/sun/star/uno/Sequence.hxx>
|
||||||
#include <com/sun/star/uno/Reference.h>
|
#include <com/sun/star/uno/Reference.h>
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
|
#include <comphelper/sequence.hxx>
|
||||||
#include <unotools/charclass.hxx>
|
#include <unotools/charclass.hxx>
|
||||||
#include <unotools/linguprops.hxx>
|
#include <unotools/linguprops.hxx>
|
||||||
#include <unotools/localedatawrapper.hxx>
|
#include <unotools/localedatawrapper.hxx>
|
||||||
@ -197,19 +198,14 @@ bool IsUseDicList( const PropertyValues &rProperties,
|
|||||||
{
|
{
|
||||||
bool bRes = true;
|
bool bRes = true;
|
||||||
|
|
||||||
sal_Int32 nLen = rProperties.getLength();
|
const PropertyValue *pVal = std::find_if(rProperties.begin(), rProperties.end(),
|
||||||
const PropertyValue *pVal = rProperties.getConstArray();
|
[](const PropertyValue& rVal) { return UPH_IS_USE_DICTIONARY_LIST == rVal.Handle; });
|
||||||
sal_Int32 i;
|
|
||||||
|
|
||||||
for ( i = 0; i < nLen; ++i)
|
if (pVal != rProperties.end())
|
||||||
{
|
{
|
||||||
if (UPH_IS_USE_DICTIONARY_LIST == pVal[i].Handle)
|
pVal->Value >>= bRes;
|
||||||
{
|
|
||||||
pVal[i].Value >>= bRes;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
else // no temporary value found in 'rProperties'
|
||||||
if (i >= nLen) // no temporary value found in 'rProperties'
|
|
||||||
{
|
{
|
||||||
uno::Reference< XFastPropertySet > xFast( rxProp, UNO_QUERY );
|
uno::Reference< XFastPropertySet > xFast( rxProp, UNO_QUERY );
|
||||||
if (xFast.is())
|
if (xFast.is())
|
||||||
@ -224,19 +220,14 @@ bool IsIgnoreControlChars( const PropertyValues &rProperties,
|
|||||||
{
|
{
|
||||||
bool bRes = true;
|
bool bRes = true;
|
||||||
|
|
||||||
sal_Int32 nLen = rProperties.getLength();
|
const PropertyValue *pVal = std::find_if(rProperties.begin(), rProperties.end(),
|
||||||
const PropertyValue *pVal = rProperties.getConstArray();
|
[](const PropertyValue& rVal) { return UPH_IS_IGNORE_CONTROL_CHARACTERS == rVal.Handle; });
|
||||||
sal_Int32 i;
|
|
||||||
|
|
||||||
for ( i = 0; i < nLen; ++i)
|
if (pVal != rProperties.end())
|
||||||
{
|
{
|
||||||
if (UPH_IS_IGNORE_CONTROL_CHARACTERS == pVal[i].Handle)
|
pVal->Value >>= bRes;
|
||||||
{
|
|
||||||
pVal[i].Value >>= bRes;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
else // no temporary value found in 'rProperties'
|
||||||
if (i >= nLen) // no temporary value found in 'rProperties'
|
|
||||||
{
|
{
|
||||||
uno::Reference< XFastPropertySet > xFast( rxProp, UNO_QUERY );
|
uno::Reference< XFastPropertySet > xFast( rxProp, UNO_QUERY );
|
||||||
if (xFast.is())
|
if (xFast.is())
|
||||||
@ -316,14 +307,12 @@ bool SaveDictionaries( const uno::Reference< XSearchableDictionaryList > &xDicLi
|
|||||||
|
|
||||||
bool bRet = true;
|
bool bRet = true;
|
||||||
|
|
||||||
Sequence< uno::Reference< XDictionary > > aDics( xDicList->getDictionaries() );
|
const Sequence< uno::Reference< XDictionary > > aDics( xDicList->getDictionaries() );
|
||||||
const uno::Reference< XDictionary > *pDic = aDics.getConstArray();
|
for (const uno::Reference<XDictionary>& rDic : aDics)
|
||||||
sal_Int32 nCount = aDics.getLength();
|
|
||||||
for (sal_Int32 i = 0; i < nCount; i++)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
uno::Reference< frame::XStorable > xStor( pDic[i], UNO_QUERY );
|
uno::Reference< frame::XStorable > xStor( rDic, UNO_QUERY );
|
||||||
if (xStor.is())
|
if (xStor.is())
|
||||||
{
|
{
|
||||||
if (!xStor->isReadonly() && xStor->hasLocation())
|
if (!xStor->isReadonly() && xStor->hasLocation())
|
||||||
@ -382,15 +371,11 @@ DictionaryError AddEntryToDic(
|
|||||||
std::vector< LanguageType >
|
std::vector< LanguageType >
|
||||||
LocaleSeqToLangVec( uno::Sequence< Locale > const &rLocaleSeq )
|
LocaleSeqToLangVec( uno::Sequence< Locale > const &rLocaleSeq )
|
||||||
{
|
{
|
||||||
const Locale *pLocale = rLocaleSeq.getConstArray();
|
|
||||||
sal_Int32 nCount = rLocaleSeq.getLength();
|
|
||||||
|
|
||||||
std::vector< LanguageType > aLangs;
|
std::vector< LanguageType > aLangs;
|
||||||
aLangs.reserve(nCount);
|
aLangs.reserve(rLocaleSeq.getLength());
|
||||||
for (sal_Int32 i = 0; i < nCount; ++i)
|
|
||||||
{
|
std::transform(rLocaleSeq.begin(), rLocaleSeq.end(), std::back_inserter(aLangs),
|
||||||
aLangs.push_back( LinguLocaleToLanguage( pLocale[i] ) );
|
[](const Locale& rLocale) { return LinguLocaleToLanguage(rLocale); });
|
||||||
}
|
|
||||||
|
|
||||||
return aLangs;
|
return aLangs;
|
||||||
}
|
}
|
||||||
@ -398,17 +383,13 @@ std::vector< LanguageType >
|
|||||||
uno::Sequence< sal_Int16 >
|
uno::Sequence< sal_Int16 >
|
||||||
LocaleSeqToLangSeq( uno::Sequence< Locale > const &rLocaleSeq )
|
LocaleSeqToLangSeq( uno::Sequence< Locale > const &rLocaleSeq )
|
||||||
{
|
{
|
||||||
const Locale *pLocale = rLocaleSeq.getConstArray();
|
std::vector<sal_Int16> aLangs;
|
||||||
sal_Int32 nCount = rLocaleSeq.getLength();
|
aLangs.reserve(rLocaleSeq.getLength());
|
||||||
|
|
||||||
uno::Sequence< sal_Int16 > aLangs( nCount );
|
std::transform(rLocaleSeq.begin(), rLocaleSeq.end(), std::back_inserter(aLangs),
|
||||||
sal_Int16 *pLang = aLangs.getArray();
|
[](const Locale& rLocale) { return static_cast<sal_uInt16>(LinguLocaleToLanguage(rLocale)); });
|
||||||
for (sal_Int32 i = 0; i < nCount; ++i)
|
|
||||||
{
|
|
||||||
pLang[i] = static_cast<sal_uInt16>(LinguLocaleToLanguage( pLocale[i] ));
|
|
||||||
}
|
|
||||||
|
|
||||||
return aLangs;
|
return comphelper::containerToSequence(aLangs);
|
||||||
}
|
}
|
||||||
bool IsReadOnly( const OUString &rURL, bool *pbExist )
|
bool IsReadOnly( const OUString &rURL, bool *pbExist )
|
||||||
{
|
{
|
||||||
|
@ -110,23 +110,17 @@ static std::vector< OUString > GetMultiPaths_Impl(
|
|||||||
sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength();
|
sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength();
|
||||||
if (!aWritablePath.isEmpty())
|
if (!aWritablePath.isEmpty())
|
||||||
++nMaxEntries;
|
++nMaxEntries;
|
||||||
aRes.resize( nMaxEntries );
|
aRes.reserve( nMaxEntries );
|
||||||
sal_Int32 nCount = 0; // number of actually added entries
|
|
||||||
if (!aWritablePath.isEmpty())
|
if (!aWritablePath.isEmpty())
|
||||||
aRes[ nCount++ ] = aWritablePath;
|
aRes.push_back(aWritablePath);
|
||||||
for (int i = 0; i < 2; ++i)
|
|
||||||
{
|
auto lPathIsNotEmpty = [](const OUString& rPath) { return !rPath.isEmpty(); };
|
||||||
const uno::Sequence< OUString > &rPathSeq = i == 0 ? aUserPaths : aInternalPaths;
|
|
||||||
const OUString *pPathSeq = rPathSeq.getConstArray();
|
if (nPathFlags & DictionaryPathFlags::USER)
|
||||||
for (sal_Int32 k = 0; k < rPathSeq.getLength(); ++k)
|
std::copy_if(std::cbegin(aUserPaths), std::cend(aUserPaths), std::back_inserter(aRes), lPathIsNotEmpty);
|
||||||
{
|
|
||||||
const bool bAddUser = &rPathSeq == &aUserPaths && (nPathFlags & DictionaryPathFlags::USER);
|
if (nPathFlags & DictionaryPathFlags::INTERNAL)
|
||||||
const bool bAddInternal = &rPathSeq == &aInternalPaths && (nPathFlags & DictionaryPathFlags::INTERNAL);
|
std::copy_if(std::cbegin(aInternalPaths), std::cend(aInternalPaths), std::back_inserter(aRes), lPathIsNotEmpty);
|
||||||
if ((bAddUser || bAddInternal) && !pPathSeq[k].isEmpty())
|
|
||||||
aRes[ nCount++ ] = pPathSeq[k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
aRes.resize( nCount );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return aRes;
|
return aRes;
|
||||||
|
@ -115,11 +115,8 @@ void ProposalList::Append( const std::vector< OUString > &rNew )
|
|||||||
|
|
||||||
void ProposalList::Append( const Sequence< OUString > &rNew )
|
void ProposalList::Append( const Sequence< OUString > &rNew )
|
||||||
{
|
{
|
||||||
sal_Int32 nLen = rNew.getLength();
|
for (const OUString& rText : rNew)
|
||||||
const OUString *pNew = rNew.getConstArray();
|
|
||||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
|
||||||
{
|
{
|
||||||
const OUString &rText = pNew[i];
|
|
||||||
if (!HasEntry( rText ))
|
if (!HasEntry( rText ))
|
||||||
Append( rText );
|
Append( rText );
|
||||||
}
|
}
|
||||||
@ -159,22 +156,11 @@ static bool SvcListHasLanguage(
|
|||||||
const LangSvcEntries_Spell &rEntry,
|
const LangSvcEntries_Spell &rEntry,
|
||||||
LanguageType nLanguage )
|
LanguageType nLanguage )
|
||||||
{
|
{
|
||||||
bool bHasLanguage = false;
|
Locale aTmpLocale = LanguageTag::convertToLocale( nLanguage );
|
||||||
Locale aTmpLocale;
|
|
||||||
|
|
||||||
const Reference< XSpellChecker > *pRef = rEntry.aSvcRefs .getConstArray();
|
return std::any_of(rEntry.aSvcRefs.begin(), rEntry.aSvcRefs.end(),
|
||||||
sal_Int32 nLen = rEntry.aSvcRefs.getLength();
|
[&aTmpLocale](const Reference<XSpellChecker>& rRef) {
|
||||||
for (sal_Int32 k = 0; k < nLen && !bHasLanguage; ++k)
|
return rRef.is() && rRef->hasLocale( aTmpLocale ); });
|
||||||
{
|
|
||||||
if (pRef[k].is())
|
|
||||||
{
|
|
||||||
if (aTmpLocale.Language.isEmpty())
|
|
||||||
aTmpLocale = LanguageTag::convertToLocale( nLanguage );
|
|
||||||
bHasLanguage = pRef[k]->hasLocale( aTmpLocale );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return bHasLanguage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellCheckerDispatcher::SpellCheckerDispatcher( LngSvcMgr &rLngSvcMgr ) :
|
SpellCheckerDispatcher::SpellCheckerDispatcher( LngSvcMgr &rLngSvcMgr ) :
|
||||||
@ -192,13 +178,13 @@ Sequence< Locale > SAL_CALL SpellCheckerDispatcher::getLocales()
|
|||||||
{
|
{
|
||||||
MutexGuard aGuard( GetLinguMutex() );
|
MutexGuard aGuard( GetLinguMutex() );
|
||||||
|
|
||||||
Sequence< Locale > aLocales( static_cast< sal_Int32 >(m_aSvcMap.size()) );
|
std::vector<Locale> aLocales;
|
||||||
Locale *pLocales = aLocales.getArray();
|
aLocales.reserve(m_aSvcMap.size());
|
||||||
for (auto const& elem : m_aSvcMap)
|
|
||||||
{
|
std::transform(m_aSvcMap.begin(), m_aSvcMap.end(), std::back_inserter(aLocales),
|
||||||
*pLocales++ = LanguageTag::convertToLocale(elem.first);
|
[](SpellSvcByLangMap_t::const_reference elem) { return LanguageTag::convertToLocale(elem.first); });
|
||||||
}
|
|
||||||
return aLocales;
|
return comphelper::containerToSequence(aLocales);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,15 +87,13 @@ void SearchSimilarText( const OUString &rText, LanguageType nLanguage,
|
|||||||
assert( eType != DictionaryType_MIXED && "unexpected dictionary type" );
|
assert( eType != DictionaryType_MIXED && "unexpected dictionary type" );
|
||||||
#endif
|
#endif
|
||||||
const Sequence< Reference< XDictionaryEntry > > aEntries = xDic->getEntries();
|
const Sequence< Reference< XDictionaryEntry > > aEntries = xDic->getEntries();
|
||||||
const Reference< XDictionaryEntry > *pEntries = aEntries.getConstArray();
|
for (const Reference<XDictionaryEntry>& rEntry : aEntries)
|
||||||
sal_Int32 nLen = aEntries.getLength();
|
|
||||||
for (sal_Int32 k = 0; k < nLen; ++k)
|
|
||||||
{
|
{
|
||||||
OUString aEntryTxt;
|
OUString aEntryTxt;
|
||||||
if (pEntries[k].is())
|
if (rEntry.is())
|
||||||
{
|
{
|
||||||
// remove characters used to determine hyphenation positions
|
// remove characters used to determine hyphenation positions
|
||||||
aEntryTxt = pEntries[k]->getDictionaryWord().replaceAll("=", "");
|
aEntryTxt = rEntry->getDictionaryWord().replaceAll("=", "");
|
||||||
}
|
}
|
||||||
if (!aEntryTxt.isEmpty() && aEntryTxt.getLength() > 1 && LevDistance( rText, aEntryTxt ) <= 2)
|
if (!aEntryTxt.isEmpty() && aEntryTxt.getLength() > 1 && LevDistance( rText, aEntryTxt ) <= 2)
|
||||||
rDicListProps.push_back( aEntryTxt );
|
rDicListProps.push_back( aEntryTxt );
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <com/sun/star/registry/XRegistryKey.hpp>
|
#include <com/sun/star/registry/XRegistryKey.hpp>
|
||||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
|
#include <comphelper/sequence.hxx>
|
||||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||||
#include <osl/mutex.hxx>
|
#include <osl/mutex.hxx>
|
||||||
#include <sal/log.hxx>
|
#include <sal/log.hxx>
|
||||||
@ -46,17 +47,9 @@ static bool SvcListHasLanguage(
|
|||||||
const Sequence< Reference< XThesaurus > > &rRefs,
|
const Sequence< Reference< XThesaurus > > &rRefs,
|
||||||
const Locale &rLocale )
|
const Locale &rLocale )
|
||||||
{
|
{
|
||||||
bool bHasLanguage = false;
|
return std::any_of(rRefs.begin(), rRefs.end(),
|
||||||
|
[&rLocale](const Reference<XThesaurus>& rRef) {
|
||||||
const Reference< XThesaurus > *pRef = rRefs.getConstArray();
|
return rRef.is() && rRef->hasLocale( rLocale ); });
|
||||||
sal_Int32 nLen = rRefs.getLength();
|
|
||||||
for (sal_Int32 k = 0; k < nLen && !bHasLanguage; ++k)
|
|
||||||
{
|
|
||||||
if (pRef[k].is())
|
|
||||||
bHasLanguage = pRef[k]->hasLocale( rLocale );
|
|
||||||
}
|
|
||||||
|
|
||||||
return bHasLanguage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,13 +77,13 @@ Sequence< Locale > SAL_CALL
|
|||||||
{
|
{
|
||||||
MutexGuard aGuard( GetLinguMutex() );
|
MutexGuard aGuard( GetLinguMutex() );
|
||||||
|
|
||||||
Sequence< Locale > aLocales( static_cast< sal_Int32 >(aSvcMap.size()) );
|
std::vector<Locale> aLocales;
|
||||||
Locale *pLocales = aLocales.getArray();
|
aLocales.reserve(aSvcMap.size());
|
||||||
for (auto const& elem : aSvcMap)
|
|
||||||
{
|
std::transform(aSvcMap.begin(), aSvcMap.end(), std::back_inserter(aLocales),
|
||||||
*pLocales++ = LanguageTag::convertToLocale(elem.first);
|
[](ThesSvcByLangMap_t::const_reference elem) { return LanguageTag::convertToLocale(elem.first); });
|
||||||
}
|
|
||||||
return aLocales;
|
return comphelper::containerToSequence(aLocales);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,15 +49,12 @@ static const sal_Int8 header[] = { 0x57, 0x6f, 0x72, 0x64, 0x50, 0x72, 0x6f };
|
|||||||
|
|
||||||
bool LotusWordProImportFilter::importImpl( const Sequence< css::beans::PropertyValue >& aDescriptor )
|
bool LotusWordProImportFilter::importImpl( const Sequence< css::beans::PropertyValue >& aDescriptor )
|
||||||
{
|
{
|
||||||
|
|
||||||
sal_Int32 nLength = aDescriptor.getLength();
|
|
||||||
const PropertyValue * pValue = aDescriptor.getConstArray();
|
|
||||||
OUString sURL;
|
OUString sURL;
|
||||||
for ( sal_Int32 i = 0 ; i < nLength; i++)
|
for (const PropertyValue& rValue : aDescriptor)
|
||||||
{
|
{
|
||||||
//Note, we should attempt to use InputStream here first!
|
//Note, we should attempt to use InputStream here first!
|
||||||
if ( pValue[i].Name == "URL" )
|
if ( rValue.Name == "URL" )
|
||||||
pValue[i].Value >>= sURL;
|
rValue.Value >>= sURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SvFileStream inputStream( sURL, StreamMode::READ );
|
SvFileStream inputStream( sURL, StreamMode::READ );
|
||||||
@ -98,20 +95,17 @@ void SAL_CALL LotusWordProImportFilter::setTargetDocument( const uno::Reference<
|
|||||||
// XExtendedFilterDetection
|
// XExtendedFilterDetection
|
||||||
OUString SAL_CALL LotusWordProImportFilter::detect( css::uno::Sequence< PropertyValue >& Descriptor )
|
OUString SAL_CALL LotusWordProImportFilter::detect( css::uno::Sequence< PropertyValue >& Descriptor )
|
||||||
{
|
{
|
||||||
|
|
||||||
OUString sTypeName( "writer_LotusWordPro_Document" );
|
OUString sTypeName( "writer_LotusWordPro_Document" );
|
||||||
sal_Int32 nLength = Descriptor.getLength();
|
|
||||||
OUString sURL;
|
OUString sURL;
|
||||||
const PropertyValue * pValue = Descriptor.getConstArray();
|
|
||||||
uno::Reference < XInputStream > xInputStream;
|
uno::Reference < XInputStream > xInputStream;
|
||||||
for ( sal_Int32 i = 0 ; i < nLength; i++)
|
for (const PropertyValue& rValue : std::as_const(Descriptor))
|
||||||
{
|
{
|
||||||
if ( pValue[i].Name == "TypeName" )
|
if ( rValue.Name == "TypeName" )
|
||||||
pValue[i].Value >>= sTypeName;
|
rValue.Value >>= sTypeName;
|
||||||
else if ( pValue[i].Name == "InputStream" )
|
else if ( rValue.Name == "InputStream" )
|
||||||
pValue[i].Value >>= xInputStream;
|
rValue.Value >>= xInputStream;
|
||||||
else if ( pValue[i].Name == "URL" )
|
else if ( rValue.Name == "URL" )
|
||||||
pValue[i].Value >>= sURL;
|
rValue.Value >>= sURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Reference< css::ucb::XCommandEnvironment > xEnv;
|
uno::Reference< css::ucb::XCommandEnvironment > xEnv;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user