summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRashesh <rashesh.padia@collabora.com>2024-12-13 14:22:52 +0530
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-12-16 20:45:59 +0100
commitf4df86eda7ef82a3ffaf7fdd76a4775d0f66e438 (patch)
tree431e13609bf8bdbe94b9e856d45d6c8abca95ac2
parent91119801859ed20900ff30751ef00c9cb0dcd62d (diff)
kit: re-initialize user-defined dictionaries on lo_init
Change-Id: I017767089efe54bf8d32d905e995f1a99c23984f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178398 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
-rw-r--r--desktop/source/lib/init.cxx9
-rw-r--r--linguistic/source/dlistimp.cxx15
-rw-r--r--linguistic/source/dlistimp.hxx17
3 files changed, 33 insertions, 8 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b5493bc22cfc..e080dd8b5729 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -8319,6 +8319,15 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
uno::Reference<css::util::XPathSettings> xPathSettings = util::thePathSettings::get(xContext);
uno::Reference<lang::XInitialization> xReInitSettings(xPathSettings, uno::UNO_QUERY_THROW);
xReInitSettings->initialize({});
+
+ uno::Reference<css::linguistic2::XSearchableDictionaryList> xDicList
+ = LinguMgr::GetDictionaryList();
+ if (xDicList.is())
+ {
+ uno::Reference<lang::XInitialization> xReInitDictionaryList(xDicList,
+ uno::UNO_QUERY_THROW);
+ xReInitDictionaryList->initialize({});
+ }
}
}
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index ba39271eee0c..23863f1a1c3e 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -324,6 +324,11 @@ void DicList::SearchForDictionaries(
uno::Reference< XDictionary > xDic =
new DictionaryNeo( aDicTitle.isEmpty() ? aDicName : aDicTitle, nLang, eType, aURL, bIsWriteablePath );
+ // when using libreofficekit we don't have "options" dialog to make user-dictionaries active
+ // so when we add user-dictionary, we make them active as well
+ if (comphelper::LibreOfficeKit::isActive())
+ xDic->setActive(true);
+
addDictionary( xDic );
nCount++;
}
@@ -572,6 +577,16 @@ void SAL_CALL
aEvtListeners.removeInterface( rxListener );
}
+void SAL_CALL DicList::initialize(const css::uno::Sequence<css::uno::Any>& /*rArguments*/)
+{
+ osl::MutexGuard aGuard(GetLinguMutex());
+
+ if (!bInCreation && !bDisposing)
+ {
+ CreateDicList();
+ }
+}
+
void DicList::CreateDicList()
{
bInCreation = true;
diff --git a/linguistic/source/dlistimp.hxx b/linguistic/source/dlistimp.hxx
index 9d9e7d0882fb..455bfb2f8382 100644
--- a/linguistic/source/dlistimp.hxx
+++ b/linguistic/source/dlistimp.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
#include <comphelper/interfacecontainer3.hxx>
#include <cppuhelper/implbase.hxx>
@@ -34,14 +35,9 @@
class DicEvtListenerHelper;
-
-class DicList :
- public cppu::WeakImplHelper
- <
- css::linguistic2::XSearchableDictionaryList,
- css::lang::XComponent,
- css::lang::XServiceInfo
- >
+class DicList : public cppu::WeakImplHelper<css::linguistic2::XSearchableDictionaryList,
+ css::lang::XComponent, css::lang::XServiceInfo,
+ css::lang::XInitialization>
{
class MyAppExitListener : public linguistic::AppExitListener
{
@@ -68,6 +64,7 @@ class DicList :
DicList( const DicList & ) = delete;
DicList & operator = (const DicList &) = delete;
+
void CreateDicList();
DictionaryVec_t & GetOrCreateDicList()
{
@@ -111,6 +108,10 @@ public:
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+ // XInitialization
+ virtual void SAL_CALL
+ initialize(const css::uno::Sequence<css::uno::Any>& /*rArguments*/) override;
+
// non UNO-specific
void SaveDics();
};