[Libreoffice-commits] core.git: lingucomponent/source

2023-11-23 Thread Mike Kaganski (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |   14 
+-
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 05d5181e2c19aca7e6098217ddb7065e02819a53
Author: Mike Kaganski 
AuthorDate: Thu Nov 23 13:21:02 2023 +0100
Commit: Mike Kaganski 
CommitDate: Thu Nov 23 22:30:29 2023 +0100

tdf#158117: encode the username sent to LanguageTool

Change-Id: I762ebb7487b3bcb80cd88b265b4e75c0d8b7c639
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159764
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index 599bb01c6194..fe912cb6b341 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -86,15 +86,16 @@ PropertyValue lcl_GetLineColorPropertyFromErrorId(const 
std::string& rErrorId)
 return comphelper::makePropertyValue("LineColor", aColor);
 }
 
-OString encodeTextForLanguageTool(const OUString& text)
+OString encodeTextForLT(const OUString& text)
 {
 // Let's be a bit conservative. I don't find a good description what needs 
encoding (and in
 // which way) at https://languagetool.org/http-api/; the "Try it out!" 
function shows that
 // different cases are handled differently by the demo; some 
percent-encode the UTF-8
 // representation, like %D0%90 (for cyrillic А); some turn into entities 
like  (for
-// exclamation mark !); some other to things like \u0027 (for apostrophe 
').
+// exclamation mark !); some other to things like \u0027 (for apostrophe 
'). So only keep
+// RFC 3986's "Unreserved Characters" set unencoded, use UTF-8 
percent-encoding for the rest.
 static constexpr auto myCharClass = rtl::createUriCharClass(
-u8"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
+
u8"-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
 return OUStringToOString(
 rtl::Uri::encode(text, myCharClass.data(), rtl_UriEncodeStrict, 
RTL_TEXTENCODING_UTF8),
 RTL_TEXTENCODING_ASCII_US);
@@ -196,10 +197,9 @@ std::string makeHttpRequest(std::u16string_view aURL, 
HTTP_METHOD method, const
 {
 OString apiKey
 = OUStringToOString(LanguageToolCfg::ApiKey::get().value_or(""), 
RTL_TEXTENCODING_UTF8);
-OString username = 
OUStringToOString(LanguageToolCfg::Username::get().value_or(""),
- RTL_TEXTENCODING_UTF8);
+OUString username = LanguageToolCfg::Username::get().value_or("");
 if (!apiKey.isEmpty() && !username.isEmpty())
-realPostData += "=" + username + "=" + apiKey;
+realPostData += "=" + encodeTextForLT(username) + 
"=" + apiKey;
 }
 
 return makeHttpRequest_impl(aURL, method, realPostData, nullptr, 
nStatusCode);
@@ -440,7 +440,7 @@ ProofreadingResult SAL_CALL 
LanguageToolGrammarChecker::doProofreading(
 }
 else
 {
-postData = "text=" + encodeTextForLanguageTool(aText) + "=" + 
langTag;
+postData = "text=" + encodeTextForLT(aText) + "=" + langTag;
 }
 
 if (auto cachedResult = mCachedResults.find(postData); cachedResult != 
mCachedResults.end())


[Libreoffice-commits] core.git: lingucomponent/source

2023-10-22 Thread Gökay Şatır (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 768da8bf8fa20848d5da9dfc56b1b8ce42b1404f
Author: Gökay Şatır 
AuthorDate: Mon Oct 16 12:26:10 2023 +0300
Commit: Caolán McNamara 
CommitDate: Sun Oct 22 21:50:28 2023 +0200

Don't encode the text when sending it to Duden corrector.

Signed-off-by: Gökay Şatır 
Change-Id: I9e1a2adede04858e5c43b878786bbcc28922aa5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158023
Tested-by: Jenkins CollaboraOffice 
(cherry picked from commit 8989cba47fce3763229005b1ed2fec74da7cfb72)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158333
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index d1c87af5fa0a..79d061e42c85 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -427,14 +427,14 @@ ProofreadingResult SAL_CALL 
LanguageToolGrammarChecker::doProofreading(
 = std::min(xRes.nStartOfNextSentencePosition, aText.getLength());
 
 OString langTag(LanguageTag::convertToBcp47(aLocale, false).toUtf8());
-OString postData = encodeTextForLanguageTool(aText);
+OString postData;
 const bool bDudenProtocol = 
LanguageToolCfg::RestProtocol::get().value_or("") == "duden";
 if (bDudenProtocol)
 {
 std::stringstream aStream;
 boost::property_tree::ptree aTree;
 aTree.put("text-language", langTag.getStr());
-aTree.put("text", postData.getStr());
+aTree.put("text", aText.toUtf8()); // We don't encode the text in 
Duden Corrector tool case.
 aTree.put("hyphenation", false);
 aTree.put("spellchecking-level", 3);
 aTree.put("correction-proposals", true);
@@ -443,7 +443,7 @@ ProofreadingResult SAL_CALL 
LanguageToolGrammarChecker::doProofreading(
 }
 else
 {
-postData = "text=" + postData + "=" + langTag;
+postData = "text=" + encodeTextForLanguageTool(aText) + "=" + 
langTag;
 }
 
 if (auto cachedResult = mCachedResults.find(postData); cachedResult != 
mCachedResults.end())


[Libreoffice-commits] core.git: lingucomponent/source

2023-06-07 Thread Khaled Hosny (via logerrit)
 lingucomponent/source/lingutil/lingutil.cxx |   12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 2940fb7d2aba063441e7ce70bb276bfe912ed73e
Author: Khaled Hosny 
AuthorDate: Wed Jun 7 17:43:13 2023 +0300
Commit: خالد حسني 
CommitDate: Wed Jun 7 17:56:49 2023 +0200

tdf#64830: Don’t require hunspell dictionary for every Arabic locale

For old-style hunspell dictionaries, if “ar” dictionary is found, add
the rest of Arabic locales for that dictionary’s aLocaleNames, so that
distributions don’t have to symlink the dictionary files.

This is similar to the fix for macOS spell checking in:

Author: Khaled Hosny 
Date:   Tue Feb 7 21:29:12 2023 +0200

tdf#153436: Improve handling of Arabic system spell dictionary on macOS

Change-Id: I96b23566cba7b345a10e10c10f1bfe02ce1f8cf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152706
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/lingucomponent/source/lingutil/lingutil.cxx 
b/lingucomponent/source/lingutil/lingutil.cxx
index 5e931f894ad2..e5ea427eda1c 100644
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -121,8 +121,18 @@ static void GetOldStyleDicsInDir(
 // add the dictionary to the resulting vector
 SvtLinguConfigDictionaryEntry aDicEntry;
 aDicEntry.aLocations = { sPath };
-aDicEntry.aLocaleNames = { aLocaleName };
 aDicEntry.aFormatName = aFormatName;
+if (aLocaleName == u"ar")
+aDicEntry.aLocaleNames = {
+aLocaleName,
+u"ar-AE", u"ar-BH", u"ar-DJ", u"ar-DZ", u"ar-EG",
+u"ar-ER", u"ar-IL", u"ar-IQ", u"ar-JO", u"ar-KM",
+u"ar-KW", u"ar-LB", u"ar-LY", u"ar-MA", u"ar-MR",
+u"ar-OM", u"ar-PS", u"ar-QA", u"ar-SA", u"ar-SD",
+u"ar-SO", u"ar-SY", u"ar-TD", u"ar-TN", u"ar-YE"
+};
+else
+aDicEntry.aLocaleNames = { aLocaleName };
 aRes.push_back( aDicEntry );
 }
 }


[Libreoffice-commits] core.git: lingucomponent/source

2023-06-04 Thread Mike Kaganski (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 23f918ef6a542cc5f473f6c9bb5897ce5be9dd06
Author: Mike Kaganski 
AuthorDate: Sun Apr 23 20:14:10 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Jun 4 22:51:50 2023 +0200

Use getXWeak in lingucomponent

Change-Id: Icd70dd656d847f595cc1325ed0decb4941a82cde
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150857
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index c68a17cbd466..7152a6ff0880 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -528,7 +528,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 lingucomponent_LanguageToolGrammarChecker_get_implementation(
 css::uno::XComponentContext*, css::uno::Sequence const&)
 {
-return cppu::acquire(static_cast(new 
LanguageToolGrammarChecker()));
+return cppu::acquire(new LanguageToolGrammarChecker());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


[Libreoffice-commits] core.git: lingucomponent/source

2023-03-09 Thread Mike Kaganski (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |  228 
--
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx |6 
 2 files changed, 95 insertions(+), 139 deletions(-)

New commits:
commit 3579343ec00adcbf54938e59d27cc52d11ddb920
Author: Mike Kaganski 
AuthorDate: Thu Mar 9 13:11:14 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Mar 9 12:08:16 2023 +

Some refactoring and deduplication

Change-Id: I443bd562bc9df6636bf71a230a05a12e443c6614
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148532
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index 91a027e6ec6b..1c167e61df60 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -43,27 +43,23 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
-using namespace osl;
 using namespace com::sun::star;
 using namespace com::sun::star::beans;
 using namespace com::sun::star::lang;
-using namespace com::sun::star::uno;
 using namespace com::sun::star::linguistic2;
-using namespace linguistic;
-
-#define COL_ORANGE Color(0xD1, 0x68, 0x20)
-
-constexpr OUStringLiteral sDuden = u"duden";
 
 namespace
 {
-Sequence lcl_GetLineColorPropertyFromErrorId(const std::string& 
rErrorId)
+constexpr size_t MAX_SUGGESTIONS_SIZE = 10;
+
+PropertyValue lcl_GetLineColorPropertyFromErrorId(const std::string& rErrorId)
 {
 Color aColor;
 if (rErrorId == "TYPOS" || rErrorId == "orth")
@@ -77,10 +73,10 @@ Sequence 
lcl_GetLineColorPropertyFromErrorId(const std::string& r
 else
 {
 // Same color is used for other errorId's such as GRAMMAR, TYPOGRAPHY..
+constexpr Color COL_ORANGE(0xD1, 0x68, 0x20);
 aColor = COL_ORANGE;
 }
-Sequence aProperties{ 
comphelper::makePropertyValue("LineColor", aColor) };
-return aProperties;
+return comphelper::makePropertyValue("LineColor", aColor);
 }
 
 OString encodeTextForLanguageTool(const OUString& text)
@@ -115,15 +111,14 @@ enum class HTTP_METHOD
 HTTP_POST
 };
 
-struct curl_cleanup_t
-{
-void operator()(CURL* p) const { curl_easy_cleanup(p); }
-};
-
-std::string makeHttpRequest_impl(std::string_view aURL, HTTP_METHOD method,
+std::string makeHttpRequest_impl(std::u16string_view aURL, HTTP_METHOD method,
  const OString& aPostData, curl_slist* 
pHttpHeader,
  tools::Long& nStatusCode)
 {
+struct curl_cleanup_t
+{
+void operator()(CURL* p) const { curl_easy_cleanup(p); }
+};
 std::unique_ptr curl(curl_easy_init());
 if (!curl)
 {
@@ -139,10 +134,11 @@ std::string makeHttpRequest_impl(std::string_view aURL, 
HTTP_METHOD method,
 + pVersion->version + " " + pVersion->ssl_version);
 (void)curl_easy_setopt(curl.get(), CURLOPT_USERAGENT, useragent.getStr());
 
+OString aURL8 = OUStringToOString(aURL, RTL_TEXTENCODING_UTF8);
 (void)curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, pHttpHeader);
 (void)curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
-(void)curl_easy_setopt(curl.get(), CURLOPT_URL, aURL.data());
-(void)curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
+(void)curl_easy_setopt(curl.get(), CURLOPT_URL, aURL8.getStr());
+(void)curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, 10L);
 // (void)curl_easy_setopt(curl.get(), CURLOPT_VERBOSE, 1L);
 
 std::string response_body;
@@ -174,7 +170,7 @@ std::string makeHttpRequest_impl(std::string_view aURL, 
HTTP_METHOD method,
 return response_body;
 }
 
-std::string makeDudenHttpRequest(std::string_view aURL, const OString& 
aPostData,
+std::string makeDudenHttpRequest(std::u16string_view aURL, const OString& 
aPostData,
  tools::Long& nStatusCode)
 {
 struct curl_slist* pList = nullptr;
@@ -192,7 +188,7 @@ std::string makeDudenHttpRequest(std::string_view aURL, 
const OString& aPostData
 return makeHttpRequest_impl(aURL, HTTP_METHOD::HTTP_POST, aPostData, 
pList, nStatusCode);
 }
 
-std::string makeHttpRequest(std::string_view aURL, HTTP_METHOD method, const 
OString& aPostData,
+std::string makeHttpRequest(std::u16string_view aURL, HTTP_METHOD method, 
const OString& aPostData,
 tools::Long& nStatusCode)
 {
 OString realPostData(aPostData);
@@ -208,133 +204,98 @@ std::string makeHttpRequest(std::string_view aURL, 
HTTP_METHOD method, const OSt
 return makeHttpRequest_impl(aURL, method, realPostData, nullptr, 
nStatusCode);
 }
 
-void parseDudenResponse(ProofreadingResult& rResult, std::string_view 
aJSONBody)
+template 
+Sequence parseJson(std::string&& json, std::string 
path, Func f)
 {
-size_t nSize;
-int 

[Libreoffice-commits] core.git: lingucomponent/source linguistic/source

2023-03-08 Thread Mike Kaganski (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |   14 
--
 linguistic/source/gciterator.cxx  |5 +++
 2 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 6b6d59d04e0398d67e789db05b6071faf2255ec1
Author: Mike Kaganski 
AuthorDate: Wed Mar 8 12:56:06 2023 +0300
Commit: Mike Kaganski 
CommitDate: Wed Mar 8 12:52:12 2023 +

Add some SAL_WARNs and SAL_INFOs

These help when debugging the LanguageTool issues.

Change-Id: I04bb84dbffc8e4c4e0b353f8e830fe66d8dff576
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148199
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index 06e9f4eddff1..91a027e6ec6b 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -126,7 +126,10 @@ std::string makeHttpRequest_impl(std::string_view aURL, 
HTTP_METHOD method,
 {
 std::unique_ptr curl(curl_easy_init());
 if (!curl)
+{
+SAL_WARN("languagetool", "CURL initialization failed");
 return {}; // empty string
+}
 
 // Same useragent string as in CurlSession 
(ucp/webdav-curl/CurlSession.cxx)
 curl_version_info_data const* const 
pVersion(curl_version_info(CURLVERSION_NOW));
@@ -341,20 +344,15 @@ sal_Bool SAL_CALL 
LanguageToolGrammarChecker::isSpellChecker() { return false; }
 
 sal_Bool SAL_CALL LanguageToolGrammarChecker::hasLocale(const Locale& rLocale)
 {
-bool bRes = false;
 if (!m_aSuppLocales.hasElements())
 getLocales();
 
 for (auto const& suppLocale : std::as_const(m_aSuppLocales))
-{
 if (rLocale == suppLocale)
-{
-bRes = true;
-break;
-}
-}
+return true;
 
-return bRes;
+SAL_INFO("languagetool", "No locale \"" << 
LanguageTag::convertToBcp47(rLocale, false) << "\"");
+return false;
 }
 
 Sequence SAL_CALL LanguageToolGrammarChecker::getLocales()
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index a43a990a886f..edd028e31e28 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -565,6 +565,11 @@ uno::Reference< linguistic2::XProofreader > 
GrammarCheckingIterator::GetGrammarC
 }
 }
 }
+else // not found - quite normal
+{
+SAL_INFO("linguistic", "No grammar checker found for \""
+   << LanguageTag::convertToBcp47(rLocale, 
false) << "\"");
+}
 //  THREAD SAFE END 
 
 return xRes;


[Libreoffice-commits] core.git: lingucomponent/source

2023-03-05 Thread Stephan Bergmann (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a45f25bdfb6166d754ebb8c7224c2e6bdc2e8527
Author: Stephan Bergmann 
AuthorDate: Sun Mar 5 16:38:52 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Sun Mar 5 17:31:12 2023 +

Fix rtl::createUriCharClass argument (C++20)

Change-Id: Ifb4d8a430adc19d51d07af3ca2aff66a7983224a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148283
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index ddb2e834215c..06e9f4eddff1 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -90,8 +90,8 @@ OString encodeTextForLanguageTool(const OUString& text)
 // different cases are handled differently by the demo; some 
percent-encode the UTF-8
 // representation, like %D0%90 (for cyrillic А); some turn into entities 
like  (for
 // exclamation mark !); some other to things like \u0027 (for apostrophe 
').
-static constexpr auto myCharClass
-= 
rtl::createUriCharClass("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
+static constexpr auto myCharClass = rtl::createUriCharClass(
+u8"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
 return OUStringToOString(
 rtl::Uri::encode(text, myCharClass.data(), rtl_UriEncodeStrict, 
RTL_TEXTENCODING_UTF8),
 RTL_TEXTENCODING_ASCII_US);


[Libreoffice-commits] core.git: lingucomponent/source

2023-03-04 Thread Mike Kaganski (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |  261 
+-
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx |4 
 2 files changed, 131 insertions(+), 134 deletions(-)

New commits:
commit e6d8db305d6ba63b6a4a4c5046177a0d607678f6
Author: Mike Kaganski 
AuthorDate: Sat Mar 4 23:44:11 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Mar 4 21:42:00 2023 +

A bit more of refactoring

Change-Id: I43dde0375674c4078658a2179108edb5187d2cfc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148257
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index 4ad7c1388ea7..ddb2e834215c 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -115,12 +115,16 @@ enum class HTTP_METHOD
 HTTP_POST
 };
 
+struct curl_cleanup_t
+{
+void operator()(CURL* p) const { curl_easy_cleanup(p); }
+};
+
 std::string makeHttpRequest_impl(std::string_view aURL, HTTP_METHOD method,
  const OString& aPostData, curl_slist* 
pHttpHeader,
  tools::Long& nStatusCode)
 {
-std::unique_ptr> curl(curl_easy_init(),
-   [](CURL* p) { 
curl_easy_cleanup(p); });
+std::unique_ptr curl(curl_easy_init());
 if (!curl)
 return {}; // empty string
 
@@ -129,8 +133,7 @@ std::string makeHttpRequest_impl(std::string_view aURL, 
HTTP_METHOD method,
 assert(pVersion);
 OString const useragent(
 OString::Concat("LibreOffice " LIBO_VERSION_DOTTED " 
denylistedbackend/")
-+ ::std::string_view(pVersion->version, strlen(pVersion->version)) + " 
"
-+ pVersion->ssl_version);
++ pVersion->version + " " + pVersion->ssl_version);
 (void)curl_easy_setopt(curl.get(), CURLOPT_USERAGENT, useragent.getStr());
 
 (void)curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, pHttpHeader);
@@ -201,6 +204,130 @@ std::string makeHttpRequest(std::string_view aURL, 
HTTP_METHOD method, const OSt
 
 return makeHttpRequest_impl(aURL, method, realPostData, nullptr, 
nStatusCode);
 }
+
+void parseDudenResponse(ProofreadingResult& rResult, std::string_view 
aJSONBody)
+{
+size_t nSize;
+int nProposalSize;
+boost::property_tree::ptree aRoot;
+std::stringstream aStream(aJSONBody.data());
+boost::property_tree::read_json(aStream, aRoot);
+
+const boost::optional aPositions
+= aRoot.get_child_optional("check-positions");
+if (!aPositions || !(nSize = aPositions.get().size()))
+{
+return;
+}
+
+Sequence aChecks(nSize);
+auto pChecks = aChecks.getArray();
+size_t nIndex1 = 0, nIndex2 = 0;
+auto itPos = aPositions.get().begin();
+while (itPos != aPositions.get().end())
+{
+const boost::property_tree::ptree& rTree = itPos->second;
+const std::string sType = rTree.get("type", "");
+const int nOffset = rTree.get("offset", 0);
+const int nLength = rTree.get("length", 0);
+
+pChecks[nIndex1].nErrorStart = nOffset;
+pChecks[nIndex1].nErrorLength = nLength;
+pChecks[nIndex1].nErrorType = PROOFREADING_ERROR;
+//pChecks[nIndex1].aShortComment = ??
+//pChecks[nIndex1].aFullComment = ??
+pChecks[nIndex1].aProperties = 
lcl_GetLineColorPropertyFromErrorId(sType);
+
+const boost::optional aProposals
+= rTree.get_child_optional("proposals");
+if (aProposals && (nProposalSize = aProposals.get().size()))
+{
+pChecks[nIndex1].aSuggestions.realloc(std::min(nProposalSize, 
MAX_SUGGESTIONS_SIZE));
+
+nIndex2 = 0;
+auto itProp = aProposals.get().begin();
+auto pSuggestions = pChecks[nIndex1].aSuggestions.getArray();
+while (itProp != aProposals.get().end() && nIndex2 < 
MAX_SUGGESTIONS_SIZE)
+{
+pSuggestions[nIndex2++]
+= OStringToOUString(itProp->second.data(), 
RTL_TEXTENCODING_UTF8);
+itProp++;
+}
+}
+
+nIndex1++;
+itPos++;
+}
+
+rResult.aErrors = aChecks;
+}
+
+/*
+rResult is both input and output
+aJSONBody is the response body from the HTTP Request to LanguageTool API
+*/
+void parseProofreadingJSONResponse(ProofreadingResult& rResult, 
std::string_view aJSONBody)
+{
+boost::property_tree::ptree root;
+std::stringstream aStream(aJSONBody.data());
+boost::property_tree::read_json(aStream, root);
+boost::property_tree::ptree& matches = root.get_child("matches");
+size_t matchSize = matches.size();
+
+if (matchSize <= 0)
+{
+return;
+}
+Sequence aErrors(matchSize);
+auto pErrors = 

[Libreoffice-commits] core.git: lingucomponent/source

2023-03-04 Thread Mike Kaganski (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |   26 
+++---
 1 file changed, 20 insertions(+), 6 deletions(-)

New commits:
commit 43dcdfae40c9c37032ed5e92cd0634feb53b706d
Author: Mike Kaganski 
AuthorDate: Sat Mar 4 12:46:56 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Mar 4 14:18:51 2023 +

tdf#153617: percent-encode the text sent to LanguageTool API.

Change-Id: I0bb55c70f560240fca6e3c13b3d75418e49d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148236
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index 0856be3f741d..a153e7ac5ef0 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace osl;
 using namespace com::sun::star;
@@ -77,6 +78,20 @@ Sequence 
lcl_GetLineColorPropertyFromErrorId(const std::string& r
 Sequence aProperties{ 
comphelper::makePropertyValue("LineColor", aColor) };
 return aProperties;
 }
+
+OString encodeTextForLanguageTool(const OUString& text)
+{
+// Let's be a bit conservative. I don't find a good description what needs 
encoding (and in
+// which way) at https://languagetool.org/http-api/; the "Try it out!" 
function shows that
+// different cases are handled differently by the demo; some 
percent-encode the UTF-8
+// representation, like %D0%90 (for cyrillic А); some turn into entities 
like  (for
+// exclamation mark !); some other to things like \u0027 (for apostrophe 
').
+static constexpr auto myCharClass
+= 
rtl::createUriCharClass("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
+return OUStringToOString(
+rtl::Uri::encode(text, myCharClass.data(), rtl_UriEncodeStrict, 
RTL_TEXTENCODING_UTF8),
+RTL_TEXTENCODING_ASCII_US);
+}
 }
 
 LanguageToolGrammarChecker::LanguageToolGrammarChecker()
@@ -224,14 +239,14 @@ ProofreadingResult SAL_CALL 
LanguageToolGrammarChecker::doProofreading(
 xRes.nBehindEndOfSentencePosition
 = std::min(xRes.nStartOfNextSentencePosition, aText.getLength());
 
-OUString langTag(aLocale.Language + "-" + aLocale.Country);
-OString postData;
+OString langTag(LanguageTag::convertToBcp47(aLocale, false).toUtf8());
+OString postData = encodeTextForLanguageTool(aText);
 if (rLanguageOpts.getRestProtocol() == sDuden)
 {
 std::stringstream aStream;
 boost::property_tree::ptree aTree;
-aTree.put("text-language", langTag.toUtf8().getStr());
-aTree.put("text", aText.toUtf8().getStr());
+aTree.put("text-language", langTag.getStr());
+aTree.put("text", postData.getStr());
 aTree.put("hyphenation", false);
 aTree.put("spellchecking-level", 3);
 aTree.put("correction-proposals", true);
@@ -240,8 +255,7 @@ ProofreadingResult SAL_CALL 
LanguageToolGrammarChecker::doProofreading(
 }
 else
 {
-postData = OUStringToOString(Concat2View("text=" + aText + 
"=" + langTag),
- RTL_TEXTENCODING_UTF8);
+postData = "text=" + postData + "=" + langTag;
 }
 
 if (auto cachedResult = mCachedResults.find(postData); cachedResult != 
mCachedResults.end())


[Libreoffice-commits] core.git: lingucomponent/source

2023-03-03 Thread Miklos Vajna (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 27b8c67bb154d2e09c2377a5f73621b72167a226
Author: Miklos Vajna 
AuthorDate: Fri Mar 3 10:57:39 2023 +0100
Commit: Miklos Vajna 
CommitDate: Fri Mar 3 10:51:30 2023 +

lingucomponent: don't get locales from the server when this is disabled

Do it like LanguageToolGrammarChecker::doProofreading(), which already
checked for this setting.

Helps when soffice starts up in an environment without network access
and also is pointless. Avoids this warning:


warn:languagetool:13511:13511:lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx:508:
 CURL request returned with error: 28

Which looked odd, given that LT was disabled already.

Change-Id: Ideb0c59ad79bdbd7d22acef22e31a43377d30ec1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148166
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index ff38eb67d172..fb8228890bdc 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -111,6 +111,11 @@ Sequence SAL_CALL 
LanguageToolGrammarChecker::getLocales()
 if (m_aSuppLocales.hasElements())
 return m_aSuppLocales;
 SvxLanguageToolOptions& rLanguageOpts = SvxLanguageToolOptions::Get();
+if (!rLanguageOpts.getEnabled())
+{
+return m_aSuppLocales;
+}
+
 OString localeUrl = OUStringToOString(rLanguageOpts.getLocaleListURL(), 
RTL_TEXTENCODING_UTF8);
 if (localeUrl.isEmpty())
 {


[Libreoffice-commits] core.git: lingucomponent/source

2023-02-07 Thread Khaled Hosny (via logerrit)
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |   14 +++-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 9d44236a62bf59d120dda89924d0d1407b2bd52b
Author: Khaled Hosny 
AuthorDate: Tue Feb 7 21:29:12 2023 +0200
Commit: خالد حسني 
CommitDate: Tue Feb 7 22:01:07 2023 +

tdf#153436: Improve handling of Arabic system spell dictionary on macOS

The system has only a generic “ar” spell dictionary, but LibreOffice
wants country code as well. Since it is the same dictionary for all
Arabic locales, we now add entries to all Arabic country codes we know
about.

Change-Id: Iaf5a8f495b3d1023d7fe40654afa0cce3fe9fbdc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146641
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index c20871b1e127..448870e9125c 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -125,7 +125,19 @@ Sequence< Locale > SAL_CALL MacSpellChecker::getLocales()
 
 // Fix up generic languages (without territory code) and odd 
combinations that LO
 // doesn't handle.
-if ([pLangStr isEqualToString:@"da"])
+if ([pLangStr isEqualToString:@"ar"])
+{
+const std::vector aAR
+{ @"AE", @"BH", @"DJ", @"DZ", @"EG", @"ER", @"IL", @"IQ", 
@"JO",
+  @"KM", @"KW", @"LB", @"LY", @"MA", @"MR", @"OM", @"PS", 
@"QA",
+  @"SA", @"SD", @"SO", @"SY", @"TD", @"TN", @"YE" };
+for (auto c: aAR)
+{
+pLangStr = [@"ar_" stringByAppendingString: c];
+postspdict.push_back( pLangStr );
+}
+}
+else if ([pLangStr isEqualToString:@"da"])
 {
 postspdict.push_back( @"da_DK" );
 }


[Libreoffice-commits] core.git: lingucomponent/source

2023-01-31 Thread Andrea Gelmini (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit d8e6b488ceaff7c88856ebcfcfec14d2d8cd7652
Author: Andrea Gelmini 
AuthorDate: Tue Jan 31 10:45:16 2023 +0100
Commit: Julien Nabet 
CommitDate: Tue Jan 31 21:53:56 2023 +

Remove duplicated include

Change-Id: Ia5f606fd64737aed372afb2ee4762f9eb3e21a86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146380
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index d2c715325f26..9fb8a53bb300 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -43,7 +43,6 @@
 #include 
 #include 
 #include 
-#include 
 
 using namespace osl;
 using namespace com::sun::star;


[Libreoffice-commits] core.git: lingucomponent/source

2023-01-31 Thread Henry Castro (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |   69 
+-
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx |2 
 2 files changed, 69 insertions(+), 2 deletions(-)

New commits:
commit 1d89f4835384e6379177e1607bb648b567e3fdab
Author: Henry Castro 
AuthorDate: Mon Nov 21 21:38:40 2022 -0400
Commit: Henry Castro 
CommitDate: Tue Jan 31 16:04:16 2023 +

lingucomponent: implement custom parse response rest protocol

Response:

HTTP/1.1 200 OK
Transfer encoding: chunked
Content-Type: application/json
{
"hyphenation-positions":[
{"offset":15,"quality":0},
{"offset":20,"quality":1}
],
}, "check-positions":[
{"offset":15,"length":6,"errorcode":4711,"type":"orth","severity":1,"propos
als":["Entwurf","Entw\u00fcrfe"]},
{"offset":22,"length":3,"errorcode":8221,"type":"orth","severity":1}
]
}

Signed-off-by: Henry Castro 
Change-Id: I87228237f23306fb367edab1e21ce002aaf13f2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143108
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145598
Tested-by: Jenkins

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index ae0b493a32e1..d2c715325f26 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -62,7 +62,7 @@ namespace
 Sequence lcl_GetLineColorPropertyFromErrorId(const std::string& 
rErrorId)
 {
 Color aColor;
-if (rErrorId == "TYPOS")
+if (rErrorId == "TYPOS" || rErrorId == "orth")
 {
 aColor = COL_LIGHTRED;
 }
@@ -261,13 +261,78 @@ ProofreadingResult SAL_CALL 
LanguageToolGrammarChecker::doProofreading(
 return xRes;
 }
 
-parseProofreadingJSONResponse(xRes, response_body);
+if (rLanguageOpts.getRestProtocol() == sDuden)
+{
+parseDudenResponse(xRes, response_body);
+}
+else
+{
+parseProofreadingJSONResponse(xRes, response_body);
+}
 // cache the result
 mCachedResults.insert(
 std::pair>(aText, 
xRes.aErrors));
 return xRes;
 }
 
+void LanguageToolGrammarChecker::parseDudenResponse(ProofreadingResult& 
rResult,
+std::string_view aJSONBody)
+{
+size_t nSize;
+int nProposalSize;
+boost::property_tree::ptree aRoot;
+std::stringstream aStream(aJSONBody.data());
+boost::property_tree::read_json(aStream, aRoot);
+
+const boost::optional aPositions
+= aRoot.get_child_optional("check-positions");
+if (!aPositions || !(nSize = aPositions.get().size()))
+{
+return;
+}
+
+Sequence aChecks(nSize);
+auto pChecks = aChecks.getArray();
+size_t nIndex1 = 0, nIndex2 = 0;
+auto itPos = aPositions.get().begin();
+while (itPos != aPositions.get().end())
+{
+const boost::property_tree::ptree& rTree = itPos->second;
+const std::string sType = rTree.get("type", "");
+const int nOffset = rTree.get("offset", 0);
+const int nLength = rTree.get("length", 0);
+
+pChecks[nIndex1].nErrorStart = nOffset;
+pChecks[nIndex1].nErrorLength = nLength;
+pChecks[nIndex1].nErrorType = PROOFREADING_ERROR;
+//pChecks[nIndex1].aShortComment = ??
+//pChecks[nIndex1].aFullComment = ??
+pChecks[nIndex1].aProperties = 
lcl_GetLineColorPropertyFromErrorId(sType);
+
+const boost::optional aProposals
+= rTree.get_child_optional("proposals");
+if (aProposals && (nProposalSize = aProposals.get().size()))
+{
+pChecks[nIndex1].aSuggestions.realloc(std::min(nProposalSize, 
MAX_SUGGESTIONS_SIZE));
+
+nIndex2 = 0;
+auto itProp = aProposals.get().begin();
+auto pSuggestions = pChecks[nIndex1].aSuggestions.getArray();
+while (itProp != aProposals.get().end() && nIndex2 < 
MAX_SUGGESTIONS_SIZE)
+{
+pSuggestions[nIndex2++]
+= OStringToOUString(itProp->second.data(), 
RTL_TEXTENCODING_UTF8);
+itProp++;
+}
+}
+
+nIndex1++;
+itPos++;
+}
+
+rResult.aErrors = aChecks;
+}
+
 /*
 rResult is both input and output
 aJSONBody is the response body from the HTTP Request to LanguageTool API
diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx
index 1a5da7995716..00513851888d 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx
@@ -51,6 +51,8 @@ class LanguageToolGrammarChecker
 mCachedResults;
 LanguageToolGrammarChecker(const LanguageToolGrammarChecker&) = delete;
 

[Libreoffice-commits] core.git: lingucomponent/source

2023-01-31 Thread Henry Castro (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |   79 
+-
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx |2 
 2 files changed, 77 insertions(+), 4 deletions(-)

New commits:
commit e295f060f25f3a731a93cea23a1662091f4c9763
Author: Henry Castro 
AuthorDate: Mon Nov 21 21:34:24 2022 -0400
Commit: Henry Castro 
CommitDate: Tue Jan 31 13:33:50 2023 +

lingucomponent: implement custom request http rest protocol

Request:

POST /api/check HTTP/1.1
Host: localhost:8099
Content-Type: application/json
Cache-Control: no-cache

{
"dictionaries": [
"daily",
"jungblutt"
],
"text-language": "en-DE",
"property-sets": [
"base", "daily",
"culture"
],
"hyphenation": true,
"spellchecking-level": 1,
"correction-proposals": true,
"single-word-mode": false,
"message-language": "fr-LU",
"message-level": 1,
"text": "This is a final throw for the interface to the Duden server."
}

Signed-off-by: Henry Castro 
Change-Id: I2a288a7c573014d42df03f7cc12c57a7f788750e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143107
Reviewed-by: Ashod Nakashian 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145597
Tested-by: Jenkins

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index b868e4744ac7..ae0b493a32e1 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -55,6 +55,8 @@ using namespace linguistic;
 
 #define COL_ORANGE Color(0xD1, 0x68, 0x20)
 
+constexpr OUStringLiteral sDuden = u"duden";
+
 namespace
 {
 Sequence lcl_GetLineColorPropertyFromErrorId(const std::string& 
rErrorId)
@@ -226,11 +228,28 @@ ProofreadingResult SAL_CALL 
LanguageToolGrammarChecker::doProofreading(
 }
 
 tools::Long http_code = 0;
+std::string response_body;
 OUString langTag(aLocale.Language + "-" + aLocale.Country);
-OString postData(OUStringToOString(Concat2View("text=" + aText + 
"=" + langTag),
-   RTL_TEXTENCODING_UTF8));
-const std::string response_body
-= makeHttpRequest(checkerURL, HTTP_METHOD::HTTP_POST, postData, 
http_code);
+
+if (rLanguageOpts.getRestProtocol() == sDuden)
+{
+std::stringstream aStream;
+boost::property_tree::ptree aTree;
+aTree.put("text-language", langTag.toUtf8().getStr());
+aTree.put("text", aText.toUtf8().getStr());
+aTree.put("hyphenation", false);
+aTree.put("spellchecking-level", 3);
+aTree.put("correction-proposals", true);
+boost::property_tree::write_json(aStream, aTree);
+response_body = makeDudenHttpRequest(checkerURL, 
HTTP_METHOD::HTTP_POST,
+ aStream.str().c_str(), http_code);
+}
+else
+{
+OString postData(OUStringToOString(Concat2View("text=" + aText + 
"=" + langTag),
+   RTL_TEXTENCODING_UTF8));
+response_body = makeHttpRequest(checkerURL, HTTP_METHOD::HTTP_POST, 
postData, http_code);
+}
 
 if (http_code != 200)
 {
@@ -317,6 +336,58 @@ void 
LanguageToolGrammarChecker::parseProofreadingJSONResponse(ProofreadingResul
 rResult.aErrors = aErrors;
 }
 
+std::string LanguageToolGrammarChecker::makeDudenHttpRequest(std::string_view 
aURL,
+ HTTP_METHOD 
method,
+ const OString& 
aData,
+ tools::Long& 
nCode)
+{
+std::unique_ptr> curl(curl_easy_init(),
+   [](CURL* p) { 
curl_easy_cleanup(p); });
+if (!curl)
+return {}; // empty string
+
+std::string sResponseBody;
+struct curl_slist* pList = nullptr;
+SvxLanguageToolOptions& rLanguageOpts = SvxLanguageToolOptions::Get();
+OString sAccessToken = OString::Concat("access_token: ")
+   + OUStringToOString(rLanguageOpts.getApiKey(), 
RTL_TEXTENCODING_UTF8);
+
+pList = curl_slist_append(pList, "Cache-Control: no-cache");
+pList = curl_slist_append(pList, "Content-Type: application/json");
+if (!sAccessToken.isEmpty())
+pList = curl_slist_append(pList, sAccessToken.getStr());
+
+curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, pList);
+curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
+curl_easy_setopt(curl.get(), CURLOPT_URL, aURL.data());
+curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
+curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, WriteCallback);
+curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, 
static_cast());
+
+// allow unknown or 

[Libreoffice-commits] core.git: lingucomponent/source

2022-06-30 Thread Miklos Vajna (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx |   36 
--
 1 file changed, 17 insertions(+), 19 deletions(-)

New commits:
commit a4a6680718e2cbc6c471894ed9d3b729504002b7
Author: Miklos Vajna 
AuthorDate: Wed Jun 29 19:51:14 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu Jun 30 08:53:26 2022 +0200

lingucomponent: avoid 'using namespace' in a header file

Because that would pollute the global namespace in any cxx file
including this header.

Change-Id: Ida324d125114ae03d8868842b881e3b94af62bfb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136631
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx
index 36b31238d0b5..0262be896cd6 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx
@@ -30,11 +30,6 @@
 #include 
 #include 
 
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::linguistic2;
-
 // Magical numbers
 #define MAX_CACHE_SIZE 10
 #define MAX_SUGGESTIONS_SIZE 10
@@ -48,13 +43,15 @@ enum class HTTP_METHOD
 };
 
 class LanguageToolGrammarChecker
-: public cppu::WeakImplHelper
+: public cppu::WeakImplHelper
 {
-Sequence m_aSuppLocales;
-o3tl::lru_map> mCachedResults;
+css::uno::Sequence m_aSuppLocales;
+o3tl::lru_map>
+mCachedResults;
 LanguageToolGrammarChecker(const LanguageToolGrammarChecker&) = delete;
 LanguageToolGrammarChecker& operator=(const LanguageToolGrammarChecker&) = 
delete;
-static void parseProofreadingJSONResponse(ProofreadingResult& rResult,
+static void 
parseProofreadingJSONResponse(css::linguistic2::ProofreadingResult& rResult,
   std::string_view aJSONBody);
 static std::string makeHttpRequest(std::string_view aURL, HTTP_METHOD 
method,
const OString& aPostData, tools::Long& 
nStatusCode);
@@ -64,30 +61,31 @@ public:
 virtual ~LanguageToolGrammarChecker() override;
 
 // XSupportedLocales
-virtual Sequence SAL_CALL getLocales() override;
-virtual sal_Bool SAL_CALL hasLocale(const Locale& rLocale) override;
+virtual css::uno::Sequence SAL_CALL getLocales() 
override;
+virtual sal_Bool SAL_CALL hasLocale(const css::lang::Locale& rLocale) 
override;
 
 // XProofReader
 virtual sal_Bool SAL_CALL isSpellChecker() override;
-virtual ProofreadingResult SAL_CALL doProofreading(
-const OUString& aDocumentIdentifier, const OUString& aText, const 
Locale& aLocale,
-sal_Int32 nStartOfSentencePosition, sal_Int32 
nSuggestedBehindEndOfSentencePosition,
-const Sequence& aProperties) override;
+virtual css::linguistic2::ProofreadingResult SAL_CALL
+doProofreading(const OUString& aDocumentIdentifier, const OUString& aText,
+   const css::lang::Locale& aLocale, sal_Int32 
nStartOfSentencePosition,
+   sal_Int32 nSuggestedBehindEndOfSentencePosition,
+   const css::uno::Sequence& 
aProperties) override;
 
 virtual void SAL_CALL ignoreRule(const OUString& aRuleIdentifier,
- const Locale& aLocale) override;
+ const css::lang::Locale& aLocale) 
override;
 virtual void SAL_CALL resetIgnoreRules() override;
 
 // XServiceDisplayName
-virtual OUString SAL_CALL getServiceDisplayName(const Locale& rLocale) 
override;
+virtual OUString SAL_CALL getServiceDisplayName(const css::lang::Locale& 
rLocale) override;
 
 // XInitialization
-virtual void SAL_CALL initialize(const Sequence& rArguments) override;
+virtual void SAL_CALL initialize(const css::uno::Sequence& 
rArguments) override;
 
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) 
override;
-virtual Sequence SAL_CALL getSupportedServiceNames() override;
+virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() 
override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


[Libreoffice-commits] core.git: lingucomponent/source

2022-06-23 Thread Miklos Vajna (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |   16 
+++---
 1 file changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 74d545ee8e4f8c9a1317decd3352ce97e0e24913
Author: Miklos Vajna 
AuthorDate: Wed Jun 22 19:26:59 2022 +0100
Commit: Miklos Vajna 
CommitDate: Thu Jun 23 15:13:31 2022 +0200

lingucomponent: use comphelper::makePropertyValue() in languagetoolimp

This allows giving aColor an actual type.

Change-Id: If51ec4028b712166094c3f24a2e1d7643ff0136d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136295
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index d4f73c8ee4bc..ef56578c9825 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace osl;
 using namespace com::sun::star;
@@ -53,28 +54,23 @@ using namespace linguistic;
 
 namespace
 {
-PropertyValue lcl_MakePropertyValue(const OUString& rName, uno::Any& rValue)
-{
-return PropertyValue(rName, -1, rValue, 
css::beans::PropertyState_DIRECT_VALUE);
-}
-
 Sequence lcl_GetLineColorPropertyFromErrorId(const std::string& 
rErrorId)
 {
-uno::Any aColor;
+Color aColor;
 if (rErrorId == "TYPOS")
 {
-aColor <<= COL_LIGHTRED;
+aColor = COL_LIGHTRED;
 }
 else if (rErrorId == "STYLE")
 {
-aColor <<= COL_LIGHTBLUE;
+aColor = COL_LIGHTBLUE;
 }
 else
 {
 // Same color is used for other errorId's such as GRAMMAR, TYPOGRAPHY..
-aColor <<= COL_ORANGE;
+aColor = COL_ORANGE;
 }
-Sequence aProperties{ lcl_MakePropertyValue("LineColor", 
aColor) };
+Sequence aProperties{ 
comphelper::makePropertyValue("LineColor", aColor) };
 return aProperties;
 }
 }


[Libreoffice-commits] core.git: lingucomponent/source

2022-06-18 Thread Caolán McNamara (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |2 ++
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx |4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 634f13a722dc68b7a2df7518880ce4f9d5d89f19
Author: Caolán McNamara 
AuthorDate: Sat Jun 18 12:48:39 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sat Jun 18 16:10:53 2022 +0200

add usual footer directives

Change-Id: I1fd6c5e98e77bc7f275dff65f4c2287b58550f48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136081
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index 7b6e8005fcb7..d4f73c8ee4bc 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -405,3 +405,5 @@ 
lingucomponent_LanguageToolGrammarChecker_get_implementation(
 {
 return cppu::acquire(static_cast(new 
LanguageToolGrammarChecker()));
 }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx
index e0dadfecab68..36b31238d0b5 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.hxx
@@ -88,4 +88,6 @@ public:
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) 
override;
 virtual Sequence SAL_CALL getSupportedServiceNames() override;
-};
\ No newline at end of file
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


[Libreoffice-commits] core.git: lingucomponent/source

2022-06-18 Thread Caolán McNamara (via logerrit)
 lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |   26 
+-
 1 file changed, 13 insertions(+), 13 deletions(-)

New commits:
commit b9a83f9ad4bf1d7754e23af5e6e4eb03750adb92
Author: Caolán McNamara 
AuthorDate: Sat Jun 18 12:47:18 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sat Jun 18 16:10:18 2022 +0200

cid#1506303 silence Unchecked return value

and

cid#1506308 Unchecked return value from library

Change-Id: I2a2057b44f1e1e3b8577b02fb63e5460c7222b11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136080
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index 06b4fcb64175..7b6e8005fcb7 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -338,33 +338,33 @@ std::string 
LanguageToolGrammarChecker::makeHttpRequest(std::string_view aURL, H
 }
 
 std::string response_body;
-curl_easy_setopt(curl.get(), CURLOPT_URL, aURL.data());
+(void)curl_easy_setopt(curl.get(), CURLOPT_URL, aURL.data());
 
-curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
-// curl_easy_setopt(curl.get(), CURLOPT_VERBOSE, 1L);
+(void)curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
+// (void)curl_easy_setopt(curl.get(), CURLOPT_VERBOSE, 1L);
 
-curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, WriteCallback);
-curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, 
static_cast(_body));
-curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYPEER, false);
-curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYHOST, false);
-curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
+(void)curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, WriteCallback);
+(void)curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, 
static_cast(_body));
+(void)curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYPEER, false);
+(void)curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYHOST, false);
+(void)curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
 
 if (method == HTTP_METHOD::HTTP_POST)
 {
-curl_easy_setopt(curl.get(), CURLOPT_POST, 1L);
+(void)curl_easy_setopt(curl.get(), CURLOPT_POST, 1L);
 if (isPremium == false)
 {
-curl_easy_setopt(curl.get(), CURLOPT_POSTFIELDS, 
aPostData.getStr());
+(void)curl_easy_setopt(curl.get(), CURLOPT_POSTFIELDS, 
aPostData.getStr());
 }
 else
 {
 premiumPostData = aPostData + "=" + username + "=" 
+ apiKey;
-curl_easy_setopt(curl.get(), CURLOPT_POSTFIELDS, 
premiumPostData.getStr());
+(void)curl_easy_setopt(curl.get(), CURLOPT_POSTFIELDS, 
premiumPostData.getStr());
 }
 }
 
 /*CURLcode cc = */
-curl_easy_perform(curl.get());
+(void)curl_easy_perform(curl.get());
 curl_easy_getinfo(curl.get(), CURLINFO_RESPONSE_CODE, );
 return response_body;
 }
@@ -404,4 +404,4 @@ 
lingucomponent_LanguageToolGrammarChecker_get_implementation(
 css::uno::XComponentContext*, css::uno::Sequence const&)
 {
 return cppu::acquire(static_cast(new 
LanguageToolGrammarChecker()));
-}
\ No newline at end of file
+}


[Libreoffice-commits] core.git: lingucomponent/source

2022-03-28 Thread Stephan Bergmann (via logerrit)
 lingucomponent/source/languageguessing/simpleguesser.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f891cecab59179efdb1e3153752f744db0a420ad
Author: Stephan Bergmann 
AuthorDate: Mon Mar 28 14:29:22 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Mar 28 16:34:38 2022 +0200

-Werror,-Wunused-but-set-variable

...ever since cab1870e677f33a2501f15916110da46d3336d24 "INTEGRATION: CWS
languageguessing: #i73173# integrate Google SoC language-guessing"

Change-Id: I0abf783944499b6ac8015e37952013d05b273558
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132206
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/languageguessing/simpleguesser.cxx 
b/lingucomponent/source/languageguessing/simpleguesser.cxx
index 7b4d9f1119ad..7210b1f451e3 100644
--- a/lingucomponent/source/languageguessing/simpleguesser.cxx
+++ b/lingucomponent/source/languageguessing/simpleguesser.cxx
@@ -123,7 +123,7 @@ std::vector SimpleGuesser::GuessLanguage(const char* 
text)
 
 int current_pointer = 0;
 
-for(int i = 0; guess_list[current_pointer] != '\0'; i++)
+while(guess_list[current_pointer] != '\0')
 {
 while (guess_list[current_pointer] != GUESS_SEPARATOR_OPEN && 
guess_list[current_pointer] != '\0')
 current_pointer++;


[Libreoffice-commits] core.git: lingucomponent/source

2021-11-27 Thread Noel Grandin (via logerrit)
 lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx|3 ++-
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx |3 ++-
 lingucomponent/source/spellcheck/spell/sspellimp.hxx |3 ++-
 lingucomponent/source/thesaurus/libnth/nthesimp.hxx  |3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 770cb7825b772366ab61d4f6f7a98de30b5cd80a
Author: Noel Grandin 
AuthorDate: Tue Nov 23 20:43:03 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Nov 27 14:12:00 2021 +0100

use more OInterfaceContainerHelper3 in lingucomponent

Change-Id: I4ad7c868815d7f6b8982dd192bc74b0b07a438f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125935
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
index 9ab7df50879b..45ebca112544 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_LINGUCOMPONENT_SOURCE_HYPHENATOR_HYPHEN_HYPHENIMP_HXX
 #define INCLUDED_LINGUCOMPONENT_SOURCE_HYPHENATOR_HYPHEN_HYPHENIMP_HXX
 
+#include 
 #include 
 #include 
 #include 
@@ -67,7 +68,7 @@ class Hyphenator :
 Sequence< Locale >  aSuppLocales;
 std::vector< HDInfo >   mvDicts;
 
-::comphelper::OInterfaceContainerHelper2   aEvtListeners;
+::comphelper::OInterfaceContainerHelper3 aEvtListeners;
 std::unique_ptr pPropHelper;
 boolbDisposing;
 
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index 0967ecaef685..776c474d21db 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_MACOSXSPELL_MACSPELLIMP_HXX
 #define INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_MACOSXSPELL_MACSPELLIMP_HXX
 
+#include 
 #include 
 
 #include 
@@ -68,7 +69,7 @@ class MacSpellChecker :
 #else
 UITextChecker * pChecker;
 #endif
-::comphelper::OInterfaceContainerHelper2   aEvtListeners;
+::comphelper::OInterfaceContainerHelper3 aEvtListeners;
 rtl::Reference< linguistic::PropertyHelper_Spell >xPropHelper;
 boolbDisposing;
 
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.hxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
index 7adf0ab17b5f..c4c002b9ead1 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.hxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_SPELL_SSPELLIMP_HXX
 #define INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_SPELL_SSPELLIMP_HXX
 
+#include 
 #include 
 #include 
 #include 
@@ -68,7 +69,7 @@ class SpellChecker :
 
 Sequence< Locale > m_aSuppLocales;
 
-::comphelper::OInterfaceContainerHelper2   m_aEvtListeners;
+::comphelper::OInterfaceContainerHelper3 m_aEvtListeners;
 std::unique_ptr m_pPropHelper;
 boolm_bDisposing;
 
diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.hxx 
b/lingucomponent/source/thesaurus/libnth/nthesimp.hxx
index 69a67a224002..04eab06882c2 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.hxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_LINGUCOMPONENT_SOURCE_THESAURUS_LIBNTH_NTHESIMP_HXX
 #define INCLUDED_LINGUCOMPONENT_SOURCE_THESAURUS_LIBNTH_NTHESIMP_HXX
 
+#include 
 #include 
 #include 
 #include 
@@ -63,7 +64,7 @@ class Thesaurus :
 {
 Sequence< Locale >  aSuppLocales;
 
-::comphelper::OInterfaceContainerHelper2   aEvtListeners;
+::comphelper::OInterfaceContainerHelper3 aEvtListeners;
 linguistic::PropertyHelper_Thesaurus*   pPropHelper;
 boolbDisposing;
 struct ThesInfo


[Libreoffice-commits] core.git: lingucomponent/source

2021-11-25 Thread mwarner (via logerrit)
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit f32b7faf33778282a9519d75fc0a130aa93b3144
Author: mwarner 
AuthorDate: Thu Nov 25 16:47:47 2021 -0500
Commit: Stephan Bergmann 
CommitDate: Fri Nov 26 08:53:30 2021 +0100

Unused Import of Carbon.h in macspellimp.hxx

The macspellimp.hxx file was needlessly importing Carbon/Carbon.h

Change-Id: I22ee6bf5c39b52fb09409983f52803e58459f2e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125853
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index dc9ad055d3bc..0967ecaef685 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -24,7 +24,6 @@
 
 #include 
 #ifdef MACOSX
-#include 
 #import 
 #else
 #include 


[Libreoffice-commits] core.git: lingucomponent/source

2021-07-31 Thread Noel Grandin (via logerrit)
 lingucomponent/source/numbertext/numbertext.cxx |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit f883bf8b655569b9897a4a237b52d424b2550cf8
Author: Noel Grandin 
AuthorDate: Fri Jul 30 15:32:41 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 31 14:25:08 2021 +0200

osl::Mutex->std::mutex in NumberText_Impl

Change-Id: I9903a2717fe9019c45c4ecc3e7dcaed7e1a9d9f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119730
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/lingucomponent/source/numbertext/numbertext.cxx 
b/lingucomponent/source/numbertext/numbertext.cxx
index cb8e913bf571..5b9a32a65196 100644
--- a/lingucomponent/source/numbertext/numbertext.cxx
+++ b/lingucomponent/source/numbertext/numbertext.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 
 #include 
 #include 
@@ -47,9 +48,9 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::linguistic2;
 
-static osl::Mutex& GetNumberTextMutex()
+static std::mutex& GetNumberTextMutex()
 {
-static osl::Mutex aMutex;
+static std::mutex aMutex;
 return aMutex;
 }
 
@@ -111,7 +112,7 @@ void NumberText_Impl::EnsureInitialized()
 
 OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const 
Locale& rLocale)
 {
-osl::MutexGuard aGuard(GetNumberTextMutex());
+std::lock_guard aGuard(GetNumberTextMutex());
 EnsureInitialized();
 // libnumbertext supports Language + Country tags (separated by "_" or "-")
 LanguageTag aLanguageTag(rLocale);
@@ -141,7 +142,7 @@ OUString SAL_CALL NumberText_Impl::getNumberText(const 
OUString& rText, const Lo
 
 uno::Sequence SAL_CALL NumberText_Impl::getAvailableLanguages()
 {
-osl::MutexGuard aGuard(GetNumberTextMutex());
+std::lock_guard aGuard(GetNumberTextMutex());
 // TODO
 Sequence aRes;
 return aRes;


[Libreoffice-commits] core.git: lingucomponent/source

2021-07-31 Thread Noel Grandin (via logerrit)
 lingucomponent/source/languageguessing/guesslang.cxx |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit e81be03d9f2c952da0516be0f42fd2dbe6f6d4a4
Author: Noel Grandin 
AuthorDate: Fri Jul 30 15:31:22 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 31 14:24:40 2021 +0200

osl::Mutex->std::mutex in LangGuess_Impl

Change-Id: If2ea21cd52ddae821598398524c84b5b22817c33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119729
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/lingucomponent/source/languageguessing/guesslang.cxx 
b/lingucomponent/source/languageguessing/guesslang.cxx
index dfece0efe4e5..98274af16d46 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 
 #include 
@@ -54,9 +55,9 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::linguistic2;
 
-static osl::Mutex &  GetLangGuessMutex()
+static std::mutex & GetLangGuessMutex()
 {
-static osl::Mutex aMutex;
+static std::mutex aMutex;
 return aMutex;
 }
 
@@ -160,7 +161,7 @@ Locale SAL_CALL LangGuess_Impl::guessPrimaryLanguage(
 ::sal_Int32 nStartPos,
 ::sal_Int32 nLen )
 {
-osl::MutexGuard aGuard( GetLangGuessMutex() );
+std::lock_guard aGuard( GetLangGuessMutex() );
 
 EnsureInitialized();
 
@@ -189,7 +190,7 @@ void LangGuess_Impl::SetFingerPrintsDB(
 
 uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getAvailableLanguages(  )
 {
-osl::MutexGuard aGuard( GetLangGuessMutex() );
+std::lock_guard aGuard( GetLangGuessMutex() );
 
 EnsureInitialized();
 
@@ -211,7 +212,7 @@ uno::Sequence< Locale > SAL_CALL 
LangGuess_Impl::getAvailableLanguages(  )
 
 uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getEnabledLanguages(  )
 {
-osl::MutexGuard aGuard( GetLangGuessMutex() );
+std::lock_guard aGuard( GetLangGuessMutex() );
 
 EnsureInitialized();
 
@@ -233,7 +234,7 @@ uno::Sequence< Locale > SAL_CALL 
LangGuess_Impl::getEnabledLanguages(  )
 
 uno::Sequence< Locale > SAL_CALL LangGuess_Impl::getDisabledLanguages(  )
 {
-osl::MutexGuard aGuard( GetLangGuessMutex() );
+std::lock_guard aGuard( GetLangGuessMutex() );
 
 EnsureInitialized();
 
@@ -256,7 +257,7 @@ uno::Sequence< Locale > SAL_CALL 
LangGuess_Impl::getDisabledLanguages(  )
 void SAL_CALL LangGuess_Impl::disableLanguages(
 const uno::Sequence< Locale >& rLanguages )
 {
-osl::MutexGuard aGuard( GetLangGuessMutex() );
+std::lock_guard aGuard( GetLangGuessMutex() );
 
 EnsureInitialized();
 
@@ -277,7 +278,7 @@ void SAL_CALL LangGuess_Impl::disableLanguages(
 void SAL_CALL LangGuess_Impl::enableLanguages(
 const uno::Sequence< Locale >& rLanguages )
 {
-osl::MutexGuard aGuard( GetLangGuessMutex() );
+std::lock_guard aGuard( GetLangGuessMutex() );
 
 EnsureInitialized();
 


[Libreoffice-commits] core.git: lingucomponent/source

2021-06-10 Thread Stephan Bergmann (via logerrit)
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit da905b57745a343aa922a4e9fb513b121cd6ad8b
Author: Stephan Bergmann 
AuthorDate: Thu Jun 10 16:02:02 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jun 10 17:35:59 2021 +0200

-Werror,-Wunused-but-set-variable (Clang 13 trunk)

...ever since the code's introduction in
4e386a897cd43aae3664ce68e47dd46b271de780 "INTEGRATION: CWS 
macosxspellchecker"

Change-Id: I932b7ff4cc8aabf2e70379ed9ebe361881246c46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116997
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index b4a206ada437..c20871b1e127 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -356,8 +356,6 @@ sal_Bool SAL_CALL MacSpellChecker::hasLocale(const Locale& 
rLocale)
 
 sal_Int16 MacSpellChecker::GetSpellFailure( const OUString , const 
Locale  )
 {
-rtl_TextEncoding aEnc;
-
 // initialize a myspell object for each dictionary once
 // (note: mutex is held higher up in isValid)
 
@@ -377,7 +375,6 @@ sal_Int16 MacSpellChecker::GetSpellFailure( const OUString 
, const Locale
 
 if (n)
 {
-aEnc = 0;
 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
 NSString* aNSStr = [[[NSString alloc] initWithCharacters: 
reinterpret_cast(nWord.getStr()) length: 
nWord.getLength()]autorelease];
 NSString* aLang = [[[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Language.getStr()) length: 
rLocale.Language.getLength()]autorelease];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2021-05-17 Thread Tor Lillqvist (via logerrit)
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 7527afeb305bb01340461f6fddf6d13a5acca3e3
Author: Tor Lillqvist 
AuthorDate: Wed Mar 17 09:14:44 2021 +0200
Commit: Tor Lillqvist 
CommitDate: Mon May 17 09:25:07 2021 +0200

Don't use the macOS system German spelling dictionary for Swiss German

The system German dictionary accepts 'ß' which is not used in Swiss
Standard German but completely replaced with 'ss'. We assume that the
LibreOffice German dictionary is installed, too. It has correct
spelling for de_CH.

It would be good if we knew in the macosxspell code whether the
LibreOffice German dictionary installed, and act correspondingly. But
figuring that out seems more complicated than what I am willing to
spend on this for now.

Change-Id: I380d7734cea34a2408d9ed20a8c3d9efe6a8fea2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115690
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 874f14bc0f19..b4a206ada437 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -131,8 +131,9 @@ Sequence< Locale > SAL_CALL MacSpellChecker::getLocales()
 }
 else if ([pLangStr isEqualToString:@"de"])
 {
+// Not de_CH and de_LI, though. They need separate 
dictionaries.
 const std::vector aDE
-{ @"AT", @"BE", @"CH", @"DE", @"LI", @"LU" };
+{ @"AT", @"BE", @"DE", @"LU" };
 for (auto c: aDE)
 {
 pLangStr = [@"de_" stringByAppendingString: c];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2021-03-18 Thread Tor Lillqvist (via logerrit)
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |   25 
 1 file changed, 25 insertions(+)

New commits:
commit 370984c385dbc52c8ee7e6e71f4c0cc085fee422
Author: Tor Lillqvist 
AuthorDate: Thu Mar 18 13:45:18 2021 +0200
Commit: Tor Lillqvist 
CommitDate: Fri Mar 19 06:31:54 2021 +0100

Use the iOS fr_FR and it_IT dictionaries for other relevant countries, too

Fixes https://github.com/CollaboraOnline/online/issues/1463

Change-Id: I9fffd4bc9499aee2098258f5c3a9181330b339a1
Signed-off-by: Tor Lillqvist 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112670
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112690

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index a919015f8ca5..874f14bc0f19 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -197,11 +197,36 @@ Sequence< Locale > SAL_CALL MacSpellChecker::getLocales()
 postspdict.push_back( pLangStr );
 }
 }
+#ifdef IOS
+else if ([pLangStr isEqualToString:@"fr_FR"])
+{
+const std::vector aFR
+{ @"BE", @"BF", @"BJ", @"CA", @"CH", @"CI", @"FR", @"LU", 
@"MC", @"ML",
+  @"MU", @"NE", @"SN", @"TG" };
+for (auto c: aFR)
+{
+pLangStr = [@"fr_" stringByAppendingString: c];
+postspdict.push_back( pLangStr );
+}
+}
+#endif
 else if ([pLangStr isEqualToString:@"it"])
 {
 postspdict.push_back( @"it_CH" );
 postspdict.push_back( @"it_IT" );
 }
+#ifdef IOS
+else if ([pLangStr isEqualToString:@"it_IT"])
+{
+const std::vector aIT
+{ @"CH", @"IT" };
+for (auto c: aIT)
+{
+pLangStr = [@"it_" stringByAppendingString: c];
+postspdict.push_back( pLangStr );
+}
+}
+#endif
 else if ([pLangStr isEqualToString:@"ko"])
 {
 postspdict.push_back( @"ko_KR" );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2021-03-02 Thread Stephan Bergmann (via logerrit)
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 670df8db5cbb2a9cac46a8602b95192a02fa3e2c
Author: Stephan Bergmann 
AuthorDate: Tue Mar 2 13:42:21 2021 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Mar 3 08:47:37 2021 +0100

loplugin:refcounting (macOS)

Change-Id: Id68d9c9733738595aeb4bad24d77f77da2878e83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111830
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 74b365c71746..cba8dae08094 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using namespace utl;
@@ -486,7 +487,7 @@ Reference< XSpellAlternatives >
 }
 
 // now return an empty alternative for no suggestions or the list of 
alternatives if some found
-SpellAlternatives *pAlt = new SpellAlternatives;
+rtl::Reference pAlt = new SpellAlternatives;
 pAlt->SetWordLanguage( rWord, nLang );
 pAlt->SetFailureType( SpellFailure::SPELLING_ERROR );
 pAlt->SetAlternatives( aStr );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source solenv/clang-format

2020-11-12 Thread Philipp Hofer (via logerrit)
 lingucomponent/source/languageguessing/simpleguesser.hxx |4 ++--
 solenv/clang-format/excludelist  |1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit f0126ffa6469d6c43f04596cb6f5ca83919ef8fc
Author: Philipp Hofer 
AuthorDate: Thu Nov 12 13:05:40 2020 +0100
Commit: Mike Kaganski 
CommitDate: Fri Nov 13 08:22:27 2020 +0100

tdf#123936 Formatting files in module lingucomponent with clang-format

Change-Id: Ia156fe8eb259fda0c23275fcaebc6b37790f11f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105688
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/lingucomponent/source/languageguessing/simpleguesser.hxx 
b/lingucomponent/source/languageguessing/simpleguesser.hxx
index 34abf26d4fcf..ac9ef7a3a3a7 100644
--- a/lingucomponent/source/languageguessing/simpleguesser.hxx
+++ b/lingucomponent/source/languageguessing/simpleguesser.hxx
@@ -29,7 +29,8 @@
 
 using namespace std;
 
-class SimpleGuesser final {
+class SimpleGuesser final
+{
 public:
 /**inits the object with conf file "./conf.txt"*/
 SimpleGuesser();
@@ -96,7 +97,6 @@ public:
 void SetDBPath(const char* thePathOfConfFile, const char* prefix);
 
 private:
-
 //Where typical fingerprints (n-gram tables) are stored
 void* h;
 
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 01d6908c98b8..ab5083590fce 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -7502,7 +7502,6 @@ lingucomponent/source/languageguessing/guess.cxx
 lingucomponent/source/languageguessing/guess.hxx
 lingucomponent/source/languageguessing/guesslang.cxx
 lingucomponent/source/languageguessing/simpleguesser.cxx
-lingucomponent/source/languageguessing/simpleguesser.hxx
 lingucomponent/source/lingutil/lingutil.cxx
 lingucomponent/source/lingutil/lingutil.hxx
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2020-10-02 Thread Stephan Bergmann (via logerrit)
 lingucomponent/source/hyphenator/hyphen/hyphen.component   |2 +-
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx  |5 ++---
 lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component |2 +-
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm|5 ++---
 lingucomponent/source/spellcheck/spell/spell.component |2 +-
 lingucomponent/source/spellcheck/spell/sspellimp.cxx   |5 ++---
 lingucomponent/source/thesaurus/libnth/lnth.component  |2 +-
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx|5 ++---
 8 files changed, 12 insertions(+), 16 deletions(-)

New commits:
commit cf7638fd051773efcc78ea9610030354d4d15665
Author: Stephan Bergmann 
AuthorDate: Fri Oct 2 14:23:42 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 2 20:43:22 2020 +0200

Use the new single-instance="true" attribute in lingucomponent

Change-Id: I802ee5ac618aa706b126630c8bb4e7e2e83c59f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103852
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphen.component 
b/lingucomponent/source/hyphenator/hyphen/hyphen.component
index 0d775423dd5c..b9bc8b1f36ca 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphen.component
+++ b/lingucomponent/source/hyphenator/hyphen/hyphen.component
@@ -20,7 +20,7 @@
 http://openoffice.org/2010/uno-components;>
   
+constructor="lingucomponent_Hyphenator_get_implementation" 
single-instance="true">
 
   
 
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 8c7d09ac66e6..988306757a96 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -803,9 +804,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 lingucomponent_Hyphenator_get_implementation(
 css::uno::XComponentContext* , css::uno::Sequence const&)
 {
-static rtl::Reference g_Instance(new Hyphenator());
-g_Instance->acquire();
-return static_cast(g_Instance.get());
+return cppu::acquire(static_cast(new Hyphenator()));
 }
 
 
diff --git a/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component 
b/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
index f318df2abfec..b1fe7d612aa8 100644
--- a/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
+++ b/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
@@ -20,7 +20,7 @@
 http://openoffice.org/2010/uno-components;>
   
+constructor="lingucomponent_MacSpellChecker_get_implementation" 
single-instance="true">
 
   
 
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index c3f64635e071..74b365c71746 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -634,9 +635,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 lingucomponent_MacSpellChecker_get_implementation(
 css::uno::XComponentContext* , css::uno::Sequence const&)
 {
-static rtl::Reference g_Instance(new MacSpellChecker());
-g_Instance->acquire();
-return static_cast(g_Instance.get());
+return cppu::acquire(static_cast(new 
MacSpellChecker()));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lingucomponent/source/spellcheck/spell/spell.component 
b/lingucomponent/source/spellcheck/spell/spell.component
index 59f634eab02a..c284e13fc3a7 100644
--- a/lingucomponent/source/spellcheck/spell/spell.component
+++ b/lingucomponent/source/spellcheck/spell/spell.component
@@ -20,7 +20,7 @@
 http://openoffice.org/2010/uno-components;>
   
+constructor="lingucomponent_SpellChecker_get_implementation" 
single-instance="true">
 
   
 
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 23bd9e014c29..051b29c60d4e 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -635,9 +636,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 lingucomponent_SpellChecker_get_implementation(
 css::uno::XComponentContext* , css::uno::Sequence const&)
 {
-static rtl::Reference g_Instance(new SpellChecker());
-g_Instance->acquire();
-return static_cast(g_Instance.get());
+return cppu::acquire(static_cast(new SpellChecker()));
 }
 
 
diff --git 

[Libreoffice-commits] core.git: lingucomponent/source

2020-07-20 Thread Noel Grandin (via logerrit)
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 09974c595adf81fde90dfa27ccac771d1f0ecfff
Author: Noel Grandin 
AuthorDate: Mon Jul 20 12:39:11 2020 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 20 22:00:09 2020 +0200

this should be a single-instance component

regression from
commit 3fbadfa1ad41a3477804c592e06caec708c05218
lingucomponent: create instances with uno constructors

Change-Id: Ie53c56a88dc1c15178219b0098803586164837da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99038
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index b50e0048689e..8c7d09ac66e6 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -803,7 +803,9 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 lingucomponent_Hyphenator_get_implementation(
 css::uno::XComponentContext* , css::uno::Sequence const&)
 {
-return cppu::acquire(new Hyphenator());
+static rtl::Reference g_Instance(new Hyphenator());
+g_Instance->acquire();
+return static_cast(g_Instance.get());
 }
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source linguistic/source

2020-07-20 Thread Noel Grandin (via logerrit)
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx |5 -
 linguistic/source/lngsvcmgr.cxx |3 +--
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit fed392061613f71ecd04a485a8ec0de0595b441c
Author: Noel Grandin 
AuthorDate: Mon Jul 20 12:49:02 2020 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 20 17:28:33 2020 +0200

fix SAL_WARN when instantiating Thesaurus

Before
commit 3fbadfa1ad41a3477804c592e06caec708c05218
lingucomponent: create instances with uno constructors
Thesaurus was constructed but Thesaurus::initialize was NOT being called
from GetAvailLocales.

However, we have some code marked "HACK" in
   cppuhelper/source/servicemanager.cxx
i.e.
   ServiceManager::createInstanceWithArguments
which DOES call initialize.

And we have code in GetAvailLocales which passes what Thesuarus
considers an invalid number of arguments, because all the other similar
services DO take 2 args (even though they don't use the second arg!)

So we have a bunch of temporary hack and backwards compat stuff
interacting, causing a SAL_WARN.

So make Thesauras::initialize a little more tolerant, which means we're
now initialising it, which is a change in behaviour, so if this commit
comes up a regression, we will need find another warn to stop the
warning.

Change-Id: I60e0ed1bd2d4fbccbc539b5536aba055a7dfc6c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99039
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx 
b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
index 11f557cd1d54..a8b32bd4727f 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
@@ -466,10 +466,13 @@ void SAL_CALL Thesaurus::initialize( const Sequence< Any 
>& rArguments )
 return;
 
 sal_Int32 nLen = rArguments.getLength();
-if (1 == nLen)
+// Accept one of two args so we can be compatible with the call site in 
GetAvailLocales()
+// linguistic module
+if (1 == nLen || 2 == nLen)
 {
 Reference< XLinguProperties >   xPropSet;
 rArguments.getConstArray()[0] >>= xPropSet;
+assert(xPropSet);
 
 //! Pointer allows for access of the non-UNO functions.
 //! And the reference to the UNO-functions while increasing
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 5c741fdd05e2..5891dbbd4fb1 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -73,8 +73,7 @@ static uno::Sequence< lang::Locale > GetAvailLocales(
 {
 std::set< LanguageType > aLanguages;
 
-//! since we're going to create one-instance services we have to
-//! supply their arguments even if we would not need them here...
+// All of these services only use one arg, but need two args for 
compat reasons
 uno::Sequence< uno::Any > aArgs(2);
 aArgs.getArray()[0] <<= GetLinguProperties();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source solenv/bin

2020-07-18 Thread Noel Grandin (via logerrit)
 lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component |5 -
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx   |8 -
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm|   50 
+-
 solenv/bin/native-code.py  |3 
 4 files changed, 13 insertions(+), 53 deletions(-)

New commits:
commit d9b7ddd24d379909f9cd2d83ce28fa619953d841
Author: Noel Grandin 
AuthorDate: Thu Jul 16 18:58:25 2020 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 18 19:07:53 2020 +0200

lingucomponent/spell: create instances with uno constructors

See tdf#74608 for motivation.

Change-Id: I850e5b243750cbe168136907523d1ada7050c453
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98924
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component 
b/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
index 92807d4b3dfc..f318df2abfec 100644
--- a/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
+++ b/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
@@ -18,8 +18,9 @@
  -->
 
 http://openoffice.org/2010/uno-components;>
-  
+xmlns="http://openoffice.org/2010/uno-components;>
+  
 
   
 
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index 0adc1a1cbf2f..dc9ad055d3bc 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -116,16 +116,8 @@ public:
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) 
override;
 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
-
-static inline OUString  getImplementationName_Static() throw();
-static Sequence< OUString > getSupportedServiceNames_Static() throw();
 };
 
-inline OUString MacSpellChecker::getImplementationName_Static() throw()
-{
-return "org.openoffice.lingu.MacOSXSpellChecker";
-}
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 1d6f84fcce78..c3f64635e071 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -514,16 +514,6 @@ Reference< XSpellAlternatives > SAL_CALL
 return xAlt;
 }
 
-/// @throws Exception
-static Reference< XInterface > MacSpellChecker_CreateInstance(
-const Reference< XMultiServiceFactory > & /*rSMgr*/ )
-{
-
-Reference< XInterface > xService = static_cast(new 
MacSpellChecker);
-return xService;
-}
-
-
 sal_Bool SAL_CALL
 MacSpellChecker::addLinguServiceEventListener(
 const Reference< XLinguServiceEventListener >& rxLstnr )
@@ -627,7 +617,7 @@ void SAL_CALL
 // Service specific part
 OUString SAL_CALL MacSpellChecker::getImplementationName()
 {
-return getImplementationName_Static();
+return "org.openoffice.lingu.MacOSXSpellChecker";
 }
 
 sal_Bool SAL_CALL MacSpellChecker::supportsService( const OUString& 
ServiceName )
@@ -637,40 +627,16 @@ sal_Bool SAL_CALL MacSpellChecker::supportsService( const 
OUString& ServiceName
 
 Sequence< OUString > SAL_CALL MacSpellChecker::getSupportedServiceNames()
 {
-return getSupportedServiceNames_Static();
-}
-
-Sequence< OUString > MacSpellChecker::getSupportedServiceNames_Static()
-throw()
-{
-Sequence< OUString > aSNS { SN_SPELLCHECKER };
-return aSNS;
+return { SN_SPELLCHECKER };
 }
 
-extern "C"
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+lingucomponent_MacSpellChecker_get_implementation(
+css::uno::XComponentContext* , css::uno::Sequence const&)
 {
-
-SAL_DLLPUBLIC_EXPORT void * MacOSXSpell_component_getFactory(
-const char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
-{
-void * pRet = nullptr;
-if ( MacSpellChecker::getImplementationName_Static().equalsAscii( 
pImplName ) )
-{
-Reference< XSingleServiceFactory > xFactory =
-cppu::createOneInstanceFactory(
-static_cast< XMultiServiceFactory * >( pServiceManager ),
-MacSpellChecker::getImplementationName_Static(),
-MacSpellChecker_CreateInstance,
-MacSpellChecker::getSupportedServiceNames_Static());
-// acquire, because we return an interface pointer instead of a 
reference
-xFactory->acquire();
-pRet = xFactory.get();
-}
-return pRet;
+static rtl::Reference g_Instance(new MacSpellChecker());
+g_Instance->acquire();
+return static_cast(g_Instance.get());
 }
 
-}
-
-
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff 

[Libreoffice-commits] core.git: lingucomponent/source solenv/bin

2020-07-14 Thread Noel Grandin (via logerrit)
 lingucomponent/source/hyphenator/hyphen/hyphen.component   |5 -
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx  |   42 +-
 lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx  |8 -
 lingucomponent/source/languageguessing/guesslang.component |5 -
 lingucomponent/source/languageguessing/guesslang.cxx   |   53 +
 lingucomponent/source/numbertext/numbertext.component  |5 -
 lingucomponent/source/numbertext/numbertext.cxx|   43 ++
 lingucomponent/source/spellcheck/spell/spell.component |5 -
 lingucomponent/source/spellcheck/spell/sspellimp.cxx   |   46 +--
 lingucomponent/source/spellcheck/spell/sspellimp.hxx   |8 -
 lingucomponent/source/thesaurus/libnth/lnth.component  |5 -
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx|   45 +--
 lingucomponent/source/thesaurus/libnth/nthesimp.hxx|   10 --
 solenv/bin/native-code.py  |   11 +-
 14 files changed, 59 insertions(+), 232 deletions(-)

New commits:
commit 3fbadfa1ad41a3477804c592e06caec708c05218
Author: Noel Grandin 
AuthorDate: Tue Jul 14 10:16:47 2020 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 14 12:04:06 2020 +0200

lingucomponent: create instances with uno constructors

See tdf#74608 for motivation.

Change-Id: I11770c8873d14cfd0e438fb580d8d0ea9e99f594
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98709
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphen.component 
b/lingucomponent/source/hyphenator/hyphen/hyphen.component
index ea9298e464a0..0d775423dd5c 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphen.component
+++ b/lingucomponent/source/hyphenator/hyphen/hyphen.component
@@ -18,8 +18,9 @@
  -->
 
 http://openoffice.org/2010/uno-components;>
-  
+xmlns="http://openoffice.org/2010/uno-components;>
+  
 
   
 
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index d03aaf1df0ea..b50e0048689e 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -692,14 +692,6 @@ OUString Hyphenator::makeInitCap(const OUString& aTerm, 
CharClass const * pCC)
 return aTerm;
 }
 
-/// @throws Exception
-static Reference< XInterface > Hyphenator_CreateInstance(
-const Reference< XMultiServiceFactory > & /*rSMgr*/ )
-{
-Reference< XInterface > xService = static_cast(new 
Hyphenator);
-return xService;
-}
-
 sal_Bool SAL_CALL Hyphenator::addLinguServiceEventListener(
 const Reference< XLinguServiceEventListener >& rxLstnr )
 {
@@ -794,7 +786,7 @@ void SAL_CALL Hyphenator::removeEventListener( const 
Reference< XEventListener >
 // Service specific part
 OUString SAL_CALL Hyphenator::getImplementationName()
 {
-return getImplementationName_Static();
+return "org.openoffice.lingu.LibHnjHyphenator";
 }
 
 sal_Bool SAL_CALL Hyphenator::supportsService( const OUString& ServiceName )
@@ -804,37 +796,15 @@ sal_Bool SAL_CALL Hyphenator::supportsService( const 
OUString& ServiceName )
 
 Sequence< OUString > SAL_CALL Hyphenator::getSupportedServiceNames()
 {
-return getSupportedServiceNames_Static();
+return { SN_HYPHENATOR };
 }
 
-Sequence< OUString > Hyphenator::getSupportedServiceNames_Static()
-throw()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+lingucomponent_Hyphenator_get_implementation(
+css::uno::XComponentContext* , css::uno::Sequence const&)
 {
-Sequence< OUString > aSNS { SN_HYPHENATOR };
-return aSNS;
+return cppu::acquire(new Hyphenator());
 }
 
-extern "C"
-{
-
-SAL_DLLPUBLIC_EXPORT void * hyphen_component_getFactory(
-const char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
-{
-void * pRet = nullptr;
-if ( Hyphenator::getImplementationName_Static().equalsAscii( pImplName ) )
-{
-Reference< XSingleServiceFactory > xFactory =
-cppu::createOneInstanceFactory(
-static_cast< XMultiServiceFactory * >( pServiceManager ),
-Hyphenator::getImplementationName_Static(),
-Hyphenator_CreateInstance,
-Hyphenator::getSupportedServiceNames_Static());
-// acquire, because we return an interface pointer instead of a 
reference
-xFactory->acquire();
-pRet = xFactory.get();
-}
-return pRet;
-}
 
-}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
index d5103b8e7aa5..9ab7df50879b 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
@@ -114,20 +114,12 @@ public:
 virtual sal_Bool SAL_CALL supportsService( const 

[Libreoffice-commits] core.git: lingucomponent/source

2020-07-01 Thread Stephan Bergmann (via logerrit)
 lingucomponent/source/languageguessing/guesslang.cxx |2 +-
 lingucomponent/source/numbertext/numbertext.cxx  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5ab5f2d8656a1a0f3c9631e767687f9bb51a6913
Author: Stephan Bergmann 
AuthorDate: Wed Jul 1 11:35:26 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jul 1 14:17:38 2020 +0200

Upcoming improved loplugin:staticanonymous -> redundantstatic: 
lingucomponent

Change-Id: I70423a669527f2ce6ec25f58b8c409c0e2231962
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97604
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/languageguessing/guesslang.cxx 
b/lingucomponent/source/languageguessing/guesslang.cxx
index 7e9d1999b919..4f73e5e008a2 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -333,7 +333,7 @@ static Reference< XInterface > LangGuess_Impl_create(
 }
 
 // EXPORTED ### functions to allow for registration and creation of the 
UNO component
-static const struct ::cppu::ImplementationEntry s_component_entries [] =
+const struct ::cppu::ImplementationEntry s_component_entries [] =
 {
 {
 LangGuess_Impl_create, getImplementationName_LangGuess_Impl,
diff --git a/lingucomponent/source/numbertext/numbertext.cxx 
b/lingucomponent/source/numbertext/numbertext.cxx
index 34e7694601a3..71927a7ac9c7 100644
--- a/lingucomponent/source/numbertext/numbertext.cxx
+++ b/lingucomponent/source/numbertext/numbertext.cxx
@@ -175,7 +175,7 @@ static Reference 
NumberText_Impl_create(Reference
 }
 
 // EXPORTED ### functions to allow for registration and creation of the 
UNO component
-static const struct ::cppu::ImplementationEntry s_component_entries[]
+const struct ::cppu::ImplementationEntry s_component_entries[]
 = { { NumberText_Impl_create, getImplementationName_NumberText_Impl,
   getSupportedServiceNames_NumberText_Impl, 
::cppu::createSingleComponentFactory, nullptr,
   0 },
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source sw/qa

2020-06-18 Thread László Németh (via logerrit)
 lingucomponent/source/numbertext/numbertext.cxx |   25 
 sw/qa/extras/uiwriter/uiwriter.cxx  |2 -
 2 files changed, 21 insertions(+), 6 deletions(-)

New commits:
commit 41f926e7a8adf92e73a810227e049ec83ab104bf
Author: László Németh 
AuthorDate: Wed Jun 17 21:35:39 2020 +0200
Commit: László Németh 
CommitDate: Thu Jun 18 11:17:08 2020 +0200

tdf#133589 Numbertext: fix Hung encoding on Windows

Workaround to fix non-BMP Unicode characters in
the case of Hung (Old Hungarian) module, resulted by
std::wstring limitation on Windows.

Change-Id: I4f6a72ad0e3d4f70ef7e35910bb4147aedb0e4ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96562
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/lingucomponent/source/numbertext/numbertext.cxx 
b/lingucomponent/source/numbertext/numbertext.cxx
index 70324c7027b2..89f5432624bf 100644
--- a/lingucomponent/source/numbertext/numbertext.cxx
+++ b/lingucomponent/source/numbertext/numbertext.cxx
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -132,11 +133,27 @@ OUString SAL_CALL NumberText_Impl::getNumberText(const 
OUString& rText, const Lo
 aCode += "-" + aCountry;
 OString aLangCode(OUStringToOString(aCode, RTL_TEXTENCODING_ASCII_US));
 OString aInput(OUStringToOString(rText, RTL_TEXTENCODING_UTF8));
-std::wstring aResult = Numbertext::string2wstring(aInput.getStr());
-bool result = m_aNumberText.numbertext(aResult, aLangCode.getStr());
+std::wstring sResult = Numbertext::string2wstring(aInput.getStr());
+bool result = m_aNumberText.numbertext(sResult, aLangCode.getStr());
 DBG_ASSERT(result, "numbertext: false");
-OString aResult2(Numbertext::wstring2string(aResult).c_str());
-return OUString::fromUtf8(aResult2);
+OUString aResult = 
OUString::fromUtf8(Numbertext::wstring2string(sResult).c_str());
+#if defined(_WIN32)
+// workaround to fix non-BMP Unicode characters resulted by wstring 
limitation
+if (!aScript.isEmpty() && aScript == "Hung")
+{
+OUStringBuffer aFix;
+for (int i = 0; i < aResult.getLength(); ++i)
+{
+sal_Unicode c = aResult[i];
+if (0x0C80 <= c && c <= 0x0CFF)
+aFix.append(sal_Unicode(0xD803)).append(sal_Unicode(c + 
0xD000));
+else
+aFix.append(c);
+}
+aResult = aFix.makeStringAndClear();
+}
+#endif
+return aResult;
 }
 
 uno::Sequence SAL_CALL NumberText_Impl::getAvailableLanguages()
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 6851037952fc..1fff27fff064 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -7275,7 +7275,6 @@ void SwUiWriterTest::testTdf128860()
 
 void SwUiWriterTest::testTdf133589()
 {
-#if !defined(_WIN32)
 // Hungarian test document with right-to-left paragraph setting
 SwDoc* pDoc = createDoc("tdf133589.fodt");
 SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
@@ -7307,7 +7306,6 @@ void SwUiWriterTest::testTdf133589()
 nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
 sReplaced += u"೺೺೿೼೼ ";
 CPPUNIT_ASSERT_EQUAL(sReplaced, 
static_cast(pDoc->GetNodes()[nIndex])->GetText());
-#endif
 }
 
 #if HAVE_FEATURE_PDFIUM
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2020-04-07 Thread Noel Grandin (via logerrit)
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |   36 ++---
 lingucomponent/source/languageguessing/guess.cxx  |   73 +--
 lingucomponent/source/languageguessing/guesslang.cxx  |   80 ++---
 lingucomponent/source/lingutil/lingutil.cxx   |  110 +-
 lingucomponent/source/numbertext/numbertext.cxx   |   30 ++--
 lingucomponent/source/spellcheck/spell/sspellimp.cxx  |   36 ++---
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx   |   32 ++---
 7 files changed, 198 insertions(+), 199 deletions(-)

New commits:
commit 35f9dec3645f7a4a8d1f7f9dfb62e28d73bc5244
Author: Noel Grandin 
AuthorDate: Tue Apr 7 10:55:00 2020 +0200
Commit: Noel Grandin 
CommitDate: Tue Apr 7 13:10:29 2020 +0200

loplugin:flatten in lingucomponent

Change-Id: Ic0bf912a22e8efeae1a4f4864397f3f3d474c632
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91803
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index e6692a1d0b50..d03aaf1df0ea 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -736,25 +736,25 @@ void SAL_CALL Hyphenator::initialize( const Sequence< Any 
>& rArguments )
 {
 MutexGuard  aGuard( GetLinguMutex() );
 
-if (!pPropHelper)
+if (pPropHelper)
+return;
+
+sal_Int32 nLen = rArguments.getLength();
+if (2 == nLen)
 {
-sal_Int32 nLen = rArguments.getLength();
-if (2 == nLen)
-{
-Reference< XLinguProperties >   xPropSet;
-rArguments.getConstArray()[0] >>= xPropSet;
-// rArguments.getConstArray()[1] >>= xDicList;
-
-//! Pointer allows for access of the non-UNO functions.
-//! And the reference to the UNO-functions while increasing
-//! the ref-count and will implicitly free the memory
-//! when the object is no longer used.
-pPropHelper.reset( new PropertyHelper_Hyphenation( 
static_cast(this), xPropSet ) );
-pPropHelper->AddAsPropListener();   //! after a reference is 
established
-}
-else {
-OSL_FAIL( "wrong number of arguments in sequence" );
-}
+Reference< XLinguProperties >   xPropSet;
+rArguments.getConstArray()[0] >>= xPropSet;
+// rArguments.getConstArray()[1] >>= xDicList;
+
+//! Pointer allows for access of the non-UNO functions.
+//! And the reference to the UNO-functions while increasing
+//! the ref-count and will implicitly free the memory
+//! when the object is no longer used.
+pPropHelper.reset( new PropertyHelper_Hyphenation( 
static_cast(this), xPropSet ) );
+pPropHelper->AddAsPropListener();   //! after a reference is 
established
+}
+else {
+OSL_FAIL( "wrong number of arguments in sequence" );
 }
 }
 
diff --git a/lingucomponent/source/languageguessing/guess.cxx 
b/lingucomponent/source/languageguessing/guess.cxx
index a2f3be35382b..45700ff7d1ff 100644
--- a/lingucomponent/source/languageguessing/guess.cxx
+++ b/lingucomponent/source/languageguessing/guess.cxx
@@ -58,47 +58,46 @@ Guess::Guess(const char * guess_str)
 , country_str(DEFAULT_COUNTRY)
 {
 //if the guess is not like "UNKNOWN" or "SHORT", go into the brackets
-if(strcmp(guess_str + 1, TEXTCAT_RESULT_UNKNOWN_STR) != 0
-   &&
-   strcmp(guess_str + 1, TEXTCAT_RESULT_SHORT_STR) != 0)
-{
-// From how this ctor is called from SimpleGuesser::GuessLanguage and
-// SimpleGuesser::GetManagedLanguages in
-// lingucomponent/source/languageguessing/simpleguesser.cxx, guess_str 
must start with "[":
-assert(guess_str[0] == GUESS_SEPARATOR_OPEN);
-auto const start = guess_str + 1;
-// Only look at the prefix of guess_str, delimited by the next "]" or 
"[" or end-of-string;
-// split it into at most three segments separated by "-" (where excess 
occurrences of "-"
-// would become part of the third segment), like "en-US-utf8"; the 
first segment denotes the
-// language; if there are three segments, the second denotes the 
country and the third the
-// encoding; otherwise, the second segment, if any (e.g., in 
"haw-utf8"), denotes the
-// encoding:
-char const * dash1 = nullptr;
-char const * dash2 = nullptr;
-auto p = start;
-for (;; ++p) {
-auto const c = *p;
-if (c == '\0' || c == GUESS_SEPARATOR_OPEN || c == 
GUESS_SEPARATOR_CLOSE) {
+if(strcmp(guess_str + 1, TEXTCAT_RESULT_UNKNOWN_STR) == 0
+   || strcmp(guess_str + 1, TEXTCAT_RESULT_SHORT_STR) == 0)
+return;
+
+// From how this ctor is called from SimpleGuesser::GuessLanguage and
+// SimpleGuesser::GetManagedLanguages in
+// 

[Libreoffice-commits] core.git: lingucomponent/source

2019-10-09 Thread Stephan Bergmann (via logerrit)
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx |2 +-
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c63ec2a923b8e06df01593677ca90a271084ca04
Author: Stephan Bergmann 
AuthorDate: Wed Oct 9 23:15:09 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Oct 10 00:05:53 2019 +0200

loplugin:redundantpointerops (macOS)

Change-Id: I40d51fbdd712d1e6e64cede05338c07a06261d8a
Reviewed-on: https://gerrit.libreoffice.org/80568
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index a750a849144e..0adc1a1cbf2f 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -79,7 +79,7 @@ class MacSpellChecker :
 linguistic::PropertyHelper_Spell &  GetPropHelper_Impl();
 linguistic::PropertyHelper_Spell &  GetPropHelper()
 {
-return xPropHelper.is() ? *xPropHelper.get() : GetPropHelper_Impl();
+return xPropHelper.is() ? *xPropHelper : GetPropHelper_Impl();
 }
 
 sal_Int16   GetSpellFailure( const OUString , const Locale  
);
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 31af179f4eaf..ef3d5decb013 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -87,7 +87,7 @@ PropertyHelper_Spell & MacSpellChecker::GetPropHelper_Impl()
 xPropHelper = new PropertyHelper_Spell( static_cast(this), xPropSet );
 xPropHelper->AddAsPropListener();
 }
-return *xPropHelper.get();
+return *xPropHelper;
 }
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: lingucomponent/source linguistic/source lotuswordpro/source

2019-08-30 Thread Arkadiy Illarionov (via logerrit)
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx   |   60 +--
 lingucomponent/source/languageguessing/guesslang.cxx|   18 -
 lingucomponent/source/spellcheck/spell/sspellimp.cxx|7 
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx |   63 +--
 linguistic/source/convdic.cxx   |   47 --
 linguistic/source/convdiclist.cxx   |   34 -
 linguistic/source/dlistimp.cxx  |   13 
 linguistic/source/gciterator.cxx|   19 -
 linguistic/source/hyphdsp.cxx   |   18 -
 linguistic/source/lngopt.cxx|   30 -
 linguistic/source/lngprophelp.cxx   |  149 +++-
 linguistic/source/lngsvcmgr.cxx |  279 +---
 linguistic/source/misc.cxx  |   65 +--
 linguistic/source/misc2.cxx |   26 -
 linguistic/source/spelldsp.cxx  |   38 --
 linguistic/source/spelldta.cxx  |8 
 linguistic/source/thesdsp.cxx   |   29 -
 lotuswordpro/source/filter/LotusWordProImportFilter.cxx |   26 -
 18 files changed, 341 insertions(+), 588 deletions(-)

New commits:
commit 760a377f7148e623e9e16d24e66f54a401ecb946
Author: Arkadiy Illarionov 
AuthorDate: Thu Aug 29 00:51:02 2019 +0300
Commit: Arkadiy Illarionov 
CommitDate: Fri Aug 30 14:15:57 2019 +0200

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 
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov 

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index bd38e3d470d4..2008395319e0 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -19,6 +19,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -51,6 +52,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -113,11 +115,10 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
 uno::Sequence< OUString > aFormatList;
 aLinguCfg.GetSupportedDictionaryFormatsFor( "Hyphenators",
 "org.openoffice.lingu.LibHnjHyphenator", aFormatList );
-sal_Int32 nLen = aFormatList.getLength();
-for (sal_Int32 i = 0;  i < nLen;  ++i)
+for (const auto& rFormat : std::as_const(aFormatList))
 {
 std::vector< SvtLinguConfigDictionaryEntry > aTmpDic(
-aLinguCfg.GetActiveDictionariesByFormat( aFormatList[i] ) 
);
+aLinguCfg.GetActiveDictionariesByFormat( rFormat ) );
 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
 MergeNewStyleDicsAndOldStyleDics( aDics, aOldStyleDics );
 
-sal_Int32 numdict = aDics.size();
-if (numdict)
+if (!aDics.empty())
 {
 // get supported locales from the dictionaries-to-use...
-sal_Int32 k = 0;
 std::set aLocaleNamesSet;
 for (auto const& dict : aDics)
 {
-uno::Sequence< OUString > aLocaleNames( dict.aLocaleNames );
-sal_Int32 nLen2 = aLocaleNames.getLength();
-for (k = 0;  k < nLen2;  ++k)
+for (const auto& rLocaleName : dict.aLocaleNames)
 {
-aLocaleNamesSet.insert( aLocaleNames[k] );
+aLocaleNamesSet.insert( rLocaleName );
 }
 }
 // ... and add them to the resulting sequence
-aSuppLocales.realloc( aLocaleNamesSet.size() );
-k = 0;
-for (auto const& localeName :  aLocaleNamesSet)
-{
-Locale aTmp( LanguageTag::convertToLocale(localeName));
-aSuppLocales[k++] = aTmp;
-}
+std::vector aLocalesVec;
+aLocalesVec.reserve(aLocaleNamesSet.size());
+
+std::transform(aLocaleNamesSet.begin(), aLocaleNamesSet.end(), 
std::back_inserter(aLocalesVec),
+[](const OUString& localeName) { return 
LanguageTag::convertToLocale(localeName); });
+
+aSuppLocales = comphelper::containerToSequence(aLocalesVec);
 
 //! For each dictionary and each locale we need a separate entry.
 //! If this results in more than one dictionary per locale than 
(for now)
 //! it is undefined which dictionary gets used.
 //! In the future the implementation should support 

[Libreoffice-commits] core.git: lingucomponent/source

2019-08-10 Thread Stephan Bergmann (via logerrit)
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx |5 +-
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm  |   21 ---
 2 files changed, 11 insertions(+), 15 deletions(-)

New commits:
commit 91e4d876098aaa7ac18a03e20cbc2789fba98041
Author: Stephan Bergmann 
AuthorDate: Sat Aug 10 19:43:29 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Aug 10 22:59:52 2019 +0200

Combine MacSpellChecker p/xPropHelper

Change-Id: Ie5b5ea4863ce39f53ab4ebe2e02dc7ed141627ba
Reviewed-on: https://gerrit.libreoffice.org/77248
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index e26d353455fe..a750a849144e 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -70,8 +70,7 @@ class MacSpellChecker :
 UITextChecker * pChecker;
 #endif
 ::comphelper::OInterfaceContainerHelper2   aEvtListeners;
-Reference< XPropertyChangeListener >xPropHelper;
-linguistic::PropertyHelper_Spell *  pPropHelper;
+rtl::Reference< linguistic::PropertyHelper_Spell >xPropHelper;
 boolbDisposing;
 
 MacSpellChecker(const MacSpellChecker &) = delete;
@@ -80,7 +79,7 @@ class MacSpellChecker :
 linguistic::PropertyHelper_Spell &  GetPropHelper_Impl();
 linguistic::PropertyHelper_Spell &  GetPropHelper()
 {
-return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
+return xPropHelper.is() ? *xPropHelper.get() : GetPropHelper_Impl();
 }
 
 sal_Int16   GetSpellFailure( const OUString , const Locale  
);
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 4c97ead10acb..31af179f4eaf 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -52,7 +52,6 @@ MacSpellChecker::MacSpellChecker() :
 aDLocs = nullptr;
 aDNames = nullptr;
 bDisposing = false;
-pPropHelper = nullptr;
 numdict = 0;
 #ifndef IOS
 NSApplicationLoad();
@@ -74,22 +73,21 @@ MacSpellChecker::~MacSpellChecker()
   aDLocs = nullptr;
   if (aDNames) delete[] aDNames;
   aDNames = nullptr;
-  if (pPropHelper)
- pPropHelper->RemoveAsPropListener();
+  if (xPropHelper.is())
+ xPropHelper->RemoveAsPropListener();
 }
 
 
 PropertyHelper_Spell & MacSpellChecker::GetPropHelper_Impl()
 {
-if (!pPropHelper)
+if (!xPropHelper.is())
 {
 Reference< XLinguProperties >   xPropSet( GetLinguProperties() );
 
-pPropHelper = new PropertyHelper_Spell( static_cast(this), xPropSet );
-xPropHelper = pPropHelper;
-pPropHelper->AddAsPropListener();   //! after a reference is 
established
+xPropHelper = new PropertyHelper_Spell( static_cast(this), xPropSet );
+xPropHelper->AddAsPropListener();
 }
-return *pPropHelper;
+return *xPropHelper.get();
 }
 
 
@@ -570,7 +568,7 @@ void SAL_CALL
 {
 MutexGuard  aGuard( GetLinguMutex() );
 
-if (!pPropHelper)
+if (!xPropHelper.is())
 {
 sal_Int32 nLen = rArguments.getLength();
 if (2 == nLen)
@@ -583,9 +581,8 @@ void SAL_CALL
 //! And the reference to the UNO-functions while increasing
 //! the ref-count and will implicitly free the memory
 //! when the object is no longer used.
-pPropHelper = new PropertyHelper_Spell( static_cast(this), xPropSet );
-xPropHelper = pPropHelper;
-pPropHelper->AddAsPropListener();   //! after a reference is 
established
+xPropHelper = new PropertyHelper_Spell( static_cast(this), xPropSet );
+xPropHelper->AddAsPropListener();
 }
 else
 OSL_FAIL( "wrong number of arguments in sequence" );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: lingucomponent/source

2019-08-10 Thread Stephan Bergmann (via logerrit)
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 71074815b80282009923edef75f95ba7f0424c57
Author: Stephan Bergmann 
AuthorDate: Sat Aug 10 12:58:09 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Aug 10 14:43:11 2019 +0200

loplugin:referencecasting (macOS)

Change-Id: I81f5de54c6657f7f8e5ffbd8c4a7c1b7f3cb70c2
Reviewed-on: https://gerrit.libreoffice.org/77238
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 0fad4078e32e..edc801c4b20a 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -83,7 +83,7 @@ PropertyHelper_Spell & MacSpellChecker::GetPropHelper_Impl()
 {
 if (!pPropHelper)
 {
-Reference< XLinguProperties >   xPropSet( GetLinguProperties(), 
UNO_QUERY );
+Reference< XLinguProperties >   xPropSet( GetLinguProperties() );
 
 pPropHelper = new PropertyHelper_Spell( static_cast(this), xPropSet );
 xPropHelper = pPropHelper;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: lingucomponent/source

2019-07-19 Thread Andrea Gelmini (via logerrit)
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit cb99b4429142511d0520ad3b5bc89c83bc451657
Author: Andrea Gelmini 
AuthorDate: Thu Jul 11 22:22:52 2019 +
Commit: Julien Nabet 
CommitDate: Fri Jul 19 10:01:14 2019 +0200

Fix typo

Change-Id: I542d694bbab6ce8d07bee9345db70a64a2fc0963
Reviewed-on: https://gerrit.libreoffice.org/75924
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index bc4d91038a25..87cb8583f8e6 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -299,7 +299,7 @@ Reference< XHyphenatedWord > SAL_CALL 
Hyphenator::hyphenate( const OUString& aWo
 return nullptr;
 }
 
-// other wise hyphenate the word with that dictionary
+// otherwise hyphenate the word with that dictionary
 dict = mvDicts[k].aPtr;
 eEnc = mvDicts[k].eEnc;
 CharClass * pCC =  mvDicts[k].apCC.get();
@@ -539,7 +539,7 @@ Reference< XPossibleHyphens > SAL_CALL 
Hyphenator::createPossibleHyphens( const
 return nullptr;
 }
 
-// other wise hyphenate the word with that dictionary
+// otherwise hyphenate the word with that dictionary
 dict = mvDicts[k].aPtr;
 rtl_TextEncoding eEnc = mvDicts[k].eEnc;
 CharClass* pCC = mvDicts[k].apCC.get();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: lingucomponent/source linguistic/source oox/source package/source pyuno/source reportdesign/source

2019-05-17 Thread Arkadiy Illarionov (via logerrit)
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |6 ++---
 lingucomponent/source/spellcheck/spell/sspellimp.cxx  |6 ++---
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx   |   14 ++--
 linguistic/source/gciterator.cxx  |4 +--
 linguistic/source/hyphdsp.cxx |   14 ++--
 linguistic/source/lngsvcmgr.cxx   |   20 +-
 linguistic/source/spelldsp.cxx|8 +++
 linguistic/source/thesdsp.cxx |8 +++
 oox/source/core/filterbase.cxx|2 -
 oox/source/core/filterdetect.cxx  |2 -
 oox/source/core/xmlfilterbase.cxx |2 -
 oox/source/drawingml/chart/chartspaceconverter.cxx|4 +--
 oox/source/drawingml/customshapeproperties.cxx|2 -
 oox/source/drawingml/shape.cxx|6 ++---
 oox/source/export/chartexport.cxx |   10 -
 oox/source/export/drawingml.cxx   |   20 +-
 oox/source/export/shapes.cxx  |2 -
 oox/source/helper/zipstorage.cxx  |2 -
 oox/source/ole/olestorage.cxx |2 -
 package/source/xstor/owriteablestream.cxx |8 +++
 package/source/xstor/xstorage.cxx |2 -
 package/source/zipapi/XBufferedThreadedStream.cxx |2 -
 package/source/zipapi/XUnbufferedStream.cxx   |8 +++
 package/source/zipapi/ZipFile.cxx |   20 +-
 package/source/zipapi/ZipOutputEntry.cxx  |2 -
 package/source/zippackage/ZipPackage.cxx  |   16 +++---
 package/source/zippackage/ZipPackageFolder.cxx|2 -
 package/source/zippackage/ZipPackageStream.cxx|   16 +++---
 package/source/zippackage/zipfileaccess.cxx   |2 -
 pyuno/source/module/pyuno_adapter.cxx |2 -
 reportdesign/source/core/api/ReportDefinition.cxx |2 -
 reportdesign/source/filter/xml/xmlControlProperty.cxx |2 -
 reportdesign/source/filter/xml/xmlExport.cxx  |2 -
 reportdesign/source/ui/dlg/GroupExchange.cxx  |2 -
 reportdesign/source/ui/dlg/GroupsSorting.cxx  |8 +++
 reportdesign/source/ui/dlg/Navigator.cxx  |2 -
 reportdesign/source/ui/report/ReportController.cxx|   16 +++---
 reportdesign/source/ui/report/ReportSection.cxx   |2 -
 reportdesign/source/ui/report/ViewsWindow.cxx |2 -
 reportdesign/source/ui/report/propbrw.cxx |4 +--
 40 files changed, 128 insertions(+), 128 deletions(-)

New commits:
commit 0e4c542f7a862e681baf25f042bc3a928c14004f
Author: Arkadiy Illarionov 
AuthorDate: Fri May 3 22:11:02 2019 +0300
Commit: Michael Stahl 
CommitDate: Fri May 17 11:20:15 2019 +0200

Use hasElements to check Sequence emptiness in [l-r]*

Similar to clang-tidy readability-container-size-empty

Change-Id: Idd67f332b04857a39df26bad1733aae21236f105
Reviewed-on: https://gerrit.libreoffice.org/71764
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 8ad50fa36915..bc4d91038a25 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -171,8 +171,8 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
 k = 0;
 for (auto const& dict :  aDics)
 {
-if (dict.aLocaleNames.getLength() > 0 &&
-dict.aLocations.getLength() > 0)
+if (dict.aLocaleNames.hasElements() &&
+dict.aLocations.hasElements())
 {
 uno::Sequence< OUString > aLocaleNames(dict.aLocaleNames);
 sal_Int32 nLocales = aLocaleNames.getLength();
@@ -218,7 +218,7 @@ sal_Bool SAL_CALL Hyphenator::hasLocale(const Locale& 
rLocale)
 MutexGuard  aGuard( GetLinguMutex() );
 
 bool bRes = false;
-if (!aSuppLocales.getLength())
+if (!aSuppLocales.hasElements())
 getLocales();
 
 const Locale *pLocale = aSuppLocales.getConstArray();
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 3462899714a2..64032ad14b2d 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -197,8 +197,8 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 m_DictItems.reserve(nDictSize);
 for (auto const& dict : aDics)
 {
-if (dict.aLocaleNames.getLength() > 0 &&
-dict.aLocations.getLength() > 0)
+   

[Libreoffice-commits] core.git: lingucomponent/source

2019-04-24 Thread Tor Lillqvist (via logerrit)
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 81297c29ceb55dec44999e31a11dea81668c3c8f
Author: Tor Lillqvist 
AuthorDate: Wed Apr 24 16:30:39 2019 +0300
Commit: Tor Lillqvist 
CommitDate: Wed Apr 24 16:37:54 2019 +0300

The iOS sv_SE dictionary surely works for sv_FI, too

(I know Swedish, this is not guesswork, there are no orthography
differences.)

Change-Id: I6f652f01dc95aa3a89fec1964c2a49109eb5e30b

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 823687c2cb25..0fad4078e32e 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -227,6 +227,13 @@ Sequence< Locale > SAL_CALL MacSpellChecker::getLocales()
 postspdict.push_back( @"sv_FI" );
 postspdict.push_back( @"sv_SE" );
 }
+#ifdef IOS
+else if ([pLangStr isEqualToString:@"sv_SE"])
+{
+postspdict.push_back( @"sv_FI" );
+postspdict.push_back( @"sv_SE" );
+}
+#endif
 else if ([pLangStr isEqualToString:@"tr"])
 {
 postspdict.push_back( @"tr_TR" );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: lingucomponent/source

2019-04-24 Thread Tor Lillqvist (via logerrit)
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |   14 
 1 file changed, 14 insertions(+)

New commits:
commit dedf339aa14df31c134650660b9aac55bdd8464d
Author: Tor Lillqvist 
AuthorDate: Wed Apr 24 16:21:23 2019 +0300
Commit: Tor Lillqvist 
CommitDate: Wed Apr 24 16:26:21 2019 +0300

tdf#124909: Assume the iOS de_DE dictionary works well enough generically

On macOS, the system says it has a generic "de" dictionary. But on
iOS, it says it is specificaly "de_DE". Assume it is good enough for
the other German variants, too, for now.

Change-Id: I745cc02c1ffa774dbcbfdc1d775ce358957f04f8

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index f97c0945afe9..823687c2cb25 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -139,6 +139,20 @@ Sequence< Locale > SAL_CALL MacSpellChecker::getLocales()
 postspdict.push_back( pLangStr );
 }
 }
+#ifdef IOS
+// iOS says it has specifically de_DE, but let's assume it is good 
enough for the other
+// variants, too, for now.
+else if ([pLangStr isEqualToString:@"de_DE"])
+{
+const std::vector aDE
+{ @"AT", @"BE", @"CH", @"DE", @"LI", @"LU" };
+for (auto c: aDE)
+{
+pLangStr = [@"de_" stringByAppendingString: c];
+postspdict.push_back( pLangStr );
+}
+}
+#endif
 else if ([pLangStr isEqualToString:@"en"])
 {
 // System has en_AU, en_CA, en_GB, and en_IN. Add the rest.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: lingucomponent/source

2019-03-27 Thread Stephan Bergmann (via logerrit)
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |1 +
 1 file changed, 1 insertion(+)

New commits:
commit d9a84bebb51417fb9f550744b31cf030ccd982e6
Author: Stephan Bergmann 
AuthorDate: Wed Mar 27 10:50:58 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Mar 27 14:03:33 2019 +0100

loplugin:staticmethods

Change-Id: Ieec779cb0250374004ab7cd5e9ed2b3476ddaed7
Reviewed-on: https://gerrit.libreoffice.org/69806
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index d66e7149ea70..f97c0945afe9 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -445,6 +445,7 @@ Reference< XSpellAlternatives >
 #ifdef MACOSX
 [[NSSpellChecker sharedSpellChecker] setLanguage:aLang];
 NSArray *guesses = [[NSSpellChecker sharedSpellChecker] 
guessesForWordRange:NSMakeRange(0, [aNSStr length]) inString:aNSStr 
language:aLang inSpellDocumentWithTag:0];
+(void) this; // avoid loplugin:staticmethods, the !MACOSX case uses 
'this'
 #else
 NSArray *guesses = [pChecker guessesForWordRange:NSMakeRange(0, 
[aNSStr length]) inString:aNSStr language:aLang];
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: lingucomponent/source vcl/inc vcl/osx

2019-03-17 Thread Libreoffice Gerrit user
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx |5 ++---
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm  |4 ++--
 vcl/inc/osx/salframe.h   |3 ---
 vcl/osx/salframe.cxx |2 +-
 4 files changed, 5 insertions(+), 9 deletions(-)

New commits:
commit 5d1bc45e807dded3041eadeb5483ed67c0b028f0
Author: Stephan Bergmann 
AuthorDate: Fri Mar 15 15:13:16 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Sun Mar 17 16:40:11 2019 +0100

loplugin:typedefparam (macOS)

Change-Id: I50cacafa8bbd90fef15603f0bde3f653f78393ea
Reviewed-on: https://gerrit.libreoffice.org/69305
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index 64fb8ac37f49..084b08c23d0f 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -32,7 +32,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -90,8 +89,8 @@ public:
 virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) override;
 
 // XSpellChecker
-virtual sal_Bool SAL_CALL isValid( const OUString& rWord, const Locale& 
rLocale, const PropertyValues& rProperties ) override;
-virtual Reference< XSpellAlternatives > SAL_CALL spell( const OUString& 
rWord, const Locale& rLocale, const PropertyValues& rProperties ) override;
+virtual sal_Bool SAL_CALL isValid( const OUString& rWord, const Locale& 
rLocale, const css::uno::Sequence& rProperties ) override;
+virtual Reference< XSpellAlternatives > SAL_CALL spell( const OUString& 
rWord, const Locale& rLocale, const css::uno::Sequence& 
rProperties ) override;
 
 // XLinguServiceEventBroadcaster
 virtual sal_Bool SAL_CALL addLinguServiceEventListener( const Reference< 
XLinguServiceEventListener >& rxLstnr ) override;
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 02b130e67c95..9eb7e65244d6 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -358,7 +358,7 @@ sal_Int16 MacSpellChecker::GetSpellFailure( const OUString 
, const Locale
 
 sal_Bool SAL_CALL
 MacSpellChecker::isValid( const OUString& rWord, const Locale& rLocale,
-const PropertyValues& rProperties )
+const css::uno::Sequence& rProperties )
 {
 MutexGuard  aGuard( GetLinguMutex() );
 
@@ -464,7 +464,7 @@ Reference< XSpellAlternatives >
 
 Reference< XSpellAlternatives > SAL_CALL
 MacSpellChecker::spell( const OUString& rWord, const Locale& rLocale,
-const PropertyValues& rProperties )
+const css::uno::Sequence& rProperties )
 {
 MutexGuard  aGuard( GetLinguMutex() );
 
diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h
index e7bb03008db6..2038cf99b33f 100644
--- a/vcl/inc/osx/salframe.h
+++ b/vcl/inc/osx/salframe.h
@@ -43,9 +43,6 @@ class AquaSalTimer;
 class AquaSalInstance;
 class AquaSalMenu;
 
-typedef struct SalFrame::SalPointerState SalPointerState;
-
-
 class AquaSalFrame : public SalFrame
 {
 public:
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index f3f3dda1ec5f..3666f500b36f 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -1422,7 +1422,7 @@ void AquaSalFrame::GetWorkArea( tools::Rectangle& rRect )
 rRect.SetBottom( static_cast(aRect.origin.y + aRect.size.height - 1) 
);
 }
 
-SalPointerState AquaSalFrame::GetPointerState()
+SalFrame::SalPointerState AquaSalFrame::GetPointerState()
 {
 OSX_SALDATA_RUNINMAIN_UNION( GetPointerState(), state )
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: lingucomponent/source

2019-03-12 Thread Libreoffice Gerrit user
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit af836fe33dd42c6043ef70f897c90c8b3ba826a7
Author: Andrea Gelmini 
AuthorDate: Tue Mar 12 01:52:25 2019 +
Commit: Julien Nabet 
CommitDate: Tue Mar 12 07:06:19 2019 +0100

Fix typo

Change-Id: I08c974135f1936e6fc4f992091e5038d66d524c3
Reviewed-on: https://gerrit.libreoffice.org/69073
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 92107c94c136..8ad50fa36915 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -129,7 +129,7 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
 
 // to prefer dictionaries with configuration entries we will only
 // use those old style dictionaries that add a language that
-// is not yet supported by the list od new style dictionaries
+// is not yet supported by the list of new style dictionaries
 MergeNewStyleDicsAndOldStyleDics( aDics, aOldStyleDics );
 
 sal_Int32 numdict = aDics.size();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: lingucomponent/source

2018-11-18 Thread Libreoffice Gerrit user
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx |1 -
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm  |6 +++---
 2 files changed, 3 insertions(+), 4 deletions(-)

New commits:
commit d30eb91f140ffcdf9326b218b03f5ff8607611a9
Author: Stephan Bergmann 
AuthorDate: Sat Nov 17 17:22:57 2018 +0100
Commit: Stephan Bergmann 
CommitDate: Sun Nov 18 12:51:03 2018 +0100

lolugin:staticmethods

Change-Id: I731ad0f55e68ffa7658955c9d8a557da2759fcac
Reviewed-on: https://gerrit.libreoffice.org/63496
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index e0c075ecbc72..64fb8ac37f49 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -80,7 +80,6 @@ class MacSpellChecker :
 }
 
 sal_Int16   GetSpellFailure( const OUString , const Locale  
);
-Reference< XSpellAlternatives > GetProposals( const OUString , const 
Locale  );
 
 public:
 MacSpellChecker();
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 9b4c715b7ba0..1c7434b45054 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -393,9 +393,10 @@ sal_Bool SAL_CALL
 return (nFailure == -1);
 }
 
+namespace {
 
 Reference< XSpellAlternatives >
-MacSpellChecker::GetProposals( const OUString , const Locale 
 )
+GetProposals( const OUString , const Locale  )
 {
 // Retrieves the return values for the 'spell' function call in case
 // of a misspelled word.
@@ -458,8 +459,7 @@ Reference< XSpellAlternatives >
 
 }
 
-
-
+}
 
 Reference< XSpellAlternatives > SAL_CALL
 MacSpellChecker::spell( const OUString& rWord, const Locale& rLocale,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2018-10-26 Thread Libreoffice Gerrit user
 lingucomponent/source/languageguessing/guess.cxx |   75 +++
 1 file changed, 36 insertions(+), 39 deletions(-)

New commits:
commit 31a8d9c711dfdbdb4b11067125d763b1d570033b
Author: Stephan Bergmann 
AuthorDate: Fri Oct 26 13:16:57 2018 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 26 14:44:56 2018 +0200

Don't read past end of string in Guess ctor

:
> ==26422==ERROR: AddressSanitizer: heap-buffer-overflow on address 
0x604000accc72 at pc 0x2ae43e63f4b6 bp 0x2ae43e600510 sp 0x2ae43e600508
> READ of size 1 at 0x604000accc72 thread T70 (cppu_threadpool)
> #0 0x2ae43e63f4b5 in Guess::Guess(char const*) 
/lingucomponent/source/languageguessing/guess.cxx:95:28
> #1 0x2ae43e667f2f in SimpleGuesser::GetManagedLanguages(char) 
/lingucomponent/source/languageguessing/simpleguesser.cxx:169:19
> #2 0x2ae43e668420 in SimpleGuesser::GetAvailableLanguages() 
/lingucomponent/source/languageguessing/simpleguesser.cxx:179:12
> #3 0x2ae43e64a18e in LangGuess_Impl::getEnabledLanguages() 
/lingucomponent/source/languageguessing/guesslang.cxx:229:24
[...]
> 0x604000accc72 is located 0 bytes to the right of 34-byte region 
[0x604000accc50,0x604000accc72)
> allocated by thread T70 (cppu_threadpool) here:
[...]
> #7 0x2ae43e65350a in std::string::operator+=(char const*) 
/home/tdf/lode/opt_private/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/bits/basic_string.h:3355:16
> #8 0x2ae43e667e6e in SimpleGuesser::GetManagedLanguages(char) 
/lingucomponent/source/languageguessing/simpleguesser.cxx:168:21
> #9 0x2ae43e668420 in SimpleGuesser::GetAvailableLanguages() 
/lingucomponent/source/languageguessing/simpleguesser.cxx:179:12
> #10 0x2ae43e64a18e in LangGuess_Impl::getEnabledLanguages() 
/lingucomponent/source/languageguessing/guesslang.cxx:229:24
[...]

shows, during UITest_librelogo, the Guess ctor making wrong assumptions 
about
the structure of guess_str and skipping over the terminating NUL.  Locally I
could see that while most inputs do have the expected syntax of starting 
with
"[" and containing two "-", one input is indeed just "[haw-utf8" without a
second "-".

I don't know where the strings passed into the Guess ctor in the two places 
in
lingucomponent/source/languageguessing/simpleguesser.cxx ultimately come 
from,
and what their guaranteed syntax and their semantics is.  So from the 
existing
code and the non--well-formed "[haw-utf8" sample (where the second segment 
shall
apparently designate an encoding, not a country), construct rules how to
robustly parse any input into potential language/country/encoding parts.  
(What
is obvious from the call sites is that for one each input will start with 
"[",
and for another the item to parse need neither be "]"- nor NUL-terminated.)

(Guess::encoding_str and the local enc variable have effectively been unused
ever since the code's introduction in 
0762811922c4e1a3474bdd91daf308baafbc18e4
"INTEGRATION: CWS languageguessing".  Guess::encoding_str, but not the local
enc variable, got later removed with 
b275246c30ce3796cd22f72cd82c58b5cf4c86f0
"loplugin:unusedfields in formula..registry".)

Change-Id: Icbedc05ed5b119ee4efbc3118cc17076a4d80c74
Reviewed-on: https://gerrit.libreoffice.org/62390
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/languageguessing/guess.cxx 
b/lingucomponent/source/languageguessing/guess.cxx
index eefa7ab6c0f0..a2f3be35382b 100644
--- a/lingucomponent/source/languageguessing/guess.cxx
+++ b/lingucomponent/source/languageguessing/guess.cxx
@@ -17,6 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+
+#include 
 #include 
 #include 
 
@@ -39,11 +42,6 @@
 
 using namespace std;
 
-static bool isSeparator(const char c){
-return c == GUESS_SEPARATOR_OPEN || c == GUESS_SEPARATOR_SEP || c == 
GUESS_SEPARATOR_CLOSE || c == '\0';
-}
-
-
 Guess::Guess()
 : language_str(DEFAULT_LANGUAGE)
 , country_str(DEFAULT_COUNTRY)
@@ -59,48 +57,47 @@ Guess::Guess(const char * guess_str)
 : language_str(DEFAULT_LANGUAGE)
 , country_str(DEFAULT_COUNTRY)
 {
-string lang;
-string country;
-string enc;
-
 //if the guess is not like "UNKNOWN" or "SHORT", go into the brackets
 if(strcmp(guess_str + 1, TEXTCAT_RESULT_UNKNOWN_STR) != 0
&&
strcmp(guess_str + 1, TEXTCAT_RESULT_SHORT_STR) != 0)
 {
-
-int current_pointer = 0;
-
-//this is to go to the first char of the guess string ( the '[' of 
"[en-US-utf8]" )
-while(!isSeparator(guess_str[current_pointer])){
-current_pointer++;
+// From how this ctor is called from SimpleGuesser::GuessLanguage and
+// SimpleGuesser::GetManagedLanguages 

[Libreoffice-commits] core.git: lingucomponent/source

2018-07-26 Thread Libreoffice Gerrit user
 lingucomponent/source/languageguessing/guess.cxx |4 
 lingucomponent/source/languageguessing/guess.hxx |2 --
 2 files changed, 6 deletions(-)

New commits:
commit d6ecc3562b0628b1c3e0cac3b4e7a39f4038e2e8
Author: Stephan Bergmann 
AuthorDate: Thu Jul 26 11:45:43 2018 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jul 26 16:49:36 2018 +0200

lingucomponent: avoid -Werror=deprecated-copy (GCC trunk towards GCC 9)

...by removing explicitly user-provided functions that do the same as their
implicitly-defined counterparts, but may prevent implicitly declared copy
functions from being defined as non-deleted in the future.  (Even if a dtor 
was
declared non-inline in an include file, the apparently-used 
implicitly-defined
copy functions are already inline, so why bother with a non-inline dtor.)

Change-Id: Ib8eea8d4d2088c8a32c5938985ad14e4609a4237
Reviewed-on: https://gerrit.libreoffice.org/58060
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/lingucomponent/source/languageguessing/guess.cxx 
b/lingucomponent/source/languageguessing/guess.cxx
index 7c578672d19e..e802c0ed95e1 100644
--- a/lingucomponent/source/languageguessing/guess.cxx
+++ b/lingucomponent/source/languageguessing/guess.cxx
@@ -104,8 +104,4 @@ Guess::Guess(const char * guess_str)
 }
 }
 
-Guess::~Guess()
-{
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lingucomponent/source/languageguessing/guess.hxx 
b/lingucomponent/source/languageguessing/guess.hxx
index 9277f94c559d..d85db86900f8 100644
--- a/lingucomponent/source/languageguessing/guess.hxx
+++ b/lingucomponent/source/languageguessing/guess.hxx
@@ -43,8 +43,6 @@ class Guess final {
  */
 Guess(const char * guess_str);
 
-~Guess();
-
 const string& GetLanguage() { return language_str;}
 const string& GetCountry() { return country_str;}
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2018-07-10 Thread Tor Lillqvist
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |  112 ++--
 1 file changed, 100 insertions(+), 12 deletions(-)

New commits:
commit d66df262ee4fd8abc794ef9ef764a182b0da29ea
Author: Tor Lillqvist 
Date:   Tue Jul 10 09:28:41 2018 +0300

tdf#118647: Improve handling of system spell dictionaries on macOS

The system has generic spell dictionaries for languages spoken in many
countries, but LibreOffice wants them to correspond to specific
language-country combinations. So do it like that then.

Change-Id: I9ec4bb4302b2f1eec3ce7b1c1ef8f2be867bad52
Reviewed-on: https://gerrit.libreoffice.org/57220
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index a863cd2d87b9..d9f0d017ba84 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -115,8 +115,106 @@ Sequence< Locale > SAL_CALL MacSpellChecker::getLocales()
 for (NSUInteger i = 0; i < [aSpellCheckLanguages count]; i++)
 {
 NSString* pLangStr = static_cast([aSpellCheckLanguages 
objectAtIndex:i]);
-postspdict.push_back( pLangStr );
+
+// Fix up generic languages (without territory code) and odd 
combinations that LO
+// doesn't handle.
+if ([pLangStr isEqualToString:@"da"])
+{
+postspdict.push_back( @"da_DK" );
+}
+else if ([pLangStr isEqualToString:@"de"])
+{
+const std::vector aDE
+{ @"AT", @"BE", @"CH", @"DE", @"LI", @"LU" };
+for (auto c: aDE)
+{
+pLangStr = [@"de_" stringByAppendingString: c];
+postspdict.push_back( pLangStr );
+}
+}
+else if ([pLangStr isEqualToString:@"en"])
+{
+// System has en_AU, en_CA, en_GB, and en_IN. Add the rest.
+const std::vector aEN
+{ @"BW", @"BZ", @"GH", @"GM", @"IE", @"JM", @"MU", @"MW", 
@"MY", @"NA",
+  @"NZ", @"PH", @"TT", @"US", @"ZA", @"ZW" };
+for (auto c: aEN)
+{
+pLangStr = [@"en_" stringByAppendingString: c];
+postspdict.push_back( pLangStr );
+}
+}
+else if ([pLangStr isEqualToString:@"en_JP"]
+ || [pLangStr isEqualToString:@"en_SG"])
+{
+// Just skip, LO doesn't have those yet in this context.
+}
+else if ([pLangStr isEqualToString:@"es"])
+{
+const std::vector aES
+{ @"AR", @"BO", @"CL", @"CO", @"CR", @"CU", @"DO", @"EC", 
@"ES", @"GT",
+  @"HN", @"MX", @"NI", @"PA", @"PE", @"PR", @"PY", @"SV", 
@"UY", @"VE" };
+for (auto c: aES)
+{
+pLangStr = [@"es_" stringByAppendingString: c];
+postspdict.push_back( pLangStr );
+}
+}
+else if ([pLangStr isEqualToString:@"fi"])
+{
+postspdict.push_back( @"fi_FI" );
+}
+else if ([pLangStr isEqualToString:@"fr"])
+{
+const std::vector aFR
+{ @"BE", @"BF", @"BJ", @"CA", @"CH", @"CI", @"FR", @"LU", 
@"MC", @"ML",
+  @"MU", @"NE", @"SN", @"TG" };
+for (auto c: aFR)
+{
+pLangStr = [@"fr_" stringByAppendingString: c];
+postspdict.push_back( pLangStr );
+}
+}
+else if ([pLangStr isEqualToString:@"it"])
+{
+postspdict.push_back( @"it_CH" );
+postspdict.push_back( @"it_IT" );
+}
+else if ([pLangStr isEqualToString:@"ko"])
+{
+postspdict.push_back( @"ko_KR" );
+}
+else if ([pLangStr isEqualToString:@"nl"])
+{
+postspdict.push_back( @"nl_BE" );
+postspdict.push_back( @"nl_NL" );
+}
+else if ([pLangStr isEqualToString:@"nb"])
+{
+postspdict.push_back( @"nb_NO" );
+}
+else if ([pLangStr isEqualToString:@"pl"])
+{
+postspdict.push_back( @"pl_PL" );
+}
+else if ([pLangStr isEqualToString:@"ru"])
+{
+

[Libreoffice-commits] core.git: lingucomponent/source

2018-05-18 Thread Tor Lillqvist
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |   22 +++-
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 69c8e9a0607e9a197dfff8139f2ca14c2538da8a
Author: Tor Lillqvist 
Date:   Thu May 17 12:35:34 2018 +0300

tdf#112442: Use list of available dictionaries, not available locales

Also, turn some specific overly generic languages that LO doesn't
recognize in this context into the country-specific ones that the
dictionary (probably) is for. Skip some odd locales LO doesn't know in
this context. In particular, what the system calls the "en" dictionary
is for "en_US", and "nb" is for "nb_NO". The "es" one probably is for
"es_ES".

Also, skip some language-country combinations that LO doesn't
recognize in this context. In partiular, "en_JP" and "en_SG".

Change-Id: I29450775a263bdc03fd43849380f66e6d09b
Reviewed-on: https://gerrit.libreoffice.org/54476
Tested-by: Jenkins 
Reviewed-by: Tor Lillqvist 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 15a195c52a02..a863cd2d87b9 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -110,16 +110,12 @@ Sequence< Locale > SAL_CALL MacSpellChecker::getLocales()
 // TODO How on Mac OS X?
 
 // invoke a second  dictionary manager to get the shared dictionary 
list
-NSArray *aLocales = [NSLocale availableLocaleIdentifiers];
+NSArray *aSpellCheckLanguages = [[NSSpellChecker sharedSpellChecker] 
availableLanguages];
 
-//Test for existence of the dictionaries
-for (NSUInteger i = 0; i < [aLocales count]; i++)
+for (NSUInteger i = 0; i < [aSpellCheckLanguages count]; i++)
 {
-NSString* pLangStr = static_cast([aLocales 
objectAtIndex:i]);
-if( [[NSSpellChecker sharedSpellChecker] setLanguage:pLangStr ] )
-{
-postspdict.push_back( pLangStr );
-}
+NSString* pLangStr = static_cast([aSpellCheckLanguages 
objectAtIndex:i]);
+postspdict.push_back( pLangStr );
 }
 
 numshr = postspdict.size();
@@ -151,6 +147,16 @@ Sequence< Locale > SAL_CALL MacSpellChecker::getLocales()
 NSString* aCountry = [ aLocDict 
objectForKey:NSLocaleCountryCode ];
 OUString lang([aLang cStringUsingEncoding: 
NSUTF8StringEncoding], [aLang length], aEnc);
 OUString country([ aCountry cStringUsingEncoding: 
NSUTF8StringEncoding], [aCountry length], aEnc);
+// Fix some overly generic or odd locales LO doesn't know
+if (lang == "en" && country.isEmpty())
+country = "US"; // I guess that is what it means
+else if (lang == "nb" && country.isEmpty())
+country = "NO";
+else if (lang == "es" && country.isEmpty())
+country = "ES"; // Probably better than claiming it to be 
for all es-* ?
+else if ((lang == "en" && country == "JP")
+ || (lang == "en" && country == "SG"))
+continue; // Just skip, LO doesn't have those yet in this 
context
 Locale nLoc( lang, country, OUString() );
 newloc = 1;
 //eliminate duplicates (is this needed for MacOS?)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2018-05-03 Thread Stephan Bergmann
 lingucomponent/source/numbertext/numbertext.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e56702c41bc84a4ddeaad23a59b66aee6bd35a6c
Author: Stephan Bergmann 
Date:   Thu May 3 13:27:21 2018 +0200

loplugin:staticaccess

Change-Id: Ic62cdd1fd2ba2fe0ecda49505cf7047457d33b87

diff --git a/lingucomponent/source/numbertext/numbertext.cxx 
b/lingucomponent/source/numbertext/numbertext.cxx
index e86278d851f4..237aaa46ba01 100644
--- a/lingucomponent/source/numbertext/numbertext.cxx
+++ b/lingucomponent/source/numbertext/numbertext.cxx
@@ -143,10 +143,10 @@ OUString SAL_CALL NumberText_Impl::getNumberText(const 
OUString& rText, const Lo
 aCode += "-" + aCountry;
 OString aLangCode(OUStringToOString(aCode, RTL_TEXTENCODING_ASCII_US));
 OString aInput(OUStringToOString(rText, RTL_TEXTENCODING_UTF8));
-std::wstring aResult = m_aNumberText.string2wstring(aInput.getStr());
+std::wstring aResult = Numbertext::string2wstring(aInput.getStr());
 bool result = m_aNumberText.numbertext(aResult, aLangCode.getStr());
 DBG_ASSERT(result, "numbertext: false");
-OString aResult2(m_aNumberText.wstring2string(aResult).c_str());
+OString aResult2(Numbertext::wstring2string(aResult).c_str());
 return OUString::fromUtf8(aResult2);
 #else
 return rText;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2018-03-19 Thread Caolán McNamara
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d2dc813469960cfef48b187cc5f9883478e41f14
Author: Caolán McNamara 
Date:   Mon Mar 19 14:08:48 2018 +

coverity#1430057 silence Argument cannot be negative

Change-Id: I58bf1a204393ea95c85f51cf9ef3387db1565a4e
Reviewed-on: https://gerrit.libreoffice.org/51558
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 8f9480e3ff0f..ba9523bc78f8 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -284,7 +284,7 @@ Reference< XHyphenatedWord > SAL_CALL 
Hyphenator::hyphenate( const OUString& aWo
 }
 
 // if we have a hyphenation dictionary matching this locale
-if (k != -1)
+if (k >= 0)
 {
 int nHyphenationPos = -1;
 int nHyphenationPosAlt = -1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2018-01-19 Thread abstatic
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |   78 ++-
 lingucomponent/source/spellcheck/spell/sspellimp.hxx |   17 ++--
 2 files changed, 39 insertions(+), 56 deletions(-)

New commits:
commit 4edc58af369244fb734d34fee027237624cca9e6
Author: abstatic 
Date:   Thu Jan 18 16:31:44 2018 +0530

tdf#112373 Using vector of struct to manage hunspell dicts

Currently we use arrays allocated on heap for initializing
available locales and dictionaries.

This patch encapsulates all the different objects
related to a dictionary into a strcut dictItem.

unique_ptr is used for hunspell, also uses o3tl::make_unique for creating 
them.
Used 'reserve' for better memory allocation of vector.
Removed unused member and local variables.

Change-Id: I6309c681790cfec4ee9b9937063bc414cf1f
Reviewed-on: https://gerrit.libreoffice.org/48109
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 192e4e2a3bb7..694bc1aa27e4 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -48,6 +48,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace utl;
 using namespace osl;
@@ -69,28 +70,19 @@ using namespace linguistic;
 #endif
 
 SpellChecker::SpellChecker() :
-m_aDicts(nullptr),
-m_aDEncs(nullptr),
-m_aDLocs(nullptr),
-m_aDNames(nullptr),
-m_nNumDict(0),
 m_aEvtListeners(GetLinguMutex()),
 m_pPropHelper(nullptr),
 m_bDisposing(false)
 {
 }
 
+SpellChecker::DictItem::DictItem(OUString i_DName, Locale i_DLoc, 
rtl_TextEncoding i_DEnc):
+m_aDName(i_DName), m_aDLoc(i_DLoc), m_aDEnc(i_DEnc)
+{
+}
+
 SpellChecker::~SpellChecker()
 {
-if (m_aDicts)
-{
-   for (int i = 0; i < m_nNumDict; ++i)
-   {
-delete m_aDicts[i];
-   }
-   delete[] m_aDicts;
-}
-delete[] m_aDLocs;
 if (m_pPropHelper)
 {
 m_pPropHelper->RemoveAsPropListener();
@@ -116,7 +108,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 
 // this routine should return the locales supported by the installed
 // dictionaries.
-if (!m_nNumDict)
+if (m_DictItems.empty())
 {
 SvtLinguConfig aLinguCfg;
 
@@ -150,7 +142,6 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 uno::Reference< lang::XMultiServiceFactory > 
xServiceFactory(comphelper::getProcessServiceFactory());
 uno::Reference< ucb::XSimpleFileAccess > 
xAccess(xServiceFactory->createInstance("com.sun.star.ucb.SimpleFileAccess"), 
uno::UNO_QUERY);
 // get supported locales from the dictionaries-to-use...
-sal_Int32 k = 0;
 std::set aLocaleNamesSet;
 for (auto const& dict : aDics)
 {
@@ -178,7 +169,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 }
 // ... and add them to the resulting sequence
 m_aSuppLocales.realloc( aLocaleNamesSet.size() );
-k = 0;
+sal_Int32 k = 0;
 for (auto const& localeName : aLocaleNamesSet)
 {
 Locale aTmp( LanguageTag::convertToLocale(localeName));
@@ -190,16 +181,12 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 //! it is undefined which dictionary gets used.
 //! In the future the implementation should support using several 
dictionaries
 //! for one locale.
-m_nNumDict = 0;
+sal_uInt32 nDictSize = 0;
 for (auto const& dict : aDics)
-m_nNumDict = m_nNumDict + dict.aLocaleNames.getLength();
+nDictSize += dict.aLocaleNames.getLength();
 
 // add dictionary information
-m_aDicts  = new Hunspell* [m_nNumDict];
-m_aDEncs.reset( new rtl_TextEncoding [m_nNumDict] );
-m_aDLocs  = new Locale [m_nNumDict];
-m_aDNames.reset( new OUString [m_nNumDict] );
-k = 0;
+m_DictItems.reserve(nDictSize);
 for (auto const& dict : aDics)
 {
 if (dict.aLocaleNames.getLength() > 0 &&
@@ -212,33 +199,22 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 // Once for each of its supported locales.
 for (auto const& localeName : aLocaleNames)
 {
-m_aDicts[k]  = nullptr;
-m_aDEncs[k]  = RTL_TEXTENCODING_DONTKNOW;
-m_aDLocs[k]  = 
LanguageTag::convertToLocale(localeName);
 // also both files have to be in the same directory 
and the
 // file names must only differ in the extension 
(.aff/.dic).

[Libreoffice-commits] core.git: lingucomponent/source

2017-11-01 Thread Julien Nabet
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |   30 --
 lingucomponent/source/lingutil/lingutil.cxx   |   18 ++
 lingucomponent/source/lingutil/lingutil.hxx   |3 -
 lingucomponent/source/spellcheck/spell/sspellimp.cxx  |   51 +++---
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx   |   29 --
 5 files changed, 59 insertions(+), 72 deletions(-)

New commits:
commit a14892eda219b273726d2ca001955dfeb36360c3
Author: Julien Nabet 
Date:   Wed Nov 1 16:56:25 2017 +0100

Replace lists by vectors in lingucomponent

+ use loop ranges

Change-Id: I0ae81e3c10a6382d3f5719b2824a70d6e72b1462
Reviewed-on: https://gerrit.libreoffice.org/44169
Reviewed-by: Noel Grandin 
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 550c18ce..1a9c1d628a14 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -47,7 +47,7 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -117,7 +117,7 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
 // get list of dictionaries-to-use
 // (or better speaking: the list of dictionaries using the
 // new configuration entries).
-std::list< SvtLinguConfigDictionaryEntry > aDics;
+std::vector< SvtLinguConfigDictionaryEntry > aDics;
 uno::Sequence< OUString > aFormatList;
 aLinguCfg.GetSupportedDictionaryFormatsFor( "Hyphenators",
 "org.openoffice.lingu.LibHnjHyphenator", aFormatList );
@@ -146,10 +146,9 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
 // get supported locales from the dictionaries-to-use...
 sal_Int32 k = 0;
 std::set aLocaleNamesSet;
-std::list< SvtLinguConfigDictionaryEntry >::const_iterator aDictIt;
-for (aDictIt = aDics.begin();  aDictIt != aDics.end();  ++aDictIt)
+for (auto const& dict : aDics)
 {
-uno::Sequence< OUString > aLocaleNames( aDictIt->aLocaleNames 
);
+uno::Sequence< OUString > aLocaleNames( dict.aLocaleNames );
 sal_Int32 nLen2 = aLocaleNames.getLength();
 for (k = 0;  k < nLen2;  ++k)
 {
@@ -158,11 +157,10 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
 }
 // ... and add them to the resulting sequence
 aSuppLocales.realloc( aLocaleNamesSet.size() );
-std::set::const_iterator aItB;
 k = 0;
-for (aItB = aLocaleNamesSet.begin();  aItB != 
aLocaleNamesSet.end();  ++aItB)
+for (auto const& localeName :  aLocaleNamesSet)
 {
-Locale aTmp( LanguageTag::convertToLocale( *aItB ));
+Locale aTmp( LanguageTag::convertToLocale(localeName));
 aSuppLocales[k++] = aTmp;
 }
 
@@ -172,19 +170,19 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
 //! In the future the implementation should support using several 
dictionaries
 //! for one locale.
 numdict = 0;
-for (aDictIt = aDics.begin();  aDictIt != aDics.end();  ++aDictIt)
-numdict = numdict + aDictIt->aLocaleNames.getLength();
+for (auto const& dict :  aDics)
+numdict = numdict + dict.aLocaleNames.getLength();
 
 // add dictionary information
 aDicts = new HDInfo[numdict];
 
 k = 0;
-for (aDictIt = aDics.begin();  aDictIt != aDics.end();  ++aDictIt)
+for (auto const& dict :  aDics)
 {
-if (aDictIt->aLocaleNames.getLength() > 0 &&
-aDictIt->aLocations.getLength() > 0)
+if (dict.aLocaleNames.getLength() > 0 &&
+dict.aLocations.getLength() > 0)
 {
-uno::Sequence< OUString > aLocaleNames( 
aDictIt->aLocaleNames );
+uno::Sequence< OUString > aLocaleNames(dict.aLocaleNames);
 sal_Int32 nLocales = aLocaleNames.getLength();
 
 // currently only one language per dictionary is supported 
in the actual implementation...
@@ -192,7 +190,7 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
 // Once for each of its supported locales.
 for (sal_Int32 i = 0;  i < nLocales;  ++i)
 {
-LanguageTag aLanguageTag( aDictIt->aLocaleNames[i] );
+LanguageTag aLanguageTag(dict.aLocaleNames[i]);
 aDicts[k].aPtr = nullptr;
 aDicts[k].eEnc = 

[Libreoffice-commits] core.git: lingucomponent/source

2017-10-23 Thread Caolán McNamara
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit daa6fe9f040314bf05f914a45e10a8d7b9613d3b
Author: Caolán McNamara 
Date:   Mon Oct 23 13:13:49 2017 +0100

hardly need a mutex to return a local string

Change-Id: Ic147ad6af32de022802d1d14858197bf61c29a28

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index aa7e23ed160d..d278878b283f 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -747,7 +747,6 @@ sal_Bool SAL_CALL 
Hyphenator::removeLinguServiceEventListener(
 
 OUString SAL_CALL Hyphenator::getServiceDisplayName( const Locale& /*rLocale*/ 
)
 {
-MutexGuard  aGuard( GetLinguMutex() );
 return OUString( "Libhyphen Hyphenator" );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2017-10-04 Thread Julien Nabet
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx |1 -
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm  |9 -
 2 files changed, 4 insertions(+), 6 deletions(-)

New commits:
commit cfce9b418072ff930d400890dcc0781e919fce24
Author: Julien Nabet 
Date:   Wed Oct 4 22:02:53 2017 +0200

Fix potential leak in macspellimp.mm

+ avoid macSpell var
I'm not sure to retrieve [NSSpellChecker sharedSpellChecker] in a pointer
is a good idea.
Most of the examples using sharedSpellChecker just call [NSSpellChecker 
sharedSpellChecker]
each time. If there's a bit more code, at least we're sure we won't leak 
because of this.

Change-Id: I9818bd3d51f26b50849e1a5e69cc705acd92ad29
Reviewed-on: https://gerrit.libreoffice.org/43140
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index 7c72b748c7b2..c489bee337f2 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -63,7 +63,6 @@ class MacSpellChecker :
 Locale *aDLocs;
 OUString *  aDNames;
 sal_Int32   numdict;
-NSSpellChecker *macSpell;
 int macTag;   // unique tag for this doc
 
 ::comphelper::OInterfaceContainerHelper2   aEvtListeners;
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index f146db7b8dab..4519e2a98fd7 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -57,7 +57,6 @@ MacSpellChecker::MacSpellChecker() :
 numdict = 0;
 NSApplicationLoad();
 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
-macSpell = [NSSpellChecker sharedSpellChecker];
 macTag = [NSSpellChecker uniqueSpellDocumentTag];
 [pool release];
 }
@@ -117,7 +116,7 @@ Sequence< Locale > SAL_CALL MacSpellChecker::getLocales()
 for (NSUInteger i = 0; i < [aLocales count]; i++)
 {
 NSString* pLangStr = (NSString*)[aLocales objectAtIndex:i];
-if( [macSpell setLanguage:pLangStr ] )
+if( [[NSSpellChecker sharedSpellChecker] setLanguage:pLangStr ] )
 {
 postspdict.push_back( pLangStr );
 }
@@ -241,7 +240,7 @@ sal_Int16 MacSpellChecker::GetSpellFailure( const OUString 
, const Locale
 }
 
 NSInteger aCount;
-NSRange range = [macSpell checkSpellingOfString:aNSStr startingAt:0 
language:aLang wrap:false inSpellDocumentWithTag:macTag wordCount:];
+NSRange range = [[NSSpellChecker sharedSpellChecker] 
checkSpellingOfString:aNSStr startingAt:0 language:aLang wrap:false 
inSpellDocumentWithTag:macTag wordCount:];
 int rVal = 0;
 if(range.length>0)
 {
@@ -339,8 +338,8 @@ Reference< XSpellAlternatives >
 NSString* aTaggedCountry = [@"_" stringByAppendingString:aCountry];
 aLang = [aLang  stringByAppendingString:aTaggedCountry];
 }
-[macSpell setLanguage:aLang];
-NSArray *guesses = [macSpell guessesForWordRange:NSMakeRange(0, 
[aNSStr length]) inString:aNSStr language:aLang inSpellDocumentWithTag:0];
+[[NSSpellChecker sharedSpellChecker] setLanguage:aLang];
+NSArray *guesses = [[NSSpellChecker sharedSpellChecker] 
guessesForWordRange:NSMakeRange(0, [aNSStr length]) inString:aNSStr 
language:aLang inSpellDocumentWithTag:0];
 count = [guesses count];
 if (count)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2017-09-17 Thread Julien Nabet
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 11fcdecb631fef7797da9489ea36468e292e2986
Author: Julien Nabet 
Date:   Sun Sep 17 21:37:49 2017 +0200

Related tdf#112425: fix another leak in MacSpellChecker

Apply the same changes in GetProposals than GetSpellFailure

Change-Id: Id78966568833f29c21f44724974254218636597d
Reviewed-on: https://gerrit.libreoffice.org/42397
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 51e82f1dd0fb..f146db7b8dab 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -331,13 +331,12 @@ Reference< XSpellAlternatives >
 if (n)
 {
 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
-NSString* aNSStr = [[NSString alloc] initWithCharacters: 
reinterpret_cast(nWord.getStr()) length: nWord.getLength()];
-NSString* aLang = [[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Language.getStr()) length: 
rLocale.Language.getLength() ];
+NSString* aNSStr = [[[NSString alloc] initWithCharacters: 
reinterpret_cast(nWord.getStr()) length: 
nWord.getLength()]autorelease];
+NSString* aLang = [[[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Language.getStr()) length: 
rLocale.Language.getLength()]autorelease];
 if(rLocale.Country.getLength()>0)
 {
-NSString* aCountry = [[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Country.getStr()) length: 
rLocale.Country.getLength() ];
+NSString* aCountry = [[[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Country.getStr()) length: 
rLocale.Country.getLength()]autorelease];
 NSString* aTaggedCountry = [@"_" stringByAppendingString:aCountry];
-[aLang autorelease];
 aLang = [aLang  stringByAppendingString:aTaggedCountry];
 }
 [macSpell setLanguage:aLang];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2017-09-16 Thread Julien Nabet
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 83288332f7ced698610739419989c464256f1c4d
Author: Julien Nabet 
Date:   Sat Sep 16 22:14:26 2017 +0200

tdf#112425: fix leak in MacSpellChecker

by using "autorelease" keyword with init vars

Change-Id: I056282460b94f8052287f5ad29d26a4870cd06a5
Reviewed-on: https://gerrit.libreoffice.org/42361
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 033b87555cf8..51e82f1dd0fb 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -231,13 +231,12 @@ sal_Int16 MacSpellChecker::GetSpellFailure( const 
OUString , const Locale
 {
 aEnc = 0;
 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
-NSString* aNSStr = [[NSString alloc] initWithCharacters: 
reinterpret_cast(nWord.getStr()) length: nWord.getLength()];
-NSString* aLang = [[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Language.getStr()) length: 
rLocale.Language.getLength()];
+NSString* aNSStr = [[[NSString alloc] initWithCharacters: 
reinterpret_cast(nWord.getStr()) length: 
nWord.getLength()]autorelease];
+NSString* aLang = [[[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Language.getStr()) length: 
rLocale.Language.getLength()]autorelease];
 if(rLocale.Country.getLength()>0)
 {
-NSString* aCountry = [[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Country.getStr()) length: 
rLocale.Country.getLength()];
+NSString* aCountry = [[[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Country.getStr()) length: 
rLocale.Country.getLength()]autorelease];
 NSString* aTaggedCountry = [@"_" stringByAppendingString:aCountry];
-[aLang autorelease];
 aLang = [aLang  stringByAppendingString:aTaggedCountry];
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2017-07-12 Thread Noel Grandin
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |6 ++
 lingucomponent/source/spellcheck/spell/sspellimp.hxx |3 ++-
 2 files changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 0088f365b1c1e3103b310ac3371bc5c918fe617e
Author: Noel Grandin 
Date:   Wed Jul 12 09:34:07 2017 +0200

loplugin:useuniqueptr in lingucomponent

Change-Id: I5d668718620114cb8b9d53375497a4d0b1759abb
Reviewed-on: https://gerrit.libreoffice.org/39852
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index a3c9696fa142..97b5c48a1676 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -88,7 +88,6 @@ SpellChecker::~SpellChecker()
}
delete[] m_aDicts;
 }
-delete[] m_aDEncs;
 delete[] m_aDLocs;
 delete[] m_aDNames;
 if (m_pPropHelper)
@@ -200,7 +199,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 
 // add dictionary information
 m_aDicts  = new Hunspell* [m_nNumDict];
-m_aDEncs  = new rtl_TextEncoding [m_nNumDict];
+m_aDEncs.reset( new rtl_TextEncoding [m_nNumDict] );
 m_aDLocs  = new Locale [m_nNumDict];
 m_aDNames = new OUString [m_nNumDict];
 k = 0;
@@ -240,8 +239,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 m_nNumDict = 0;
 delete[] m_aDicts;
 m_aDicts  = nullptr;
-delete[] m_aDEncs;
-m_aDEncs = nullptr;
+m_aDEncs.reset();
 delete[] m_aDLocs;
 m_aDLocs  = nullptr;
 delete[] m_aDNames;
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.hxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
index 63b13d19b11d..3a61900e8c15 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.hxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
@@ -34,6 +34,7 @@
 #include 
 
 #include 
+#include 
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
@@ -55,7 +56,7 @@ class SpellChecker :
 {
 Sequence< Locale > m_aSuppLocales;
 Hunspell **m_aDicts;
-rtl_TextEncoding * m_aDEncs;
+std::unique_ptr m_aDEncs;
 Locale *   m_aDLocs;
 OUString * m_aDNames;
 sal_Int32  m_nNumDict;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2017-06-30 Thread Stephan Bergmann
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit d6db18316b5e55bd38ceb7568aa5fb4564ed49a9
Author: Stephan Bergmann 
Date:   Fri Jun 30 09:55:00 2017 +0200

loplugin:oncevar

Change-Id: I285296913f469aa624ececefab488ff4c456f05a

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 4d817e7c517e..033b87555cf8 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -236,8 +236,7 @@ sal_Int16 MacSpellChecker::GetSpellFailure( const OUString 
, const Locale
 if(rLocale.Country.getLength()>0)
 {
 NSString* aCountry = [[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Country.getStr()) length: 
rLocale.Country.getLength()];
-NSString* aTag = @"_";
-NSString* aTaggedCountry = [aTag stringByAppendingString:aCountry];
+NSString* aTaggedCountry = [@"_" stringByAppendingString:aCountry];
 [aLang autorelease];
 aLang = [aLang  stringByAppendingString:aTaggedCountry];
 }
@@ -338,8 +337,7 @@ Reference< XSpellAlternatives >
 if(rLocale.Country.getLength()>0)
 {
 NSString* aCountry = [[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Country.getStr()) length: 
rLocale.Country.getLength() ];
-NSString* aTag = @"_";
-NSString* aTaggedCountry = [aTag stringByAppendingString:aCountry];
+NSString* aTaggedCountry = [@"_" stringByAppendingString:aCountry];
 [aLang autorelease];
 aLang = [aLang  stringByAppendingString:aTaggedCountry];
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source toolkit/source vcl/unx

2017-05-21 Thread Jochen Nitschke
 lingucomponent/source/languageguessing/simpleguesser.cxx |   17 ---
 toolkit/source/controls/controlmodelcontainerbase.cxx|5 
 vcl/unx/generic/gdi/x11cairotextrender.cxx   |2 -
 3 files changed, 1 insertion(+), 23 deletions(-)

New commits:
commit c8d8b9b70e91090af2ed138283be42734b4d5748
Author: Jochen Nitschke 
Date:   Sun May 21 12:22:51 2017 +0200

cppcheck: unusedStructMember

Change-Id: I1e2859e7a12a61db953be12f11149aaecb462b5b
Reviewed-on: https://gerrit.libreoffice.org/37871
Tested-by: Jenkins 
Reviewed-by: Jochen Nitschke 

diff --git a/lingucomponent/source/languageguessing/simpleguesser.cxx 
b/lingucomponent/source/languageguessing/simpleguesser.cxx
index d5227edbdc01..589fbeb54f2b 100644
--- a/lingucomponent/source/languageguessing/simpleguesser.cxx
+++ b/lingucomponent/source/languageguessing/simpleguesser.cxx
@@ -69,23 +69,8 @@ static int startsAsciiCaseInsensitive(const std::string , 
const std::string &
  }
 
 /**
- * This 3 following structures are from fingerprint.c and textcat.c
+ * This following structure is from textcat.c
  */
-typedef struct ngram_t {
-
-sint2 rank;
-char str[MAXNGRAMSIZE+1];
-
-} ngram_t;
-
-typedef struct fp_t {
-
-const char *name;
-ngram_t *fprint;
-uint4 size;
-
-} fp_t;
-
 typedef struct textcat_t{
 
 void **fprint;
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx 
b/toolkit/source/controls/controlmodelcontainerbase.cxx
index 5f88ae38faae..b874493e233a 100644
--- a/toolkit/source/controls/controlmodelcontainerbase.cxx
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -74,11 +74,6 @@ using namespace ::com::sun::star::util;
 using namespace toolkit;
 
 #define PROPERTY_RESOURCERESOLVER "ResourceResolver"
-struct LanguageDependentProp
-{
-const char* pPropName;
-sal_Int32   nPropNameLength;
-};
 
 
 namespace
diff --git a/vcl/unx/generic/gdi/x11cairotextrender.cxx 
b/vcl/unx/generic/gdi/x11cairotextrender.cxx
index 612b921d3a75..290f638a0196 100644
--- a/vcl/unx/generic/gdi/x11cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/x11cairotextrender.cxx
@@ -31,10 +31,8 @@ struct BOX
 };
 struct _XRegion
 {
-long size;
 long numRects;
 BOX *rects;
-BOX extents;
 };
 
 X11CairoTextRender::X11CairoTextRender(X11SalGraphics& rParent)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2017-02-25 Thread Stephan Bergmann
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |   27 +-
 1 file changed, 20 insertions(+), 7 deletions(-)

New commits:
commit 4520435ad59802b6a567b3bb6c77927663be0f81
Author: Stephan Bergmann 
Date:   Sat Feb 25 16:50:23 2017 +0100

Clean up use of integer types

Change-Id: I06364be5bbbe7862d20ea24ee155cf468f63f0b0

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 4b13583..5bf39b1 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -50,6 +50,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -617,7 +618,7 @@ Reference< XPossibleHyphens > SAL_CALL 
Hyphenator::createPossibleHyphens( const
 // now convert word to needed encoding
 OString encWord(OU2ENC(nTerm,eEnc));
 
-int wordlen = encWord.getLength();
+sal_Int32 wordlen = encWord.getLength();
 std::unique_ptr lcword(new char[wordlen+1]);
 std::unique_ptr hyphens(new char[wordlen+5]);
 char ** rep = nullptr; // replacements of discretionary hyphenation
@@ -628,7 +629,7 @@ Reference< XPossibleHyphens > SAL_CALL 
Hyphenator::createPossibleHyphens( const
 strcpy(lcword.get(),encWord.getStr());
 
 // first remove any trailing periods
-int n = wordlen-1;
+sal_Int32 n = wordlen-1;
 while((n >=0) && (lcword[n] == '.'))
 n--;
 n++;
@@ -655,14 +656,13 @@ Reference< XPossibleHyphens > SAL_CALL 
Hyphenator::createPossibleHyphens( const
 }
 }
 // now backfill hyphens[] for any removed periods
-for (int c = n; c < wordlen; c++)
+for (sal_Int32 c = n; c < wordlen; c++)
 hyphens[c] = '0';
 hyphens[wordlen] = '\0';
 
-sal_Int16 nHyphCount = 0;
-sal_Int16 i;
+sal_Int32 nHyphCount = 0;
 
-for ( i = 0; i < encWord.getLength(); i++)
+for ( sal_Int32 i = 0; i < encWord.getLength(); i++)
 {
 if (hyphens[i]&1)
 nHyphCount++;
@@ -673,12 +673,25 @@ Reference< XPossibleHyphens > SAL_CALL 
Hyphenator::createPossibleHyphens( const
 OUStringBuffer hyphenatedWordBuffer;
 nHyphCount = 0;
 
-for (i = 0; i < nWord.getLength(); i++)
+for (sal_Int32 i = 0; i < nWord.getLength(); i++)
 {
 hyphenatedWordBuffer.append(aWord[i]);
 // hyphenation position
 if (hyphens[i]&1)
 {
+// linguistic::PossibleHyphens is stuck with
+// css::uno::Sequence because of
+// css.linguistic2.XPossibleHpyhens.getHyphenationPositions, so
+// any further positions need to be ignored:
+assert(i >= SAL_MIN_INT16);
+if (i > SAL_MAX_INT16)
+{
+SAL_WARN(
+"lingucomponent",
+"hyphen pos " << i << " > SAL_MAX_INT16 in \"" << aWord
+<< "\"");
+continue;
+}
 pPos[nHyphCount] = i;
 hyphenatedWordBuffer.append('=');
 nHyphCount++;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2017-02-20 Thread Khaled Hosny
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |  160 +--
 lingucomponent/source/spellcheck/spell/sspellimp.hxx |   20 +-
 2 files changed, 90 insertions(+), 90 deletions(-)

New commits:
commit 2d028dfe846a4dccb8b4572cc51f2b57f0305d61
Author: Khaled Hosny 
Date:   Mon Feb 20 10:46:45 2017 +0200

Prefix members

Change-Id: I342ac49877c928c52eb3001f5a7bab07588636fa
Reviewed-on: https://gerrit.libreoffice.org/34463
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index bb370e1..686f52f 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -68,47 +68,47 @@ using namespace linguistic;
 #endif
 
 SpellChecker::SpellChecker() :
-aDicts(nullptr),
-aDEncs(nullptr),
-aDLocs(nullptr),
-aDNames(nullptr),
-numdict(0),
-aEvtListeners(GetLinguMutex()),
-pPropHelper(nullptr),
-bDisposing(false)
+m_aDicts(nullptr),
+m_aDEncs(nullptr),
+m_aDLocs(nullptr),
+m_aDNames(nullptr),
+m_nNumDict(0),
+m_aEvtListeners(GetLinguMutex()),
+m_pPropHelper(nullptr),
+m_bDisposing(false)
 {
 }
 
 SpellChecker::~SpellChecker()
 {
-if (aDicts)
+if (m_aDicts)
 {
-   for (int i = 0; i < numdict; ++i)
+   for (int i = 0; i < m_nNumDict; ++i)
{
-delete aDicts[i];
+delete m_aDicts[i];
}
-   delete[] aDicts;
+   delete[] m_aDicts;
 }
-delete[] aDEncs;
-delete[] aDLocs;
-delete[] aDNames;
-if (pPropHelper)
+delete[] m_aDEncs;
+delete[] m_aDLocs;
+delete[] m_aDNames;
+if (m_pPropHelper)
 {
-pPropHelper->RemoveAsPropListener();
-delete pPropHelper;
+m_pPropHelper->RemoveAsPropListener();
+delete m_pPropHelper;
 }
 }
 
 PropertyHelper_Spelling & SpellChecker::GetPropHelper_Impl()
 {
-if (!pPropHelper)
+if (!m_pPropHelper)
 {
 Reference< XLinguProperties >   xPropSet( GetLinguProperties(), 
UNO_QUERY );
 
-pPropHelper = new PropertyHelper_Spelling( static_cast(this), xPropSet );
-pPropHelper->AddAsPropListener();   //! after a reference is 
established
+m_pPropHelper = new PropertyHelper_Spelling( static_cast(this), xPropSet );
+m_pPropHelper->AddAsPropListener();   //! after a reference is 
established
 }
-return *pPropHelper;
+return *m_pPropHelper;
 }
 
 Sequence< Locale > SAL_CALL SpellChecker::getLocales()
@@ -117,7 +117,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 
 // this routine should return the locales supported by the installed
 // dictionaries.
-if (!numdict)
+if (!m_nNumDict)
 {
 SvtLinguConfig aLinguCfg;
 
@@ -181,13 +181,13 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 }
 }
 // ... and add them to the resulting sequence
-aSuppLocales.realloc( aLocaleNamesSet.size() );
+m_aSuppLocales.realloc( aLocaleNamesSet.size() );
 std::set::const_iterator aItB;
 k = 0;
 for (aItB = aLocaleNamesSet.begin();  aItB != 
aLocaleNamesSet.end();  ++aItB)
 {
 Locale aTmp( LanguageTag::convertToLocale( *aItB ));
-aSuppLocales[k++] = aTmp;
+m_aSuppLocales[k++] = aTmp;
 }
 
 //! For each dictionary and each locale we need a separate entry.
@@ -195,15 +195,15 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 //! it is undefined which dictionary gets used.
 //! In the future the implementation should support using several 
dictionaries
 //! for one locale.
-numdict = 0;
+m_nNumDict = 0;
 for (aDictIt = aDics.begin();  aDictIt != aDics.end();  ++aDictIt)
-numdict = numdict + aDictIt->aLocaleNames.getLength();
+m_nNumDict = m_nNumDict + aDictIt->aLocaleNames.getLength();
 
 // add dictionary information
-aDicts  = new Hunspell* [numdict];
-aDEncs  = new rtl_TextEncoding [numdict];
-aDLocs  = new Locale [numdict];
-aDNames = new OUString [numdict];
+m_aDicts  = new Hunspell* [m_nNumDict];
+m_aDEncs  = new rtl_TextEncoding [m_nNumDict];
+m_aDLocs  = new Locale [m_nNumDict];
+m_aDNames = new OUString [m_nNumDict];
 k = 0;
 for (aDictIt = aDics.begin();  aDictIt != aDics.end();  ++aDictIt)
 {
@@ -218,40 +218,40 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 // Once for each of its supported locales.
 for (sal_Int32 i = 0;  i < nLocales;  ++i)
  

[Libreoffice-commits] core.git: lingucomponent/source

2016-12-15 Thread Caolán McNamara
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

New commits:
commit 484370526ddf1ae94a62439d879f8ef592180d19
Author: Caolán McNamara 
Date:   Thu Dec 15 09:45:33 2016 +

fix collision

Change-Id: I73371e19877a8b192b188c1c6367ba0d391530df

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index c09f7a4..a01d23d 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -58,7 +58,7 @@ using namespace com::sun::star::linguistic2;
 using namespace linguistic;
 
 // XML-header of SPELLML queries
-#if defined SPELL_XML
+#if !defined SPELL_XML
 #define SPELL_XML ""
 #endif
 
@@ -277,10 +277,6 @@ sal_Bool SAL_CALL SpellChecker::hasLocale(const Locale& 
rLocale)
 return bRes;
 }
 
-#ifndef MAXWORDLEN
-#   define MAXWORDLEN 176
-#endif
-
 sal_Int16 SpellChecker::GetSpellFailure(const OUString , const Locale 
)
 {
 if (rWord.getLength() > MAXWORDLEN)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2016-12-15 Thread Caolán McNamara
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 7f9a389b45e2452d859e17cf51acd27dc7355af6
Author: Caolán McNamara 
Date:   Thu Dec 15 09:25:22 2016 +

if building against system hunspell < 1.5.4 > 1.4.0

Change-Id: I9ba1b9c3c0e3efb00538b2f3ed4fcffc29f9e931

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 173426f..5a1abd7 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -270,6 +270,10 @@ sal_Bool SAL_CALL SpellChecker::hasLocale(const Locale& 
rLocale)
 return bRes;
 }
 
+#ifndef MAXWORDLEN
+#   define MAXWORDLEN 176
+#endif
+
 sal_Int16 SpellChecker::GetSpellFailure(const OUString , const Locale 
)
 {
 if (rWord.getLength() > MAXWORDLEN)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2016-09-14 Thread Stephan Bergmann
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0f6cb25be8ef72ec1e3cadded38f0698edf08cb4
Author: Stephan Bergmann 
Date:   Wed Sep 14 14:48:18 2016 +0200

loplugin:override

Change-Id: If6d03fd0d3b5b69f3b07e697c4f6d7a3668ee69a

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index b51a804..ceb370d 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -86,7 +86,7 @@ class MacSpellChecker :
 
 public:
 MacSpellChecker();
-virtual ~MacSpellChecker();
+virtual ~MacSpellChecker() override;
 
 // XSupportedLocales (for XSpellChecker)
 virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException) 
override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2016-02-02 Thread Kay Schenk
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 6691d78f1df044877fdfa30dd08f0821569efc92
Author: Kay Schenk 
Date:   Thu Jan 28 22:19:30 2016 +

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

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

(cherry picked from commit 983e71fa37e12fbae29eddc2b855ddaf6280cc0e)

Change-Id: I279275e11fb2ee6a223c7905652165d1b7a2e0ac

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 00e8e50a..e8ec4e8 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -21,11 +21,13 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -141,6 +143,8 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 
 if (!aDics.empty())
 {
+uno::Reference< lang::XMultiServiceFactory > 
xServiceFactory(comphelper::getProcessServiceFactory());
+uno::Reference< ucb::XSimpleFileAccess > 
xAccess(xServiceFactory->createInstance("com.sun.star.ucb.SimpleFileAccess"), 
uno::UNO_QUERY);
 // get supported locales from the dictionaries-to-use...
 sal_Int32 k = 0;
 std::set< OUString, lt_rtl_OUString > aLocaleNamesSet;
@@ -148,10 +152,14 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
 for (aDictIt = aDics.begin();  aDictIt != aDics.end();  ++aDictIt)
 {
 uno::Sequence< OUString > aLocaleNames( aDictIt->aLocaleNames 
);
+uno::Sequence< OUString > aLocations( aDictIt->aLocations );
 sal_Int32 nLen2 = aLocaleNames.getLength();
 for (k = 0;  k < nLen2;  ++k)
 {
-aLocaleNamesSet.insert( aLocaleNames[k] );
+if (xAccess.is() && xAccess->exists(aLocations[k]))
+{
+aLocaleNamesSet.insert( aLocaleNames[k] );
+}
 }
 }
 // ... and add them to the resulting sequence
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source linguistic/source lotuswordpro/source mysqlc/source

2015-12-22 Thread Noel Grandin
 lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx   |1 -
 lingucomponent/source/languageguessing/guesslang.cxx|   12 +---
 linguistic/source/defs.hxx  |2 --
 lotuswordpro/source/filter/LotusWordProImportFilter.hxx |1 -
 lotuswordpro/source/filter/lwpbulletstylemgr.hxx|1 -
 mysqlc/source/mysqlc_connection.hxx |1 -
 6 files changed, 5 insertions(+), 13 deletions(-)

New commits:
commit 1b80ad7246db991596f44ca58c4e4bd1e387e524
Author: Noel Grandin 
Date:   Tue Dec 22 09:58:45 2015 +0200

loplugin:unusedfields in lingu,lotuswordpro,mysqlc

Change-Id: I5866c8d95e04714e81a45e73bf00a430859a4327

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
index 73fc628..e59ab94 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
@@ -70,7 +70,6 @@ class Hyphenator :
 sal_Int32 numdict;
 
 ::cppu::OInterfaceContainerHelper   aEvtListeners;
-Reference< XMultiServiceFactory >   rSMgr;
 linguistic::PropertyHelper_Hyphenation* pPropHelper;
 boolbDisposing;
 
diff --git a/lingucomponent/source/languageguessing/guesslang.cxx 
b/lingucomponent/source/languageguessing/guesslang.cxx
index 0cc0054..2ccea80 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -80,13 +80,12 @@ class LangGuess_Impl :
 {
 SimpleGuesser   m_aGuesser;
 boolm_bInitialized;
-css::uno::Reference< css::uno::XComponentContext >  m_xContext;
 
 virtual ~LangGuess_Impl() {}
 voidEnsureInitialized();
 
 public:
-explicit LangGuess_Impl(css::uno::Reference< css::uno::XComponentContext > 
const & rxContext);
+LangGuess_Impl();
 
 // XServiceInfo implementation
 virtual OUString SAL_CALL getImplementationName(  ) 
throw(RuntimeException, std::exception) override;
@@ -106,9 +105,8 @@ public:
 void SetFingerPrintsDB( const OUString  ) throw 
(RuntimeException);
 };
 
-LangGuess_Impl::LangGuess_Impl(css::uno::Reference< 
css::uno::XComponentContext > const & rxContext) :
-m_bInitialized( false ),
-m_xContext( rxContext )
+LangGuess_Impl::LangGuess_Impl() :
+m_bInitialized( false )
 {
 }
 
@@ -351,9 +349,9 @@ Sequence SAL_CALL 
LangGuess_Impl::getSupportedServiceNames_Static(  )
  * @param xMgr service manager to if the components needs other component 
instances
  */
 Reference< XInterface > SAL_CALL LangGuess_Impl_create(
-Reference< XComponentContext > const & xContext )
+Reference< XComponentContext > const & )
 {
-return static_cast< ::cppu::OWeakObject * >( new LangGuess_Impl(xContext) 
);
+return static_cast< ::cppu::OWeakObject * >( new LangGuess_Impl );
 }
 
 // EXPORTED ### functions to allow for registration and creation of the 
UNO component
diff --git a/linguistic/source/defs.hxx b/linguistic/source/defs.hxx
index ab86dfb..213f812 100644
--- a/linguistic/source/defs.hxx
+++ b/linguistic/source/defs.hxx
@@ -73,8 +73,6 @@ struct LangSvcEntries_Spell : public LangSvcEntries
 
 struct LangSvcEntries_Grammar : public LangSvcEntries
 {
-css::uno::Sequence< css::uno::Reference< css::linguistic2::XProofreader > 
>  aSvcRefs;
-
 LangSvcEntries_Grammar() : LangSvcEntries() {}
 explicit LangSvcEntries_Grammar( const OUString  ) : 
LangSvcEntries( rSvcImplName ) {}
 };
diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.hxx 
b/lotuswordpro/source/filter/LotusWordProImportFilter.hxx
index e2a953c..0babf81 100644
--- a/lotuswordpro/source/filter/LotusWordProImportFilter.hxx
+++ b/lotuswordpro/source/filter/LotusWordProImportFilter.hxx
@@ -48,7 +48,6 @@ protected:
 css::uno::Reference< css::uno::XComponentContext > mxContext;
 css::uno::Reference< css::lang::XComponent > mxDoc;
 OUString msFilterName;
-css::uno::Reference< css::xml::sax::XDocumentHandler > mxHandler;
 
 bool SAL_CALL importImpl( const css::uno::Sequence< 
css::beans::PropertyValue >& aDescriptor )
 throw (css::uno::RuntimeException, std::exception);
diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.hxx 
b/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
index 98a83ab..878b2c3 100644
--- a/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
@@ -97,7 +97,6 @@ private:
 bool m_bContinue;
 bool m_bIsBulletSkipped;
 LwpObjectID m_aCurrentNumberingID;
-std::unique_ptr m_pCurrentNumOverride;
 };
 
 inline void LwpBulletStyleMgr::SetFoundry(LwpFoundry* pFoundry)
diff --git a/mysqlc/source/mysqlc_connection.hxx 
b/mysqlc/source/mysqlc_connection.hxx
index 78ccd0d..a41f349 100644
--- a/mysqlc/source/mysqlc_connection.hxx
+++ b/mysqlc/source/mysqlc_connection.hxx
@@ -104,7 +104,6 @@ namespace 

[Libreoffice-commits] core.git: lingucomponent/source

2015-11-17 Thread Stephan Bergmann
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 8f7e5633b12802cd4a7f06ca27659f0983018786
Author: Stephan Bergmann 
Date:   Tue Nov 17 10:39:42 2015 +0100

Don't assume sal_Unicode is unsigned short

Change-Id: Ia93c541ea21be89578789d58f642109184a18685

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 29b6b74..a73ceba 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -236,11 +236,11 @@ sal_Int16 MacSpellChecker::GetSpellFailure( const 
OUString , const Locale
 {
 aEnc = 0;
 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
-NSString* aNSStr = [[NSString alloc] initWithCharacters: 
nWord.getStr() length: nWord.getLength()];
-NSString* aLang = [[NSString alloc] initWithCharacters: 
rLocale.Language.getStr() length: rLocale.Language.getLength()];
+NSString* aNSStr = [[NSString alloc] initWithCharacters: 
reinterpret_cast(nWord.getStr()) length: nWord.getLength()];
+NSString* aLang = [[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Language.getStr()) length: 
rLocale.Language.getLength()];
 if(rLocale.Country.getLength()>0)
 {
-NSString* aCountry = [[NSString alloc] initWithCharacters: 
rLocale.Country.getStr() length: rLocale.Country.getLength()];
+NSString* aCountry = [[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Country.getStr()) length: 
rLocale.Country.getLength()];
 NSString* aTag = @"_";
 NSString* aTaggedCountry = [aTag stringByAppendingString:aCountry];
 [aLang autorelease];
@@ -339,11 +339,11 @@ Reference< XSpellAlternatives >
 if (n)
 {
 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
-NSString* aNSStr = [[NSString alloc] initWithCharacters: 
nWord.getStr() length: nWord.getLength()];
-NSString* aLang = [[NSString alloc] initWithCharacters: 
rLocale.Language.getStr() length: rLocale.Language.getLength() ];
+NSString* aNSStr = [[NSString alloc] initWithCharacters: 
reinterpret_cast(nWord.getStr()) length: nWord.getLength()];
+NSString* aLang = [[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Language.getStr()) length: 
rLocale.Language.getLength() ];
 if(rLocale.Country.getLength()>0)
 {
-NSString* aCountry = [[NSString alloc] initWithCharacters: 
rLocale.Country.getStr() length: rLocale.Country.getLength() ];
+NSString* aCountry = [[NSString alloc] initWithCharacters: 
reinterpret_cast(rLocale.Country.getStr()) length: 
rLocale.Country.getLength() ];
 NSString* aTag = @"_";
 NSString* aTaggedCountry = [aTag stringByAppendingString:aCountry];
 [aLang autorelease];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2015-08-19 Thread Takeshi Abe
 lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx|5 ++---
 lingucomponent/source/languageguessing/guesslang.cxx |4 ++--
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx |5 ++---
 lingucomponent/source/spellcheck/spell/sspellimp.hxx |5 ++---
 lingucomponent/source/thesaurus/libnth/nthesdta.hxx  |4 ++--
 lingucomponent/source/thesaurus/libnth/nthesimp.hxx  |5 ++---
 6 files changed, 12 insertions(+), 16 deletions(-)

New commits:
commit e87c08babed9e3ac34908771fc95cab5386f01a2
Author: Takeshi Abe t...@fixedpoint.jp
Date:   Wed Aug 19 10:23:16 2015 +0900

lingucomponent: tdf#88206 replace cppu::WeakImplHelper*

with the variadic variants.

Change-Id: Ibe00b26512a4895a603a084f4e816c74b99894df
Reviewed-on: https://gerrit.libreoffice.org/17850
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Noel Grandin noelgran...@gmail.com

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
index ad5db82..d7bb068 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
@@ -20,8 +20,7 @@
 #ifndef INCLUDED_LINGUCOMPONENT_SOURCE_HYPHENATOR_HYPHEN_HYPHENIMP_HXX
 #define INCLUDED_LINGUCOMPONENT_SOURCE_HYPHENATOR_HYPHEN_HYPHENIMP_HXX
 
-#include cppuhelper/implbase1.hxx
-#include cppuhelper/implbase6.hxx
+#include cppuhelper/implbase.hxx
 #include com/sun/star/lang/XComponent.hpp
 #include com/sun/star/lang/XInitialization.hpp
 #include com/sun/star/lang/XServiceDisplayName.hpp
@@ -56,7 +55,7 @@ struct HDInfo {
 };
 
 class Hyphenator :
-public cppu::WeakImplHelper6
+public cppu::WeakImplHelper
 
 XHyphenator,
 XLinguServiceEventBroadcaster,
diff --git a/lingucomponent/source/languageguessing/guesslang.cxx 
b/lingucomponent/source/languageguessing/guesslang.cxx
index 9c848cd..2b2da0e 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -25,7 +25,7 @@
 #include sal/config.h
 #include cppuhelper/factory.hxx
 #include cppuhelper/implementationentry.hxx
-#include cppuhelper/implbase2.hxx
+#include cppuhelper/implbase.hxx
 #include cppuhelper/supportsservice.hxx
 
 #include simpleguesser.hxx
@@ -74,7 +74,7 @@ static osl::Mutex   GetLangGuessMutex()
 }
 
 class LangGuess_Impl :
-public ::cppu::WeakImplHelper2
+public ::cppu::WeakImplHelper
 XLanguageGuessing,
 XServiceInfo ,
 private boost::noncopyable
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index df566a8..5a53fd3 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -20,8 +20,7 @@
 #ifndef INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_MACOSXSPELL_MACSPELLIMP_HXX
 #define INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_MACOSXSPELL_MACSPELLIMP_HXX
 
-#include cppuhelper/implbase1.hxx
-#include cppuhelper/implbase6.hxx
+#include cppuhelper/implbase.hxx
 
 #ifdef MACOSX
 #include premac.h
@@ -50,7 +49,7 @@ using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::linguistic2;
 
 class MacSpellChecker :
-public cppu::WeakImplHelper6
+public cppu::WeakImplHelper
 
 XSpellChecker,
 XLinguServiceEventBroadcaster,
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.hxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
index 097471b..ffbff58 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.hxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
@@ -20,8 +20,7 @@
 #ifndef INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_SPELL_SSPELLIMP_HXX
 #define INCLUDED_LINGUCOMPONENT_SOURCE_SPELLCHECK_SPELL_SSPELLIMP_HXX
 
-#include cppuhelper/implbase1.hxx
-#include cppuhelper/implbase6.hxx
+#include cppuhelper/implbase.hxx
 #include com/sun/star/lang/XComponent.hpp
 #include com/sun/star/lang/XInitialization.hpp
 #include com/sun/star/lang/XServiceDisplayName.hpp
@@ -45,7 +44,7 @@ using namespace ::com::sun::star::linguistic2;
 class Hunspell;
 
 class SpellChecker :
-public cppu::WeakImplHelper6
+public cppu::WeakImplHelper
 
 XSpellChecker,
 XLinguServiceEventBroadcaster,
diff --git a/lingucomponent/source/thesaurus/libnth/nthesdta.hxx 
b/lingucomponent/source/thesaurus/libnth/nthesdta.hxx
index 9e676e2..28e2f2f 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesdta.hxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesdta.hxx
@@ -21,13 +21,13 @@
 #define INCLUDED_LINGUCOMPONENT_SOURCE_THESAURUS_LIBNTH_NTHESDTA_HXX
 
 #include com/sun/star/linguistic2/XMeaning.hpp
-#include cppuhelper/implbase1.hxx
+#include cppuhelper/implbase.hxx
 
 namespace linguistic
 {
 
 class Meaning :
-public cppu::WeakImplHelper1
+public 

[Libreoffice-commits] core.git: lingucomponent/source

2015-04-02 Thread Stephan Bergmann
 lingucomponent/source/spellcheck/macosxspell/macreg.mm |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4d2923e1876e1c3a1da9056e4508be71e6cac9f3
Author: Stephan Bergmann sberg...@redhat.com
Date:   Thu Apr 2 21:02:04 2015 +0200

loplugin:redundantcast

Change-Id: I3ef78881cfed8b66f067e9164efcccf425fb549c

diff --git a/lingucomponent/source/spellcheck/macosxspell/macreg.mm 
b/lingucomponent/source/spellcheck/macosxspell/macreg.mm
index b3504c1..648fc84 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macreg.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macreg.mm
@@ -38,7 +38,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL 
MacOSXSpell_component_getFactory(
 void * pRet = NULL;
 pRet = MacSpellChecker_getFactory(
 pImplName,
-reinterpret_cast XMultiServiceFactory * ( pServiceManager ),
+static_cast XMultiServiceFactory * ( pServiceManager ),
 pRegistryKey );
 
 return pRet;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2014-08-07 Thread Stephan Bergmann
 lingucomponent/source/languageguessing/guesslang.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit f31424e650c4f7d4a09a166377ee4890fd317292
Author: Stephan Bergmann sberg...@redhat.com
Date:   Thu Aug 7 13:44:03 2014 +0200

Fix *_component_getFactory function type

Change-Id: Ib86d37e1570c9a64ef83beaf11bf0ec4676533eb

diff --git a/lingucomponent/source/languageguessing/guesslang.cxx 
b/lingucomponent/source/languageguessing/guesslang.cxx
index c778ff9..66f8b6d 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -31,7 +31,6 @@
 #include simpleguesser.hxx
 #include guess.hxx
 
-#include com/sun/star/registry/XRegistryKey.hpp
 #include com/sun/star/lang/XServiceInfo.hpp
 #include com/sun/star/linguistic2/XLanguageGuessing.hpp
 #include unotools/pathoptions.hxx
@@ -377,8 +376,8 @@ extern C
 {
 
 SAL_DLLPUBLIC_EXPORT void * SAL_CALL guesslang_component_getFactory(
-sal_Char const * implName, lang::XMultiServiceFactory * xMgr,
-registry::XRegistryKey * xRegistry )
+sal_Char const * implName, void * xMgr,
+void * xRegistry )
 {
 return ::cppu::component_getFactoryHelper(
 implName, xMgr, xRegistry, s_component_entries );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2014-07-15 Thread László Németh
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |2 +-
 lingucomponent/source/lingutil/lingutil.cxx   |   13 +
 lingucomponent/source/lingutil/lingutil.hxx   |8 
 lingucomponent/source/spellcheck/spell/sspellimp.cxx  |4 ++--
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx   |4 ++--
 5 files changed, 26 insertions(+), 5 deletions(-)

New commits:
commit ea9331fd4955fe6fad0957ee6240275148353e32
Author: László Németh nem...@numbertext.org
Date:   Tue Jul 15 14:11:34 2014 +0200

fdo#80363 always use WIN32 long path prefix with Hunspell, MyThes, Hyphen

Change-Id: I738401babffd38c241ef16e23d1b246444fd8d55

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 72fd23d..b8b9979 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -293,7 +293,7 @@ Reference XHyphenatedWord  SAL_CALL 
Hyphenator::hyphenate( const OUString aWo
 
 #if defined(WNT)
 // Hyphen waits UTF-8 encoded paths with \\?\ long path prefix.
-OString sTmp = OUStringToOString(dictpath, RTL_TEXTENCODING_UTF8);
+OString sTmp = Win_AddLongPathPrefix(OUStringToOString(dictpath, 
RTL_TEXTENCODING_UTF8));
 #else
 OString sTmp( OU2ENC( dictpath, osl_getThreadTextEncoding() ) );
 #endif
diff --git a/lingucomponent/source/lingutil/lingutil.cxx 
b/lingucomponent/source/lingutil/lingutil.cxx
index 769a023..c384a5b 100644
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#if defined(WNT)
+#include windows.h
+#endif
+
 #include osl/thread.h
 #include osl/file.hxx
 #include tools/debug.hxx
@@ -41,6 +45,15 @@
 using ::com::sun::star::lang::Locale;
 using namespace ::com::sun::star;
 
+#if defined(WNT)
+OString Win_AddLongPathPrefix( const OString rPathName )
+{
+#define WIN32_LONG_PATH_PREFIX ?\\
+  if (!rPathName.match(WIN32_LONG_PATH_PREFIX)) return WIN32_LONG_PATH_PREFIX 
+ rPathName;
+  return rPathName;
+}
+#endif //defined(WNT)
+
 // build list of old style diuctionaries (not as extensions) to use.
 // User installed dictionaries (the ones residing in the user paths)
 // will get precedence over system installed ones for the same language.
diff --git a/lingucomponent/source/lingutil/lingutil.hxx 
b/lingucomponent/source/lingutil/lingutil.hxx
index bda6de1..a54832c 100644
--- a/lingucomponent/source/lingutil/lingutil.hxx
+++ b/lingucomponent/source/lingutil/lingutil.hxx
@@ -48,6 +48,14 @@ inline bool operator == ( const 
::com::sun::star::lang::Locale rL1, const ::com
 rL1.Variant  ==  rL2.Variant;
 }
 
+#if defined(WNT)
+
+// to be use to get a path name with long path prefix
+// under Windows for Hunspell, Hyphen and MyThes libraries
+OString Win_AddLongPathPrefix( const OString rPathName );
+#endif
+
+
 // temporary function, to be removed when new style dictionaries
 // using configuration entries are fully implemented and provided
 std::vector SvtLinguConfigDictionaryEntry  GetOldStyleDics( const char * 
pDicType );
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 8881816..078f9da 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -306,8 +306,8 @@ sal_Int16 SpellChecker::GetSpellFailure( const OUString 
rWord, const Locale rL
 // about 120+ characters which will usually be exceed when
 // using dictionaries as extensions. (Hunspell waits UTF-8 
encoded
 // path with \\?\ long path prefix.)
-OString aTmpaff = OUStringToOString(aff, 
RTL_TEXTENCODING_UTF8);
-OString aTmpdict = OUStringToOString(dict, 
RTL_TEXTENCODING_UTF8);
+OString aTmpaff = 
Win_AddLongPathPrefix(OUStringToOString(aff, RTL_TEXTENCODING_UTF8));
+OString aTmpdict = 
Win_AddLongPathPrefix(OUStringToOString(dict, RTL_TEXTENCODING_UTF8));
 #else
 OString aTmpaff(OU2ENC(aff,osl_getThreadTextEncoding()));
 OString aTmpdict(OU2ENC(dict,osl_getThreadTextEncoding()));
diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx 
b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
index 73d0542..994f28a 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
@@ -331,8 +331,8 @@ Sequence  Reference  
::com::sun::star::linguistic2::XMeaning   SAL_CALL Thes
 
 #if defined(WNT)
 // MyThes waits UTF-8 encoded paths with \\?\ long path prefix.
-OString aTmpidx = OUStringToOString(nidx, 
RTL_TEXTENCODING_UTF8);
-OString 

[Libreoffice-commits] core.git: lingucomponent/source

2014-06-17 Thread Douglas Mencken
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |4 
 1 file changed, 4 insertions(+)

New commits:
commit 5b2df0c09c63cc06c9158dba1b9e161fc799ba16
Author: Douglas Mencken dougmenc...@gmail.com
Date:   Sun Jun 15 12:37:48 2014 -0400

conditionally revert 96840ff0ce697c5c05b59d53409b3cf27ac35e5f

Change-Id: If5e53ca72fc3b90435d95b50c5c796ec0ff04869
Reviewed-on: https://gerrit.libreoffice.org/9790
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 73f2be9..4f17ad3 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -350,7 +350,11 @@ Reference XSpellAlternatives 
 aLang = [aLang  stringByAppendingString:aTaggedCountry];
 }
 [macSpell setLanguage:aLang];
+#if MAC_OS_X_VERSION_MAX_ALLOWED  1060
+NSArray *guesses = [macSpell guessesForWord:aNSStr];
+#else
 NSArray *guesses = [macSpell guessesForWordRange:NSMakeRange(0, 
[aNSStr length]) inString:aNSStr language:aLang inSpellDocumentWithTag:0];
+#endif
 count = [guesses count];
 if (count)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2014-05-23 Thread Tor Lillqvist
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx |   23 ++
 1 file changed, 23 insertions(+)

New commits:
commit 7933b269ba4c5a49dd394eef15e98c55a19038ef
Author: Tor Lillqvist t...@collabora.com
Date:   Fri May 23 13:12:05 2014 +0300

Reintroduce Win_GetShortPathName()

Change-Id: Id15d1d4d9b7fb9bb2a0a5f52b5ec1928c38bd27b

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 9f7028b..94abeb9 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -507,6 +507,29 @@ Reference  XHyphenatedWord  SAL_CALL 
Hyphenator::queryAlternativeSpelling(
 return NULL;
 }
 
+#if defined(WNT)
+static OString Win_GetShortPathName( const OUString rLongPathName )
+{
+OString aRes;
+
+sal_Unicode aShortBuffer[1024] = {0};
+sal_Int32   nShortBufSize = SAL_N_ELEMENTS( aShortBuffer );
+
+// use the version of 'GetShortPathName' that can deal with Unicode...
+sal_Int32 nShortLen = GetShortPathNameW(
+reinterpret_castLPCWSTR( rLongPathName.getStr() ),
+reinterpret_castLPWSTR( aShortBuffer ),
+nShortBufSize );
+
+if (nShortLen  nShortBufSize) // conversion successful?
+aRes = OString( OU2ENC( OUString( aShortBuffer, nShortLen ), 
osl_getThreadTextEncoding()) );
+else
+OSL_FAIL( Win_GetShortPathName: buffer to short );
+
+return aRes;
+}
+#endif //defined(WNT)
+
 Reference XPossibleHyphens  SAL_CALL Hyphenator::createPossibleHyphens( 
const OUString aWord,
 const ::com::sun::star::lang::Locale aLocale,
 const ::com::sun::star::beans::PropertyValues aProperties )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2014-04-25 Thread Caolán McNamara
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 445d62565d662a7119a0c49e8e8de68ee244dc74
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Apr 25 20:16:01 2014 +0100

error C2059: syntax error : ´)´

Change-Id: Ic81d7f524ff0ea5fb2e79de2828d77f91791ed35

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index a58885b..c8b665d 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -306,8 +306,8 @@ sal_Int16 SpellChecker::GetSpellFailure( const OUString 
rWord, const Locale rL
 // about 120+ characters which will usually be exceed when
 // using dictionaries as extensions. (Hunspell waits UTF-8 
encoded
 // path with \\?\ long path prefix.)
-OString aTmpaff = OUStringToOString(aff, 
RTL_TEXTENCODING_UTF8));
-OString aTmpdict = OUStringToOString(dict, 
RTL_TEXTENCODING_UTF8));
+OString aTmpaff = OUStringToOString(aff, 
RTL_TEXTENCODING_UTF8);
+OString aTmpdict = OUStringToOString(dict, 
RTL_TEXTENCODING_UTF8);
 #else
 OString aTmpaff(OU2ENC(aff,osl_getThreadTextEncoding()));
 OString aTmpdict(OU2ENC(dict,osl_getThreadTextEncoding()));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2014-04-14 Thread Stephan Bergmann
 lingucomponent/source/hyphenator/hyphen/hreg.cxx  |8 ++--
 lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx |6 ++
 lingucomponent/source/languageguessing/guesslang.cxx  |   10 +++---
 lingucomponent/source/spellcheck/spell/sreg.cxx   |8 ++--
 lingucomponent/source/spellcheck/spell/sspellimp.hxx  |6 ++
 lingucomponent/source/thesaurus/libnth/nthesimp.hxx   |4 
 lingucomponent/source/thesaurus/libnth/ntreg.cxx  |8 ++--
 7 files changed, 25 insertions(+), 25 deletions(-)

New commits:
commit 5b8ca52fe7ebe40761b9ecd84d313f90eba61687
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Apr 14 13:10:53 2014 +0200

Clean up function declarations

Change-Id: Ia811e9d3a6745e75fb6c6876316fde3629d8

diff --git a/lingucomponent/source/hyphenator/hyphen/hreg.cxx 
b/lingucomponent/source/hyphenator/hyphen/hreg.cxx
index 9142dfa..493df8b 100644
--- a/lingucomponent/source/hyphenator/hyphen/hreg.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hreg.cxx
@@ -22,15 +22,11 @@
 
 #include com/sun/star/registry/XRegistryKey.hpp
 
+#include hyphenimp.hxx
+
 using namespace com::sun::star::lang;
 using namespace com::sun::star::registry;
 
-// declaration of external RegEntry-functions defined by the service objects
-extern void * SAL_CALL Hyphenator_getFactory(
-const sal_Char * pImplName,
-XMultiServiceFactory * pServiceManager,
-void * /*pRegistryKey*/ );
-
 // definition of the two functions that are used to provide the services
 extern C
 {
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
index c99a954..919c64b 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx
@@ -40,6 +40,8 @@
 #include lingutil.hxx
 #include stdio.h
 
+#include hyphen.h
+
 using namespace ::rtl;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
@@ -132,6 +134,10 @@ inline OUString Hyphenator::getImplementationName_Static() 
throw()
 return OUString( org.openoffice.lingu.LibHnjHyphenator );
 }
 
+void * SAL_CALL Hyphenator_getFactory(
+char const * pImplName, css::lang::XMultiServiceFactory * pServiceManager,
+void *);
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lingucomponent/source/languageguessing/guesslang.cxx 
b/lingucomponent/source/languageguessing/guesslang.cxx
index ba7f1f3..b21f9ba 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -19,6 +19,7 @@
 
 #include iostream
 
+#include boost/noncopyable.hpp
 #include tools/debug.hxx
 
 #include sal/config.h
@@ -77,15 +78,13 @@ static osl::Mutex   GetLangGuessMutex()
 class LangGuess_Impl :
 public ::cppu::WeakImplHelper2
 XLanguageGuessing,
-XServiceInfo 
+XServiceInfo ,
+private boost::noncopyable
 {
 SimpleGuesser   m_aGuesser;
 boolm_bInitialized;
 css::uno::Reference css::uno::XComponentContext   m_xContext;
 
-LangGuess_Impl( const LangGuess_Impl  ); // not defined
-LangGuess_Impl  operator =( const LangGuess_Impl  ); // not defined
-
 virtual ~LangGuess_Impl() {}
 voidEnsureInitialized();
 
@@ -108,9 +107,6 @@ public:
 
 // implementation specific
 void SetFingerPrintsDB( const OUString fileName ) throw 
(RuntimeException);
-
-static const OUString  SAL_CALL getImplementationName_Static() throw();
-
 };
 
 LangGuess_Impl::LangGuess_Impl(css::uno::Reference 
css::uno::XComponentContext  const  rxContext) :
diff --git a/lingucomponent/source/spellcheck/spell/sreg.cxx 
b/lingucomponent/source/spellcheck/spell/sreg.cxx
index e8b75ff..e018a4a 100644
--- a/lingucomponent/source/spellcheck/spell/sreg.cxx
+++ b/lingucomponent/source/spellcheck/spell/sreg.cxx
@@ -22,15 +22,11 @@
 
 #include com/sun/star/registry/XRegistryKey.hpp
 
+#include sspellimp.hxx
+
 using namespace com::sun::star::lang;
 using namespace com::sun::star::registry;
 
-// declaration of external RegEntry-functions defined by the service objects
-extern void * SAL_CALL SpellChecker_getFactory(
-const sal_Char * pImplName,
-XMultiServiceFactory * pServiceManager,
-void * /*pRegistryKey*/ );
-
 // definition of the two functions that are used to provide the services
 extern C
 {
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.hxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
index 9c7c0d8..6aa649c 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.hxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
@@ -43,6 +43,8 @@ using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::linguistic2;
 
+class Hunspell;
+
 class SpellChecker :
 public cppu::WeakImplHelper6
 
@@ -119,6 +121,10 @@ inline OUString 

[Libreoffice-commits] core.git: lingucomponent/source

2014-04-14 Thread Stephan Bergmann
 lingucomponent/source/spellcheck/macosxspell/macreg.mm   |   15 +--
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx |3 ++
 2 files changed, 5 insertions(+), 13 deletions(-)

New commits:
commit 981590d1cf89bb07864ec62bfebdc03c61bd475b
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Apr 14 21:54:23 2014 +0200

Clean up function declarations

Change-Id: Ic00323f1c22f9b3642758dc21b65a2413624515e

diff --git a/lingucomponent/source/spellcheck/macosxspell/macreg.mm 
b/lingucomponent/source/spellcheck/macosxspell/macreg.mm
index 6324c32..b3504c1 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macreg.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macreg.mm
@@ -24,22 +24,11 @@
 
 #include com/sun/star/registry/XRegistryKey.hpp
 
+#include macspellimp.hxx
+
 using namespace com::sun::star::lang;
 using namespace com::sun::star::registry;
 
-
-// declaration of external RegEntry-functions defined by the service objects
-
-
-extern void * SAL_CALL MacSpellChecker_getFactory(
-const sal_Char * pImplName,
-XMultiServiceFactory * pServiceManager,
-void * /*pRegistryKey*/ );
-
-
-// definition of the two functions that are used to provide the services
-
-
 extern C
 {
 
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index 696553d..94a53a9 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -127,6 +127,9 @@ inline OUString 
MacSpellChecker::getImplementationName_Static() throw()
 return OUString( org.openoffice.lingu.MacOSXSpellChecker );
 }
 
+void * SAL_CALL MacSpellChecker_getFactory(
+char const * pImplName, XMultiServiceFactory * pServiceManager, void *);
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2014-03-30 Thread Stephan Bergmann
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx |   28 +--
 1 file changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 2ee552c8973859aafae95a967c395f670c202e88
Author: Stephan Bergmann sberg...@redhat.com
Date:   Sun Mar 30 22:19:37 2014 +0200

loplugin:saloverride

Change-Id: I19d7a8eb9f53a7f5ab7acf9dc7b0ca0b90950ee5

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index 7f7f501..696553d 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -91,32 +91,32 @@ public:
 virtual ~MacSpellChecker();
 
 // XSupportedLocales (for XSpellChecker)
-virtual Sequence Locale  SAL_CALL getLocales() throw(RuntimeException);
-virtual sal_Bool SAL_CALL hasLocale( const Locale rLocale ) 
throw(RuntimeException);
+virtual Sequence Locale  SAL_CALL getLocales() throw(RuntimeException) 
SAL_OVERRIDE;
+virtual sal_Bool SAL_CALL hasLocale( const Locale rLocale ) 
throw(RuntimeException) SAL_OVERRIDE;
 
 // XSpellChecker
-virtual sal_Bool SAL_CALL isValid( const OUString rWord, const Locale 
rLocale, const PropertyValues rProperties ) throw(IllegalArgumentException, 
RuntimeException);
-virtual Reference XSpellAlternatives  SAL_CALL spell( const OUString 
rWord, const Locale rLocale, const PropertyValues rProperties ) 
throw(IllegalArgumentException, RuntimeException);
+virtual sal_Bool SAL_CALL isValid( const OUString rWord, const Locale 
rLocale, const PropertyValues rProperties ) throw(IllegalArgumentException, 
RuntimeException) SAL_OVERRIDE;
+virtual Reference XSpellAlternatives  SAL_CALL spell( const OUString 
rWord, const Locale rLocale, const PropertyValues rProperties ) 
throw(IllegalArgumentException, RuntimeException) SAL_OVERRIDE;
 
 // XLinguServiceEventBroadcaster
-virtual sal_Bool SAL_CALL addLinguServiceEventListener( const Reference 
XLinguServiceEventListener  rxLstnr ) throw(RuntimeException);
-virtual sal_Bool SAL_CALL removeLinguServiceEventListener( const 
Reference XLinguServiceEventListener  rxLstnr ) throw(RuntimeException);
+virtual sal_Bool SAL_CALL addLinguServiceEventListener( const Reference 
XLinguServiceEventListener  rxLstnr ) throw(RuntimeException) SAL_OVERRIDE;
+virtual sal_Bool SAL_CALL removeLinguServiceEventListener( const 
Reference XLinguServiceEventListener  rxLstnr ) throw(RuntimeException) 
SAL_OVERRIDE;
 
 // XServiceDisplayName
-virtual OUString SAL_CALL getServiceDisplayName( const Locale rLocale ) 
throw(RuntimeException);
+virtual OUString SAL_CALL getServiceDisplayName( const Locale rLocale ) 
throw(RuntimeException) SAL_OVERRIDE;
 
 // XInitialization
-virtual void SAL_CALL initialize( const Sequence Any  rArguments ) 
throw(Exception, RuntimeException);
+virtual void SAL_CALL initialize( const Sequence Any  rArguments ) 
throw(Exception, RuntimeException) SAL_OVERRIDE;
 
 // XComponent
-virtual void SAL_CALL dispose() throw(RuntimeException);
-virtual void SAL_CALL addEventListener( const Reference XEventListener  
rxListener ) throw(RuntimeException);
-virtual void SAL_CALL removeEventListener( const Reference XEventListener 
 rxListener ) throw(RuntimeException);
+virtual void SAL_CALL dispose() throw(RuntimeException) SAL_OVERRIDE;
+virtual void SAL_CALL addEventListener( const Reference XEventListener  
rxListener ) throw(RuntimeException) SAL_OVERRIDE;
+virtual void SAL_CALL removeEventListener( const Reference XEventListener 
 rxListener ) throw(RuntimeException) SAL_OVERRIDE;
 
 // XServiceInfo
-virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
-virtual sal_Bool SAL_CALL supportsService( const OUString rServiceName ) 
throw(RuntimeException);
-virtual Sequence OUString  SAL_CALL getSupportedServiceNames() 
throw(RuntimeException);
+virtual OUString SAL_CALL getImplementationName() throw(RuntimeException) 
SAL_OVERRIDE;
+virtual sal_Bool SAL_CALL supportsService( const OUString rServiceName ) 
throw(RuntimeException) SAL_OVERRIDE;
+virtual Sequence OUString  SAL_CALL getSupportedServiceNames() 
throw(RuntimeException) SAL_OVERRIDE;
 
 static inline OUString  getImplementationName_Static() throw();
 static Sequence OUString  getSupportedServiceNames_Static() throw();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2014-03-25 Thread Tor Lillqvist
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit f883832c93f78559fa5e1ba5d6d4dd2681595680
Author: Tor Lillqvist t...@collabora.com
Date:   Tue Mar 25 14:43:05 2014 +0200

WaE: unused variable 'catst2' [loplugin:unusedvariablecheck]

Change-Id: Iaeff659796b17ffe5e102b75045c90913f12b615

diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx 
b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
index 300d0f3..8db3f29 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
@@ -405,7 +405,6 @@ Sequence  Reference  
::com::sun::star::linguistic2::XMeaning   SAL_CALL Thes
 OUString sTerm(pe-psyns[i],strlen(pe-psyns[i]),eEnc );
 sal_Int32 catpos = sTerm.indexOf('(');
 OUString catst;
-OUString catst2;
 if (catpos  2)
 {
 // remove category name for affixation and casing
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2014-02-26 Thread Alexander Wilms
 lingucomponent/source/hyphenator/hyphen/hreg.cxx |8 --
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx|   34 +
 lingucomponent/source/hyphenator/hyphen/hyphenimp.hxx|   12 ---
 lingucomponent/source/languageguessing/guess.cxx |   10 +-
 lingucomponent/source/languageguessing/guesslang.cxx |   23 --
 lingucomponent/source/languageguessing/simpleguesser.cxx |   11 ---
 lingucomponent/source/lingutil/lingutil.cxx  |9 --
 lingucomponent/source/lingutil/lingutil.hxx  |   12 ---
 lingucomponent/source/spellcheck/macosxspell/macreg.mm   |   10 +-
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx |   10 --
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm  |2 
 lingucomponent/source/spellcheck/spell/sreg.cxx  |8 --
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |   38 +--
 lingucomponent/source/spellcheck/spell/sspellimp.hxx |8 --
 lingucomponent/source/thesaurus/libnth/nthesdta.cxx  |7 --
 lingucomponent/source/thesaurus/libnth/nthesdta.hxx  |3 
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx  |   28 
 lingucomponent/source/thesaurus/libnth/nthesimp.hxx  |   10 --
 lingucomponent/source/thesaurus/libnth/ntreg.cxx |8 --
 19 files changed, 29 insertions(+), 222 deletions(-)

New commits:
commit 412c47ded694df2f955b4c590f096238eb549d3d
Author: Alexander Wilms f.alexander.wi...@gmail.com
Date:   Wed Feb 26 16:06:37 2014 +0100

Remove visual noise from lingucomponent

Change-Id: I6021eabab1474c99868f38ecd0d466eb0d97054e
Reviewed-on: https://gerrit.libreoffice.org/8279
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/lingucomponent/source/hyphenator/hyphen/hreg.cxx 
b/lingucomponent/source/hyphenator/hyphen/hreg.cxx
index e69deab..9142dfa 100644
--- a/lingucomponent/source/hyphenator/hyphen/hreg.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hreg.cxx
@@ -25,19 +25,13 @@
 using namespace com::sun::star::lang;
 using namespace com::sun::star::registry;
 
-
 // declaration of external RegEntry-functions defined by the service objects
-//
-
 extern void * SAL_CALL Hyphenator_getFactory(
 const sal_Char * pImplName,
 XMultiServiceFactory * pServiceManager,
 void * /*pRegistryKey*/ );
 
-
 // definition of the two functions that are used to provide the services
-//
-
 extern C
 {
 
@@ -54,6 +48,4 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL 
hyphen_component_getFactory(
 
 }
 
-///
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 567dc09..0e50008 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -57,13 +57,9 @@ using namespace com::sun::star::uno;
 using namespace com::sun::star::linguistic2;
 using namespace linguistic;
 
-
 // min, max
 #define Max(a,b) (a  b ? a : b)
 
-///
-
-
 Hyphenator::Hyphenator() :
 aEvtListeners   ( GetLinguMutex() )
 {
@@ -105,7 +101,6 @@ PropertyHelper_Hyphenation Hyphenator::GetPropHelper_Impl()
 return *pPropHelper;
 }
 
-
 Sequence Locale  SAL_CALL Hyphenator::getLocales()
 throw(RuntimeException)
 {
@@ -113,7 +108,6 @@ Sequence Locale  SAL_CALL Hyphenator::getLocales()
 
 // this routine should return the locales supported by the installed
 // dictionaries.
-
 if (!numdict)
 {
 SvtLinguConfig aLinguCfg;
@@ -217,7 +211,7 @@ Sequence Locale  SAL_CALL Hyphenator::getLocales()
 }
 else
 {
-/* no dictionary found so register no dictionaries */
+// no dictionary found so register no dictionaries
 numdict = 0;
 aDicts = NULL;
 aSuppLocales.realloc(0);
@@ -227,8 +221,6 @@ Sequence Locale  SAL_CALL Hyphenator::getLocales()
 return aSuppLocales;
 }
 
-
-
 sal_Bool SAL_CALL Hyphenator::hasLocale(const Locale rLocale)
 throw(RuntimeException)
 {
@@ -251,7 +243,6 @@ sal_Bool SAL_CALL Hyphenator::hasLocale(const Locale 
rLocale)
 return bRes;
 }
 
-
 Reference XHyphenatedWord  SAL_CALL Hyphenator::hyphenate( const OUString 
aWord,
const ::com::sun::star::lang::Locale aLocale,
sal_Int16 nMaxLeading,
@@ -373,7 +364,7 @@ Reference XHyphenatedWord  SAL_CALL 
Hyphenator::hyphenate( const OUString aWo
 Max(dict-crhmin, Max(dict-crhmin, 2) + Max(0, minTrail - 
Max(dict-rhmin, 2))) );
 if (bFailed)
 {
-//whoops 

[Libreoffice-commits] core.git: lingucomponent/source sfx2/inc sfx2/source starmath/source svl/qa svx/inc svx/source

2014-01-30 Thread Alexandre Vicenzi
 lingucomponent/source/thesaurus/libnth/nthesdta.hxx |3 
 sfx2/inc/bitset.hxx |   49 
 sfx2/source/inc/slotserv.hxx|   11 ---
 starmath/source/cfgitem.hxx |   10 ---
 svl/qa/unit/test_URIHelper.cxx  |1 
 svx/inc/pch/precompiled_svx.hxx |1 
 svx/source/accessibility/AccessibleTextEventQueue.hxx   |1 
 svx/source/customshapes/EnhancedCustomShapeFontWork.cxx |1 
 svx/source/inc/fmslotinvalidator.hxx|   11 ---
 svx/source/inc/formtoolbars.hxx |   11 ---
 10 files changed, 1 insertion(+), 98 deletions(-)

New commits:
commit c5685ec791fbce43e982ffecc9e062063ec7e3d7
Author: Alexandre Vicenzi vicenzi.alexan...@gmail.com
Date:   Wed Jan 29 20:46:48 2014 -0200

fdo#63154 Removed unused solar.h ref. in linguc., sfx2, starmath, svl and 
svx

Change-Id: I241661119371b75804fcf9215ff5e5da2a5b9265
Reviewed-on: https://gerrit.libreoffice.org/7732
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/lingucomponent/source/thesaurus/libnth/nthesdta.hxx 
b/lingucomponent/source/thesaurus/libnth/nthesdta.hxx
index dce8c47..7e09841 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesdta.hxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesdta.hxx
@@ -22,9 +22,6 @@
 
 
 #include com/sun/star/linguistic2/XMeaning.hpp
-
-#include tools/solar.h
-
 #include cppuhelper/implbase1.hxx
 
 
diff --git a/sfx2/inc/bitset.hxx b/sfx2/inc/bitset.hxx
index 6fb0424..0711513 100644
--- a/sfx2/inc/bitset.hxx
+++ b/sfx2/inc/bitset.hxx
@@ -19,8 +19,6 @@
 #ifndef INCLUDED_SFX2_INC_BITSET_HXX
 #define INCLUDED_SFX2_INC_BITSET_HXX
 
-#include tools/solar.h
-
 class BitSet
 {
 private:
@@ -64,174 +62,129 @@ public:
 sal_Bool operator!=( sal_uInt16 nBit ) const;
 
 };
-//
 
 // returns sal_True if the set is empty
-
-
-
 inline sal_Bool BitSet::operator!() const
 {
 return nCount == 0;
 }
-//
 
 // returns the number of bits in the bitset
-
 inline sal_uInt16 BitSet::Count() const
 {
 return nCount;
 }
-//
 
 // creates the union of two bitset
-
 inline BitSet BitSet::operator|( const BitSet rSet ) const
 {
 return BitSet(*this) |= rSet;
 }
-//
 
 // creates the union of a bitset with a single bit
-
 inline BitSet BitSet::operator|( sal_uInt16 nBit ) const
 {
 return BitSet(*this) |= nBit;
 }
-//
 
 // creates the asymetric difference
-
 inline BitSet BitSet::operator-( const BitSet ) const
 {
 return BitSet();
 }
-//
 
 // creates the asymetric difference with a single bit
-
-
 inline BitSet BitSet::operator-( sal_uInt16 ) const
 {
 return BitSet();
 }
-//
 
 // removes the bits contained in rSet
-
 inline BitSet BitSet::operator-=( const BitSet )
 {
 return *this;
 }
-//
-
 
 // creates the intersection with another bitset
-
 inline BitSet BitSet::operator( const BitSet ) const
 {
 return BitSet();
 }
-//
 
 // intersects with another bitset
-
 inline BitSet BitSet::operator=( const BitSet )
 {
 return *this;
 }
-//
 
 // creates the symetric difference with another bitset
-
 inline BitSet BitSet::operator^( const BitSet ) const
 {
 return BitSet();
 }
-//
 
 // creates the symetric difference with a single bit
-
 inline BitSet BitSet::operator^( sal_uInt16 ) const
 {
 return BitSet();
 }
-//
 
 // builds the symetric difference with another bitset
-
 inline BitSet BitSet::operator^=( const BitSet )
 {
 return *this;
 }
-//
+
 #ifdef BITSET_READY
 // builds the symetric difference with a single bit
-
 inline BitSet BitSet::operator^=( sal_uInt16 )
 {
 // crash!!!
 return BitSet();
 }
 #endif
-//
 
 // determines if the other bitset is a real superset
-
 inline sal_Bool BitSet::IsRealSubSet( const BitSet ) const
 {
 return sal_False;
 }
-//
 
 // determines if the other bitset is a 

[Libreoffice-commits] core.git: lingucomponent/source

2013-12-26 Thread Tor Lillqvist
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 25fe5fe9fd8fa85fd80713bbe2f0ea55d1fb8af8
Author: Tor Lillqvist t...@collabora.com
Date:   Thu Dec 26 18:42:15 2013 +0200

WaE: unused variable 'aPathOpt'

Change-Id: I6544f1662850a715e8841dcad35135fb1d94

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 9bed126..b0e2584 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -105,7 +105,6 @@ Sequence Locale  SAL_CALL MacSpellChecker::getLocales()
 // to see what dictionaries the admin/user has installed
 
 int numshr;  // number of shared dictionary entries
-SvtPathOptions aPathOpt;
 rtl_TextEncoding aEnc = RTL_TEXTENCODING_UTF8;
 
 std::vectorNSString * postspdict;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2013-12-09 Thread Andras Timar
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |   42 ++-
 lingucomponent/source/spellcheck/spell/sspellimp.hxx |3 -
 2 files changed, 26 insertions(+), 19 deletions(-)

New commits:
commit cb56ab9bca5e917d86a7dc24eb144353c405f07c
Author: Andras Timar andras.ti...@collabora.com
Date:   Mon Dec 9 20:22:26 2013 +0100

fdo#56443 allow different name for .dic and .aff files

For example, de_CH_frami.dic and de_AT_frami.dic use de_DE_frami.aff.

Change-Id: I1d3770ad871b4714f7e595e1cd13f5fd7f224a1f

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index e3a79df..bce00cc 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -66,7 +66,8 @@ SpellChecker::SpellChecker() :
 aDicts(NULL),
 aDEncs(NULL),
 aDLocs(NULL),
-aDNames(NULL),
+aDAffNames(NULL),
+aDDicNames(NULL),
 numdict(0),
 aEvtListeners(GetLinguMutex()),
 pPropHelper(NULL),
@@ -86,7 +87,8 @@ SpellChecker::~SpellChecker()
 }
 delete[] aDEncs;
 delete[] aDLocs;
-delete[] aDNames;
+delete[] aDAffNames;
+delete[] aDDicNames;
 if (pPropHelper)
 {
 pPropHelper-RemoveAsPropListener();
@@ -183,7 +185,8 @@ Sequence Locale  SAL_CALL SpellChecker::getLocales()
 aDicts  = new Hunspell* [numdict];
 aDEncs  = new rtl_TextEncoding [numdict];
 aDLocs  = new Locale [numdict];
-aDNames = new OUString [numdict];
+aDAffNames = new OUString [numdict];
+aDDicNames = new OUString [numdict];
 k = 0;
 for (aDictIt = aDics.begin();  aDictIt != aDics.end();  ++aDictIt)
 {
@@ -201,13 +204,16 @@ Sequence Locale  SAL_CALL SpellChecker::getLocales()
 aDicts[k]  = NULL;
 aDEncs[k]  = RTL_TEXTENCODING_DONTKNOW;
 aDLocs[k]  = LanguageTag::convertToLocale( 
aLocaleNames[i] );
-// also both files have to be in the same directory 
and the
-// file names must only differ in the extension 
(.aff/.dic).
-// Thus we use the first location only and strip the 
extension part.
-OUString aLocation = aDictIt-aLocations[0];
-sal_Int32 nPos = aLocation.lastIndexOf( '.' );
-aLocation = aLocation.copy( 0, nPos );
-aDNames[k] = aLocation;
+if ((aDictIt-aLocations[0]).endsWith(.aff))
+{
+aDAffNames[k] = aDictIt-aLocations[0];
+aDDicNames[k] = aDictIt-aLocations[1];
+}
+else
+{
+aDAffNames[k] = aDictIt-aLocations[1];
+aDDicNames[k] = aDictIt-aLocations[0];
+}
 
 ++k;
 }
@@ -225,8 +231,10 @@ Sequence Locale  SAL_CALL SpellChecker::getLocales()
 aDEncs = NULL;
 delete[] aDLocs;
 aDLocs  = NULL;
-delete[] aDNames;
-aDNames = NULL;
+delete[] aDAffNames;
+delete[] aDDicNames;
+aDAffNames = NULL;
+aDDicNames = NULL;
 aSuppLocales.realloc(0);
 }
 }
@@ -303,18 +311,16 @@ sal_Int16 SpellChecker::GetSpellFailure( const OUString 
rWord, const Locale rL
 {
 if (!aDicts[i])
 {
-OUString dicpath = aDNames[i] + .dic;
-OUString affpath = aDNames[i] + .aff;
 OUString dict;
 OUString aff;
-osl::FileBase::getSystemPathFromFileURL(dicpath,dict);
-osl::FileBase::getSystemPathFromFileURL(affpath,aff);
+
osl::FileBase::getSystemPathFromFileURL(aDDicNames[i],dict);
+osl::FileBase::getSystemPathFromFileURL(aDAffNames[i],aff);
 OString aTmpaff(OU2ENC(aff,osl_getThreadTextEncoding()));
 OString aTmpdict(OU2ENC(dict,osl_getThreadTextEncoding()));
 
 #if defined(WNT)
-// workaround for Windows specifc problem that the
-// path length in calls to 'fopen' is limted to somewhat
+// workaround for Windows specific problem that the
+// path length in calls to 'fopen' is limited to somewhat
 // about 120+ characters which will usually be exceed when
 // using dictionaries as extensions.
 aTmpaff = Win_GetShortPathName( aff );
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.hxx 

[Libreoffice-commits] core.git: lingucomponent/source

2013-10-20 Thread Stephan Bergmann
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit e6e0098be8744c25ee065acc878d237963b80bd5
Author: Stephan Bergmann sberg...@redhat.com
Date:   Sun Oct 20 23:00:36 2013 +0200

String - OUString

Change-Id: Ied50819f226d1fa7fd7f6d004a796b5a08194a23

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 9af04b2..330b832 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -369,8 +369,7 @@ Reference XSpellAlternatives 
 
 // now return an empty alternative for no suggestions or the list 
of alternatives if some found
 SpellAlternatives *pAlt = new SpellAlternatives;
-String aTmp(rWord);
-pAlt-SetWordLanguage( aTmp, nLang );
+pAlt-SetWordLanguage( rWord, nLang );
 pAlt-SetFailureType( SpellFailure::SPELLING_ERROR );
 pAlt-SetAlternatives( aStr );
 xRes = pAlt;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2013-10-11 Thread Eike Rathke
 lingucomponent/source/lingutil/lingutil.cxx |   16 
 1 file changed, 16 insertions(+)

New commits:
commit d5f33e2db4ce6d7c5f81a18705431fcf4d184b9c
Author: Eike Rathke er...@redhat.com
Date:   Fri Oct 11 22:58:48 2013 +0200

the dreaded hu_HU_u8.dic of myspell-hu needs exceptional handling

Change-Id: I2cef8d0dd306ce22552db0b5d8890c754be9e835

diff --git a/lingucomponent/source/lingutil/lingutil.cxx 
b/lingucomponent/source/lingutil/lingutil.cxx
index 70f10cc..4f72163 100644
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -147,12 +147,28 @@ std::vector SvtLinguConfigDictionaryEntry  
GetOldStyleDics( const char *pDicTy
 nStartIndex - aSystemPrefix.getLength());
 if (sChunk.isEmpty())
 continue;
+
 // We prefer (now) to use language tags.
 // Avoid feeding in the older LANG_REGION scheme to the BCP47
 // ctor as that triggers use of liblangtag and initializes its
 // database which we do not want during startup. Convert
 // instead.
 sChunk = sChunk.replace( '_', '-');
+
+// There's a known exception to the rule, the dreaded
+// hu_HU_u8.dic of the myspell-hu package, see
+// 
http://packages.debian.org/search?arch=anysearchon=contentskeywords=hu_HU_u8.dic
+// This was ignored because unknown in the old implementation,
+// truncate to the known locale and either insert because hu_HU
+// wasn't encountered yet, or skip because it was. It doesn't
+// really matter because the proper new-style hu_HU dictionary
+// will take precedence anyway if installed with a Hungarian
+// languagepack. Again, this is only to not pull in all
+// liblangtag and stuff during startup, the result would be
+// !isValidBcp47() and the dictionary ignored.
+if (sChunk == hu-HU-u8)
+sChunk = hu-HU;
+
 LanguageTag aLangTag(sChunk, true);
 if (!aLangTag.isValidBcp47())
 continue;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2013-10-02 Thread Caolán McNamara
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 3ec4fedc6a3d96b0625d274d9542dc787949231f
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Oct 2 20:26:00 2013 +0100

CID#983035 fix potential memleak

Change-Id: If41d78ce424e85390c7a92eaa36f912c43eef390

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 7e1a1c5..d68fd25 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -476,9 +476,10 @@ Reference XSpellAlternatives 
 OUString cvtwrd(suglst[ii],strlen(suglst[ii]),eEnc);
 pStr[numsug + ii] = cvtwrd;
 }
-pMS-free_list(suglst, count);
 numsug += count;
 }
+
+pMS-free_list(suglst, count);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2013-09-17 Thread Eike Rathke
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 91a1e61ec6ad00b1ed91af47e2fde90b7365cc06
Author: Eike Rathke er...@redhat.com
Date:   Tue Sep 17 14:06:00 2013 +0200

clearly it's enough to obtain the const array once

Change-Id: I6d9ffef6b052012d09ff54d2a457e1314e6239ee

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 9d48775..7e1a1c5 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -243,10 +243,10 @@ sal_Bool SAL_CALL SpellChecker::hasLocale(const Locale 
rLocale)
 if (!aSuppLocales.getLength())
 getLocales();
 
+const Locale *pLocale = aSuppLocales.getConstArray();
 sal_Int32 nLen = aSuppLocales.getLength();
 for (sal_Int32 i = 0;  i  nLen;  ++i)
 {
-const Locale *pLocale = aSuppLocales.getConstArray();
 if (rLocale == pLocale[i])
 {
 bRes = sal_True;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2013-05-14 Thread Tor Lillqvist
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d49a0b43048de8a9e5c154e405eb6cecaf606783
Author: Tor Lillqvist t...@iki.fi
Date:   Tue May 14 20:24:55 2013 +0300

One more XPropertySet - XLinguProperties

Change-Id: I9ce34899181416f6c5e38289035af35ed5533616

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 0936661..9af04b2 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -466,7 +466,7 @@ void SAL_CALL
 sal_Int32 nLen = rArguments.getLength();
 if (2 == nLen)
 {
-Reference XPropertySetxPropSet;
+Reference XLinguPropertiesxPropSet;
 rArguments.getConstArray()[0] = xPropSet;
 //rArguments.getConstArray()[1] = xDicList;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2013-05-09 Thread Herbert Dürr
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit b4d9ed143471659ef0905379c5ebd60ee711c1e4
Author: Herbert Dürr h...@apache.org
Date:   Tue Apr 16 11:20:17 2013 +

small optimization, don't call objectAtIndex twice

(cherry picked from commit a88630fb326fa4dcbe28edd1c149c8e5e7b7f123)

Conflicts:
lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx

Change-Id: Ic48281be27bf43f8a564f46684ddb53a2d83d80e

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index c2ca438..64cc1c1 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -120,9 +120,10 @@ Sequence Locale  SAL_CALL MacSpellChecker::getLocales()
 //Test for existence of the dictionaries
 for (unsigned int i = 0; i  [aLocales count]; i++)
 {
-if( [macSpell setLanguage:[aLocales objectAtIndex:i] ] )
+NSString* pLangStr = (NSString*)[aLocales objectAtIndex:i];
+if( [macSpell setLanguage:pLangStr ] )
 {
-postspdict.push_back( [ aLocales objectAtIndex:i ] );
+postspdict.push_back( pLangStr );
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2013-03-25 Thread Stephan Bergmann
 lingucomponent/source/languageguessing/simpleguesser.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e21114a9282096e2b7e5ebbc4dd74e2f85c7e36c
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Mar 25 18:19:45 2013 +0100

Missing _TEXTCAT_RESULT_SHORT - TEXTCAT_RESULT_SHORT_STR

...cf. d4244efeb171632f309c8cfcbea4fbe2a3de3193 libexttextcat: fix 
spelling of
TEXTCAT_RESULT_UNKOWN.

Change-Id: I65e8327296450324205e937fa762b656afebe2dd

diff --git a/lingucomponent/source/languageguessing/simpleguesser.cxx 
b/lingucomponent/source/languageguessing/simpleguesser.cxx
index b6d52cd..ac171b1 100644
--- a/lingucomponent/source/languageguessing/simpleguesser.cxx
+++ b/lingucomponent/source/languageguessing/simpleguesser.cxx
@@ -128,7 +128,7 @@ vectorGuess SimpleGuesser::GuessLanguage(const char* text)
 
 const char *guess_list = textcat_Classify(h, text, len);
 
-if (strcmp(guess_list, _TEXTCAT_RESULT_SHORT) == 0)
+if (strcmp(guess_list, TEXTCAT_RESULT_SHORT_STR) == 0)
 return guesses;
 
 int current_pointer = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: lingucomponent/source

2013-02-07 Thread László Németh
 lingucomponent/source/spellcheck/spell/sspellimp.cxx |   37 +--
 1 file changed, 34 insertions(+), 3 deletions(-)

New commits:
commit 98029f1625663609d670f79eea61f7547bfc8123
Author: László Németh nem...@numbertext.org
Date:   Fri Feb 8 08:29:33 2013 +0100

fdo#60427, fdo#59337: spell words with ZWNJ/ZWJ, f-lig. (only 8-bit dic.)

Change-Id: Ie8ac76373f4f4a456cdfb7f1a77ce640a5595d10

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 6ed0907..c5b873c 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -274,13 +274,23 @@ sal_Int16 SpellChecker::GetSpellFailure( const OUString 
rWord, const Locale rL
 OUStringBuffer rBuf(rWord);
 sal_Int32 n = rBuf.getLength();
 sal_Unicode c;
+sal_Int32 extrachar = 0;
+
 for (sal_Int32 ix=0; ix  n; ix++)
 {
 c = rBuf[ix];
 if ((c == 0x201C) || (c == 0x201D))
 rBuf[ix] = (sal_Unicode)0x0022;
-if ((c == 0x2018) || (c == 0x2019))
+else if ((c == 0x2018) || (c == 0x2019))
 rBuf[ix] = (sal_Unicode)0x0027;
+
+// recognize words with Unicode ligatures and ZWNJ/ZWJ characters (only
+// with 8-bit encoded dictionaries. For UTF-8 encoded dictionaries
+// set ICONV and IGNORE aff file options, if needed.)
+
+else if ((c == 0x200C) || (c == 0x200D) ||
+((c = 0xFB00)  (c = 0xFB04)))
+extrachar = 1;
 }
 OUString nWord(rBuf.makeStringAndClear());
 
@@ -334,10 +344,31 @@ sal_Int16 SpellChecker::GetSpellFailure( const OUString 
rWord, const Locale rL
 
 OString aWrd(OU2ENC(nWord,eEnc));
 int rVal = pMS-spell((char*)aWrd.getStr());
-if (rVal != 1)
+if (rVal != 1) {
+if (extrachar  (eEnc != RTL_TEXTENCODING_UTF8)) {
+OUStringBuffer mBuf(nWord);
+n = mBuf.getLength();
+for (sal_Int32 ix=n-1; ix = 0; ix--)
+{
+  switch (mBuf[ix]) {
+case 0xFB00: mBuf.remove(ix, 1); mBuf.insert(ix, 
ff); break;
+case 0xFB01: mBuf.remove(ix, 1); mBuf.insert(ix, 
fi); break;
+case 0xFB02: mBuf.remove(ix, 1); mBuf.insert(ix, 
fl); break;
+case 0xFB03: mBuf.remove(ix, 1); mBuf.insert(ix, 
ffi); break;
+case 0xFB04: mBuf.remove(ix, 1); mBuf.insert(ix, 
ffl); break;
+case 0x200C:
+case 0x200D: mBuf.remove(ix, 1); break;
+  }
+}
+OUString mWord(mBuf.makeStringAndClear());
+OString bWrd(OU2ENC(mWord, eEnc));
+rVal = pMS-spell((char*)bWrd.getStr());
+if (rVal == 1) return -1;
+}
 nRes = SpellFailure::SPELLING_ERROR;
-else
+} else {
 return -1;
+}
 pMS = NULL;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits