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

2023-06-02 Thread Mike Kaganski (via logerrit)
 linguistic/source/gciterator.cxx |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

New commits:
commit 17339a6e1f090972781af94e96f6a39408e49c88
Author: Mike Kaganski 
AuthorDate: Fri Jun 2 17:45:02 2023 +0200
Commit: Mike Kaganski 
CommitDate: Fri Jun 2 19:29:27 2023 +0200

Simplify a bit

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

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 5ab816dfa802..2ef50fbeab27 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -477,12 +477,9 @@ void GrammarCheckingIterator::ProcessResult(
 if (bContinueWithNextPara)
 {
 // we need to continue with the next paragraph
-uno::Reference< text::XFlatParagraph > xFlatParaNext;
 if (rxFlatParagraphIterator.is())
-xFlatParaNext = rxFlatParagraphIterator->getNextPara();
-{
-AddEntry( rxFlatParagraphIterator, xFlatParaNext, 
rRes.aDocumentIdentifier, 0, bIsAutomaticChecking );
-}
+AddEntry(rxFlatParagraphIterator, 
rxFlatParagraphIterator->getNextPara(),
+ rRes.aDocumentIdentifier, 0, bIsAutomaticChecking);
 }
 }
 


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

2023-06-02 Thread Mike Kaganski (via logerrit)
 linguistic/source/gciterator.cxx |7 +++
 linguistic/source/gciterator.hxx |7 +++
 2 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 72869f559021ced673465cb9aa82e461ecaafc91
Author: Mike Kaganski 
AuthorDate: Fri Jun 2 14:32:45 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jun 2 15:43:23 2023 +0200

tdf#155647: Pass XFlatParagraph by normal Reference, not WeakReference

Since commit a7ce722b476c4bb0c9a113ae0c2759181edfe48f (tdf#155232:
drop m_aFlatParaList from SwXFlatParagraphIterator, 2023-05-13), the
instances of XFlatParagraph are not cached in its iterator. Hence,
the instances created in GrammarCheckingIterator to pass to AddEntry
got immediately destroyed upon the scope end, before the checking
thread (where weak references were passed) had a chance to create own
hard references. Then GrammarCheckingIterator::DequeueAndCheck found
that xFlatPara was empty, and exited.

Just pass hard references there. The iterator was passed to the thread
by hard reference in FPEntry anyway; and so, the use of weak reference
to flat paragraph objects provided no benefit, when the iterator kept
hard references.

Change-Id: Ib56652d88b9a5c6f20aa3d70fed18f8be0d3a3df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152554
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 1cd8883705c7..5ab816dfa802 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -345,16 +345,15 @@ OUString GrammarCheckingIterator::GetOrCreateDocId(
 
 
 void GrammarCheckingIterator::AddEntry(
-const uno::WeakReference< text::XFlatParagraphIterator >& 
xFlatParaIterator,
-const uno::WeakReference< text::XFlatParagraph >& xFlatPara,
+const uno::Reference< text::XFlatParagraphIterator >& xFlatParaIterator,
+const uno::Reference< text::XFlatParagraph >& xFlatPara,
 const OUString & rDocId,
 sal_Int32 nStartIndex,
 bool bAutomatic )
 {
 // we may not need/have a xFlatParaIterator (e.g. if checkGrammarAtPos was 
called)
 // but we always need a xFlatPara...
-uno::Reference< text::XFlatParagraph > xPara( xFlatPara );
-if (!xPara.is())
+if (!xFlatPara.is())
 return;
 
 FPEntry aNewFPEntry;
diff --git a/linguistic/source/gciterator.hxx b/linguistic/source/gciterator.hxx
index 18984d398165..e25b15a96226 100644
--- a/linguistic/source/gciterator.hxx
+++ b/linguistic/source/gciterator.hxx
@@ -29,7 +29,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -52,7 +51,7 @@ struct FPEntry
 css::uno::Reference< css::text::XFlatParagraphIterator > m_xParaIterator;
 
 // flat paragraph
-css::uno::WeakReference< css::text::XFlatParagraph > m_xPara;
+css::uno::Reference< css::text::XFlatParagraph > m_xPara;
 
 // document ID to identify different documents
 OUStringm_aDocId;
@@ -126,8 +125,8 @@ class GrammarCheckingIterator:
 OUString GetOrCreateDocId( const css::uno::Reference< 
css::lang::XComponent >  );
 
 void AddEntry(
-const css::uno::WeakReference< css::text::XFlatParagraphIterator 
>& xFlatParaIterator,
-const css::uno::WeakReference< css::text::XFlatParagraph >& 
xFlatPara,
+const css::uno::Reference< css::text::XFlatParagraphIterator >& 
xFlatParaIterator,
+const css::uno::Reference< css::text::XFlatParagraph >& xFlatPara,
 const OUString , sal_Int32 nStartIndex, bool bAutomatic );
 
 void ProcessResult( const css::linguistic2::ProofreadingResult ,


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

2023-06-02 Thread Mike Kaganski (via logerrit)
 linguistic/source/lngsvcmgr.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit a5c1c674e031087ef0516cebac049341dcdd2fcf
Author: Mike Kaganski 
AuthorDate: Fri Jun 2 12:06:24 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jun 2 13:07:17 2023 +0200

Fix nullptr dereference

Seen e.g. in builds where no grammar checker was available (like
bibisect, or own builds), and LanguageTool is enabled in its page,
and then enabled in Writing Aids options page (Available Language
Modules list) in the same session, without program restart.

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

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 73abcf92abd5..69e884257e33 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -1488,6 +1488,8 @@ void SAL_CALL
 {
 if (!mxGrammarDsp.is())
 GetGrammarCheckerDsp_Impl();
+if (!mxGrammarDsp) // e.g., when !SvtLinguConfig().HasGrammarChecker()
+return;
 bool bChanged = !IsEqSvcList( rServiceImplNames,
   mxGrammarDsp->GetServiceList( rLocale ) 
);
 if (bChanged)


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

2023-03-05 Thread Mike Kaganski (via logerrit)
 linguistic/source/gciterator.cxx |   49 ++-
 linguistic/source/gciterator.hxx |   14 ---
 2 files changed, 44 insertions(+), 19 deletions(-)

New commits:
commit e7ae5b4793fb74309d5d1f32c3c696d07071d676
Author: Mike Kaganski 
AuthorDate: Sun Mar 5 11:06:29 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Mar 5 14:11:00 2023 +

tdf#152459: fallback to language-only when looking for grammar checker

LanguageTool registers itself for languages like "en-US", "es-AR", "de-DE";
but also for generic "en", "es", "de". When the requested language, like
"fr-CH" or "es-PH", is not found in the registered grammar checkers, the
fallback strings will be attempted.

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

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 5bca138e6517..a43a990a886f 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -488,8 +488,30 @@ void GrammarCheckingIterator::ProcessResult(
 }
 
 
+std::pair>
+GrammarCheckingIterator::getServiceForLocale(const lang::Locale& rLocale) const
+{
+if (!rLocale.Language.isEmpty())
+{
+const OUString sBcp47 = LanguageTag::convertToBcp47(rLocale, false);
+GCImplNames_t::const_iterator 
aLangIt(m_aGCImplNamesByLang.find(sBcp47));
+if (aLangIt != m_aGCImplNamesByLang.end())
+return { aLangIt->second, {} };
+
+for (const auto& sFallbackBcp47 : 
LanguageTag(rLocale).getFallbackStrings(false))
+{
+aLangIt = m_aGCImplNamesByLang.find(sFallbackBcp47);
+if (aLangIt != m_aGCImplNamesByLang.end())
+return { aLangIt->second, sFallbackBcp47 };
+}
+}
+
+return {};
+}
+
+
 uno::Reference< linguistic2::XProofreader > 
GrammarCheckingIterator::GetGrammarChecker(
-const lang::Locale  )
+lang::Locale  )
 {
 uno::Reference< linguistic2::XProofreader > xRes;
 
@@ -503,11 +525,11 @@ uno::Reference< linguistic2::XProofreader > 
GrammarCheckingIterator::GetGrammarC
 m_bGCServicesChecked = true;
 }
 
-const LanguageType nLang = LanguageTag::convertToLanguageType( rLocale, 
false);
-GCImplNames_t::const_iterator aLangIt( m_aGCImplNamesByLang.find( nLang ) 
);
-if (aLangIt != m_aGCImplNamesByLang.end())  // matching configured 
language found?
+if (const auto& [aSvcImplName, oFallbackBcp47] = 
getServiceForLocale(rLocale);
+!aSvcImplName.isEmpty()) // matching configured language found?
 {
-OUString aSvcImplName( aLangIt->second );
+if (oFallbackBcp47)
+rLocale = LanguageTag::convertToLocale(*oFallbackBcp47, false);
 GCReferences_t::const_iterator aImplNameIt( 
m_aGCReferencesByService.find( aSvcImplName ) );
 if (aImplNameIt != m_aGCReferencesByService.end())  // matching impl 
name found?
 {
@@ -1088,8 +1110,7 @@ void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl()
 {
 // only the first entry is used, there should be only one 
grammar checker per language
 const OUString aImplName( aImplNames[0] );
-const LanguageType nLang = 
LanguageTag::convertToLanguageType( rElementName );
-aTmpGCImplNamesByLang[ nLang ] = aImplName;
+aTmpGCImplNamesByLang[rElementName] = aImplName;
 }
 }
 else
@@ -1137,17 +1158,17 @@ void GrammarCheckingIterator::SetServiceList(
 {
 ::osl::Guard< ::osl::Mutex > aGuard( MyMutex() );
 
-LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
+OUString sBcp47 = LanguageTag::convertToBcp47(rLocale, false);
 OUString aImplName;
 if (rSvcImplNames.hasElements())
 aImplName = rSvcImplNames[0];   // there is only one grammar checker 
per language
 
-if (!LinguIsUnspecified(nLanguage) && nLanguage != LANGUAGE_DONTKNOW)
+if (!LinguIsUnspecified(sBcp47) && !sBcp47.isEmpty())
 {
 if (!aImplName.isEmpty())
-m_aGCImplNamesByLang[ nLanguage ] = aImplName;
+m_aGCImplNamesByLang[sBcp47] = aImplName;
 else
-m_aGCImplNamesByLang.erase( nLanguage );
+m_aGCImplNamesByLang.erase(sBcp47);
 }
 }
 
@@ -1157,11 +1178,7 @@ uno::Sequence< OUString > 
GrammarCheckingIterator::GetServiceList(
 {
 ::osl::Guard< ::osl::Mutex > aGuard( MyMutex() );
 
-OUString aImplName; // there is only one grammar checker per language
-LanguageType nLang  = LinguLocaleToLanguage( rLocale );
-GCImplNames_t::const_iterator aIt( m_aGCImplNamesByLang.find( nLang ) );
-if (aIt != m_aGCImplNamesByLang.end())
-aImplName = aIt->second;
+const OUString aImplName = getServiceForLocale(rLocale).first; // 
there is only one 

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

2023-03-05 Thread Mike Kaganski (via logerrit)
 linguistic/source/gciterator.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ef6bf01f1b1d9b93bb306295f4723b52e4e1e5b4
Author: Mike Kaganski 
AuthorDate: Sun Mar 5 11:10:37 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Mar 5 09:42:03 2023 +

No need to use a clearable guard here

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

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 3f766264eee4..5bca138e6517 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -768,7 +768,7 @@ linguistic2::ProofreadingResult SAL_CALL 
GrammarCheckingIterator::checkSentenceA
 
 //  THREAD SAFE START 
 {
-::osl::ClearableGuard< ::osl::Mutex > aGuard( MyMutex() );
+::osl::Guard< ::osl::Mutex > aGuard( MyMutex() );
 aDocId = GetOrCreateDocId( xComponent );
 nSuggestedEndOfSentencePos = GetSuggestedEndOfSentence( rText, 
nStartPos, aCurLocale );
 DBG_ASSERT( nSuggestedEndOfSentencePos > nStartPos, 
"nSuggestedEndOfSentencePos calculation failed?" );


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

2023-03-05 Thread Mike Kaganski (via logerrit)
 linguistic/source/gciterator.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c084a8f30d1a5b9416340ee4a557da896d069882
Author: Mike Kaganski 
AuthorDate: Sun Mar 5 11:11:33 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Mar 5 09:18:57 2023 +

Swap instead of copy-assignment

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

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 1613b2dac36b..3f766264eee4 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -1106,7 +1106,7 @@ void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl()
 {
 //  THREAD SAFE START 
 ::osl::Guard< ::osl::Mutex > aGuard( MyMutex() );
-m_aGCImplNamesByLang = aTmpGCImplNamesByLang;
+m_aGCImplNamesByLang.swap(aTmpGCImplNamesByLang);
 //  THREAD SAFE END 
 }
 }


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

2023-02-28 Thread niket1322git (via logerrit)
 linguistic/source/convdic.hxx |5 +
 linguistic/source/convdiclist.hxx |5 +
 linguistic/source/defs.hxx|6 +-
 linguistic/source/dicimp.hxx  |6 +-
 linguistic/source/dlistimp.hxx|5 +
 linguistic/source/gciterator.hxx  |6 +-
 linguistic/source/hhconvdic.hxx   |5 +
 linguistic/source/hyphdsp.hxx |7 +--
 linguistic/source/lngopt.hxx  |5 +
 linguistic/source/lngsvcmgr.hxx   |6 +-
 linguistic/source/spelldsp.hxx|6 +-
 11 files changed, 11 insertions(+), 51 deletions(-)

New commits:
commit a38fbfbf2f2d63d01444f0a0382b72de3e0af578
Author: niket1322git 
AuthorDate: Fri Feb 24 21:16:12 2023 +0530
Commit: Julien Nabet 
CommitDate: Tue Feb 28 17:03:39 2023 +

tdf#143148 Use pragma once instead of include guards

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

diff --git a/linguistic/source/convdic.hxx b/linguistic/source/convdic.hxx
index e5f1d4bea69a..a0501e2ddf1b 100644
--- a/linguistic/source/convdic.hxx
+++ b/linguistic/source/convdic.hxx
@@ -16,8 +16,7 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef INCLUDED_LINGUISTIC_SOURCE_CONVDIC_HXX
-#define INCLUDED_LINGUISTIC_SOURCE_CONVDIC_HXX
+#pragma once
 
 #include 
 #include 
@@ -121,6 +120,4 @@ public:
 voidRemoveEntry( const OUString , const OUString  
);
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/linguistic/source/convdiclist.hxx 
b/linguistic/source/convdiclist.hxx
index 11ab399aae90..5176244403cd 100644
--- a/linguistic/source/convdiclist.hxx
+++ b/linguistic/source/convdiclist.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_LINGUISTIC_SOURCE_CONVDICLIST_HXX
-#define INCLUDED_LINGUISTIC_SOURCE_CONVDICLIST_HXX
+#pragma once
 
 #include 
 #include 
@@ -85,6 +84,4 @@ public:
 voidFlushDics();
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/linguistic/source/defs.hxx b/linguistic/source/defs.hxx
index 7e3d658956e5..7d8995828d03 100644
--- a/linguistic/source/defs.hxx
+++ b/linguistic/source/defs.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_LINGUISTIC_SOURCE_DEFS_HXX
-#define INCLUDED_LINGUISTIC_SOURCE_DEFS_HXX
+#pragma once
 
 #include 
 #include 
@@ -88,7 +87,4 @@ protected:
 ~LinguDispatcher() {}
 };
 
-
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx
index 3d5233a887ac..507e13a5aa58 100644
--- a/linguistic/source/dicimp.hxx
+++ b/linguistic/source/dicimp.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_LINGUISTIC_SOURCE_DICIMP_HXX
-#define INCLUDED_LINGUISTIC_SOURCE_DICIMP_HXX
+#pragma once
 
 #include 
 #include 
@@ -168,7 +167,4 @@ public:
 getReplacementText() override;
 };
 
-
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/linguistic/source/dlistimp.hxx b/linguistic/source/dlistimp.hxx
index 97ae91f7c84f..9d9e7d0882fb 100644
--- a/linguistic/source/dlistimp.hxx
+++ b/linguistic/source/dlistimp.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_LINGUISTIC_SOURCE_DLISTIMP_HXX
-#define INCLUDED_LINGUISTIC_SOURCE_DLISTIMP_HXX
+#pragma once
 
 #include 
 #include 
@@ -116,6 +115,4 @@ public:
 voidSaveDics();
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/linguistic/source/gciterator.hxx b/linguistic/source/gciterator.hxx
index c4cc076b3c9b..f35c8b412ef9 100644
--- a/linguistic/source/gciterator.hxx
+++ b/linguistic/source/gciterator.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_LINGUISTIC_SOURCE_GCITERATOR_HXX
-#define INCLUDED_LINGUISTIC_SOURCE_GCITERATOR_HXX
+#pragma once
 
 #include 
 #include 
@@ -205,7 +204,4 @@ private:
 std::map maMap;
 };
 
-
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/linguistic/source/hhconvdic.hxx b/linguistic/source/hhconvdic.hxx
index 107607be6d57..15a7831284f2 100644
--- a/linguistic/source/hhconvdic.hxx
+++ b/linguistic/source/hhconvdic.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_LINGUISTIC_SOURCE_HHCONVDIC_HXX
-#define INCLUDED_LINGUISTIC_SOURCE_HHCONVDIC_HXX
+#pragma once
 
 #include "convdic.hxx"
 
@@ -40,6 +39,4 @@ public:
 virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() 
override;
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: 

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

2023-02-15 Thread Tor Lillqvist (via logerrit)
 linguistic/source/lngprophelp.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit d88fa033f02b70e28dbef6b42a4e73abc24c3a60
Author: Tor Lillqvist 
AuthorDate: Wed Feb 15 14:20:27 2023 +0200
Commit: Tor Lillqvist 
CommitDate: Wed Feb 15 14:45:33 2023 +

Make a few warning messages a bit more useful

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

diff --git a/linguistic/source/lngprophelp.cxx 
b/linguistic/source/lngprophelp.cxx
index 543685dc33c4..57483d062e55 100644
--- a/linguistic/source/lngprophelp.cxx
+++ b/linguistic/source/lngprophelp.cxx
@@ -412,7 +412,7 @@ bool PropertyHelper_Spell::propertyChange_Impl( const 
PropertyChangeEvent& rEvt
 break;
 }
 default:
-SAL_WARN( "linguistic", "unknown property" );
+SAL_WARN( "linguistic", "unknown property handle " << 
rEvt.PropertyHandle << " (check in include/unotools/linguprops.hxx)" );
 }
 if (pbVal)
 rEvt.NewValue >>= *pbVal;
@@ -474,7 +474,7 @@ void PropertyHelper_Spell::SetTmpPropVals( const 
PropertyValues  )
 case UPH_IS_SPELL_CLOSED_COMPOUND : pbResVal = 
 break;
 case UPH_IS_SPELL_HYPHENATED_COMPOUND : pbResVal = 
 break;
 default:
-SAL_WARN( "linguistic", "unknown property" );
+SAL_WARN( "linguistic", "unknown property handle " << 
rVal.Handle << " (check in include/unotools/linguprops.hxx)" );
 }
 if (pbResVal)
 rVal.Value >>= *pbResVal;
@@ -577,7 +577,7 @@ bool PropertyHelper_Hyphen::propertyChange_Impl( const 
PropertyChangeEvent& rEvt
 case UPH_HYPH_MIN_WORD_LENGTH : pnVal =  break;
 case UPH_HYPH_NO_CAPS : pbVal =  break;
 default:
-SAL_WARN( "linguistic", "unknown property" );
+SAL_WARN( "linguistic", "unknown property handle " << 
rEvt.PropertyHandle << " (check in include/unotools/linguprops.hxx)");
 }
 if (pnVal)
 rEvt.NewValue >>= *pnVal;
@@ -629,7 +629,7 @@ void PropertyHelper_Hyphen::SetTmpPropVals( const 
PropertyValues  )
 else if ( rVal.Name == UPN_HYPH_NO_CAPS )
 pbResVal = 
 
-DBG_ASSERT( pnResVal || pbResVal, "unknown property" );
+SAL_WARN_IF( !(pnResVal || pbResVal), "linguistic", "unknown property 
'" << rVal.Name << "'");
 
 if (pnResVal)
 rVal.Value >>= *pnResVal;


[Libreoffice-commits] core.git: linguistic/source offapi/com offapi/type_reference

2023-02-02 Thread Stephan Bergmann (via logerrit)
 linguistic/source/lngopt.hxx |8 --
 offapi/com/sun/star/linguistic2/XLinguProperties.idl |   24 +++
 offapi/type_reference/offapi.idl |2 -
 3 files changed, 10 insertions(+), 24 deletions(-)

New commits:
commit 537a8de72b935a406e6154a8cc55040ed521741e
Author: Stephan Bergmann 
AuthorDate: Thu Feb 2 16:46:29 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Feb 2 18:31:34 2023 +

Remove redundant attributes that were added to published XLinguProperties

...by 57d79744c77eef96b4c2bd3b16e0a04317ffcf9e "tdf#136306 offapi 
linguistic:
add options to disable rule-based compounding".  See


"Re: Request for [API CHANGE] in spell checking: add new options to disable
rule-based compounding" for details.  (And I want to get
offapi/type_reference/offapi.idl back into a clean state before updating the
reference rdbs, which I want to do now that LO 7.5.0 has been released, so 
I'm
taking over here.)

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

diff --git a/linguistic/source/lngopt.hxx b/linguistic/source/lngopt.hxx
index 08dde49e117c..896e345edb74 100644
--- a/linguistic/source/lngopt.hxx
+++ b/linguistic/source/lngopt.hxx
@@ -124,14 +124,6 @@ public:
 { return getPropertyBool(UPN_IS_SPELL_CAPITALIZATION); }
 virtual void SAL_CALL setIsSpellCapitalization(sal_Bool p1) override
 { setProperty(UPN_IS_SPELL_CAPITALIZATION, static_cast(p1)); }
-virtual sal_Bool SAL_CALL getIsSpellClosedCompound() override
-{ return getPropertyBool(UPN_IS_SPELL_CLOSED_COMPOUND); }
-virtual void SAL_CALL setIsSpellClosedCompound(sal_Bool p1) override
-{ setProperty(UPN_IS_SPELL_CLOSED_COMPOUND, static_cast(p1)); }
-virtual sal_Bool SAL_CALL getIsSpellHyphenatedCompound() override
-{ return getPropertyBool(UPN_IS_SPELL_HYPHENATED_COMPOUND); }
-virtual void SAL_CALL setIsSpellHyphenatedCompound(sal_Bool p1) override
-{ setProperty(UPN_IS_SPELL_HYPHENATED_COMPOUND, 
static_cast(p1)); }
 virtual sal_Int16 SAL_CALL getHyphMinLeading() override
 { return getPropertyInt16(UPN_HYPH_MIN_LEADING); }
 virtual void SAL_CALL setHyphMinLeading(sal_Int16 p1) override
diff --git a/offapi/com/sun/star/linguistic2/XLinguProperties.idl 
b/offapi/com/sun/star/linguistic2/XLinguProperties.idl
index c35047879c29..74db6604958f 100644
--- a/offapi/com/sun/star/linguistic2/XLinguProperties.idl
+++ b/offapi/com/sun/star/linguistic2/XLinguProperties.idl
@@ -27,6 +27,16 @@ module com { module sun { module star { module linguistic2 {
 */
 published interface XLinguProperties
 {
+/** Gives access to the properties.
+
+Among those properties are:
+
+  boolean IsSpellClosedCompound defines whether spell checking 
should be accept
+  rule-based closed compounding of dictionary words.  Since 
LibreOffice 7.6.
+  boolean IsSpellHyphenatedCompound defines whether spell checking 
should be accept
+  rule-based hyphenated compounding of dictionary words.  Since 
LibreOffice 7.6.
+
+*/
 interface com::sun::star::beans::XPropertySet;
 
 /** defines if the dictionary-list should be used for spell checking
@@ -106,20 +116,6 @@ published interface XLinguProperties
 */
 [attribute] com::sun::star::lang::Locale DefaultLocale_CTL;
 
-/** defines whether spell checking should be accept rule-based
- closed compounding of dictionary words.
-
-@since LibreOffice 7.6
-*/
-[attribute] boolean IsSpellClosedCompound;
-
-/** defines whether spell checking should be accept rule-based
- hyphenated compounding of dictionary words.
-
-@since LibreOffice 7.6
-*/
-[attribute] boolean IsSpellHyphenatedCompound;
-
 };
 
 
diff --git a/offapi/type_reference/offapi.idl b/offapi/type_reference/offapi.idl
index 027af1657732..f17e103ca8d3 100644
--- a/offapi/type_reference/offapi.idl
+++ b/offapi/type_reference/offapi.idl
@@ -8968,8 +8968,6 @@ module com {
  [attribute] boolean IsWrapReverse;
  [attribute] ::com::sun::star::lang::Locale DefaultLocale_CJK;
  [attribute] ::com::sun::star::lang::Locale DefaultLocale_CTL;
- [attribute] boolean IsSpellClosedCompound;
- [attribute] boolean IsSpellHyphenatedCompound;
 };
 published service LinguProperties: 
::com::sun::star::linguistic2::XLinguProperties;
 published struct LinguServiceEvent: ::com::sun::star::lang::EventObject {


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

2023-01-29 Thread Noel Grandin (via logerrit)
 linguistic/source/lngsvcmgr.cxx |   23 +--
 1 file changed, 9 insertions(+), 14 deletions(-)

New commits:
commit d33dbd8d3bee4dfd614ae0153ebca3db3948e9f8
Author: Noel Grandin 
AuthorDate: Sun Jan 29 21:07:45 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Jan 30 06:41:57 2023 +

no need to take SolarMutex when calling Idle::Start

but it is wise to hold our own mutex while accessing our own field

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

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index f38ee262099c..73abcf92abd5 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -439,22 +439,17 @@ LngSvcMgr::LngSvcMgr()
 // css::util::XModifyListener
 void LngSvcMgr::modified(const lang::EventObject&)
 {
-{
-osl::MutexGuard aGuard(GetLinguMutex());
-//assume that if an extension has been added/removed that
-//it might be a dictionary extension, so drop our cache
+osl::MutexGuard aGuard(GetLinguMutex());
+//assume that if an extension has been added/removed that
+//it might be a dictionary extension, so drop our cache
 
-pAvailSpellSvcs.reset();
-pAvailGrammarSvcs.reset();
-pAvailHyphSvcs.reset();
-pAvailThesSvcs.reset();
-}
+pAvailSpellSvcs.reset();
+pAvailGrammarSvcs.reset();
+pAvailHyphSvcs.reset();
+pAvailThesSvcs.reset();
 
-{
-SolarMutexGuard aGuard;
-//schedule in an update to execute in the main thread
-aUpdateIdle.Start();
-}
+//schedule in an update to execute in the main thread
+aUpdateIdle.Start();
 }
 
 //run update, and inform everyone that dictionaries (may) have changed, this


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

2023-01-21 Thread Caolán McNamara (via logerrit)
 linguistic/source/dicimp.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit bd0b3aac25b5163ae21fff613131cb3ff068e816
Author: Caolán McNamara 
AuthorDate: Fri Jan 20 21:08:17 2023 +
Commit: Caolán McNamara 
CommitDate: Sat Jan 21 16:21:53 2023 +

tdf#144915 effectively remove limit on number of words in dictionary

this was 2000 entries in the initial checkin, then changed to 3
(in 2008). Lets makes it effectively unlimited.

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

diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx
index 4ab0025799ea..3d5233a887ac 100644
--- a/linguistic/source/dicimp.hxx
+++ b/linguistic/source/dicimp.hxx
@@ -30,7 +30,7 @@
 
 #include "defs.hxx"
 
-#define DIC_MAX_ENTRIES 3
+#define DIC_MAX_ENTRIES SAL_MAX_INT32
 
 sal_Int16 ReadDicVersion( SvStream& rStream, LanguageType , bool , 
OUString  );
 


[Libreoffice-commits] core.git: linguistic/source offapi/com sw/inc sw/source

2023-01-17 Thread Fred Kruse (via logerrit)
 linguistic/source/gciterator.cxx  |2 ++
 offapi/com/sun/star/style/ParagraphProperties.idl |9 +
 sw/inc/cmdid.h|3 ++-
 sw/inc/unoprnms.hxx   |1 +
 sw/source/core/unocore/unocrsrhelper.cxx  |   12 
 sw/source/core/unocore/unoflatpara.cxx|   18 ++
 sw/source/core/unocore/unomapproperties.hxx   |1 +
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |1 +
 8 files changed, 46 insertions(+), 1 deletion(-)

New commits:
commit 04f15c8a8c733f159f77bd58905e4136a32b1be9
Author: Fred Kruse 
AuthorDate: Sun Jan 15 19:09:36 2023 +0100
Commit: Michael Stahl 
CommitDate: Tue Jan 17 10:17:19 2023 +

Properties SortedTextId and DocumentElementsCount added for grammar check

The LanguageTool extension (LT extension) runs not only a grammar check on 
the level of sentences and paragraphs, some rules work on the level of many 
paragraphs or full text. The LT extension uses a complex caching mechanism to 
support this feature. A mapping from a check request to the cached to the 
(flat)paragraphs is necessary. Until now, this is done by a time-consuming and 
error-prone mechanism.  The adding of the SortedTextId introduce a feature, a 
paragraph to be checked can be fast and easy identified. The flatparagraphs 
also can easily be mapped to cursors to get additional information of the 
paragraph, used for further features of LT extension.
The added Property DocumentElementsCount to flatparagraphs and 
doProofreading gives the extension the hint to recreate the cache.

Change-Id: I4b6b58bba4dfb3e870fe7b71fd8537ee9ffd6476
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142251
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 581f356f215e..1613b2dac36b 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -557,6 +557,8 @@ lcl_makeProperties(uno::Reference 
const& xFlatPara, sal_In
 return comphelper::InitPropertySequence({
 { "FieldPositions", xProps->getPropertyValue("FieldPositions") },
 { "FootnotePositions", xProps->getPropertyValue("FootnotePositions") },
+{ "SortedTextId", xProps->getPropertyValue("SortedTextId") },
+{ "DocumentElementsCount", 
xProps->getPropertyValue("DocumentElementsCount") },
 { "ProofInfo", a }
 });
 }
diff --git a/offapi/com/sun/star/style/ParagraphProperties.idl 
b/offapi/com/sun/star/style/ParagraphProperties.idl
index 9951703c8a3d..a7d6c059bd8a 100644
--- a/offapi/com/sun/star/style/ParagraphProperties.idl
+++ b/offapi/com/sun/star/style/ParagraphProperties.idl
@@ -419,6 +419,15 @@ published service ParagraphProperties
 @since LibreOffice 7.4
  */
 [optional, property] long ParaHyphenationZone;
+
+/** contains a paragraph identifier within the actual text,
+which also shows the position of the paragraph relative to the
+other paragraphs of the same text, i.e. a paragraph with lower
+identifier is there before the other ones with greater values.
+This property depends on implementation details and is considered 
experimental.
+@since LibreOffice 7.5
+ */
+[optional, property, readonly] long SortedTextId;
 };
 
 
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index c44745a0e861..02d78f338851 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -577,7 +577,8 @@ class SwUINumRuleItem;
 #define FN_UNO_FOOTER_LEFT  (FN_EXTRA2 + 39)
 #define FN_UNO_FOOTER_RIGHT (FN_EXTRA2 + 40)
 #define FN_UNO_TEXT_PARAGRAPH   (FN_EXTRA2 + 41)
-#define FN_UNO_PARENT_TEXT (FN_EXTRA2 + 42)
+#define FN_UNO_PARENT_TEXT  (FN_EXTRA2 + 42)
+#define FN_UNO_SORTED_TEXT_ID   (FN_EXTRA2 + 43)
 #define FN_UNO_FOLLOW_STYLE (FN_EXTRA2 + 59)
 
 #define FN_API_CALL 
TypedWhichId(FN_EXTRA2 + 60)
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 42a38fdef0aa..85a1938d61ce 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -412,6 +412,7 @@ inline constexpr OUStringLiteral 
UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT = u"FooterIsD
 inline constexpr OUStringLiteral UNO_NAME_FOOTER_IS_SHARED = u"FooterIsShared";
 inline constexpr OUStringLiteral UNO_NAME_TEXT_PARAGRAPH = u"TextParagraph";
 inline constexpr OUStringLiteral UNO_NAME_PARENT_TEXT = u"ParentText";
+inline constexpr OUStringLiteral UNO_NAME_SORTED_TEXT_ID = u"SortedTextId";
 
 inline constexpr OUStringLiteral UNO_NAME_FOOTER_HEIGHT = u"FooterHeight";
 inline constexpr OUStringLiteral UNO_NAME_FOOTER_IS_ON = u"FooterIsOn";
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index 

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

2022-12-14 Thread Stephan Bergmann (via logerrit)
 linguistic/source/gciterator.cxx |   11 +++
 linguistic/source/gciterator.hxx |7 ++-
 linguistic/source/lngsvcmgr.cxx  |3 ++-
 3 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit b0e9c4c5f063cefa9557810e3349bdb9c7493091
Author: Stephan Bergmann 
AuthorDate: Thu Dec 8 15:57:27 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Dec 14 09:54:30 2022 +

loplugin:unocast (GrammarCheckingIterator)

(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)

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

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 581f356f215e..2300b7343268 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -50,6 +50,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -1167,6 +1168,16 @@ uno::Sequence< OUString > 
GrammarCheckingIterator::GetServiceList(
 }
 
 
+sal_Int64 GrammarCheckingIterator::getSomething(css::uno::Sequence 
const & aIdentifier) {
+return comphelper::getSomethingImpl(aIdentifier, this);
+}
+
+css::uno::Sequence const & GrammarCheckingIterator::getUnoTunnelId() 
{
+static comphelper::UnoIdInit const id;
+return id.getSeq();
+}
+
+
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 linguistic_GrammarCheckingIterator_get_implementation(
 css::uno::XComponentContext* , css::uno::Sequence const&)
diff --git a/linguistic/source/gciterator.hxx b/linguistic/source/gciterator.hxx
index c4cc076b3c9b..55e2527e6e9b 100644
--- a/linguistic/source/gciterator.hxx
+++ b/linguistic/source/gciterator.hxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -78,7 +79,8 @@ class GrammarCheckingIterator:
 css::linguistic2::XLinguServiceEventListener,
 css::linguistic2::XLinguServiceEventBroadcaster,
 css::lang::XComponent,
-css::lang::XServiceInfo
+css::lang::XServiceInfo,
+css::lang::XUnoTunnel
 >,
 public LinguDispatcher
 {
@@ -179,6 +181,9 @@ public:
 // LinguDispatcher
 virtual void SetServiceList( const css::lang::Locale , const 
css::uno::Sequence< OUString >  ) override;
 virtual css::uno::Sequence< OUString > GetServiceList( const 
css::lang::Locale  ) const override;
+
+sal_Int64 SAL_CALL getSomething(css::uno::Sequence const & 
aIdentifier) override;
+static css::uno::Sequence const & getUnoTunnelId();
 };
 
 
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index f38ee262099c..7ef56cb10fb8 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -890,7 +891,7 @@ void LngSvcMgr::GetGrammarCheckerDsp_Impl( bool bSetSvcList 
 )
 
 if (xGCI.is())
 {
-mxGrammarDsp = dynamic_cast< GrammarCheckingIterator * >(xGCI.get());
+mxGrammarDsp = comphelper::getFromUnoTunnel< GrammarCheckingIterator 
>(xGCI);
 SAL_WARN_IF( mxGrammarDsp == nullptr, "linguistic", "failed to get 
implementation" );
 if (bSetSvcList && mxGrammarDsp.is())
 SetCfgServiceLists( *mxGrammarDsp );


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

2022-10-14 Thread Caolán McNamara (via logerrit)
 linguistic/source/translate.cxx |   28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 07f675361d5a09ad4e3978f324dcd3c8c6d90cef
Author: Caolán McNamara 
AuthorDate: Fri Oct 14 15:17:00 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 14 20:44:37 2022 +0200

cid#1515996 silence Unchecked return value from library

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

diff --git a/linguistic/source/translate.cxx b/linguistic/source/translate.cxx
index a88a02d22ff7..12f5491e2129 100644
--- a/linguistic/source/translate.cxx
+++ b/linguistic/source/translate.cxx
@@ -16,27 +16,27 @@ OString Translate(const OString& rTargetLang, const 
OString& rAPIUrl, const OStr
 
 std::unique_ptr> curl(curl_easy_init(),
[](CURL* p) { 
curl_easy_cleanup(p); });
-curl_easy_setopt(curl.get(), CURLOPT_URL, rAPIUrl.getStr());
-curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
-curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
+(void)curl_easy_setopt(curl.get(), CURLOPT_URL, rAPIUrl.getStr());
+(void)curl_easy_setopt(curl.get(), CURLOPT_FAILONERROR, 1L);
+(void)curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, CURL_TIMEOUT);
 
 std::string response_body;
-curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION,
- +[](void* buffer, size_t size, size_t nmemb, void* userp) 
-> size_t {
- if (!userp)
- return 0;
- std::string* response = 
static_cast(userp);
- size_t real_size = size * nmemb;
- response->append(static_cast(buffer), 
real_size);
- return real_size;
- });
-curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, 
static_cast(_body));
+(void)curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION,
+   +[](void* buffer, size_t size, size_t nmemb, void* 
userp) -> size_t {
+   if (!userp)
+   return 0;
+   std::string* response = 
static_cast(userp);
+   size_t real_size = size * nmemb;
+   response->append(static_cast(buffer), 
real_size);
+   return real_size;
+   });
+(void)curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, 
static_cast(_body));
 OString aLang(curl_easy_escape(curl.get(), rTargetLang.getStr(), 
rTargetLang.getLength()));
 OString aAuthKey(curl_easy_escape(curl.get(), rAuthKey.getStr(), 
rAuthKey.getLength()));
 OString aData(curl_easy_escape(curl.get(), rData.getStr(), 
rData.getLength()));
 OString aPostData("auth_key=" + aAuthKey + "_lang=" + aLang + 
"=" + aData);
 
-curl_easy_setopt(curl.get(), CURLOPT_POSTFIELDS, aPostData.getStr());
+(void)curl_easy_setopt(curl.get(), CURLOPT_POSTFIELDS, aPostData.getStr());
 CURLcode cc = curl_easy_perform(curl.get());
 if (cc != CURLE_OK)
 {


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

2022-10-13 Thread Andrea Gelmini (via logerrit)
 linguistic/source/translate.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 9e6db1ae2b0e8e070ae13fbae782bc2c01f49049
Author: Andrea Gelmini 
AuthorDate: Wed Oct 12 17:47:14 2022 +0200
Commit: Julien Nabet 
CommitDate: Thu Oct 13 20:39:03 2022 +0200

Remove duplicated include

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

diff --git a/linguistic/source/translate.cxx b/linguistic/source/translate.cxx
index 5337c33153e1..a88a02d22ff7 100644
--- a/linguistic/source/translate.cxx
+++ b/linguistic/source/translate.cxx
@@ -1,7 +1,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 


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

2022-09-12 Thread Noel Grandin (via logerrit)
 linguistic/source/misc.cxx |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 7458cb8d13b2893ccbfb648198319cc3a73d7e50
Author: Noel Grandin 
AuthorDate: Sat Sep 10 19:25:04 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Sep 12 10:13:54 2022 +0200

no need to allocate this on the heap

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

diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index de2bc96860ee..dc4c17ce8430 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -64,10 +65,10 @@ osl::Mutex & GetLinguMutex()
 
 const LocaleDataWrapper & GetLocaleDataWrapper( LanguageType nLang )
 {
-static std::unique_ptr xLclDtaWrp;
-if (!xLclDtaWrp || xLclDtaWrp->getLoadedLanguageTag().getLanguageType() != 
nLang)
-xLclDtaWrp.reset(new LocaleDataWrapper(LanguageTag( nLang )));
-return *xLclDtaWrp;
+static std::optional oLclDtaWrp;
+if (!oLclDtaWrp || oLclDtaWrp->getLoadedLanguageTag().getLanguageType() != 
nLang)
+oLclDtaWrp.emplace(LanguageTag( nLang ));
+return *oLclDtaWrp;
 }
 
 LanguageType LinguLocaleToLanguage( const css::lang::Locale& rLocale )


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

2022-08-26 Thread Caolán McNamara (via logerrit)
 linguistic/source/convdic.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3968bd07f3052c5ff90ed173c851e62d551e4012
Author: Caolán McNamara 
AuthorDate: Fri Aug 26 08:58:18 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 26 11:35:50 2022 +0200

cid#1500669 silence Dereference after null check

and

cid#1500619 Dereference after null check

help coverity out that there is only ConversionDirection_FROM_LEFT
and ConversionDirection_FROM_RIGHT

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

diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index 057dfc41edbe..f204cfad0f45 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -370,7 +370,7 @@ uno::Sequence< OUString > SAL_CALL ConvDic::getConversions(
 {
 MutexGuard  aGuard( GetLinguMutex() );
 
-if (!pFromRight && eDirection == ConversionDirection_FROM_RIGHT)
+if (!pFromRight && eDirection != ConversionDirection_FROM_LEFT)
 return uno::Sequence< OUString >();
 
 if (bNeedEntries)
@@ -398,7 +398,7 @@ uno::Sequence< OUString > SAL_CALL 
ConvDic::getConversionEntries(
 {
 MutexGuard  aGuard( GetLinguMutex() );
 
-if (!pFromRight && eDirection == ConversionDirection_FROM_RIGHT)
+if (!pFromRight && eDirection != ConversionDirection_FROM_LEFT)
 return uno::Sequence< OUString >();
 
 if (bNeedEntries)


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

2022-05-19 Thread Noel Grandin (via logerrit)
 linguistic/source/hyphdta.cxx |   11 ---
 1 file changed, 11 deletions(-)

New commits:
commit 8bfdbf5b7474596fe1d7d3318920c9a36f630201
Author: Noel Grandin 
AuthorDate: Wed May 18 15:02:49 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu May 19 09:30:21 2022 +0200

HyphenatedWord and PossibleHyphens do not need locking

they never modify any local (or global) state

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

diff --git a/linguistic/source/hyphdta.cxx b/linguistic/source/hyphdta.cxx
index 4d2a88266c07..d19d8834006e 100644
--- a/linguistic/source/hyphdta.cxx
+++ b/linguistic/source/hyphdta.cxx
@@ -70,43 +70,36 @@ HyphenatedWord::~HyphenatedWord()
 
 OUString SAL_CALL HyphenatedWord::getWord()
 {
-MutexGuard  aGuard( GetLinguMutex() );
 return aWord;
 }
 
 
 Locale SAL_CALL HyphenatedWord::getLocale()
 {
-MutexGuard  aGuard( GetLinguMutex() );
-
 return LanguageTag::convertToLocale( nLanguage );
 }
 
 
 sal_Int16 SAL_CALL HyphenatedWord::getHyphenationPos()
 {
-MutexGuard  aGuard( GetLinguMutex() );
 return nHyphenationPos;
 }
 
 
 OUString SAL_CALL HyphenatedWord::getHyphenatedWord()
 {
-MutexGuard  aGuard( GetLinguMutex() );
 return aHyphenatedWord;
 }
 
 
 sal_Int16 SAL_CALL HyphenatedWord::getHyphenPos()
 {
-MutexGuard  aGuard( GetLinguMutex() );
 return nHyphPos;
 }
 
 
 sal_Bool SAL_CALL HyphenatedWord::isAlternativeSpelling()
 {
-MutexGuard  aGuard( GetLinguMutex() );
 return bIsAltSpelling;
 }
 
@@ -129,28 +122,24 @@ PossibleHyphens::~PossibleHyphens()
 
 OUString SAL_CALL PossibleHyphens::getWord()
 {
-MutexGuard  aGuard( GetLinguMutex() );
 return aWord;
 }
 
 
 Locale SAL_CALL PossibleHyphens::getLocale()
 {
-MutexGuard  aGuard( GetLinguMutex() );
 return LanguageTag::convertToLocale( nLanguage );
 }
 
 
 OUString SAL_CALL PossibleHyphens::getPossibleHyphens()
 {
-MutexGuard  aGuard( GetLinguMutex() );
 return aWordWithHyphens;
 }
 
 
 Sequence< sal_Int16 > SAL_CALL PossibleHyphens::getHyphenationPositions()
 {
-MutexGuard  aGuard( GetLinguMutex() );
 return aOrigHyphenPos;
 }
 


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

2022-05-18 Thread Noel Grandin (via logerrit)
 linguistic/source/dicimp.cxx |7 ---
 1 file changed, 7 deletions(-)

New commits:
commit 52112a1b8c778bf94534537978a36ba82d7cdf6c
Author: Noel Grandin 
AuthorDate: Wed May 18 13:55:28 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed May 18 18:02:03 2022 +0200

DicEntry doesn't need locking

it never modifies state

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

diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 803445b4ef28..7eb18d64c635 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -503,8 +503,6 @@ int DictionaryNeo::cmpDicEntry(std::u16string_view rWord1,
std::u16string_view rWord2,
bool bSimilarOnly)
 {
-MutexGuard  aGuard( GetLinguMutex() );
-
 // returns 0 if rWord1 is equal to rWord2
 //   " a value < 0 if rWord1 is less than rWord2
 //   " a value > 0 if rWord1 is greater than rWord2
@@ -1054,8 +1052,6 @@ void DicEntry::splitDicFileWord(const OUString 
,
 OUString ,
 OUString )
 {
-MutexGuard  aGuard( GetLinguMutex() );
-
 sal_Int32 nDelimPos = rDicFileWord.indexOf( "==" );
 if (-1 != nDelimPos)
 {
@@ -1075,19 +1071,16 @@ void DicEntry::splitDicFileWord(const OUString 
,
 
 OUString SAL_CALL DicEntry::getDictionaryWord(  )
 {
-MutexGuard  aGuard( GetLinguMutex() );
 return aDicWord;
 }
 
 sal_Bool SAL_CALL DicEntry::isNegative(  )
 {
-MutexGuard  aGuard( GetLinguMutex() );
 return bIsNegativ;
 }
 
 OUString SAL_CALL DicEntry::getReplacementText(  )
 {
-MutexGuard  aGuard( GetLinguMutex() );
 return aReplacement;
 }
 


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

2022-04-02 Thread Noel Grandin (via logerrit)
 linguistic/source/dicimp.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 496ad6ad023229377476cf84eb243d2e669ae3d0
Author: Noel Grandin 
AuthorDate: Sat Apr 2 12:24:44 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Apr 2 21:26:30 2022 +0200

use more string_view

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

diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index ea4718ff8bce..d37990824f34 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -92,14 +92,14 @@ static uno::Reference< XLinguServiceManager2 > 
GetLngSvcMgr_Impl()
 return xRes;
 }
 
-static bool getTag(std::string_view rLine, const char *pTagName,
+static bool getTag(std::string_view rLine, std::string_view rTagName,
 OString )
 {
-size_t nPos = rLine.find(pTagName);
+size_t nPos = rLine.find(rTagName);
 if (nPos == std::string_view::npos)
 return false;
 
-rTagValue = comphelper::string::strip(rLine.substr(nPos + 
strlen(pTagName)),
+rTagValue = comphelper::string::strip(rLine.substr(nPos + rTagName.size()),
 ' ');
 return true;
 }


[Libreoffice-commits] core.git: linguistic/source reportdesign/source sc/source sfx2/source

2022-02-07 Thread Julien Nabet (via logerrit)
 linguistic/source/convdicxml.cxx   |3 --
 reportdesign/source/ui/report/ReportController.cxx |   15 --
 sc/source/ui/unoobj/docuno.cxx |   22 -
 sfx2/source/appl/shutdownicon.cxx  |5 
 sfx2/source/dialog/backingwindow.cxx   |   18 ++---
 5 files changed, 19 insertions(+), 44 deletions(-)

New commits:
commit a7c9980a4a6bb1f547c0c4a7b554ac9afe7b25fc
Author: Julien Nabet 
AuthorDate: Mon Feb 7 20:27:56 2022 +0100
Commit: Julien Nabet 
CommitDate: Tue Feb 8 07:04:02 2022 +0100

 Simplify sequence of PropertyValue in linguisting/reportdesign/sc/sfx2

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

diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx
index 46b5ec69d320..c8a09997fd7e 100644
--- a/linguistic/source/convdicxml.cxx
+++ b/linguistic/source/convdicxml.cxx
@@ -248,8 +248,7 @@ bool ConvDicXMLExport::Export()
 {
 uno::Reference< document::XExporter > xExporter( this );
 uno::Reference< document::XFilter > xFilter( xExporter, UNO_QUERY );
-uno::Sequence< beans::PropertyValue > aProps(0);
-xFilter->filter( aProps );  // calls exportDoc implicitly
+xFilter->filter( {} );  // calls exportDoc implicitly
 
 return bSuccess;
 }
diff --git a/reportdesign/source/ui/report/ReportController.cxx 
b/reportdesign/source/ui/report/ReportController.cxx
index b845623ed0fa..91b0dc9cf03e 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -1701,9 +1701,7 @@ void OReportController::impl_initialize( )
 const OReportPage* pPage = 
dynamic_cast(m_aReportModel->GetPage(static_cast(m_nPageNum)));
 if ( pPage )
 {
-uno::Sequence< beans::PropertyValue> aArgs(1);
-aArgs.getArray()[0].Value <<= pPage->getSection();
-executeUnChecked(SID_SELECT,aArgs);
+executeUnChecked(SID_SELECT,{ 
comphelper::makePropertyValue("", pPage->getSection() ) });
 }
 }
 else
@@ -1719,8 +1717,7 @@ void OReportController::impl_initialize( )
 {
 m_sLastActivePage = "Data";
 getDesignView()->setCurrentPage(m_sLastActivePage);
-uno::Sequence< beans::PropertyValue> aArgs;
-executeUnChecked(SID_SELECT_REPORT,aArgs);
+executeUnChecked(SID_SELECT_REPORT,{});
 }
 
 setModified(false); // and we are not modified yet
@@ -2790,8 +2787,7 @@ void SAL_CALL OReportController::restoreViewData(const 
uno::Any& i_data)
 util::URL aCommand;
 aCommand.Complete = ".uno:" + rCommandName;
 
-Sequence aCommandArgs{ comphelper::makePropertyValue("Value", 
rCommandValue) };
-executeUnChecked( aCommand, aCommandArgs );
+executeUnChecked( aCommand, { 
comphelper::makePropertyValue("Value", rCommandValue) } );
 }
 else
 {
@@ -2866,7 +2862,7 @@ uno::Reference 
OReportController::executeReport()
 if (pErrorId != RID_ERR_NO_COMMAND)
 {
 if ( !m_bShowProperties )
-
executeUnChecked(SID_SHOW_PROPERTYBROWSER,uno::Sequence< 
beans::PropertyValue>());
+executeUnChecked(SID_SHOW_PROPERTYBROWSER, {});
 
 m_sLastActivePage = "Data";
 getDesignView()->setCurrentPage(m_sLastActivePage);
@@ -2878,8 +2874,7 @@ uno::Reference 
OReportController::executeReport()
 }
 if ( nCommand )
 {
-uno::Sequence< beans::PropertyValue> aArgs;
-executeUnChecked(nCommand,aArgs);
+executeUnChecked(nCommand, {});
 }
 }
 }
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 2c739b909fb2..ca7cb56fee5f 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1905,19 +1905,15 @@ uno::Sequence SAL_CALL 
ScModelObj::getRenderer( sal_Int32
 const awt::Size aPageSize(aMMRect.GetWidth(), aMMRect.GetHeight());
 const awt::Point aCalcPagePos(aMMRect.Left(), aMMRect.Top());
 
-uno::Sequence aSequence(5);
-beans::PropertyValue* pArray = aSequence.getArray();
-pArray[0].Name = SC_UNONAME_PAGESIZE;
-pArray[0].Value <<= aPageSize;
-// #i58# all positions are relative to the whole page, including 
non-printable area
-pArray[1].Name = SC_UNONAME_INC_NP_AREA;
-pArray[1].Value <<= true;
-pArray[2].Name = SC_UNONAME_SOURCERANGE;
-pArray[2].Value <<= 

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

2021-12-06 Thread Noel Grandin (via logerrit)
 linguistic/source/lngopt.cxx |6 +++---
 linguistic/source/lngopt.hxx |4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 5aac0725c79d21dba11c03d3c39ccb986a5e7cca
Author: Noel Grandin 
AuthorDate: Wed Dec 1 21:30:45 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Dec 4 12:00:48 2021 +0100

use OMultiTypeInterfaceContainerHelperVar3 in LinguProps

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

diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx
index 517117306a86..f176735f37cf 100644
--- a/linguistic/source/lngopt.cxx
+++ b/linguistic/source/lngopt.cxx
@@ -192,14 +192,14 @@ LinguProps::LinguProps() :
 
 void LinguProps::launchEvent( const PropertyChangeEvent  ) const
 {
-comphelper::OInterfaceContainerHelper2 *pContainer =
+comphelper::OInterfaceContainerHelper3 
*pContainer =
 aPropListeners.getContainer( rEvt.PropertyHandle );
 if (pContainer)
 {
-comphelper::OInterfaceIteratorHelper2 aIt( *pContainer );
+comphelper::OInterfaceIteratorHelper3 aIt( *pContainer );
 while (aIt.hasMoreElements())
 {
-static_cast< XPropertyChangeListener* >( aIt.next() 
)->propertyChange( rEvt );
+aIt.next()->propertyChange( rEvt );
 }
 }
 }
diff --git a/linguistic/source/lngopt.hxx b/linguistic/source/lngopt.hxx
index effd2e8cb790..b21ea631cc19 100644
--- a/linguistic/source/lngopt.hxx
+++ b/linguistic/source/lngopt.hxx
@@ -23,7 +23,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -60,7 +60,7 @@ public:
 GetActiveDics() const   { return pData->aActiveDics; }
 };
 
-typedef comphelper::OMultiTypeInterfaceContainerHelperVar2
+typedef 
comphelper::OMultiTypeInterfaceContainerHelperVar3
 OPropertyListenerContainerHelper;
 
 class LinguProps :


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

2021-11-27 Thread Noel Grandin (via logerrit)
 linguistic/source/convdic.hxx |4 ++--
 linguistic/source/convdiclist.hxx |4 ++--
 linguistic/source/dicimp.hxx  |4 ++--
 linguistic/source/dlistimp.cxx|6 +++---
 linguistic/source/dlistimp.hxx|3 ++-
 linguistic/source/gciterator.hxx  |6 +++---
 linguistic/source/lngopt.hxx  |3 ++-
 linguistic/source/lngsvcmgr.cxx   |1 +
 linguistic/source/lngsvcmgr.hxx   |4 ++--
 9 files changed, 19 insertions(+), 16 deletions(-)

New commits:
commit d448b16d811593f0c8e8f2e60e957a83390c4b99
Author: Noel Grandin 
AuthorDate: Tue Nov 23 20:58:54 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Nov 27 13:18:52 2021 +0100

use more OInterfaceContainerHelper3 in linguistic

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

diff --git a/linguistic/source/convdic.hxx b/linguistic/source/convdic.hxx
index 26dc2aee0517..ba914d3a9779 100644
--- a/linguistic/source/convdic.hxx
+++ b/linguistic/source/convdic.hxx
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -55,7 +55,7 @@ class ConvDic :
 
 protected:
 
-::comphelper::OInterfaceContainerHelper2   aFlushListeners;
+::comphelper::OInterfaceContainerHelper3 
aFlushListeners;
 
 ConvMap aFromLeft;
 std::unique_ptr< ConvMap >pFromRight; // only available for 
bidirectional conversion dictionaries
diff --git a/linguistic/source/convdiclist.hxx 
b/linguistic/source/convdiclist.hxx
index 907f53fa242e..11ab399aae90 100644
--- a/linguistic/source/convdiclist.hxx
+++ b/linguistic/source/convdiclist.hxx
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -51,7 +51,7 @@ class ConvDicList :
 virtual voidAtExit() override;
 };
 
-::comphelper::OInterfaceContainerHelper2  aEvtListeners;
+::comphelper::OInterfaceContainerHelper3 
aEvtListeners;
 rtl::Reference  mxNameContainer;
 rtl::Reference mxExitListener;
 bool  bDisposing;
diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx
index dc7c94c3e91f..fdef09909519 100644
--- a/linguistic/source/dicimp.hxx
+++ b/linguistic/source/dicimp.hxx
@@ -24,7 +24,7 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -42,7 +42,7 @@ class DictionaryNeo :
 >
 {
 
-::comphelper::OInterfaceContainerHelper2
aDicEvtListeners;
+
::comphelper::OInterfaceContainerHelper3
 aDicEvtListeners;
 std::vector< css::uno::Reference< css::linguistic2::XDictionaryEntry > >
 aEntries;
 OUStringaDicName;
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 90067e1d4da8..b7fbfa1844ab 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -66,7 +66,7 @@ class DicEvtListenerHelper :
 XDictionaryEventListener
 >
 {
-comphelper::OInterfaceContainerHelper2  aDicListEvtListeners;
+comphelper::OInterfaceContainerHelper3 
aDicListEvtListeners;
 uno::Reference< XDictionaryList >   xMyDicList;
 
 sal_Int16   nCondensedEvt;
@@ -124,7 +124,7 @@ void SAL_CALL DicEvtListenerHelper::disposing( const 
EventObject& rSource )
 {
 osl::MutexGuard aGuard( GetLinguMutex() );
 
-uno::Reference< XInterface > xSrc( rSource.Source );
+uno::Reference< XDictionaryListEventListener > xSrc( rSource.Source, 
UNO_QUERY );
 
 // remove event object from EventListener list
 if (xSrc.is())
@@ -133,7 +133,7 @@ void SAL_CALL DicEvtListenerHelper::disposing( const 
EventObject& rSource )
 // if object is a dictionary then remove it from the dictionary list
 // Note: this will probably happen only if someone makes a XDictionary
 // implementation of his own that is also a XComponent.
-uno::Reference< XDictionary > xDic( xSrc, UNO_QUERY );
+uno::Reference< XDictionary > xDic( rSource.Source, UNO_QUERY );
 if (xDic.is())
 {
 xMyDicList->removeDictionary( xDic );
diff --git a/linguistic/source/dlistimp.hxx b/linguistic/source/dlistimp.hxx
index df594cccdb68..97ae91f7c84f 100644
--- a/linguistic/source/dlistimp.hxx
+++ b/linguistic/source/dlistimp.hxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -54,7 +55,7 @@ class DicList :
 
 LinguOptionsaOpt;
 
-::comphelper::OInterfaceContainerHelper2aEvtListeners;
+::comphelper::OInterfaceContainerHelper3 
aEvtListeners;
 
 typedef std::vector< css::uno::Reference< css::linguistic2::XDictionary > 
>   DictionaryVec_t;
 DictionaryVec_t aDicList;
diff --git a/linguistic/source/gciterator.hxx 

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

2021-11-15 Thread Noel Grandin (via logerrit)
 linguistic/source/convdiclist.cxx |   14 +---
 linguistic/source/gciterator.cxx  |   44 +-
 linguistic/source/gciterator.hxx  |3 --
 linguistic/source/misc.cxx|   15 ++--
 4 files changed, 35 insertions(+), 41 deletions(-)

New commits:
commit 1badef89c0794167b9b84ea44d4a7df5645de8a7
Author: Noel Grandin 
AuthorDate: Sun Nov 14 22:12:55 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Nov 15 09:25:13 2021 +0100

rtl::Static->thread-safe static in linguistic

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

diff --git a/linguistic/source/convdiclist.cxx 
b/linguistic/source/convdiclist.cxx
index 43d75141bc01..54517960f062 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -33,7 +33,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -312,18 +311,17 @@ void ConvDicNameContainer::AddConvDics(
 
 namespace
 {
-struct StaticConvDicList : public rtl::StaticWithInit<
-rtl::Reference, StaticConvDicList> {
-rtl::Reference operator () () {
-return new ConvDicList;
-}
+rtl::Reference& StaticConvDicList()
+{
+static rtl::Reference SINGLETON = new ConvDicList;
+return SINGLETON;
 };
 }
 
 void ConvDicList::MyAppExitListener::AtExit()
 {
 rMyDicList.FlushDics();
-StaticConvDicList::get().clear();
+StaticConvDicList().clear();
 }
 
 ConvDicList::ConvDicList() :
@@ -535,7 +533,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 linguistic_ConvDicList_get_implementation(
 css::uno::XComponentContext* , css::uno::Sequence const&)
 {
-return cppu::acquire(StaticConvDicList::get().get());
+return cppu::acquire(StaticConvDicList().get());
 }
 
 
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index b915dee3033a..28336c5184a4 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -272,13 +272,19 @@ css::uno::Any SAL_CALL 
LngXStringKeyMap::getValueByIndex(::sal_Int32 nIndex)
 }
 
 
+osl::Mutex& GrammarCheckingIterator::MyMutex()
+{
+static osl::Mutex SINGLETON;
+return SINGLETON;
+}
+
 GrammarCheckingIterator::GrammarCheckingIterator() :
 m_bEnd( false ),
 m_bGCServicesChecked( false ),
 m_nDocIdCounter( 0 ),
 m_thread(nullptr),
-m_aEventListeners( MyMutex::get() ),
-m_aNotifyListeners( MyMutex::get() )
+m_aEventListeners( MyMutex() ),
+m_aNotifyListeners( MyMutex() )
 {
 }
 
@@ -292,7 +298,7 @@ void GrammarCheckingIterator::TerminateThread()
 {
 oslThread t;
 {
-::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
+::osl::Guard< ::osl::Mutex > aGuard( MyMutex() );
 t = m_thread;
 m_thread = nullptr;
 m_bEnd = true;
@@ -307,7 +313,7 @@ void GrammarCheckingIterator::TerminateThread()
 
 sal_Int32 GrammarCheckingIterator::NextDocId()
 {
-::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
+::osl::Guard< ::osl::Mutex > aGuard( MyMutex() );
 m_nDocIdCounter += 1;
 return m_nDocIdCounter;
 }
@@ -359,7 +365,7 @@ void GrammarCheckingIterator::AddEntry(
 aNewFPEntry.m_bAutomatic= bAutomatic;
 
 // add new entry to the end of this queue
-::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
+::osl::Guard< ::osl::Mutex > aGuard( MyMutex() );
 if (!m_thread)
 m_thread = osl_createThread( lcl_workerfunc, this );
 m_aFPEntriesQueue.push_back( aNewFPEntry );
@@ -488,7 +494,7 @@ uno::Reference< linguistic2::XProofreader > 
GrammarCheckingIterator::GetGrammarC
 uno::Reference< linguistic2::XProofreader > xRes;
 
 //  THREAD SAFE START 
-::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
+::osl::Guard< ::osl::Mutex > aGuard( MyMutex() );
 
 // check supported locales for each grammarchecker if not already done
 if (!m_bGCServicesChecked)
@@ -562,7 +568,7 @@ void GrammarCheckingIterator::DequeueAndCheck()
 //  THREAD SAFE START 
 bool bQueueEmpty = false;
 {
-::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
+::osl::Guard< ::osl::Mutex > aGuard( MyMutex() );
 if (m_bEnd)
 {
 break;
@@ -579,7 +585,7 @@ void GrammarCheckingIterator::DequeueAndCheck()
 OUString aCurDocId;
 //  THREAD SAFE START 
 {
-::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
+::osl::Guard< ::osl::Mutex > aGuard( MyMutex() );
 aFPEntryItem= m_aFPEntriesQueue.front();
 xFPIterator = aFPEntryItem.m_xParaIterator;
 xFlatPara   = aFPEntryItem.m_xPara;
@@ -604,7 +610,7 @@ void 

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

2021-10-12 Thread Noel Grandin (via logerrit)
 linguistic/source/lngsvcmgr.cxx |   12 ++--
 svtools/source/misc/langhelp.cxx|6 +++---
 toolkit/source/controls/unocontrols.cxx |8 
 3 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit e4913a56c07914708d8272ae211e23b73349e673
Author: Noel Grandin 
AuthorDate: Mon Oct 11 21:12:33 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 12 08:30:29 2021 +0200

loplugin:moveparam in various

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

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 72f93042dde2..278e7942828b 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -131,9 +131,9 @@ struct SvcInfo
 const std::vector< LanguageType >aSuppLanguages;
 
 SvcInfo( const OUString ,
- const std::vector< LanguageType >   ) :
+ std::vector< LanguageType >&& rSuppLanguages ) :
 aSvcImplName(rSvcImplName),
-aSuppLanguages  (rSuppLanguages)
+aSuppLanguages  (std::move(rSuppLanguages))
 {
 }
 
@@ -961,7 +961,7 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
 uno::Sequence 
aLocaleSequence(xSvc->getLocales());
 aLanguages = LocaleSeqToLangVec( aLocaleSequence );
 
-pAvailSpellSvcs->push_back( SvcInfo( aImplName, aLanguages ) );
+pAvailSpellSvcs->push_back( SvcInfo( aImplName, 
std::move(aLanguages) ) );
 }
 catch (const uno::Exception &)
 {
@@ -1019,7 +1019,7 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
 uno::Sequence 
aLocaleSequence(xSvc->getLocales());
 aLanguages = LocaleSeqToLangVec( aLocaleSequence );
 
-pAvailGrammarSvcs->push_back( SvcInfo( aImplName, aLanguages ) 
);
+pAvailGrammarSvcs->push_back( SvcInfo( aImplName, 
std::move(aLanguages) ) );
 }
 catch (const uno::Exception &)
 {
@@ -1071,7 +1071,7 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
 SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty 
implementation name" );
 uno::Sequence 
aLocaleSequence(xSvc->getLocales());
 aLanguages = LocaleSeqToLangVec( aLocaleSequence );
-pAvailHyphSvcs->push_back( SvcInfo( aImplName, aLanguages ) );
+pAvailHyphSvcs->push_back( SvcInfo( aImplName, 
std::move(aLanguages) ) );
 }
 catch (const uno::Exception &)
 {
@@ -1125,7 +1125,7 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl()
 uno::Sequence 
aLocaleSequence(xSvc->getLocales());
 aLanguages = LocaleSeqToLangVec( aLocaleSequence );
 
-pAvailThesSvcs->push_back( SvcInfo( aImplName, aLanguages ) );
+pAvailThesSvcs->push_back( SvcInfo( aImplName, 
std::move(aLanguages) ) );
 }
 catch (const uno::Exception &)
 {
diff --git a/svtools/source/misc/langhelp.cxx b/svtools/source/misc/langhelp.cxx
index 92171ea6bc99..ff48868e17aa 100644
--- a/svtools/source/misc/langhelp.cxx
+++ b/svtools/source/misc/langhelp.cxx
@@ -69,9 +69,9 @@ class InstallLangpack : public Idle
 {
 std::vector m_aPackages;
 public:
-explicit InstallLangpack(const std::vector& rPackages)
+explicit InstallLangpack(std::vector&& rPackages)
 : Idle("install langpack")
-, m_aPackages(rPackages)
+, m_aPackages(std::move(rPackages))
 {
 SetPriority(TaskPriority::LOWEST);
 }
@@ -151,7 +151,7 @@ OUString getInstalledLocaleForSystemUILanguage(const 
css::uno::SequenceStart();
 }
 }
diff --git a/toolkit/source/controls/unocontrols.cxx 
b/toolkit/source/controls/unocontrols.cxx
index 3cb577d85392..0107262bf5b9 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -1998,9 +1998,9 @@ struct UnoControlListBoxModel_Data
 m_aListItems = i_copySource.m_aListItems;
 }
 
-voidsetAllItems( const ::std::vector< ListItem >& i_rItems )
+voidsetAllItems( ::std::vector< ListItem >&& i_rItems )
 {
-m_aListItems = i_rItems;
+m_aListItems = std::move(i_rItems);
 }
 
 voidremoveItem( const sal_Int32 i_nIndex )
@@ -2130,7 +2130,7 @@ void SAL_CALL 
UnoControlListBoxModel::setFastPropertyValue_NoBroadcast( sal_Int3
 aItems.begin(),
 CreateListItem()
 );
-m_xData->setAllItems( aItems );
+m_xData->setAllItems( std::move(aItems) );
 
 // since an XItemListListener does not have a "all items modified" or some 
such method,
 // we simulate this by notifying removal of all items, followed by 
insertion of all new
@@ -2937,7 +2937,7 @@ void SAL_CALL 

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

2021-08-12 Thread Noel Grandin (via logerrit)
 linguistic/source/lngsvcmgr.cxx |   30 +++---
 linguistic/source/lngsvcmgr.hxx |   11 ++-
 2 files changed, 21 insertions(+), 20 deletions(-)

New commits:
commit f9871d218bcae184a5845d63366175ea2df2086a
Author: Noel Grandin 
AuthorDate: Wed Aug 11 18:11:18 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Aug 12 08:40:30 2021 +0200

flatten LngSvcMgr

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

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 9e0100538809..898eeaf2256a 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -922,7 +922,7 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
 if (pAvailSpellSvcs)
 return;
 
-pAvailSpellSvcs.reset(new SvcInfoArray);
+pAvailSpellSvcs.emplace();
 
 uno::Reference< uno::XComponentContext > xContext( 
comphelper::getProcessComponentContext() );
 
@@ -960,7 +960,7 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
 uno::Sequence 
aLocaleSequence(xSvc->getLocales());
 aLanguages = LocaleSeqToLangVec( aLocaleSequence );
 
-pAvailSpellSvcs->push_back( std::make_unique( 
aImplName, aLanguages ) );
+pAvailSpellSvcs->push_back( SvcInfo( aImplName, aLanguages ) );
 }
 catch (const uno::Exception &)
 {
@@ -976,7 +976,7 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
 if (pAvailGrammarSvcs)
 return;
 
-pAvailGrammarSvcs.reset(new SvcInfoArray);
+pAvailGrammarSvcs.emplace();
 
 uno::Reference< uno::XComponentContext > xContext( 
comphelper::getProcessComponentContext() );
 
@@ -1018,7 +1018,7 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
 uno::Sequence 
aLocaleSequence(xSvc->getLocales());
 aLanguages = LocaleSeqToLangVec( aLocaleSequence );
 
-pAvailGrammarSvcs->push_back( std::make_unique( 
aImplName, aLanguages ) );
+pAvailGrammarSvcs->push_back( SvcInfo( aImplName, aLanguages ) 
);
 }
 catch (const uno::Exception &)
 {
@@ -1035,7 +1035,7 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
 if (pAvailHyphSvcs)
 return;
 
-pAvailHyphSvcs.reset(new SvcInfoArray);
+pAvailHyphSvcs.emplace();
 uno::Reference< uno::XComponentContext > xContext( 
comphelper::getProcessComponentContext() );
 
 uno::Reference< container::XContentEnumerationAccess > xEnumAccess( 
xContext->getServiceManager(), uno::UNO_QUERY );
@@ -1070,7 +1070,7 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
 SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty 
implementation name" );
 uno::Sequence 
aLocaleSequence(xSvc->getLocales());
 aLanguages = LocaleSeqToLangVec( aLocaleSequence );
-pAvailHyphSvcs->push_back( std::make_unique( 
aImplName, aLanguages ) );
+pAvailHyphSvcs->push_back( SvcInfo( aImplName, aLanguages ) );
 }
 catch (const uno::Exception &)
 {
@@ -1086,7 +1086,7 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl()
 if (pAvailThesSvcs)
 return;
 
-pAvailThesSvcs.reset(new SvcInfoArray);
+pAvailThesSvcs.emplace();
 
 uno::Reference< uno::XComponentContext > xContext( 
comphelper::getProcessComponentContext() );
 
@@ -1124,7 +1124,7 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl()
 uno::Sequence 
aLocaleSequence(xSvc->getLocales());
 aLanguages = LocaleSeqToLangVec( aLocaleSequence );
 
-pAvailThesSvcs->push_back( std::make_unique( 
aImplName, aLanguages ) );
+pAvailThesSvcs->push_back( SvcInfo( aImplName, aLanguages ) );
 }
 catch (const uno::Exception &)
 {
@@ -1376,22 +1376,22 @@ uno::Sequence< OUString > SAL_CALL
 if (rServiceName == SN_SPELLCHECKER)
 {
 GetAvailableSpellSvcs_Impl();
-pInfoArray = pAvailSpellSvcs.get();
+pInfoArray = &*pAvailSpellSvcs;
 }
 else if (rServiceName == SN_GRAMMARCHECKER)
 {
 GetAvailableGrammarSvcs_Impl();
-pInfoArray = pAvailGrammarSvcs.get();
+pInfoArray = &*pAvailGrammarSvcs;
 }
 else if (rServiceName == SN_HYPHENATOR)
 {
 GetAvailableHyphSvcs_Impl();
-pInfoArray = pAvailHyphSvcs.get();
+pInfoArray = &*pAvailHyphSvcs;
 }
 else if (rServiceName == SN_THESAURUS)
 {
 GetAvailableThesSvcs_Impl();
-pInfoArray = pAvailThesSvcs.get();
+pInfoArray = &*pAvailThesSvcs;
 }
 
 if (pInfoArray)
@@ -1400,12 +1400,12 @@ uno::Sequence< OUString > SAL_CALL
 aVec.reserve(pInfoArray->size());
 
 LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
-for (const auto& pInfo 

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

2021-08-10 Thread Stephan Bergmann (via logerrit)
 linguistic/source/lngsvcmgr.cxx |   23 ++-
 1 file changed, 10 insertions(+), 13 deletions(-)

New commits:
commit 6b8df9d79f89242a503b93b3c9e9f279eeda2105
Author: Stephan Bergmann 
AuthorDate: Tue Aug 10 10:29:29 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Aug 10 17:13:58 2021 +0200

pAvailGrammarSvcs can never be null here

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

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index a0f9822e4779..9e0100538809 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -1009,19 +1009,16 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
 : xFactory->createInstance(),
 uno::UNO_QUERY_THROW);
 
-if (pAvailGrammarSvcs)
-{
-OUStringaImplName;
-std::vector< LanguageType >aLanguages;
-uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY 
);
-if (xInfo.is())
-aImplName = xInfo->getImplementationName();
-SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty 
implementation name" );
-uno::Sequence 
aLocaleSequence(xSvc->getLocales());
-aLanguages = LocaleSeqToLangVec( aLocaleSequence );
-
-pAvailGrammarSvcs->push_back( std::make_unique( 
aImplName, aLanguages ) );
-}
+OUStringaImplName;
+std::vector< LanguageType >aLanguages;
+uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
+if (xInfo.is())
+aImplName = xInfo->getImplementationName();
+SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty 
implementation name" );
+uno::Sequence 
aLocaleSequence(xSvc->getLocales());
+aLanguages = LocaleSeqToLangVec( aLocaleSequence );
+
+pAvailGrammarSvcs->push_back( std::make_unique( 
aImplName, aLanguages ) );
 }
 catch (const uno::Exception &)
 {


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

2021-08-10 Thread Stephan Bergmann (via logerrit)
 linguistic/source/lngsvcmgr.cxx |  116 +---
 1 file changed, 51 insertions(+), 65 deletions(-)

New commits:
commit f989bd22cc3c80d3c5119e3de1a269ab9a80bd78
Author: Stephan Bergmann 
AuthorDate: Tue Aug 10 10:13:04 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Aug 10 15:07:35 2021 +0200

Catch exceptions when setting up linguistic extensions

...not only from the createInstance calls, but also from later calls like
XSpellChecker::getLocales.  At least when installing
 
(which
only contains native code for macOS and Windows) on Linux, that getLocales 
call
would cause a RuntimeException, but which was effectively left uncaught and 
thus
caused a crash.

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

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index b4b8d3836f6e..a0f9822e4779 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -940,7 +940,6 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
 uno::Reference< lang::XSingleComponentFactory > xCompFactory;
 uno::Reference< lang::XSingleServiceFactory > xFactory;
 
-uno::Reference< linguistic2::XSpellChecker > xSvc;
 xCompFactory.set(aCurrent, css::uno::UNO_QUERY);
 if (!xCompFactory.is())
 {
@@ -950,27 +949,24 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
 {
 try
 {
-xSvc.set( ( xCompFactory.is() ? 
xCompFactory->createInstanceWithContext( xContext ) : 
xFactory->createInstance() ), uno::UNO_QUERY );
+uno::Reference< linguistic2::XSpellChecker > xSvc( ( 
xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : 
xFactory->createInstance() ), uno::UNO_QUERY_THROW );
+
+OUStringaImplName;
+std::vector< LanguageType >   aLanguages;
+uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
+if (xInfo.is())
+aImplName = xInfo->getImplementationName();
+SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty 
implementation name" );
+uno::Sequence 
aLocaleSequence(xSvc->getLocales());
+aLanguages = LocaleSeqToLangVec( aLocaleSequence );
+
+pAvailSpellSvcs->push_back( std::make_unique( 
aImplName, aLanguages ) );
 }
 catch (const uno::Exception &)
 {
 SAL_WARN( "linguistic", "createInstance failed" );
 }
 }
-
-if (xSvc.is())
-{
-OUStringaImplName;
-std::vector< LanguageType >   aLanguages;
-uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
-if (xInfo.is())
-aImplName = xInfo->getImplementationName();
-SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty 
implementation name" );
-uno::Sequence aLocaleSequence(xSvc->getLocales());
-aLanguages = LocaleSeqToLangVec( aLocaleSequence );
-
-pAvailSpellSvcs->push_back( std::make_unique( aImplName, 
aLanguages ) );
-}
 }
 }
 
@@ -998,7 +994,6 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
 uno::Reference< lang::XSingleComponentFactory > xCompFactory;
 uno::Reference< lang::XSingleServiceFactory > xFactory;
 
-uno::Reference< linguistic2::XProofreader > xSvc;
 xCompFactory.set(aCurrent, css::uno::UNO_QUERY);
 if (!xCompFactory.is())
 {
@@ -1008,13 +1003,24 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
 {
 try
 {
-if (xCompFactory.is())
-{
-
xSvc.set(xCompFactory->createInstanceWithContext(xContext), uno::UNO_QUERY);
-}
-else
+uno::Reference< linguistic2::XProofreader > xSvc(
+xCompFactory.is()
+? xCompFactory->createInstanceWithContext(xContext)
+: xFactory->createInstance(),
+uno::UNO_QUERY_THROW);
+
+if (pAvailGrammarSvcs)
 {
-xSvc.set(xFactory->createInstance(), uno::UNO_QUERY);
+OUStringaImplName;
+std::vector< LanguageType >aLanguages;
+uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY 
);
+if (xInfo.is())
+aImplName = xInfo->getImplementationName();
+SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty 
implementation name" );
+uno::Sequence 

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

2021-07-18 Thread Noel Grandin (via logerrit)
 linguistic/source/misc.cxx |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 2b9afb52a96b86cb6f1aab2bdccca3b19566a8c7
Author: Noel Grandin 
AuthorDate: Sun Jul 18 15:04:41 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Jul 18 20:47:06 2021 +0200

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

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

diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 59214bed4500..ac9ad9de37e9 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -46,6 +46,7 @@
 
 #include 
 #include 
+#include 
 
 using namespace osl;
 using namespace com::sun::star;
@@ -571,15 +572,11 @@ static CharClass & lcl_GetCharClass()
 return aCC;
 }
 
-static osl::Mutex & lcl_GetCharClassMutex()
-{
-static osl::Mutex   aMutex;
-return aMutex;
-}
+static std::mutex s_GetCharClassMutex;
 
 bool IsUpper( const OUString , sal_Int32 nPos, sal_Int32 nLen, 
LanguageType nLanguage )
 {
-MutexGuard  aGuard( lcl_GetCharClassMutex() );
+std::lock_guard  aGuard( s_GetCharClassMutex );
 
 CharClass  = lcl_GetCharClass();
 rCC.setLanguageTag( LanguageTag( nLanguage ));
@@ -615,7 +612,7 @@ CapType capitalType(const OUString& aTerm, CharClass const 
* pCC)
 
 OUString ToLower( const OUString , LanguageType nLanguage )
 {
-MutexGuard  aGuard( lcl_GetCharClassMutex() );
+std::lock_guard  aGuard( s_GetCharClassMutex );
 
 CharClass  = lcl_GetCharClass();
 rCC.setLanguageTag( LanguageTag( nLanguage ));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-11-12 Thread Philipp Hofer (via logerrit)
 linguistic/source/hhconvdic.hxx |   19 ---
 solenv/clang-format/excludelist |1 -
 2 files changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 0d3fb848a2995a0869c4c5fa8916214a513865ac
Author: Philipp Hofer 
AuthorDate: Thu Nov 12 13:06:00 2020 +0100
Commit: Mike Kaganski 
CommitDate: Fri Nov 13 08:23:21 2020 +0100

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

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

diff --git a/linguistic/source/hhconvdic.hxx b/linguistic/source/hhconvdic.hxx
index ba7e671b5c58..107607be6d57 100644
--- a/linguistic/source/hhconvdic.hxx
+++ b/linguistic/source/hhconvdic.hxx
@@ -22,27 +22,24 @@
 
 #include "convdic.hxx"
 
-
-class HHConvDic :
-public ConvDic
+class HHConvDic : public ConvDic
 {
-HHConvDic(const HHConvDic &) = delete;
-HHConvDic & operator = (const HHConvDic &) = delete;
+HHConvDic(const HHConvDic&) = delete;
+HHConvDic& operator=(const HHConvDic&) = delete;
 
 public:
-HHConvDic( const OUString , const OUString  );
+HHConvDic(const OUString& rName, const OUString& rMainURL);
 virtual ~HHConvDic() override;
 
 // XConversionDictionary
-virtual void SAL_CALL addEntry( const OUString& aLeftText, const OUString& 
aRightText ) override;
+virtual void SAL_CALL addEntry(const OUString& aLeftText, const OUString& 
aRightText) override;
 
 // XServiceInfo
-virtual OUString SAL_CALL getImplementationName(  ) override;
-virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
-virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  
) override;
+virtual OUString SAL_CALL getImplementationName() override;
+virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) 
override;
+virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() 
override;
 };
 
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index ab5083590fce..4495c0572f2b 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -7526,7 +7526,6 @@ linguistic/source/dlistimp.hxx
 linguistic/source/gciterator.cxx
 linguistic/source/gciterator.hxx
 linguistic/source/hhconvdic.cxx
-linguistic/source/hhconvdic.hxx
 linguistic/source/hyphdsp.cxx
 linguistic/source/hyphdsp.hxx
 linguistic/source/hyphdta.cxx
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-10-02 Thread Stephan Bergmann (via logerrit)
 linguistic/source/dlistimp.cxx   |5 ++---
 linguistic/source/gciterator.cxx |6 ++
 linguistic/source/lng.component  |8 
 linguistic/source/lngopt.cxx |6 ++
 linguistic/source/lngsvcmgr.cxx  |5 ++---
 5 files changed, 12 insertions(+), 18 deletions(-)

New commits:
commit 1be81c0ae66fdb4a92ca9b4fe6691958da838866
Author: Stephan Bergmann 
AuthorDate: Fri Oct 2 14:22:55 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 2 20:42:52 2020 +0200

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

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

diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 03c576a820f4..3fa38b38d4a5 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -784,9 +785,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 linguistic_DicList_get_implementation(
 css::uno::XComponentContext* , css::uno::Sequence const&)
 {
-static rtl::Reference g_Instance(new DicList());
-g_Instance->acquire();
-return static_cast(g_Instance.get());
+return cppu::acquire(static_cast(new DicList()));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 45c13b1cfe72..19864c9d8035 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -48,12 +48,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -1174,9 +1174,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 linguistic_GrammarCheckingIterator_get_implementation(
 css::uno::XComponentContext* , css::uno::Sequence const&)
 {
-static rtl::Reference g_Instance(new 
GrammarCheckingIterator());
-g_Instance->acquire();
-return static_cast(g_Instance.get());
+return cppu::acquire(static_cast(new 
GrammarCheckingIterator()));
 }
 
 
diff --git a/linguistic/source/lng.component b/linguistic/source/lng.component
index 525e02cd93e7..82622e2f005f 100644
--- a/linguistic/source/lng.component
+++ b/linguistic/source/lng.component
@@ -24,19 +24,19 @@
 
   
   
+constructor="linguistic_DicList_get_implementation" single-instance="true">
 
   
   
+constructor="linguistic_LinguProps_get_implementation" 
single-instance="true">
 
   
   
+constructor="linguistic_LngSvcMgr_get_implementation" 
single-instance="true">
 
   
   
+constructor="linguistic_GrammarCheckingIterator_get_implementation" 
single-instance="true">
 
   
 
diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx
index f82124ecc07a..290b6581f8dc 100644
--- a/linguistic/source/lngopt.cxx
+++ b/linguistic/source/lngopt.cxx
@@ -23,11 +23,11 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -427,9 +427,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 linguistic_LinguProps_get_implementation(
 css::uno::XComponentContext* , css::uno::Sequence const&)
 {
-static rtl::Reference g_Instance(new LinguProps());
-g_Instance->acquire();
-return static_cast(g_Instance.get());
+return cppu::acquire(static_cast(new LinguProps()));
 }
 
 
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 5f25749da164..23a2e2c7cac7 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "lngsvcmgr.hxx"
 #include 
@@ -1837,9 +1838,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 linguistic_LngSvcMgr_get_implementation(
 css::uno::XComponentContext* , css::uno::Sequence const&)
 {
-static rtl::Reference g_Instance(new LngSvcMgr());
-g_Instance->acquire();
-return static_cast(g_Instance.get());
+return cppu::acquire(static_cast(new LngSvcMgr()));
 }
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-09-01 Thread Andrea Gelmini (via logerrit)
 linguistic/source/spelldsp.cxx |   28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

New commits:
commit e772c8e86dcdb7c5b80b04d57b454158909ffe61
Author: Andrea Gelmini 
AuthorDate: Mon Aug 31 16:10:12 2020 +0200
Commit: Julien Nabet 
CommitDate: Tue Sep 1 22:03:39 2020 +0200

Fix typo in code

It passed "make check" on Linux

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

diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index a1390c916c77..fb58843a0efb 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -453,7 +453,7 @@ Reference< XSpellAlternatives > 
SpellCheckerDispatcher::spell_Impl(
 // try already instantiated services first
 {
 const Reference< XSpellChecker >  *pRef  = 
pEntry->aSvcRefs.getConstArray();
-sal_Int32 nNumSugestions = -1;
+sal_Int32 nNumSuggestions = -1;
 while (i <= pEntry->nLastTriedSvcIndex
&&  (!bTmpResValid || xTmpRes.is()) )
 {
@@ -483,17 +483,17 @@ Reference< XSpellAlternatives > 
SpellCheckerDispatcher::spell_Impl(
 if (!xRes.is() && bTmpResValid)
 {
 xRes = xTmpRes;
-nNumSugestions = 0;
+nNumSuggestions = 0;
 if (xRes.is())
-nNumSugestions = xRes->getAlternatives().getLength();
+nNumSuggestions = xRes->getAlternatives().getLength();
 }
-sal_Int32 nTmpNumSugestions = 0;
+sal_Int32 nTmpNumSuggestions = 0;
 if (xTmpRes.is() && bTmpResValid)
-nTmpNumSugestions = xTmpRes->getAlternatives().getLength();
-if (xRes.is() && nNumSugestions == 0 && nTmpNumSugestions > 0)
+nTmpNumSuggestions = 
xTmpRes->getAlternatives().getLength();
+if (xRes.is() && nNumSuggestions == 0 && nTmpNumSuggestions > 
0)
 {
 xRes = xTmpRes;
-nNumSugestions = nTmpNumSugestions;
+nNumSuggestions = nTmpNumSuggestions;
 }
 
 ++i;
@@ -514,7 +514,7 @@ Reference< XSpellAlternatives > 
SpellCheckerDispatcher::spell_Impl(
 Sequence< Any > aArgs(2);
 aArgs.getArray()[0] <<= GetPropSet();
 
-sal_Int32 nNumSugestions = -1;
+sal_Int32 nNumSuggestions = -1;
 while (i < nLen  &&  (!bTmpResValid || xTmpRes.is()))
 {
 // create specific service via it's implementation name
@@ -562,17 +562,17 @@ Reference< XSpellAlternatives > 
SpellCheckerDispatcher::spell_Impl(
 if (!xRes.is() && bTmpResValid)
 {
 xRes = xTmpRes;
-nNumSugestions = 0;
+nNumSuggestions = 0;
 if (xRes.is())
-nNumSugestions = xRes->getAlternatives().getLength();
+nNumSuggestions = xRes->getAlternatives().getLength();
 }
-sal_Int32 nTmpNumSugestions = 0;
+sal_Int32 nTmpNumSuggestions = 0;
 if (xTmpRes.is() && bTmpResValid)
-nTmpNumSugestions = xTmpRes->getAlternatives().getLength();
-if (xRes.is() && nNumSugestions == 0 && nTmpNumSugestions > 0)
+nTmpNumSuggestions = 
xTmpRes->getAlternatives().getLength();
+if (xRes.is() && nNumSuggestions == 0 && nTmpNumSuggestions > 
0)
 {
 xRes = xTmpRes;
-nNumSugestions = nTmpNumSugestions;
+nNumSuggestions = nTmpNumSuggestions;
 }
 
 pEntry->nLastTriedSvcIndex = static_cast(i);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-04 Thread Stephan Bergmann (via logerrit)
 linguistic/source/dlistimp.cxx |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 5a28a2ac3f692975306025e9e35e95f4c9ddcd38
Author: Stephan Bergmann 
AuthorDate: Tue Aug 4 14:30:04 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Aug 4 20:48:15 2020 +0200

loplugin:referencecasting (clang-cl)

("the source reference is already a subtype of the destination reference")

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

diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 31f0a20c4230..03c576a820f4 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -530,10 +530,8 @@ void SAL_CALL
 size_t nCount = rDicList.size();
 for (size_t i = 0;  i < nCount;  i++)
 {
-uno::Reference< XDictionary > xDic( rDicList[i], UNO_QUERY );
-
 // save (modified) dictionaries
-uno::Reference< frame::XStorable >  xStor( xDic , UNO_QUERY );
+uno::Reference< frame::XStorable >  xStor( rDicList[i] , UNO_QUERY 
);
 if (xStor.is())
 {
 try
@@ -548,8 +546,8 @@ void SAL_CALL
 
 // release references to (members of) this object hold by
 // dictionaries
-if (xDic.is())
-xDic->removeDictionaryEventListener( mxDicEvtLstnrHelper.get() 
);
+if (rDicList[i].is())
+rDicList[i]->removeDictionaryEventListener( 
mxDicEvtLstnrHelper.get() );
 }
 }
 mxDicEvtLstnrHelper.clear();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-01 Thread Stephan Bergmann (via logerrit)
 linguistic/source/dicimp.cxx  |   20 ++--
 linguistic/source/gciterator.cxx  |8 
 linguistic/source/iprcache.cxx|2 +-
 linguistic/source/lngprophelp.cxx |2 +-
 linguistic/source/misc.cxx|2 +-
 5 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit 6a9f71f232eb214a4be943b4f6a9e4a228a1ed5c
Author: Stephan Bergmann 
AuthorDate: Wed Jul 1 13:21:56 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jul 1 16:16:34 2020 +0200

Upcoming improved loplugin:staticanonymous -> redundantstatic: linguistic

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

diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index ef348f75a594..d29a2bcb0ad3 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -76,16 +76,16 @@ using namespace linguistic;
 // text stripping and dictionary saving.
 #define EXTENSION_FOR_TITLE_TEXT "."
 
-static const char* const pVerStr2= "WBSWG2";
-static const char* const pVerStr5= "WBSWG5";
-static const char* const pVerStr6= "WBSWG6";
-static const char* const pVerOOo7= "OOoUserDict1";
-
-static const sal_Int16 DIC_VERSION_DONTKNOW = -1;
-static const sal_Int16 DIC_VERSION_2 = 2;
-static const sal_Int16 DIC_VERSION_5 = 5;
-static const sal_Int16 DIC_VERSION_6 = 6;
-static const sal_Int16 DIC_VERSION_7 = 7;
+const char* const pVerStr2= "WBSWG2";
+const char* const pVerStr5= "WBSWG5";
+const char* const pVerStr6= "WBSWG6";
+const char* const pVerOOo7= "OOoUserDict1";
+
+const sal_Int16 DIC_VERSION_DONTKNOW = -1;
+const sal_Int16 DIC_VERSION_2 = 2;
+const sal_Int16 DIC_VERSION_5 = 5;
+const sal_Int16 DIC_VERSION_6 = 6;
+const sal_Int16 DIC_VERSION_7 = 7;
 
 static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl()
 {
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index ac8fd2bf2cf4..6e1a5ea0602f 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -68,7 +68,7 @@ static OUString 
GrammarCheckingIterator_getImplementationName() throw();
 static uno::Sequence< OUString > 
GrammarCheckingIterator_getSupportedServiceNames() throw();
 
 // white space list: obtained from the fonts.config.txt of a Linux system.
-static const sal_Unicode aWhiteSpaces[] =
+const sal_Unicode aWhiteSpaces[] =
 {
 0x0020,   /* SPACE */
 0x00a0,   /* NO-BREAK SPACE */
@@ -121,10 +121,10 @@ static const sal_Unicode aWhiteSpaces[] =
 };
 
 //  Information about reason for proofreading (ProofInfo)
-   static const sal_Int32 PROOFINFO_GET_PROOFRESULT = 1;
-   static const sal_Int32 PROOFINFO_MARK_PARAGRAPH = 2;
+   const sal_Int32 PROOFINFO_GET_PROOFRESULT = 1;
+   const sal_Int32 PROOFINFO_MARK_PARAGRAPH = 2;
 
-static const int nWhiteSpaces = SAL_N_ELEMENTS( aWhiteSpaces );
+const int nWhiteSpaces = SAL_N_ELEMENTS( aWhiteSpaces );
 
 static bool lcl_IsWhiteSpace( sal_Unicode cChar )
 {
diff --git a/linguistic/source/iprcache.cxx b/linguistic/source/iprcache.cxx
index eb49db33892f..14eee1dfc69b 100644
--- a/linguistic/source/iprcache.cxx
+++ b/linguistic/source/iprcache.cxx
@@ -39,7 +39,7 @@ namespace linguistic
 
 #define NUM_FLUSH_PROPS 6
 
-static const struct
+const struct
 {
 const char *pPropName;
 sal_Int32   nPropHdl;
diff --git a/linguistic/source/lngprophelp.cxx 
b/linguistic/source/lngprophelp.cxx
index 1c066e7eba34..d6681c28 100644
--- a/linguistic/source/lngprophelp.cxx
+++ b/linguistic/source/lngprophelp.cxx
@@ -54,7 +54,7 @@ static const char *aCH[] =
 UPN_IS_USE_DICTIONARY_LIST,
 };
 
-static const int nCHCount = SAL_N_ELEMENTS(aCH);
+const int nCHCount = SAL_N_ELEMENTS(aCH);
 
 
 PropertyChgHelper::PropertyChgHelper(
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 8024a3b34437..3e0beddada2d 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -625,7 +625,7 @@ OUString ToLower( const OUString , LanguageType 
nLanguage )
 
 // sorted(!) array of unicode ranges for code points that are exclusively(!) 
used as numbers
 // and thus may NOT not be part of names or words like the Chinese/Japanese 
number characters
-static const sal_uInt32 the_aDigitZeroes [] =
+const sal_uInt32 the_aDigitZeroes [] =
 {
 0x0030, //0039; Decimal # Nd  [10] DIGIT ZERO..DIGIT NINE
 0x0660, //0669; Decimal # Nd  [10] ARABIC-INDIC DIGIT 
ZERO..ARABIC-INDIC DIGIT NINE
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-04-28 Thread Miklos Vajna (via logerrit)
 linguistic/source/lngsvcmgr.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 9ee7a841d41a5517fd567b17b936ea4c0141e157
Author: Miklos Vajna 
AuthorDate: Mon Apr 27 16:32:52 2020 +0200
Commit: Miklos Vajna 
CommitDate: Tue Apr 28 14:28:19 2020 +0200

linguistic: make LngSvcMgr::GetAvailableGrammarSvcs_Impl() more readable

It's not exactly clear why, but as a side effect, this makes a crash in
uno::Reference::release() go away in the --enable-macosx-sandbox case.
But it helps readability as well, so why not.

The root cause is probabably either a compiler bug or the old code
depends on a longer lifetime of the temporaries involved in the function
call, but that's not clear to me.

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

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 2cf8524f851f..16581700d890 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -1011,7 +1011,14 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
 {
 try
 {
-xSvc.set( ( xCompFactory.is() ? 
xCompFactory->createInstanceWithContext( xContext ) : 
xFactory->createInstance() ), uno::UNO_QUERY );
+if (xCompFactory.is())
+{
+
xSvc.set(xCompFactory->createInstanceWithContext(xContext), uno::UNO_QUERY);
+}
+else
+{
+xSvc.set(xFactory->createInstance(), uno::UNO_QUERY);
+}
 }
 catch (const uno::Exception &)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-04-23 Thread Noel Grandin (via logerrit)
 linguistic/source/convdic.cxx  |2 +-
 linguistic/source/dicimp.cxx   |   28 ++--
 linguistic/source/dicimp.hxx   |2 +-
 linguistic/source/dlistimp.cxx |4 ++--
 4 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 524c4c61ebd985ab6721d8c7e5f8f85f273883cb
Author: Noel Grandin 
AuthorDate: Thu Apr 23 11:37:44 2020 +0200
Commit: Noel Grandin 
CommitDate: Thu Apr 23 13:23:36 2020 +0200

loplugin:makeshared in linguistic

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

diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index e4d1b4e82dfc..b67558954a2a 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -224,7 +224,7 @@ void ConvDic::Save()
 if (!xStream.is())
 return;
 
-SvStreamPtr pStream( utl::UcbStreamHelper::CreateStream( xStream ) );
+std::unique_ptr pStream( utl::UcbStreamHelper::CreateStream( 
xStream ) );
 
 // get XML writer
 uno::Reference< xml::sax::XWriter > xSaxWriter = 
xml::sax::Writer::create(xContext);
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index de8d5326c22a..ef348f75a594 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -107,7 +107,7 @@ static bool getTag(const OString , const char 
*pTagName,
 }
 
 
-sal_Int16 ReadDicVersion( SvStreamPtr const , LanguageType , 
bool , OUString  )
+sal_Int16 ReadDicVersion( SvStream& rStream, LanguageType , bool , 
OUString  )
 {
 // Sniff the header
 sal_Int16 nDicVersion = DIC_VERSION_DONTKNOW;
@@ -116,13 +116,13 @@ sal_Int16 ReadDicVersion( SvStreamPtr const , 
LanguageType , bool
 nLng = LANGUAGE_NONE;
 bNeg = false;
 
-if (!rpStream.get() || rpStream->GetError())
+if (rStream.GetError())
 return -1;
 
-sal_uInt64 const nSniffPos = rpStream->Tell();
+sal_uInt64 const nSniffPos = rStream.Tell();
 static std::size_t nVerOOo7Len = sal::static_int_cast< std::size_t 
>(strlen( pVerOOo7 ));
 pMagicHeader[ nVerOOo7Len ] = '\0';
-if ((rpStream->ReadBytes(static_cast(pMagicHeader), nVerOOo7Len) 
== nVerOOo7Len) &&
+if ((rStream.ReadBytes(static_cast(pMagicHeader), nVerOOo7Len) == 
nVerOOo7Len) &&
 !strcmp(pMagicHeader, pVerOOo7))
 {
 bool bSuccess;
@@ -131,10 +131,10 @@ sal_Int16 ReadDicVersion( SvStreamPtr const , 
LanguageType , bool
 nDicVersion = DIC_VERSION_7;
 
 // 1st skip magic / header line
-rpStream->ReadLine(aLine);
+rStream.ReadLine(aLine);
 
 // 2nd line: language all | en-US | pt-BR ...
-while ((bSuccess = rpStream->ReadLine(aLine)))
+while ((bSuccess = rStream.ReadLine(aLine)))
 {
 OString aTagValue;
 
@@ -177,13 +177,13 @@ sal_Int16 ReadDicVersion( SvStreamPtr const , 
LanguageType , bool
 {
 sal_uInt16 nLen;
 
-rpStream->Seek (nSniffPos );
+rStream.Seek (nSniffPos );
 
-rpStream->ReadUInt16( nLen );
+rStream.ReadUInt16( nLen );
 if (nLen >= MAX_HEADER_LENGTH)
 return -1;
 
-rpStream->ReadBytes(pMagicHeader, nLen);
+rStream.ReadBytes(pMagicHeader, nLen);
 pMagicHeader[nLen] = '\0';
 
 // Check version magic
@@ -202,13 +202,13 @@ sal_Int16 ReadDicVersion( SvStreamPtr const , 
LanguageType , bool
 {
 // The language of the dictionary
 sal_uInt16 nTmp = 0;
-rpStream->ReadUInt16( nTmp );
+rStream.ReadUInt16( nTmp );
 nLng = LanguageType(nTmp);
 if (VERS2_NOLANGUAGE == static_cast(nLng))
 nLng = LANGUAGE_NONE;
 
 // Negative Flag
-rpStream->ReadCharAsBool( bNeg );
+rStream.ReadCharAsBool( bNeg );
 }
 }
 
@@ -290,12 +290,12 @@ ErrCode DictionaryNeo::loadEntries(const OUString 
)
 if (!xStream.is())
 return ErrCode(sal_uInt32(-1));
 
-SvStreamPtr pStream( utl::UcbStreamHelper::CreateStream( xStream ) );
+std::unique_ptr pStream( utl::UcbStreamHelper::CreateStream( 
xStream ) );
 
 // read header
 bool bNegativ;
 LanguageType nLang;
-nDicVersion = ReadDicVersion(pStream, nLang, bNegativ, aDicName);
+nDicVersion = ReadDicVersion(*pStream, nLang, bNegativ, aDicName);
 ErrCode nErr = pStream->GetError();
 if (nErr != ERRCODE_NONE)
 return nErr;
@@ -424,7 +424,7 @@ ErrCode DictionaryNeo::saveEntries(const OUString )
 if (!xStream.is())
 return ErrCode(sal_uInt32(-1));
 
-SvStreamPtr pStream( utl::UcbStreamHelper::CreateStream( xStream ) );
+std::unique_ptr pStream( utl::UcbStreamHelper::CreateStream( 
xStream ) );
 
 // Always write as the latest version, i.e. DIC_VERSION_7
 
diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx
index 

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

2020-04-07 Thread Noel Grandin (via logerrit)
 linguistic/source/convdicxml.cxx  |   26 -
 linguistic/source/dicimp.cxx  |   38 +-
 linguistic/source/dlistimp.cxx|  118 +++
 linguistic/source/gciterator.cxx  |   70 ++--
 linguistic/source/iprcache.cxx|   26 -
 linguistic/source/lngprophelp.cxx |  164 +-
 linguistic/source/lngsvcmgr.cxx   |  620 +++---
 7 files changed, 531 insertions(+), 531 deletions(-)

New commits:
commit e41106332982faef3c8b343b96904eeaa9ff6f60
Author: Noel Grandin 
AuthorDate: Tue Apr 7 10:14:17 2020 +0200
Commit: Noel Grandin 
CommitDate: Tue Apr 7 13:11:35 2020 +0200

loplugin:flatten in linguistic

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

diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx
index fe5ff97105aa..99e9959957ff 100644
--- a/linguistic/source/convdicxml.cxx
+++ b/linguistic/source/convdicxml.cxx
@@ -228,21 +228,21 @@ void ConvDicXMLEntryTextContext_Impl::startFastElement(
 sal_Int32 /*Element*/,
 const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttrList 
)
 {
-if ( rxAttrList.is() )
-{
-sax_fastparser::FastAttributeList *pAttribList =
-sax_fastparser::FastAttributeList::castToFastAttributeList( 
rxAttrList );
+if ( !rxAttrList.is() )
+return;
 
-for (auto  : *pAttribList)
+sax_fastparser::FastAttributeList *pAttribList =
+sax_fastparser::FastAttributeList::castToFastAttributeList( rxAttrList 
);
+
+for (auto  : *pAttribList)
+{
+switch (aIter.getToken())
 {
-switch (aIter.getToken())
-{
-case XML_NAMESPACE_TCD | XML_LEFT_TEXT:
-aLeftText = aIter.toString();
-break;
-default:
-;
-}
+case XML_NAMESPACE_TCD | XML_LEFT_TEXT:
+aLeftText = aIter.toString();
+break;
+default:
+;
 }
 }
 }
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index e2fc1d53832c..cae5f9871858 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -764,31 +764,31 @@ void SAL_CALL DictionaryNeo::setActive( sal_Bool 
bActivate )
 {
 MutexGuard  aGuard( GetLinguMutex() );
 
-if (bIsActive != bool(bActivate))
+if (bIsActive == bool(bActivate))
+return;
+
+bIsActive = bActivate;
+sal_Int16 nEvent = bIsActive ?
+DictionaryEventFlags::ACTIVATE_DIC : 
DictionaryEventFlags::DEACTIVATE_DIC;
+
+// remove entries from memory if dictionary is deactivated
+if (!bIsActive)
 {
-bIsActive = bActivate;
-sal_Int16 nEvent = bIsActive ?
-DictionaryEventFlags::ACTIVATE_DIC : 
DictionaryEventFlags::DEACTIVATE_DIC;
+bool bIsEmpty = aEntries.empty();
 
-// remove entries from memory if dictionary is deactivated
-if (!bIsActive)
+// save entries first if necessary
+if (bIsModified && hasLocation() && !isReadonly())
 {
-bool bIsEmpty = aEntries.empty();
-
-// save entries first if necessary
-if (bIsModified && hasLocation() && !isReadonly())
-{
-store();
+store();
 
-aEntries.clear();
-bNeedEntries = !bIsEmpty;
-}
-DBG_ASSERT( !bIsModified || !hasLocation() || isReadonly(),
-"lng : dictionary is still modified" );
+aEntries.clear();
+bNeedEntries = !bIsEmpty;
 }
-
-launchEvent(nEvent, nullptr);
+DBG_ASSERT( !bIsModified || !hasLocation() || isReadonly(),
+"lng : dictionary is still modified" );
 }
+
+launchEvent(nEvent, nullptr);
 }
 
 sal_Bool SAL_CALL DictionaryNeo::isActive(  )
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 27ad955ca886..98ed47202f55 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -522,46 +522,46 @@ void SAL_CALL
 {
 osl::MutexGuard aGuard( GetLinguMutex() );
 
-if (!bDisposing)
-{
-bDisposing = true;
-EventObject aEvtObj( static_cast(this) );
+if (bDisposing)
+return;
+
+bDisposing = true;
+EventObject aEvtObj( static_cast(this) );
 
-aEvtListeners.disposeAndClear( aEvtObj );
-if (mxDicEvtLstnrHelper.is())
-mxDicEvtLstnrHelper->DisposeAndClear( aEvtObj );
+aEvtListeners.disposeAndClear( aEvtObj );
+if (mxDicEvtLstnrHelper.is())
+mxDicEvtLstnrHelper->DisposeAndClear( aEvtObj );
 
-//! avoid creation of dictionaries if not already done
-if ( !aDicList.empty() )
+//! avoid creation of dictionaries if not already done
+if ( 

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

2020-03-06 Thread Fred Kruse (via logerrit)
 linguistic/source/gciterator.cxx |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit f0d0436e9f360575bda2c1e4f1ed4d3f6fa0b40f
Author: Fred Kruse 
AuthorDate: Mon Mar 2 21:12:50 2020 +0100
Commit: Michael Stahl 
CommitDate: Fri Mar 6 11:12:52 2020 +0100

add information to xProofrader in gciterator.cxx

the in formation gives the reason for the initiataed proof. This helps to
get the location of the checked paragraph inside the test. This is needed
for running text level rules e.g. in LanguagTool

Change-Id: I559a07a74932134c6dbb04fb9f6137e623e02d5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89854
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index c0e56632df4b..2c95c33a690f 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -120,6 +120,10 @@ static const sal_Unicode aWhiteSpaces[] =
 0xfffb/* INTERLINEAR ANNOTATION TERMINATOR */
 };
 
+//  Information about reason for proofreading (ProofInfo)
+   static const sal_Int32 PROOFINFO_GET_PROOFRESULT = 1;
+   static const sal_Int32 PROOFINFO_MARK_PARAGRAPH = 2;
+
 static const int nWhiteSpaces = SAL_N_ELEMENTS( aWhiteSpaces );
 
 static bool lcl_IsWhiteSpace( sal_Unicode cChar )
@@ -545,13 +549,15 @@ uno::Reference< linguistic2::XProofreader > 
GrammarCheckingIterator::GetGrammarC
 }
 
 static uno::Sequence
-lcl_makeProperties(uno::Reference const& xFlatPara)
+lcl_makeProperties(uno::Reference const& xFlatPara, 
sal_Int32 nProofInfo)
 {
 uno::Reference const xProps(
 xFlatPara, uno::UNO_QUERY_THROW);
+css::uno::Any a (nProofInfo);
 return comphelper::InitPropertySequence({
 { "FieldPositions", xProps->getPropertyValue("FieldPositions") },
-{ "FootnotePositions", xProps->getPropertyValue("FootnotePositions") }
+{ "FootnotePositions", xProps->getPropertyValue("FootnotePositions") },
+{ "ProofInfo", a }
 });
 }
 
@@ -619,7 +625,7 @@ void GrammarCheckingIterator::DequeueAndCheck()
 {
 aGuard.clear();
 uno::Sequence const 
aProps(
-lcl_makeProperties(xFlatPara));
+lcl_makeProperties(xFlatPara, 
PROOFINFO_MARK_PARAGRAPH));
 aRes = xGC->doProofreading(aCurDocId, aCurTxt, 
aCurLocale,
nStartPos, 
nSuggestedEnd, aProps);
 
@@ -772,7 +778,7 @@ linguistic2::ProofreadingResult SAL_CALL 
GrammarCheckingIterator::checkSentenceA
 if (xGC.is())
 {
 uno::Sequence const aProps(
-lcl_makeProperties(xFlatPara));
+lcl_makeProperties(xFlatPara, 
PROOFINFO_GET_PROOFRESULT));
 aTmpRes = xGC->doProofreading( aDocId, rText,
 aCurLocale, nStartPos, nSuggestedEndOfSentencePos, aProps 
);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-11-20 Thread Noel Grandin (via logerrit)
 linguistic/source/convdicxml.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit c1346f75145415a6a28b3b0f4e83d09bdfbc67e0
Author: Noel Grandin 
AuthorDate: Wed Nov 20 09:59:44 2019 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 20 10:38:56 2019 +0100

use correct parser overrides in ConvDicXMLImportContext

after
commit 36c965311f53dd9feae63ed4f8ab6de4cc449b99
Date:   Sun Sep 29 19:40:09 2019 +0200
use FastParser in linguistic

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

diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx
index f4165abcadf8..979a33ab8464 100644
--- a/linguistic/source/convdicxml.cxx
+++ b/linguistic/source/convdicxml.cxx
@@ -84,7 +84,7 @@ public:
 }
 
 // SvXMLImportContext
-virtual void Characters( const OUString  ) override;
+virtual void SAL_CALL characters( const OUString  ) override;
 virtual css::uno::Reference SAL_CALL 
createFastChildContext(
 sal_Int32 Element, const css::uno::Reference< 
css::xml::sax::XFastAttributeList > & xAttrList ) override;
 };
@@ -148,14 +148,14 @@ public:
 
 // SvXMLImportContext
 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
-virtual void Characters( const OUString  ) override;
+virtual void SAL_CALL characters( const OUString  ) override;
 
 const OUString &GetRightText() const{ return aRightText; }
 const OUString &GetLeftText() const { return 
rEntryContext.GetLeftText(); }
 };
 
 
-void ConvDicXMLImportContext::Characters(const OUString & /*rChars*/)
+void ConvDicXMLImportContext::characters(const OUString & /*rChars*/)
 {
 /*
 Whitespace occurring within the content of token elements is "trimmed"
@@ -250,7 +250,7 @@ void ConvDicXMLEntryTextContext_Impl::startFastElement(
 }
 
 
-void ConvDicXMLRightTextContext_Impl::Characters( const OUString  )
+void ConvDicXMLRightTextContext_Impl::characters( const OUString  )
 {
 aRightText += rChars;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-15 Thread Noel Grandin (via logerrit)
 linguistic/source/convdic.cxx |   14 +-
 1 file changed, 1 insertion(+), 13 deletions(-)

New commits:
commit 9dceb75ec9af78df6f683443c7f4008076412903
Author: Noel Grandin 
AuthorDate: Fri Nov 15 13:38:04 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Nov 15 20:14:44 2019 +0100

no need to construct an extra parser in ConvDicXMLImport

the SvXMLImport superclass already constructs a parser

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

diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index 1a7b559a203b..b07ea422a119 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -42,7 +42,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -93,21 +92,10 @@ static void ReadThroughDic( const OUString , 
ConvDicXMLImport 
 xml::sax::InputSource aParserInput;
 aParserInput.aInputStream = xIn;
 
-// get parser
-uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( 
xContext );
-
-//!! keep a reference until everything is done to
-//!! ensure the proper lifetime of the object
-uno::Reference < xml::sax::XDocumentHandler > xFilter(
-static_cast(), 
UNO_QUERY );
-
-// connect parser and filter
-xParser->setDocumentHandler( xFilter );
-
 // finally, parser the stream
 try
 {
-xParser->parseStream( aParserInput );   // implicitly calls 
ConvDicXMLImport::CreateContext
+rImport.parseStream( aParserInput );   // implicitly calls 
ConvDicXMLImport::CreateContext
 }
 catch( xml::sax::SAXParseException& )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-09 Thread Mike Kaganski (via logerrit)
 linguistic/source/gciterator.cxx |   90 ---
 1 file changed, 48 insertions(+), 42 deletions(-)

New commits:
commit 8e9de1ad055d1d8f41a6cf6d8cea245463f61d40
Author: Mike Kaganski 
AuthorDate: Tue Apr 9 22:23:23 2019 +0100
Commit: Mike Kaganski 
CommitDate: Wed Apr 10 00:50:53 2019 +0200

Fix double-clear of clearable mutex guard

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

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 325af32849bd..62322ae67032 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -611,57 +611,63 @@ void GrammarCheckingIterator::DequeueAndCheck()
 const bool bModified = xFlatPara->isModified();
 if (!bModified)
 {
-//  THREAD SAFE START 
-::osl::ClearableGuard< ::osl::Mutex > aGuard( 
MyMutex::get() );
-
-sal_Int32 nStartPos = aFPEntryItem.m_nStartIndex;
-sal_Int32 nSuggestedEnd = GetSuggestedEndOfSentence( 
aCurTxt, nStartPos, aCurLocale );
-DBG_ASSERT( (nSuggestedEnd == 0 && aCurTxt.isEmpty()) 
|| nSuggestedEnd > nStartPos,
-"nSuggestedEndOfSentencePos calculation 
failed?" );
-
 linguistic2::ProofreadingResult aRes;
 
-uno::Reference< linguistic2::XProofreader > xGC( 
GetGrammarChecker( aCurLocale ), uno::UNO_QUERY );
-if (xGC.is())
+//  THREAD SAFE START 
 {
-aGuard.clear();
-uno::Sequence const aProps(
-lcl_makeProperties(xFlatPara));
-aRes = xGC->doProofreading( aCurDocId, aCurTxt,
-aCurLocale, nStartPos, 
nSuggestedEnd, aProps );
-
-//!! work-around to prevent looping if the grammar 
checker
-//!! failed to properly identify the sentence end
-if (
-aRes.nBehindEndOfSentencePosition <= nStartPos 
&&
-aRes.nBehindEndOfSentencePosition != 
nSuggestedEnd
-)
+osl::ClearableMutexGuard aGuard(MyMutex::get());
+
+sal_Int32 nStartPos = aFPEntryItem.m_nStartIndex;
+sal_Int32 nSuggestedEnd
+= GetSuggestedEndOfSentence(aCurTxt, 
nStartPos, aCurLocale);
+DBG_ASSERT((nSuggestedEnd == 0 && 
aCurTxt.isEmpty())
+   || nSuggestedEnd > nStartPos,
+   "nSuggestedEndOfSentencePos calculation 
failed?");
+
+uno::Reference xGC(
+GetGrammarChecker(aCurLocale), uno::UNO_QUERY);
+if (xGC.is())
+{
+aGuard.clear();
+uno::Sequence const 
aProps(
+lcl_makeProperties(xFlatPara));
+aRes = xGC->doProofreading(aCurDocId, aCurTxt, 
aCurLocale,
+   nStartPos, 
nSuggestedEnd, aProps);
+
+//!! work-around to prevent looping if the 
grammar checker
+//!! failed to properly identify the sentence 
end
+if (aRes.nBehindEndOfSentencePosition <= 
nStartPos
+&& aRes.nBehindEndOfSentencePosition != 
nSuggestedEnd)
+{
+SAL_WARN(
+"linguistic",
+"!! Grammarchecker failed to provide 
end of sentence !!");
+aRes.nBehindEndOfSentencePosition = 
nSuggestedEnd;
+}
+
+aRes.xFlatParagraph = xFlatPara;
+aRes.nStartOfSentencePosition = nStartPos;
+}
+else
 {
-SAL_WARN( "linguistic", "!! Grammarchecker 
failed to provide end of sentence !!" );
+// no grammar checker -> no error
+// but we need to provide the data below in 
order to continue with the next sentence
+

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

2019-03-05 Thread Libreoffice Gerrit user
 linguistic/source/hyphdsp.cxx  |6 +++---
 linguistic/source/hyphdta.cxx  |2 +-
 linguistic/source/spelldsp.cxx |4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit e578e2b7855d0b474eed5b1ef6b808ba25295c06
Author: Julien Nabet 
AuthorDate: Tue Mar 5 21:36:50 2019 +0100
Commit: Julien Nabet 
CommitDate: Wed Mar 6 07:04:22 2019 +0100

Typo: unexpectend->unexpected

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

diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index b15ec9c15807..38cd240c2b76 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -299,7 +299,7 @@ Reference< XHyphenatedWord > SAL_CALL
 
 // replace typographical apostroph by ascii apostroph
 OUString aSingleQuote( GetLocaleDataWrapper( nLanguage 
).getQuotationMarkEnd() );
-DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpectend length of 
quotation mark" );
+DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpected length of 
quotation mark" );
 if (!aSingleQuote.isEmpty())
 aChkWord = aChkWord.replace( aSingleQuote[0], '\'' );
 
@@ -434,7 +434,7 @@ Reference< XHyphenatedWord > SAL_CALL
 
 // replace typographical apostroph by ascii apostroph
 OUString aSingleQuote( GetLocaleDataWrapper( nLanguage 
).getQuotationMarkEnd() );
-DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpectend length of 
quotation mark" );
+DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpected length of 
quotation mark" );
 if (!aSingleQuote.isEmpty())
 aChkWord = aChkWord.replace( aSingleQuote[0], '\'' );
 
@@ -559,7 +559,7 @@ Reference< XPossibleHyphens > SAL_CALL
 
 // replace typographical apostroph by ascii apostroph
 OUString aSingleQuote( GetLocaleDataWrapper( nLanguage 
).getQuotationMarkEnd() );
-DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpectend length of 
quotation mark" );
+DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpected length of 
quotation mark" );
 if (!aSingleQuote.isEmpty())
 aChkWord = aChkWord.replace( aSingleQuote[0], '\'' );
 
diff --git a/linguistic/source/hyphdta.cxx b/linguistic/source/hyphdta.cxx
index 278eaa0d279f..3996fc5fb994 100644
--- a/linguistic/source/hyphdta.cxx
+++ b/linguistic/source/hyphdta.cxx
@@ -49,7 +49,7 @@ HyphenatedWord::HyphenatedWord(const OUString , 
LanguageType nLang, sal_In
 nLanguage   (nLang)
 {
 OUString aSingleQuote( GetLocaleDataWrapper( nLanguage 
).getQuotationMarkEnd() );
-DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpectend length of 
quotation mark" );
+DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpected length of quotation 
mark" );
 if (!aSingleQuote.isEmpty())
 {
 // ignore typographical apostrophes (which got replaced in original
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 3103d1c7ef1c..522ee43a96e5 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -285,7 +285,7 @@ bool SpellCheckerDispatcher::isValid_Impl(
 
 // replace typographical apostroph by ascii apostroph
 OUString aSingleQuote( GetLocaleDataWrapper( nLanguage 
).getQuotationMarkEnd() );
-DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpectend length of 
quotation mark" );
+DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpected length of 
quotation mark" );
 if (!aSingleQuote.isEmpty())
 aChkWord = aChkWord.replace( aSingleQuote[0], '\'' );
 
@@ -448,7 +448,7 @@ Reference< XSpellAlternatives > 
SpellCheckerDispatcher::spell_Impl(
 
 // replace typographical apostroph by ascii apostroph
 OUString aSingleQuote( GetLocaleDataWrapper( nLanguage 
).getQuotationMarkEnd() );
-DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpectend length of 
quotation mark" );
+DBG_ASSERT( 1 == aSingleQuote.getLength(), "unexpected length of 
quotation mark" );
 if (!aSingleQuote.isEmpty())
 aChkWord = aChkWord.replace( aSingleQuote[0], '\'' );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2018-11-25 Thread Libreoffice Gerrit user
 linguistic/source/gciterator.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit d82349e3fcc87b7a9f52a009b14c5e3336a39700
Author: Mike Kaganski 
AuthorDate: Sat Nov 24 22:01:16 2018 +0300
Commit: Mike Kaganski 
CommitDate: Sun Nov 25 11:15:23 2018 +0100

tdf#120703 PVS: fix possible buffer over-read when iterating string

V560 A part of conditional expression is always true: nStartPos < nLen.

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

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 557ca5d62c06..9e1e11532080 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -167,8 +167,9 @@ static sal_Int32 lcl_SkipWhiteSpaces( const OUString 
, sal_Int32 nStartPos
 sal_Int32 nRes = nStartPos;
 if (0 <= nStartPos && nStartPos < nLen)
 {
+const sal_Unicode* const pEnd = rText.getStr() + nLen;
 const sal_Unicode *pText = rText.getStr() + nStartPos;
-while (nStartPos < nLen && lcl_IsWhiteSpace( *pText ))
+while (pText != pEnd && lcl_IsWhiteSpace(*pText))
 ++pText;
 nRes = pText - rText.getStr();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-15 Thread Libreoffice Gerrit user
 linguistic/source/lngsvcmgr.cxx |   51 +++-
 linguistic/source/lngsvcmgr.hxx |   10 +++
 2 files changed, 24 insertions(+), 37 deletions(-)

New commits:
commit 9b9f60dd3adafe2364cb9f8122b430f729f0ad1c
Author: Noel Grandin 
AuthorDate: Sat Aug 11 10:23:31 2018 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 15 10:03:52 2018 +0200

loplugin:useuniqueptr in LngSvcMgr

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

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 83668cc06dfa..d106bf586934 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -417,11 +417,6 @@ LngSvcMgr::LngSvcMgr()
 {
 bDisposing = false;
 
-pAvailSpellSvcs = nullptr;
-pAvailGrammarSvcs   = nullptr;
-pAvailHyphSvcs  = nullptr;
-pAvailThesSvcs  = nullptr;
-
 // request notify events when properties (i.e. something in the subtree) 
changes
 uno::Sequence< OUString > aNames(4);
 OUString *pNames = aNames.getArray();
@@ -464,10 +459,10 @@ void LngSvcMgr::modified(const lang::EventObject&)
 //assume that if an extension has been added/removed that
 //it might be a dictionary extension, so drop our cache
 
-clearSvcInfoArray(pAvailSpellSvcs);
-clearSvcInfoArray(pAvailGrammarSvcs);
-clearSvcInfoArray(pAvailHyphSvcs);
-clearSvcInfoArray(pAvailThesSvcs);
+pAvailSpellSvcs.reset();
+pAvailGrammarSvcs.reset();
+pAvailHyphSvcs.reset();
+pAvailThesSvcs.reset();
 }
 
 {
@@ -521,12 +516,6 @@ void LngSvcMgr::disposing(const lang::EventObject&)
 stopListening();
 }
 
-void LngSvcMgr::clearSvcInfoArray(SvcInfoArray* )
-{
-delete rpInfo;
-rpInfo = nullptr;
-}
-
 LngSvcMgr::~LngSvcMgr()
 {
 stopListening();
@@ -535,10 +524,10 @@ LngSvcMgr::~LngSvcMgr()
 // will be freed in the destructor of the respective Reference's
 // xSpellDsp, xGrammarDsp, xHyphDsp, xThesDsp
 
-clearSvcInfoArray(pAvailSpellSvcs);
-clearSvcInfoArray(pAvailGrammarSvcs);
-clearSvcInfoArray(pAvailHyphSvcs);
-clearSvcInfoArray(pAvailThesSvcs);
+pAvailSpellSvcs.reset();
+pAvailGrammarSvcs.reset();
+pAvailHyphSvcs.reset();
+pAvailThesSvcs.reset();
 }
 
 namespace
@@ -801,7 +790,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > 
 )
 osl::MutexGuard aGuard(GetLinguMutex());
 
 // delete old cached data, needs to be acquired new on demand
-clearSvcInfoArray(pAvailSpellSvcs);
+pAvailSpellSvcs.reset();
 
 if (lcl_SeqHasString( aSpellCheckerListEntries, aKeyText ))
 {
@@ -824,7 +813,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > 
 )
 osl::MutexGuard aGuard(GetLinguMutex());
 
 // delete old cached data, needs to be acquired new on demand
-clearSvcInfoArray(pAvailGrammarSvcs);
+pAvailGrammarSvcs.reset();
 
 if (lcl_SeqHasString( aGrammarCheckerListEntries, aKeyText ))
 {
@@ -850,7 +839,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > 
 )
 osl::MutexGuard aGuard(GetLinguMutex());
 
 // delete old cached data, needs to be acquired new on demand
-clearSvcInfoArray(pAvailHyphSvcs);
+pAvailHyphSvcs.reset();
 
 if (lcl_SeqHasString( aHyphenatorListEntries, aKeyText ))
 {
@@ -873,7 +862,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > 
 )
 osl::MutexGuard aGuard(GetLinguMutex());
 
 // delete old cached data, needs to be acquired new on demand
-clearSvcInfoArray(pAvailThesSvcs);
+pAvailThesSvcs.reset();
 
 if (lcl_SeqHasString( aThesaurusListEntries, aKeyText ))
 {
@@ -980,7 +969,7 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
 {
 if (!pAvailSpellSvcs)
 {
-pAvailSpellSvcs = new SvcInfoArray;
+pAvailSpellSvcs.reset(new SvcInfoArray);
 
 uno::Reference< uno::XComponentContext > xContext( 
comphelper::getProcessComponentContext() );
 
@@ -1042,7 +1031,7 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
 {
 if (!pAvailGrammarSvcs)
 {
-pAvailGrammarSvcs = new SvcInfoArray;
+pAvailGrammarSvcs.reset(new SvcInfoArray);
 
 uno::Reference< uno::XComponentContext > xContext( 
comphelper::getProcessComponentContext() );
 
@@ -1105,7 +1094,7 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
 {
 if (!pAvailHyphSvcs)
 {
-pAvailHyphSvcs = new SvcInfoArray;
+pAvailHyphSvcs.reset(new SvcInfoArray);
 uno::Reference< uno::XComponentContext > xContext( 
comphelper::getProcessComponentContext() );
 
 uno::Reference< container::XContentEnumerationAccess > xEnumAccess( 

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

2018-06-02 Thread Caolán McNamara
 linguistic/source/gciterator.cxx |   16 
 linguistic/source/gciterator.hxx |   10 +-
 2 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit be13ca094dac91545a879905a34adb5fdb23afe9
Author: Caolán McNamara 
Date:   Sat Jun 2 17:10:42 2018 +0100

mergedlibs failure with duplicate SwXStringKeyMap

just rename this one for a quick fix

Change-Id: Iae9152356640c3454a73b56f7e097d084d8eb3a0
Reviewed-on: https://gerrit.libreoffice.org/55210
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index a1bba7cbf739..d124ab1865aa 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -233,9 +233,9 @@ static lang::Locale lcl_GetPrimaryLanguageOfSentence(
 }
 
 
-SwXStringKeyMap::SwXStringKeyMap() {}
+LngXStringKeyMap::LngXStringKeyMap() {}
 
-void SAL_CALL SwXStringKeyMap::insertValue(const OUString& aKey, const 
css::uno::Any& aValue)
+void SAL_CALL LngXStringKeyMap::insertValue(const OUString& aKey, const 
css::uno::Any& aValue)
 {
 std::map::const_iterator aIter = maMap.find(aKey);
 if (aIter != maMap.end())
@@ -244,7 +244,7 @@ void SAL_CALL SwXStringKeyMap::insertValue(const OUString& 
aKey, const css::uno:
 maMap[aKey] = aValue;
 }
 
-css::uno::Any SAL_CALL SwXStringKeyMap::getValue(const OUString& aKey)
+css::uno::Any SAL_CALL LngXStringKeyMap::getValue(const OUString& aKey)
 {
 std::map::const_iterator aIter = maMap.find(aKey);
 if (aIter == maMap.end())
@@ -253,14 +253,14 @@ css::uno::Any SAL_CALL SwXStringKeyMap::getValue(const 
OUString& aKey)
 return (*aIter).second;
 }
 
-sal_Bool SAL_CALL SwXStringKeyMap::hasValue(const OUString& aKey)
+sal_Bool SAL_CALL LngXStringKeyMap::hasValue(const OUString& aKey)
 {
 return maMap.find(aKey) != maMap.end();
 }
 
-::sal_Int32 SAL_CALL SwXStringKeyMap::getCount() { return maMap.size(); }
+::sal_Int32 SAL_CALL LngXStringKeyMap::getCount() { return maMap.size(); }
 
-OUString SAL_CALL SwXStringKeyMap::getKeyByIndex(::sal_Int32 nIndex)
+OUString SAL_CALL LngXStringKeyMap::getKeyByIndex(::sal_Int32 nIndex)
 {
 if (static_cast(nIndex) >= maMap.size())
 throw css::lang::IndexOutOfBoundsException();
@@ -268,7 +268,7 @@ OUString SAL_CALL 
SwXStringKeyMap::getKeyByIndex(::sal_Int32 nIndex)
 return OUString();
 }
 
-css::uno::Any SAL_CALL SwXStringKeyMap::getValueByIndex(::sal_Int32 nIndex)
+css::uno::Any SAL_CALL LngXStringKeyMap::getValueByIndex(::sal_Int32 nIndex)
 {
 if (static_cast(nIndex) >= maMap.size())
 throw css::lang::IndexOutOfBoundsException();
@@ -428,7 +428,7 @@ void GrammarCheckingIterator::ProcessResult(
 rDesc.nType = text::TextMarkupType::PROOFREADING;
 
 uno::Reference< container::XStringKeyMap > xKeyMap(
-new SwXStringKeyMap());
+new LngXStringKeyMap());
 for( const beans::PropertyValue& rProperty : 
rError.aProperties )
 {
 if ( rProperty.Name == "LineColor" )
diff --git a/linguistic/source/gciterator.hxx b/linguistic/source/gciterator.hxx
index 9241b4136dd7..03abfa2ac450 100644
--- a/linguistic/source/gciterator.hxx
+++ b/linguistic/source/gciterator.hxx
@@ -186,10 +186,10 @@ public:
 
 /** Implementation of the css::container::XStringKeyMap interface
  */
-class SwXStringKeyMap : public 
::cppu::WeakImplHelper
+class LngXStringKeyMap : public 
::cppu::WeakImplHelper
 {
 public:
-SwXStringKeyMap();
+LngXStringKeyMap();
 
 virtual css::uno::Any SAL_CALL getValue(const OUString& aKey) override;
 virtual sal_Bool SAL_CALL hasValue(const OUString& aKey) override;
@@ -199,10 +199,10 @@ public:
 virtual css::uno::Any SAL_CALL getValueByIndex(::sal_Int32 nIndex) 
override;
 
 private:
-SwXStringKeyMap(SwXStringKeyMap&) = delete;
-void operator=(SwXStringKeyMap&) = delete;
+LngXStringKeyMap(LngXStringKeyMap&) = delete;
+void operator=(LngXStringKeyMap&) = delete;
 
-~SwXStringKeyMap() override{};
+~LngXStringKeyMap() override{};
 
 std::map maMap;
 };
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: linguistic/source offapi/com sw/source

2018-05-31 Thread Fred Kruse
 linguistic/source/gciterator.cxx  |   62 +
 linguistic/source/gciterator.hxx  |   28 +
 offapi/com/sun/star/text/TextMarkupDescriptor.idl |   10 +++
 sw/source/core/inc/wrong.hxx  |   64 +-
 4 files changed, 161 insertions(+), 3 deletions(-)

New commits:
commit 7e428cac54c0a10aa7885923b836562e8fa82235
Author: Fred Kruse 
Date:   Mon May 28 13:04:48 2018 +0200

linguistic: add functionality to change spellcheck color

This adds a way for the grammar checker extension to change color
and line type of the 'wiggly lines' LibreOffice uses to highlight
spelling or grammar errors.

Change-Id: Idd669cf362da34f8cfcdcec14f1f80df1ddb1f9e
Reviewed-on: https://gerrit.libreoffice.org/54927
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index b1dce0de8543..a1bba7cbf739 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -233,6 +233,50 @@ static lang::Locale lcl_GetPrimaryLanguageOfSentence(
 }
 
 
+SwXStringKeyMap::SwXStringKeyMap() {}
+
+void SAL_CALL SwXStringKeyMap::insertValue(const OUString& aKey, const 
css::uno::Any& aValue)
+{
+std::map::const_iterator aIter = maMap.find(aKey);
+if (aIter != maMap.end())
+throw css::container::ElementExistException();
+
+maMap[aKey] = aValue;
+}
+
+css::uno::Any SAL_CALL SwXStringKeyMap::getValue(const OUString& aKey)
+{
+std::map::const_iterator aIter = maMap.find(aKey);
+if (aIter == maMap.end())
+throw css::container::NoSuchElementException();
+
+return (*aIter).second;
+}
+
+sal_Bool SAL_CALL SwXStringKeyMap::hasValue(const OUString& aKey)
+{
+return maMap.find(aKey) != maMap.end();
+}
+
+::sal_Int32 SAL_CALL SwXStringKeyMap::getCount() { return maMap.size(); }
+
+OUString SAL_CALL SwXStringKeyMap::getKeyByIndex(::sal_Int32 nIndex)
+{
+if (static_cast(nIndex) >= maMap.size())
+throw css::lang::IndexOutOfBoundsException();
+
+return OUString();
+}
+
+css::uno::Any SAL_CALL SwXStringKeyMap::getValueByIndex(::sal_Int32 nIndex)
+{
+if (static_cast(nIndex) >= maMap.size())
+throw css::lang::IndexOutOfBoundsException();
+
+return css::uno::Any();
+}
+
+
 GrammarCheckingIterator::GrammarCheckingIterator() :
 m_bEnd( false ),
 m_aCurCheckedDocId(),
@@ -382,6 +426,24 @@ void GrammarCheckingIterator::ProcessResult(
 // differently for example. But no special handling right 
now.
 if (rDesc.nType == text::TextMarkupType::SPELLCHECK)
 rDesc.nType = text::TextMarkupType::PROOFREADING;
+
+uno::Reference< container::XStringKeyMap > xKeyMap(
+new SwXStringKeyMap());
+for( const beans::PropertyValue& rProperty : 
rError.aProperties )
+{
+if ( rProperty.Name == "LineColor" )
+{
+xKeyMap->insertValue(rProperty.Name,
+ rProperty.Value);
+rDesc.xMarkupInfoContainer = xKeyMap;
+}
+else if ( rProperty.Name == "LineType" )
+{
+xKeyMap->insertValue(rProperty.Name,
+ rProperty.Value);
+rDesc.xMarkupInfoContainer = xKeyMap;
+}
+}
 }
 
 // at pos nErrors -> sentence markup
diff --git a/linguistic/source/gciterator.hxx b/linguistic/source/gciterator.hxx
index 568a30f50150..9241b4136dd7 100644
--- a/linguistic/source/gciterator.hxx
+++ b/linguistic/source/gciterator.hxx
@@ -37,6 +37,10 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -180,6 +184,30 @@ public:
 };
 
 
+/** Implementation of the css::container::XStringKeyMap interface
+ */
+class SwXStringKeyMap : public 
::cppu::WeakImplHelper
+{
+public:
+SwXStringKeyMap();
+
+virtual css::uno::Any SAL_CALL getValue(const OUString& aKey) override;
+virtual sal_Bool SAL_CALL hasValue(const OUString& aKey) override;
+virtual void SAL_CALL insertValue(const OUString& aKey, const 
css::uno::Any& aValue) override;
+virtual ::sal_Int32 SAL_CALL getCount() override;
+virtual OUString SAL_CALL getKeyByIndex(::sal_Int32 nIndex) override;
+virtual css::uno::Any SAL_CALL getValueByIndex(::sal_Int32 nIndex) 
override;
+
+private:
+SwXStringKeyMap(SwXStringKeyMap&) = delete;
+void operator=(SwXStringKeyMap&) = delete;
+
+~SwXStringKeyMap() override{};
+
+std::map maMap;
+};
+
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/text/TextMarkupDescriptor.idl 

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

2018-04-16 Thread Michael Meeks
 linguistic/source/gciterator.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 08364d213091e47b91b5fd044c7cda7e71d2647b
Author: Michael Meeks 
Date:   Fri Apr 13 23:28:33 2018 +0100

Defer grammar checker thread creation until use.

Avoid this thread being started and stranded in the forkit.

Change-Id: Ia79cdac729a85960c2b5a83af265d67af07b74aa
Reviewed-on: https://gerrit.libreoffice.org/52980
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 0f59515dcc15..b1dce0de8543 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -241,7 +241,7 @@ GrammarCheckingIterator::GrammarCheckingIterator() :
 m_aEventListeners( MyMutex::get() ),
 m_aNotifyListeners( MyMutex::get() )
 {
-m_thread = osl_createThread( lcl_workerfunc, this );
+m_thread = nullptr;
 }
 
 
@@ -321,6 +321,8 @@ void GrammarCheckingIterator::AddEntry(
 
 // add new entry to the end of this queue
 ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
+if (!m_thread)
+m_thread = osl_createThread( lcl_workerfunc, this );
 m_aFPEntriesQueue.push_back( aNewFPEntry );
 
 // wake up the thread in order to do grammar checking
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: linguistic/source lotuswordpro/source scaddins/idl shell/inc shell/source smoketest/data ucb/source

2018-04-14 Thread Andrea Gelmini
 linguistic/source/gciterator.hxx   |2 +-
 lotuswordpro/source/filter/xfilter/xfutil.cxx  |2 +-
 scaddins/idl/com/sun/star/sheet/addin/XAnalysis.idl|2 +-
 shell/inc/iso8601_converter.hxx|6 +++---
 shell/source/win32/shlxthandler/util/iso8601_converter.cxx |4 ++--
 smoketest/data/Basic/Standard/Test_DB.xml  |2 +-
 ucb/source/cacher/cachedcontentresultset.cxx   |4 ++--
 7 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit cc7ff0c141e27090ab521073b961b5eeeb4d693e
Author: Andrea Gelmini 
Date:   Tue Apr 3 00:27:19 2018 +0200

Fix typos

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

diff --git a/linguistic/source/gciterator.hxx b/linguistic/source/gciterator.hxx
index 0d7a1855f37f..568a30f50150 100644
--- a/linguistic/source/gciterator.hxx
+++ b/linguistic/source/gciterator.hxx
@@ -57,7 +57,7 @@ struct FPEntry
 // the starting position to be checked
 sal_Int32   m_nStartIndex;
 
-// the flag to identify whether the document does automatical grammar 
checking
+// the flag to identify whether the document does automatic grammar 
checking
 boolm_bAutomatic;
 
 FPEntry()
diff --git a/lotuswordpro/source/filter/xfilter/xfutil.cxx 
b/lotuswordpro/source/filter/xfilter/xfutil.cxx
index c54662283644..c365bf5e1dec 100644
--- a/lotuswordpro/source/filter/xfilter/xfutil.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfutil.cxx
@@ -146,7 +146,7 @@ OUString   GetUnderlineName(enumXFUnderline type)
 return OUString("double-wave");
 break;
 case enumXFUnderlineSmallWave:
-return OUString("samll-wave");
+return OUString("small-wave");
 break;
 }
 return OUString();
diff --git a/scaddins/idl/com/sun/star/sheet/addin/XAnalysis.idl 
b/scaddins/idl/com/sun/star/sheet/addin/XAnalysis.idl
index 995430c69fce..24142964efb8 100644
--- a/scaddins/idl/com/sun/star/sheet/addin/XAnalysis.idl
+++ b/scaddins/idl/com/sun/star/sheet/addin/XAnalysis.idl
@@ -400,7 +400,7 @@ module addin
 double getDuration(
 [in] com::sun::star::beans::XPropertySet xOptions,
 [in] long Settlement, [in] long Maturity, [in] double 
Coupon, [in] double Yield,
-[in] long Frequncy, [in] any Base )
+[in] long Frequency, [in] any Base )
 raises( com::sun::star::lang::IllegalArgumentException );
 
 /// effect.
diff --git a/shell/inc/iso8601_converter.hxx b/shell/inc/iso8601_converter.hxx
index 570cecbef4e5..a8a0b4ed2ae2 100644
--- a/shell/inc/iso8601_converter.hxx
+++ b/shell/inc/iso8601_converter.hxx
@@ -23,15 +23,15 @@
 #include 
 
 
-/* Converts ISO 8601 conform date/time
-   represenation to the representation
+/* Converts ISO 8601 compliant date/time
+   representation to the representation
conforming to the current locale,
ignoring the milliseconds part if exists
 */
 std::wstring iso8601_date_to_local_date(const std::wstring& iso8601date);
 
 
-/* Converts ISO 8601 conform duration
+/* Converts ISO 8601 compliant duration
representation to the representation
conforming to the current locale
 */
diff --git a/shell/source/win32/shlxthandler/util/iso8601_converter.cxx 
b/shell/source/win32/shlxthandler/util/iso8601_converter.cxx
index c55d9513b67c..331a76926a5f 100644
--- a/shell/source/win32/shlxthandler/util/iso8601_converter.cxx
+++ b/shell/source/win32/shlxthandler/util/iso8601_converter.cxx
@@ -29,8 +29,8 @@
 
 #include 
 
-/* Converts ISO 8601 conform date/time
-   represenation to the representation
+/* Converts ISO 8601 compliant date/time
+   representation to the representation
conforming to the current locale
 */
 std::wstring iso8601_date_to_local_date(const std::wstring& isoDate )
diff --git a/smoketest/data/Basic/Standard/Test_DB.xml 
b/smoketest/data/Basic/Standard/Test_DB.xml
index 4572f3d337e9..d3452d141d27 100644
--- a/smoketest/data/Basic/Standard/Test_DB.xml
+++ b/smoketest/data/Basic/Standard/Test_DB.xml
@@ -32,7 +32,7 @@ Sub TestDB
 Dim sDBName as String, sTable as String, sCurrentMessage as String
 Dim nRowCount as Integer
 Dim bResult as Boolean
-Const sTestString = Automatical Test
+Const sTestString = Automatic Test
 
 On Local Error GoTo DBERROR
 
diff --git a/ucb/source/cacher/cachedcontentresultset.cxx 
b/ucb/source/cacher/cachedcontentresultset.cxx
index c7444b5d8f45..bf343123616c 100644
--- a/ucb/source/cacher/cachedcontentresultset.cxx
+++ b/ucb/source/cacher/cachedcontentresultset.cxx
@@ -1659,7 +1659,7 @@ sal_Bool SAL_CALL CachedContentResultSet
 }
 aGuard.clear();
 
-//find out whethter the original resultset contains rows or not
+//find 

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

2018-04-07 Thread Caolán McNamara
 linguistic/source/dicimp.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e3104eb246bdf623ad01fee8ba192a4926cb264c
Author: Caolán McNamara 
Date:   Fri Apr 6 21:18:57 2018 +0100

assert on empty line

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

diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index b2208a7ca876..12c82f461401 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -376,7 +376,7 @@ ErrCode DictionaryNeo::loadEntries(const OUString )
 // remaining lines - stock strings (a [==] b)
 while (pStream->ReadLine(aLine))
 {
-if (aLine[0] == '#') // skip comments
+if (aLine.isEmpty() || aLine[0] == '#') // skip comments
 continue;
 OUString aText = OStringToOUString(aLine, RTL_TEXTENCODING_UTF8);
 uno::Reference< XDictionaryEntry > xEntry =
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-12 Thread Stephan Bergmann
 linguistic/source/convdiclist.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 00f6c248d40f708bffe2f74cc14cd4c3da5c78d3
Author: Stephan Bergmann 
Date:   Mon Mar 12 09:01:18 2018 +0100

loplugin:redundantfcast

Change-Id: I078d226b0cdec46ce1b5e36379cc9144fd865aa2

diff --git a/linguistic/source/convdiclist.cxx 
b/linguistic/source/convdiclist.cxx
index ca57f4aa373d..26c9fca36f92 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -170,7 +170,7 @@ uno::Reference< XConversionDictionary > 
ConvDicNameContainer::GetByName(
 uno::Type SAL_CALL ConvDicNameContainer::getElementType(  )
 {
 MutexGuard  aGuard( GetLinguMutex() );
-return uno::Type( cppu::UnoType::get());
+return cppu::UnoType::get();
 }
 
 sal_Bool SAL_CALL ConvDicNameContainer::hasElements(  )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-01-28 Thread Noel Grandin
 linguistic/source/spelldsp.cxx |   13 +
 linguistic/source/spelldsp.hxx |6 +++---
 2 files changed, 8 insertions(+), 11 deletions(-)

New commits:
commit 97b5bf4a39f33a3e51f1aa72339a5e88d1b9e9f3
Author: Noel Grandin 
Date:   Tue Jan 23 16:48:17 2018 +0200

loplugin:useuniqueptr in SpellCheckerDispatcher

the call to ClearSvcList() was also unnecessary, the map will get
cleared by the destructor anyway

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

diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 49009b70c3d5..6cd6c8003233 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -185,9 +185,6 @@ SpellCheckerDispatcher::SpellCheckerDispatcher( LngSvcMgr 
 ) :
 
 SpellCheckerDispatcher::~SpellCheckerDispatcher()
 {
-ClearSvcList();
-delete m_pCache;
-delete m_pCharClass;
 }
 
 
@@ -422,9 +419,9 @@ bool SpellCheckerDispatcher::isValid_Impl(
 bRes = !xTmp->isNegative();
 } else {
 setCharClass(LanguageTag(nLanguage));
-CapType ct = capitalType(aChkWord, m_pCharClass);
+CapType ct = capitalType(aChkWord, m_pCharClass.get());
 if (ct == CapType::INITCAP || ct == CapType::ALLCAP) {
-Reference< XDictionaryEntry > xTmp2( 
lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass), nLanguage 
) );
+Reference< XDictionaryEntry > xTmp2( 
lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass.get()), 
nLanguage ) );
 if (xTmp2.is()) {
 bRes = !xTmp2->isNegative();
 }
@@ -663,10 +660,10 @@ Reference< XSpellAlternatives > 
SpellCheckerDispatcher::spell_Impl(
 else
 {
 setCharClass(LanguageTag(nLanguage));
-CapType ct = capitalType(aChkWord, m_pCharClass);
+CapType ct = capitalType(aChkWord, m_pCharClass.get());
 if (ct == CapType::INITCAP || ct == CapType::ALLCAP)
 {
-Reference< XDictionaryEntry > xTmp2( 
lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass), nLanguage 
) );
+Reference< XDictionaryEntry > xTmp2( 
lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass.get()), 
nLanguage ) );
 if (xTmp2.is())
 {
 if (xTmp2->isNegative())// negative entry found
@@ -842,7 +839,7 @@ void SpellCheckerDispatcher::FlushSpellCache()
 void SpellCheckerDispatcher::setCharClass(const LanguageTag& rLanguageTag)
 {
 if (!m_pCharClass)
-m_pCharClass = new CharClass(rLanguageTag);
+m_pCharClass.reset( new CharClass(rLanguageTag) );
 m_pCharClass->setLanguageTag(rLanguageTag);
 }
 
diff --git a/linguistic/source/spelldsp.hxx b/linguistic/source/spelldsp.hxx
index 9d165dd87347..d84d11a4513a 100644
--- a/linguistic/source/spelldsp.hxx
+++ b/linguistic/source/spelldsp.hxx
@@ -58,8 +58,8 @@ class SpellCheckerDispatcher :
 css::uno::Reference< css::linguistic2::XSearchableDictionaryList >  
m_xDicList;
 
 LngSvcMgr   _rMgr;
-mutable linguistic::SpellCache  *m_pCache; // Spell Cache (holds known 
words)
-CharClass   *m_pCharClass;
+mutable std::unique_ptr m_pCache; // Spell Cache 
(holds known words)
+std::unique_ptr   m_pCharClass;
 
 SpellCheckerDispatcher(const SpellCheckerDispatcher &) = delete;
 SpellCheckerDispatcher & operator = (const SpellCheckerDispatcher &) = 
delete;
@@ -120,7 +120,7 @@ private:
 inline linguistic::SpellCache & SpellCheckerDispatcher::GetCache() const
 {
 if (!m_pCache)
-m_pCache = new linguistic::SpellCache();
+m_pCache.reset(new linguistic::SpellCache());
 return *m_pCache;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-01-04 Thread László Németh
 linguistic/source/dicimp.cxx   |   38 --
 linguistic/source/dicimp.hxx   |2 +-
 linguistic/source/dlistimp.cxx |   11 ++-
 3 files changed, 43 insertions(+), 8 deletions(-)

New commits:
commit c8fbce439db78dd85295833df494a651bd64dcd4
Author: László Németh 
Date:   Thu Jan 4 12:18:28 2018 +0100

Add optional title: field to user dictionaries

LibreOffice stores the title of an user dictionary
only in its file name, but special characters in
file names can result configuration problem for user
dictionaries shipped with LibreOffice.

Optional "title:" field of user dictionaries
supports custom titles with spaces and other UTF-8
characters.

Change-Id: Idbc4c41a2e08f50cfc0fc0d25e960084f5773bec
Reviewed-on: https://gerrit.libreoffice.org/47397
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 911735ce3815..42147866991c 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -63,8 +63,26 @@ using namespace linguistic;
 #define MAX_HEADER_LENGTH 16
 
 // XML-header to query SPELLML support
+// to handle user words with "Grammar By" model words
 #define SPELLML_SUPPORT ""
 
+// User dictionaries can contain optional "title:" tags
+// to support custom titles with space and other characters.
+// (old mechanism stores the title of the user dictionary
+// only in its file name, but special characters are
+// problem for user dictionaries shipped with LibreOffice).
+//
+// The following fake file name extension will be
+// added to the text of the title: field for correct
+// text stripping and dictionary saving.
+//
+// TODO: add translation support?
+//   tdf#50827 language dependent wordlists are already in
+//   the appropriate dict packages.
+//   Note: Also name of the special run-time dictionary
+//   "IgnoreAllList" hasn't been localized yet.
+#define EXTENSION_FOR_TITLE_TEXT "."
+
 static const sal_Char* const pVerStr2= "WBSWG2";
 static const sal_Char* const pVerStr5= "WBSWG5";
 static const sal_Char* const pVerStr6= "WBSWG6";
@@ -96,7 +114,7 @@ static bool getTag(const OString , const sal_Char 
*pTagName,
 }
 
 
-sal_Int16 ReadDicVersion( SvStreamPtr const , LanguageType , 
bool  )
+sal_Int16 ReadDicVersion( SvStreamPtr const , LanguageType , 
bool , OUString  )
 {
 // Sniff the header
 sal_Int16 nDicVersion = DIC_VERSION_DONTKNOW;
@@ -146,6 +164,16 @@ sal_Int16 ReadDicVersion( SvStreamPtr const , 
LanguageType , bool
 bNeg = aTagValue == "negative";
 }
 
+// lang: title
+if (getTag(aLine, "title: ", aTagValue))
+{
+aDicName = OStringToOUString( aTagValue, 
RTL_TEXTENCODING_UTF8) +
+// recent title text preparation in GetDicInfoStr() waits 
for an
+// extension, so we add it to avoid bad stripping at final 
dot
+// of the title text
+EXTENSION_FOR_TITLE_TEXT;
+}
+
 if (aLine.indexOf("---") != -1) // end of header
 break;
 }
@@ -274,7 +302,7 @@ ErrCode DictionaryNeo::loadEntries(const OUString )
 // read header
 bool bNegativ;
 LanguageType nLang;
-nDicVersion = ReadDicVersion(pStream, nLang, bNegativ);
+nDicVersion = ReadDicVersion(pStream, nLang, bNegativ, aDicName);
 ErrCode nErr = pStream->GetError();
 if (nErr != ERRCODE_NONE)
 return nErr;
@@ -429,6 +457,12 @@ ErrCode DictionaryNeo::saveEntries(const OUString )
 pStream->WriteLine(OString("type: positive"));
 else
 pStream->WriteLine(OString("type: negative"));
+if (aDicName.endsWith(EXTENSION_FOR_TITLE_TEXT))
+{
+pStream->WriteLine(OUStringToOString("title: " +
+// strip EXTENSION_FOR_TITLE_TEXT
+aDicName.copy(0, aDicName.lastIndexOf(EXTENSION_FOR_TITLE_TEXT)), 
eEnc));
+}
 if (ERRCODE_NONE != (nErr = pStream->GetError()))
 return nErr;
 pStream->WriteLine(OString("---"));
diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx
index 6833d3f94235..99560ff8898a 100644
--- a/linguistic/source/dicimp.hxx
+++ b/linguistic/source/dicimp.hxx
@@ -34,7 +34,7 @@
 
 #define DIC_MAX_ENTRIES 3
 
-sal_Int16 ReadDicVersion( SvStreamPtr const , LanguageType , 
bool  );
+sal_Int16 ReadDicVersion( SvStreamPtr const , LanguageType , 
bool , OUString  );
 
 class DictionaryNeo :
 public ::cppu::WeakImplHelper
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index b2a63d6e9480..cdace82de2c6 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -52,7 +52,7 @@ using namespace com::sun::star::linguistic2;
 using namespace linguistic;
 
 
-static bool 

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

2017-02-20 Thread Khaled Hosny
 linguistic/source/spelldsp.cxx |   72 -
 linguistic/source/spelldsp.hxx |   26 +++---
 2 files changed, 49 insertions(+), 49 deletions(-)

New commits:
commit 2759a1260db7f8642e085dd117a0c05215f52bdf
Author: Khaled Hosny 
Date:   Mon Feb 20 11:26:34 2017 +0200

Prefix members

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

diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 484dc1e..faf31bf 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -175,18 +175,18 @@ bool SvcListHasLanguage(
 }
 
 SpellCheckerDispatcher::SpellCheckerDispatcher( LngSvcMgr  ) :
-rMgr(rLngSvcMgr)
+m_rMgr(rLngSvcMgr)
 {
-pCache = nullptr;
-pCharClass = nullptr;
+m_pCache = nullptr;
+m_pCharClass = nullptr;
 }
 
 
 SpellCheckerDispatcher::~SpellCheckerDispatcher()
 {
 ClearSvcList();
-delete pCache;
-delete pCharClass;
+delete m_pCache;
+delete m_pCharClass;
 }
 
 
@@ -194,7 +194,7 @@ void SpellCheckerDispatcher::ClearSvcList()
 {
 // release memory for each table entry
 SpellSvcByLangMap_t aTmp;
-aSvcMap.swap( aTmp );
+m_aSvcMap.swap( aTmp );
 }
 
 
@@ -202,10 +202,10 @@ Sequence< Locale > SAL_CALL 
SpellCheckerDispatcher::getLocales()
 {
 MutexGuard  aGuard( GetLinguMutex() );
 
-Sequence< Locale > aLocales( static_cast< sal_Int32 >(aSvcMap.size()) );
+Sequence< Locale > aLocales( static_cast< sal_Int32 >(m_aSvcMap.size()) );
 Locale *pLocales = aLocales.getArray();
 SpellSvcByLangMap_t::const_iterator aIt;
-for (aIt = aSvcMap.begin();  aIt != aSvcMap.end();  ++aIt)
+for (aIt = m_aSvcMap.begin();  aIt != m_aSvcMap.end();  ++aIt)
 {
 *pLocales++ = LanguageTag::convertToLocale( aIt->first );
 }
@@ -216,8 +216,8 @@ Sequence< Locale > SAL_CALL 
SpellCheckerDispatcher::getLocales()
 sal_Bool SAL_CALL SpellCheckerDispatcher::hasLocale( const Locale& rLocale )
 {
 MutexGuard  aGuard( GetLinguMutex() );
-SpellSvcByLangMap_t::const_iterator aIt( aSvcMap.find( 
LinguLocaleToLanguage( rLocale ) ) );
-return aIt != aSvcMap.end();
+SpellSvcByLangMap_t::const_iterator aIt( m_aSvcMap.find( 
LinguLocaleToLanguage( rLocale ) ) );
+return aIt != m_aSvcMap.end();
 }
 
 
@@ -286,8 +286,8 @@ bool SpellCheckerDispatcher::isValid_Impl(
 return bRes;
 
 // search for entry with that language
-SpellSvcByLangMap_t::iteratoraIt( aSvcMap.find( nLanguage ) );
-LangSvcEntries_Spell*pEntry = aIt != aSvcMap.end() ? aIt->second.get() 
: nullptr;
+SpellSvcByLangMap_t::iteratoraIt( m_aSvcMap.find( nLanguage ) );
+LangSvcEntries_Spell*pEntry = aIt != m_aSvcMap.end() ? 
aIt->second.get() : nullptr;
 
 if (pEntry)
 {
@@ -379,7 +379,7 @@ bool SpellCheckerDispatcher::isValid_Impl(
 Reference< XLinguServiceEventBroadcaster >
 xBroadcaster( xSpell, UNO_QUERY );
 if (xBroadcaster.is())
-rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
+m_rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
 
 bTmpResValid = true;
 if (xSpell.is()  &&  xSpell->hasLocale( aLocale ))
@@ -409,7 +409,7 @@ bool SpellCheckerDispatcher::isValid_Impl(
 if (i == nLen)
 {
 if (!SvcListHasLanguage( *pEntry, nLanguage ))
-aSvcMap.erase( nLanguage );
+m_aSvcMap.erase( nLanguage );
 }
 }
 
@@ -421,9 +421,9 @@ bool SpellCheckerDispatcher::isValid_Impl(
 bRes = !xTmp->isNegative();
 } else {
 setCharClass(LanguageTag(nLanguage));
-CapType ct = capitalType(aChkWord, pCharClass);
+CapType ct = capitalType(aChkWord, m_pCharClass);
 if (ct == CapType::INITCAP || ct == CapType::ALLCAP) {
-Reference< XDictionaryEntry > xTmp2( 
lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, pCharClass), nLanguage ) 
);
+Reference< XDictionaryEntry > xTmp2( 
lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass), nLanguage 
) );
 if (xTmp2.is()) {
 bRes = !xTmp2->isNegative();
 }
@@ -449,8 +449,8 @@ Reference< XSpellAlternatives > 
SpellCheckerDispatcher::spell_Impl(
 return xRes;
 
 // search for entry with that language
-SpellSvcByLangMap_t::iteratoraIt( aSvcMap.find( nLanguage ) );
-LangSvcEntries_Spell*pEntry = aIt != aSvcMap.end() ? aIt->second.get() 
: nullptr;
+SpellSvcByLangMap_t::iteratoraIt( m_aSvcMap.find( nLanguage ) );
+LangSvcEntries_Spell*pEntry = aIt != 

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

2017-01-03 Thread Muhammet Kara
 linguistic/source/misc.cxx |   13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

New commits:
commit 80e6671cacbe1785948de0311be972f897e962d9
Author: Muhammet Kara 
Date:   Wed Dec 28 16:07:48 2016 +0300

tdf#43157 Cleanup DBG_ASSERT in misc.cxx

Change-Id: I92faaf758e08776b731411c964f168c6ced253bc
Reviewed-on: https://gerrit.libreoffice.org/32474
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 37f20fb..6fe170c 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -18,7 +18,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -149,9 +148,9 @@ IntArray2D::~IntArray2D()
 
 sal_Int32 & IntArray2D::Value( int i, int k  )
 {
-DBG_ASSERT( 0 <= i && i < n1, "first index out of range" );
-DBG_ASSERT( 0 <= k && k < n2, "first index out of range" );
-DBG_ASSERT( i * n2 + k < n1 * n2, "index out of range" );
+assert( (0 <= i && i < n1) && "first index out of range" );
+assert( (0 <= k && k < n2) && "second index out of range" );
+assert( (i * n2 + k < n1 * n2) && "index out of range" );
 return pData[ i * n2 + k ];
 }
 
@@ -299,8 +298,8 @@ uno::Reference< XDictionaryEntry > SearchDicList(
 if ( axDic.is() && axDic->isActive()
 && (nLang == nLanguage  ||  LinguIsUnspecified( nLang)) )
 {
-DBG_ASSERT( eType != DictionaryType_MIXED,
-"lng : unexpected dictionary type" );
+// DictionaryType_MIXED is deprecated
+SAL_WARN_IF(eType == DictionaryType_MIXED, "linguistic", 
"unexpected dictionary type");
 
 if (   (!bSearchPosDics  &&  eType == DictionaryType_NEGATIVE)
 || ( bSearchPosDics  &&  eType == DictionaryType_POSITIVE))
@@ -477,7 +476,7 @@ static bool GetAltSpelling( sal_Int16 , sal_Int16 
, OUString &
 
 rnChgPos = sal::static_int_cast< sal_Int16 >(nPosL);
 rnChgLen = sal::static_int_cast< sal_Int16 >(nAltPosR - nPosL);
-DBG_ASSERT( rnChgLen >= 0, "nChgLen < 0");
+assert( rnChgLen >= 0 && "nChgLen < 0");
 
 sal_Int32 nTxtStart = nPosL;
 sal_Int32 nTxtLen   = nAltPosR - nPosL + 1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-11-29 Thread Stephan Bergmann
 linguistic/source/lngsvcmgr.cxx |   24 +++-
 1 file changed, 15 insertions(+), 9 deletions(-)

New commits:
commit f108d9f088127050c641b1dd119d54179f4371e3
Author: Stephan Bergmann 
Date:   Tue Nov 29 11:29:19 2016 +0100

Idle::Start must be called with SolarMutex locked

...as asserted now since c00d8271ba443c4f0acf657c226eea4824597f95 "vcl: 
assert
solar mutex is held for various timer / scheduler ops."  Caused that assert 
to
fire when adding an extension via "Tools - Extension Manager... Add".

Change-Id: I86eeb2c4a83c3dff98ba9012c068af91e7932df6

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 20ea193..9ac9656 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -29,6 +29,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -479,17 +480,22 @@ LngSvcMgr::LngSvcMgr()
 void LngSvcMgr::modified(const lang::EventObject&)
 throw(uno::RuntimeException, std::exception)
 {
-osl::MutexGuard aGuard(GetLinguMutex());
-//assume that if an extension has been added/removed that
-//it might be a dictionary extension, so drop our cache
+{
+osl::MutexGuard aGuard(GetLinguMutex());
+//assume that if an extension has been added/removed that
+//it might be a dictionary extension, so drop our cache
 
-clearSvcInfoArray(pAvailSpellSvcs);
-clearSvcInfoArray(pAvailGrammarSvcs);
-clearSvcInfoArray(pAvailHyphSvcs);
-clearSvcInfoArray(pAvailThesSvcs);
+clearSvcInfoArray(pAvailSpellSvcs);
+clearSvcInfoArray(pAvailGrammarSvcs);
+clearSvcInfoArray(pAvailHyphSvcs);
+clearSvcInfoArray(pAvailThesSvcs);
+}
 
-//schedule in an update to execute in the main thread
-aUpdateIdle.Start();
+{
+SolarMutexGuard aGuard;
+//schedule in an update to execute in the main thread
+aUpdateIdle.Start();
+}
 }
 
 //run update, and inform everyone that dictionaries (may) have changed, this
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-09-29 Thread Stephan Bergmann
 linguistic/source/dicimp.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a8f206d9e888c5339bd5f98961c1a460dab5504d
Author: Stephan Bergmann 
Date:   Thu Sep 29 18:44:46 2016 +0200

loplugin:literaltoboolconversion

Change-Id: I99859433f3e3541c8e44248e4a29ef2c5fb24845

diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index b588be1..3e7ff05 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -387,7 +387,7 @@ sal_uLong DictionaryNeo::saveEntries(const OUString )
 }
 catch (const uno::Exception &)
 {
-DBG_ASSERT( 0, "failed to get input stream" );
+DBG_ASSERT( false, "failed to get input stream" );
 }
 if (!xStream.is())
 return static_cast< sal_uLong >(-1);
@@ -445,7 +445,7 @@ sal_uLong DictionaryNeo::saveEntries(const OUString )
 }
 catch (const uno::Exception &)
 {
-DBG_ASSERT( 0, "failed to write stream" );
+DBG_ASSERT( false, "failed to write stream" );
 return static_cast< sal_uLong >(-1);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-09-29 Thread Caolán McNamara
 linguistic/source/dicimp.cxx |   97 +--
 1 file changed, 30 insertions(+), 67 deletions(-)

New commits:
commit a8f32f34b68d9368db5371c0889e7b5955b5a10f
Author: Caolán McNamara 
Date:   Thu Sep 29 16:49:06 2016 +0100

Resolves: tdf#67555 writeFile honors ntfs symlinks as it turns out

and correctly truncates the file without replacing it by a delete
+ recreate.

So we can drop the custom temp directory+move code of

fdo#42122 - truncate files that shrink to avoid dictionary corruption

This reverts commit 28300209604ee1bb8e5050322b29e95a07f679d8.

and so don't need

fdo#66420: fix user dictionaries on Windows

This reverts commit d68de5195605bd9236851e0714dd9b03b0f5f3be.

Change-Id: I7f2010f4113f78cd0667632253b56055d189cbff

diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index eac5646..b588be1 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -368,61 +369,6 @@ static OString formatForSave(const uno::Reference< 
XDictionaryEntry > ,
return aStr.makeStringAndClear();
 }
 
-struct TmpDictionary
-{
-OUString maURL, maTmpURL;
-uno::Reference< ucb::XSimpleFileAccess3 > mxAccess;
-
-void cleanTmpFile()
-{
-try
-{
-if (mxAccess.is())
-{
-mxAccess->kill(maTmpURL);
-}
-}
-catch (const uno::Exception &) { }
-}
-explicit TmpDictionary(const OUString )
-: maURL( rURL )
-{
-maTmpURL = maURL + ".tmp";
-}
-~TmpDictionary()
-{
-cleanTmpFile();
-}
-
-uno::Reference< io::XStream > openTmpFile()
-{
-uno::Reference< io::XStream > xStream;
-
-try
-{
-mxAccess = ucb::SimpleFileAccess::create(
-comphelper::getProcessComponentContext());
-xStream = mxAccess->openFileReadWrite(maTmpURL);
-} catch (const uno::Exception &) { }
-
-return xStream;
-}
-
-sal_uLong renameTmpToURL()
-{
-try
-{
-mxAccess->move(maTmpURL, maURL);
-}
-catch (const uno::Exception &)
-{
-SAL_WARN( "linguistic", "failed to overwrite dict" );
-return static_cast< sal_uLong >(-1);
-}
-return 0;
-}
-};
-
 sal_uLong DictionaryNeo::saveEntries(const OUString )
 {
 MutexGuard aGuard( GetLinguMutex() );
@@ -431,16 +377,23 @@ sal_uLong DictionaryNeo::saveEntries(const OUString )
 return 0;
 DBG_ASSERT(!INetURLObject( rURL ).HasError(), "lng : invalid URL");
 
-// lifecycle manage the .tmp file
-TmpDictionary aTmpDictionary(rURL);
-uno::Reference< io::XStream > xStream = aTmpDictionary.openTmpFile();
+uno::Reference< uno::XComponentContext > xContext( 
comphelper::getProcessComponentContext() );
 
+// get XOutputStream stream
+uno::Reference xStream;
+try
+{
+xStream = io::TempFile::create(xContext);
+}
+catch (const uno::Exception &)
+{
+DBG_ASSERT( 0, "failed to get input stream" );
+}
 if (!xStream.is())
 return static_cast< sal_uLong >(-1);
 
 SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( 
xStream ) );
 
-
 // Always write as the latest version, i.e. DIC_VERSION_7
 
 rtl_TextEncoding eEnc = RTL_TEXTENCODING_UTF8;
@@ -475,16 +428,26 @@ sal_uLong DictionaryNeo::saveEntries(const OUString )
 OString aOutStr = formatForSave(aEntrie, eEnc);
 pStream->WriteLine (aOutStr);
 if (0 != (nErr = pStream->GetError()))
-break;
+return nErr;
 }
 
-pStream.reset(); // fdo#66420 close streams so Win32 can move the file
-xStream.clear();
-nErr = aTmpDictionary.renameTmpToURL();
-
-//If we are migrating from an older version, then on first successful
-//write, we're now converted to the latest version, i.e. DIC_VERSION_7
-nDicVersion = DIC_VERSION_7;
+try
+{
+pStream.reset();
+uno::Reference< ucb::XSimpleFileAccess3 > 
xAccess(ucb::SimpleFileAccess::create(xContext));
+Reference xInputStream(xStream, UNO_QUERY_THROW);
+uno::Reference xSeek(xInputStream, UNO_QUERY_THROW);
+xSeek->seek(0);
+xAccess->writeFile(rURL, xInputStream);
+//If we are migrating from an older version, then on first successful
+//write, we're now converted to the latest version, i.e. DIC_VERSION_7
+nDicVersion = DIC_VERSION_7;
+}
+catch (const uno::Exception &)
+{
+DBG_ASSERT( 0, "failed to write stream" );
+return static_cast< sal_uLong >(-1);
+}
 
 return nErr;
 }
___
Libreoffice-commits mailing list

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

2016-08-30 Thread Eike Rathke
 linguistic/source/misc.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 1fe51b19829d1393f0e376ec65b889b61d1b1ba1
Author: Eike Rathke 
Date:   Tue Aug 30 21:53:21 2016 +0200

construct only when needed

Change-Id: I5729e80bdaf726c64edf3d50f7225b2181f6e2c9

diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 160af548..353d2de 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -72,10 +72,8 @@ LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang )
 {
 static LocaleDataWrapper aLclDtaWrp( SvtSysLocale().GetLanguageTag() );
 
-const LanguageTag  = aLclDtaWrp.getLoadedLanguageTag();
-LanguageTag aLcl( nLang );
-if (aLcl != rLcl)
-aLclDtaWrp.setLanguageTag( aLcl );
+if (nLang != aLclDtaWrp.getLoadedLanguageTag().getLanguageType())
+aLclDtaWrp.setLanguageTag( LanguageTag( nLang ) );
 return aLclDtaWrp;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-08-30 Thread Eike Rathke
 linguistic/source/lngsvcmgr.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 424d48d347c317fa1a542d65e68327aea08cb1ed
Author: Eike Rathke 
Date:   Tue Aug 30 21:31:04 2016 +0200

calling set::find() before set::insert() is unwise

... because the insert() fails anyway if the key exists already and
adding a find() only is a performance penalty.

Change-Id: I38da75754fb23b9db3b59e5a0bd81e5e5bb05ce2

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 566d6c4..8f45622 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -114,9 +114,8 @@ static uno::Sequence< lang::Locale > GetAvailLocales(
 const lang::Locale *pLoc = aLoc.getConstArray();
 LanguageType nLang = LinguLocaleToLanguage( pLoc[k] );
 
-// language not already added?
-if (aLanguages.find( nLang ) == aLanguages.end())
-aLanguages.insert( nLang );
+// It's a set, so insertion fails if language was already 
added.
+aLanguages.insert( nLang );
 }
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-08-30 Thread Eike Rathke
 linguistic/source/lngsvcmgr.cxx |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 628bb5ce3c9774e9b499aad81bae300ef023b25c
Author: Eike Rathke 
Date:   Tue Aug 30 21:23:06 2016 +0200

pass the already available bcp47 string instead of yet another conversion

Change-Id: I6ed8428b28300cdd0586d505211e45d76a622115

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index aefcdde..566d6c4 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -580,20 +580,18 @@ namespace
 Sequence< OUString > lcl_GetLastFoundSvcs(
 SvtLinguConfig ,
 const OUString  ,
-const Locale  )
+const OUString& rCfgLocaleStr )
 {
 Sequence< OUString > aRes;
 
-OUString aCfgLocaleStr( LanguageTag::convertToBcp47( rAvailLocale ) );
-
 Sequence< OUString > aNodeNames( rCfg.GetNodeNames(rLastFoundList) );
-bool bFound = lcl_FindEntry( aCfgLocaleStr, aNodeNames);
+bool bFound = lcl_FindEntry( rCfgLocaleStr, aNodeNames);
 
 if (bFound)
 {
 Sequence< OUString > aNames(1);
 OUString  = aNames.getArray()[0];
-rNodeName = rLastFoundList + "/" + aCfgLocaleStr;
+rNodeName = rLastFoundList + "/" + rCfgLocaleStr;
 Sequence< Any > aValues( rCfg.GetProperties( aNames ) );
 if (aValues.getLength())
 {
@@ -741,7 +739,7 @@ void LngSvcMgr::UpdateAll()
 aLastFoundSvcs[k][ aCfgLocaleStr ] = aAvailSvcs;
 
 Sequence< OUString > aLastSvcs(
-lcl_GetLastFoundSvcs( aCfg, aLastFoundList , 
pAvailLocale[i] ));
+lcl_GetLastFoundSvcs( aCfg, aLastFoundList , aCfgLocaleStr 
));
 Sequence< OUString > aNewSvcs =
 lcl_GetNewEntries( aLastSvcs, aAvailSvcs );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-08-30 Thread Eike Rathke
 linguistic/source/convdicxml.cxx |2 +-
 linguistic/source/dicimp.cxx |2 +-
 linguistic/source/gciterator.cxx |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 9a2d6e7e77a660560af9d5b1bbe3a5171176f8d6
Author: Eike Rathke 
Date:   Tue Aug 30 20:45:36 2016 +0200

Related: tdf#83376 fallback to known in linguistic context is wrong, always.

Change-Id: I2f06818e6569fd7e59b94d11b69808a2b81490d5

diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx
index 039067a..b4ccd20 100644
--- a/linguistic/source/convdicxml.cxx
+++ b/linguistic/source/convdicxml.cxx
@@ -212,7 +212,7 @@ void ConvDicXMLDictionaryContext_Impl::StartElement(
 OUString aValue = rxAttrList->getValueByIndex(i);
 
 if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "lang" )
-nLanguage = LanguageTag::convertToLanguageTypeWithFallback( aValue 
);
+nLanguage = LanguageTag::convertToLanguageType( aValue );
 else if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == 
"conversion-type" )
 nConversionType = GetConversionTypeFromText( aValue );
 }
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index a6d3127..0b9fdce 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -122,7 +122,7 @@ sal_Int16 ReadDicVersion( SvStreamPtr , sal_uInt16 
, bool  )
 if (aTagValue == "")
 nLng = LANGUAGE_NONE;
 else
-nLng = LanguageTag::convertToLanguageTypeWithFallback(
+nLng = LanguageTag::convertToLanguageType(
 OStringToOUString( aTagValue, 
RTL_TEXTENCODING_ASCII_US));
 }
 
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index e076fa6..f3553c4 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -1042,7 +1042,7 @@ void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl()
 {
 // only the first entry is used, there should be only one 
grammar checker per language
 const OUString aImplName( aImplNames[0] );
-const LanguageType nLang = 
LanguageTag::convertToLanguageTypeWithFallback( pElementNames[i] );
+const LanguageType nLang = 
LanguageTag::convertToLanguageType( pElementNames[i] );
 aTmpGCImplNamesByLang[ nLang ] = aImplName;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-08-30 Thread Eike Rathke
 linguistic/source/lngsvcmgr.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 04311182b6fadcbdeef7aec15c7eea0240ee628c
Author: Eike Rathke 
Date:   Tue Aug 30 20:23:02 2016 +0200

Resolves: tdf#83376 do not let linguistic tools fall back to known languages

Falling back to known locales was necessary before the new language tag
implementation that can register "unknown" tags on the fly. In fact here we
want to handle tags unknown to us and not fall back to worst case en-US 
even,
so that dictionaries, grammar checkers, thesauri et al for any language tag 
can
be used with such tagged document content.

Change-Id: I06e54f41e00e69779b4c0cbbc891f250545a17d2

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 10a1eeb..aefcdde 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -839,7 +839,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > 
 )
 
 LanguageType nLang = LANGUAGE_NONE;
 if (!aKeyText.isEmpty())
-nLang = LanguageTag::convertToLanguageTypeWithFallback( 
aKeyText );
+nLang = LanguageTag::convertToLanguageType( aKeyText );
 
 GetSpellCheckerDsp_Impl( false ); // don't set service 
list, it will be done below
 pSpellDsp->SetServiceList( 
LanguageTag::convertToLocale(nLang), aSvcImplNames );
@@ -862,7 +862,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > 
 )
 
 LanguageType nLang = LANGUAGE_NONE;
 if (!aKeyText.isEmpty())
-nLang = LanguageTag::convertToLanguageTypeWithFallback( 
aKeyText );
+nLang = LanguageTag::convertToLanguageType( aKeyText );
 
 if (SvtLinguConfig().HasGrammarChecker())
 {
@@ -888,7 +888,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > 
 )
 
 LanguageType nLang = LANGUAGE_NONE;
 if (!aKeyText.isEmpty())
-nLang = LanguageTag::convertToLanguageTypeWithFallback( 
aKeyText );
+nLang = LanguageTag::convertToLanguageType( aKeyText );
 
 GetHyphenatorDsp_Impl( false );   // don't set service list, 
it will be done below
 pHyphDsp->SetServiceList( LanguageTag::convertToLocale(nLang), 
aSvcImplNames );
@@ -911,7 +911,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > 
 )
 
 LanguageType nLang = LANGUAGE_NONE;
 if (!aKeyText.isEmpty())
-nLang = LanguageTag::convertToLanguageTypeWithFallback( 
aKeyText );
+nLang = LanguageTag::convertToLanguageType( aKeyText );
 
 GetThesaurusDsp_Impl( false );  // don't set service list, it 
will be done below
 pThesDsp->SetServiceList( LanguageTag::convertToLocale(nLang), 
aSvcImplNames );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-08-30 Thread Eike Rathke
 linguistic/source/lngsvcmgr.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 3e289cf10b36f423ae6626296d739291850aa53b
Author: Eike Rathke 
Date:   Tue Aug 30 17:34:54 2016 +0200

use static LanguageTag::convertTo...() instead of LanguageTag().get...()

They know best when a temporary LanguageTag instance is needed and when
not.

Change-Id: Ia0dc5b2d165b15362080d60dbb9f58cfa0403014

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 3f5dbff..10a1eeb 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -715,7 +715,7 @@ void LngSvcMgr::UpdateAll()
 const OUString *pNodeName = aNodeNames.getConstArray();
 for (i = 0;  i < nNodeNames;  ++i)
 {
-Locale aLocale( (LanguageTag(pNodeName[i])).getLocale() );
+Locale aLocale( LanguageTag::convertToLocale( pNodeName[i]));
 Sequence< OUString > aCfgSvcs( getConfiguredServices( aService, 
aLocale ));
 Sequence< OUString > aAvailSvcs( getAvailableServices( aService, 
aLocale ));
 
@@ -734,7 +734,7 @@ void LngSvcMgr::UpdateAll()
 const Locale *pAvailLocale = aAvailLocales.getConstArray();
 for (i = 0;  i < nAvailLocales;  ++i)
 {
-OUString aCfgLocaleStr( (LanguageTag(pAvailLocale[i])).getBcp47() 
);
+OUString aCfgLocaleStr( LanguageTag::convertToBcp47( 
pAvailLocale[i]));
 
 Sequence< OUString > aAvailSvcs( getAvailableServices( aService, 
pAvailLocale[i] ));
 
@@ -1777,7 +1777,7 @@ bool LngSvcMgr::SaveCfgSvcs( const OUString  
)
 aCfgAny <<= aSvcImplNames;
 DBG_ASSERT( aCfgAny.hasValue(), "missing value for 'Any' type" );
 
-OUString aCfgLocaleStr( (LanguageTag(pLocale[i])).getBcp47() );
+OUString aCfgLocaleStr( LanguageTag::convertToBcp47( pLocale[i]));
 pValue->Value = aCfgAny;
 pValue->Name  = aNodeName + "/" + aCfgLocaleStr;
 pValue++;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-04-05 Thread Rohan Kumar
 linguistic/source/hyphdsp.cxx   |6 ++
 linguistic/source/lngsvcmgr.cxx |   33 +
 linguistic/source/spelldta.cxx  |4 ++--
 3 files changed, 13 insertions(+), 30 deletions(-)

New commits:
commit 931d003ade7c4a88f46be1e89b32d58e5eb9d083
Author: Rohan Kumar 
Date:   Sat Mar 5 12:21:23 2016 +0530

tdf#91794 remove OSL_DEBUG_LEVEL > 1 conditionals

I disentangled my previous patch and uploaded one patch
per module

Change-Id: Ic7351452833816358cff96e154d6d5d40f094aa8
Reviewed-on: https://gerrit.libreoffice.org/22666
Tested-by: Jenkins 
Reviewed-by: Björn Michaelsen 

diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index 5ed22c5..42c42e4 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -120,8 +120,7 @@ Reference  
HyphenatorDispatcher::buildHyphWord(
 
 if (nHyphenationPos > 0)
 {
-
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
 {
 if (aTmp.toString() != rOrigWord)
 {
@@ -142,8 +141,7 @@ Reference  
HyphenatorDispatcher::buildHyphWord(
 sal_Int32 nL = aLonger.getLength();
 if (nS > 0 && nL > 0)
 {
-DBG_ASSERT( (nS + 1 == nL) && aLonger[nL-1] == '.',
-"HyphenatorDispatcher::buildHyphWord: 
unexpected difference between words!" );
+assert( ((nS + 1 == nL) && aLonger[nL-1] == '.') 
&& "HyphenatorDispatcher::buildHyphWord: unexpected difference between words!" 
);
 }
 }
 }
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index d77a372..d45b409 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -782,12 +782,7 @@ void LngSvcMgr::UpdateAll()
 {
 // add new or replace existing entries.
 bool bRes = aCfg.ReplaceSetProperties( aSubNodeName, 
aNewValues );
-if (!bRes)
-{
-#if OSL_DEBUG_LEVEL > 1
-SAL_WARN( "linguistic", "failed to set new configuration 
values" );
-#endif
-}
+SAL_WARN_IF(!bRes, "linguistic", "failed to set new 
configuration values");
 }
 }
 }
@@ -1428,8 +1423,8 @@ uno::Reference< linguistic2::XSpellChecker > SAL_CALL
 throw(uno::RuntimeException, std::exception)
 {
 osl::MutexGuard aGuard( GetLinguMutex() );
-#if OSL_DEBUG_LEVEL > 1
-getAvailableLocales( SN_SPELLCHECKER );
+#if OSL_DEBUG_LEVEL > 0
+getAvailableLocales(SN_SPELLCHECKER);
 #endif
 
 uno::Reference< linguistic2::XSpellChecker > xRes;
@@ -1448,10 +1443,9 @@ uno::Reference< linguistic2::XHyphenator > SAL_CALL
 throw(uno::RuntimeException, std::exception)
 {
 osl::MutexGuard aGuard( GetLinguMutex() );
-#if OSL_DEBUG_LEVEL > 1
-getAvailableLocales( SN_HYPHENATOR );
+#if OSL_DEBUG_LEVEL > 0
+getAvailableLocales(SN_HYPHENATOR);
 #endif
-
 uno::Reference< linguistic2::XHyphenator >   xRes;
 if (!bDisposing)
 {
@@ -1468,10 +1462,9 @@ uno::Reference< linguistic2::XThesaurus > SAL_CALL
 throw(uno::RuntimeException, std::exception)
 {
 osl::MutexGuard aGuard( GetLinguMutex() );
-#if OSL_DEBUG_LEVEL > 1
-getAvailableLocales( SN_THESAURUS );
+#if OSL_DEBUG_LEVEL > 0
+getAvailableLocales(SN_THESAURUS);
 #endif
-
 uno::Reference< linguistic2::XThesaurus >xRes;
 if (!bDisposing)
 {
@@ -1645,9 +1638,6 @@ void SAL_CALL
 
 osl::MutexGuard aGuard( GetLinguMutex() );
 
-#if OSL_DEBUG_LEVEL > 1
-#endif
-
 LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
 if (!LinguIsUnspecified( nLanguage))
 {
@@ -1814,15 +1804,14 @@ static uno::Sequence< OUString > GetLangSvcList( const 
uno::Any  )
 if (rVal.hasValue())
 {
 rVal >>= aRes;
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
 sal_Int32 nSvcs = aRes.getLength();
 if (nSvcs)
 {
 const OUString *pSvcName = aRes.getConstArray();
 for (sal_Int32 j = 0;  j < nSvcs;  ++j)
 {
-OUString aImplName( pSvcName[j] );
-SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "service 
impl-name missing" );
+SAL_WARN_IF( pSvcName[j].isEmpty(), "linguistic", "service 
impl-name missing" );
 }
 }
 #endif
@@ -1930,10 +1919,6 @@ uno::Sequence< OUString > SAL_CALL
 }
 }
 
-#if OSL_DEBUG_LEVEL > 1
-const OUString *pImplNames = aSvcImplNames.getConstArray();
-(void) pImplNames;
-#endif
 return aSvcImplNames;
 }
 
diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx
index 6a0a938..34027d9 100644
--- 

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

2016-02-18 Thread László Németh
 linguistic/source/spelldta.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 60d900254e93e8ac19fed3fa451b91c536efe930
Author: László Németh 
Date:   Wed Feb 17 23:23:39 2016 +0100

tdf#97179: do not suggest 1-letter custom dictionary words

Fix for the following regression:

Suggestions for all 1- or 2-letter words contain ~all Greek
letters from the commit c4318b8c1912c1ee947d96b02b3d4abf2eaf65f6
(add Greek alphabet to the technical dictionary).

Change-Id: I9356d439debfec34a963edbe5daacde976cc532c
Reviewed-on: https://gerrit.libreoffice.org/22449
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx
index bb62a5a..001fbe9 100644
--- a/linguistic/source/spelldta.cxx
+++ b/linguistic/source/spelldta.cxx
@@ -99,7 +99,7 @@ void SearchSimilarText( const OUString , sal_Int16 
nLanguage,
 // remove characters used to determine hyphenation 
positions
 aEntryTxt = 
comphelper::string::remove(pEntries[k]->getDictionaryWord(), '=');
 }
-if (!aEntryTxt.isEmpty()  &&  LevDistance( rText, aEntryTxt ) 
<= 2)
+if (!aEntryTxt.isEmpty()  &&  aEntryTxt.getLength() > 1  &&  
LevDistance( rText, aEntryTxt ) <= 2)
 rDicListProps.push_back( aEntryTxt );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-11-11 Thread Stephan Bergmann
 linguistic/source/hyphdsp.cxx  |4 
 linguistic/source/spelldta.cxx |1 +
 2 files changed, 5 insertions(+)

New commits:
commit a31b4f4c6eaa7a2e5e5986a4dee5acbd94ada8d1
Author: Stephan Bergmann 
Date:   Wed Nov 11 11:03:46 2015 +0100

Missing includes

Change-Id: I5cade452b4567886c5587be927af7caaa24d92b4

diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index 981e831..0ab8485 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+
+#include 
+
 #include 
 #include 
 #include 
diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx
index d066510..ffe8641 100644
--- a/linguistic/source/spelldta.cxx
+++ b/linguistic/source/spelldta.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 #include "linguistic/spelldta.hxx"
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-09-17 Thread Caolán McNamara
 linguistic/source/dicimp.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit c881e20ecddcbba5db6daf41e2ef294f6a97dd19
Author: Caolán McNamara 
Date:   Thu Sep 17 11:13:35 2015 +0100

include algorithm for std::min/max

Change-Id: I59ff81e1c203fb81a3f6b0fe666082a08ad8cfc5

diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index f79af01..e9820d5 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -40,6 +40,8 @@
 
 #include "defs.hxx"
 
+#include 
+
 
 using namespace utl;
 using namespace osl;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-09-08 Thread Stephan Bergmann
 linguistic/source/lngprophelp.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit f89475ce90f184e15e10508c1eace674a01a6740
Author: Stephan Bergmann 
Date:   Tue Sep 8 14:08:34 2015 +0200

clang-analyzer-deadcode.DeadStores

...ever since its inception with 4c9ed88132bb472eb1b759c8e53874e79402c769
"INTEGRATION: CWS tl04: #118281# switch to Proximity linguistic"

Change-Id: Id1579bfc6dffa3685641c96b7a79489338e8dd22

diff --git a/linguistic/source/lngprophelp.cxx 
b/linguistic/source/lngprophelp.cxx
index 24c3733..3083d5c 100644
--- a/linguistic/source/lngprophelp.cxx
+++ b/linguistic/source/lngprophelp.cxx
@@ -190,10 +190,6 @@ bool PropertyChgHelper::propertyChange_Impl( const 
PropertyChangeEvent& rEvt )
 bSCWA = bSWWA = true;
 break;
 }
-default:
-{
-bRes = false;
-}
 }
 if (pbVal)
 rEvt.NewValue >>= *pbVal;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-05-02 Thread Caolán McNamara
 linguistic/source/lngsvcmgr.cxx |8 
 1 file changed, 8 deletions(-)

New commits:
commit 62eebc07e443fff02388539e26f583bc45c81ba3
Author: Caolán McNamara caol...@redhat.com
Date:   Sat May 2 12:02:16 2015 +0100

drop useless debugging stuff

Change-Id: Ia7f189de07370edc9330e8e79169bdb07adf

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 5271732..81c2f5c 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -1824,14 +1824,6 @@ bool LngSvcMgr::SaveCfgSvcs( const OUString 
rServiceName )
 uno::Sequence OUString  aSvcImplNames;
 aSvcImplNames = pDsp-GetServiceList( pLocale[i] );
 
-#if OSL_DEBUG_LEVEL  1
-sal_Int32 nSvcs = aSvcImplNames.getLength();
-const OUString *pSvcImplName = aSvcImplNames.getConstArray();
-for (sal_Int32 j = 0;  j  nSvcs;  ++j)
-{
-OUString aImplName( pSvcImplName[j] );
-}
-#endif
 // build value to be written back to configuration
 uno::Any aCfgAny;
 if ((pDsp == pHyphDsp || pDsp == pGrammarDsp)  
aSvcImplNames.getLength()  1)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-05-02 Thread Caolán McNamara
 linguistic/source/misc.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit 332f6625727273cf4839b1169d469b4a3c746f4f
Author: Caolán McNamara caol...@redhat.com
Date:   Sat May 2 13:54:37 2015 +0100

drop useless debugging stuff

Change-Id: I4475b1112dfd9d6b1439deb4792d1320a00b79dc

diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index bd1bdc8..c685f60 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -531,9 +531,6 @@ uno::Reference XHyphenatedWord  
RebuildHyphensAndControlChars(
  nChgLen = 0;
 OUString aRplc;
 bool bAltSpelling = GetAltSpelling( nChgPos, nChgLen, aRplc, 
rxHyphWord );
-#if OSL_DEBUG_LEVEL  1
-OUString aWord( rxHyphWord-getWord() );
-#endif
 
 OUString aOrigHyphenatedWord;
 sal_Int16 nOrigHyphenPos= -1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-01-02 Thread Miklos Vajna
 linguistic/source/convdic.hxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d7794d2584cd5d476b011b5344c77ad59c179c58
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Jan 2 21:15:40 2015 +0100

linguistic: fix gcc-4.8 build

Change-Id: Ic67d11cff11078a7d83a3ee98b91ec8ae138adef

diff --git a/linguistic/source/convdic.hxx b/linguistic/source/convdic.hxx
index 73948f2..5b30e67 100644
--- a/linguistic/source/convdic.hxx
+++ b/linguistic/source/convdic.hxx
@@ -57,12 +57,12 @@ struct StrEQ
 }
 };
 
-typedef std::unordered_multimap const OUString, OUString,
+typedef std::unordered_multimap OUString, OUString,
const OUStringHash, StrEQ  ConvMap;
 
 typedef std::set OUString, StrLT  ConvMapKeySet;
 
-typedef std::unordered_multimap const OUString, sal_Int16,
+typedef std::unordered_multimap OUString, sal_Int16,
OUStringHash, StrEQ  PropTypeMap;
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-08-22 Thread Caolán McNamara
 linguistic/source/lngsvcmgr.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8a4a1d285a79cc3544e1b32dad94b68982705977
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Aug 22 11:58:51 2014 +0100

pAvailGrammarSvcs can be reset to 0 on error

e.g. java grammar checker installed and java
disabled at runtime

Change-Id: I84b0e5eeb3ef9c30e153cb5fb65e35270023cd34

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 44c5551..259dd8f 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -1152,7 +1152,7 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
 }
 }
 
-if (xSvc.is())
+if (xSvc.is()  pAvailGrammarSvcs)
 {
 OUStringaImplName;
 uno::Sequence sal_Int16aLanguages;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-08-12 Thread Caolán McNamara
 linguistic/source/misc.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 73bb0fe7953f501747fb6b7c315beda4f253a216
Author: Caolán McNamara caol...@redhat.com
Date:   Tue Aug 12 10:24:06 2014 +0100

Resolves: fdo#81972 determining capitalization of =63335 char word hangs

Change-Id: I929eb86021883852381df1edf8bf1fb2150e348d

diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index c1cede4..db7d030 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -615,7 +615,7 @@ CapType SAL_CALL capitalType(const OUString aTerm, 
CharClass * pCC)
 {
 OUString aStr(aTerm);
 sal_Int32 nc = 0;
-for (sal_uInt16 tindex = 0; tindex  tlen;  tindex++)
+for (sal_Int32 tindex = 0; tindex  tlen; ++tindex)
 {
 if (pCC-getCharacterType(aStr,tindex) 
::com::sun::star::i18n::KCharacterType::UPPER) nc++;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-04-09 Thread Stephan Bergmann
 linguistic/source/convdiclist.cxx |   19 +-
 linguistic/source/convdicxml.cxx  |   10 -
 linguistic/source/dicimp.cxx  |   10 -
 linguistic/source/dlistimp.cxx|1 
 linguistic/source/gciterator.cxx  |1 
 linguistic/source/lngopt.cxx  |1 
 linguistic/source/lngreg.cxx  |   38 +
 linguistic/source/lngreg.hxx  |   68 ++
 linguistic/source/lngsvcmgr.cxx   |9 ++---
 linguistic/source/spelldsp.cxx|8 +---
 10 files changed, 89 insertions(+), 76 deletions(-)

New commits:
commit 5d81ecff7e81fd7f8b2c19294f220dd7f9ce6166
Author: Stephan Bergmann sberg...@redhat.com
Date:   Wed Apr 9 12:25:20 2014 +0200

Clean up function declarations and some unused functions

Change-Id: I9e58a0bc56f5df40621185f19b01edf074558464

diff --git a/linguistic/source/convdiclist.cxx 
b/linguistic/source/convdiclist.cxx
index 20e3dd7..4501670 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -17,6 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include sal/config.h
+
+#include boost/noncopyable.hpp
 #include com/sun/star/container/XNameContainer.hpp
 #include com/sun/star/lang/Locale.hpp
 #include com/sun/star/linguistic2/ConversionDictionaryType.hpp
@@ -41,6 +44,7 @@
 #include convdiclist.hxx
 #include defs.hxx
 #include hhconvdic.hxx
+#include lngreg.hxx
 #include linguistic/misc.hxx
 
 using namespace osl;
@@ -81,19 +85,15 @@ class ConvDicNameContainer :
 public cppu::WeakImplHelper1
 
 ::com::sun::star::container::XNameContainer
-
+,
+private boost::noncopyable
 {
 uno::Sequence uno::Reference XConversionDictionary aConvDics;
-ConvDicList rConvDicList;
-
-// disallow copy-constructor and assignment-operator for now
-ConvDicNameContainer(const ConvDicNameContainer );
-ConvDicNameContainer  operator = (const ConvDicNameContainer );
 
 sal_Int32 GetIndexByName_Impl( const OUString rName );
 
 public:
-ConvDicNameContainer( ConvDicList rMyConvDicList );
+ConvDicNameContainer();
 virtual ~ConvDicNameContainer();
 
 // XElementAccess
@@ -128,8 +128,7 @@ public:
 }
 };
 
-ConvDicNameContainer::ConvDicNameContainer( ConvDicList rMyConvDicList ) :
-rConvDicList( rMyConvDicList )
+ConvDicNameContainer::ConvDicNameContainer()
 {
 }
 
@@ -403,7 +402,7 @@ ConvDicNameContainer  ConvDicList::GetNameContainer()
 {
 if (!pNameContainer)
 {
-pNameContainer = new ConvDicNameContainer( *this );
+pNameContainer = new ConvDicNameContainer;
 pNameContainer-AddConvDics( GetDictionaryWriteablePath(), 
OUString(CONV_DIC_EXT)  );
 xNameContainer = pNameContainer;
 
diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx
index 2bd7769..6b7fb27 100644
--- a/linguistic/source/convdicxml.cxx
+++ b/linguistic/source/convdicxml.cxx
@@ -92,11 +92,6 @@ public:
 {
 }
 
-const ConvDicXMLImport  GetConvDicImport() const
-{
-return (const ConvDicXMLImport ) GetImport();
-}
-
 ConvDicXMLImport  GetConvDicImport()
 {
 return (ConvDicXMLImport ) GetImport();
@@ -126,9 +121,6 @@ public:
 // SvXMLImportContext
 virtual void StartElement( const ::com::sun::star::uno::Reference 
::com::sun::star::xml::sax::XAttributeList  xAttrList ) SAL_OVERRIDE;
 virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const 
OUString rLocalName, const uno::Reference xml::sax::XAttributeList  
rxAttrList ) SAL_OVERRIDE;
-
-sal_Int16   GetLanguage() const { return nLanguage; }
-sal_Int16   GetConversionType() const   { return nConversionType; }
 };
 
 
@@ -152,8 +144,6 @@ public:
 virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const 
OUString rLocalName, const uno::Reference xml::sax::XAttributeList  
rxAttrList ) SAL_OVERRIDE;
 
 const OUString GetLeftText() const { return aLeftText; }
-sal_Int16   GetPropertyType() const { return nPropertyType; }
-voidSetPropertyType( sal_Int16 nVal )   { nPropertyType = 
nVal; }
 };
 
 
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 5e3c0fd..ffab959 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -751,16 +751,6 @@ sal_Bool DictionaryNeo::addEntry_Impl(const 
uno::Reference XDictionaryEntry  x
 return bRes;
 }
 
-
-uno::Reference XInterface  SAL_CALL DictionaryNeo_CreateInstance(
-const uno::Reference XMultiServiceFactory   /*rSMgr*/ )
-throw(Exception)
-{
-uno::Reference XInterface  xService =
-(cppu::OWeakObject*) new DictionaryNeo;
-return xService;
-}
-
 OUString SAL_CALL DictionaryNeo::getName(  )
 throw(RuntimeException, std::exception)
 {
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 994ddd1..9b161db 100644

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

2014-03-18 Thread Noel Grandin
 linguistic/source/convdic.cxx|4 ++--
 linguistic/source/convdicxml.hxx |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 85341374cb9c2244d8d681b1b44909a9fa829f11
Author: Noel Grandin n...@peralex.com
Date:   Tue Mar 18 11:24:01 2014 +0200

remove unused parameter

Change-Id: Iab723e78b0305dadee5598b21a9ea78093109b65

diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index beee732..3e909c7 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -141,7 +141,7 @@ sal_Bool IsConvDic( const OUString rFileURL, sal_Int16 
nLang, sal_Int16 nConv
 // first argument being 0 should stop the file from being parsed
 // up to the end (reading all entries) when the required
 // data (language, conversion type) is found.
-ConvDicXMLImport *pImport = new ConvDicXMLImport( 0, rFileURL );
+ConvDicXMLImport *pImport = new ConvDicXMLImport( 0 );
 
 //!! keep a first reference to ensure the lifetime of the object !!
 uno::Reference XInterface  xRef( (document::XFilter *) pImport, 
UNO_QUERY );
@@ -220,7 +220,7 @@ void ConvDic::Load()
 
 //!! prevent function from being called recursively via HasEntry, AddEntry
 bNeedEntries = sal_False;
-ConvDicXMLImport *pImport = new ConvDicXMLImport( this, aMainURL );
+ConvDicXMLImport *pImport = new ConvDicXMLImport( this );
 //!! keep a first reference to ensure the lifetime of the object !!
 uno::Reference XInterface  xRef( (document::XFilter *) pImport, 
UNO_QUERY );
 ReadThroughDic( aMainURL, *pImport );// will implicitly add the entries
diff --git a/linguistic/source/convdicxml.hxx b/linguistic/source/convdicxml.hxx
index de5fada..21f48d6 100644
--- a/linguistic/source/convdicxml.hxx
+++ b/linguistic/source/convdicxml.hxx
@@ -83,7 +83,7 @@ class ConvDicXMLImport : public SvXMLImport
 public:
 
 //!!  see comment for pDic member
-ConvDicXMLImport( ConvDic *pConvDic, const OUString /*rFileName*/ ) :
+ConvDicXMLImport( ConvDic *pConvDic ) :
 SvXMLImport ( comphelper::getProcessComponentContext(), 
com.sun.star.lingu2.ConvDicXMLImport, IMPORT_ALL ),
 pDic( pConvDic )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-01-30 Thread László Németh
 linguistic/source/dicimp.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit bcfa89158e1ce8cecf9c078ef852225180472a55
Author: László Németh nem...@numbertext.org
Date:   Thu Jan 30 15:19:56 2014 +0100

fdo#44314 non-standard hyphenation (fix previous commit)

Change-Id: Ib830cf5b57051039106d1f60059fe8a3bdbecf1a

diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 1306253..2e83a06 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -608,20 +608,22 @@ int DictionaryNeo::cmpDicEntry(const OUString rWord1,
 {
 if (aWord1[ nIdx1 ] == cIgnBeg)
 IgnState = true;
-if (IgnState || aWord1[ nIdx1++ ] == cIgnChar)
+if (IgnState || aWord1[ nIdx1 ] == cIgnChar)
 nNumIgnChar1++;
 if (aWord1[ nIdx1] == cIgnEnd)
 IgnState = false;
+nIdx1++;
 }
 IgnState = false;
 while (nIdx2  nLen2 )
 {
-if (aWord1[ nIdx2 ] == cIgnBeg)
+if (aWord2[ nIdx2 ] == cIgnBeg)
 IgnState = true;
-if (aWord2[ nIdx2++ ] == cIgnChar)
+if (IgnState || aWord2[ nIdx2 ] == cIgnChar)
 nNumIgnChar2++;
-if (aWord1[ nIdx1] == cIgnEnd)
+if (aWord2[ nIdx2 ] == cIgnEnd)
 IgnState = false;
+nIdx2++;
 }
 
 nRes = ((sal_Int32) nLen1 - nNumIgnChar1) - ((sal_Int32) nLen2 - 
nNumIgnChar2);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-01-01 Thread Julien Nabet
 linguistic/source/lngopt.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6a82f67223bf8dd6d417b442e4f895496232a742
Author: Julien Nabet serval2...@yahoo.fr
Date:   Wed Jan 1 21:39:13 2014 +0100

Resolves: fdo#72464 Character line break is set to 0 Options/.../Writing 
Aids

Change-Id: I9f3d1c64fde064fc7ba9bdfcb9e35032a0c40255

diff --git a/linguistic/source/lngopt.hxx b/linguistic/source/lngopt.hxx
index 4e3df8e..791e242 100644
--- a/linguistic/source/lngopt.hxx
+++ b/linguistic/source/lngopt.hxx
@@ -145,7 +145,7 @@ public:
 virtual void SAL_CALL setIsSpellCapitalization(sal_Bool p1) throw 
(css::uno::RuntimeException)
 { setProperty(UPN_IS_SPELL_CAPITALIZATION, p1); }
 virtual sal_Int16 SAL_CALL getHyphMinLeading() throw 
(css::uno::RuntimeException)
-{ return getPropertyBool(UPN_HYPH_MIN_LEADING); }
+{ return getPropertyInt16(UPN_HYPH_MIN_LEADING); }
 virtual void SAL_CALL setHyphMinLeading(sal_Int16 p1) throw 
(css::uno::RuntimeException)
 { setProperty(UPN_HYPH_MIN_LEADING, p1); }
 virtual sal_Int16 SAL_CALL getHyphMinTrailing() throw 
(css::uno::RuntimeException)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-10-02 Thread Stephan Bergmann
 linguistic/source/gciterator.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit 08de2ef50f93a768fd735047fcbd59bfd9e25fe5
Author: Stephan Bergmann sberg...@redhat.com
Date:   Wed Oct 2 17:51:36 2013 +0200

-Werror,-Wunused-variable

Change-Id: I90ad58235c07b0336a9cee5981a57b9ad16312e7

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 5544aee..efde32c 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -355,7 +355,6 @@ void GrammarCheckingIterator::ProcessResult(
  rRes.nBehindEndOfSentencePosition  = 
rRes.nStartOfNextSentencePosition;
 (void) bBoundariesOk;
 DBG_ASSERT( bBoundariesOk, inconsistent sentence boundaries );
-uno::Sequence linguistic2::SingleProofreadingError  aErrors = 
rRes.aErrors;
 
 uno::Reference text::XMultiTextMarkup  xMulti( rRes.xFlatParagraph, 
uno::UNO_QUERY );
 if (xMulti.is())// use new API for markups
@@ -492,9 +491,6 @@ uno::Reference linguistic2::XProofreader  
GrammarCheckingIterator::GetGrammarC
 
 void GrammarCheckingIterator::DequeueAndCheck()
 {
-uno::Sequence sal_Int32   aLangPortions;
-uno::Sequence lang::LocaleaLangPortionsLocale;
-
 for (;;)
 {
 //  THREAD SAFE START 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-09-02 Thread Michael Stahl
 linguistic/source/gciterator.cxx |   12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit b23999755a865a277c29adfc1dc0c249275bfd7e
Author: Michael Stahl mst...@redhat.com
Date:   Mon Sep 2 15:58:00 2013 +0200

fdo#68750: ensure that GetSuggestedEndOfSentence makes progress

Checking a string of 17399 spaces takes 20 seconds here in
GrammarCheckingIterator::GetSuggestedEndOfSentence() because
BreakIterator_Unicode::endOfSentence() will always return
0 as a result regardless of what nStartPos it gets.

Change-Id: Id02440a91d7015c2896e387854445ee5383092fa

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index b806c22..694dcd7 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -754,13 +754,23 @@ sal_Int32 
GrammarCheckingIterator::GetSuggestedEndOfSentence(
 m_xBreakIterator = i18n::BreakIterator::create(xContext);
 }
 sal_Int32 nTextLen = rText.getLength();
-sal_Int32 nEndPosition;
+sal_Int32 nEndPosition(0);
 sal_Int32 nTmpStartPos = nSentenceStartPos;
 do
 {
+sal_Int32 const nPrevEndPosition(nEndPosition);
 nEndPosition = nTextLen;
 if (nTmpStartPos  nTextLen)
+{
 nEndPosition = m_xBreakIterator-endOfSentence( rText, 
nTmpStartPos, rLocale );
+if (nEndPosition = nPrevEndPosition)
+{
+// fdo#68750 if there's no progress at all then presumably
+// there's no end of sentence in this paragraph so just
+// set the end position to end of paragraph
+nEndPosition = nTextLen;
+}
+}
 if (nEndPosition  0)
 nEndPosition = nTextLen;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-03-19 Thread Andras Timar
 linguistic/source/convdic.cxx |1 -
 linguistic/source/convdiclist.cxx |1 -
 linguistic/source/convdicxml.cxx  |1 -
 linguistic/source/dicimp.cxx  |1 -
 linguistic/source/dlistimp.cxx|1 -
 linguistic/source/hhconvdic.cxx   |1 -
 linguistic/source/misc.cxx|1 -
 linguistic/source/misc2.cxx   |1 -
 8 files changed, 8 deletions(-)

New commits:
commit 332a93435fc5757532d0b93b38aaf9fe1c9ca0f5
Author: Andras Timar ati...@suse.com
Date:   Tue Mar 19 22:55:56 2013 +0100

fdo#39445 writing out tools/fsys.hxx (linguistic)

Change-Id: I5d0e5ebbec46c32998962398da14ac81bb8afea8

diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index 6bfeb58..58872b7 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -22,7 +22,6 @@
 #include i18npool/lang.h
 #include osl/mutex.hxx
 #include tools/debug.hxx
-#include tools/fsys.hxx
 #include tools/stream.hxx
 #include tools/string.hxx
 #include tools/urlobj.hxx
diff --git a/linguistic/source/convdiclist.cxx 
b/linguistic/source/convdiclist.cxx
index 9fa05f4..a71ce6e 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -18,7 +18,6 @@
  */
 
 
-#include tools/fsys.hxx
 #include tools/stream.hxx
 #include tools/urlobj.hxx
 #include unotools/pathoptions.hxx
diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx
index 7b6f71ea..7ddf38f 100644
--- a/linguistic/source/convdicxml.cxx
+++ b/linguistic/source/convdicxml.cxx
@@ -18,7 +18,6 @@
  */
 
 #include tools/debug.hxx
-#include tools/fsys.hxx
 #include tools/string.hxx
 #include i18npool/languagetag.hxx
 #include tools/stream.hxx
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 1752a56..4307d4c 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -25,7 +25,6 @@
 #include i18npool/languagetag.hxx
 #include osl/mutex.hxx
 #include tools/debug.hxx
-#include tools/fsys.hxx
 #include tools/stream.hxx
 #include tools/string.hxx
 #include tools/urlobj.hxx
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 27ded13..6415298 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -21,7 +21,6 @@
 #include cppuhelper/factory.hxx
 #include i18npool/mslangid.hxx
 #include osl/file.hxx
-#include tools/fsys.hxx
 #include tools/stream.hxx
 #include tools/urlobj.hxx
 #include unotools/pathoptions.hxx
diff --git a/linguistic/source/hhconvdic.cxx b/linguistic/source/hhconvdic.cxx
index 96cdc7e..71cc782 100644
--- a/linguistic/source/hhconvdic.cxx
+++ b/linguistic/source/hhconvdic.cxx
@@ -19,7 +19,6 @@
 
 #include unicode/uscript.h
 #include i18npool/lang.h
-#include tools/fsys.hxx
 #include tools/stream.hxx
 #include tools/string.hxx
 #include osl/mutex.hxx
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 333a6ff..f3d4159 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -19,7 +19,6 @@
 
 #include sal/macros.h
 #include tools/string.hxx
-#include tools/fsys.hxx
 #include tools/debug.hxx
 #include unotools/pathoptions.hxx
 #include svl/lngmisc.hxx
diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx
index a4ef6d9..15b33ac 100644
--- a/linguistic/source/misc2.cxx
+++ b/linguistic/source/misc2.cxx
@@ -18,7 +18,6 @@
  */
 
 #include tools/string.hxx
-#include tools/fsys.hxx
 #include tools/urlobj.hxx
 #include ucbhelper/content.hxx
 #include tools/debug.hxx
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-02-21 Thread Stephan Bergmann
 linguistic/source/dicimp.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e5cdfe589f8ce559a9e6d8fee3b1a6bd3c9ec233
Author: Stephan Bergmann sberg...@redhat.com
Date:   Thu Feb 21 11:47:14 2013 +0100

This apparently wants sal_uLong, not bool

Change-Id: I0cf295ea2f83908d98427ae1f3bb6fa1dbbd0b12

diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 9dc63e3..886a826 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -423,7 +423,7 @@ struct TmpDictionary
 return xStream;
 }
 
-bool renameTmpToURL()
+sal_uLong renameTmpToURL()
 {
 try
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-02-20 Thread Michael Meeks
 linguistic/source/dicimp.cxx |   74 ++-
 1 file changed, 59 insertions(+), 15 deletions(-)

New commits:
commit 28300209604ee1bb8e5050322b29e95a07f679d8
Author: Michael Meeks michael.me...@suse.com
Date:   Wed Feb 20 16:19:30 2013 +

fdo#42122 - truncate files that shrink to avoid dictionary corruption.

fixes a nasty apparently introduced by 
7e01bc8d28ffefd4539a5eae2587e1f7da0999e7

Change-Id: I8227cb49a5dfa885d4dc38ce353a356bb5ed8a69

diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 2216a8c..9dc63e3 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -386,33 +386,75 @@ static rtl::OString formatForSave(const uno::Reference 
XDictionaryEntry  xEnt
return aStr.makeStringAndClear();
 }
 
+struct TmpDictionary
+{
+OUString maURL, maTmpURL;
+uno::Reference ucb::XSimpleFileAccess3  mxAccess;
+
+void cleanTmpFile()
+{
+try
+{
+mxAccess-kill(maTmpURL);
+}
+catch (const uno::Exception ) { }
+}
+TmpDictionary(const OUString rURL)
+: maURL( rURL )
+{
+maTmpURL = maURL + .tmp;
+}
+~TmpDictionary()
+{
+cleanTmpFile();
+}
+
+uno::Reference io::XStream  openTmpFile()
+{
+uno::Reference io::XStream  xStream;
+
+try
+{
+mxAccess = ucb::SimpleFileAccess::create(
+comphelper::getProcessComponentContext());
+xStream = mxAccess-openFileReadWrite(maTmpURL);
+} catch (const uno::Exception ) { }
+
+return xStream;
+}
+
+bool renameTmpToURL()
+{
+try
+{
+mxAccess-move(maTmpURL, maURL);
+}
+catch (const uno::Exception )
+{
+DBG_ASSERT( 0, failed to overwrite dict );
+return static_cast sal_uLong (-1);
+}
+return 0;
+}
+};
 
 sal_uLong DictionaryNeo::saveEntries(const OUString rURL)
 {
-MutexGuard  aGuard( GetLinguMutex() );
+MutexGuard aGuard( GetLinguMutex() );
 
 if (rURL.isEmpty())
 return 0;
 DBG_ASSERT(!INetURLObject( rURL ).HasError(), lng : invalid URL);
 
-uno::Reference uno::XComponentContext  xContext( 
comphelper::getProcessComponentContext() );
+// lifecycle manage the .tmp file
+TmpDictionary aTmpDictionary(rURL);
+uno::Reference io::XStream  xStream = aTmpDictionary.openTmpFile();
 
-// get XOutputStream stream
-uno::Reference io::XStream  xStream;
-try
-{
-uno::Reference ucb::XSimpleFileAccess3  xAccess( 
ucb::SimpleFileAccess::create(xContext) );
-xStream = xAccess-openFileReadWrite( rURL );
-}
-catch (const uno::Exception )
-{
-DBG_ASSERT( 0, failed to get input stream );
-}
 if (!xStream.is())
 return static_cast sal_uLong (-1);
 
-SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( 
xStream ) );
 sal_uLong nErr = sal::static_int_cast sal_uLong (-1);
+SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( 
xStream ) );
 
 //
 // Always write as the latest version, i.e. DIC_VERSION_7
@@ -449,9 +491,11 @@ sal_uLong DictionaryNeo::saveEntries(const OUString rURL)
 rtl::OString aOutStr = formatForSave(pEntry[i], eEnc);
 pStream-WriteLine (aOutStr);
 if (0 != (nErr = pStream-GetError()))
-return nErr;
+break;
 }
 
+nErr = aTmpDictionary.renameTmpToURL();
+
 //If we are migrating from an older version, then on first successful
 //write, we're now converted to the latest version, i.e. DIC_VERSION_7
 nDicVersion = DIC_VERSION_7;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits