Kaydet (Commit) 464f69b8 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: rhbz#836937 insanely slow with Zemberek installed

Zemberek is a java spellchecker extension. With it installed the collecting of
spellchecker information on first activation of spellchecking is insanely slow
as the cache of spellcheckers is thrown away on each iteration through each
language known to LibreOffice.

So...

move the config updating stuff from editeng down to the linguistic layer. Let
the linguistic layer keep its spellchecker cache and listen to the extension
manager to know if an extension which might be a spellchecker one has been
modified and only throw away the cache on that event or if (existing
implementation) the config data for linguistics changes.

The polling of changed linguistic data in SvxLinguConfigUpdate::IsNeedUpdateAll
can be removed and leave it up to LngSvcMgr to load everything in its ctor and
keep itself up to date with its config and extension listeners.

Change-Id: I9c93d998928e2e7f5128c36771b3e450a8057cd6
üst 7fe61368
......@@ -1141,12 +1141,6 @@ SvxLinguTabPage::SvxLinguTabPage( Window* pParent,
aLinguDicsEditPB.SetAccessibleName(sAccessibleNameDicsEdit);
aLinguOptionsEditPB.SetAccessibleName(sAccessibleNameOptionEdit);
// force recalculation of hash value used for checking the need of updating
// because new dictionaries might be installed / downloaded.
//! Thus it needs to be called now since it may infuence the supported languages
//! to be reported AND the found user-dictionaries(!) as well.
SvxLinguConfigUpdate::UpdateAll( sal_True );
xProp = uno::Reference< XPropertySet >( SvxGetLinguPropertySet(), UNO_QUERY );
xDicList = uno::Reference< XDictionaryList >( SvxGetDictionaryList(), UNO_QUERY );
if (xDicList.is())
......
......@@ -45,26 +45,6 @@ class LinguMgrExitLstnr;
class Window;
///////////////////////////////////////////////////////////////////////////
// SvxLinguConfigUpdate
// class to update configuration items when (before!) the linguistic is used.
//
// This class is called by all the dummy implementations to update all of the
// configuration (list of used/available services) when the linguistic is
// accessed for the first time.
class SvxLinguConfigUpdate
{
static sal_Int16 nNeedUpdating; // n == -1 => needs to be checked
// n == 0 => already updated, nothing to be done
// n == 1 => needs to be updated
public:
EDITENG_DLLPUBLIC static void UpdateAll( sal_Bool bForceCheck = sal_False );
static sal_Bool IsNeedUpdateAll( sal_Bool bForceCheck = sal_False );
};
///////////////////////////////////////////////////////////////////////////
class EDITENG_DLLPUBLIC LinguMgr
......
......@@ -53,6 +53,7 @@ $(eval $(call gb_Library_use_libraries,lng,\
tl \
ucbhelper \
utl \
vcl \
xo \
$(gb_STDLIBS) \
))
......
lg linguistic : svl xmloff ucbhelper comphelper ICU:icu LIBXSLT:libxslt NULL
lg linguistic : svl vcl xmloff ucbhelper comphelper ICU:icu LIBXSLT:libxslt NULL
lg linguistic\prj nmake - all lg_prj NULL
This diff is collapsed.
......@@ -30,7 +30,7 @@
#define _LINGUISTIC_LNGSVCMGR_HXX_
#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
#include <cppuhelper/implbase4.hxx> // helper for implementations
#include <cppuhelper/implbase5.hxx> // helper for implementations
#include <cppuhelper/interfacecontainer.h> //OMultiTypeInterfaceContainerHelper
......@@ -39,8 +39,10 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
#include <com/sun/star/linguistic2/XAvailableLocales.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
#include <unotools/configitem.hxx>
#include <vcl/timer.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
#include "linguistic/misc.hxx"
......@@ -64,12 +66,13 @@ namespace com { namespace sun { namespace star { namespace linguistic2 {
class LngSvcMgr :
public cppu::WeakImplHelper4
public cppu::WeakImplHelper5
<
com::sun::star::linguistic2::XLinguServiceManager,
com::sun::star::linguistic2::XAvailableLocales,
com::sun::star::lang::XComponent,
com::sun::star::lang::XServiceInfo
com::sun::star::lang::XServiceInfo,
com::sun::star::util::XModifyListener
>,
private utl::ConfigItem
{
......@@ -89,6 +92,12 @@ class LngSvcMgr :
com::sun::star::uno::Reference<
::com::sun::star::lang::XEventListener > xListenerHelper;
com::sun::star::uno::Reference<
::com::sun::star::util::XModifyBroadcaster> xMB;
Timer aUpdateTimer;
com::sun::star::uno::Sequence<
com::sun::star::lang::Locale > aAvailSpellLocales;
com::sun::star::uno::Sequence<
......@@ -139,6 +148,10 @@ class LngSvcMgr :
virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames );
virtual void Commit();
void UpdateAll();
void stopListening();
DECL_LINK( updateAndBroadcast, void* );
public:
LngSvcMgr();
virtual ~LngSvcMgr();
......@@ -166,6 +179,11 @@ public:
virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
// XEventListener
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rSource ) throw(::com::sun::star::uno::RuntimeException);
// XModifyListener
virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& rEvent ) throw(::com::sun::star::uno::RuntimeException);
static inline ::rtl::OUString getImplementationName_Static();
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment