summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/inc/classes/rootactiontriggercontainer.hxx11
-rw-r--r--framework/inc/helper/actiontriggerhelper.hxx2
-rw-r--r--framework/source/classes/rootactiontriggercontainer.cxx20
-rw-r--r--framework/source/helper/actiontriggerhelper.cxx5
-rw-r--r--linguistic/inc/iprcache.hxx67
-rw-r--r--linguistic/inc/lngprops.hxx6
-rw-r--r--linguistic/inc/misc.hxx3
-rw-r--r--linguistic/inc/spelldta.hxx32
-rw-r--r--linguistic/inc/supplang.hxx115
-rw-r--r--linguistic/qa/unoapi/knownissues.xcl3
-rw-r--r--linguistic/source/defs.hxx95
-rw-r--r--linguistic/source/dicimp.cxx19
-rw-r--r--linguistic/source/dicimp.hxx19
-rw-r--r--linguistic/source/dlistimp.cxx89
-rw-r--r--linguistic/source/dlistimp.hxx140
-rw-r--r--linguistic/source/gciterator.cxx524
-rw-r--r--linguistic/source/gciterator.hxx57
-rw-r--r--linguistic/source/hyphdsp.cxx187
-rw-r--r--linguistic/source/hyphdsp.hxx32
-rw-r--r--linguistic/source/iprcache.cxx294
-rw-r--r--linguistic/source/lngopt.cxx62
-rw-r--r--linguistic/source/lngopt.hxx126
-rw-r--r--linguistic/source/lngsvcmgr.cxx970
-rw-r--r--linguistic/source/lngsvcmgr.hxx116
-rw-r--r--linguistic/source/makefile.mk4
-rw-r--r--linguistic/source/misc.cxx28
-rw-r--r--linguistic/source/misc2.cxx2
-rw-r--r--linguistic/source/prophelp.cxx20
-rw-r--r--linguistic/source/spelldsp.cxx361
-rw-r--r--linguistic/source/spelldsp.hxx151
-rw-r--r--linguistic/source/spelldta.cxx21
-rw-r--r--linguistic/source/supplang.cxx161
-rw-r--r--linguistic/source/thesdsp.cxx75
-rw-r--r--linguistic/source/thesdsp.hxx42
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu5
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs161
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx12
-rw-r--r--scripting/source/dlgprov/dlgprov.hxx1
-rw-r--r--sfx2/inc/sfx2/sfxsids.hrc1
-rw-r--r--sfx2/inc/sfx2/viewsh.hxx2
-rw-r--r--sfx2/source/menu/mnumgr.cxx6
-rw-r--r--sfx2/source/view/viewsh.cxx4
-rw-r--r--svx/inc/editstat.hxx2
-rw-r--r--svx/inc/helpid.hrc4
-rw-r--r--svx/inc/svx/SpellDialogChildWindow.hxx9
-rw-r--r--svx/inc/svx/SpellPortions.hxx19
-rw-r--r--svx/inc/svx/editeng.hxx2
-rw-r--r--svx/inc/svx/optlingu.hxx7
-rw-r--r--svx/inc/svx/outliner.hxx2
-rw-r--r--svx/inc/svx/splwrap.hxx4
-rw-r--r--svx/inc/svx/svxdlg.hxx3
-rw-r--r--svx/inc/svx/svxids.hrc3
-rw-r--r--svx/inc/unolingu.hxx23
-rw-r--r--svx/sdi/svx.sdi55
-rw-r--r--svx/source/dialog/SpellAttrib.hxx25
-rw-r--r--svx/source/dialog/SpellDialog.cxx209
-rw-r--r--svx/source/dialog/SpellDialog.hrc1
-rw-r--r--svx/source/dialog/SpellDialog.src12
-rw-r--r--svx/source/dialog/SpellDialogChildWindow.cxx22
-rw-r--r--svx/source/dialog/dlgfact.cxx2
-rw-r--r--svx/source/dialog/dlgfact.hxx2
-rw-r--r--svx/source/dialog/optdict.cxx30
-rw-r--r--svx/source/dialog/optdict.hxx7
-rw-r--r--svx/source/dialog/splwrap.cxx13
-rw-r--r--svx/source/dialog/treeopt.cxx33
-rw-r--r--svx/source/editeng/editeng.cxx11
-rw-r--r--svx/source/editeng/editstt2.hxx3
-rw-r--r--svx/source/editeng/editview.cxx7
-rw-r--r--svx/source/editeng/impedit.cxx3
-rw-r--r--svx/source/editeng/impedit.hxx2
-rw-r--r--svx/source/editeng/impedit3.cxx2
-rw-r--r--svx/source/editeng/impedit4.cxx16
-rw-r--r--svx/source/editeng/unolingu.cxx235
-rw-r--r--svx/source/inc/SpellDialog.hxx3
-rw-r--r--svx/source/options/optlingu.cxx305
-rw-r--r--svx/source/options/optlingu.hrc3
-rw-r--r--svx/source/options/optlingu.src12
-rw-r--r--svx/source/outliner/outlin2.cxx7
-rw-r--r--svx/source/svdraw/svdotext.cxx3
-rw-r--r--svx/uiconfig/layout/delzip1
-rw-r--r--svx/uiconfig/layout/layout.mk33
-rw-r--r--svx/uiconfig/layout/makefile.mk50
-rw-r--r--svx/uiconfig/layout/zoom.xml59
-rw-r--r--svx/util/hidother.src1
84 files changed, 2333 insertions, 2963 deletions
diff --git a/framework/inc/classes/rootactiontriggercontainer.hxx b/framework/inc/classes/rootactiontriggercontainer.hxx
index 924089fd3596..70e00d09033e 100644
--- a/framework/inc/classes/rootactiontriggercontainer.hxx
+++ b/framework/inc/classes/rootactiontriggercontainer.hxx
@@ -33,6 +33,7 @@
#include <helper/propertysetcontainer.hxx>
#include <vcl/menu.hxx>
+#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -48,10 +49,11 @@ class RootActionTriggerContainer : public PropertySetContainer,
public com::sun::star::lang::XMultiServiceFactory,
public com::sun::star::lang::XServiceInfo,
public com::sun::star::lang::XUnoTunnel,
- public com::sun::star::lang::XTypeProvider
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::container::XNamed
{
public:
- RootActionTriggerContainer( const Menu* pMenu, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
+ RootActionTriggerContainer( const Menu* pMenu, const ::rtl::OUString* pMenuIdentifier, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
virtual ~RootActionTriggerContainer();
const Menu* GetMenu();
@@ -109,6 +111,10 @@ class RootActionTriggerContainer : public PropertySetContainer,
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
+
private:
void FillContainer();
@@ -116,6 +122,7 @@ class RootActionTriggerContainer : public PropertySetContainer,
sal_Bool m_bContainerChanged;
sal_Bool m_bInContainerCreation;
const Menu* m_pMenu;
+ const ::rtl::OUString* m_pMenuIdentifier;
};
}
diff --git a/framework/inc/helper/actiontriggerhelper.hxx b/framework/inc/helper/actiontriggerhelper.hxx
index b684335d9f0f..76ae24a70a89 100644
--- a/framework/inc/helper/actiontriggerhelper.hxx
+++ b/framework/inc/helper/actiontriggerhelper.hxx
@@ -64,7 +64,7 @@ namespace framework
// #110897#
static com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > CreateActionTriggerContainerFromMenu(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- const Menu* pMenu );
+ const Menu* pMenu, const ::rtl::OUString* pMenuIdentifier );
// Fills the submitted rActionTriggerContainer with the structure of the menu
// provided as the second parameter
diff --git a/framework/source/classes/rootactiontriggercontainer.cxx b/framework/source/classes/rootactiontriggercontainer.cxx
index 3d2dab60ccdb..09ae494c00f4 100644
--- a/framework/source/classes/rootactiontriggercontainer.cxx
+++ b/framework/source/classes/rootactiontriggercontainer.cxx
@@ -60,12 +60,13 @@ static Sequence< sal_Int8 > impl_getStaticIdentifier()
}
-RootActionTriggerContainer::RootActionTriggerContainer( const Menu* pMenu, const Reference< XMultiServiceFactory >& rServiceManager ) :
+RootActionTriggerContainer::RootActionTriggerContainer( const Menu* pMenu, const ::rtl::OUString* pMenuIdentifier, const Reference< XMultiServiceFactory >& rServiceManager ) :
PropertySetContainer( rServiceManager )
, m_bContainerCreated( sal_False )
, m_bContainerChanged( sal_False )
, m_bInContainerCreation( sal_False )
, m_pMenu( pMenu )
+ , m_pMenuIdentifier( pMenuIdentifier )
{
}
@@ -106,7 +107,8 @@ throw ( RuntimeException )
SAL_STATIC_CAST( XMultiServiceFactory* , this ),
SAL_STATIC_CAST( XServiceInfo* , this ),
SAL_STATIC_CAST( XUnoTunnel* , this ),
- SAL_STATIC_CAST( XTypeProvider* , this ));
+ SAL_STATIC_CAST( XTypeProvider* , this ),
+ SAL_STATIC_CAST( XNamed* , this ));
if( a.hasValue() )
{
@@ -314,7 +316,8 @@ Sequence< Type > SAL_CALL RootActionTriggerContainer::getTypes() throw ( Runtime
::getCppuType(( const Reference< XIndexReplace >*)NULL ) ,
::getCppuType(( const Reference< XServiceInfo >*)NULL ) ,
::getCppuType(( const Reference< XTypeProvider >*)NULL ) ,
- ::getCppuType(( const Reference< XUnoTunnel >*)NULL ) ) ;
+ ::getCppuType(( const Reference< XUnoTunnel >*)NULL ) ,
+ ::getCppuType(( const Reference< XNamed >*)NULL )) ;
// ... and set his address to static pointer!
pTypeCollection = &aTypeCollection ;
@@ -363,6 +366,17 @@ void RootActionTriggerContainer::FillContainer()
m_pMenu );
m_bInContainerCreation = sal_False;
}
+::rtl::OUString RootActionTriggerContainer::getName() throw ( RuntimeException )
+{
+ ::rtl::OUString sRet;
+ if( m_pMenuIdentifier )
+ sRet = *m_pMenuIdentifier;
+ return sRet;
+}
+void RootActionTriggerContainer::setName( const ::rtl::OUString& ) throw ( RuntimeException)
+{
+ throw RuntimeException();
+}
}
diff --git a/framework/source/helper/actiontriggerhelper.cxx b/framework/source/helper/actiontriggerhelper.cxx
index c04eba5fa3a1..15977c777f1e 100644
--- a/framework/source/helper/actiontriggerhelper.cxx
+++ b/framework/source/helper/actiontriggerhelper.cxx
@@ -404,9 +404,10 @@ void ActionTriggerHelper::FillActionTriggerContainerFromMenu(
Reference< XIndexContainer > ActionTriggerHelper::CreateActionTriggerContainerFromMenu(
// #110897#
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
- const Menu* pMenu )
+ const Menu* pMenu,
+ const ::rtl::OUString* pMenuIdentifier )
{
- return new RootActionTriggerContainer( pMenu, xServiceFactory );
+ return new RootActionTriggerContainer( pMenu, pMenuIdentifier, xServiceFactory );
}
}
diff --git a/linguistic/inc/iprcache.hxx b/linguistic/inc/iprcache.hxx
index d0be97480749..0b6fdaad2547 100644
--- a/linguistic/inc/iprcache.hxx
+++ b/linguistic/inc/iprcache.hxx
@@ -32,24 +32,25 @@
#define _LINGUISTIC_IPRCACHE_HXX_
-#include <com/sun/star/uno/Reference.h>
-
#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
#include <cppuhelper/implbase2.hxx> // helper for implementations
+
+#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/document/XEventListener.hpp>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-
#include <com/sun/star/linguistic2/XDictionaryListEventListener.hpp>
#include <com/sun/star/linguistic2/XDictionaryList.hpp>
-#include <tools/string.hxx>
+#include <rtl/string.hxx>
+#include <i18npool/lang.h>
+
+#include <set>
+#include <map>
namespace linguistic
{
-class IPRCachedWord;
-
///////////////////////////////////////////////////////////////////////////
class Flushable
@@ -83,33 +84,22 @@ public:
inline void SetFlushObj( Flushable *pFO) { pFlushObj = pFO; }
- void SetDicList(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryList > &rDL );
- void SetPropSet(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet > &rPS );
+ void SetDicList( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryList > &rDL );
+ void SetPropSet( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &rPS );
//XEventListener
- virtual void SAL_CALL
- disposing( const ::com::sun::star::lang::EventObject& rSource )
- throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rSource ) throw(::com::sun::star::uno::RuntimeException);
// XDictionaryListEventListener
- virtual void SAL_CALL
- processDictionaryListEvent(
- const ::com::sun::star::linguistic2::DictionaryListEvent& rDicListEvent )
- throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processDictionaryListEvent( const ::com::sun::star::linguistic2::DictionaryListEvent& rDicListEvent ) throw(::com::sun::star::uno::RuntimeException);
// XPropertyChangeListener
- virtual void SAL_CALL
- propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt )
- throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt ) throw(::com::sun::star::uno::RuntimeException);
};
///////////////////////////////////////////////////////////////////////////
-class IPRSpellCache :
+class SpellCache :
public Flushable
{
::com::sun::star::uno::Reference<
@@ -117,36 +107,23 @@ class IPRSpellCache :
xFlushLstnr;
FlushListener *pFlushLstnr;
- IPRCachedWord **ppHash;
- IPRCachedWord *pFirst;
- IPRCachedWord *pLast;
- IPRCachedWord *pRun;
- IPRCachedWord *pInput;
- ULONG nIndex;
- ULONG nCount;
- ULONG nInputPos;
- ULONG nInputValue;
- ULONG nTblSize;
-#ifdef DBG_STATISTIC
- ULONG nMaxInput;
- ULONG nMax;
- ULONG nFound;
- ULONG nLost;
-#endif
+ typedef std::set< ::rtl::OUString > WordList_t;
+ typedef std::map< LanguageType, WordList_t > LangWordList_t;
+ LangWordList_t aWordLists;
// don't allow to use copy-constructor and assignment-operator
- IPRSpellCache(const IPRSpellCache &);
- IPRSpellCache & operator = (const IPRSpellCache &);
+ SpellCache(const SpellCache &);
+ SpellCache & operator = (const SpellCache &);
public:
- IPRSpellCache( ULONG nSize );
- virtual ~IPRSpellCache();
+ SpellCache();
+ virtual ~SpellCache();
// Flushable
virtual void Flush();
- void AddWord( const String& rWord, INT16 nLang );
- BOOL CheckWord( const String& rWord, INT16 nLang, BOOL bAllLang );
+ void AddWord( const ::rtl::OUString& rWord, LanguageType nLang );
+ bool CheckWord( const ::rtl::OUString& rWord, LanguageType nLang );
};
///////////////////////////////////////////////////////////////////////////
diff --git a/linguistic/inc/lngprops.hxx b/linguistic/inc/lngprops.hxx
index 48948bdb1a38..2714c439d18e 100644
--- a/linguistic/inc/lngprops.hxx
+++ b/linguistic/inc/lngprops.hxx
@@ -40,7 +40,7 @@
// WIDs for property names
//!! Don't change values! They are used as the property handles in
//!! the service description
-#define WID_IS_GERMAN_PRE_REFORM UPH_IS_GERMAN_PRE_REFORM
+#define WID_IS_GERMAN_PRE_REFORM UPH_IS_GERMAN_PRE_REFORM /*! deprecated !*/
#define WID_IS_USE_DICTIONARY_LIST UPH_IS_USE_DICTIONARY_LIST
#define WID_IS_IGNORE_CONTROL_CHARACTERS UPH_IS_IGNORE_CONTROL_CHARACTERS
#define WID_IS_SPELL_UPPER_CASE UPH_IS_SPELL_UPPER_CASE
@@ -51,8 +51,8 @@
#define WID_HYPH_MIN_WORD_LENGTH UPH_HYPH_MIN_WORD_LENGTH
#define WID_DEFAULT_LOCALE UPH_DEFAULT_LOCALE
#define WID_IS_SPELL_AUTO UPH_IS_SPELL_AUTO
-#define WID_IS_SPELL_HIDE UPH_IS_SPELL_HIDE
-#define WID_IS_SPELL_IN_ALL_LANGUAGES UPH_IS_SPELL_IN_ALL_LANGUAGES
+#define WID_IS_SPELL_HIDE UPH_IS_SPELL_HIDE /*! deprecated !*/
+#define WID_IS_SPELL_IN_ALL_LANGUAGES UPH_IS_SPELL_IN_ALL_LANGUAGES /*! deprecated !*/
#define WID_IS_SPELL_SPECIAL UPH_IS_SPELL_SPECIAL
#define WID_IS_HYPH_AUTO UPH_IS_HYPH_AUTO
#define WID_IS_HYPH_SPECIAL UPH_IS_HYPH_SPECIAL
diff --git a/linguistic/inc/misc.hxx b/linguistic/inc/misc.hxx
index 55d9fadad387..f9565f2eb873 100644
--- a/linguistic/inc/misc.hxx
+++ b/linguistic/inc/misc.hxx
@@ -64,7 +64,8 @@ namespace com { namespace sun { namespace star { namespace frame {
class LocaleDataWrapper;
///////////////////////////////////////////////////////////////////////////
-#define SN_GRAMMARCHECKER "com.sun.star.linguistic2.GrammarChecker"
+#define SN_GRAMMARCHECKER "com.sun.star.linguistic2.Proofreader"
+#define SN_GRAMMARCHECKINGITERATOR "com.sun.star.linguistic2.ProofreadingIterator"
#define SN_SPELLCHECKER "com.sun.star.linguistic2.SpellChecker"
#define SN_HYPHENATOR "com.sun.star.linguistic2.Hyphenator"
#define SN_THESAURUS "com.sun.star.linguistic2.Thesaurus"
diff --git a/linguistic/inc/spelldta.hxx b/linguistic/inc/spelldta.hxx
index 356ac4edcd80..559a58e32348 100644
--- a/linguistic/inc/spelldta.hxx
+++ b/linguistic/inc/spelldta.hxx
@@ -33,11 +33,12 @@
#include <vector>
#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
+#include <com/sun/star/linguistic2/XSetSpellAlternatives.hpp>
#include <tools/solar.h>
#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
-#include <cppuhelper/implbase1.hxx> // helper for implementations
+#include <cppuhelper/implbase2.hxx>
namespace com { namespace sun { namespace star {
namespace linguistic2 {
@@ -86,9 +87,10 @@ void SearchSimilarText( const rtl::OUString &rText, INT16 nLanguage,
class SpellAlternatives :
- public cppu::WeakImplHelper1
+ public cppu::WeakImplHelper2
<
- ::com::sun::star::linguistic2::XSpellAlternatives
+ ::com::sun::star::linguistic2::XSpellAlternatives,
+ ::com::sun::star::linguistic2::XSetSpellAlternatives
>
{
::com::sun::star::uno::Sequence< ::rtl::OUString > aAlt; // list of alternatives, may be empty.
@@ -109,21 +111,15 @@ public:
virtual ~SpellAlternatives();
// XSpellAlternatives
- virtual ::rtl::OUString SAL_CALL
- getWord()
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::lang::Locale SAL_CALL
- getLocale()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL
- getFailureType()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL
- getAlternativesCount()
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- getAlternatives()
- throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getWord( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getFailureType( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getAlternativesCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAlternatives( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XSetSpellAlternatives
+ virtual void SAL_CALL setAlternatives( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aAlternatives ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFailureType( ::sal_Int16 nFailureType ) throw (::com::sun::star::uno::RuntimeException);
// non-interface specific functions
void SetWordLanguage(const ::rtl::OUString &rWord, INT16 nLang);
diff --git a/linguistic/inc/supplang.hxx b/linguistic/inc/supplang.hxx
deleted file mode 100644
index 1d13b3064e39..000000000000
--- a/linguistic/inc/supplang.hxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: supplang.hxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _LINGUISTIC_SUPPLANG_HXX_
-#define _LINGUISTIC_SUPPLANG_HXX_
-
-#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
-#include <cppuhelper/implbase1.hxx> // helper for implementations
-
-
-#include <osl/mutex.hxx>
-#include <tools/string.hxx>
-#include <tools/table.hxx>
-#include <vcl/svapp.hxx>
-#include <osl/thread.h>
-#include <unotools/charclass.hxx>
-
-#include <com/sun/star/uno/Sequence.h>
-#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/beans/PropertyValues.hpp>
-#include <com/sun/star/frame/XTerminateListener.hpp>
-#include <com/sun/star/beans/PropertyValues.hpp>
-#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/linguistic2/XDictionaryEntry.hpp>
-#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
-
-namespace com { namespace sun { namespace star { namespace beans {
- class XPropertySet;
- class XFastPropertySet;
-}}}}
-
-namespace com { namespace sun { namespace star { namespace frame {
- class XDesktop;
-}}}}
-
-
-namespace linguistic
-{
-
-///////////////////////////////////////////////////////////////////////////
-
-// defines for actual state (availability) of languages
-#define LANG_NOT_AVAIL ((short) 0x0303)
-#define LANG_QUERY ((short) 0x5555)
-#define LANG_FAILED ((short) 0)
-#define LANG_OK ((short) 1)
-
-enum ModuleName { MOD_SPELL, MOD_HYPH, MOD_THES };
-
-struct LanguageState
-{
- INT16 nLanguage;
- INT16 nSpellState;
- INT16 nHyphState;
- INT16 nThesState;
-
- INT16 & GetState( ModuleName eModule );
-};
-
-LanguageState * GetLanguageState( INT16 nLanguage, LanguageState *pArray );
-
-///////////////////////////////////////////////////////////////////////////
-
-DECLARE_TABLE( SuppLangTable, INT16 * )
-
-class SuppLanguages
-{
- SuppLangTable aLanguages;
-
-protected:
- virtual INT16 CheckLanguage( INT16 nLanguage ) const = 0;
-
-public:
- SuppLanguages( LanguageState *pState, USHORT nCount );
- virtual ~SuppLanguages();
-
- BOOL HasLanguage( INT16 nLanguage ) const;
- const com::sun::star::uno::Sequence< INT16 >
- GetLanguages() const;
-};
-
-///////////////////////////////////////////////////////////////////////////
-
-} // namespace linguistic
-
-#endif
-
diff --git a/linguistic/qa/unoapi/knownissues.xcl b/linguistic/qa/unoapi/knownissues.xcl
index da4b986e54ee..a809c0f1557f 100644
--- a/linguistic/qa/unoapi/knownissues.xcl
+++ b/linguistic/qa/unoapi/knownissues.xcl
@@ -5,4 +5,5 @@ lng.LngSvcMgr
### i88538 ###
lng.DicList::com::sun::star::linguistic2::XSearchableDictionaryList
-
+### i96846 ###
+lng.LinguProperties::com::sun::star::linguistic2::LinguProperties
diff --git a/linguistic/source/defs.hxx b/linguistic/source/defs.hxx
index 08f5397a0681..ca3a611c30ee 100644
--- a/linguistic/source/defs.hxx
+++ b/linguistic/source/defs.hxx
@@ -31,42 +31,99 @@
#ifndef _LINGUISTIC_DEFS_HXX_
#define _LINGUISTIC_DEFS_HXX_
+#include <com/sun/star/linguistic2/XSpellChecker.hpp>
+#include <com/sun/star/linguistic2/XProofreader.hpp>
+#include <com/sun/star/linguistic2/XHyphenator.hpp>
+#include <com/sun/star/linguistic2/XThesaurus.hpp>
+
///////////////////////////////////////////////////////////////////////////
#define A2OU(x) ::rtl::OUString::createFromAscii( x )
+namespace css = ::com::sun::star;
+
///////////////////////////////////////////////////////////////////////////
-struct SvcFlags
+struct LangSvcEntries
{
- INT16 nLastTriedSvcIndex; // index in sequence of the last
- // service tried to instantiate
- // (used for cascading)
- BOOL bAlreadyWarned : 1;
- BOOL bDoWarnAgain : 1;
-
- SvcFlags() :
- nLastTriedSvcIndex(-1), bAlreadyWarned(FALSE), bDoWarnAgain(FALSE)
+ css::uno::Sequence< ::rtl::OUString > aSvcImplNames;
+
+ sal_Int16 nLastTriedSvcIndex;
+ bool bAlreadyWarned;
+ bool bDoWarnAgain;
+
+ LangSvcEntries() : nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false) {}
+
+ inline LangSvcEntries( const css::uno::Sequence< ::rtl::OUString > &rSvcImplNames ) :
+ aSvcImplNames(rSvcImplNames),
+ nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false)
+ {
+ }
+
+ inline LangSvcEntries( const ::rtl::OUString &rSvcImplName ) :
+ nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false)
{
+ aSvcImplNames.realloc(1);
+ aSvcImplNames[0] = rSvcImplName;
+ }
+
+ bool IsAlreadyWarned() const { return bAlreadyWarned != 0; }
+ void SetAlreadyWarned( bool bVal ) { bAlreadyWarned = 0 != bVal; }
+ bool IsDoWarnAgain() const { return bDoWarnAgain != 0; }
+ void SetDoWarnAgain( bool bVal ) { bDoWarnAgain = 0 != bVal; }
+
+ inline void Clear()
+ {
+ aSvcImplNames.realloc(0);
+ nLastTriedSvcIndex = -1;
+ bAlreadyWarned = false;
+ bDoWarnAgain = false;
}
};
+struct LangSvcEntries_Spell : public LangSvcEntries
+{
+ css::uno::Sequence< css::uno::Reference< css::linguistic2::XSpellChecker > > aSvcRefs;
+
+ LangSvcEntries_Spell() : LangSvcEntries() {}
+ LangSvcEntries_Spell( const css::uno::Sequence< ::rtl::OUString > &rSvcImplNames ) : LangSvcEntries( rSvcImplNames ) {}
+};
+
+struct LangSvcEntries_Grammar : public LangSvcEntries
+{
+ css::uno::Sequence< css::uno::Reference< css::linguistic2::XProofreader > > aSvcRefs;
+
+ LangSvcEntries_Grammar() : LangSvcEntries() {}
+ LangSvcEntries_Grammar( const ::rtl::OUString &rSvcImplName ) : LangSvcEntries( rSvcImplName ) {}
+};
+
+struct LangSvcEntries_Hyph : public LangSvcEntries
+{
+ css::uno::Sequence< css::uno::Reference< css::linguistic2::XHyphenator > > aSvcRefs;
+
+ LangSvcEntries_Hyph() : LangSvcEntries() {}
+ LangSvcEntries_Hyph( const ::rtl::OUString &rSvcImplName ) : LangSvcEntries( rSvcImplName ) {}
+};
+
+struct LangSvcEntries_Thes : public LangSvcEntries
+{
+ css::uno::Sequence< css::uno::Reference< css::linguistic2::XThesaurus > > aSvcRefs;
+
+ LangSvcEntries_Thes() : LangSvcEntries() {}
+ LangSvcEntries_Thes( const css::uno::Sequence< ::rtl::OUString > &rSvcImplNames ) : LangSvcEntries( rSvcImplNames ) {}
+};
+
///////////////////////////////////////////////////////////////////////////
// virtual base class for the different dispatchers
class LinguDispatcher
{
public:
- enum DspType { DSP_SPELL, DSP_HYPH, DSP_THES };
-
- virtual void
- SetServiceList( const ::com::sun::star::lang::Locale &rLocale,
- const ::com::sun::star::uno::Sequence<
- rtl::OUString > &rSvcImplNames ) = 0;
- virtual ::com::sun::star::uno::Sequence< rtl::OUString >
- GetServiceList( const ::com::sun::star::lang::Locale &rLocale ) const = 0;
- virtual DspType
- GetDspType() const = 0;
+ enum DspType { DSP_SPELL, DSP_HYPH, DSP_THES, DSP_GRAMMAR };
+
+ virtual void SetServiceList( const css::lang::Locale &rLocale, const css::uno::Sequence< rtl::OUString > &rSvcImplNames ) = 0;
+ virtual css::uno::Sequence< rtl::OUString > GetServiceList( const css::lang::Locale &rLocale ) const = 0;
+ virtual DspType GetDspType() const = 0;
};
///////////////////////////////////////////////////////////////////////////
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 390603a6564c..1555fd3df4d7 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -805,7 +805,7 @@ sal_Bool SAL_CALL DictionaryNeo::isActive( )
return bIsActive;
}
-sal_Int16 SAL_CALL DictionaryNeo::getCount( )
+sal_Int32 SAL_CALL DictionaryNeo::getCount( )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -827,21 +827,7 @@ void SAL_CALL DictionaryNeo::setLocale( const Locale& aLocale )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- setLanguage( LocaleToLanguage( aLocale ) );
-}
-
-sal_Int16 SAL_CALL DictionaryNeo::getLanguage( )
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
- return nLanguage;
-}
-
-void SAL_CALL DictionaryNeo::setLanguage( sal_Int16 nLanguageP )
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
-
+ INT16 nLanguageP = LocaleToLanguage( aLocale );
if (!bIsReadonly && nLanguage != nLanguageP)
{
nLanguage = nLanguageP;
@@ -851,7 +837,6 @@ void SAL_CALL DictionaryNeo::setLanguage( sal_Int16 nLanguageP )
}
}
-
uno::Reference< XDictionaryEntry > SAL_CALL DictionaryNeo::getEntry(
const OUString& aWord )
throw(RuntimeException)
diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx
index a38ef005fc9f..52eada08c486 100644
--- a/linguistic/source/dicimp.hxx
+++ b/linguistic/source/dicimp.hxx
@@ -31,13 +31,12 @@
#ifndef _LINGUISTIC_DICIMP_HXX_
#define _LINGUISTIC_DICIMP_HXX_
-#include <com/sun/star/linguistic2/XDictionary1.hpp>
#include <com/sun/star/linguistic2/XDictionary.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
-#include <cppuhelper/implbase3.hxx> // helper for implementations
+#include <cppuhelper/implbase2.hxx> // helper for implementations
#include <cppuhelper/implbase1.hxx> // helper for implementations
#include <cppuhelper/interfacecontainer.h>
#include <tools/string.hxx>
@@ -48,7 +47,7 @@
///////////////////////////////////////////////////////////////////////////
-#define DIC_MAX_ENTRIES 2000
+#define DIC_MAX_ENTRIES 30000
INT16 ReadDicVersion( SvStream *pStream, USHORT &nLng, BOOL &bNeg );
const String GetDicExtension();
@@ -56,9 +55,8 @@ const String GetDicExtension();
///////////////////////////////////////////////////////////////////////////
class DictionaryNeo :
- public ::cppu::WeakImplHelper3
+ public ::cppu::WeakImplHelper2
<
- ::com::sun::star::linguistic2::XDictionary1,
::com::sun::star::linguistic2::XDictionary,
::com::sun::star::frame::XStorable
>
@@ -116,15 +114,6 @@ public:
setName( const ::rtl::OUString& aName )
throw(::com::sun::star::uno::RuntimeException);
- // XDictionary1 (same as XDictionary but for sal_Int16 as language)
- // only the different ones are listed
- virtual sal_Int16 SAL_CALL
- getLanguage()
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- setLanguage( sal_Int16 nLang )
- throw(::com::sun::star::uno::RuntimeException);
-
// XDictionary
virtual ::com::sun::star::linguistic2::DictionaryType SAL_CALL
getDictionaryType()
@@ -135,7 +124,7 @@ public:
virtual sal_Bool SAL_CALL
isActive()
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL
+ virtual sal_Int32 SAL_CALL
getCount()
throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::lang::Locale SAL_CALL
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 455034f36b94..4da58e270991 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -63,10 +63,6 @@ using namespace linguistic;
///////////////////////////////////////////////////////////////////////////
-SV_IMPL_OBJARR(ActDicArray, ActDic);
-
-///////////////////////////////////////////////////////////////////////////
-
static BOOL IsVers2OrNewer( const String& rFileURL, USHORT& nLng, BOOL& bNeg );
static void AddInternal( const uno::Reference< XDictionary > &rDic,
@@ -303,12 +299,12 @@ void DicList::MyAppExitListener::AtExit()
DicList::DicList() :
- aEvtListeners ( GetLinguMutex() ),
- pDicList( 0 )
+ aEvtListeners ( GetLinguMutex() )
{
pDicEvtLstnrHelper = new DicEvtListenerHelper( this );
xDicEvtLstnrHelper = pDicEvtLstnrHelper;
bDisposing = FALSE;
+ bInCreation = FALSE;
pExitListener = new MyAppExitListener( *this );
xExitListener = pExitListener;
@@ -318,12 +314,11 @@ DicList::DicList() :
DicList::~DicList()
{
pExitListener->Deactivate();
- delete pDicList;
}
-void DicList::searchForDictionaries(
- ActDicArray &rDicList,
+void DicList::SearchForDictionaries(
+ DictionaryVec_t&rDicList,
const String &rDicDirURL,
BOOL bIsWriteablePath )
{
@@ -366,11 +361,11 @@ void DicList::searchForDictionaries(
if (STRING_NOTFOUND != nPos)
aTmp1 = aTmp1.Copy( nPos + 1 );
String aTmp2;
- USHORT j;
- USHORT nCount = rDicList.Count();
+ size_t j;
+ size_t nCount = rDicList.size();
for(j = 0; j < nCount; j++)
{
- aTmp2 = rDicList.GetObject( j ).xDic->getName().getStr();
+ aTmp2 = rDicList[j]->getName().getStr();
aTmp2 = ToLower( aTmp2, nSystemLanguage );
if(aTmp1 == aTmp2)
break;
@@ -394,16 +389,16 @@ void DicList::searchForDictionaries(
}
-INT32 DicList::getDicPos(const uno::Reference< XDictionary > &xDic)
+INT32 DicList::GetDicPos(const uno::Reference< XDictionary > &xDic)
{
osl::MutexGuard aGuard( GetLinguMutex() );
INT32 nPos = -1;
- ActDicArray& rDicList = GetDicList();
- USHORT n = rDicList.Count();
- for (USHORT i = 0; i < n; i++)
+ DictionaryVec_t& rDicList = GetOrCreateDicList();
+ size_t n = rDicList.size();
+ for (size_t i = 0; i < n; i++)
{
- if ( rDicList.GetObject(i).xDic == xDic )
+ if ( rDicList[i] == xDic )
return i;
}
return nPos;
@@ -421,7 +416,7 @@ uno::Reference< XInterface > SAL_CALL
sal_Int16 SAL_CALL DicList::getCount() throw(RuntimeException)
{
osl::MutexGuard aGuard( GetLinguMutex() );
- return GetDicList().Count();
+ return static_cast< sal_Int16 >(GetOrCreateDicList().size());
}
uno::Sequence< uno::Reference< XDictionary > > SAL_CALL
@@ -430,14 +425,14 @@ uno::Sequence< uno::Reference< XDictionary > > SAL_CALL
{
osl::MutexGuard aGuard( GetLinguMutex() );
- ActDicArray& rDicList = GetDicList();
+ DictionaryVec_t& rDicList = GetOrCreateDicList();
- uno::Sequence< uno::Reference< XDictionary > > aDics( rDicList.Count() );
+ uno::Sequence< uno::Reference< XDictionary > > aDics( rDicList.size() );
uno::Reference< XDictionary > *pDic = aDics.getArray();
- USHORT n = (USHORT) aDics.getLength();
- for (USHORT i = 0; i < n; i++)
- pDic[i] = rDicList.GetObject(i).xDic;
+ INT32 n = (USHORT) aDics.getLength();
+ for (INT32 i = 0; i < n; i++)
+ pDic[i] = rDicList[i];
return aDics;
}
@@ -449,11 +444,11 @@ uno::Reference< XDictionary > SAL_CALL
osl::MutexGuard aGuard( GetLinguMutex() );
uno::Reference< XDictionary > xDic;
- ActDicArray& rDicList = GetDicList();
- USHORT nCount = rDicList.Count();
- for (USHORT i = 0; i < nCount; i++)
+ DictionaryVec_t& rDicList = GetOrCreateDicList();
+ size_t nCount = rDicList.size();
+ for (size_t i = 0; i < nCount; i++)
{
- const uno::Reference< XDictionary > &rDic = rDicList.GetObject(i).xDic;
+ const uno::Reference< XDictionary > &rDic = rDicList[i];
if (rDic.is() && rDic->getName() == aDictionaryName)
{
xDic = rDic;
@@ -476,8 +471,8 @@ sal_Bool SAL_CALL DicList::addDictionary(
BOOL bRes = FALSE;
if (xDictionary.is())
{
- ActDicArray& rDicList = GetDicList();
- rDicList.Insert( ActDic(xDictionary), rDicList.Count() );
+ DictionaryVec_t& rDicList = GetOrCreateDicList();
+ rDicList.push_back( xDictionary );
bRes = TRUE;
// add listener helper to the dictionaries listener lists
@@ -496,12 +491,12 @@ sal_Bool SAL_CALL
return FALSE;
BOOL bRes = FALSE;
- INT32 nPos = getDicPos( xDictionary );
+ INT32 nPos = GetDicPos( xDictionary );
if (nPos >= 0)
{
// remove dictionary list from the dictionaries listener lists
- ActDicArray& rDicList = GetDicList();
- uno::Reference< XDictionary > xDic( rDicList.GetObject( (USHORT) nPos ).xDic );
+ DictionaryVec_t& rDicList = GetOrCreateDicList();
+ uno::Reference< XDictionary > xDic( rDicList[ nPos ] );
DBG_ASSERT(xDic.is(), "lng : empty reference");
if (xDic.is())
{
@@ -511,7 +506,8 @@ sal_Bool SAL_CALL
xDic->removeDictionaryEventListener( xDicEvtLstnrHelper );
}
- rDicList.Remove( (USHORT) nPos );
+ // remove element at nPos
+ rDicList.erase( rDicList.begin() + nPos );
bRes = TRUE;
}
return bRes;
@@ -613,13 +609,13 @@ void SAL_CALL
pDicEvtLstnrHelper->DisposeAndClear( aEvtObj );
//! avoid creation of dictionaries if not already done
- if (pDicList)
+ if (aDicList.size() > 0)
{
- ActDicArray& rDicList = GetDicList();
- INT16 nCount = rDicList.Count();
- for (INT16 i = 0; i < nCount; i++)
+ DictionaryVec_t& rDicList = GetOrCreateDicList();
+ size_t nCount = rDicList.size();
+ for (size_t i = 0; i < nCount; i++)
{
- uno::Reference< XDictionary > xDic( rDicList.GetObject(i).xDic , UNO_QUERY );
+ uno::Reference< XDictionary > xDic( rDicList[i], UNO_QUERY );
// save (modified) dictionaries
uno::Reference< frame::XStorable > xStor( xDic , UNO_QUERY );
@@ -666,7 +662,7 @@ void SAL_CALL
void DicList::_CreateDicList()
{
- pDicList = new ActDicArray;
+ bInCreation = TRUE;
// look for dictionaries
const rtl::OUString aWriteablePath( GetDictionaryWriteablePath() );
@@ -675,7 +671,7 @@ void DicList::_CreateDicList()
for (sal_Int32 i = 0; i < aPaths.getLength(); ++i)
{
const BOOL bIsWriteablePath = (pPaths[i] == aWriteablePath);
- searchForDictionaries( *pDicList, pPaths[i], bIsWriteablePath );
+ SearchForDictionaries( aDicList, pPaths[i], bIsWriteablePath );
}
// create IgnoreAllList dictionary with empty URL (non persistent)
@@ -717,6 +713,8 @@ void DicList::_CreateDicList()
pDicEvtLstnrHelper->ClearEvents();
pDicEvtLstnrHelper->EndCollectEvents();
+
+ bInCreation = FALSE;
}
@@ -724,16 +722,15 @@ void DicList::SaveDics()
{
// save dics only if they have already been used/created.
//! don't create them just for the purpose of saving them !
- if (pDicList)
+ if (aDicList.size() > 0)
{
// save (modified) dictionaries
- ActDicArray& rDicList = GetDicList();
- USHORT nCount = rDicList.Count();;
- for (USHORT i = 0; i < nCount; i++)
+ DictionaryVec_t& rDicList = GetOrCreateDicList();
+ size_t nCount = rDicList.size();;
+ for (size_t i = 0; i < nCount; i++)
{
// save (modified) dictionaries
- uno::Reference< frame::XStorable > xStor( rDicList.GetObject(i).xDic,
- UNO_QUERY );
+ uno::Reference< frame::XStorable > xStor( rDicList[i], UNO_QUERY );
if (xStor.is())
{
try
diff --git a/linguistic/source/dlistimp.hxx b/linguistic/source/dlistimp.hxx
index e549d96e5f00..d6d2d7654f91 100644
--- a/linguistic/source/dlistimp.hxx
+++ b/linguistic/source/dlistimp.hxx
@@ -39,9 +39,11 @@
#include <cppuhelper/implbase1.hxx> // helper for implementations
#include <cppuhelper/implbase3.hxx> // helper for implementations
#include <cppuhelper/interfacecontainer.h>
-#include <svtools/svarray.hxx>
#include <tools/debug.hxx>
+#include <vector>
+#include <memory>
+
#include "misc.hxx"
#include "lngopt.hxx"
@@ -49,18 +51,6 @@ class DicEvtListenerHelper;
///////////////////////////////////////////////////////////////////////////
-class ActDic
-{
-public:
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > xDic;
-
- ActDic() {}
- ActDic(const ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > &rDic) : xDic(rDic) {}
-};
-SV_DECL_OBJARR( ActDicArray, ActDic, 16, 16 )
-
class DicList :
public cppu::WeakImplHelper3
<
@@ -81,7 +71,9 @@ class DicList :
LinguOptions aOpt;
::cppu::OInterfaceContainerHelper aEvtListeners;
- ActDicArray* pDicList;
+
+ typedef std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > > DictionaryVec_t;
+ DictionaryVec_t aDicList;
::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::
XDictionaryEventListener > xDicEvtLstnrHelper;
@@ -92,24 +84,25 @@ class DicList :
MyAppExitListener *pExitListener;
BOOL bDisposing;
+ BOOL bInCreation;
// disallow copy-constructor and assignment-operator for now
DicList( const DicList & );
DicList & operator = (const DicList &);
- void _CreateDicList();
- ActDicArray& GetDicList()
+ void _CreateDicList();
+ DictionaryVec_t & GetOrCreateDicList()
{
- if( !pDicList )
+ if (!bInCreation && aDicList.size() == 0)
_CreateDicList();
- return *pDicList;
+ return aDicList;
}
- void launchEvent(INT16 nEvent, com::sun::star::uno::Sequence<
+ void LaunchEvent(INT16 nEvent, com::sun::star::uno::Sequence<
::com::sun::star::linguistic2::XDictionary > xDic);
- void searchForDictionaries( ActDicArray &rDicList,
+ void SearchForDictionaries( DictionaryVec_t &rDicList,
const String &rDicDir, BOOL bIsWritePath );
- INT32 getDicPos(const com::sun::star::uno::Reference<
+ INT32 GetDicPos(const com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XDictionary > &xDic);
public:
@@ -117,95 +110,34 @@ public:
virtual ~DicList();
// XDictionaryList
- virtual sal_Int16 SAL_CALL
- getCount()
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > > SAL_CALL
- getDictionaries()
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > SAL_CALL
- getDictionaryByName( const ::rtl::OUString& aDictionaryName )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL
- addDictionary( const ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary >& xDictionary )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL
- removeDictionary( const ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary >& xDictionary )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL
- addDictionaryListEventListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryListEventListener >& xListener,
- sal_Bool bReceiveVerbose )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL
- removeDictionaryListEventListener(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryListEventListener >& xListener )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL
- beginCollectEvents()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL
- endCollectEvents()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL
- flushEvents()
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary > SAL_CALL
- createDictionary( const ::rtl::OUString& aName,
- const ::com::sun::star::lang::Locale& aLocale,
- ::com::sun::star::linguistic2::DictionaryType eDicType,
- const ::rtl::OUString& aURL )
- throw(::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > > SAL_CALL getDictionaries( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > SAL_CALL getDictionaryByName( const ::rtl::OUString& aDictionaryName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL addDictionary( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary >& xDictionary ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL removeDictionary( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary >& xDictionary ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL addDictionaryListEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryListEventListener >& xListener, ::sal_Bool bReceiveVerbose ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL removeDictionaryListEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryListEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL beginCollectEvents( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL endCollectEvents( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL flushEvents( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > SAL_CALL createDictionary( const ::rtl::OUString& aName, const ::com::sun::star::lang::Locale& aLocale, ::com::sun::star::linguistic2::DictionaryType eDicType, const ::rtl::OUString& aURL ) throw (::com::sun::star::uno::RuntimeException);
// XSearchableDictionaryList
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryEntry > SAL_CALL
- queryDictionaryEntry( const ::rtl::OUString& aWord,
- const ::com::sun::star::lang::Locale& aLocale,
- sal_Bool bSearchPosDics, sal_Bool bSpellEntry )
- throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryEntry > SAL_CALL queryDictionaryEntry( const ::rtl::OUString& aWord, const ::com::sun::star::lang::Locale& aLocale, sal_Bool bSearchPosDics, sal_Bool bSpellEntry ) throw(::com::sun::star::uno::RuntimeException);
// XComponent
- virtual void SAL_CALL
- dispose()
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- addEventListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener >& xListener )
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- removeEventListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener >& aListener )
- throw(::com::sun::star::uno::RuntimeException);
-
-
- ////////////////////////////////////////////////////////////
- // Service specific part
- //
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
// XServiceInfo
- virtual ::rtl::OUString SAL_CALL
- getImplementationName()
- throw(::com::sun::star::uno::RuntimeException);
- 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);
-
-
- static inline ::rtl::OUString
- getImplementationName_Static() throw();
- static com::sun::star::uno::Sequence< ::rtl::OUString >
- getSupportedServiceNames_Static() throw();
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ 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);
+
+
+ static inline ::rtl::OUString getImplementationName_Static() throw();
+ static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
// non UNO-specific
void SaveDics();
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index a22beb032c38..f1df871618f8 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -39,15 +39,17 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/linguistic2/XSupportedLocales.hpp>
-#include <com/sun/star/linguistic2/XGrammarChecker.hpp>
-#include <com/sun/star/linguistic2/XGrammarCheckingIterator.hpp>
-#include <com/sun/star/linguistic2/SingleGrammarError.hpp>
-#include <com/sun/star/linguistic2/GrammarCheckingResult.hpp>
+#include <com/sun/star/linguistic2/XProofreader.hpp>
+#include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
+#include <com/sun/star/linguistic2/SingleProofreadingError.hpp>
+#include <com/sun/star/linguistic2/ProofreadingResult.hpp>
#include <com/sun/star/linguistic2/LinguServiceEvent.hpp>
#include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/text/TextMarkupType.hpp>
+#include <com/sun/star/text/TextMarkupDescriptor.hpp>
#include <com/sun/star/text/XTextMarkup.hpp>
+#include <com/sun/star/text/XMultiTextMarkup.hpp>
#include <com/sun/star/text/XFlatParagraph.hpp>
#include <com/sun/star/text/XFlatParagraphIterator.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -76,6 +78,7 @@
#include "gciterator.hxx"
using ::rtl::OUString;
+using namespace linguistic;
using namespace ::com::sun::star;
// forward declarations
@@ -85,6 +88,149 @@ static uno::Sequence< OUString > GrammarCheckingIterator_getSupportedServiceName
//////////////////////////////////////////////////////////////////////
+// white space list: obtained from the fonts.config.txt of a Linux system.
+static sal_Unicode aWhiteSpaces[] =
+{
+ 0x0020, /* SPACE */
+ 0x00a0, /* NO-BREAK SPACE */
+ 0x00ad, /* SOFT HYPHEN */
+ 0x115f, /* HANGUL CHOSEONG FILLER */
+ 0x1160, /* HANGUL JUNGSEONG FILLER */
+ 0x1680, /* OGHAM SPACE MARK */
+ 0x2000, /* EN QUAD */
+ 0x2001, /* EM QUAD */
+ 0x2002, /* EN SPACE */
+ 0x2003, /* EM SPACE */
+ 0x2004, /* THREE-PER-EM SPACE */
+ 0x2005, /* FOUR-PER-EM SPACE */
+ 0x2006, /* SIX-PER-EM SPACE */
+ 0x2007, /* FIGURE SPACE */
+ 0x2008, /* PUNCTUATION SPACE */
+ 0x2009, /* THIN SPACE */
+ 0x200a, /* HAIR SPACE */
+ 0x200b, /* ZERO WIDTH SPACE */
+ 0x200c, /* ZERO WIDTH NON-JOINER */
+ 0x200d, /* ZERO WIDTH JOINER */
+ 0x200e, /* LEFT-TO-RIGHT MARK */
+ 0x200f, /* RIGHT-TO-LEFT MARK */
+ 0x2028, /* LINE SEPARATOR */
+ 0x2029, /* PARAGRAPH SEPARATOR */
+ 0x202a, /* LEFT-TO-RIGHT EMBEDDING */
+ 0x202b, /* RIGHT-TO-LEFT EMBEDDING */
+ 0x202c, /* POP DIRECTIONAL FORMATTING */
+ 0x202d, /* LEFT-TO-RIGHT OVERRIDE */
+ 0x202e, /* RIGHT-TO-LEFT OVERRIDE */
+ 0x202f, /* NARROW NO-BREAK SPACE */
+ 0x205f, /* MEDIUM MATHEMATICAL SPACE */
+ 0x2060, /* WORD JOINER */
+ 0x2061, /* FUNCTION APPLICATION */
+ 0x2062, /* INVISIBLE TIMES */
+ 0x2063, /* INVISIBLE SEPARATOR */
+ 0x206A, /* INHIBIT SYMMETRIC SWAPPING */
+ 0x206B, /* ACTIVATE SYMMETRIC SWAPPING */
+ 0x206C, /* INHIBIT ARABIC FORM SHAPING */
+ 0x206D, /* ACTIVATE ARABIC FORM SHAPING */
+ 0x206E, /* NATIONAL DIGIT SHAPES */
+ 0x206F, /* NOMINAL DIGIT SHAPES */
+ 0x3000, /* IDEOGRAPHIC SPACE */
+ 0x3164, /* HANGUL FILLER */
+ 0xfeff, /* ZERO WIDTH NO-BREAK SPACE */
+ 0xffa0, /* HALFWIDTH HANGUL FILLER */
+ 0xfff9, /* INTERLINEAR ANNOTATION ANCHOR */
+ 0xfffa, /* INTERLINEAR ANNOTATION SEPARATOR */
+ 0xfffb /* INTERLINEAR ANNOTATION TERMINATOR */
+};
+
+static int nWhiteSpaces = sizeof( aWhiteSpaces ) / sizeof( aWhiteSpaces[0] );
+
+static bool lcl_IsWhiteSpace( sal_Unicode cChar )
+{
+ bool bFound = false;
+ for (int i = 0; i < nWhiteSpaces && !bFound; ++i)
+ {
+ if (cChar == aWhiteSpaces[i])
+ bFound = true;
+ }
+ return bFound;
+}
+
+static sal_Int32 lcl_SkipWhiteSpaces( const OUString &rText, sal_Int32 nStartPos )
+{
+ // note having nStartPos point right behind the string is OK since that one
+ // is a correct end-of-sentence position to be returned from a grammar checker...
+
+ const sal_Int32 nLen = rText.getLength();
+ bool bIllegalArgument = false;
+ if (nStartPos < 0)
+ {
+ bIllegalArgument = true;
+ nStartPos = 0;
+ }
+ if (nStartPos > nLen)
+ {
+ bIllegalArgument = true;
+ nStartPos = nLen;
+ }
+ if (bIllegalArgument)
+ {
+ DBG_ASSERT( 0, "lcl_SkipWhiteSpaces: illegal arguments" );
+ }
+
+ sal_Int32 nRes = nStartPos;
+ if (0 <= nStartPos && nStartPos < nLen)
+ {
+ const sal_Unicode *pText = rText.getStr() + nStartPos;
+ while (nStartPos < nLen && lcl_IsWhiteSpace( *pText ))
+ ++pText;
+ nRes = pText - rText.getStr();
+ }
+
+ DBG_ASSERT( 0 <= nRes && nRes <= nLen, "lcl_SkipWhiteSpaces return value out of range" );
+ return nRes;
+}
+
+static sal_Int32 lcl_BacktraceWhiteSpaces( const OUString &rText, sal_Int32 nStartPos )
+{
+ // note having nStartPos point right behind the string is OK since that one
+ // is a correct end-of-sentence position to be returned from a grammar checker...
+
+ const sal_Int32 nLen = rText.getLength();
+ bool bIllegalArgument = false;
+ if (nStartPos < 0)
+ {
+ bIllegalArgument = true;
+ nStartPos = 0;
+ }
+ if (nStartPos > nLen)
+ {
+ bIllegalArgument = true;
+ nStartPos = nLen;
+ }
+ if (bIllegalArgument)
+ {
+ DBG_ASSERT( 0, "lcl_BacktraceWhiteSpaces: illegal arguments" );
+ }
+
+ sal_Int32 nRes = nStartPos;
+ sal_Int32 nPosBefore = nStartPos - 1;
+ const sal_Unicode *pStart = rText.getStr();
+ if (0 <= nPosBefore && nPosBefore < nLen && lcl_IsWhiteSpace( pStart[ nPosBefore ] ))
+ nStartPos = nPosBefore;
+ if (0 <= nStartPos && nStartPos < nLen)
+ {
+ const sal_Unicode *pText = rText.getStr() + nStartPos;
+ while (pText > pStart && lcl_IsWhiteSpace( *pText ))
+ --pText;
+ // now add 1 since we wnat to point to the first char after the last char in the sentence...
+ nRes = pText - pStart + 1;
+ }
+
+ DBG_ASSERT( 0 <= nRes && nRes <= nLen, "lcl_BacktraceWhiteSpaces return value out of range" );
+ return nRes;
+}
+
+//////////////////////////////////////////////////////////////////////
+
extern "C" void workerfunc (void * gci)
{
((GrammarCheckingIterator*)gci)->DequeueAndCheck();
@@ -133,13 +279,12 @@ void stopGrammarChecking ()
GrammarCheckingIterator::GrammarCheckingIterator( const uno::Reference< lang::XMultiServiceFactory > & rxMgr ) :
m_xMSF( rxMgr ),
m_bEnd( sal_False ),
+ m_aCurCheckedDocId(),
m_bGCServicesChecked( sal_False ),
m_nDocIdCounter( 0 ),
- m_nCurCheckedDocId( - 1 ),
m_nLastEndOfSentencePos( -1 ),
- m_aMutex(),
- m_aEventListeners( m_aMutex ),
- m_aNotifyListeners( m_aMutex )
+ m_aEventListeners( MyMutex::get() ),
+ m_aNotifyListeners( MyMutex::get() )
{
osl_createThread( workerfunc, this );
}
@@ -147,46 +292,47 @@ GrammarCheckingIterator::GrammarCheckingIterator( const uno::Reference< lang::XM
GrammarCheckingIterator::~GrammarCheckingIterator()
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
}
sal_Int32 GrammarCheckingIterator::NextDocId()
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
m_nDocIdCounter += 1;
return m_nDocIdCounter;
}
-sal_Int32 GrammarCheckingIterator::GetOrCreateDocId(
+OUString GrammarCheckingIterator::GetOrCreateDocId(
const uno::Reference< lang::XComponent > &xComponent )
{
// internal method; will always be called with locked mutex
- sal_Int32 nRes = -1;
+ OUString aRes;
if (xComponent.is())
{
- if (m_aDocIdMap.find( xComponent ) != m_aDocIdMap.end())
+ if (m_aDocIdMap.find( xComponent.get() ) != m_aDocIdMap.end())
{
- // add new entry
- nRes = m_aDocIdMap[ xComponent ];
- xComponent->addEventListener( this );
+ // return already existing entry
+ aRes = m_aDocIdMap[ xComponent.get() ];
}
- else // return already existing entry
+ else // add new entry
{
- nRes = NextDocId();
- m_aDocIdMap[ xComponent ] = nRes;
+ sal_Int32 nRes = NextDocId();
+ aRes = OUString::valueOf( nRes );
+ m_aDocIdMap[ xComponent.get() ] = aRes;
+ xComponent->addEventListener( this );
}
}
- return nRes;
+ return aRes;
}
void GrammarCheckingIterator::AddEntry(
uno::WeakReference< text::XFlatParagraphIterator > xFlatParaIterator,
uno::WeakReference< text::XFlatParagraph > xFlatPara,
- sal_Int32 nDocId,
+ const OUString & rDocId,
sal_Int32 nStartIndex,
sal_Bool bAutomatic )
{
@@ -198,12 +344,12 @@ void GrammarCheckingIterator::AddEntry(
FPEntry aNewFPEntry;
aNewFPEntry.m_xParaIterator = xFlatParaIterator;
aNewFPEntry.m_xPara = xFlatPara;
- aNewFPEntry.m_nDocId = nDocId;
+ aNewFPEntry.m_aDocId = rDocId;
aNewFPEntry.m_nStartIndex = nStartIndex;
aNewFPEntry.m_bAutomatic = bAutomatic;
// add new entry to the end of this queue
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
m_aFPEntriesQueue.push_back( aNewFPEntry );
// wake up the thread in order to do grammar checking
@@ -213,13 +359,12 @@ void GrammarCheckingIterator::AddEntry(
void GrammarCheckingIterator::ProcessResult(
- const linguistic2::GrammarCheckingResult &rRes,
- sal_Int32 nSentenceStartPos,
+ const linguistic2::ProofreadingResult &rRes,
const uno::Reference< text::XFlatParagraphIterator > &rxFlatParagraphIterator,
bool bIsAutomaticChecking )
{
DBG_ASSERT( rRes.xFlatParagraph.is(), "xFlatParagraph is missing" );
-
+ //no guard necessary as no members are used
sal_Bool bContinueWithNextPara = sal_False;
if (!rRes.xFlatParagraph.is() || rRes.xFlatParagraph->isModified())
{
@@ -228,38 +373,73 @@ void GrammarCheckingIterator::ProcessResult(
}
else // paragraph is still unchanged...
{
+ //
// mark found errors...
- bool bBoundariesOk = 0 <= nSentenceStartPos && nSentenceStartPos <= rRes.nEndOfSentencePos;
+ //
+
+ sal_Int32 nTextLen = rRes.aText.getLength();
+ bool bBoundariesOk = 0 <= rRes.nStartOfSentencePosition && rRes.nStartOfSentencePosition <= nTextLen &&
+ 0 <= rRes.nBehindEndOfSentencePosition && rRes.nBehindEndOfSentencePosition <= nTextLen &&
+ 0 <= rRes.nStartOfNextSentencePosition && rRes.nStartOfNextSentencePosition <= nTextLen &&
+ rRes.nStartOfSentencePosition <= rRes.nBehindEndOfSentencePosition &&
+ rRes.nBehindEndOfSentencePosition <= rRes.nStartOfNextSentencePosition;
+ (void) bBoundariesOk;
DBG_ASSERT( bBoundariesOk, "inconsistent sentence boundaries" );
- uno::Sequence< linguistic2::SingleGrammarError > aErrors = rRes.aGrammarErrors;
- if (aErrors.getLength() > 0 && bBoundariesOk)
+ 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
{
- for (sal_Int16 i = 0; i < aErrors.getLength(); ++i)
+ try
{
- linguistic2::SingleGrammarError aError = aErrors[aErrors.getLength() - 1 - i];
+ // length = number of found errors + 1 sentence markup
+ sal_Int32 nErrors = rRes.aErrors.getLength();
+ uno::Sequence< text::TextMarkupDescriptor > aDescriptors( nErrors + 1 );
+ text::TextMarkupDescriptor * pDescriptors = aDescriptors.getArray();
- OUString aIdentifier;
- uno::Reference< container::XStringKeyMap > xStringKeyMap;
+ // at pos 0 .. nErrors-1 -> all grammar errors
+ for (sal_Int32 i = 0; i < nErrors; ++i)
+ {
+ const linguistic2::SingleProofreadingError &rError = rRes.aErrors[i];
+ text::TextMarkupDescriptor &rDesc = aDescriptors[i];
+
+ rDesc.nType = rError.nErrorType;
+ rDesc.nOffset = rError.nErrorStart;
+ rDesc.nLength = rError.nErrorLength;
+
+ // the proofreader may return SPELLING but right now our core
+ // does only handle PROOFREADING if the result is from the proofreader...
+ // (later on we may wish to color spelling errors found by the proofreader
+ // differently for example. But no special handling right now.
+ if (rDesc.nType == text::TextMarkupType::SPELLCHECK)
+ rDesc.nType = text::TextMarkupType::PROOFREADING;
+ }
- // display the grammar error mark
- rRes.xFlatParagraph->commitTextMarkup( aError.nErrorType, aIdentifier, aError.nErrorStart, aError.nErrorLength, xStringKeyMap );
+ // at pos nErrors -> sentence markup
+ // nSentenceLength: includes the white-spaces following the sentence end...
+ const sal_Int32 nSentenceLength = rRes.nStartOfNextSentencePosition - rRes.nStartOfSentencePosition;
+ pDescriptors[ nErrors ].nType = text::TextMarkupType::SENTENCE;
+ pDescriptors[ nErrors ].nOffset = rRes.nStartOfSentencePosition;
+ pDescriptors[ nErrors ].nLength = nSentenceLength;
- // commit sentence markup to identify sentence boundaries
- const sal_Int32 nSentenceLength = rRes.nEndOfSentencePos - nSentenceStartPos;
- rRes.xFlatParagraph->commitTextMarkup( text::TextMarkupType::SENTENCE, aIdentifier, nSentenceStartPos, nSentenceLength, xStringKeyMap );
+ xMulti->commitMultiTextMarkup( aDescriptors ) ;
+ }
+ catch (lang::IllegalArgumentException &)
+ {
+ DBG_ERROR( "commitMultiTextMarkup: IllegalArgumentException exception caught" );
}
}
// other sentences left to be checked in this paragraph?
- if (rRes.nEndOfSentencePos < rRes.aText.getLength())
+ if (rRes.nStartOfNextSentencePosition < rRes.aText.getLength())
{
- AddEntry( rxFlatParagraphIterator, rRes.xFlatParagraph, rRes.nDocumentId, rRes.nEndOfSentencePos, bIsAutomaticChecking );
+ AddEntry( rxFlatParagraphIterator, rRes.xFlatParagraph, rRes.aDocumentIdentifier, rRes.nStartOfNextSentencePosition, bIsAutomaticChecking );
}
else // current paragraph finished
{
// set "already checked" flag for the current flat paragraph
if (rRes.xFlatParagraph.is())
- rRes.xFlatParagraph->setChecked( text::TextMarkupType::GRAMMAR, true );
+ rRes.xFlatParagraph->setChecked( text::TextMarkupType::PROOFREADING, true );
bContinueWithNextPara = sal_True;
}
@@ -272,27 +452,27 @@ void GrammarCheckingIterator::ProcessResult(
if (rxFlatParagraphIterator.is())
xFlatParaNext = rxFlatParagraphIterator->getNextPara();
{
- AddEntry( rxFlatParagraphIterator, xFlatParaNext, rRes.nDocumentId, 0, bIsAutomaticChecking );
+ AddEntry( rxFlatParagraphIterator, xFlatParaNext, rRes.aDocumentIdentifier, 0, bIsAutomaticChecking );
}
}
}
-uno::Reference< linguistic2::XGrammarChecker > GrammarCheckingIterator::GetGrammarChecker(
+uno::Reference< linguistic2::XProofreader > GrammarCheckingIterator::GetGrammarChecker(
const lang::Locale &rLocale )
{
(void) rLocale;
- uno::Reference< linguistic2::XGrammarChecker > xRes;
+ uno::Reference< linguistic2::XProofreader > xRes;
// ---- THREAD SAFE START ----
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
// check supported locales for each grammarchecker if not already done
if (!m_bGCServicesChecked)
{
//GetAvailableGCSvcs_Impl();
- //GetConfiguredGCSvcs_Impl();
- GetMatchingGCSvcs_Impl();
+ GetConfiguredGCSvcs_Impl();
+ //GetMatchingGCSvcs_Impl();
m_bGCServicesChecked = sal_True;
}
@@ -312,7 +492,7 @@ uno::Reference< linguistic2::XGrammarChecker > GrammarCheckingIterator::GetGramm
{
uno::Reference< lang::XMultiServiceFactory > xMgr(
utl::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- uno::Reference< linguistic2::XGrammarChecker > xGC(
+ uno::Reference< linguistic2::XProofreader > xGC(
xMgr->createInstance( aSvcImplName ), uno::UNO_QUERY_THROW );
uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xGC, uno::UNO_QUERY_THROW );
@@ -350,7 +530,7 @@ void GrammarCheckingIterator::DequeueAndCheck()
// ---- THREAD SAFE START ----
bool bEnd = false;
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
bEnd = m_bEnd;
}
// ---- THREAD SAFE END ----
@@ -359,7 +539,7 @@ void GrammarCheckingIterator::DequeueAndCheck()
// ---- THREAD SAFE START ----
bool bQueueEmpty = false;
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
bQueueEmpty = m_aFPEntriesQueue.empty();
}
// ---- THREAD SAFE END ----
@@ -369,16 +549,16 @@ void GrammarCheckingIterator::DequeueAndCheck()
uno::Reference< text::XFlatParagraphIterator > xFPIterator;
uno::Reference< text::XFlatParagraph > xFlatPara;
FPEntry aFPEntryItem;
- sal_Int32 nCurDocId = - 1;
+ OUString aCurDocId;
sal_Bool bModified = sal_False;
// ---- THREAD SAFE START ----
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
aFPEntryItem = m_aFPEntriesQueue.front();
xFPIterator = aFPEntryItem.m_xParaIterator;
xFlatPara = aFPEntryItem.m_xPara;
- m_nCurCheckedDocId = aFPEntryItem.m_nDocId;
- nCurDocId = m_nCurCheckedDocId;
+ m_aCurCheckedDocId = aFPEntryItem.m_aDocId;
+ aCurDocId = m_aCurCheckedDocId;
m_aFPEntriesQueue.pop_front();
}
@@ -393,33 +573,39 @@ void GrammarCheckingIterator::DequeueAndCheck()
if (!bModified)
{
// ---- THREAD SAFE START ----
- ::osl::ClearableGuard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::ClearableGuard< ::osl::Mutex > aGuard( MyMutex::get() );
sal_Int32 nStartPos = aFPEntryItem.m_nStartIndex;
sal_Int32 nSuggestedEnd = GetSuggestedEndOfSentence( aCurTxt, nStartPos, aCurLocale );
- linguistic2::GrammarCheckingResult aRes;
+ linguistic2::ProofreadingResult aRes;
- uno::Reference< linguistic2::XGrammarChecker > xGC( GetGrammarChecker( aCurLocale ), uno::UNO_QUERY );
+ uno::Reference< linguistic2::XProofreader > xGC( GetGrammarChecker( aCurLocale ), uno::UNO_QUERY );
if (xGC.is())
{
aGuard.clear();
- aRes = xGC->doGrammarChecking( nCurDocId, aCurTxt, aCurLocale, nStartPos, nSuggestedEnd, aLangPortions, aLangPortionsLocale );
+ uno::Sequence< beans::PropertyValue > aEmptyProps;
+ aRes = xGC->doProofreading( aCurDocId, aCurTxt, aCurLocale, nStartPos, nSuggestedEnd, aEmptyProps );
aRes.xFlatParagraph = xFlatPara;
- aRes.nStartOfSentencePos = nStartPos;
+ aRes.nStartOfSentencePosition = nStartPos;
}
else
{
// no grammar checker -> no error
// but we need to provide the data below in order to continue with the next sentence
- aRes.nDocumentId = nCurDocId;
+ aRes.aDocumentIdentifier = aCurDocId;
aRes.xFlatParagraph = xFlatPara;
aRes.aText = aCurTxt;
aRes.aLocale = aCurLocale;
- aRes.nStartOfSentencePos = nStartPos;
- aRes.nEndOfSentencePos = nSuggestedEnd;
+ aRes.nStartOfSentencePosition = nStartPos;
+ aRes.nBehindEndOfSentencePosition = nSuggestedEnd;
}
- ProcessResult( aRes, nStartPos, xFPIterator, aFPEntryItem.m_bAutomatic );
+ aRes.nStartOfNextSentencePosition = lcl_SkipWhiteSpaces( aCurTxt, aRes.nBehindEndOfSentencePosition );
+ aRes.nBehindEndOfSentencePosition = lcl_BacktraceWhiteSpaces( aCurTxt, aRes.nStartOfNextSentencePosition );
+
+ //guard has to be cleared as ProcessResult calls out of this class
+ aGuard.clear();
+ ProcessResult( aRes, xFPIterator, aFPEntryItem.m_bAutomatic );
// ---- THREAD SAFE END ----
}
else
@@ -427,14 +613,14 @@ void GrammarCheckingIterator::DequeueAndCheck()
// the paragraph changed meanwhile... (and maybe is still edited)
// thus we simply continue to ask for the next to be checked.
uno::Reference< text::XFlatParagraph > xFlatParaNext( xFPIterator->getNextPara() );
- AddEntry( xFPIterator, xFlatParaNext, nCurDocId, 0, aFPEntryItem.m_bAutomatic );
+ AddEntry( xFPIterator, xFlatParaNext, aCurDocId, 0, aFPEntryItem.m_bAutomatic );
}
}
// ---- THREAD SAFE START ----
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
- m_nCurCheckedDocId = -1;
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
+ m_aCurCheckedDocId = OUString();
}
// ---- THREAD SAFE END ----
}
@@ -442,7 +628,7 @@ void GrammarCheckingIterator::DequeueAndCheck()
{
// ---- THREAD SAFE START ----
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
// Check queue state again
if (m_aFPEntriesQueue.empty())
m_aWakeUpThread.reset();
@@ -459,7 +645,7 @@ void GrammarCheckingIterator::DequeueAndCheck()
// ---- THREAD SAFE START ----
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
bEnd = m_bEnd;
}
// ---- THREAD SAFE END ----
@@ -470,32 +656,32 @@ void GrammarCheckingIterator::DequeueAndCheck()
}
-void SAL_CALL GrammarCheckingIterator::startGrammarChecking(
+void SAL_CALL GrammarCheckingIterator::startProofreading(
const uno::Reference< ::uno::XInterface > & xDoc,
- const uno::Reference< text::XFlatParagraphIteratorProvider > & xIteratorProvider,
- sal_Bool bAutomatic)
+ const uno::Reference< text::XFlatParagraphIteratorProvider > & xIteratorProvider )
throw (uno::RuntimeException, lang::IllegalArgumentException)
{
// get paragraph to start checking with
+ const bool bAutomatic = true;
uno::Reference<text::XFlatParagraphIterator> xFPIterator = xIteratorProvider->getFlatParagraphIterator(
- text::TextMarkupType::GRAMMAR, bAutomatic );
+ text::TextMarkupType::PROOFREADING, bAutomatic );
uno::Reference< text::XFlatParagraph > xPara( xFPIterator.is()? xFPIterator->getFirstPara() : NULL );
uno::Reference< lang::XComponent > xComponent( xDoc, uno::UNO_QUERY );
// ---- THREAD SAFE START ----
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
if (xPara.is() && xComponent.is())
{
- sal_Int32 nDocId = GetOrCreateDocId( xComponent );
+ OUString aDocId = GetOrCreateDocId( xComponent );
// create new entry and add it to queue
- AddEntry( xFPIterator, xPara, nDocId, 0, bAutomatic );
+ AddEntry( xFPIterator, xPara, aDocId, 0, bAutomatic );
}
// ---- THREAD SAFE END ----
}
-linguistic2::GrammarCheckingResult SAL_CALL GrammarCheckingIterator::checkGrammarAtPos(
+linguistic2::ProofreadingResult SAL_CALL GrammarCheckingIterator::checkSentenceAtPosition(
const uno::Reference< uno::XInterface >& xDoc,
const uno::Reference< text::XFlatParagraph >& xFlatPara,
const OUString& rText,
@@ -509,30 +695,28 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
// for the context menu...
- linguistic2::GrammarCheckingResult aRes;
+ linguistic2::ProofreadingResult aRes;
uno::Reference< lang::XComponent > xComponent( xDoc, uno::UNO_QUERY );
if (xFlatPara.is() && xComponent.is() &&
( nErrorPosInPara < 0 || nErrorPosInPara < rText.getLength()))
{
- uno::Sequence< sal_Int32 > aLangPortions;
- uno::Sequence< lang::Locale > aLangPortionsLocale;
-
// iterate through paragraph until we find the sentence we are interested in
- linguistic2::GrammarCheckingResult aTmpRes;
- sal_Int32 nStartPos = nErrorPosInPara > 0 ? 0 : nStartOfSentencePos;
+ linguistic2::ProofreadingResult aTmpRes;
+ sal_Int32 nStartPos = nStartOfSentencePos >= 0 ? nStartOfSentencePos : 0;
+
bool bFound = false;
do
{
lang::Locale aCurLocale = lcl_GetPrimaryLanguageOfSentence( xFlatPara, nStartPos );
sal_Int32 nOldStartOfSentencePos = nStartPos;
- uno::Reference< linguistic2::XGrammarChecker > xGC;
- sal_Int32 nDocId = -1;
+ uno::Reference< linguistic2::XProofreader > xGC;
+ OUString aDocId;
// ---- THREAD SAFE START ----
{
- ::osl::ClearableGuard< ::osl::Mutex > aGuard( m_aMutex );
- nDocId = GetOrCreateDocId( xComponent );
+ ::osl::ClearableGuard< ::osl::Mutex > aGuard( MyMutex::get() );
+ aDocId = GetOrCreateDocId( xComponent );
nSuggestedEndOfSentencePos = GetSuggestedEndOfSentence( rText, nStartPos, aCurLocale );
xGC = GetGrammarChecker( aCurLocale );
@@ -541,17 +725,21 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
sal_Int32 nEndPos = -1;
if (xGC.is())
{
- aTmpRes = xGC->doGrammarChecking( nDocId, rText, aCurLocale, nStartPos, nSuggestedEndOfSentencePos, aLangPortions, aLangPortionsLocale );
- aTmpRes.xFlatParagraph = xFlatPara;
- aTmpRes.nStartOfSentencePos = nStartPos;
- nEndPos = aTmpRes.nEndOfSentencePos;
+ uno::Sequence< beans::PropertyValue > aEmptyProps;
+ aTmpRes = xGC->doProofreading( aDocId, rText, aCurLocale, nStartPos, nSuggestedEndOfSentencePos, aEmptyProps );
+ aTmpRes.xFlatParagraph = xFlatPara;
+ aTmpRes.nStartOfSentencePosition = nStartPos;
+ nEndPos = aTmpRes.nBehindEndOfSentencePosition;
if ((nErrorPosInPara< 0 || nStartPos <= nErrorPosInPara) && nErrorPosInPara < nEndPos)
bFound = true;
}
if (nEndPos == -1) // no result from grammar checker
nEndPos = nSuggestedEndOfSentencePos;
- nStartPos = nEndPos;
+ nStartPos = lcl_SkipWhiteSpaces( rText, nEndPos );
+ aTmpRes.nBehindEndOfSentencePosition = nEndPos;
+ aTmpRes.nStartOfNextSentencePosition = nStartPos;
+ aTmpRes.nBehindEndOfSentencePosition = lcl_BacktraceWhiteSpaces( rText, aTmpRes.nStartOfNextSentencePosition );
// prevent endless loop by forcefully advancing if needs be...
if (nStartPos <= nOldStartOfSentencePos)
@@ -592,6 +780,9 @@ sal_Int32 GrammarCheckingIterator::GetSuggestedEndOfSentence(
nEndPosition = nTextLen;
if (nTmpStartPos < nTextLen)
nEndPosition = m_xBreakIterator->endOfSentence( rText, nTmpStartPos, rLocale );
+ if (nEndPosition < 0)
+ nEndPosition = nTextLen;
+
++nTmpStartPos;
}
while (nEndPosition <= nSentenceStartPos && nEndPosition < nTextLen);
@@ -602,42 +793,57 @@ sal_Int32 GrammarCheckingIterator::GetSuggestedEndOfSentence(
}
-sal_Int32 SAL_CALL GrammarCheckingIterator::getEndOfSentence(
- const uno::Reference< text::XFlatParagraph >& xFlatPara,
- sal_Int32 nSentenceStartPos )
-throw (lang::IllegalArgumentException, uno::RuntimeException)
+void SAL_CALL GrammarCheckingIterator::resetIgnoreRules( )
+throw (uno::RuntimeException)
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
- (void) xFlatPara;
- (void)nSentenceStartPos;
- return 0;
+ GCReferences_t::iterator aIt( m_aGCReferencesByService.begin() );
+ while (aIt != m_aGCReferencesByService.end())
+ {
+ uno::Reference< linguistic2::XProofreader > xGC( aIt->second );
+ if (xGC.is())
+ xGC->resetIgnoreRules();
+ ++aIt;
+ }
}
-sal_Bool SAL_CALL GrammarCheckingIterator::isGrammarChecking(
- const uno::Reference< uno::XInterface >& xDoc,
- sal_Bool bAutomatic )
+sal_Bool SAL_CALL GrammarCheckingIterator::isProofreading(
+ const uno::Reference< uno::XInterface >& xDoc )
throw (uno::RuntimeException)
{
// ---- THREAD SAFE START ----
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
- (void) bAutomatic;
sal_Bool bRes = sal_False;
uno::Reference< lang::XComponent > xComponent( xDoc, uno::UNO_QUERY );
if (xComponent.is())
{
- sal_Int32 nDocId = m_aDocIdMap[ xComponent ];
- if (m_nCurCheckedDocId >= 0 && m_nCurCheckedDocId == nDocId)
- bRes = sal_True;
- else if (m_aDocIdMap.find( xComponent ) != m_aDocIdMap.end())
+ // if the component was already used in one of the two calls to check text
+ // i.e. in startGrammarChecking or checkGrammarAtPos it will be found in the
+ // m_aDocIdMap unless the document already disposed.
+ // If it is not found then it is not yet being checked (or requested to being checked)
+ const DocMap_t::const_iterator aIt( m_aDocIdMap.find( xComponent.get() ) );
+ if (aIt != m_aDocIdMap.end())
{
- sal_Int32 nSize = m_aFPEntriesQueue.size();
- for (sal_Int32 i = 0; i < nSize && !bRes; ++i)
+ // check in document is checked automatically in the background...
+ OUString aDocId = aIt->second;
+ if (m_aCurCheckedDocId.getLength() > 0 && m_aCurCheckedDocId == aDocId)
+ {
+ // an entry for that document was dequed and is currently being checked.
+ bRes = sal_True;
+ }
+ else
{
- if (nDocId == m_aFPEntriesQueue[i].m_nDocId /*&& m_aFPEntriesQueue[i].m_bAutomatic == bAutomatic*/)
- bRes = sal_True;
+ // we need to check if there is an entry for that document in the queue...
+ // That is the document is going to be checked sooner or later.
+
+ sal_Int32 nSize = m_aFPEntriesQueue.size();
+ for (sal_Int32 i = 0; i < nSize && !bRes; ++i)
+ {
+ if (aDocId == m_aFPEntriesQueue[i].m_aDocId)
+ bRes = sal_True;
+ }
}
}
}
@@ -651,12 +857,12 @@ void SAL_CALL GrammarCheckingIterator::processLinguServiceEvent(
const linguistic2::LinguServiceEvent& rLngSvcEvent )
throw (uno::RuntimeException)
{
- if (rLngSvcEvent.nEvent == linguistic2::LinguServiceEventFlags::GRAMMAR_CHECK_AGAIN)
+ if (rLngSvcEvent.nEvent == linguistic2::LinguServiceEventFlags::PROOFREAD_AGAIN)
{
try
{
- uno::Reference< uno::XInterface > xThis(*this);
- linguistic2::LinguServiceEvent aEvent( xThis, linguistic2::LinguServiceEventFlags::GRAMMAR_CHECK_AGAIN );
+ uno::Reference< uno::XInterface > xThis( dynamic_cast< XLinguServiceEventBroadcaster * >(this) );
+ linguistic2::LinguServiceEvent aEvent( xThis, linguistic2::LinguServiceEventFlags::PROOFREAD_AGAIN );
m_aNotifyListeners.notifyEach(
&linguistic2::XLinguServiceEventListener::processLinguServiceEvent,
aEvent);
@@ -682,7 +888,7 @@ throw (uno::RuntimeException)
{
if (xListener.is())
{
-// ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+// ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
m_aNotifyListeners.addInterface( xListener );
}
return sal_True;
@@ -695,7 +901,7 @@ throw (uno::RuntimeException)
{
if (xListener.is())
{
-// ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+// ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
m_aNotifyListeners.removeInterface( xListener );
}
return sal_True;
@@ -705,7 +911,7 @@ throw (uno::RuntimeException)
void SAL_CALL GrammarCheckingIterator::dispose()
throw (uno::RuntimeException)
{
- lang::EventObject aEvt( (linguistic2::XGrammarCheckingIterator *) this );
+ lang::EventObject aEvt( (linguistic2::XProofreadingIterator *) this );
m_aEventListeners.disposeAndClear( aEvt );
//
@@ -714,7 +920,7 @@ throw (uno::RuntimeException)
m_aRequestEndThread.reset();
// ---- THREAD SAFE START ----
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
m_bEnd = sal_True;
}
// ---- THREAD SAFE END ----
@@ -726,7 +932,7 @@ throw (uno::RuntimeException)
// ---- THREAD SAFE START ----
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
// releaase all UNO references
@@ -751,7 +957,7 @@ throw (uno::RuntimeException)
{
if (xListener.is())
{
-// ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+// ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
m_aEventListeners.addInterface( xListener );
}
}
@@ -763,7 +969,7 @@ throw (uno::RuntimeException)
{
if (xListener.is())
{
-// ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+// ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
m_aEventListeners.removeInterface( xListener );
}
}
@@ -778,13 +984,14 @@ throw (uno::RuntimeException)
//!! and the call to xFlatParagraphIterator->getNextPara() will result in an empty reference.
//!! And if an entry is currently checked by a grammar checker upon return the results
//!! should be ignored.
- //!! All of the above resulting in that we only have to get rid of all references here.
+ //!! Also GetOrCreateDocId will not use that very same Id again...
+ //!! All of the above resulting in that we only have to get rid of the implementation pointer here.
uno::Reference< lang::XComponent > xDoc( rSource.Source, uno::UNO_QUERY );
if (xDoc.is())
{
// ---- THREAD SAFE START ----
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
- m_aDocIdMap.erase( xDoc );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
+ m_aDocIdMap.erase( xDoc.get() );
// ---- THREAD SAFE END ----
}
}
@@ -826,7 +1033,7 @@ uno::Reference< util::XChangesBatch > GrammarCheckingIterator::GetUpdateAccess()
return m_xUpdateAccess;
}
-/*
+
void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl()
{
GCImplNames_t aTmpGCImplNamesByLang;
@@ -867,13 +1074,13 @@ void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl()
{
// ---- THREAD SAFE START ----
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
m_aGCImplNamesByLang = aTmpGCImplNamesByLang;
// ---- THREAD SAFE END ----
}
}
-*/
+/*
void GrammarCheckingIterator::GetMatchingGCSvcs_Impl()
{
GCImplNames_t aTmpGCImplNamesByLang;
@@ -916,12 +1123,12 @@ void GrammarCheckingIterator::GetMatchingGCSvcs_Impl()
{
// ---- THREAD SAFE START ----
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
m_aGCImplNamesByLang = aTmpGCImplNamesByLang;
// ---- THREAD SAFE END ----
}
}
-
+*/
/*
void GrammarCheckingIterator::GetAvailableGCSvcs_Impl()
@@ -952,7 +1159,7 @@ void GrammarCheckingIterator::GetAvailableGCSvcs_Impl()
{
try
{
- uno::Reference< linguistic2::XGrammarChecker > xSvc( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
+ uno::Reference< linguistic2::XProofreader > xSvc( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
if (xSvc.is())
{
OUString aImplName;
@@ -966,7 +1173,7 @@ void GrammarCheckingIterator::GetAvailableGCSvcs_Impl()
{
uno::Sequence< lang::Locale > aLocaleSequence( xSuppLoc->getLocales() );
// ---- THREAD SAFE START ----
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
m_aGCLocalesByService[ aImplName ] = aLocaleSequence;
m_aGCReferencesByService[ aImplName ] = xSvc;
// ---- THREAD SAFE END ----
@@ -1010,19 +1217,68 @@ uno::Sequence< OUString > SAL_CALL GrammarCheckingIterator::getSupportedServiceN
}
+void GrammarCheckingIterator::SetServiceList(
+ const lang::Locale &rLocale,
+ const uno::Sequence< OUString > &rSvcImplNames )
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
+
+ LanguageType nLanguage = LocaleToLanguage( rLocale );
+ OUString aImplName;
+ if (rSvcImplNames.getLength() > 0)
+ aImplName = rSvcImplNames[0]; // there is only one grammar checker per language
+
+ if (nLanguage != LANGUAGE_NONE && nLanguage != LANGUAGE_DONTKNOW)
+ {
+ if (aImplName.getLength() > 0)
+ m_aGCImplNamesByLang[ nLanguage ] = aImplName;
+ else
+ m_aGCImplNamesByLang.erase( nLanguage );
+ }
+}
+
+
+uno::Sequence< OUString > GrammarCheckingIterator::GetServiceList(
+ const lang::Locale &rLocale ) const
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
+
+ uno::Sequence< OUString > aRes(1);
+
+ OUString aImplName; // there is only one grammar checker per language
+ LanguageType nLang = LocaleToLanguage( rLocale );
+ GCImplNames_t::const_iterator aIt( m_aGCImplNamesByLang.find( nLang ) );
+ if (aIt != m_aGCImplNamesByLang.end())
+ aImplName = aIt->second;
+
+ if (aImplName.getLength() > 0)
+ aRes[0] = aImplName;
+ else
+ aRes.realloc(0);
+
+ return aRes;
+}
+
+
+LinguDispatcher::DspType GrammarCheckingIterator::GetDspType() const
+{
+ return DSP_GRAMMAR;
+}
+
+
///////////////////////////////////////////////////////////////////////////
static OUString GrammarCheckingIterator_getImplementationName() throw()
{
- return A2OU( "com.sun.star.lingu2.GrammarCheckingIterator" );
+ return A2OU( "com.sun.star.lingu2.ProofreadingIterator" );
}
static uno::Sequence< OUString > GrammarCheckingIterator_getSupportedServiceNames() throw()
{
uno::Sequence< OUString > aSNS( 1 );
- aSNS.getArray()[0] = A2OU( "com.sun.star.linguistic2.GrammarCheckingIterator" );
+ aSNS.getArray()[0] = A2OU( SN_GRAMMARCHECKINGITERATOR );
return aSNS;
}
diff --git a/linguistic/source/gciterator.hxx b/linguistic/source/gciterator.hxx
index 954195b422f6..e3745a205692 100644
--- a/linguistic/source/gciterator.hxx
+++ b/linguistic/source/gciterator.hxx
@@ -31,10 +31,11 @@
#ifndef _LINGUISTIC_GRAMMARCHECKINGITERATOR_HXX_
#define _LINGUISTIC_GRAMMARCHECKINGITERATOR_HXX_
+#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/linguistic2/XGrammarCheckingIterator.hpp>
+#include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
#include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp>
#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -43,10 +44,13 @@
#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/weakref.hxx>
#include <osl/mutex.hxx>
+#include <osl/conditn.hxx>
+#include <rtl/instance.hxx>
#include <map>
#include <deque>
+#include "defs.hxx"
//////////////////////////////////////////////////////////////////////
@@ -60,16 +64,16 @@ struct FPEntry
::com::sun::star::uno::WeakReference< ::com::sun::star::text::XFlatParagraph > m_xPara;
// document ID to identify different documents
- sal_Int32 m_nDocId;
+ ::rtl::OUString m_aDocId;
// the starting position to be checked
- sal_Int32 m_nStartIndex;
+ sal_Int32 m_nStartIndex;
// the flag to identify whether the document does automatical grammar checking
- sal_Bool m_bAutomatic;
+ sal_Bool m_bAutomatic;
FPEntry()
- : m_nDocId( 0 )
+ : m_aDocId()
, m_nStartIndex( 0 )
, m_bAutomatic( 0 )
{
@@ -83,12 +87,13 @@ struct FPEntry
class GrammarCheckingIterator:
public cppu::WeakImplHelper5
<
- ::com::sun::star::linguistic2::XGrammarCheckingIterator,
+ ::com::sun::star::linguistic2::XProofreadingIterator,
::com::sun::star::linguistic2::XLinguServiceEventListener,
::com::sun::star::linguistic2::XLinguServiceEventBroadcaster,
::com::sun::star::lang::XComponent,
::com::sun::star::lang::XServiceInfo
- >
+ >,
+ public LinguDispatcher
{
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF;
@@ -103,9 +108,8 @@ class GrammarCheckingIterator:
// the flag to end the endless loop
sal_Bool m_bEnd;
- // parameter ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponen > --> the document
- // parameter sal_Int32 --> DocId to indentify the document
- typedef std::map< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >, sal_Int32 > DocMap_t;
+ // Note that it must be the pointer and not the uno-reference to check if it is the same implementation object
+ typedef std::map< XComponent *, ::rtl::OUString > DocMap_t;
DocMap_t m_aDocIdMap;
// parameter ::rtl::OUString --> implementation name
@@ -118,18 +122,19 @@ class GrammarCheckingIterator:
GCImplNames_t m_aGCImplNamesByLang;
// implname -> UNO reference mapping
- typedef std::map< ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XGrammarChecker > > GCReferences_t;
+ typedef std::map< ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > > GCReferences_t;
GCReferences_t m_aGCReferencesByService;
+ ::rtl::OUString m_aCurCheckedDocId;
sal_Bool m_bGCServicesChecked;
sal_Int32 m_nDocIdCounter;
- sal_Int32 m_nCurCheckedDocId;
sal_Int32 m_nLastEndOfSentencePos;
osl::Condition m_aWakeUpThread;
osl::Condition m_aRequestEndThread;
//! beware of initilization order !
- osl::Mutex m_aMutex;
+ struct MyMutex : public rtl::Static< osl::Mutex, MyMutex > {};
+ //
cppu::OInterfaceContainerHelper m_aEventListeners;
cppu::OInterfaceContainerHelper m_aNotifyListeners;
@@ -137,23 +142,23 @@ class GrammarCheckingIterator:
mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch > m_xUpdateAccess;
sal_Int32 NextDocId();
- sal_Int32 GetOrCreateDocId( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &xComp );
+ ::rtl::OUString GetOrCreateDocId( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &xComp );
void AddEntry(
::com::sun::star::uno::WeakReference< ::com::sun::star::text::XFlatParagraphIterator > xFlatParaIterator,
::com::sun::star::uno::WeakReference< ::com::sun::star::text::XFlatParagraph > xFlatPara,
- sal_Int32 nDocId, sal_Int32 nStartIndex, sal_Bool bAutomatic );
+ const ::rtl::OUString &rDocId, sal_Int32 nStartIndex, sal_Bool bAutomatic );
- void ProcessResult( const ::com::sun::star::linguistic2::GrammarCheckingResult &rRes, sal_Int32 nSentenceStartPos,
+ void ProcessResult( const ::com::sun::star::linguistic2::ProofreadingResult &rRes,
const ::com::sun::star::uno::Reference< ::com::sun::star::text::XFlatParagraphIterator > &rxFlatParagraphIterator,
bool bIsAutomaticChecking );
sal_Int32 GetSuggestedEndOfSentence( const ::rtl::OUString &rText, sal_Int32 nSentenceStartPos, const ::com::sun::star::lang::Locale &rLocale );
-// void GetConfiguredGCSvcs_Impl();
- void GetMatchingGCSvcs_Impl();
+ void GetConfiguredGCSvcs_Impl();
+// void GetMatchingGCSvcs_Impl();
// void GetAvailableGCSvcs_Impl();
- ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XGrammarChecker > GetGrammarChecker( const ::com::sun::star::lang::Locale & rLocale );
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > GetGrammarChecker( const ::com::sun::star::lang::Locale & rLocale );
::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch > GetUpdateAccess() const;
@@ -168,11 +173,11 @@ public:
explicit GrammarCheckingIterator( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rxMgr );
virtual ~GrammarCheckingIterator();
- // XGrammarCheckingIterator
- virtual void SAL_CALL startGrammarChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XFlatParagraphIteratorProvider >& xIteratorProvider, ::sal_Bool bAutomatic ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::linguistic2::GrammarCheckingResult SAL_CALL checkGrammarAtPos( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XFlatParagraph >& xFlatPara, const ::rtl::OUString& aText, const ::com::sun::star::lang::Locale& aLocale, ::sal_Int32 nStartOfSentencePos, ::sal_Int32 nSuggestedEndOfSentencePos, ::sal_Int32 nErrorPosInPara ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getEndOfSentence( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XFlatParagraph >& xFlatPara, ::sal_Int32 nSentenceStartPos ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isGrammarChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xDoc, ::sal_Bool bAutomatic ) throw (::com::sun::star::uno::RuntimeException);
+ // XProofreadingIterator
+ virtual void SAL_CALL startProofreading( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xDocument, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XFlatParagraphIteratorProvider >& xIteratorProvider ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::linguistic2::ProofreadingResult SAL_CALL checkSentenceAtPosition( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xDocument, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XFlatParagraph >& xFlatParagraph, const ::rtl::OUString& aText, const ::com::sun::star::lang::Locale& aLocale, ::sal_Int32 nStartOfSentencePosition, ::sal_Int32 nSuggestedBehindEndOfSentencePosition, ::sal_Int32 nErrorPositionInParagraph ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL resetIgnoreRules( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isProofreading( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xDocument ) throw (::com::sun::star::uno::RuntimeException);
// XLinguServiceEventListener
virtual void SAL_CALL processLinguServiceEvent( const ::com::sun::star::linguistic2::LinguServiceEvent& aLngSvcEvent ) throw (::com::sun::star::uno::RuntimeException);
@@ -194,6 +199,10 @@ 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);
+ // LinguDispatcher
+ virtual void SetServiceList( const ::com::sun::star::lang::Locale &rLocale, const ::com::sun::star::uno::Sequence< rtl::OUString > &rSvcImplNames );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > GetServiceList( const ::com::sun::star::lang::Locale &rLocale ) const;
+ virtual DspType GetDspType() const;
};
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index 19b1e97c3a2c..a04d01c0d1a7 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -1,3 +1,4 @@
+
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -62,18 +63,6 @@ using namespace linguistic;
///////////////////////////////////////////////////////////////////////////
-LangSvcEntry_Hyph::~LangSvcEntry_Hyph()
-{
-}
-
-
-LangSvcEntry_Hyph::LangSvcEntry_Hyph( const ::rtl::OUString &rSvcImplName ) :
- aSvcImplName( rSvcImplName )
-{
-}
-
-///////////////////////////////////////////////////////////////////////////
-
HyphenatorDispatcher::HyphenatorDispatcher( LngSvcMgr &rLngSvcMgr ) :
rMgr (rLngSvcMgr)
{
@@ -89,13 +78,8 @@ HyphenatorDispatcher::~HyphenatorDispatcher()
void HyphenatorDispatcher::ClearSvcList()
{
// release memory for each table entry
- LangSvcEntry_Hyph *pItem = aSvcList.First();
- while (pItem)
- {
- LangSvcEntry_Hyph *pTmp = pItem;
- pItem = aSvcList.Next();
- delete pTmp;
- }
+ HyphSvcByLangMap_t aTmp;
+ aSvcMap.swap( aTmp );
}
@@ -254,15 +238,12 @@ Sequence< Locale > SAL_CALL HyphenatorDispatcher::getLocales()
{
MutexGuard aGuard( GetLinguMutex() );
- ULONG nCnt = aSvcList.Count();
- Sequence< Locale > aLocales( nCnt );
- Locale *pItem = aLocales.getArray();
- LangSvcEntry_Hyph *pEntry = aSvcList.First();
- for (ULONG i = 0; i < nCnt; i++)
+ Sequence< Locale > aLocales( static_cast< sal_Int32 >(aSvcMap.size()) );
+ Locale *pLocales = aLocales.getArray();
+ HyphSvcByLangMap_t::const_iterator aIt;
+ for (aIt = aSvcMap.begin(); aIt != aSvcMap.end(); ++aIt)
{
- DBG_ASSERT( pEntry, "lng : pEntry is NULL pointer" );
- pItem[i] = CreateLocale( (LanguageType) aSvcList.GetKey( pEntry ) );
- pEntry = aSvcList.Next();
+ *pLocales++ = CreateLocale( aIt->first );
}
return aLocales;
}
@@ -272,7 +253,8 @@ BOOL SAL_CALL HyphenatorDispatcher::hasLocale(const Locale& rLocale)
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- return 0 != aSvcList.Get( LocaleToLanguage( rLocale ) );
+ HyphSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LocaleToLanguage( rLocale ) ) );
+ return aIt != aSvcMap.end();
}
@@ -293,7 +275,7 @@ Reference< XHyphenatedWord > SAL_CALL
return xRes;
// search for entry with that language
- LangSvcEntry_Hyph *pEntry = aSvcList.Get( nLanguage );
+ LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get();
BOOL bWordModified = FALSE;
if (!pEntry || (nMaxLeading < 0 || nMaxLeading > nWordLen))
@@ -339,24 +321,29 @@ Reference< XHyphenatedWord > SAL_CALL
}
else
{
- INT32 nLen = pEntry->aSvcImplName.getLength() ? 1 : 0;
- DBG_ASSERT( pEntry->aFlags.nLastTriedSvcIndex < nLen,
+ INT32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0;
+ DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
"lng : index out of range");
INT32 i = 0;
- Reference< XHyphenator > &rHyph = pEntry->aSvcRef;
+ Reference< XHyphenator > xHyph;
+ if (pEntry->aSvcRefs.getLength() > 0)
+ xHyph = pEntry->aSvcRefs[0];
// try already instantiated service
- if (i <= pEntry->aFlags.nLastTriedSvcIndex)
+ if (i <= pEntry->nLastTriedSvcIndex)
{
- if (rHyph.is() && rHyph->hasLocale( rLocale ))
- xRes = rHyph->hyphenate( aChkWord, rLocale, nChkMaxLeading,
+ if (xHyph.is() && xHyph->hasLocale( rLocale ))
+ xRes = xHyph->hyphenate( aChkWord, rLocale, nChkMaxLeading,
rProperties );
++i;
}
- else if (pEntry->aFlags.nLastTriedSvcIndex < nLen - 1)
+ else if (pEntry->nLastTriedSvcIndex < nLen - 1)
// instantiate services and try it
{
+// const OUString *pImplNames = pEntry->aSvcImplNames.getConstArray();
+ Reference< XHyphenator > *pRef = pEntry->aSvcRefs.getArray();
+
Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() );
if (xMgr.is())
{
@@ -368,35 +355,34 @@ Reference< XHyphenatedWord > SAL_CALL
//aArgs.getArray()[1] <<= GetDicList();
// create specific service via it's implementation name
- Reference< XHyphenator > xHyph;
try
{
xHyph = Reference< XHyphenator >(
xMgr->createInstanceWithArguments(
- pEntry->aSvcImplName, aArgs ), UNO_QUERY );
+ pEntry->aSvcImplNames[0], aArgs ), UNO_QUERY );
}
catch (uno::Exception &)
{
- DBG_ERROR( "createInstanceWithArguments failed" );
+ DBG_ASSERT( 0, "createInstanceWithArguments failed" );
}
- rHyph = xHyph;
+ pRef [i] = xHyph;
Reference< XLinguServiceEventBroadcaster >
xBroadcaster( xHyph, UNO_QUERY );
if (xBroadcaster.is())
rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
- if (rHyph.is() && rHyph->hasLocale( rLocale ))
- xRes = rHyph->hyphenate( aChkWord, rLocale, nChkMaxLeading,
+ if (xHyph.is() && xHyph->hasLocale( rLocale ))
+ xRes = xHyph->hyphenate( aChkWord, rLocale, nChkMaxLeading,
rProperties );
- pEntry->aFlags.nLastTriedSvcIndex = (INT16) i;
+ pEntry->nLastTriedSvcIndex = (INT16) i;
++i;
// if language is not supported by the services
// remove it from the list.
- if (rHyph.is() && !rHyph->hasLocale( rLocale ))
- aSvcList.Remove( nLanguage );
+ if (xHyph.is() && !xHyph->hasLocale( rLocale ))
+ aSvcMap.erase( nLanguage );
}
}
} // if (xEntry.is())
@@ -432,7 +418,7 @@ Reference< XHyphenatedWord > SAL_CALL
return xRes;
// search for entry with that language
- LangSvcEntry_Hyph *pEntry = aSvcList.Get( nLanguage );
+ LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get();
BOOL bWordModified = FALSE;
if (!pEntry || !(0 <= nIndex && nIndex <= nWordLen - 2))
@@ -473,24 +459,29 @@ Reference< XHyphenatedWord > SAL_CALL
}
else
{
- INT32 nLen = pEntry->aSvcImplName.getLength() ? 1 : 0;
- DBG_ASSERT( pEntry->aFlags.nLastTriedSvcIndex < nLen,
+ INT32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0;
+ DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
"lng : index out of range");
INT32 i = 0;
- Reference< XHyphenator > &rHyph = pEntry->aSvcRef;
+ Reference< XHyphenator > xHyph;
+ if (pEntry->aSvcRefs.getLength() > 0)
+ xHyph = pEntry->aSvcRefs[0];
// try already instantiated service
- if (i <= pEntry->aFlags.nLastTriedSvcIndex)
+ if (i <= pEntry->nLastTriedSvcIndex)
{
- if (rHyph.is() && rHyph->hasLocale( rLocale ))
- xRes = rHyph->queryAlternativeSpelling( aChkWord, rLocale,
+ if (xHyph.is() && xHyph->hasLocale( rLocale ))
+ xRes = xHyph->queryAlternativeSpelling( aChkWord, rLocale,
nChkIndex, rProperties );
++i;
}
- else if (pEntry->aFlags.nLastTriedSvcIndex < nLen - 1)
+ else if (pEntry->nLastTriedSvcIndex < nLen - 1)
// instantiate services and try it
{
+// const OUString *pImplNames = pEntry->aSvcImplNames.getConstArray();
+ Reference< XHyphenator > *pRef = pEntry->aSvcRefs.getArray();
+
Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() );
if (xMgr.is())
{
@@ -502,35 +493,34 @@ Reference< XHyphenatedWord > SAL_CALL
//aArgs.getArray()[1] <<= GetDicList();
// create specific service via it's implementation name
- Reference< XHyphenator > xHyph;
try
{
xHyph = Reference< XHyphenator >(
xMgr->createInstanceWithArguments(
- pEntry->aSvcImplName, aArgs ), UNO_QUERY );
+ pEntry->aSvcImplNames[0], aArgs ), UNO_QUERY );
}
catch (uno::Exception &)
{
- DBG_ERROR( "createInstanceWithArguments failed" );
+ DBG_ASSERT( 0, "createInstanceWithArguments failed" );
}
- rHyph = xHyph;
+ pRef [i] = xHyph;
Reference< XLinguServiceEventBroadcaster >
xBroadcaster( xHyph, UNO_QUERY );
if (xBroadcaster.is())
rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
- if (rHyph.is() && rHyph->hasLocale( rLocale ))
- xRes = rHyph->queryAlternativeSpelling( aChkWord, rLocale,
+ if (xHyph.is() && xHyph->hasLocale( rLocale ))
+ xRes = xHyph->queryAlternativeSpelling( aChkWord, rLocale,
nChkIndex, rProperties );
- pEntry->aFlags.nLastTriedSvcIndex = (INT16) i;
+ pEntry->nLastTriedSvcIndex = (INT16) i;
++i;
// if language is not supported by the services
// remove it from the list.
- if (rHyph.is() && !rHyph->hasLocale( rLocale ))
- aSvcList.Remove( nLanguage );
+ if (xHyph.is() && !xHyph->hasLocale( rLocale ))
+ aSvcMap.erase( nLanguage );
}
}
} // if (xEntry.is())
@@ -565,7 +555,7 @@ Reference< XPossibleHyphens > SAL_CALL
return xRes;
// search for entry with that language
- LangSvcEntry_Hyph *pEntry = aSvcList.Get( nLanguage );
+ LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get();
if (!pEntry)
{
@@ -602,24 +592,29 @@ Reference< XPossibleHyphens > SAL_CALL
}
else
{
- INT32 nLen = pEntry->aSvcImplName.getLength() ? 1 : 0;
- DBG_ASSERT( pEntry->aFlags.nLastTriedSvcIndex < nLen,
+ INT32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0;
+ DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
"lng : index out of range");
INT32 i = 0;
- Reference< XHyphenator > &rHyph = pEntry->aSvcRef;
+ Reference< XHyphenator > xHyph;
+ if (pEntry->aSvcRefs.getLength() > 0)
+ xHyph = pEntry->aSvcRefs[0];
// try already instantiated service
- if (i <= pEntry->aFlags.nLastTriedSvcIndex)
+ if (i <= pEntry->nLastTriedSvcIndex)
{
- if (rHyph.is() && rHyph->hasLocale( rLocale ))
- xRes = rHyph->createPossibleHyphens( aChkWord, rLocale,
+ if (xHyph.is() && xHyph->hasLocale( rLocale ))
+ xRes = xHyph->createPossibleHyphens( aChkWord, rLocale,
rProperties );
++i;
}
- else if (pEntry->aFlags.nLastTriedSvcIndex < nLen - 1)
+ else if (pEntry->nLastTriedSvcIndex < nLen - 1)
// instantiate services and try it
{
+// const OUString *pImplNames = pEntry->aSvcImplNames.getConstArray();
+ Reference< XHyphenator > *pRef = pEntry->aSvcRefs.getArray();
+
Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() );
if (xMgr.is())
{
@@ -631,35 +626,34 @@ Reference< XPossibleHyphens > SAL_CALL
//aArgs.getArray()[1] <<= GetDicList();
// create specific service via it's implementation name
- Reference< XHyphenator > xHyph;
try
{
xHyph = Reference< XHyphenator >(
xMgr->createInstanceWithArguments(
- pEntry->aSvcImplName, aArgs ), UNO_QUERY );
+ pEntry->aSvcImplNames[0], aArgs ), UNO_QUERY );
}
catch (uno::Exception &)
{
- DBG_ERROR( "createWithArguments failed" );
+ DBG_ASSERT( 0, "createWithArguments failed" );
}
- rHyph = xHyph;
+ pRef [i] = xHyph;
Reference< XLinguServiceEventBroadcaster >
xBroadcaster( xHyph, UNO_QUERY );
if (xBroadcaster.is())
rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
- if (rHyph.is() && rHyph->hasLocale( rLocale ))
- xRes = rHyph->createPossibleHyphens( aChkWord, rLocale,
+ if (xHyph.is() && xHyph->hasLocale( rLocale ))
+ xRes = xHyph->createPossibleHyphens( aChkWord, rLocale,
rProperties );
- pEntry->aFlags.nLastTriedSvcIndex = (INT16) i;
+ pEntry->nLastTriedSvcIndex = (INT16) i;
++i;
// if language is not supported by the services
// remove it from the list.
- if (rHyph.is() && !rHyph->hasLocale( rLocale ))
- aSvcList.Remove( nLanguage );
+ if (xHyph.is() && !xHyph->hasLocale( rLocale ))
+ aSvcMap.erase( nLanguage );
}
}
} // if (xEntry.is())
@@ -684,27 +678,27 @@ void HyphenatorDispatcher::SetServiceList( const Locale &rLocale,
INT16 nLanguage = LocaleToLanguage( rLocale );
INT32 nLen = rSvcImplNames.getLength();
-
if (0 == nLen)
// remove entry
- aSvcList.Remove( nLanguage );
+ aSvcMap.erase( nLanguage );
else
{
// modify/add entry
- LangSvcEntry_Hyph *pEntry = aSvcList.Get( nLanguage );
+ LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get();
// only one hypenator can be in use for a language...
- const OUString &rSvcImplName = rSvcImplNames.getConstArray()[0];
+ //const OUString &rSvcImplName = rSvcImplNames.getConstArray()[0];
if (pEntry)
{
- pEntry->aSvcImplName = rSvcImplName;
- pEntry->aSvcRef = NULL;
- pEntry->aFlags = SvcFlags();
+ pEntry->Clear();
+ pEntry->aSvcImplNames = rSvcImplNames;
+ pEntry->aSvcImplNames.realloc(1);
+ pEntry->aSvcRefs = Sequence< Reference < XHyphenator > > ( 1 );
}
else
{
- pEntry = new LangSvcEntry_Hyph( rSvcImplName );
- aSvcList.Insert( nLanguage, pEntry );
- DBG_ASSERT( aSvcList.Get( nLanguage ), "lng : Insert failed" );
+ boost::shared_ptr< LangSvcEntries_Hyph > pTmpEntry( new LangSvcEntries_Hyph( rSvcImplNames[0] ) );
+ pTmpEntry->aSvcRefs = Sequence< Reference < XHyphenator > >( 1 );
+ aSvcMap[ nLanguage ] = pTmpEntry;
}
}
}
@@ -715,23 +709,24 @@ Sequence< OUString >
{
MutexGuard aGuard( GetLinguMutex() );
- Sequence< OUString > aRes(1);
+ Sequence< OUString > aRes;
// search for entry with that language and use data from that
INT16 nLanguage = LocaleToLanguage( rLocale );
HyphenatorDispatcher *pThis = (HyphenatorDispatcher *) this;
- const LangSvcEntry_Hyph *pEntry = pThis->aSvcList.Get( nLanguage );
+ const LangSvcEntries_Hyph *pEntry = pThis->aSvcMap[ nLanguage ].get();
if (pEntry)
- aRes.getArray()[0] = pEntry->aSvcImplName;
- else
- aRes.realloc(0);
+ {
+ aRes = pEntry->aSvcImplNames;
+ if (aRes.getLength() > 0)
+ aRes.realloc(1);
+ }
return aRes;
}
-HyphenatorDispatcher::DspType
- HyphenatorDispatcher::GetDspType() const
+LinguDispatcher::DspType HyphenatorDispatcher::GetDspType() const
{
return DSP_HYPH;
}
diff --git a/linguistic/source/hyphdsp.hxx b/linguistic/source/hyphdsp.hxx
index 28cacbc363ed..c761cffbfbd4 100644
--- a/linguistic/source/hyphdsp.hxx
+++ b/linguistic/source/hyphdsp.hxx
@@ -40,11 +40,12 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
-#include <tools/table.hxx>
#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
#include <cppuhelper/implbase1.hxx> // helper for implementations
+#include <boost/shared_ptr.hpp>
+#include <map>
#include "lngopt.hxx"
#include "misc.hxx"
@@ -54,31 +55,6 @@ class LngSvcMgr;
///////////////////////////////////////////////////////////////////////////
-class LangSvcEntry_Hyph
-{
- friend class HyphenatorDispatcher;
-
- ::rtl::OUString aSvcImplName;
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator > aSvcRef;
-
-// INT16 nLang; //used as key in the table
- SvcFlags aFlags;
-
-public:
- LangSvcEntry_Hyph() {}
- LangSvcEntry_Hyph( const ::rtl::OUString &rSvcImplName );
- ~LangSvcEntry_Hyph();
-
- BOOL IsAlreadyWarned() const { return aFlags.bAlreadyWarned != 0; }
- void SetAlreadyWarned(BOOL bVal) { aFlags.bAlreadyWarned = 0 != bVal; }
- BOOL IsDoWarnAgain() const { return aFlags.bDoWarnAgain != 0; }
- void SetDoWarnAgain(BOOL bVal) { aFlags.bDoWarnAgain = 0 != bVal; }
-};
-
-DECLARE_TABLE( HyphSvcList, LangSvcEntry_Hyph * )
-
-
class HyphenatorDispatcher :
public cppu::WeakImplHelper1
<
@@ -86,7 +62,9 @@ class HyphenatorDispatcher :
>,
public LinguDispatcher
{
- HyphSvcList aSvcList;
+ typedef boost::shared_ptr< LangSvcEntries_Hyph > LangSvcEntries_Hyph_Ptr_t;
+ typedef std::map< LanguageType, LangSvcEntries_Hyph_Ptr_t > HyphSvcByLangMap_t;
+ HyphSvcByLangMap_t aSvcMap;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > xPropSet;
diff --git a/linguistic/source/iprcache.cxx b/linguistic/source/iprcache.cxx
index b3efb84b9684..a9bb5c3da768 100644
--- a/linguistic/source/iprcache.cxx
+++ b/linguistic/source/iprcache.cxx
@@ -85,7 +85,7 @@ static const struct
INT32 nPropHdl;
} aFlushProperties[ NUM_FLUSH_PROPS ] =
{
- { UPN_IS_GERMAN_PRE_REFORM, UPH_IS_GERMAN_PRE_REFORM },
+ { UPN_IS_GERMAN_PRE_REFORM, UPH_IS_GERMAN_PRE_REFORM }, /* deprecated */
{ UPN_IS_USE_DICTIONARY_LIST, UPH_IS_USE_DICTIONARY_LIST },
{ UPN_IS_IGNORE_CONTROL_CHARACTERS, UPH_IS_IGNORE_CONTROL_CHARACTERS },
{ UPN_IS_SPELL_UPPER_CASE, UPH_IS_SPELL_UPPER_CASE },
@@ -239,62 +239,7 @@ void SAL_CALL FlushListener::propertyChange(
///////////////////////////////////////////////////////////////////////////
-class IPRCachedWord
-{
- String aWord;
- IPRCachedWord *pNext;
- IPRCachedWord *pPrev;
- IPRCachedWord *pFollow;
- INT16 nLanguage;
- ULONG nFound;
-
- // don't allow to use copy-constructor and assignment-operator
- IPRCachedWord(const IPRCachedWord &);
- IPRCachedWord & operator = (const IPRCachedWord &);
-
-public:
- IPRCachedWord( const String& rWord, IPRCachedWord* pFollowPtr, INT16 nLang )
- : aWord( rWord ), pNext( 0 ), pPrev( 0 ), pFollow( pFollowPtr ),
- nLanguage( nLang ), nFound( 0 ) {}
- ~IPRCachedWord(){}
-
- const String& GetWord() { return aWord; }
- void SetWord( const String& aNew ) { aWord = aNew; }
-
- USHORT GetLang() { return nLanguage; }
- void SetLang( INT16 nNew ) { nLanguage = nNew; }
-
- IPRCachedWord* GetNext() { return pNext; }
- void SetNext( IPRCachedWord* pNew ) { pNext = pNew; }
-
- IPRCachedWord* GetPrev() { return pPrev; }
- void SetPrev( IPRCachedWord* pNew ) { pPrev = pNew; }
-
- IPRCachedWord* GetFollow() { return pFollow; }
- void SetFollow( IPRCachedWord* pNew ){ pFollow = pNew; }
-
- void IncFound() { ++nFound; }
- ULONG GetFound() { return nFound; }
- void SetFound( ULONG nNew ) { nFound = nNew; }
-};
-
-///////////////////////////////////////////////////////////////////////////
-
-IPRSpellCache::IPRSpellCache( ULONG nSize ) :
- ppHash ( NULL ),
- pFirst ( NULL ),
- pLast ( NULL ),
- nIndex ( 0 ),
- nCount ( 0 ),
- nInputPos ( 0 ),
- nInputValue ( 0 ),
- nTblSize ( nSize )
-#ifdef DBG_STATISTIC
- ,nMax ( IPR_DEF_CACHE_MAX ),
- nMaxInput ( IPR_DEF_CACHE_MAXINPUT ),
- nFound ( 0 ),
- nLost ( 0 )
-#endif
+SpellCache::SpellCache()
{
pFlushLstnr = new FlushListener( this );
xFlushLstnr = pFlushLstnr;
@@ -304,236 +249,39 @@ IPRSpellCache::IPRSpellCache( ULONG nSize ) :
pFlushLstnr->SetPropSet( aPropertySet ); //! after reference is established
}
-IPRSpellCache::~IPRSpellCache()
+SpellCache::~SpellCache()
{
- MutexGuard aGuard( GetLinguMutex() );
-
- Reference<XDictionaryList> aDictionaryList;
- pFlushLstnr->SetDicList( aDictionaryList );
- Reference<XPropertySet> aPropertySet;
- pFlushLstnr->SetPropSet( aPropertySet );
-
-#ifdef DBG_STATISTIC
- // Binary File oeffnen
- String aOutTmp( String::CreateFromAscii( "iprcache.stk" ) )
- SvFileStream aOut( aOutTmp, STREAM_STD_WRITE );
-
- if( aOut.IsOpen() && !aOut.GetError() && ppHash )
- {
- ByteString aStr( "Gefunden: ");
- aStr += nFound;
- aStr += " Verloren: ";
- aStr += nLost;
- ULONG nSumSum = 0;
- aOut << aStr.GetBuffer() << endl;
- for( ULONG i = 0; i < nTblSize; ++i )
- {
- aStr = "Index: ";
- aStr += i;
- aStr += " Tiefe: ";
- ULONG nDeep = 0;
- ULONG nSum = 0;
- IPRCachedWord* pTmp = *( ppHash + i );
- while( pTmp )
- {
- ++nDeep;
- nSum += pTmp->GetFound();
- pTmp = pTmp->GetNext();
- }
- aStr += nDeep;
- aStr += " Anzahl: ";
- aStr += nSum;
- nSumSum += nSum;
- aOut << aStr.GetBuffer() << endl;
- pTmp = *( ppHash + i );
- aStr = " Found: ";
- while( pTmp )
- {
- aStr += pTmp->GetFound();
- aStr += " ";
- pTmp = pTmp->GetNext();
- }
- aOut << aStr.GetBuffer() << endl;
- }
- aStr = "Summe: ";
- aStr += nSumSum;
- aOut << aStr.GetBuffer() << endl;
- }
-#endif
-
- while( pFirst )
- {
- pLast = pFirst->GetNext();
- delete pFirst;
- pFirst = pLast;
- }
- delete ppHash;
+ Reference<XDictionaryList> aEmptyList;
+ Reference<XPropertySet> aEmptySet;
+ pFlushLstnr->SetDicList( aEmptyList );
+ pFlushLstnr->SetPropSet( aEmptySet );
}
-void IPRSpellCache::Flush()
+void SpellCache::Flush()
{
MutexGuard aGuard( GetLinguMutex() );
-
- if( ppHash )
- {
- while( pFirst )
- {
- pLast = pFirst->GetNext();
- delete pFirst;
- pFirst = pLast;
- }
- delete ppHash;
- ppHash = NULL;
- nIndex = 0;
- nCount = 0;
- nInputPos = 0;
- nInputValue = 0;
-#ifdef DBG_STATISTIC
- nFound = 0;
- nLost = 0;
-#endif
- }
+ // clear word list
+ LangWordList_t aEmpty;
+ aWordLists.swap( aEmpty );
}
-BOOL IPRSpellCache::CheckWord( const String& rWord, INT16 nLang, BOOL bAllLang )
+bool SpellCache::CheckWord( const OUString& rWord, LanguageType nLang )
{
MutexGuard aGuard( GetLinguMutex() );
-
- BOOL bRet = FALSE;
- // Hash-Index-Berechnung
- nIndex = 0;
- const sal_Unicode* pp = rWord.GetBuffer();
- while( *pp )
- nIndex = nIndex << 1 ^ *pp++;
- nIndex %= nTblSize;
-
- if( ppHash )
- {
- pRun = *(ppHash + nIndex);
-
- if( pRun && FALSE == ( bRet = (rWord == pRun->GetWord() &&
- (nLang == pRun->GetLang() || bAllLang)) ) )
- {
- IPRCachedWord* pTmp = pRun->GetNext();
- while( pTmp && FALSE ==( bRet = ( rWord == pTmp->GetWord() &&
- (nLang == pTmp->GetLang() || bAllLang) ) ) )
- {
- pRun = pTmp;
- pTmp = pTmp->GetNext();
- }
- if ( bRet )
- { // Gefunden: Umsortieren in der Hash-Liste
- pRun->SetNext( pTmp->GetNext() );
- pTmp->SetNext( *( ppHash + nIndex ) );
- *( ppHash + nIndex ) = pTmp;
- pRun = pTmp;
- }
- }
- if( bRet )
- {
- if ( pRun->GetPrev() )
- { // Wenn wir noch nicht erster sind, werden wir es jetzt:
- if (
- ((pRun->GetFound() <= nInputValue) && (++nInputPos > IPR_CACHE_MAXINPUT)) ||
- ((pInput == pRun) && NULL == (pInput = pRun->GetFollow()))
- )
-
- { // Wenn die Input-Stelle am Maximum anlangt, erhoehen
- ++nInputValue; // wir den InputValue und gehen wieder
- nInputPos = 0; // an den Anfang
- pInput = pFirst;
- }
- IPRCachedWord* pTmp = pRun->GetFollow();
- pRun->GetPrev()->SetFollow( pTmp ); //Unser Ex-Prev -> Ex-Follow
- pRun->SetFollow( pFirst ); // Wir selbst -> Ex-First
- pFirst->SetPrev( pRun ); // Wir selbst <- Ex-First
- if( pTmp )
- pTmp->SetPrev( pRun->GetPrev() ); // Ex-Prev <- Ex-Follow
- else
- pLast = pRun->GetPrev(); // falls wir letzter waren
- pRun->SetPrev( NULL ); // Erste haben keinen Prev
- pFirst = pRun; // Wir sind Erster!
- }
- pRun->IncFound(); // Mitzaehlen, wie oft wiedergefunden
- }
- }
- return bRet;
+ WordList_t &rList = aWordLists[ nLang ];
+ const WordList_t::const_iterator aIt = rList.find( rWord );
+ return aIt != rList.end();
}
-void IPRSpellCache::AddWord( const String& rWord, INT16 nLang )
+void SpellCache::AddWord( const OUString& rWord, LanguageType nLang )
{
MutexGuard aGuard( GetLinguMutex() );
-
- if( !ppHash )
- {
- ppHash = new IPRCachedWord* [ nTblSize ];
- memset( (void *)ppHash, 0, ( sizeof( IPRCachedWord* ) * nTblSize ) );
- }
- IPRCachedWord* pTmp;
- if( nCount == IPR_CACHE_MAX-1 )
- {
- ULONG nDel = 0;
- pRun = pLast; // Der letzte wird ueberschrieben
- const sal_Unicode* pp = pRun->GetWord().GetBuffer();
- while( *pp )
- nDel = nDel << 1 ^ *pp++;
- nDel %= nTblSize; // Hash-Index des letzten
- // Der letzte wird aus seiner alten Hash-Liste entfernt
- if( ( pTmp = *( ppHash + nDel ) ) == pRun )
- *( ppHash + nDel ) = pRun->GetNext();
- else
- {
- while( pTmp->GetNext() != pRun )
- pTmp = pTmp->GetNext();
- pTmp->SetNext( pRun->GetNext() );
- }
- pRun->SetWord( rWord ); // Ueberschreiben des alten Inhalts
- pRun->SetLang( nLang );
- pRun->SetFound( 0 );
- }
- else
- {
- ++nCount;
- pRun = new IPRCachedWord( rWord, pFirst, nLang );
- if( pFirst )
- pFirst->SetPrev( pRun );
- pFirst = pRun; // Ganz Neue kommen erstmal nach vorne
- if ( !pLast )
- {
- pLast = pRun;
- pInput = pRun;
- }
- }
-
- pRun->SetNext( *( ppHash + nIndex ) ); // In der Hash-Liste
- *(ppHash + nIndex ) = pRun; // vorne einsortieren
-
- // In der LRU-Kette umsortieren ...
- if ( pRun != pInput && pRun != pInput->GetPrev() )
- {
- pTmp = pRun->GetPrev();
- IPRCachedWord* pFoll = pRun->GetFollow();
- // Entfernen aus der alten Position
- if( pTmp )
- pTmp->SetFollow( pFoll );
- else
- pFirst = pFoll; // wir waren erster
- if( pFoll )
- pFoll->SetPrev( pTmp );
- else
- pLast = pTmp; // wir waren letzter
- // Einfuegen vor pInput
- if( NULL != (pTmp = pInput->GetPrev()) )
- pTmp->SetFollow( pRun );
- else
- pFirst = pRun; // pInput war erster
- pRun->SetPrev( pTmp );
- pRun->SetFollow( pInput );
- pInput->SetPrev( pRun );
- }
- pInput = pRun; // pInput zeigt auf den zuletzt einsortierten
+ WordList_t & rList = aWordLists[ nLang ];
+ // occasional clean-up...
+ if (rList.size() > 500)
+ rList.clear();
+ rList.insert( rWord );
}
-
///////////////////////////////////////////////////////////////////////////
} // namespace linguistic
diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx
index c71cac2ecab7..2ef63492c719 100644
--- a/linguistic/source/lngopt.cxx
+++ b/linguistic/source/lngopt.cxx
@@ -130,14 +130,14 @@ BOOL LinguOptions::SetValue( Any &rOld, const Any &rVal, INT32 nWID )
switch( nWID )
{
- case WID_IS_GERMAN_PRE_REFORM : pbVal = &pData->bIsGermanPreReform; break;
+ case WID_IS_GERMAN_PRE_REFORM : /*! deprecated !*/ break;
case WID_IS_USE_DICTIONARY_LIST : pbVal = &pData->bIsUseDictionaryList; break;
case WID_IS_IGNORE_CONTROL_CHARACTERS : pbVal = &pData->bIsIgnoreControlCharacters; break;
case WID_IS_HYPH_AUTO : pbVal = &pData->bIsHyphAuto; break;
case WID_IS_HYPH_SPECIAL : pbVal = &pData->bIsHyphSpecial; break;
case WID_IS_SPELL_AUTO : pbVal = &pData->bIsSpellAuto; break;
- case WID_IS_SPELL_HIDE : pbVal = &pData->bIsSpellHideMarkings; break;
- case WID_IS_SPELL_IN_ALL_LANGUAGES :pbVal = &pData->bIsSpellInAllLanguages; break;
+ case WID_IS_SPELL_HIDE : /*! deprecated !*/ break;
+ case WID_IS_SPELL_IN_ALL_LANGUAGES :/*! deprecated !*/ break;
case WID_IS_SPELL_SPECIAL : pbVal = &pData->bIsSpellSpecial; break;
case WID_IS_WRAP_REVERSE : pbVal = &pData->bIsSpellReverse; break;
case WID_DEFAULT_LANGUAGE : pnVal = &pData->nDefaultLanguage; break;
@@ -164,7 +164,7 @@ BOOL LinguOptions::SetValue( Any &rOld, const Any &rVal, INT32 nWID )
}
default :
{
- DBG_ERROR("lng : unknown WID");
+ DBG_ASSERT( 0,"lng : unknown WID");
bRes = FALSE;
}
}
@@ -207,14 +207,14 @@ void LinguOptions::GetValue( Any &rVal, INT32 nWID ) const
switch( nWID )
{
- case WID_IS_GERMAN_PRE_REFORM : pbVal = &pData->bIsGermanPreReform; break;
+ case WID_IS_GERMAN_PRE_REFORM : /*! deprecated !*/ break;
case WID_IS_USE_DICTIONARY_LIST : pbVal = &pData->bIsUseDictionaryList; break;
case WID_IS_IGNORE_CONTROL_CHARACTERS : pbVal = &pData->bIsIgnoreControlCharacters; break;
case WID_IS_HYPH_AUTO : pbVal = &pData->bIsHyphAuto; break;
case WID_IS_HYPH_SPECIAL : pbVal = &pData->bIsHyphSpecial; break;
case WID_IS_SPELL_AUTO : pbVal = &pData->bIsSpellAuto; break;
- case WID_IS_SPELL_HIDE : pbVal = &pData->bIsSpellHideMarkings; break;
- case WID_IS_SPELL_IN_ALL_LANGUAGES :pbVal = &pData->bIsSpellInAllLanguages; break;
+ case WID_IS_SPELL_HIDE : /*! deprecated !*/ break;
+ case WID_IS_SPELL_IN_ALL_LANGUAGES :/*! deprecated !*/ break;
case WID_IS_SPELL_SPECIAL : pbVal = &pData->bIsSpellSpecial; break;
case WID_IS_WRAP_REVERSE : pbVal = &pData->bIsSpellReverse; break;
case WID_DEFAULT_LANGUAGE : pnVal = &pData->nDefaultLanguage; break;
@@ -244,7 +244,7 @@ void LinguOptions::GetValue( Any &rVal, INT32 nWID ) const
}
default :
{
- DBG_ERROR("lng : unknown WID");
+ DBG_ASSERT( 0,"lng : unknown WID");
}
}
@@ -265,7 +265,7 @@ struct WID_Name
//! since the WID is used as index in this table!
WID_Name aWID_Name[] =
{
- { WID_IS_GERMAN_PRE_REFORM, UPN_IS_GERMAN_PRE_REFORM },
+ { 0, 0 },
{ WID_IS_USE_DICTIONARY_LIST, UPN_IS_USE_DICTIONARY_LIST },
{ WID_IS_IGNORE_CONTROL_CHARACTERS, UPN_IS_IGNORE_CONTROL_CHARACTERS },
{ WID_IS_SPELL_UPPER_CASE, UPN_IS_SPELL_UPPER_CASE },
@@ -276,8 +276,8 @@ WID_Name aWID_Name[] =
{ WID_HYPH_MIN_WORD_LENGTH, UPN_HYPH_MIN_WORD_LENGTH },
{ WID_DEFAULT_LOCALE, UPN_DEFAULT_LOCALE },
{ WID_IS_SPELL_AUTO, UPN_IS_SPELL_AUTO },
- { WID_IS_SPELL_HIDE, UPN_IS_SPELL_HIDE },
- { WID_IS_SPELL_IN_ALL_LANGUAGES, UPN_IS_SPELL_IN_ALL_LANGUAGES },
+ { 0, 0 },
+ { 0, 0 },
{ WID_IS_SPELL_SPECIAL, UPN_IS_SPELL_SPECIAL },
{ WID_IS_HYPH_AUTO, UPN_IS_HYPH_AUTO },
{ WID_IS_HYPH_SPECIAL, UPN_IS_HYPH_SPECIAL },
@@ -292,7 +292,7 @@ WID_Name aWID_Name[] =
};
-OUString LinguOptions::GetName( INT32 nWID ) const
+OUString LinguOptions::GetName( INT32 nWID )
{
MutexGuard aGuard( GetLinguMutex() );
@@ -307,7 +307,7 @@ OUString LinguOptions::GetName( INT32 nWID ) const
}
else
{
- DBG_ERROR("lng : unknown WID");
+ DBG_ASSERT( 0,"lng : unknown WID");
}
return aRes;
@@ -333,7 +333,7 @@ static SfxItemPropertyMap aLinguProps[] =
&::getCppuType( (sal_Int16*)0 ), 0, 0 },
{ MAP_CHAR_LEN(UPN_HYPH_MIN_WORD_LENGTH), WID_HYPH_MIN_WORD_LENGTH,
&::getCppuType( (sal_Int16*)0 ), 0, 0 },
- { MAP_CHAR_LEN(UPN_IS_GERMAN_PRE_REFORM), WID_IS_GERMAN_PRE_REFORM,
+ { MAP_CHAR_LEN(UPN_IS_GERMAN_PRE_REFORM), WID_IS_GERMAN_PRE_REFORM, /*! deprecated !*/
&::getBooleanCppuType(), 0, 0 },
{ MAP_CHAR_LEN(UPN_IS_HYPH_AUTO), WID_IS_HYPH_AUTO,
&::getBooleanCppuType(), 0, 0 },
@@ -345,9 +345,9 @@ static SfxItemPropertyMap aLinguProps[] =
&::getBooleanCppuType(), 0, 0 },
{ MAP_CHAR_LEN(UPN_IS_SPELL_CAPITALIZATION), WID_IS_SPELL_CAPITALIZATION,
&::getBooleanCppuType(), 0, 0 },
- { MAP_CHAR_LEN(UPN_IS_SPELL_HIDE), WID_IS_SPELL_HIDE,
+ { MAP_CHAR_LEN(UPN_IS_SPELL_HIDE), WID_IS_SPELL_HIDE, /*! deprecated !*/
&::getBooleanCppuType(), 0, 0 },
- { MAP_CHAR_LEN(UPN_IS_SPELL_IN_ALL_LANGUAGES), WID_IS_SPELL_IN_ALL_LANGUAGES,
+ { MAP_CHAR_LEN(UPN_IS_SPELL_IN_ALL_LANGUAGES), WID_IS_SPELL_IN_ALL_LANGUAGES, /*! deprecated !*/
&::getBooleanCppuType(), 0, 0 },
{ MAP_CHAR_LEN(UPN_IS_SPELL_SPECIAL), WID_IS_SPELL_SPECIAL,
&::getBooleanCppuType(), 0, 0 },
@@ -405,7 +405,7 @@ Reference< XPropertySetInfo > SAL_CALL LinguProps::getPropertySetInfo()
}
void SAL_CALL LinguProps::setPropertyValue(
- const OUString& rPropertyName, const Any& aValue )
+ const OUString& rPropertyName, const Any& rValue )
throw(UnknownPropertyException, PropertyVetoException,
IllegalArgumentException, WrappedTargetException, RuntimeException)
{
@@ -415,11 +415,11 @@ void SAL_CALL LinguProps::setPropertyValue(
SfxItemPropertyMap::GetByName(pMap, rPropertyName);
if (pCur)
{
- Any aOld;
- if (aOpt.SetValue( aOld, aValue, pCur->nWID ))
+ Any aOld( aConfig.GetProperty( pCur->nWID ) );
+ if (aOld != rValue && aConfig.SetProperty( pCur->nWID, rValue ))
{
PropertyChangeEvent aChgEvt( (XPropertySet *) this, rPropertyName,
- FALSE, pCur->nWID, aOld, aValue );
+ FALSE, pCur->nWID, aOld, rValue );
launchEvent( aChgEvt );
}
}
@@ -441,7 +441,7 @@ Any SAL_CALL LinguProps::getPropertyValue( const OUString& rPropertyName )
const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName(pMap, rPropertyName);
if(pCur)
{
- aOpt.GetValue( aRet, pCur->nWID );
+ aRet = aConfig.GetProperty( pCur->nWID );
}
#ifdef LINGU_EXCEPTIONS
else
@@ -520,11 +520,11 @@ void SAL_CALL LinguProps::setFastPropertyValue( sal_Int32 nHandle, const Any& rV
{
MutexGuard aGuard( GetLinguMutex() );
- Any aOld;
- if (aOpt.SetValue( aOld, rValue, nHandle ))
+ Any aOld( aConfig.GetProperty( nHandle ) );
+ if (aOld != rValue && aConfig.SetProperty( nHandle, rValue ))
{
PropertyChangeEvent aChgEvt( (XPropertySet *) this,
- aOpt.GetName( nHandle ), FALSE, nHandle, aOld, rValue );
+ LinguOptions::GetName( nHandle ), FALSE, nHandle, aOld, rValue );
launchEvent( aChgEvt );
}
}
@@ -535,8 +535,7 @@ Any SAL_CALL LinguProps::getFastPropertyValue( sal_Int32 nHandle )
{
MutexGuard aGuard( GetLinguMutex() );
- Any aRes;
- aOpt.GetValue( aRes, nHandle );
+ Any aRes( aConfig.GetProperty( nHandle ) );
return aRes;
}
@@ -554,8 +553,7 @@ Sequence< PropertyValue > SAL_CALL
{
PropertyValue &rVal = pProp[i];
SfxItemPropertyMap &rItem = aLinguProps[i];
- Any aAny;
- aOpt.GetValue( aAny, rItem.nWID );
+ Any aAny( aConfig.GetProperty( rItem.nWID ) );
rVal.Name = OUString( rItem.pName, rItem.nNameLen, RTL_TEXTENCODING_ASCII_US );
rVal.Handle = rItem.nWID;
@@ -576,14 +574,8 @@ void SAL_CALL
const PropertyValue *pVal = rProps.getConstArray();
for (INT32 i = 0; i < nLen; ++i)
{
- Any aOld;
const PropertyValue &rVal = pVal[i];
- if (aOpt.SetValue( aOld, rVal.Value, rVal.Handle ))
- {
- PropertyChangeEvent aChgEvt( (XPropertySet *) this,
- rVal.Name, FALSE, rVal.Handle, aOld, rVal.Value );
- launchEvent( aChgEvt );
- }
+ setPropertyValue( rVal.Name, rVal.Value );
}
}
diff --git a/linguistic/source/lngopt.hxx b/linguistic/source/lngopt.hxx
index cf3e3d009802..f6144b7f117d 100644
--- a/linguistic/source/lngopt.hxx
+++ b/linguistic/source/lngopt.hxx
@@ -87,9 +87,8 @@ public:
BOOL SetValue( ::com::sun::star::uno::Any &rOld,
const ::com::sun::star::uno::Any &rVal, INT32 nWID );
void GetValue( ::com::sun::star::uno::Any &rVal, INT32 nWID ) const;
- ::rtl::OUString GetName( INT32 nWID ) const;
- BOOL IsSpellInAllLanguages() const { return pData->bIsSpellInAllLanguages; }
+ static ::rtl::OUString GetName( INT32 nWID );
const ::com::sun::star::uno::Sequence< rtl::OUString >
GetActiveDics() const { return pData->aActiveDics; }
@@ -134,7 +133,7 @@ class LinguProps :
OPropertyListenerContainerHelper aPropListeners;
SfxItemPropertyMap *pMap;
- LinguOptions aOpt;
+ SvtLinguConfig aConfig;
BOOL bDisposing;
@@ -148,114 +147,35 @@ public:
LinguProps();
// XPropertySet
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
- getPropertySetInfo()
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- setPropertyValue( const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Any& aValue )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::beans::PropertyVetoException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL
- getPropertyValue( const ::rtl::OUString& PropertyName )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertyChangeListener >& rxListener )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertyChangeListener >& rxListener )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- addVetoableChangeListener( const ::rtl::OUString& PropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XVetoableChangeListener >& rxListener )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XVetoableChangeListener >& rxListener )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
// XFastPropertySet
- virtual void SAL_CALL
- setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::beans::PropertyVetoException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL
- getFastPropertyValue( sal_Int32 nHandle )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
// XPropertyAccess
- virtual ::com::sun::star::uno::Sequence<
- ::com::sun::star::beans::PropertyValue > SAL_CALL
- getPropertyValues()
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- setPropertyValues( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::beans::PropertyValue >& aProps )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::beans::PropertyVetoException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
// XComponent
- virtual void SAL_CALL
- dispose()
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- addEventListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener >& rxListener )
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- removeEventListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener >& rxListener )
- throw(::com::sun::star::uno::RuntimeException);
-
-
- ////////////////////////////////////////////////////////////
- // Service specific part
- //
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
// XServiceInfo
- virtual ::rtl::OUString SAL_CALL
- getImplementationName()
- throw(::com::sun::star::uno::RuntimeException);
- 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);
-
-
- static inline ::rtl::OUString
- getImplementationName_Static() throw();
- static com::sun::star::uno::Sequence< ::rtl::OUString >
- getSupportedServiceNames_Static() throw();
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ 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);
+
+
+ static inline ::rtl::OUString getImplementationName_Static() throw();
+ static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
};
inline ::rtl::OUString LinguProps::getImplementationName_Static() throw()
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index a8d595e85789..b6e4fdcef6b5 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -31,21 +31,21 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_linguistic.hxx"
-#include <cppuhelper/factory.hxx> // helper for factories
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/linguistic2/XSupportedLocales.hpp>
-
#include <com/sun/star/linguistic2/DictionaryListEventFlags.hpp>
#include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp>
+
#include <tools/solar.h>
-#include <i18npool/mslangid.hxx>
-#include <svtools/svarray.hxx>
#include <svtools/lingucfg.hxx>
-#include <cppuhelper/extract.hxx>
#include <unotools/processfactory.hxx>
+#include <i18npool/lang.h>
+#include <i18npool/mslangid.hxx>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/extract.hxx>
#include <rtl/logfile.hxx>
#include "lngsvcmgr.hxx"
@@ -54,30 +54,20 @@
#include "spelldsp.hxx"
#include "hyphdsp.hxx"
#include "thesdsp.hxx"
+#include "gciterator.hxx"
-using namespace utl;
-using namespace osl;
-using namespace rtl;
using namespace com::sun::star;
-using namespace com::sun::star::container;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::linguistic2;
using namespace linguistic;
-
-
-SV_DECL_VARARR_SORT( SortedINT16Array, INT16, 32, 32)
-SV_IMPL_VARARR_SORT( SortedINT16Array, INT16 );
+using ::rtl::OUString;
// forward declarations
-Sequence< OUString > static GetLangSvcList( const Any &rVal );
-Sequence< OUString > static GetLangSvc( const Any &rVal );
+uno::Sequence< OUString > static GetLangSvcList( const uno::Any &rVal );
+uno::Sequence< OUString > static GetLangSvc( const uno::Any &rVal );
///////////////////////////////////////////////////////////////////////////
-static BOOL lcl_SeqHasString( const Sequence< OUString > &rSeq, const OUString &rText )
+static BOOL lcl_SeqHasString( const uno::Sequence< OUString > &rSeq, const OUString &rText )
{
BOOL bRes = FALSE;
@@ -96,20 +86,20 @@ static BOOL lcl_SeqHasString( const Sequence< OUString > &rSeq, const OUString &
///////////////////////////////////////////////////////////////////////////
-static Sequence< Locale > GetAvailLocales(
- const Sequence< OUString > &rSvcImplNames )
+static uno::Sequence< lang::Locale > GetAvailLocales(
+ const uno::Sequence< OUString > &rSvcImplNames )
{
- Sequence< Locale > aRes;
+ uno::Sequence< lang::Locale > aRes;
- Reference< XMultiServiceFactory > xFac( getProcessServiceFactory() );
+ uno::Reference< lang::XMultiServiceFactory > xFac( utl::getProcessServiceFactory() );
INT32 nNames = rSvcImplNames.getLength();
if (nNames && xFac.is())
{
- SortedINT16Array aLanguages;
+ std::set< LanguageType > aLanguages;
//! since we're going to create one-instance services we have to
//! supply their arguments even if we would not need them here...
- Sequence< Any > aArgs(2);
+ uno::Sequence< uno::Any > aArgs(2);
aArgs.getArray()[0] <<= GetLinguProperties();
// check all services for the supported languages and new
@@ -119,43 +109,45 @@ static Sequence< Locale > GetAvailLocales(
for (i = 0; i < nNames; ++i)
{
- Reference< XSupportedLocales > xSuppLoc;
+ uno::Reference< linguistic2::XSupportedLocales > xSuppLoc;
try
{
- xSuppLoc = Reference< XSupportedLocales >(
- xFac->createInstanceWithArguments( pImplNames[i], aArgs ), UNO_QUERY );
+ xSuppLoc = uno::Reference< linguistic2::XSupportedLocales >(
+ xFac->createInstanceWithArguments( pImplNames[i], aArgs ), uno::UNO_QUERY );
}
catch (uno::Exception &)
{
- DBG_ERROR( "createInstanceWithArguments failed" );
+ DBG_ASSERT( 0, "createInstanceWithArguments failed" );
}
if (xSuppLoc.is())
{
- Sequence< Locale > aLoc( xSuppLoc->getLocales() );
+ uno::Sequence< lang::Locale > aLoc( xSuppLoc->getLocales() );
INT32 nLoc = aLoc.getLength();
for (INT32 k = 0; k < nLoc; ++k)
{
- const Locale *pLoc = aLoc.getConstArray();
- INT16 nLang = LocaleToLanguage( pLoc[k] );
+ const lang::Locale *pLoc = aLoc.getConstArray();
+ LanguageType nLang = LocaleToLanguage( pLoc[k] );
// language not already added?
- if (!aLanguages.Seek_Entry( nLang ))
- aLanguages.Insert( nLang );
+ if (aLanguages.find( nLang ) == aLanguages.end())
+ aLanguages.insert( nLang );
}
}
- else {
- DBG_ERROR( "interface not supported by service" );
+ else
+ {
+ DBG_ASSERT( 0, "interface not supported by service" );
}
}
// build return sequence
- INT16 nLanguages = aLanguages.Count();
+ INT32 nLanguages = static_cast< INT32 >(aLanguages.size());
aRes.realloc( nLanguages );
- Locale *pRes = aRes.getArray();
- for (i = 0; i < nLanguages; ++i)
+ lang::Locale *pRes = aRes.getArray();
+ std::set< LanguageType >::const_iterator aIt( aLanguages.begin() );
+ for (i = 0; aIt != aLanguages.end(); ++aIt, ++i)
{
- INT16 nLang = aLanguages[(USHORT) i];
+ LanguageType nLang = *aIt;
pRes[i] = CreateLocale( nLang );
}
}
@@ -167,11 +159,11 @@ static Sequence< Locale > GetAvailLocales(
struct SvcInfo
{
- const ::rtl::OUString aSvcImplName;
- const ::com::sun::star::uno::Sequence< INT16 > aSuppLanguages;
+ const OUString aSvcImplName;
+ const uno::Sequence< INT16 > aSuppLanguages;
- SvcInfo( const ::rtl::OUString &rSvcImplName,
- const ::com::sun::star::uno::Sequence< INT16 > &rSuppLanguages ) :
+ SvcInfo( const OUString &rSvcImplName,
+ const uno::Sequence< INT16 > &rSuppLanguages ) :
aSvcImplName (rSvcImplName),
aSuppLanguages (rSuppLanguages)
{
@@ -196,92 +188,39 @@ BOOL SvcInfo::HasLanguage( INT16 nLanguage ) const
}
-typedef SvcInfo * PTR_SVCINFO;
-SV_DECL_PTRARR_DEL( SvcInfoArray, PTR_SVCINFO, 16, 16 )
-SV_IMPL_PTRARR( SvcInfoArray, PTR_SVCINFO * );
-
-
///////////////////////////////////////////////////////////////////////////
-#ifdef NEVER
-
-// not used anymore (see SetAvailableCfgServiceLists)
-
-static void SetAvailableServiceLists( LinguDispatcher &rDispatcher,
- const SvcInfoArray &rInfoArray )
-{
- USHORT nSvcs = rInfoArray.Count();
-
- // build list of all available languages
- SortedINT16Array aLanguages;
- USHORT i;
- for (i = 0; i < nSvcs; ++i)
- {
- const Sequence< INT16 > &rSuppLang = rInfoArray[i]->aSuppLanguages;
- INT32 nLang = rSuppLang.getLength();
- const INT16 *pSuppLang = rSuppLang.getConstArray();
- for (INT32 j = 0; j < nLang; ++j)
- {
- // language not already added?
- if (!aLanguages.Seek_Entry( pSuppLang[j] ))
- aLanguages.Insert( pSuppLang[j] );
- }
- }
-
- // set service list per language to all available services supporting
- // that language
- INT16 nLanguages = aLanguages.Count();
- for (i = 0; i < nLanguages; ++i)
- {
- INT16 nActLang = aLanguages[i];
- Sequence< OUString > aSvcImplNames( nSvcs );
- OUString *pSvcImplName = aSvcImplNames.getArray();
- INT32 nSeqCnt = 0;
- for (USHORT j = 0; j < nSvcs; ++j)
- {
- const SvcInfo &rSvcInfo = *rInfoArray[j];
- if (rSvcInfo.HasLanguage( nActLang ))
- pSvcImplName[ nSeqCnt++ ] = rSvcInfo.aSvcImplName;
- }
- aSvcImplNames.realloc( nSeqCnt );
-
- rDispatcher.SetServiceList( CreateLocale( nActLang ), aSvcImplNames );
- }
-}
-
-#endif
-
-
void LngSvcMgr::SetAvailableCfgServiceLists( LinguDispatcher &rDispatcher,
const SvcInfoArray &rAvailSvcs )
{
- //SvtLinguConfig aCfg;
-
// get list of nodenames to look at for their service list
const char *pEntryName = 0;
BOOL bHasLangSvcList = TRUE;
switch (rDispatcher.GetDspType())
{
- case LinguDispatcher::DSP_SPELL : pEntryName = "ServiceManager/SpellCheckerList"; break;
- case LinguDispatcher::DSP_HYPH : pEntryName = "ServiceManager/HyphenatorList";
- bHasLangSvcList = FALSE;
- break;
- case LinguDispatcher::DSP_THES : pEntryName = "ServiceManager/ThesaurusList"; break;
+ case LinguDispatcher::DSP_SPELL : pEntryName = "ServiceManager/SpellCheckerList"; break;
+ case LinguDispatcher::DSP_GRAMMAR : pEntryName = "ServiceManager/GrammarCheckerList";
+ bHasLangSvcList = FALSE;
+ break;
+ case LinguDispatcher::DSP_HYPH : pEntryName = "ServiceManager/HyphenatorList";
+ bHasLangSvcList = FALSE;
+ break;
+ case LinguDispatcher::DSP_THES : pEntryName = "ServiceManager/ThesaurusList"; break;
default :
- DBG_ERROR( "unexpected case" );
+ DBG_ASSERT( 0, "unexpected case" );
}
String aNode( String::CreateFromAscii( pEntryName ) );
- Sequence < OUString > aNodeNames( /*aCfg.*/GetNodeNames( aNode ) );
+ uno::Sequence < OUString > aNodeNames( /*aCfg.*/GetNodeNames( aNode ) );
INT32 nLen = aNodeNames.getLength();
const OUString *pNodeNames = aNodeNames.getConstArray();
for (INT32 i = 0; i < nLen; ++i)
{
- Sequence< OUString > aSvcImplNames;
+ uno::Sequence< OUString > aSvcImplNames;
- Sequence< OUString > aNames( 1 );
+ uno::Sequence< OUString > aNames( 1 );
OUString *pNames = aNames.getArray();
OUString aPropName( aNode );
@@ -289,12 +228,12 @@ void LngSvcMgr::SetAvailableCfgServiceLists( LinguDispatcher &rDispatcher,
aPropName += pNodeNames[i];
pNames[0] = aPropName;
- Sequence< Any > aValues = /*aCfg.*/GetProperties( aNames );
+ uno::Sequence< uno::Any > aValues = /*aCfg.*/GetProperties( aNames );
if (aValues.getLength())
{
// get list of configured service names for the
// current node (language)
- const Any &rValue = aValues.getConstArray()[0];
+ const uno::Any &rValue = aValues.getConstArray()[0];
if (bHasLangSvcList)
aSvcImplNames = GetLangSvcList( rValue );
else
@@ -305,17 +244,17 @@ void LngSvcMgr::SetAvailableCfgServiceLists( LinguDispatcher &rDispatcher,
{
const OUString *pImplNames = aSvcImplNames.getConstArray();
- INT16 nLang = MsLangId::convertIsoStringToLanguage( pNodeNames[i] );
+ LanguageType nLang = MsLangId::convertIsoStringToLanguage( pNodeNames[i] );
// build list of available services from those
INT32 nCnt = 0;
- Sequence< OUString > aAvailSvcs( nSvcs );
+ uno::Sequence< OUString > aAvailSvcs( nSvcs );
OUString *pAvailSvcs = aAvailSvcs.getArray();
for (INT32 k = 0; k < nSvcs; ++k)
{
// check for availability of the service
- USHORT nAvailSvcs = rAvailSvcs.Count();
- for (USHORT m = 0; m < nAvailSvcs; ++m)
+ size_t nAvailSvcs = rAvailSvcs.size();
+ for (size_t m = 0; m < nAvailSvcs; ++m)
{
const SvcInfo &rSvcInfo = *rAvailSvcs[m];
if (rSvcInfo.aSvcImplName == pImplNames[k] &&
@@ -344,17 +283,18 @@ void LngSvcMgr::SetAvailableCfgServiceLists( LinguDispatcher &rDispatcher,
class LngSvcMgrListenerHelper :
public cppu::WeakImplHelper2
<
- XLinguServiceEventListener,
- XDictionaryListEventListener
+ linguistic2::XLinguServiceEventListener,
+ linguistic2::XDictionaryListEventListener
>
{
- Timer aLaunchTimer;
+ LngSvcMgr &rMyManager;
+ Timer aLaunchTimer;
//cppu::OMultiTypeInterfaceContainerHelper aListeners;
::cppu::OInterfaceContainerHelper aLngSvcMgrListeners;
::cppu::OInterfaceContainerHelper aLngSvcEvtBroadcasters;
- Reference< XDictionaryList > xDicList;
- Reference< XInterface > xMyEvtObj;
+ uno::Reference< linguistic2::XDictionaryList > xDicList;
+ uno::Reference< uno::XInterface > xMyEvtObj;
INT16 nCombinedLngSvcEvt;
@@ -367,42 +307,45 @@ class LngSvcMgrListenerHelper :
DECL_LINK( TimeOut, Timer* );
public:
- LngSvcMgrListenerHelper( const Reference< XInterface > &rxSource,
- const Reference< XDictionaryList > &rxDicList );
+ LngSvcMgrListenerHelper( LngSvcMgr &rLngSvcMgr,
+ const uno::Reference< uno::XInterface > &rxSource,
+ const uno::Reference< linguistic2::XDictionaryList > &rxDicList );
- // XEventListener
+ // lang::XEventListener
virtual void SAL_CALL
- disposing( const EventObject& rSource )
- throw(RuntimeException);
+ disposing( const lang::EventObject& rSource )
+ throw(uno::RuntimeException);
- // XLinguServiceEventListener
+ // linguistic2::XLinguServiceEventListener
virtual void SAL_CALL
- processLinguServiceEvent( const LinguServiceEvent& aLngSvcEvent )
- throw(RuntimeException);
+ processLinguServiceEvent( const linguistic2::LinguServiceEvent& aLngSvcEvent )
+ throw(uno::RuntimeException);
- // XDictionaryListEventListener
+ // linguistic2::XDictionaryListEventListener
virtual void SAL_CALL
processDictionaryListEvent(
- const DictionaryListEvent& rDicListEvent )
- throw(RuntimeException);
+ const linguistic2::DictionaryListEvent& rDicListEvent )
+ throw(uno::RuntimeException);
inline BOOL AddLngSvcMgrListener(
- const Reference< XEventListener >& rxListener );
+ const uno::Reference< lang::XEventListener >& rxListener );
inline BOOL RemoveLngSvcMgrListener(
- const Reference< XEventListener >& rxListener );
- void DisposeAndClear( const EventObject &rEvtObj );
+ const uno::Reference< lang::XEventListener >& rxListener );
+ void DisposeAndClear( const lang::EventObject &rEvtObj );
BOOL AddLngSvcEvtBroadcaster(
- const Reference< XLinguServiceEventBroadcaster > &rxBroadcaster );
+ const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster );
BOOL RemoveLngSvcEvtBroadcaster(
- const Reference< XLinguServiceEventBroadcaster > &rxBroadcaster );
+ const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster );
void AddLngSvcEvt( INT16 nLngSvcEvt );
};
LngSvcMgrListenerHelper::LngSvcMgrListenerHelper(
- const Reference< XInterface > &rxSource,
- const Reference< XDictionaryList > &rxDicList ) :
+ LngSvcMgr &rLngSvcMgr,
+ const uno::Reference< uno::XInterface > &rxSource,
+ const uno::Reference< linguistic2::XDictionaryList > &rxDicList ) :
+ rMyManager ( rLngSvcMgr ),
aLngSvcMgrListeners ( GetLinguMutex() ),
aLngSvcEvtBroadcasters ( GetLinguMutex() ),
xDicList ( rxDicList ),
@@ -411,7 +354,7 @@ LngSvcMgrListenerHelper::LngSvcMgrListenerHelper(
if (xDicList.is())
{
xDicList->addDictionaryListEventListener(
- (XDictionaryListEventListener *) this, FALSE );
+ (linguistic2::XDictionaryListEventListener *) this, FALSE );
}
//! The timer is used to 'sum up' different events in order to reduce the
@@ -426,12 +369,12 @@ LngSvcMgrListenerHelper::LngSvcMgrListenerHelper(
}
-void SAL_CALL LngSvcMgrListenerHelper::disposing( const EventObject& rSource )
- throw(RuntimeException)
+void SAL_CALL LngSvcMgrListenerHelper::disposing( const lang::EventObject& rSource )
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
- Reference< XInterface > xRef( rSource.Source );
+ uno::Reference< uno::XInterface > xRef( rSource.Source );
if ( xRef.is() )
{
aLngSvcMgrListeners .removeInterface( xRef );
@@ -444,21 +387,24 @@ void SAL_CALL LngSvcMgrListenerHelper::disposing( const EventObject& rSource )
IMPL_LINK( LngSvcMgrListenerHelper, TimeOut, Timer*, pTimer )
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
if (&aLaunchTimer == pTimer)
{
// change event source to LinguServiceManager since the listeners
// probably do not know (and need not to know) about the specific
// SpellChecker's or Hyphenator's.
- LinguServiceEvent aEvtObj( xMyEvtObj, nCombinedLngSvcEvt );
+ linguistic2::LinguServiceEvent aEvtObj( xMyEvtObj, nCombinedLngSvcEvt );
nCombinedLngSvcEvt = 0;
- // pass event on to XLinguServiceEventListener's
+ if (rMyManager.pSpellDsp)
+ rMyManager.pSpellDsp->FlushSpellCache();
+
+ // pass event on to linguistic2::XLinguServiceEventListener's
cppu::OInterfaceIteratorHelper aIt( aLngSvcMgrListeners );
while (aIt.hasMoreElements())
{
- Reference< XLinguServiceEventListener > xRef( aIt.next(), UNO_QUERY );
+ uno::Reference< linguistic2::XLinguServiceEventListener > xRef( aIt.next(), uno::UNO_QUERY );
if (xRef.is())
xRef->processLinguServiceEvent( aEvtObj );
}
@@ -476,20 +422,20 @@ void LngSvcMgrListenerHelper::AddLngSvcEvt( INT16 nLngSvcEvt )
void SAL_CALL
LngSvcMgrListenerHelper::processLinguServiceEvent(
- const LinguServiceEvent& rLngSvcEvent )
- throw(RuntimeException)
+ const linguistic2::LinguServiceEvent& rLngSvcEvent )
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
AddLngSvcEvt( rLngSvcEvent.nEvent );
}
void SAL_CALL
LngSvcMgrListenerHelper::processDictionaryListEvent(
- const DictionaryListEvent& rDicListEvent )
- throw(RuntimeException)
+ const linguistic2::DictionaryListEvent& rDicListEvent )
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
INT16 nDlEvt = rDicListEvent.nCondensedEvent;
if (0 == nDlEvt)
@@ -497,44 +443,46 @@ void SAL_CALL
// we do keep the original event source here though...
- // pass event on to XDictionaryListEventListener's
+ // pass event on to linguistic2::XDictionaryListEventListener's
cppu::OInterfaceIteratorHelper aIt( aLngSvcMgrListeners );
while (aIt.hasMoreElements())
{
- Reference< XDictionaryListEventListener > xRef( aIt.next(), UNO_QUERY );
+ uno::Reference< linguistic2::XDictionaryListEventListener > xRef( aIt.next(), uno::UNO_QUERY );
if (xRef.is())
xRef->processDictionaryListEvent( rDicListEvent );
}
//
- // "translate" DictionaryList event into LinguServiceEvent
+ // "translate" DictionaryList event into linguistic2::LinguServiceEvent
//
INT16 nLngSvcEvt = 0;
//
INT16 nSpellCorrectFlags =
- DictionaryListEventFlags::ADD_NEG_ENTRY |
- DictionaryListEventFlags::DEL_POS_ENTRY |
- DictionaryListEventFlags::ACTIVATE_NEG_DIC |
- DictionaryListEventFlags::DEACTIVATE_POS_DIC;
+ linguistic2::DictionaryListEventFlags::ADD_NEG_ENTRY |
+ linguistic2::DictionaryListEventFlags::DEL_POS_ENTRY |
+ linguistic2::DictionaryListEventFlags::ACTIVATE_NEG_DIC |
+ linguistic2::DictionaryListEventFlags::DEACTIVATE_POS_DIC;
if (0 != (nDlEvt & nSpellCorrectFlags))
- nLngSvcEvt |= LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN;
+ nLngSvcEvt |= linguistic2::LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN;
//
INT16 nSpellWrongFlags =
- DictionaryListEventFlags::ADD_POS_ENTRY |
- DictionaryListEventFlags::DEL_NEG_ENTRY |
- DictionaryListEventFlags::ACTIVATE_POS_DIC |
- DictionaryListEventFlags::DEACTIVATE_NEG_DIC;
+ linguistic2::DictionaryListEventFlags::ADD_POS_ENTRY |
+ linguistic2::DictionaryListEventFlags::DEL_NEG_ENTRY |
+ linguistic2::DictionaryListEventFlags::ACTIVATE_POS_DIC |
+ linguistic2::DictionaryListEventFlags::DEACTIVATE_NEG_DIC;
if (0 != (nDlEvt & nSpellWrongFlags))
- nLngSvcEvt |= LinguServiceEventFlags::SPELL_WRONG_WORDS_AGAIN;
+ nLngSvcEvt |= linguistic2::LinguServiceEventFlags::SPELL_WRONG_WORDS_AGAIN;
//
INT16 nHyphenateFlags =
- DictionaryListEventFlags::ADD_POS_ENTRY |
- DictionaryListEventFlags::DEL_POS_ENTRY |
- DictionaryListEventFlags::ACTIVATE_POS_DIC |
- DictionaryListEventFlags::ACTIVATE_NEG_DIC;
+ linguistic2::DictionaryListEventFlags::ADD_POS_ENTRY |
+ linguistic2::DictionaryListEventFlags::DEL_POS_ENTRY |
+ linguistic2::DictionaryListEventFlags::ACTIVATE_POS_DIC |
+ linguistic2::DictionaryListEventFlags::ACTIVATE_NEG_DIC;
if (0 != (nDlEvt & nHyphenateFlags))
- nLngSvcEvt |= LinguServiceEventFlags::HYPHENATE_AGAIN;
- //
+ nLngSvcEvt |= linguistic2::LinguServiceEventFlags::HYPHENATE_AGAIN;
+
+ if (rMyManager.pSpellDsp)
+ rMyManager.pSpellDsp->FlushSpellCache();
if (nLngSvcEvt)
LaunchEvent( nLngSvcEvt );
}
@@ -542,13 +490,13 @@ void SAL_CALL
void LngSvcMgrListenerHelper::LaunchEvent( INT16 nLngSvcEvtFlags )
{
- LinguServiceEvent aEvt( xMyEvtObj, nLngSvcEvtFlags );
+ linguistic2::LinguServiceEvent aEvt( xMyEvtObj, nLngSvcEvtFlags );
- // pass event on to XLinguServiceEventListener's
+ // pass event on to linguistic2::XLinguServiceEventListener's
cppu::OInterfaceIteratorHelper aIt( aLngSvcMgrListeners );
while (aIt.hasMoreElements())
{
- Reference< XLinguServiceEventListener > xRef( aIt.next(), UNO_QUERY );
+ uno::Reference< linguistic2::XLinguServiceEventListener > xRef( aIt.next(), uno::UNO_QUERY );
if (xRef.is())
xRef->processLinguServiceEvent( aEvt );
}
@@ -556,28 +504,22 @@ void LngSvcMgrListenerHelper::LaunchEvent( INT16 nLngSvcEvtFlags )
inline BOOL LngSvcMgrListenerHelper::AddLngSvcMgrListener(
- const Reference< XEventListener >& rxListener )
+ const uno::Reference< lang::XEventListener >& rxListener )
{
- aLngSvcMgrListeners.addInterface(
- /*::getCppuType((const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener >*)0), */
- rxListener );
+ aLngSvcMgrListeners.addInterface( rxListener );
return TRUE;
}
inline BOOL LngSvcMgrListenerHelper::RemoveLngSvcMgrListener(
- const Reference< XEventListener >& rxListener )
+ const uno::Reference< lang::XEventListener >& rxListener )
{
- aLngSvcMgrListeners.removeInterface(
- /*::getCppuType((const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener >*)0), */
- rxListener );
+ aLngSvcMgrListeners.removeInterface( rxListener );
return TRUE;
}
-void LngSvcMgrListenerHelper::DisposeAndClear( const EventObject &rEvtObj )
+void LngSvcMgrListenerHelper::DisposeAndClear( const lang::EventObject &rEvtObj )
{
// call "disposing" for all listeners and clear list
aLngSvcMgrListeners .disposeAndClear( rEvtObj );
@@ -586,7 +528,7 @@ void LngSvcMgrListenerHelper::DisposeAndClear( const EventObject &rEvtObj )
cppu::OInterfaceIteratorHelper aIt( aLngSvcEvtBroadcasters );
while (aIt.hasMoreElements())
{
- Reference< XLinguServiceEventBroadcaster > xRef( aIt.next(), UNO_QUERY );
+ uno::Reference< linguistic2::XLinguServiceEventBroadcaster > xRef( aIt.next(), uno::UNO_QUERY );
if (xRef.is())
RemoveLngSvcEvtBroadcaster( xRef );
}
@@ -595,35 +537,35 @@ void LngSvcMgrListenerHelper::DisposeAndClear( const EventObject &rEvtObj )
if (xDicList.is())
{
xDicList->removeDictionaryListEventListener(
- (XDictionaryListEventListener *) this );
+ (linguistic2::XDictionaryListEventListener *) this );
xDicList = 0;
}
}
BOOL LngSvcMgrListenerHelper::AddLngSvcEvtBroadcaster(
- const Reference< XLinguServiceEventBroadcaster > &rxBroadcaster )
+ const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster )
{
BOOL bRes = FALSE;
if (rxBroadcaster.is())
{
aLngSvcEvtBroadcasters.addInterface( rxBroadcaster );
rxBroadcaster->addLinguServiceEventListener(
- (XLinguServiceEventListener *) this );
+ (linguistic2::XLinguServiceEventListener *) this );
}
return bRes;
}
BOOL LngSvcMgrListenerHelper::RemoveLngSvcEvtBroadcaster(
- const Reference< XLinguServiceEventBroadcaster > &rxBroadcaster )
+ const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster )
{
BOOL bRes = FALSE;
if (rxBroadcaster.is())
{
aLngSvcEvtBroadcasters.removeInterface( rxBroadcaster );
rxBroadcaster->removeLinguServiceEventListener(
- (XLinguServiceEventListener *) this );
+ (linguistic2::XLinguServiceEventListener *) this );
}
return bRes;
}
@@ -637,25 +579,29 @@ LngSvcMgr::LngSvcMgr() :
aEvtListeners ( GetLinguMutex() )
{
bHasAvailSpellLocales =
+ bHasAvailGrammarLocales =
bHasAvailHyphLocales =
bHasAvailThesLocales =
bDisposing = FALSE;
pSpellDsp = 0;
+ pGrammarDsp = 0;
pHyphDsp = 0;
pThesDsp = 0;
- pAvailSpellSvcs = 0;
- pAvailHyphSvcs = 0;
- pAvailThesSvcs = 0;
- pListenerHelper = 0;
+ pAvailSpellSvcs = 0;
+ pAvailGrammarSvcs = 0;
+ pAvailHyphSvcs = 0;
+ pAvailThesSvcs = 0;
+ pListenerHelper = 0;
// request notify events when properties (i.e. something in the subtree) changes
- Sequence< OUString > aNames(3);
+ uno::Sequence< OUString > aNames(4);
OUString *pNames = aNames.getArray();
pNames[0] = A2OU( "ServiceManager/SpellCheckerList" );
- pNames[1] = A2OU( "ServiceManager/HyphenatorList" );
- pNames[2] = A2OU( "ServiceManager/ThesaurusList" );
+ pNames[1] = A2OU( "ServiceManager/GrammarCheckerList" );
+ pNames[2] = A2OU( "ServiceManager/HyphenatorList" );
+ pNames[3] = A2OU( "ServiceManager/ThesaurusList" );
EnableNotification( aNames );
}
@@ -664,26 +610,29 @@ LngSvcMgr::~LngSvcMgr()
{
// memory for pSpellDsp, pHyphDsp, pThesDsp, pListenerHelper
// will be freed in the destructor of the respective Reference's
- // xSpellDsp, xHyphDsp, xThesDsp
+ // xSpellDsp, xGrammarDsp, xHyphDsp, xThesDsp
delete pAvailSpellSvcs;
+ delete pAvailGrammarSvcs;
delete pAvailHyphSvcs;
delete pAvailThesSvcs;
}
-void LngSvcMgr::Notify( const Sequence< OUString > &rPropertyNames )
+void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
{
const OUString aSpellCheckerList( A2OU("ServiceManager/SpellCheckerList") );
+ const OUString aGrammarCheckerList( A2OU("ServiceManager/GrammarCheckerList") );
const OUString aHyphenatorList( A2OU("ServiceManager/HyphenatorList") );
const OUString aThesaurusList( A2OU("ServiceManager/ThesaurusList") );
- const Sequence< OUString > aSpellCheckerListEntries( GetNodeNames( aSpellCheckerList ) );
- const Sequence< OUString > aHyphenatorListEntries( GetNodeNames( aHyphenatorList ) );
- const Sequence< OUString > aThesaurusListEntries( GetNodeNames( aThesaurusList ) );
+ const uno::Sequence< OUString > aSpellCheckerListEntries( GetNodeNames( aSpellCheckerList ) );
+ const uno::Sequence< OUString > aGrammarCheckerListEntries( GetNodeNames( aGrammarCheckerList ) );
+ const uno::Sequence< OUString > aHyphenatorListEntries( GetNodeNames( aHyphenatorList ) );
+ const uno::Sequence< OUString > aThesaurusListEntries( GetNodeNames( aThesaurusList ) );
- Sequence< Any > aValues;
- Sequence< OUString > aNames( 1 );
+ uno::Sequence< uno::Any > aValues;
+ uno::Sequence< OUString > aNames( 1 );
OUString *pNames = aNames.getArray();
sal_Int32 nLen = rPropertyNames.getLength();
@@ -700,7 +649,7 @@ void LngSvcMgr::Notify( const Sequence< OUString > &rPropertyNames )
OUString aKeyText;
if (nKeyStart != -1 && nKeyEnd != -1)
aKeyText = rName.copy( nKeyStart + 2, nKeyEnd - nKeyStart - 2);
- DBG_ASSERT( aKeyText.getLength() != 0, "unexpected key (Locale) string" );
+ DBG_ASSERT( aKeyText.getLength() != 0, "unexpected key (lang::Locale) string" );
if (0 == rName.compareTo( aSpellCheckerList, aSpellCheckerList.getLength() ))
{
// delete old cached data, needs to be acquired new on demand
@@ -714,7 +663,7 @@ void LngSvcMgr::Notify( const Sequence< OUString > &rPropertyNames )
aPropName += aKeyText;
pNames[0] = aPropName;
aValues = /*aCfg.*/GetProperties( aNames );
- Sequence< OUString > aSvcImplNames;
+ uno::Sequence< OUString > aSvcImplNames;
if (aValues.getLength())
aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
@@ -726,6 +675,34 @@ void LngSvcMgr::Notify( const Sequence< OUString > &rPropertyNames )
pSpellDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
}
}
+ else if (0 == rName.compareTo( aGrammarCheckerList, aGrammarCheckerList.getLength() ))
+ {
+ // delete old cached data, needs to be acquired new on demand
+ delete pAvailGrammarSvcs; pAvailGrammarSvcs = 0;
+
+ OUString aNode( aGrammarCheckerList );
+ if (lcl_SeqHasString( aGrammarCheckerListEntries, aKeyText ))
+ {
+ OUString aPropName( aNode );
+ aPropName += OUString::valueOf( (sal_Unicode) '/' );
+ aPropName += aKeyText;
+ pNames[0] = aPropName;
+ aValues = /*aCfg.*/GetProperties( aNames );
+ uno::Sequence< OUString > aSvcImplNames;
+ if (aValues.getLength())
+ aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
+
+ LanguageType nLang = LANGUAGE_NONE;
+ if (0 != aKeyText.getLength())
+ nLang = MsLangId::convertIsoStringToLanguage( aKeyText );
+
+ if (SvtLinguConfig().HasGrammarChecker())
+ {
+ GetGrammarCheckerDsp_Impl( sal_False ); // don't set service list, it will be done below
+ pGrammarDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
+ }
+ }
+ }
else if (0 == rName.compareTo( aHyphenatorList, aHyphenatorList.getLength() ))
{
// delete old cached data, needs to be acquired new on demand
@@ -739,7 +716,7 @@ void LngSvcMgr::Notify( const Sequence< OUString > &rPropertyNames )
aPropName += aKeyText;
pNames[0] = aPropName;
aValues = /*aCfg.*/GetProperties( aNames );
- Sequence< OUString > aSvcImplNames;
+ uno::Sequence< OUString > aSvcImplNames;
if (aValues.getLength())
aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
@@ -764,7 +741,7 @@ void LngSvcMgr::Notify( const Sequence< OUString > &rPropertyNames )
aPropName += aKeyText;
pNames[0] = aPropName;
aValues = /*aCfg.*/GetProperties( aNames );
- Sequence< OUString > aSvcImplNames;
+ uno::Sequence< OUString > aSvcImplNames;
if (aValues.getLength())
aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
@@ -776,8 +753,9 @@ void LngSvcMgr::Notify( const Sequence< OUString > &rPropertyNames )
pThesDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
}
}
- else {
- DBG_ERROR( "nofified for unexpected property" );
+ else
+ {
+ DBG_ASSERT( 0, "nofified for unexpected property" );
}
}
}
@@ -795,9 +773,9 @@ void LngSvcMgr::GetListenerHelper_Impl()
{
if (!pListenerHelper)
{
- pListenerHelper = new LngSvcMgrListenerHelper(
+ pListenerHelper = new LngSvcMgrListenerHelper( *this,
(XLinguServiceManager *) this, linguistic::GetDictionaryList() );
- xListenerHelper = (XLinguServiceEventListener *) pListenerHelper;
+ xListenerHelper = (linguistic2::XLinguServiceEventListener *) pListenerHelper;
}
}
@@ -814,6 +792,37 @@ void LngSvcMgr::GetSpellCheckerDsp_Impl( sal_Bool bSetSvcList )
}
+void LngSvcMgr::GetGrammarCheckerDsp_Impl( sal_Bool bSetSvcList )
+{
+ if (!pGrammarDsp && SvtLinguConfig().HasGrammarChecker())
+ {
+ //! since the grammar checking iterator needs to be a one instance service
+ //! we need to create it the correct way!
+ uno::Reference< linguistic2::XProofreadingIterator > xGCI;
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr(
+ utl::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
+ xGCI = uno::Reference< linguistic2::XProofreadingIterator >(
+ xMgr->createInstance( A2OU( SN_GRAMMARCHECKINGITERATOR ) ), uno::UNO_QUERY_THROW );
+ }
+ catch (uno::Exception &)
+ {
+ }
+ DBG_ASSERT( xGCI.is(), "instantiating grammar checking iterator failed" );
+
+ if (xGCI.is())
+ {
+ pGrammarDsp = dynamic_cast< GrammarCheckingIterator * >(xGCI.get());
+ xGrammarDsp = xGCI;
+ DBG_ASSERT( pGrammarDsp, "failed to get implementation" );
+ if (bSetSvcList)
+ SetCfgServiceLists( *pGrammarDsp );
+ }
+ }
+}
+
+
void LngSvcMgr::GetHyphenatorDsp_Impl( sal_Bool bSetSvcList )
{
if (!pHyphDsp)
@@ -844,11 +853,11 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
{
pAvailSpellSvcs = new SvcInfoArray;
- Reference< XMultiServiceFactory > xFac( getProcessServiceFactory() );
+ uno::Reference< lang::XMultiServiceFactory > xFac( utl::getProcessServiceFactory() );
if (xFac.is())
{
- Reference< XContentEnumerationAccess > xEnumAccess( xFac, UNO_QUERY );
- Reference< XEnumeration > xEnum;
+ uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xFac, uno::UNO_QUERY );
+ uno::Reference< container::XEnumeration > xEnum;
if (xEnumAccess.is())
xEnum = xEnumAccess->createContentEnumeration(
A2OU( SN_SPELLCHECKER ) );
@@ -857,45 +866,109 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
{
while (xEnum->hasMoreElements())
{
- Any aCurrent = xEnum->nextElement();
- Reference< XSingleComponentFactory > xCompFactory;
- Reference< XSingleServiceFactory > xFactory;
+ uno::Any aCurrent = xEnum->nextElement();
+ uno::Reference< lang::XSingleComponentFactory > xCompFactory;
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
+
+ uno::Reference< linguistic2::XSpellChecker > xSvc;
+ if ( cppu::extractInterface( xCompFactory, aCurrent ) || ::cppu::extractInterface( xFactory, aCurrent ) )
+ {
+ try
+ {
+ uno::Reference < uno::XComponentContext > xContext;
+ uno::Reference< beans::XPropertySet > xProps( xFac, uno::UNO_QUERY );
+
+ xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
+ xSvc = uno::Reference< linguistic2::XSpellChecker >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
+ }
+ catch (uno::Exception &)
+ {
+ DBG_ASSERT( 0, "createInstance failed" );
+ }
+ }
+
+ if (xSvc.is())
+ {
+ OUString aImplName;
+ uno::Sequence< INT16 > aLanguages;
+ uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
+ if (xInfo.is())
+ aImplName = xInfo->getImplementationName();
+ DBG_ASSERT( aImplName.getLength(),
+ "empty implementation name" );
+ uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, uno::UNO_QUERY );
+ DBG_ASSERT( xSuppLoc.is(), "interfaces not supported" );
+ if (xSuppLoc.is()) {
+ uno::Sequence<lang::Locale> aLocaleSequence(xSuppLoc->getLocales());
+ aLanguages = LocaleSeqToLangSeq( aLocaleSequence );
+ }
+
+ pAvailSpellSvcs->push_back( new SvcInfo( aImplName, aLanguages ) );
+ }
+ }
+ }
+ }
+ }
+}
+
+
+void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
+{
+ if (!pAvailGrammarSvcs)
+ {
+ pAvailGrammarSvcs = new SvcInfoArray;
+
+ uno::Reference< lang::XMultiServiceFactory > xFac( utl::getProcessServiceFactory() );
+ if (xFac.is())
+ {
+ uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xFac, uno::UNO_QUERY );
+ uno::Reference< container::XEnumeration > xEnum;
+ if (xEnumAccess.is())
+ xEnum = xEnumAccess->createContentEnumeration(
+ A2OU( SN_GRAMMARCHECKER ) );
+
+ if (xEnum.is())
+ {
+ while (xEnum->hasMoreElements())
+ {
+ uno::Any aCurrent = xEnum->nextElement();
+ uno::Reference< lang::XSingleComponentFactory > xCompFactory;
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
- Reference< XSpellChecker > xSvc;
+ uno::Reference< linguistic2::XProofreader > xSvc;
if ( cppu::extractInterface( xCompFactory, aCurrent ) || ::cppu::extractInterface( xFactory, aCurrent ) )
{
try
{
- Reference < XComponentContext > xContext;
- Reference< XPropertySet > xProps( xFac, UNO_QUERY );
+ uno::Reference < uno::XComponentContext > xContext;
+ uno::Reference< beans::XPropertySet > xProps( xFac, uno::UNO_QUERY );
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
- xSvc = Reference< XSpellChecker >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), UNO_QUERY );
+ xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
+ xSvc = uno::Reference< linguistic2::XProofreader >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
}
catch (uno::Exception &)
{
- DBG_ERROR( "createInstance failed" );
+ DBG_ASSERT( 0, "createInstance failed" );
}
}
if (xSvc.is())
{
OUString aImplName;
- Sequence< INT16 > aLanguages;
- Reference< XServiceInfo > xInfo( xSvc, UNO_QUERY );
+ uno::Sequence< INT16 > aLanguages;
+ uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
if (xInfo.is())
aImplName = xInfo->getImplementationName();
DBG_ASSERT( aImplName.getLength(),
"empty implementation name" );
- Reference< XSupportedLocales > xSuppLoc( xSvc, UNO_QUERY );
+ uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, uno::UNO_QUERY );
DBG_ASSERT( xSuppLoc.is(), "interfaces not supported" );
if (xSuppLoc.is()) {
- Sequence<Locale> aLocaleSequence(xSuppLoc->getLocales());
+ uno::Sequence<lang::Locale> aLocaleSequence(xSuppLoc->getLocales());
aLanguages = LocaleSeqToLangSeq( aLocaleSequence );
}
- pAvailSpellSvcs->Insert( new SvcInfo( aImplName, aLanguages ),
- pAvailSpellSvcs->Count() );
+ pAvailGrammarSvcs->push_back( new SvcInfo( aImplName, aLanguages ) );
}
}
}
@@ -909,11 +982,11 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
if (!pAvailHyphSvcs)
{
pAvailHyphSvcs = new SvcInfoArray;
- Reference< XMultiServiceFactory > xFac( getProcessServiceFactory() );
+ uno::Reference< lang::XMultiServiceFactory > xFac( utl::getProcessServiceFactory() );
if (xFac.is())
{
- Reference< XContentEnumerationAccess > xEnumAccess( xFac, UNO_QUERY );
- Reference< XEnumeration > xEnum;
+ uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xFac, uno::UNO_QUERY );
+ uno::Reference< container::XEnumeration > xEnum;
if (xEnumAccess.is())
xEnum = xEnumAccess->createContentEnumeration( A2OU( SN_HYPHENATOR ) );
@@ -921,46 +994,45 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
{
while (xEnum->hasMoreElements())
{
- Any aCurrent = xEnum->nextElement();
- Reference< XSingleComponentFactory > xCompFactory;
- Reference< XSingleServiceFactory > xFactory;
+ uno::Any aCurrent = xEnum->nextElement();
+ uno::Reference< lang::XSingleComponentFactory > xCompFactory;
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
- Reference< XHyphenator > xSvc;
+ uno::Reference< linguistic2::XHyphenator > xSvc;
if ( cppu::extractInterface( xCompFactory, aCurrent ) || ::cppu::extractInterface( xFactory, aCurrent ) )
{
try
{
- Reference < XComponentContext > xContext;
- Reference< XPropertySet > xProps( xFac, UNO_QUERY );
+ uno::Reference < uno::XComponentContext > xContext;
+ uno::Reference< beans::XPropertySet > xProps( xFac, uno::UNO_QUERY );
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
- xSvc = Reference< XHyphenator >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), UNO_QUERY );
+ xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
+ xSvc = uno::Reference< linguistic2::XHyphenator >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
}
catch (uno::Exception &)
{
- DBG_ERROR( "createInstance failed" );
+ DBG_ASSERT( 0, "createInstance failed" );
}
}
if (xSvc.is())
{
OUString aImplName;
- Sequence< INT16 > aLanguages;
- Reference< XServiceInfo > xInfo( xSvc, UNO_QUERY );
+ uno::Sequence< INT16 > aLanguages;
+ uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
if (xInfo.is())
aImplName = xInfo->getImplementationName();
DBG_ASSERT( aImplName.getLength(),
"empty implementation name" );
- Reference< XSupportedLocales > xSuppLoc( xSvc, UNO_QUERY );
+ uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, uno::UNO_QUERY );
DBG_ASSERT( xSuppLoc.is(), "interfaces not supported" );
if (xSuppLoc.is()) {
- Sequence<Locale> aLocaleSequence(xSuppLoc->getLocales());
+ uno::Sequence<lang::Locale> aLocaleSequence(xSuppLoc->getLocales());
aLanguages = LocaleSeqToLangSeq( aLocaleSequence );
}
- pAvailHyphSvcs->Insert( new SvcInfo( aImplName, aLanguages ),
- pAvailHyphSvcs->Count() );
+ pAvailHyphSvcs->push_back( new SvcInfo( aImplName, aLanguages ) );
}
}
}
@@ -975,11 +1047,11 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl()
{
pAvailThesSvcs = new SvcInfoArray;
- Reference< XMultiServiceFactory > xFac( getProcessServiceFactory() );
+ uno::Reference< lang::XMultiServiceFactory > xFac( utl::getProcessServiceFactory() );
if (xFac.is())
{
- Reference< XContentEnumerationAccess > xEnumAccess( xFac, UNO_QUERY );
- Reference< XEnumeration > xEnum;
+ uno::Reference< container::XContentEnumerationAccess > xEnumAccess( xFac, uno::UNO_QUERY );
+ uno::Reference< container::XEnumeration > xEnum;
if (xEnumAccess.is())
xEnum = xEnumAccess->createContentEnumeration(
A2OU( SN_THESAURUS ) );
@@ -988,46 +1060,45 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl()
{
while (xEnum->hasMoreElements())
{
- Any aCurrent = xEnum->nextElement();
+ uno::Any aCurrent = xEnum->nextElement();
- Reference< XSingleComponentFactory > xCompFactory;
- Reference< XSingleServiceFactory > xFactory;
+ uno::Reference< lang::XSingleComponentFactory > xCompFactory;
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
- Reference< XThesaurus > xSvc;
+ uno::Reference< linguistic2::XThesaurus > xSvc;
if ( cppu::extractInterface( xCompFactory, aCurrent ) || ::cppu::extractInterface( xFactory, aCurrent ) )
{
try
{
- Reference < XComponentContext > xContext;
- Reference< XPropertySet > xProps( xFac, UNO_QUERY );
+ uno::Reference < uno::XComponentContext > xContext;
+ uno::Reference< beans::XPropertySet > xProps( xFac, uno::UNO_QUERY );
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
- xSvc = Reference< XThesaurus >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), UNO_QUERY );
+ xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
+ xSvc = uno::Reference< linguistic2::XThesaurus >( ( xCompFactory.is() ? xCompFactory->createInstanceWithContext( xContext ) : xFactory->createInstance() ), uno::UNO_QUERY );
}
catch (uno::Exception &)
{
- DBG_ERROR( "createInstance failed" );
+ DBG_ASSERT( 0, "createInstance failed" );
}
}
if (xSvc.is())
{
OUString aImplName;
- Sequence< INT16 > aLanguages;
- Reference< XServiceInfo > xInfo( xSvc, UNO_QUERY );
+ uno::Sequence< INT16 > aLanguages;
+ uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
if (xInfo.is())
aImplName = xInfo->getImplementationName();
DBG_ASSERT( aImplName.getLength(),
"empty implementation name" );
- Reference< XSupportedLocales > xSuppLoc( xSvc, UNO_QUERY );
+ uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, uno::UNO_QUERY );
DBG_ASSERT( xSuppLoc.is(), "interfaces not supported" );
if (xSuppLoc.is()) {
- Sequence<Locale> aLocaleSequence(xSuppLoc->getLocales());
+ uno::Sequence<lang::Locale> aLocaleSequence(xSuppLoc->getLocales());
aLanguages = LocaleSeqToLangSeq( aLocaleSequence );
}
- pAvailThesSvcs->Insert( new SvcInfo( aImplName, aLanguages ),
- pAvailThesSvcs->Count() );
+ pAvailThesSvcs->push_back( new SvcInfo( aImplName, aLanguages ) );
}
}
}
@@ -1040,10 +1111,8 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp )
{
RTL_LOGFILE_CONTEXT( aLog, "linguistic: LngSvcMgr::SetCfgServiceLists - Spell" );
- //SvtLinguConfig aCfg;
-
String aNode( String::CreateFromAscii( "ServiceManager/SpellCheckerList" ) );
- Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
+ uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
OUString *pNames = aNames.getArray();
INT32 nLen = aNames.getLength();
@@ -1057,13 +1126,13 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp )
pNames[i] = aTmp;
}
- Sequence< Any > aValues( /*aCfg.*/GetProperties( aNames ) );
+ uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
if (nLen && nLen == aValues.getLength())
{
- const Any *pValues = aValues.getConstArray();
+ const uno::Any *pValues = aValues.getConstArray();
for (INT32 i = 0; i < nLen; ++i)
{
- Sequence< OUString > aSvcImplNames;
+ uno::Sequence< OUString > aSvcImplNames;
if (pValues[i] >>= aSvcImplNames)
{
#if OSL_DEBUG_LEVEL > 1
@@ -1073,7 +1142,7 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp )
String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
- Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) );
+ lang::Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) );
rSpellDsp.SetServiceList( aLocale, aSvcImplNames );
}
}
@@ -1081,14 +1150,59 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp )
}
+void LngSvcMgr::SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp )
+{
+ RTL_LOGFILE_CONTEXT( aLog, "linguistic: LngSvcMgr::SetCfgServiceLists - Grammar" );
+
+ String aNode( String::CreateFromAscii( "ServiceManager/GrammarCheckerList" ) );
+ uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
+ OUString *pNames = aNames.getArray();
+ INT32 nLen = aNames.getLength();
+
+ // append path prefix need for 'GetProperties' call below
+ String aPrefix( aNode );
+ aPrefix.Append( (sal_Unicode) '/' );
+ for (int i = 0; i < nLen; ++i)
+ {
+ OUString aTmp( aPrefix );
+ aTmp += pNames[i];
+ pNames[i] = aTmp;
+ }
+
+ uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
+ if (nLen && nLen == aValues.getLength())
+ {
+ const uno::Any *pValues = aValues.getConstArray();
+ for (INT32 i = 0; i < nLen; ++i)
+ {
+ uno::Sequence< OUString > aSvcImplNames;
+ if (pValues[i] >>= aSvcImplNames)
+ {
+ // there should only be one grammar checker in use per language...
+ if (aSvcImplNames.getLength() > 1)
+ aSvcImplNames.realloc(1);
+
+#if OSL_DEBUG_LEVEL > 1
+// INT32 nSvcs = aSvcImplNames.getLength();
+// const OUString *pSvcImplNames = aSvcImplNames.getConstArray();
+#endif
+ String aLocaleStr( pNames[i] );
+ xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
+ aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
+ lang::Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) );
+ rGrammarDsp.SetServiceList( aLocale, aSvcImplNames );
+ }
+ }
+ }
+}
+
+
void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp )
{
RTL_LOGFILE_CONTEXT( aLog, "linguistic: LngSvcMgr::SetCfgServiceLists - Hyph" );
- //SvtLinguConfig aCfg;
-
String aNode( String::CreateFromAscii( "ServiceManager/HyphenatorList" ) );
- Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
+ uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
OUString *pNames = aNames.getArray();
INT32 nLen = aNames.getLength();
@@ -1102,13 +1216,13 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp )
pNames[i] = aTmp;
}
- Sequence< Any > aValues( /*aCfg.*/GetProperties( aNames ) );
+ uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
if (nLen && nLen == aValues.getLength())
{
- const Any *pValues = aValues.getConstArray();
+ const uno::Any *pValues = aValues.getConstArray();
for (INT32 i = 0; i < nLen; ++i)
{
- Sequence< OUString > aSvcImplNames;
+ uno::Sequence< OUString > aSvcImplNames;
if (pValues[i] >>= aSvcImplNames)
{
// there should only be one hyphenator in use per language...
@@ -1122,7 +1236,7 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp )
String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
- Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) );
+ lang::Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) );
rHyphDsp.SetServiceList( aLocale, aSvcImplNames );
}
}
@@ -1134,10 +1248,8 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp )
{
RTL_LOGFILE_CONTEXT( aLog, "linguistic: LngSvcMgr::SetCfgServiceLists - Thes" );
- //SvtLinguConfig aCfg;
-
String aNode( String::CreateFromAscii( "ServiceManager/ThesaurusList" ) );
- Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
+ uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) );
OUString *pNames = aNames.getArray();
INT32 nLen = aNames.getLength();
@@ -1151,13 +1263,13 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp )
pNames[i] = aTmp;
}
- Sequence< Any > aValues( /*aCfg.*/GetProperties( aNames ) );
+ uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) );
if (nLen && nLen == aValues.getLength())
{
- const Any *pValues = aValues.getConstArray();
+ const uno::Any *pValues = aValues.getConstArray();
for (INT32 i = 0; i < nLen; ++i)
{
- Sequence< OUString > aSvcImplNames;
+ uno::Sequence< OUString > aSvcImplNames;
if (pValues[i] >>= aSvcImplNames)
{
#if OSL_DEBUG_LEVEL > 1
@@ -1167,7 +1279,7 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp )
String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
- Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) );
+ lang::Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) );
rThesDsp.SetServiceList( aLocale, aSvcImplNames );
}
}
@@ -1175,16 +1287,16 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp )
}
-Reference< XSpellChecker > SAL_CALL
+uno::Reference< linguistic2::XSpellChecker > SAL_CALL
LngSvcMgr::getSpellChecker()
- throw(RuntimeException)
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
#if OSL_DEBUG_LEVEL > 1
getAvailableLocales( A2OU( SN_SPELLCHECKER ));
#endif
- Reference< XSpellChecker > xRes;
+ uno::Reference< linguistic2::XSpellChecker > xRes;
if (!bDisposing)
{
if (!xSpellDsp.is())
@@ -1195,16 +1307,16 @@ Reference< XSpellChecker > SAL_CALL
}
-Reference< XHyphenator > SAL_CALL
+uno::Reference< linguistic2::XHyphenator > SAL_CALL
LngSvcMgr::getHyphenator()
- throw(RuntimeException)
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
#if OSL_DEBUG_LEVEL > 1
getAvailableLocales( A2OU( SN_HYPHENATOR ));
#endif
- Reference< XHyphenator > xRes;
+ uno::Reference< linguistic2::XHyphenator > xRes;
if (!bDisposing)
{
if (!xHyphDsp.is())
@@ -1215,16 +1327,16 @@ Reference< XHyphenator > SAL_CALL
}
-Reference< XThesaurus > SAL_CALL
+uno::Reference< linguistic2::XThesaurus > SAL_CALL
LngSvcMgr::getThesaurus()
- throw(RuntimeException)
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
#if OSL_DEBUG_LEVEL > 1
getAvailableLocales( A2OU( SN_THESAURUS ));
#endif
- Reference< XThesaurus > xRes;
+ uno::Reference< linguistic2::XThesaurus > xRes;
if (!bDisposing)
{
if (!xThesDsp.is())
@@ -1237,10 +1349,10 @@ Reference< XThesaurus > SAL_CALL
sal_Bool SAL_CALL
LngSvcMgr::addLinguServiceManagerListener(
- const Reference< XEventListener >& xListener )
- throw(RuntimeException)
+ const uno::Reference< lang::XEventListener >& xListener )
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
BOOL bRes = FALSE;
if (!bDisposing && xListener.is())
@@ -1255,10 +1367,10 @@ sal_Bool SAL_CALL
sal_Bool SAL_CALL
LngSvcMgr::removeLinguServiceManagerListener(
- const Reference< XEventListener >& xListener )
- throw(RuntimeException)
+ const uno::Reference< lang::XEventListener >& xListener )
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
BOOL bRes = FALSE;
if (!bDisposing && xListener.is())
@@ -1272,15 +1384,15 @@ sal_Bool SAL_CALL
}
-Sequence< OUString > SAL_CALL
+uno::Sequence< OUString > SAL_CALL
LngSvcMgr::getAvailableServices(
const OUString& rServiceName,
- const Locale& rLocale )
- throw(RuntimeException)
+ const lang::Locale& rLocale )
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
- Sequence< OUString > aRes;
+ uno::Sequence< OUString > aRes;
const SvcInfoArray *pInfoArray = 0;
if (0 == rServiceName.compareToAscii( SN_SPELLCHECKER ))
@@ -1288,16 +1400,22 @@ Sequence< OUString > SAL_CALL
// don't used cached data here (force re-evaluation in order to have downloaded dictionaries
// already found without the need to restart the office
delete pAvailSpellSvcs; pAvailSpellSvcs = 0;
-// if (!pAvailSpellSvcs)
GetAvailableSpellSvcs_Impl();
pInfoArray = pAvailSpellSvcs;
}
+ else if (0 == rServiceName.compareToAscii( SN_GRAMMARCHECKER ))
+ {
+ // don't used cached data here (force re-evaluation in order to have downloaded dictionaries
+ // already found without the need to restart the office
+ delete pAvailGrammarSvcs; pAvailGrammarSvcs = 0;
+ GetAvailableGrammarSvcs_Impl();
+ pInfoArray = pAvailGrammarSvcs;
+ }
else if (0 == rServiceName.compareToAscii( SN_HYPHENATOR ))
{
// don't used cached data here (force re-evaluation in order to have downloaded dictionaries
// already found without the need to restart the office
delete pAvailHyphSvcs; pAvailHyphSvcs = 0;
-// if (!pAvailHyphSvcs)
GetAvailableHyphSvcs_Impl();
pInfoArray = pAvailHyphSvcs;
}
@@ -1306,7 +1424,6 @@ Sequence< OUString > SAL_CALL
// don't used cached data here (force re-evaluation in order to have downloaded dictionaries
// already found without the need to restart the office
delete pAvailThesSvcs; pAvailThesSvcs = 0;
-// if (!pAvailThesSvcs)
GetAvailableThesSvcs_Impl();
pInfoArray = pAvailThesSvcs;
}
@@ -1314,15 +1431,15 @@ Sequence< OUString > SAL_CALL
if (pInfoArray)
{
// resize to max number of entries
- USHORT nMaxCnt = pInfoArray->Count();
+ size_t nMaxCnt = pInfoArray->size();
aRes.realloc( nMaxCnt );
OUString *pImplName = aRes.getArray();
USHORT nCnt = 0;
- INT16 nLanguage = LocaleToLanguage( rLocale );
- for (USHORT i = 0; i < nMaxCnt; ++i)
+ LanguageType nLanguage = LocaleToLanguage( rLocale );
+ for (size_t i = 0; i < nMaxCnt; ++i)
{
- const SvcInfo *pInfo = pInfoArray->GetObject(i);
+ const SvcInfo *pInfo = (*pInfoArray)[i];
if (LANGUAGE_NONE == nLanguage
|| (pInfo && pInfo->HasLanguage( nLanguage )))
{
@@ -1339,22 +1456,27 @@ Sequence< OUString > SAL_CALL
}
-Sequence< Locale > SAL_CALL
+uno::Sequence< lang::Locale > SAL_CALL
LngSvcMgr::getAvailableLocales(
const OUString& rServiceName )
- throw(RuntimeException)
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
- Sequence< Locale > aRes;
+ uno::Sequence< lang::Locale > aRes;
- Sequence< Locale > *pAvailLocales = NULL;
+ uno::Sequence< lang::Locale > *pAvailLocales = NULL;
BOOL *pHasAvailLocales = NULL;
if (0 == rServiceName.compareToAscii( SN_SPELLCHECKER ))
{
pAvailLocales = &aAvailSpellLocales;
pHasAvailLocales = &bHasAvailSpellLocales;
}
+ else if (0 == rServiceName.compareToAscii( SN_GRAMMARCHECKER ))
+ {
+ pAvailLocales = &aAvailGrammarLocales;
+ pHasAvailLocales = &bHasAvailGrammarLocales;
+ }
else if (0 == rServiceName.compareToAscii( SN_HYPHENATOR ))
{
pAvailLocales = &aAvailHyphLocales;
@@ -1374,7 +1496,7 @@ Sequence< Locale > SAL_CALL
// if (!*pHasAvailLocales)
// {
*pAvailLocales = GetAvailLocales(
- getAvailableServices( rServiceName, Locale() ) );
+ getAvailableServices( rServiceName, lang::Locale() ) );
// *pHasAvailLocales = TRUE;
// }
aRes = *pAvailLocales;
@@ -1383,8 +1505,8 @@ Sequence< Locale > SAL_CALL
return aRes;
}
-static BOOL IsEqSvcList( const Sequence< OUString > &rList1,
- const Sequence< OUString > &rList2 )
+static BOOL IsEqSvcList( const uno::Sequence< OUString > &rList1,
+ const uno::Sequence< OUString > &rList2 )
{
// returns TRUE iff both sequences are equal
@@ -1408,19 +1530,19 @@ static BOOL IsEqSvcList( const Sequence< OUString > &rList1,
void SAL_CALL
LngSvcMgr::setConfiguredServices(
const OUString& rServiceName,
- const Locale& rLocale,
- const Sequence< OUString >& rServiceImplNames )
- throw(RuntimeException)
+ const lang::Locale& rLocale,
+ const uno::Sequence< OUString >& rServiceImplNames )
+ throw(uno::RuntimeException)
{
RTL_LOGFILE_CONTEXT( aLog, "linguistic: LngSvcMgr::setConfiguredServices" );
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
#if OSL_DEBUG_LEVEL > 1
// const OUString *pImplNames = rServiceImplNames.getConstArray();
#endif
- INT16 nLanguage = LocaleToLanguage( rLocale );
+ LanguageType nLanguage = LocaleToLanguage( rLocale );
if (LANGUAGE_NONE != nLanguage)
{
if (0 == rServiceName.compareToAscii( SN_SPELLCHECKER ))
@@ -1436,8 +1558,24 @@ void SAL_CALL
if (pListenerHelper && bChanged)
pListenerHelper->AddLngSvcEvt(
- LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN |
- LinguServiceEventFlags::SPELL_WRONG_WORDS_AGAIN );
+ linguistic2::LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN |
+ linguistic2::LinguServiceEventFlags::SPELL_WRONG_WORDS_AGAIN );
+ }
+ }
+ else if (0 == rServiceName.compareToAscii( SN_GRAMMARCHECKER ))
+ {
+ if (!xGrammarDsp.is())
+ GetGrammarCheckerDsp_Impl();
+ BOOL bChanged = !IsEqSvcList( rServiceImplNames,
+ pGrammarDsp->GetServiceList( rLocale ) );
+ if (bChanged)
+ {
+ pGrammarDsp->SetServiceList( rLocale, rServiceImplNames );
+ SaveCfgSvcs( A2OU( SN_GRAMMARCHECKER ) );
+
+ if (pListenerHelper && bChanged)
+ pListenerHelper->AddLngSvcEvt(
+ linguistic2::LinguServiceEventFlags::PROOFREAD_AGAIN );
}
}
else if (0 == rServiceName.compareToAscii( SN_HYPHENATOR ))
@@ -1453,7 +1591,7 @@ void SAL_CALL
if (pListenerHelper && bChanged)
pListenerHelper->AddLngSvcEvt(
- LinguServiceEventFlags::HYPHENATE_AGAIN );
+ linguistic2::LinguServiceEventFlags::HYPHENATE_AGAIN );
}
}
else if (0 == rServiceName.compareToAscii( SN_THESAURUS ))
@@ -1479,22 +1617,27 @@ BOOL LngSvcMgr::SaveCfgSvcs( const String &rServiceName )
BOOL bRes = FALSE;
LinguDispatcher *pDsp = 0;
- Sequence< Locale > aLocales;
+ uno::Sequence< lang::Locale > aLocales;
if (0 == rServiceName.CompareToAscii( SN_SPELLCHECKER ))
{
if (!pSpellDsp)
GetSpellCheckerDsp_Impl();
pDsp = pSpellDsp;
-// aLocales = xSpellDsp->getLocales();
aLocales = getAvailableLocales( A2OU( SN_SPELLCHECKER ) );
}
+ else if (0 == rServiceName.CompareToAscii( SN_GRAMMARCHECKER ))
+ {
+ if (!pGrammarDsp)
+ GetGrammarCheckerDsp_Impl();
+ pDsp = pGrammarDsp;
+ aLocales = getAvailableLocales( A2OU( SN_GRAMMARCHECKER ) );
+ }
else if (0 == rServiceName.CompareToAscii( SN_HYPHENATOR ))
{
if (!pHyphDsp)
GetHyphenatorDsp_Impl();
pDsp = pHyphDsp;
-// aLocales = xHyphDsp->getLocales();
aLocales = getAvailableLocales( A2OU( SN_HYPHENATOR ) );
}
else if (0 == rServiceName.CompareToAscii( SN_THESAURUS ))
@@ -1502,37 +1645,37 @@ BOOL LngSvcMgr::SaveCfgSvcs( const String &rServiceName )
if (!pThesDsp)
GetThesaurusDsp_Impl();
pDsp = pThesDsp;
-// aLocales = xThesDsp->getLocales();
aLocales = getAvailableLocales( A2OU( SN_THESAURUS ) );
}
if (pDsp && aLocales.getLength())
{
- //SvtLinguConfig aCfg;
-
INT32 nLen = aLocales.getLength();
- const Locale *pLocale = aLocales.getConstArray();
+ const lang::Locale *pLocale = aLocales.getConstArray();
- Sequence< PropertyValue > aValues( nLen );
- PropertyValue *pValues = aValues.getArray();
- PropertyValue *pValue = pValues;
+ uno::Sequence< beans::PropertyValue > aValues( nLen );
+ beans::PropertyValue *pValues = aValues.getArray();
+ beans::PropertyValue *pValue = pValues;
// get node name to be used
const char *pNodeName = NULL;
if (pDsp == pSpellDsp)
pNodeName = "ServiceManager/SpellCheckerList";
- else if (pDsp == pThesDsp)
- pNodeName = "ServiceManager/ThesaurusList";
+ else if (pDsp == pGrammarDsp)
+ pNodeName = "ServiceManager/GrammarCheckerList";
else if (pDsp == pHyphDsp)
pNodeName = "ServiceManager/HyphenatorList";
- else {
- DBG_ERROR( "node name missing" );
+ else if (pDsp == pThesDsp)
+ pNodeName = "ServiceManager/ThesaurusList";
+ else
+ {
+ DBG_ASSERT( 0, "node name missing" );
}
OUString aNodeName( A2OU(pNodeName) );
for (INT32 i = 0; i < nLen; ++i)
{
- Sequence< OUString > aSvcImplNames;
+ uno::Sequence< OUString > aSvcImplNames;
aSvcImplNames = pDsp->GetServiceList( pLocale[i] );
#if OSL_DEBUG_LEVEL > 1
@@ -1544,9 +1687,9 @@ BOOL LngSvcMgr::SaveCfgSvcs( const String &rServiceName )
}
#endif
// build value to be written back to configuration
- Any aCfgAny;
- if (pDsp == pHyphDsp && aSvcImplNames.getLength() > 1)
- aSvcImplNames.realloc(1); // there should be only one entry for hyphenators (because they are not chained)
+ uno::Any aCfgAny;
+ if ((pDsp == pHyphDsp || pDsp == pGrammarDsp) && aSvcImplNames.getLength() > 1)
+ aSvcImplNames.realloc(1); // there should be only one entry for hyphenators or grammar checkers (because they are not chained)
aCfgAny <<= aSvcImplNames;
DBG_ASSERT( aCfgAny.hasValue(), "missing value for 'Any' type" );
@@ -1569,9 +1712,9 @@ BOOL LngSvcMgr::SaveCfgSvcs( const String &rServiceName )
}
-static Sequence< OUString > GetLangSvcList( const Any &rVal )
+static uno::Sequence< OUString > GetLangSvcList( const uno::Any &rVal )
{
- Sequence< OUString > aRes;
+ uno::Sequence< OUString > aRes;
if (rVal.hasValue())
{
@@ -1594,9 +1737,9 @@ static Sequence< OUString > GetLangSvcList( const Any &rVal )
}
-static Sequence< OUString > GetLangSvc( const Any &rVal )
+static uno::Sequence< OUString > GetLangSvc( const uno::Any &rVal )
{
- Sequence< OUString > aRes;
+ uno::Sequence< OUString > aRes;
if (!rVal.hasValue())
return aRes;
@@ -1618,8 +1761,9 @@ static Sequence< OUString > GetLangSvc( const Any &rVal )
aRes.realloc(1);
aRes.getArray()[0] = aImplName;
}
- else {
- DBG_ERROR( "GetLangSvc: unexpected type encountered" );
+ else
+ {
+ DBG_ASSERT( 0, "GetLangSvc: unexpected type encountered" );
}
}
@@ -1629,28 +1773,26 @@ static Sequence< OUString > GetLangSvc( const Any &rVal )
///////////////////////////////////////////////////////////////////////////
-Sequence< OUString > SAL_CALL
+uno::Sequence< OUString > SAL_CALL
LngSvcMgr::getConfiguredServices(
const OUString& rServiceName,
- const Locale& rLocale )
- throw(RuntimeException)
+ const lang::Locale& rLocale )
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
- Sequence< OUString > aSvcImplNames;
+ uno::Sequence< OUString > aSvcImplNames;
- INT16 nLanguage = LocaleToLanguage( rLocale );
+ LanguageType nLanguage = LocaleToLanguage( rLocale );
OUString aCfgLocale( MsLangId::convertLanguageToIsoString( nLanguage ) );
- //SvtLinguConfig aCfg;
-
- Sequence< Any > aValues;
- Sequence< OUString > aNames( 1 );
+ uno::Sequence< uno::Any > aValues;
+ uno::Sequence< OUString > aNames( 1 );
OUString *pNames = aNames.getArray();
if ( 0 == rServiceName.compareToAscii( SN_SPELLCHECKER ) )
{
OUString aNode( OUString::createFromAscii( "ServiceManager/SpellCheckerList" ));
- const Sequence< OUString > aNodeEntries( GetNodeNames( aNode ) );
+ const uno::Sequence< OUString > aNodeEntries( GetNodeNames( aNode ) );
if (lcl_SeqHasString( aNodeEntries, aCfgLocale ))
{
OUString aPropName( aNode );
@@ -1662,10 +1804,25 @@ Sequence< OUString > SAL_CALL
aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
}
}
+ else if ( 0 == rServiceName.compareToAscii( SN_GRAMMARCHECKER ) )
+ {
+ OUString aNode( OUString::createFromAscii( "ServiceManager/GrammarCheckerList" ));
+ const uno::Sequence< OUString > aNodeEntries( GetNodeNames( aNode ) );
+ if (lcl_SeqHasString( aNodeEntries, aCfgLocale ))
+ {
+ OUString aPropName( aNode );
+ aPropName += OUString::valueOf( (sal_Unicode) '/' );
+ aPropName += aCfgLocale;
+ pNames[0] = aPropName;
+ aValues = /*aCfg.*/GetProperties( aNames );
+ if (aValues.getLength())
+ aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
+ }
+ }
else if ( 0 == rServiceName.compareToAscii( SN_HYPHENATOR ) )
{
OUString aNode( OUString::createFromAscii( "ServiceManager/HyphenatorList" ));
- const Sequence< OUString > aNodeEntries( GetNodeNames( aNode ) );
+ const uno::Sequence< OUString > aNodeEntries( GetNodeNames( aNode ) );
if (lcl_SeqHasString( aNodeEntries, aCfgLocale ))
{
OUString aPropName( aNode );
@@ -1680,7 +1837,7 @@ Sequence< OUString > SAL_CALL
else if ( 0 == rServiceName.compareToAscii( SN_THESAURUS ) )
{
OUString aNode( OUString::createFromAscii( "ServiceManager/ThesaurusList" ));
- const Sequence< OUString > aNodeEntries( GetNodeNames( aNode ) );
+ const uno::Sequence< OUString > aNodeEntries( GetNodeNames( aNode ) );
if (lcl_SeqHasString( aNodeEntries, aCfgLocale ))
{
OUString aPropName( aNode );
@@ -1694,7 +1851,8 @@ Sequence< OUString > SAL_CALL
}
#if OSL_DEBUG_LEVEL > 1
-// const OUString *pImplNames = aSvcImplNames.getConstArray();
+ const OUString *pImplNames = aSvcImplNames.getConstArray();
+ (void) pImplNames;
#endif
return aSvcImplNames;
}
@@ -1702,16 +1860,16 @@ Sequence< OUString > SAL_CALL
void SAL_CALL
LngSvcMgr::dispose()
- throw(RuntimeException)
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
if (!bDisposing)
{
bDisposing = TRUE;
// require listeners to release this object
- EventObject aEvtObj( (XLinguServiceManager *) this );
+ lang::EventObject aEvtObj( (XLinguServiceManager *) this );
aEvtListeners.disposeAndClear( aEvtObj );
if (pListenerHelper)
@@ -1722,40 +1880,34 @@ void SAL_CALL
void SAL_CALL
LngSvcMgr::addEventListener(
- const Reference< XEventListener >& xListener )
- throw(RuntimeException)
+ const uno::Reference< lang::XEventListener >& xListener )
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
if (!bDisposing && xListener.is())
{
- aEvtListeners.addInterface(
- /*::getCppuType((const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener >*)0), */
- xListener );
+ aEvtListeners.addInterface( xListener );
}
}
void SAL_CALL
LngSvcMgr::removeEventListener(
- const Reference< XEventListener >& xListener )
- throw(RuntimeException)
+ const uno::Reference< lang::XEventListener >& xListener )
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
if (xListener.is())
{
- aEvtListeners.removeInterface(
- /*::getCppuType((const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener >*)0), */
- xListener );
+ aEvtListeners.removeInterface( xListener );
}
}
BOOL LngSvcMgr::AddLngSvcEvtBroadcaster(
- const Reference< XLinguServiceEventBroadcaster > &rxBroadcaster )
+ const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster )
{
BOOL bRes = FALSE;
if (rxBroadcaster.is())
@@ -1769,7 +1921,7 @@ BOOL LngSvcMgr::AddLngSvcEvtBroadcaster(
BOOL LngSvcMgr::RemoveLngSvcEvtBroadcaster(
- const Reference< XLinguServiceEventBroadcaster > &rxBroadcaster )
+ const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster )
{
BOOL bRes = FALSE;
if (rxBroadcaster.is())
@@ -1785,18 +1937,18 @@ BOOL LngSvcMgr::RemoveLngSvcEvtBroadcaster(
OUString SAL_CALL
LngSvcMgr::getImplementationName()
- throw(RuntimeException)
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
return getImplementationName_Static();
}
sal_Bool SAL_CALL
LngSvcMgr::supportsService( const OUString& ServiceName )
- throw(RuntimeException)
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
uno::Sequence< OUString > aSNL = getSupportedServiceNames();
const OUString * pArray = aSNL.getConstArray();
@@ -1807,11 +1959,11 @@ sal_Bool SAL_CALL
}
-Sequence< OUString > SAL_CALL
+uno::Sequence< OUString > SAL_CALL
LngSvcMgr::getSupportedServiceNames()
- throw(RuntimeException)
+ throw(uno::RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
return getSupportedServiceNames_Static();
}
@@ -1819,7 +1971,7 @@ Sequence< OUString > SAL_CALL
uno::Sequence< OUString > LngSvcMgr::getSupportedServiceNames_Static()
throw()
{
- MutexGuard aGuard( GetLinguMutex() );
+ osl::MutexGuard aGuard( GetLinguMutex() );
uno::Sequence< OUString > aSNS( 1 ); // auch mehr als 1 Service moeglich
aSNS.getArray()[0] = A2OU( SN_LINGU_SERVCICE_MANAGER );
@@ -1827,11 +1979,11 @@ uno::Sequence< OUString > LngSvcMgr::getSupportedServiceNames_Static()
}
-Reference< XInterface > SAL_CALL LngSvcMgr_CreateInstance(
- const Reference< XMultiServiceFactory > & /*rSMgr*/ )
- throw(Exception)
+uno::Reference< uno::XInterface > SAL_CALL LngSvcMgr_CreateInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & /*rSMgr*/ )
+ throw(uno::Exception)
{
- Reference< XInterface > xService = (cppu::OWeakObject*) new LngSvcMgr;
+ uno::Reference< uno::XInterface > xService = (cppu::OWeakObject*) new LngSvcMgr;
return xService;
}
@@ -1846,7 +1998,7 @@ sal_Bool SAL_CALL LngSvcMgr_writeInfo(
String aImpl( '/' );
aImpl += LngSvcMgr::getImplementationName_Static().getStr();
aImpl.AppendAscii( "/UNO/SERVICES" );
- Reference< registry::XRegistryKey > xNewKey =
+ uno::Reference< registry::XRegistryKey > xNewKey =
pRegistryKey->createKey( aImpl );
uno::Sequence< OUString > aServices = LngSvcMgr::getSupportedServiceNames_Static();
for( INT32 i = 0; i < aServices.getLength(); i++ )
@@ -1854,7 +2006,7 @@ sal_Bool SAL_CALL LngSvcMgr_writeInfo(
return sal_True;
}
- catch(Exception &)
+ catch(uno::Exception &)
{
return sal_False;
}
@@ -1862,14 +2014,14 @@ sal_Bool SAL_CALL LngSvcMgr_writeInfo(
void * SAL_CALL LngSvcMgr_getFactory(
const sal_Char * pImplName,
- XMultiServiceFactory * pServiceManager,
+ lang::XMultiServiceFactory * pServiceManager,
void * /*pRegistryKey*/ )
{
void * pRet = 0;
if ( !LngSvcMgr::getImplementationName_Static().compareToAscii( pImplName ) )
{
- Reference< XSingleServiceFactory > xFactory =
+ uno::Reference< lang::XSingleServiceFactory > xFactory =
cppu::createOneInstanceFactory(
pServiceManager,
LngSvcMgr::getImplementationName_Static(),
diff --git a/linguistic/source/lngsvcmgr.hxx b/linguistic/source/lngsvcmgr.hxx
index 1dbaf5ed9fa3..aa7587527587 100644
--- a/linguistic/source/lngsvcmgr.hxx
+++ b/linguistic/source/lngsvcmgr.hxx
@@ -51,12 +51,15 @@
class SpellCheckerDispatcher;
class HyphenatorDispatcher;
class ThesaurusDispatcher;
-class SvcInfoArray;
+class GrammarCheckingIterator;
class LngSvcMgrListenerHelper;
+struct SvcInfo;
namespace com { namespace sun { namespace star { namespace linguistic2 {
class XLinguServiceEventBroadcaster;
class XSpellChecker;
+ class XProofreader;
+ class XProofreadingIterator;
class XHyphenator;
class XThesaurus;
} } } }
@@ -74,14 +77,18 @@ class LngSvcMgr :
>,
private utl::ConfigItem
{
+ friend class LngSvcMgrListenerHelper;
+
::cppu::OInterfaceContainerHelper aEvtListeners;
com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker > xSpellDsp;
+ ::com::sun::star::linguistic2::XSpellChecker > xSpellDsp;
+ com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XProofreadingIterator > xGrammarDsp;
com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator > xHyphDsp;
+ ::com::sun::star::linguistic2::XHyphenator > xHyphDsp;
com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XThesaurus > xThesDsp;
+ ::com::sun::star::linguistic2::XThesaurus > xThesDsp;
com::sun::star::uno::Reference<
::com::sun::star::lang::XEventListener > xListenerHelper;
@@ -89,22 +96,28 @@ class LngSvcMgr :
com::sun::star::uno::Sequence<
com::sun::star::lang::Locale > aAvailSpellLocales;
com::sun::star::uno::Sequence<
+ com::sun::star::lang::Locale > aAvailGrammarLocales;
+ com::sun::star::uno::Sequence<
com::sun::star::lang::Locale > aAvailHyphLocales;
com::sun::star::uno::Sequence<
com::sun::star::lang::Locale > aAvailThesLocales;
SpellCheckerDispatcher * pSpellDsp;
+ GrammarCheckingIterator * pGrammarDsp;
HyphenatorDispatcher * pHyphDsp;
ThesaurusDispatcher * pThesDsp;
LngSvcMgrListenerHelper * pListenerHelper;
+ typedef std::vector< SvcInfo * > SvcInfoArray;
SvcInfoArray * pAvailSpellSvcs;
+ SvcInfoArray * pAvailGrammarSvcs;
SvcInfoArray * pAvailHyphSvcs;
SvcInfoArray * pAvailThesSvcs;
BOOL bDisposing;
BOOL bHasAvailSpellLocales;
+ BOOL bHasAvailGrammarLocales;
BOOL bHasAvailHyphLocales;
BOOL bHasAvailThesLocales;
@@ -113,14 +126,18 @@ class LngSvcMgr :
LngSvcMgr & operator = (const LngSvcMgr &);
void GetAvailableSpellSvcs_Impl();
+ void GetAvailableGrammarSvcs_Impl();
void GetAvailableHyphSvcs_Impl();
void GetAvailableThesSvcs_Impl();
void GetListenerHelper_Impl();
+
void GetSpellCheckerDsp_Impl( sal_Bool bSetSvcList = sal_True );
+ void GetGrammarCheckerDsp_Impl( sal_Bool bSetSvcList = sal_True );
void GetHyphenatorDsp_Impl( sal_Bool bSetSvcList = sal_True );
void GetThesaurusDsp_Impl( sal_Bool bSetSvcList = sal_True );
void SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp );
+ void SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp );
void SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp );
void SetCfgServiceLists( ThesaurusDispatcher &rThesDsp );
@@ -138,84 +155,31 @@ public:
virtual ~LngSvcMgr();
// XLinguServiceManager
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker > SAL_CALL
- getSpellChecker()
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XHyphenator > SAL_CALL
- getHyphenator()
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XThesaurus > SAL_CALL
- getThesaurus()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL
- addLinguServiceManagerListener(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener >& xListener )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL
- removeLinguServiceManagerListener(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener >& xListener )
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- getAvailableServices(
- const ::rtl::OUString& rServiceName,
- const ::com::sun::star::lang::Locale& rLocale )
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- setConfiguredServices(
- const ::rtl::OUString& rServiceName,
- const ::com::sun::star::lang::Locale& rLocale,
- const ::com::sun::star::uno::Sequence<
- ::rtl::OUString >& rServiceImplNames )
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- getConfiguredServices(
- const ::rtl::OUString& rServiceName,
- const ::com::sun::star::lang::Locale& rLocale )
- throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker > SAL_CALL getSpellChecker( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > SAL_CALL getHyphenator( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > SAL_CALL getThesaurus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL addLinguServiceManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL removeLinguServiceManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServices( const ::rtl::OUString& aServiceName, const ::com::sun::star::lang::Locale& aLocale ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setConfiguredServices( const ::rtl::OUString& aServiceName, const ::com::sun::star::lang::Locale& aLocale, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aServiceImplNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getConfiguredServices( const ::rtl::OUString& aServiceName, const ::com::sun::star::lang::Locale& aLocale ) throw (::com::sun::star::uno::RuntimeException);
// XAvailableLocales
- virtual ::com::sun::star::uno::Sequence<
- ::com::sun::star::lang::Locale > SAL_CALL
- getAvailableLocales(
- const ::rtl::OUString& rServiceName )
- throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getAvailableLocales( const ::rtl::OUString& aServiceName ) throw (::com::sun::star::uno::RuntimeException);
// XComponent
- virtual void SAL_CALL
- dispose()
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- addEventListener(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener >& xListener )
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL
- removeEventListener(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener >& xListener )
- throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
// XServiceInfo
- virtual ::rtl::OUString SAL_CALL
- getImplementationName()
- throw(::com::sun::star::uno::RuntimeException);
- 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);
-
-
- static inline ::rtl::OUString
- getImplementationName_Static();
- static ::com::sun::star::uno::Sequence< ::rtl::OUString >
- getSupportedServiceNames_Static() throw();
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ 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);
+
+
+ static inline ::rtl::OUString getImplementationName_Static();
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
BOOL AddLngSvcEvtBroadcaster(
const ::com::sun::star::uno::Reference<
diff --git a/linguistic/source/makefile.mk b/linguistic/source/makefile.mk
index dc48a9f67dfb..36b8c8c13119 100644
--- a/linguistic/source/makefile.mk
+++ b/linguistic/source/makefile.mk
@@ -59,11 +59,9 @@ SLOFILES = \
$(SLO)$/prophelp.obj\
$(SLO)$/spelldsp.obj\
$(SLO)$/spelldta.obj\
- $(SLO)$/supplang.obj\
$(SLO)$/thesdsp.obj\
$(SLO)$/thesdta.obj\
- $(SLO)$/gciterator.obj\
- $(SLO)$/grammarchecker.obj
+ $(SLO)$/gciterator.obj
SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index be4fb2a93b42..67ebf8e29e92 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -48,16 +48,17 @@
#include <com/sun/star/beans/PropertyValues.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/linguistic2/XDictionary1.hpp>
#include <com/sun/star/linguistic2/DictionaryType.hpp>
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
#include <unotools/processfactory.hxx>
#include <unotools/localedatawrapper.hxx>
+#include <rtl/instance.hxx>
+
#include "misc.hxx"
#include "defs.hxx"
#include "lngprops.hxx"
-#include <hyphdta.hxx>
+#include "hyphdta.hxx"
using namespace utl;
@@ -75,10 +76,14 @@ namespace linguistic
///////////////////////////////////////////////////////////////////////////
+//!! multi-thread safe mutex for all platforms !!
+struct LinguMutex : public rtl::Static< osl::Mutex, LinguMutex >
+{
+};
+
osl::Mutex & GetLinguMutex()
{
- static osl::Mutex aMutex;
- return aMutex;
+ return LinguMutex::get();
}
///////////////////////////////////////////////////////////////////////////
@@ -163,7 +168,7 @@ rtl_TextEncoding GetTextEncoding( INT16 nLanguage )
nEncoding = RTL_TEXTENCODING_ISO_8859_7; break;
#endif
default:
- DBG_ERROR( "unexpected language" );
+ DBG_ASSERT( 0, "unexpected language" );
}
}
@@ -353,10 +358,10 @@ uno::Reference< XDictionaryEntry > SearchDicList(
INT32 i;
for (i = 0; i < nDics; i++)
{
- uno::Reference< XDictionary1 > axDic( pDic[i], UNO_QUERY );
+ uno::Reference< XDictionary > axDic( pDic[i], UNO_QUERY );
DictionaryType eType = axDic->getDictionaryType();
- INT16 nLang = axDic->getLanguage();
+ INT16 nLang = LocaleToLanguage( axDic->getLocale() );
if ( axDic.is() && axDic->isActive()
&& (nLang == nLanguage || nLang == LANGUAGE_NONE) )
@@ -503,12 +508,11 @@ uno::Sequence< INT16 >
const Locale *pLocale = rLocaleSeq.getConstArray();
INT32 nCount = rLocaleSeq.getLength();
- uno::Sequence< INT16 > aLangs( nCount );
+ uno::Sequence< INT16 > aLangs( nCount );
INT16 *pLang = aLangs.getArray();
for (INT32 i = 0; i < nCount; ++i)
{
pLang[i] = LocaleToLanguage( pLocale[i] );
-
}
return aLangs;
@@ -687,7 +691,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
if (nOrigHyphenPos == -1 || nOrigHyphenationPos == -1)
{
- DBG_ERROR( "failed to get nOrigHyphenPos or nOrigHyphenationPos" );
+ DBG_ASSERT( 0, "failed to get nOrigHyphenPos or nOrigHyphenationPos" );
}
else
{
@@ -847,7 +851,7 @@ uno::Reference< XInterface > GetOneInstanceService( const char *pServiceName )
}
catch (uno::Exception &)
{
- DBG_ERROR( "createInstance failed" );
+ DBG_ASSERT( 0, "createInstance failed" );
}
}
}
@@ -890,7 +894,7 @@ AppExitListener::AppExitListener()
}
catch (uno::Exception &)
{
- DBG_ERROR( "createInstance failed" );
+ DBG_ASSERT( 0, "createInstance failed" );
}
}
}
diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx
index 7c0271e243c9..f89ebc1bc661 100644
--- a/linguistic/source/misc2.cxx
+++ b/linguistic/source/misc2.cxx
@@ -121,7 +121,7 @@ String GetModulePath( SvtPathOptions::Pathes ePath, BOOL bAddAccessDelim )
}
*/
default:
- DBG_ERROR( "unexpected argument (path)" );
+ DBG_ASSERT( 0, "unexpected argument (path)" );
}
if (bAddAccessDelim && aRes.Len())
{
diff --git a/linguistic/source/prophelp.cxx b/linguistic/source/prophelp.cxx
index 6559d28c7abf..7519f80d8619 100644
--- a/linguistic/source/prophelp.cxx
+++ b/linguistic/source/prophelp.cxx
@@ -60,7 +60,7 @@ namespace linguistic
static const char *aCH[] =
{
- UPN_IS_GERMAN_PRE_REFORM,
+ UPN_IS_GERMAN_PRE_REFORM, /* deprectaed */
UPN_IS_IGNORE_CONTROL_CHARACTERS,
UPN_IS_USE_DICTIONARY_LIST,
};
@@ -144,7 +144,7 @@ void PropertyChgHelper::GetCurrentValues()
BOOL *pbVal = NULL,
*pbResVal = NULL;
- if (pPropName[i].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UPN_IS_GERMAN_PRE_REFORM ) ))
+ if (pPropName[i].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UPN_IS_GERMAN_PRE_REFORM ) )) /* deprecated */
{
pbVal = &bIsGermanPreReform;
pbResVal = &bResIsGermanPreReform;
@@ -188,14 +188,14 @@ void PropertyChgHelper::SetTmpPropVals( const PropertyValues &rPropVals )
switch (pVal[i].Handle)
{
case UPH_IS_GERMAN_PRE_REFORM :
- pbResVal = &bResIsGermanPreReform; break;
+ pbResVal = &bResIsGermanPreReform; break; /* deprecated */
case UPH_IS_IGNORE_CONTROL_CHARACTERS :
pbResVal = &bResIsIgnoreControlCharacters; break;
case UPH_IS_USE_DICTIONARY_LIST :
pbResVal = &bResIsUseDictionaryList; break;
default:
;
- //DBG_ERROR( "unknown property" );
+ //DBG_ASSERT( 0, "unknown property" );
}
if (pbResVal)
pVal[i].Value >>= *pbResVal;
@@ -224,7 +224,7 @@ BOOL PropertyChgHelper::propertyChange_Impl( const PropertyChangeEvent& rEvt )
nLngSvcFlags = 0;
break;
}
- case UPH_IS_GERMAN_PRE_REFORM :
+ case UPH_IS_GERMAN_PRE_REFORM : /* deprecated */
{
pbVal = &bIsGermanPreReform;
bSCWA = bSWWA = TRUE;
@@ -239,7 +239,7 @@ BOOL PropertyChgHelper::propertyChange_Impl( const PropertyChangeEvent& rEvt )
default:
{
bRes = FALSE;
- //DBG_ERROR( "unknown property" );
+ //DBG_ASSERT( 0, "unknown property" );
}
}
if (pbVal)
@@ -502,7 +502,7 @@ BOOL PropertyHelper_Spell::propertyChange_Impl( const PropertyChangeEvent& rEvt
break;
}
default:
- DBG_ERROR( "unknown property" );
+ DBG_ASSERT( 0, "unknown property" );
}
if (pbVal)
rEvt.NewValue >>= *pbVal;
@@ -564,7 +564,7 @@ void PropertyHelper_Spell::SetTmpPropVals( const PropertyValues &rPropVals )
case UPH_IS_SPELL_WITH_DIGITS : pbResVal = &bResIsSpellWithDigits; break;
case UPH_IS_SPELL_CAPITALIZATION : pbResVal = &bResIsSpellCapitalization; break;
default:
- DBG_ERROR( "unknown property" );
+ DBG_ASSERT( 0, "unknown property" );
}
if (pbResVal)
pVal[i].Value >>= *pbResVal;
@@ -668,7 +668,7 @@ BOOL PropertyHelper_Hyph::propertyChange_Impl( const PropertyChangeEvent& rEvt )
case UPH_HYPH_MIN_TRAILING : pnVal = &nHyphMinTrailing; break;
case UPH_HYPH_MIN_WORD_LENGTH : pnVal = &nHyphMinWordLength; break;
default:
- DBG_ERROR( "unknown property" );
+ DBG_ASSERT( 0, "unknown property" );
}
if (pnVal)
rEvt.NewValue >>= *pnVal;
@@ -720,7 +720,7 @@ void PropertyHelper_Hyph::SetTmpPropVals( const PropertyValues &rPropVals )
case UPH_HYPH_MIN_TRAILING : pnResVal = &nResHyphMinTrailing; break;
case UPH_HYPH_MIN_WORD_LENGTH : pnResVal = &nResHyphMinWordLength; break;
default:
- DBG_ERROR( "unknown property" );
+ DBG_ASSERT( 0, "unknown property" );
}
if (pnResVal)
pVal[i].Value >>= *pnResVal;
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 941f8e63684c..d9882a3dbae8 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -188,22 +188,17 @@ void ProposalList::Remove( const OUString &rText )
///////////////////////////////////////////////////////////////////////////
BOOL SvcListHasLanguage(
- const SeqLangSvcEntry_Spell &rEntry,
- INT16 nLanguage )
+ const LangSvcEntries_Spell &rEntry,
+ LanguageType nLanguage )
{
BOOL bHasLanguage = FALSE;
Locale aTmpLocale;
const Reference< XSpellChecker > *pRef = rEntry.aSvcRefs .getConstArray();
- const Reference< XSpellChecker1 > *pRef1 = rEntry.aSvc1Refs.getConstArray();
sal_Int32 nLen = rEntry.aSvcRefs.getLength();
- DBG_ASSERT( nLen == rEntry.aSvc1Refs.getLength(),
- "sequence length mismatch" );
for (INT32 k = 0; k < nLen && !bHasLanguage; ++k)
{
- if (pRef1[k].is())
- bHasLanguage = pRef1[k]->hasLanguage( nLanguage );
- else if (pRef[k].is())
+ if (pRef[k].is())
{
if (0 == aTmpLocale.Language.getLength())
aTmpLocale = CreateLocale( nLanguage );
@@ -217,45 +212,25 @@ BOOL SvcListHasLanguage(
///////////////////////////////////////////////////////////////////////////
-SeqLangSvcEntry_Spell::~SeqLangSvcEntry_Spell()
-{
-}
-
-
-SeqLangSvcEntry_Spell::SeqLangSvcEntry_Spell(
- const Sequence< OUString > &rSvcImplNames ) :
- aSvcImplNames ( rSvcImplNames ),
- aSvcRefs ( rSvcImplNames.getLength() ),
- aSvc1Refs ( rSvcImplNames.getLength() )
-{
-}
-
-///////////////////////////////////////////////////////////////////////////
-
SpellCheckerDispatcher::SpellCheckerDispatcher( LngSvcMgr &rLngSvcMgr ) :
rMgr (rLngSvcMgr)
{
- pExtCache = NULL;
+ pCache = NULL;
}
SpellCheckerDispatcher::~SpellCheckerDispatcher()
{
ClearSvcList();
- delete pExtCache;
+ delete pCache;
}
void SpellCheckerDispatcher::ClearSvcList()
{
// release memory for each table entry
- SeqLangSvcEntry_Spell *pItem = aSvcList.First();
- while (pItem)
- {
- SeqLangSvcEntry_Spell *pTmp = pItem;
- pItem = aSvcList.Next();
- delete pTmp;
- }
+ SpellSvcByLangMap_t aTmp;
+ aSvcMap.swap( aTmp );
}
@@ -263,7 +238,15 @@ Sequence< Locale > SAL_CALL SpellCheckerDispatcher::getLocales()
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- return LangSeqToLocaleSeq( getLanguages() );
+
+ Sequence< Locale > aLocales( static_cast< sal_Int32 >(aSvcMap.size()) );
+ Locale *pLocales = aLocales.getArray();
+ SpellSvcByLangMap_t::const_iterator aIt;
+ for (aIt = aSvcMap.begin(); aIt != aSvcMap.end(); ++aIt)
+ {
+ *pLocales++ = CreateLocale( aIt->first );
+ }
+ return aLocales;
}
@@ -271,7 +254,8 @@ sal_Bool SAL_CALL SpellCheckerDispatcher::hasLocale( const Locale& rLocale )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- return hasLanguage( LocaleToLanguage(rLocale) );
+ SpellSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LocaleToLanguage( rLocale ) ) );
+ return aIt != aSvcMap.end();
}
@@ -281,7 +265,7 @@ sal_Bool SAL_CALL
throw(IllegalArgumentException, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- return isValid( rWord, LocaleToLanguage(rLocale), rProperties );
+ return isValid_Impl( rWord, LocaleToLanguage( rLocale ), rProperties, TRUE );
}
@@ -291,84 +275,13 @@ Reference< XSpellAlternatives > SAL_CALL
throw(IllegalArgumentException, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- return spell( rWord, LocaleToLanguage(rLocale), rProperties );
-}
-
-
-Sequence< sal_Int16 > SAL_CALL SpellCheckerDispatcher::getLanguages()
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
-
- ULONG nCnt = aSvcList.Count();
- Sequence< INT16 > aLanguages( nCnt );
- INT16 *pLang = aLanguages.getArray();
- SeqLangSvcEntry_Spell *pEntry = aSvcList.First();
- for (ULONG i = 0; i < nCnt; i++)
- {
- DBG_ASSERT( pEntry, "lng : pEntry is NULL pointer" );
- pLang[i] = (INT16) aSvcList.GetKey( pEntry );
- pEntry = aSvcList.Next();
- }
- return aLanguages;
-}
-
-
-sal_Bool SAL_CALL SpellCheckerDispatcher::hasLanguage( sal_Int16 nLanguage )
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
- return 0 != aSvcList.Get( nLanguage );
-}
-
-
-sal_Bool SAL_CALL
- SpellCheckerDispatcher::isValid( const OUString& rWord, sal_Int16 nLanguage,
- const PropertyValues& rProperties )
- throw(IllegalArgumentException, RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
-
- BOOL bRes = TRUE;
- if (LANGUAGE_NONE != nLanguage && rWord.getLength())
- {
- if (aOpt.IsSpellInAllLanguages())
- bRes = isValidInAny( rWord, getLanguages(), rProperties );
- else
- bRes = isValid_Impl( rWord, nLanguage, rProperties, TRUE );
- }
- return bRes;
-}
-
-
-BOOL SpellCheckerDispatcher::isValidInAny(
- const OUString& rWord,
- const Sequence< INT16 >& aLanguages,
- const PropertyValues& rProperties )
- throw( RuntimeException, IllegalArgumentException )
-{
- MutexGuard aGuard( GetLinguMutex() );
-
- BOOL bRes = TRUE;
-
- INT32 nNumLang = aLanguages.getLength();
- const INT16 *pLang = aLanguages.getConstArray();
- for (int i = 0; i < nNumLang; i++)
- {
- if( LANGUAGE_NONE != pLang[i] )
- {
- if (sal_True == (bRes = isValid_Impl( rWord, pLang[i], rProperties, TRUE )))
- break;
- }
- }
-
- return bRes;
+ return spell_Impl( rWord, LocaleToLanguage( rLocale ), rProperties, TRUE );
}
BOOL SpellCheckerDispatcher::isValid_Impl(
const OUString& rWord,
- INT16 nLanguage,
+ LanguageType nLanguage,
const PropertyValues& rProperties,
BOOL bCheckDics)
throw( RuntimeException, IllegalArgumentException )
@@ -381,7 +294,7 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
return bRes;
// search for entry with that language
- SeqLangSvcEntry_Spell *pEntry = aSvcList.Get( nLanguage );
+ LangSvcEntries_Spell *pEntry = aSvcMap[ nLanguage ].get();
if (!pEntry)
{
@@ -407,7 +320,7 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
INT32 nLen = pEntry->aSvcRefs.getLength();
DBG_ASSERT( nLen == pEntry->aSvcImplNames.getLength(),
"lng : sequence length mismatch");
- DBG_ASSERT( pEntry->aFlags.nLastTriedSvcIndex < nLen,
+ DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
"lng : index out of range");
INT32 i = 0;
@@ -416,19 +329,15 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
// try already instantiated services first
{
- const Reference< XSpellChecker1 > *pRef1 =
- pEntry->aSvc1Refs.getConstArray();
const Reference< XSpellChecker > *pRef =
pEntry->aSvcRefs.getConstArray();
- while (i <= pEntry->aFlags.nLastTriedSvcIndex
+ while (i <= pEntry->nLastTriedSvcIndex
&& (!bTmpResValid || FALSE == bTmpRes))
{
bTmpResValid = TRUE;
- if (pRef1[i].is() && pRef1[i]->hasLanguage( nLanguage ))
- bTmpRes = pRef1[i]->isValid( aChkWord, nLanguage, rProperties );
- else if (pRef[i].is() && pRef[i]->hasLocale( aLocale ))
+ if (pRef[i].is() && pRef[i]->hasLocale( aLocale ))
{
- bTmpRes = GetExtCache().CheckWord( aChkWord, nLanguage, FALSE );
+ bTmpRes = GetCache().CheckWord( aChkWord, nLanguage );
if (!bTmpRes)
{
bTmpRes = pRef[i]->isValid( aChkWord, aLocale, rProperties );
@@ -437,7 +346,7 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
// But not those that are correct only because of
// the temporary supplied settings.
if (bTmpRes && 0 == rProperties.getLength())
- GetExtCache().AddWord( aChkWord, nLanguage );
+ GetCache().AddWord( aChkWord, nLanguage );
}
}
else
@@ -452,10 +361,9 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
// if still no result instantiate new services and try those
if ((!bTmpResValid || FALSE == bTmpRes)
- && pEntry->aFlags.nLastTriedSvcIndex < nLen - 1)
+ && pEntry->nLastTriedSvcIndex < nLen - 1)
{
const OUString *pImplNames = pEntry->aSvcImplNames.getConstArray();
- Reference< XSpellChecker1 > *pRef1 = pEntry->aSvc1Refs.getArray();
Reference< XSpellChecker > *pRef = pEntry->aSvcRefs .getArray();
Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() );
@@ -480,11 +388,9 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
}
catch (uno::Exception &)
{
- DBG_ERROR( "createInstanceWithArguments failed" );
+ DBG_ASSERT( 0, "createInstanceWithArguments failed" );
}
- Reference< XSpellChecker1 > xSpell1( xSpell, UNO_QUERY );
pRef [i] = xSpell;
- pRef1[i] = xSpell1;
Reference< XLinguServiceEventBroadcaster >
xBroadcaster( xSpell, UNO_QUERY );
@@ -492,11 +398,9 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
bTmpResValid = TRUE;
- if (xSpell1.is() && xSpell1->hasLanguage( nLanguage ))
- bTmpRes = xSpell1->isValid( aChkWord, nLanguage, rProperties );
- else if (xSpell.is() && xSpell->hasLocale( aLocale ))
+ if (xSpell.is() && xSpell->hasLocale( aLocale ))
{
- bTmpRes = GetExtCache().CheckWord( aChkWord, nLanguage, FALSE );
+ bTmpRes = GetCache().CheckWord( aChkWord, nLanguage );
if (!bTmpRes)
{
bTmpRes = xSpell->isValid( aChkWord, aLocale, rProperties );
@@ -505,7 +409,7 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
// But not those that are correct only because of
// the temporary supplied settings.
if (bTmpRes && 0 == rProperties.getLength())
- GetExtCache().AddWord( aChkWord, nLanguage );
+ GetCache().AddWord( aChkWord, nLanguage );
}
}
else
@@ -514,7 +418,7 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
if (bTmpResValid)
bRes = bTmpRes;
- pEntry->aFlags.nLastTriedSvcIndex = (INT16) i;
+ pEntry->nLastTriedSvcIndex = (INT16) i;
++i;
}
@@ -523,7 +427,7 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
if (i == nLen)
{
if (!SvcListHasLanguage( *pEntry, nLanguage ))
- aSvcList.Remove( nLanguage );
+ aSvcMap.erase( nLanguage );
}
}
}
@@ -551,83 +455,9 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
}
-Reference< XSpellAlternatives > SAL_CALL
- SpellCheckerDispatcher::spell( const OUString& rWord, sal_Int16 nLanguage,
- const PropertyValues& rProperties )
- throw(IllegalArgumentException, RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
-
- Reference< XSpellAlternatives > xAlt;
- if (LANGUAGE_NONE != nLanguage && rWord.getLength())
- {
- if (aOpt.IsSpellInAllLanguages())
- xAlt = spellInAny( rWord, getLanguages(), rProperties, nLanguage );
- else
- xAlt = spell_Impl( rWord, nLanguage, rProperties, TRUE );
- }
- return xAlt;
-}
-
-
-Reference< XSpellAlternatives > SpellCheckerDispatcher::spellInAny(
- const OUString& aWord,
- const Sequence< INT16 >& aLanguages,
- const PropertyValues& rProperties,
- INT16 nPreferredResultLang)
- throw( RuntimeException, IllegalArgumentException )
-{
- MutexGuard aGuard( GetLinguMutex() );
-
- Reference< XSpellAlternatives > xAlt;
-
- // check preferred language first
- BOOL bPrefLangChecked = FALSE;
- if ( LANGUAGE_NONE != nPreferredResultLang
- && hasLanguage( nPreferredResultLang ) )
- {
- xAlt = spell_Impl( aWord, nPreferredResultLang, rProperties, TRUE );
- bPrefLangChecked = TRUE;
- }
-
- // if word is incorrect (or not checked) try the other languages
- if (xAlt.is() || !bPrefLangChecked)
- {
- INT32 nNumLang = aLanguages.getLength();
- const INT16 *pLang = aLanguages.getConstArray();
- for (int i = 0; i < nNumLang; ++i)
- {
- INT16 nLang = pLang[i];
- if (nLang == nPreferredResultLang) // already checked!
- continue;
-
- // Bug 71632
- if( LANGUAGE_NONE != nLang && hasLanguage( nLang ) )
- {
- Reference< XSpellAlternatives >
- xLast( spell_Impl( aWord, nLang, rProperties, TRUE ));
-
- // remember first spelling alternatives found
- if (xLast.is() && !xAlt.is())
- xAlt = xLast;
-
- // did we finally find a language in which the word is correct?
- if (!xLast.is())
- {
- xAlt = NULL; // don't return any spelling alternatives
- break;
- }
- }
- }
- }
-
- return xAlt;
-}
-
-
Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
const OUString& rWord,
- sal_Int16 nLanguage,
+ LanguageType nLanguage,
const PropertyValues& rProperties,
BOOL bCheckDics )
throw(IllegalArgumentException, RuntimeException)
@@ -640,7 +470,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
return xRes;
// search for entry with that language
- SeqLangSvcEntry_Spell *pEntry = aSvcList.Get( nLanguage );
+ LangSvcEntries_Spell *pEntry = aSvcMap[ nLanguage ].get();
if (!pEntry)
{
@@ -666,7 +496,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
INT32 nLen = pEntry->aSvcRefs.getLength();
DBG_ASSERT( nLen == pEntry->aSvcImplNames.getLength(),
"lng : sequence length mismatch");
- DBG_ASSERT( pEntry->aFlags.nLastTriedSvcIndex < nLen,
+ DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
"lng : index out of range");
INT32 i = 0;
@@ -675,19 +505,15 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
// try already instantiated services first
{
- const Reference< XSpellChecker1 > *pRef1 =
- pEntry->aSvc1Refs.getConstArray();
const Reference< XSpellChecker > *pRef =
pEntry->aSvcRefs.getConstArray();
- while (i <= pEntry->aFlags.nLastTriedSvcIndex
+ while (i <= pEntry->nLastTriedSvcIndex
&& (!bTmpResValid || xTmpRes.is()) )
{
bTmpResValid = TRUE;
- if (pRef1[i].is() && pRef1[i]->hasLanguage( nLanguage ))
- xTmpRes = pRef1[i]->spell( aChkWord, nLanguage, rProperties );
- else if (pRef[i].is() && pRef[i]->hasLocale( aLocale ))
+ if (pRef[i].is() && pRef[i]->hasLocale( aLocale ))
{
- BOOL bOK = GetExtCache().CheckWord( aChkWord, nLanguage, FALSE );
+ BOOL bOK = GetCache().CheckWord( aChkWord, nLanguage );
if (bOK)
xTmpRes = NULL;
else
@@ -698,7 +524,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
// But not those that are correct only because of
// the temporary supplied settings.
if (!xTmpRes.is() && 0 == rProperties.getLength())
- GetExtCache().AddWord( aChkWord, nLanguage );
+ GetCache().AddWord( aChkWord, nLanguage );
}
}
else
@@ -714,10 +540,9 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
// if still no result instantiate new services and try those
if ((!bTmpResValid || xTmpRes.is())
- && pEntry->aFlags.nLastTriedSvcIndex < nLen - 1)
+ && pEntry->nLastTriedSvcIndex < nLen - 1)
{
const OUString *pImplNames = pEntry->aSvcImplNames.getConstArray();
- Reference< XSpellChecker1 > *pRef1 = pEntry->aSvc1Refs.getArray();
Reference< XSpellChecker > *pRef = pEntry->aSvcRefs .getArray();
Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() );
@@ -742,11 +567,9 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
}
catch (uno::Exception &)
{
- DBG_ERROR( "createInstanceWithArguments failed" );
+ DBG_ASSERT( 0, "createInstanceWithArguments failed" );
}
- Reference< XSpellChecker1 > xSpell1( xSpell, UNO_QUERY );
pRef [i] = xSpell;
- pRef1[i] = xSpell1;
Reference< XLinguServiceEventBroadcaster >
xBroadcaster( xSpell, UNO_QUERY );
@@ -754,11 +577,9 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
bTmpResValid = TRUE;
- if (xSpell1.is() && xSpell1->hasLanguage( nLanguage ))
- xTmpRes = xSpell1->spell( aChkWord, nLanguage, rProperties );
- else if (xSpell.is() && xSpell->hasLocale( aLocale ))
+ if (xSpell.is() && xSpell->hasLocale( aLocale ))
{
- BOOL bOK = GetExtCache().CheckWord( aChkWord, nLanguage, FALSE );
+ BOOL bOK = GetCache().CheckWord( aChkWord, nLanguage );
if (bOK)
xTmpRes = NULL;
else
@@ -769,7 +590,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
// But not those that are correct only because of
// the temporary supplied settings.
if (!xTmpRes.is() && 0 == rProperties.getLength())
- GetExtCache().AddWord( aChkWord, nLanguage );
+ GetCache().AddWord( aChkWord, nLanguage );
}
}
else
@@ -779,7 +600,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
if (!xRes.is() && bTmpResValid)
xRes = xTmpRes;
- pEntry->aFlags.nLastTriedSvcIndex = (INT16) i;
+ pEntry->nLastTriedSvcIndex = (INT16) i;
++i;
}
@@ -788,7 +609,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
if (i == nLen)
{
if (!SvcListHasLanguage( *pEntry, nLanguage ))
- aSvcList.Remove( nLanguage );
+ aSvcMap.erase( nLanguage );
}
}
}
@@ -865,45 +686,93 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
if (bCheckDics && xDList.is())
SeqRemoveNegEntries( aProposals, xDList, nLanguage );
- xRes = new SpellAlternatives( aChkWord, nLanguage,
- eFailureType, aProposals );
+ uno::Reference< linguistic2::XSetSpellAlternatives > xSetAlt( xRes, uno::UNO_QUERY );
+ if (xSetAlt.is())
+ {
+ xSetAlt->setAlternatives( aProposals );
+ xSetAlt->setFailureType( eFailureType );
+ }
+ else
+ DBG_ASSERT( 0, "XSetSpellAlternatives not implemented!" );
}
}
return xRes;
}
+uno::Sequence< sal_Int16 > SAL_CALL SpellCheckerDispatcher::getLanguages( )
+throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( GetLinguMutex() );
+ uno::Sequence< Locale > aTmp( getLocales() );
+ uno::Sequence< INT16 > aRes( LocaleSeqToLangSeq( aTmp ) );
+ return aRes;
+}
+
+
+sal_Bool SAL_CALL SpellCheckerDispatcher::hasLanguage(
+ sal_Int16 nLanguage )
+throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( GetLinguMutex() );
+ Locale aLocale( CreateLocale( nLanguage ) );
+ return hasLocale( aLocale );
+}
+
+
+sal_Bool SAL_CALL SpellCheckerDispatcher::isValid(
+ const OUString& rWord,
+ sal_Int16 nLanguage,
+ const uno::Sequence< beans::PropertyValue >& rProperties )
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ MutexGuard aGuard( GetLinguMutex() );
+ Locale aLocale( CreateLocale( nLanguage ) );
+ return isValid( rWord, aLocale, rProperties);
+}
+
+
+uno::Reference< linguistic2::XSpellAlternatives > SAL_CALL SpellCheckerDispatcher::spell(
+ const OUString& rWord,
+ sal_Int16 nLanguage,
+ const uno::Sequence< beans::PropertyValue >& rProperties )
+throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ MutexGuard aGuard( GetLinguMutex() );
+ Locale aLocale( CreateLocale( nLanguage ) );
+ return spell( rWord, aLocale, rProperties);
+}
+
void SpellCheckerDispatcher::SetServiceList( const Locale &rLocale,
const Sequence< OUString > &rSvcImplNames )
{
MutexGuard aGuard( GetLinguMutex() );
- if (pExtCache)
- pExtCache->Flush(); // new services may spell differently...
+ if (pCache)
+ pCache->Flush(); // new services may spell differently...
INT16 nLanguage = LocaleToLanguage( rLocale );
- if (0 == rSvcImplNames.getLength())
+ INT32 nLen = rSvcImplNames.getLength();
+ if (0 == nLen)
// remove entry
- aSvcList.Remove( nLanguage );
+ aSvcMap.erase( nLanguage );
else
{
// modify/add entry
- SeqLangSvcEntry_Spell *pEntry = aSvcList.Get( nLanguage );
+ LangSvcEntries_Spell *pEntry = aSvcMap[ nLanguage ].get();
if (pEntry)
{
- INT32 nLen = rSvcImplNames.getLength();
+ pEntry->Clear();
pEntry->aSvcImplNames = rSvcImplNames;
- pEntry->aSvcRefs = Sequence< Reference < XSpellChecker > > ( nLen );
- pEntry->aSvc1Refs = Sequence< Reference < XSpellChecker1 > >( nLen );
- pEntry->aFlags = SvcFlags();
+ pEntry->aSvcRefs = Sequence< Reference < XSpellChecker > > ( nLen );
}
else
{
- pEntry = new SeqLangSvcEntry_Spell( rSvcImplNames );
- aSvcList.Insert( nLanguage, pEntry );
- DBG_ASSERT( aSvcList.Get( nLanguage ), "lng : Insert failed" );
+ boost::shared_ptr< LangSvcEntries_Spell > pTmpEntry( new LangSvcEntries_Spell( rSvcImplNames ) );
+ pTmpEntry->aSvcRefs = Sequence< Reference < XSpellChecker > >( nLen );
+ aSvcMap[ nLanguage ] = pTmpEntry;
}
}
}
@@ -919,7 +788,7 @@ Sequence< OUString >
// search for entry with that language and use data from that
INT16 nLanguage = LocaleToLanguage( rLocale );
SpellCheckerDispatcher *pThis = (SpellCheckerDispatcher *) this;
- const SeqLangSvcEntry_Spell *pEntry = pThis->aSvcList.Get( nLanguage );
+ const LangSvcEntries_Spell *pEntry = pThis->aSvcMap[ nLanguage ].get();
if (pEntry)
aRes = pEntry->aSvcImplNames;
@@ -927,12 +796,16 @@ Sequence< OUString >
}
-SpellCheckerDispatcher::DspType
- SpellCheckerDispatcher::GetDspType() const
+LinguDispatcher::DspType SpellCheckerDispatcher::GetDspType() const
{
return DSP_SPELL;
}
+void SpellCheckerDispatcher::FlushSpellCache()
+{
+ if (pCache)
+ pCache->Flush();
+}
///////////////////////////////////////////////////////////////////////////
diff --git a/linguistic/source/spelldsp.hxx b/linguistic/source/spelldsp.hxx
index c48cdf88aebb..161837fd4610 100644
--- a/linguistic/source/spelldsp.hxx
+++ b/linguistic/source/spelldsp.hxx
@@ -36,69 +36,39 @@
#include "iprcache.hxx"
#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
-#include <cppuhelper/implbase1.hxx> // helper for implementations
-#include <cppuhelper/implbase2.hxx> // helper for implementations
-#include <cppuhelper/implbase7.hxx> // helper for implementations
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase7.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceDisplayName.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValues.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/linguistic2/XSpellChecker.hpp>
#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
+#include <com/sun/star/linguistic2/XSpellChecker.hpp>
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
-#include <tools/table.hxx>
+#include <boost/shared_ptr.hpp>
+#include <map>
class LngSvcMgr;
///////////////////////////////////////////////////////////////////////////
-class SeqLangSvcEntry_Spell
-{
- friend class SpellCheckerDispatcher;
- friend BOOL SvcListHasLanguage(
- const SeqLangSvcEntry_Spell &rEntry,
- INT16 nLanguage );
-
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aSvcImplNames;
- ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker > > aSvcRefs;
- ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellChecker1 > > aSvc1Refs;
-
-// INT16 nLang; //used as key in the table
- SvcFlags aFlags;
-
-public:
- SeqLangSvcEntry_Spell() {}
- SeqLangSvcEntry_Spell( const ::com::sun::star::uno::Sequence<
- ::rtl::OUString > &rSvcImplNames );
- ~SeqLangSvcEntry_Spell();
-
- BOOL IsAlreadyWarned() const { return aFlags.bAlreadyWarned != 0; }
- void SetAlreadyWarned(BOOL bVal) { aFlags.bAlreadyWarned = 0 != bVal; }
- BOOL IsDoWarnAgain() const { return aFlags.bDoWarnAgain != 0; }
- void SetDoWarnAgain(BOOL bVal) { aFlags.bDoWarnAgain = 0 != bVal; }
-};
-
-DECLARE_TABLE( SpellSvcList, SeqLangSvcEntry_Spell * )
-
-
class SpellCheckerDispatcher :
public cppu::WeakImplHelper2
<
- ::com::sun::star::linguistic2::XSpellChecker,
- ::com::sun::star::linguistic2::XSpellChecker1
+ ::com::sun::star::linguistic2::XSpellChecker1,
+ ::com::sun::star::linguistic2::XSpellChecker
>,
public LinguDispatcher
{
- SpellSvcList aSvcList;
- LinguOptions aOpt;
+ typedef boost::shared_ptr< LangSvcEntries_Spell > LangSvcEntries_Spell_Ptr_t;
+ typedef std::map< LanguageType, LangSvcEntries_Spell_Ptr_t > SpellSvcByLangMap_t;
+ SpellSvcByLangMap_t aSvcMap;
+ LinguOptions aOpt;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > xPropSet;
@@ -106,15 +76,13 @@ class SpellCheckerDispatcher :
::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
LngSvcMgr &rMgr;
- linguistic::IPRSpellCache *pExtCache; // SpellCache for external SpellCheckers
- // (usually those not called via XSpellChecker1)
- // One for all of them.
+ linguistic::SpellCache *pCache; // Spell Cache (holds known words)
// disallow copy-constructor and assignment-operator for now
SpellCheckerDispatcher(const SpellCheckerDispatcher &);
SpellCheckerDispatcher & operator = (const SpellCheckerDispatcher &);
- inline linguistic::IPRSpellCache & GetExtCache() const;
+ inline linguistic::SpellCache & GetCache() const;
inline ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
@@ -125,97 +93,52 @@ class SpellCheckerDispatcher :
void ClearSvcList();
- BOOL isValid_Impl(const ::rtl::OUString& aWord, INT16 nLanguage,
+ BOOL isValid_Impl(const ::rtl::OUString& aWord, LanguageType nLanguage,
const ::com::sun::star::beans::PropertyValues& aProperties,
BOOL bCheckDics)
throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XSpellAlternatives >
- spell_Impl(const ::rtl::OUString& aWord, INT16 nLanguage,
+ spell_Impl(const ::rtl::OUString& aWord, LanguageType nLanguage,
const ::com::sun::star::beans::PropertyValues& aProperties,
BOOL bCheckDics)
throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
- BOOL isValidInAny(const ::rtl::OUString& aWord,
- const ::com::sun::star::uno::Sequence< INT16 >& aLanguages,
- const ::com::sun::star::beans::PropertyValues& aProperties)
- throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
-
- com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellAlternatives >
- spellInAny(const ::rtl::OUString& aWord,
- const ::com::sun::star::uno::Sequence< INT16 >& aLanguages,
- const ::com::sun::star::beans::PropertyValues& aProperties,
- INT16 nPreferredResultLang)
- throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
-
public:
SpellCheckerDispatcher( LngSvcMgr &rLngSvcMgr );
virtual ~SpellCheckerDispatcher();
// XSupportedLocales (for XSpellChecker)
- virtual ::com::sun::star::uno::Sequence<
- ::com::sun::star::lang::Locale > SAL_CALL
- getLocales()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL
- hasLocale( const ::com::sun::star::lang::Locale& aLocale )
- throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasLocale( const ::com::sun::star::lang::Locale& aLocale ) throw(::com::sun::star::uno::RuntimeException);
// XSpellChecker
- virtual sal_Bool SAL_CALL
- isValid( const ::rtl::OUString& aWord,
- const ::com::sun::star::lang::Locale& aLocale,
- const ::com::sun::star::beans::PropertyValues& aProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellAlternatives > SAL_CALL
- spell( const ::rtl::OUString& aWord,
- const ::com::sun::star::lang::Locale& aLocale,
- const ::com::sun::star::beans::PropertyValues& aProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
-
- // XSupportedLanguages (for XSpellChecker1)
- virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL
- getLanguages()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL
- hasLanguage( sal_Int16 nLanguage )
- throw(::com::sun::star::uno::RuntimeException);
-
- // XSpellChecker1 (same as XSpellChecker but sal_Int16 for language)
- virtual sal_Bool SAL_CALL
- isValid( const ::rtl::OUString& aWord, sal_Int16 nLanguage,
- const ::com::sun::star::beans::PropertyValues& aProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellAlternatives > SAL_CALL
- spell( const ::rtl::OUString& aWord, sal_Int16 nLanguage,
- const ::com::sun::star::beans::PropertyValues& aProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isValid( const ::rtl::OUString& aWord, const ::com::sun::star::lang::Locale& aLocale, const ::com::sun::star::beans::PropertyValues& aProperties ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives > SAL_CALL spell( const ::rtl::OUString& aWord, const ::com::sun::star::lang::Locale& aLocale, const ::com::sun::star::beans::PropertyValues& aProperties ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XSupportedLanguages
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int16 > SAL_CALL getLanguages( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasLanguage( ::sal_Int16 nLanguage ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XSpellChecker1
+ virtual ::sal_Bool SAL_CALL isValid( const ::rtl::OUString& aWord, ::sal_Int16 nLanguage, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives > SAL_CALL spell( const ::rtl::OUString& aWord, ::sal_Int16 nLanguage, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
// LinguDispatcher
- virtual void
- SetServiceList( const ::com::sun::star::lang::Locale &rLocale,
- const ::com::sun::star::uno::Sequence<
- rtl::OUString > &rSvcImplNames );
- virtual ::com::sun::star::uno::Sequence< rtl::OUString >
- GetServiceList( const ::com::sun::star::lang::Locale &rLocale ) const;
- virtual DspType
- GetDspType() const;
+ virtual void SetServiceList( const ::com::sun::star::lang::Locale &rLocale, const ::com::sun::star::uno::Sequence< rtl::OUString > &rSvcImplNames );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > GetServiceList( const ::com::sun::star::lang::Locale &rLocale ) const;
+ virtual DspType GetDspType() const;
+
+ void FlushSpellCache();
};
-inline linguistic::IPRSpellCache & SpellCheckerDispatcher::GetExtCache() const
+inline linguistic::SpellCache & SpellCheckerDispatcher::GetCache() const
{
- if (!pExtCache)
- ((SpellCheckerDispatcher *) this)->pExtCache = new linguistic::IPRSpellCache( 997 );
- return *pExtCache;
+ if (!pCache)
+ ((SpellCheckerDispatcher *) this)->pCache = new linguistic::SpellCache();
+ return *pCache;
}
diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx
index a9c0ebbd8af3..f3729f231132 100644
--- a/linguistic/source/spelldta.cxx
+++ b/linguistic/source/spelldta.cxx
@@ -34,7 +34,6 @@
#include <com/sun/star/linguistic2/SpellFailure.hpp>
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
-#include <com/sun/star/linguistic2/XDictionary1.hpp>
#include <tools/debug.hxx>
#include <unotools/processfactory.hxx>
#include <osl/mutex.hxx>
@@ -143,9 +142,9 @@ void SearchSimilarText( const OUString &rText, INT16 nLanguage,
for (INT32 i = 0; i < nDics; i++)
{
- Reference< XDictionary1 > xDic( pDic[i], UNO_QUERY );
+ Reference< XDictionary > xDic( pDic[i], UNO_QUERY );
- INT16 nLang = xDic->getLanguage();
+ INT16 nLang = LocaleToLanguage( xDic->getLocale() );
if ( xDic.is() && xDic->isActive()
&& (nLang == nLanguage || nLang == LANGUAGE_NONE) )
@@ -326,6 +325,22 @@ Sequence< OUString > SAL_CALL SpellAlternatives::getAlternatives()
}
+void SAL_CALL SpellAlternatives::setAlternatives( const uno::Sequence< OUString >& rAlternatives )
+throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( GetLinguMutex() );
+ aAlt = rAlternatives;
+}
+
+
+void SAL_CALL SpellAlternatives::setFailureType( sal_Int16 nFailureType )
+throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( GetLinguMutex() );
+ nType = nFailureType;
+}
+
+
void SpellAlternatives::SetWordLanguage(const OUString &rWord, INT16 nLang)
{
MutexGuard aGuard( GetLinguMutex() );
diff --git a/linguistic/source/supplang.cxx b/linguistic/source/supplang.cxx
deleted file mode 100644
index d10dbedae737..000000000000
--- a/linguistic/source/supplang.cxx
+++ /dev/null
@@ -1,161 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: supplang.cxx,v $
- * $Revision: 1.9 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_linguistic.hxx"
-#include <tools/string.hxx>
-#include <tools/fsys.hxx>
-#include <tools/urlobj.hxx>
-#include <ucbhelper/content.hxx>
-#include <tools/debug.hxx>
-#include <svtools/pathoptions.hxx>
-#include <unotools/processfactory.hxx>
-#include <unotools/localfilehelper.hxx>
-#include <unotools/localedatawrapper.hxx>
-#include <unotools/ucbhelper.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/XFastPropertySet.hpp>
-#include <com/sun/star/beans/XPropertyChangeListener.hpp>
-#include <com/sun/star/frame/XTerminateListener.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
-
-#include <com/sun/star/beans/PropertyValues.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/linguistic2/XDictionary1.hpp>
-#include <com/sun/star/linguistic2/DictionaryType.hpp>
-#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
-
-#include "misc.hxx"
-#include "lngprops.hxx"
-#include "supplang.hxx"
-
-using namespace utl;
-using namespace osl;
-using namespace rtl;
-using namespace com::sun::star;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::linguistic2;
-using namespace linguistic;
-
-namespace linguistic
-{
-
-///////////////////////////////////////////////////////////////////////////
-
-INT16 & LanguageState::GetState( ModuleName eModule )
-{
- if ( MOD_SPELL == eModule )
- return nSpellState;
- else if ( MOD_HYPH == eModule )
- return nHyphState;
- else
- {
- DBG_ASSERT( MOD_THES == eModule, "unexpected argument" );
- return nThesState;
- }
-}
-
-
-LanguageState * GetLanguageState( INT16 nLanguage, LanguageState *pArray )
-{
- if (!pArray)
- return 0;
-
- LanguageState *pState = pArray;
- INT16 nLang;
- while ((nLang = pState->nLanguage) != LANGUAGE_NONE && nLang != nLanguage)
- ++pState;
- return nLang == LANGUAGE_NONE ? 0 : pState;
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-SuppLanguages::SuppLanguages( LanguageState *pState, USHORT nCount)
-{
- for (USHORT i = 0; i < nCount; ++i)
- aLanguages.Insert( pState[i].nLanguage, new INT16( LANG_QUERY ) );
-}
-
-
-SuppLanguages::~SuppLanguages()
-{
- INT16 *pItem = aLanguages.First();
- while (pItem)
- {
- INT16 *pTmp = pItem;
- pItem = aLanguages.Next();
- delete pTmp;
- }
-}
-
-
-BOOL SuppLanguages::HasLanguage( INT16 nLanguage ) const
-{
- BOOL bRes = FALSE;
- SuppLanguages *pThis = (SuppLanguages *) this;
- INT16 *pEntry = pThis->aLanguages.Seek( nLanguage );
- if (pEntry)
- {
- INT16 nState = *pEntry;
- if (LANG_QUERY == nState)
- {
- nState = CheckLanguage( nLanguage );
- pThis->aLanguages.Replace( nLanguage, new INT16( nState ) );
- }
- bRes = LANG_OK == nState;
- }
- return bRes;
-}
-
-
-const Sequence< INT16 > SuppLanguages::GetLanguages() const
-{
- INT32 nLen = aLanguages.Count();
- Sequence< INT16 > aRes( nLen );
- INT16 *pRes = aRes.getArray();
- USHORT nCnt = 0;
- for (INT32 i = 0; i < nLen; ++i)
- {
- INT16 nLanguage = sal::static_int_cast< INT16 >(aLanguages.GetObjectKey( i ));
- if (HasLanguage( nLanguage ))
- pRes[ nCnt++ ] = nLanguage;
- }
- aRes.realloc( nCnt );
- return aRes;
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-} // namespace linguistic
-
-
diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx
index ea9e4a8fdd60..cc0623d1dd82 100644
--- a/linguistic/source/thesdsp.cxx
+++ b/linguistic/source/thesdsp.cxx
@@ -74,19 +74,6 @@ static BOOL SvcListHasLanguage(
///////////////////////////////////////////////////////////////////////////
-SeqLangSvcEntry_Thes::~SeqLangSvcEntry_Thes()
-{
-}
-
-
-SeqLangSvcEntry_Thes::SeqLangSvcEntry_Thes(
- const Sequence< OUString > &rSvcImplNames ) :
- aSvcImplNames ( rSvcImplNames ),
- aSvcRefs ( rSvcImplNames.getLength() )
-{
-}
-
-///////////////////////////////////////////////////////////////////////////
ThesaurusDispatcher::ThesaurusDispatcher()
{
@@ -102,13 +89,8 @@ ThesaurusDispatcher::~ThesaurusDispatcher()
void ThesaurusDispatcher::ClearSvcList()
{
// release memory for each table entry
- SeqLangSvcEntry_Thes *pItem = aSvcList.First();
- while (pItem)
- {
- SeqLangSvcEntry_Thes *pTmp = pItem;
- pItem = aSvcList.Next();
- delete pTmp;
- }
+ ThesSvcByLangMap_t aTmp;
+ aSvcMap.swap( aTmp );
}
@@ -118,15 +100,12 @@ Sequence< Locale > SAL_CALL
{
MutexGuard aGuard( GetLinguMutex() );
- ULONG nCnt = aSvcList.Count();
- Sequence< Locale > aLocales( nCnt );
- Locale *pItem = aLocales.getArray();
- SeqLangSvcEntry_Thes *pEntry = aSvcList.First();
- for (ULONG i = 0; i < nCnt; i++)
+ Sequence< Locale > aLocales( static_cast< sal_Int32 >(aSvcMap.size()) );
+ Locale *pLocales = aLocales.getArray();
+ ThesSvcByLangMap_t::const_iterator aIt;
+ for (aIt = aSvcMap.begin(); aIt != aSvcMap.end(); ++aIt)
{
- DBG_ASSERT( pEntry, "lng : pEntry is NULL pointer" );
- pItem[i] = CreateLocale( (LanguageType) aSvcList.GetKey( pEntry ) );
- pEntry = aSvcList.Next();
+ *pLocales++ = CreateLocale( aIt->first );
}
return aLocales;
}
@@ -137,7 +116,8 @@ sal_Bool SAL_CALL
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- return 0 != aSvcList.Get( LocaleToLanguage( rLocale ) );
+ ThesSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LocaleToLanguage( rLocale ) ) );
+ return aIt != aSvcMap.end();
}
@@ -156,7 +136,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
return aMeanings;
// search for entry with that language
- SeqLangSvcEntry_Thes *pEntry = aSvcList.Get( nLanguage );
+ LangSvcEntries_Thes *pEntry = aSvcMap[ nLanguage ].get();
if (!pEntry)
{
@@ -175,7 +155,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
INT32 nLen = pEntry->aSvcRefs.getLength();
DBG_ASSERT( nLen == pEntry->aSvcImplNames.getLength(),
"lng : sequence length mismatch");
- DBG_ASSERT( pEntry->aFlags.nLastTriedSvcIndex < nLen,
+ DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
"lng : index out of range");
INT32 i = 0;
@@ -183,7 +163,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
// try already instantiated services first
{
const Reference< XThesaurus > *pRef = pEntry->aSvcRefs.getConstArray();
- while (i <= pEntry->aFlags.nLastTriedSvcIndex
+ while (i <= pEntry->nLastTriedSvcIndex
&& aMeanings.getLength() == 0)
{
if (pRef[i].is() && pRef[i]->hasLocale( rLocale ))
@@ -194,7 +174,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
// if still no result instantiate new services and try those
if (aMeanings.getLength() == 0
- && pEntry->aFlags.nLastTriedSvcIndex < nLen - 1)
+ && pEntry->nLastTriedSvcIndex < nLen - 1)
{
const OUString *pImplNames = pEntry->aSvcImplNames.getConstArray();
Reference< XThesaurus > *pRef = pEntry->aSvcRefs.getArray();
@@ -218,14 +198,14 @@ Sequence< Reference< XMeaning > > SAL_CALL
}
catch (uno::Exception &)
{
- DBG_ERROR( "createInstanceWithArguments failed" );
+ DBG_ASSERT( 0, "createInstanceWithArguments failed" );
}
pRef[i] = xThes;
if (xThes.is() && xThes->hasLocale( rLocale ))
aMeanings = xThes->queryMeanings( aChkWord, rLocale, rProperties );
- pEntry->aFlags.nLastTriedSvcIndex = (INT16) i;
+ pEntry->nLastTriedSvcIndex = (INT16) i;
++i;
}
@@ -234,7 +214,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
if (i == nLen && aMeanings.getLength() == 0)
{
if (!SvcListHasLanguage( pEntry->aSvcRefs, rLocale ))
- aSvcList.Remove( nLanguage );
+ aSvcMap.erase( nLanguage );
}
}
}
@@ -251,25 +231,25 @@ void ThesaurusDispatcher::SetServiceList( const Locale &rLocale,
INT16 nLanguage = LocaleToLanguage( rLocale );
- if (0 == rSvcImplNames.getLength())
+ INT32 nLen = rSvcImplNames.getLength();
+ if (0 == nLen)
// remove entry
- aSvcList.Remove( nLanguage );
+ aSvcMap.erase( nLanguage );
else
{
// modify/add entry
- SeqLangSvcEntry_Thes *pEntry = aSvcList.Get( nLanguage );
+ LangSvcEntries_Thes *pEntry = aSvcMap[ nLanguage ].get();
if (pEntry)
{
+ pEntry->Clear();
pEntry->aSvcImplNames = rSvcImplNames;
- pEntry->aSvcRefs = Sequence< Reference < XThesaurus > >(
- rSvcImplNames.getLength() );
- pEntry->aFlags = SvcFlags();
+ pEntry->aSvcRefs = Sequence< Reference < XThesaurus > >( nLen );
}
else
{
- pEntry = new SeqLangSvcEntry_Thes( rSvcImplNames );
- aSvcList.Insert( nLanguage, pEntry );
- DBG_ASSERT( aSvcList.Get( nLanguage ), "lng : Insert failed" );
+ boost::shared_ptr< LangSvcEntries_Thes > pTmpEntry( new LangSvcEntries_Thes( rSvcImplNames ) );
+ pTmpEntry->aSvcRefs = Sequence< Reference < XThesaurus > >( nLen );
+ aSvcMap[ nLanguage ] = pTmpEntry;
}
}
}
@@ -285,7 +265,7 @@ Sequence< OUString >
// search for entry with that language and use data from that
INT16 nLanguage = LocaleToLanguage( rLocale );
ThesaurusDispatcher *pThis = (ThesaurusDispatcher *) this;
- const SeqLangSvcEntry_Thes *pEntry = pThis->aSvcList.Get( nLanguage );
+ const LangSvcEntries_Thes *pEntry = pThis->aSvcMap[ nLanguage ].get();
if (pEntry)
aRes = pEntry->aSvcImplNames;
@@ -293,8 +273,7 @@ Sequence< OUString >
}
-ThesaurusDispatcher::DspType
- ThesaurusDispatcher::GetDspType() const
+LinguDispatcher::DspType ThesaurusDispatcher::GetDspType() const
{
return DSP_THES;
}
diff --git a/linguistic/source/thesdsp.hxx b/linguistic/source/thesdsp.hxx
index f52bc08d449b..b734d8ea9fdb 100644
--- a/linguistic/source/thesdsp.hxx
+++ b/linguistic/source/thesdsp.hxx
@@ -33,6 +33,7 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyAccess.hpp>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/lang/XComponent.hpp>
@@ -48,46 +49,15 @@
#include <cppuhelper/interfacecontainer.h>
#include <vos/mutex.hxx>
-#include <tools/table.hxx>
-
-#include "lngopt.hxx"
+#include <boost/shared_ptr.hpp>
+#include <map>
-class LinguOptions;
+#include "lngopt.hxx"
-namespace com { namespace sun { namespace star { namespace beans {
- class XPropertySet;
-}}}}
///////////////////////////////////////////////////////////////////////////
-class SeqLangSvcEntry_Thes
-{
- friend class ThesaurusDispatcher;
-
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aSvcImplNames;
- ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XThesaurus > > aSvcRefs;
-// INT16 nLang; //used as key in the table
- SvcFlags aFlags;
-
-public:
- SeqLangSvcEntry_Thes() {}
- SeqLangSvcEntry_Thes( const ::com::sun::star::uno::Sequence<
- ::rtl::OUString > &rSvcImplNames );
- ~SeqLangSvcEntry_Thes();
-
- BOOL IsAlreadyWarned() const { return aFlags.bAlreadyWarned != 0; }
- void SetAlreadyWarned(BOOL bVal) { aFlags.bAlreadyWarned = 0 != bVal; }
- BOOL IsDoWarnAgain() const { return aFlags.bDoWarnAgain != 0; }
- void SetDoWarnAgain(BOOL bVal) { aFlags.bDoWarnAgain = 0 != bVal; }
-};
-
-
-
-DECLARE_TABLE( ThesSvcList, SeqLangSvcEntry_Thes * )
-
class ThesaurusDispatcher :
public cppu::WeakImplHelper1
<
@@ -95,7 +65,9 @@ class ThesaurusDispatcher :
>,
public LinguDispatcher
{
- ThesSvcList aSvcList;
+ typedef boost::shared_ptr< LangSvcEntries_Thes > LangSvcEntries_Thes_Ptr_t;
+ typedef std::map< LanguageType, LangSvcEntries_Thes_Ptr_t > ThesSvcByLangMap_t;
+ ThesSvcByLangMap_t aSvcMap;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > xPropSet;
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 54c3a74c7eaa..b7923632b0c8 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -2947,6 +2947,11 @@
<value xml:lang="en-US">~Spelling...</value>
</prop>
</node>
+ <node oor:name=".uno:RecheckDocument" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">~Recheck Document...</value>
+ </prop>
+ </node>
<node oor:name=".uno:SpellingAndGrammarDialog" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">~Spelling and Grammar...</value>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs b/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs
index baf87a40cf39..99bee988ab09 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Linguistic.xcs
@@ -72,21 +72,21 @@
</prop>
</group>
- <group oor:name="VendorEntry">
+ <group oor:name="ServiceNameEntry">
<info>
- <desc>Provides the service implementation name for further look-up.</desc>
+ <desc>The node name is the service implementation name.</desc>
</info>
- <prop oor:name="VendorName" oor:type="xs:string">
+ <prop oor:name="VendorImagesNode" oor:type="xs:string">
<info>
- <desc>Contains the vendor name (actually the service implementation name).</desc>
- <label>Vendor entry</label>
+ <desc>Contains the node name in the VendorImages set to look for in order to find a specific image.</desc>
+ <label>Vendor images node</label>
</info>
</prop>
</group>
<group oor:name="VendorImagesEntry">
<info>
- <desc>The bitmaps for vendor specifc branding in the UI. The node name is the service implementation name.</desc>
+ <desc>The images for vendor specifc branding in the UI. The node name is the service implementation name.</desc>
</info>
<prop oor:name="SpellAndGrammarDialogImage" oor:type="xs:string">
<info>
@@ -94,10 +94,34 @@
<label>Spell and grammar dialog image</label>
</info>
</prop>
- <prop oor:name="SpellAndGrammarContextMenuImage" oor:type="xs:string">
+ <prop oor:name="SpellAndGrammarDialogImage_HC" oor:type="xs:string">
<info>
- <desc>The path to the image for the spell and grammar checking context menu.</desc>
- <label>Spell and grammar context menu image</label>
+ <desc>The path to the image for the spell and grammar checking dialog in high contrast mode.</desc>
+ <label>Spell and grammar dialog image</label>
+ </info>
+ </prop>
+ <prop oor:name="SpellAndGrammarContextMenuSuggestionImage" oor:type="xs:string">
+ <info>
+ <desc>The path to the image for the spell and grammar checking suggestions in the context menu context menu.</desc>
+ <label>Spell and grammar context menu suggestions image</label>
+ </info>
+ </prop>
+ <prop oor:name="SpellAndGrammarContextMenuSuggestionImage_HC" oor:type="xs:string">
+ <info>
+ <desc>The path to the image for the spell and grammar checking suggestions in the context menu context menu in high contrast mode.</desc>
+ <label>Spell and grammar context menu suggestions image</label>
+ </info>
+ </prop>
+ <prop oor:name="SpellAndGrammarContextMenuDictionaryImage" oor:type="xs:string">
+ <info>
+ <desc>The path to the image for the spell and grammar checking context menu context menu.</desc>
+ <label>Spell and grammar context menu dictionary image</label>
+ </info>
+ </prop>
+ <prop oor:name="SpellAndGrammarContextMenuDictionaryImage_HC" oor:type="xs:string">
+ <info>
+ <desc>The path to the image for the spell and grammar checking context menu in high contrast mode.</desc>
+ <label>Spell and grammar context menu dictionary image</label>
</info>
</prop>
</group>
@@ -118,31 +142,25 @@
<component>
- <group oor:name="Bitmaps">
- <info>
- <desc>Contains settings for special bitmaps to be used.</desc>
- </info>
- <set oor:name="VendorImages" oor:node-type="VendorImagesEntry">
- <info>
- <desc>Contains the images to use. The node names are the service implementation names.</desc>
- <label>Vendor images</label>
- </info>
- </set>
-
- <set oor:name="SpellAndGrammarDialog" oor:node-type="VendorEntry">
- <info>
- <desc>Contains the vendor name (service implementation name) to look up for the image to use. The node names are the langauges.</desc>
- <label>Spell and grammar dialog vendor list</label>
- </info>
- </set>
-
- <set oor:name="SpellAndGrammarContextMenu" oor:node-type="VendorEntry">
- <info>
- <desc>Contains the vendor name (service implementation name) to look up for the image to use. The node names are the langauges.</desc>
- <label>Spell and grammar context menu vendor list</label>
- </info>
- </set>
- </group>
+ <group oor:name="Images">
+ <info>
+ <desc>Contains settings for images to be used.</desc>
+ </info>
+ <set oor:name="ServiceNameEntries" oor:node-type="ServiceNameEntry">
+ <info>
+ <desc>The node name is the service implementation name and and the property states
+ the node name to use in the VendorImages set.
+ </desc>
+ <label>Component entries</label>
+ </info>
+ </set>
+ <set oor:name="VendorImages" oor:node-type="VendorImagesEntry">
+ <info>
+ <desc>Contains the images to use. The node names are the service implementation names.</desc>
+ <label>Vendor images</label>
+ </info>
+ </set>
+ </group>
<group oor:name="General">
<info>
@@ -199,17 +217,6 @@
<value/>
<!-- JB: Empty default inserted into empty property node. Remove if NIL was intended -->
</prop>
- <prop oor:name="IsGermanPreReform" oor:type="xs:boolean">
- <!-- OldPath: MiscOptions -->
- <!-- OldLocation: soffice.ini -->
- <!-- UIHints: Tools - Options - General - Language -->
- <info>
- <author>TL</author>
- <desc>Determines if the Old German spelling should be used (true) or not (false).</desc>
- <label>Old German spelling</label>
- </info>
- <value>false</value>
- </prop>
<group oor:name="DictionaryList">
<info>
<desc>Defines which personal dictionaries are used.</desc>
@@ -348,17 +355,6 @@
</info>
<value>true</value>
</prop>
- <prop oor:name="IsHideMarkings" oor:type="xs:boolean">
- <!-- OldPath: MiscOptions / SpellOptions -->
- <!-- OldLocation: soffice.ini -->
- <!-- UIHints: Tools - Options - General - Language -->
- <info>
- <author>TL</author>
- <desc>Hides the wavy lines that underline possible spelling errors when AutoSpellcheck is active.</desc>
- <label>Hide markings</label>
- </info>
- <value>false</value>
- </prop>
<prop oor:name="IsSpellAuto" oor:type="xs:boolean">
<!-- OldPath: MiscOptions / SpellOptions -->
<!-- OldLocation: soffice.ini -->
@@ -381,17 +377,6 @@
</info>
<value>true</value>
</prop>
- <prop oor:name="IsSpellInAllLocales" oor:type="xs:boolean">
- <!-- OldPath: MiscOptions / SpellOptions -->
- <!-- OldLocation: soffice.ini -->
- <!-- UIHints: Tools - Options - General - Language -->
- <info>
- <author>TL</author>
- <desc>Checks spelling in all languages.</desc>
- <label>Check spelling in all languages</label>
- </info>
- <value>false</value>
- </prop>
<prop oor:name="IsReverseDirection" oor:type="xs:boolean">
<!-- OldPath: MiscOptions / SpellOptions -->
<!-- OldLocation: soffice.ini -->
@@ -404,27 +389,27 @@
<value>false</value>
</prop>
</group>
- <group oor:name="GrammarChecking">
- <info>
- <desc>Contains grammar checking relevant settings.</desc>
- </info>
- <prop oor:name="IsAutoCheck" oor:type="xs:boolean">
- <info>
- <author>OS</author>
- <desc>determines if grammar is automatically checked.</desc>
- <label>Automatic grammar checking</label>
- </info>
- <value>false</value>
- </prop>
- <prop oor:name="IsInteractiveCheck" oor:type="xs:boolean">
- <info>
- <author>OS</author>
- <desc>determines if grammar is check in the spelling and grammar dialog.</desc>
- <label>Interactive grammar checking</label>
- </info>
- <value>false</value>
- </prop>
- </group>
+ <group oor:name="GrammarChecking">
+ <info>
+ <desc>Contains grammar checking relevant settings.</desc>
+ </info>
+ <prop oor:name="IsAutoCheck" oor:type="xs:boolean">
+ <info>
+ <author>OS</author>
+ <desc>determines if grammar is automatically checked.</desc>
+ <label>Automatic grammar checking</label>
+ </info>
+ <value>true</value>
+ </prop>
+ <prop oor:name="IsInteractiveCheck" oor:type="xs:boolean">
+ <info>
+ <author>OS</author>
+ <desc>determines if grammar is check in the spelling and grammar dialog.</desc>
+ <label>Interactive grammar checking</label>
+ </info>
+ <value>true</value>
+ </prop>
+ </group>
<group oor:name="Hyphenation">
<info>
<desc>Contains hyphenation relevant settings.</desc>
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index a683245e7bea..1bb78ded543e 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -549,14 +549,12 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
// also add the dialog control itself to the sequence
pObjects[nControlCount] = Reference< XInterface >( rxControl, UNO_QUERY );
- if ( !m_xScriptEventsAttacher.is() )
- m_xScriptEventsAttacher = new DialogEventsAttacherImpl( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess, bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ) );
+ Reference< XScriptEventsAttacher > xScriptEventsAttacher = new DialogEventsAttacherImpl
+ ( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess,
+ bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ) );
- if ( m_xScriptEventsAttacher.is() )
- {
- Any aHelper;
- m_xScriptEventsAttacher->attachEvents( aObjects, Reference< XScriptListener >(), aHelper );
- }
+ Any aHelper;
+ xScriptEventsAttacher->attachEvents( aObjects, Reference< XScriptListener >(), aHelper );
}
}
}
diff --git a/scripting/source/dlgprov/dlgprov.hxx b/scripting/source/dlgprov/dlgprov.hxx
index 521aba8fd8ec..46b629597dab 100644
--- a/scripting/source/dlgprov/dlgprov.hxx
+++ b/scripting/source/dlgprov/dlgprov.hxx
@@ -83,7 +83,6 @@ namespace dlgprov
std::auto_ptr< BasicRTLParams > m_BasicInfo;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
- ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsAttacher > m_xScriptEventsAttacher;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModel( const ::rtl::OUString& sURL );
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index 3785aaf2a121..af4e47dd904d 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -999,7 +999,6 @@
#define SID_ATTR_HYPHENREGION (SID_OPTIONS_START + 12)
#define SID_SPELL_MODIFIED (SID_OPTIONS_START + 15)
#define SID_AUTOSPELL_CHECK (SID_OPTIONS_START + 21)
-#define SID_AUTOSPELL_MARKOFF (SID_OPTIONS_START + 22)
// InetTabPage
#define SID_INET_SMTPGATEWAY (SID_OPTIONS_START + 50)
diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx
index 71ce2b903e7e..3dd4ff3d63a7 100644
--- a/sfx2/inc/sfx2/viewsh.hxx
+++ b/sfx2/inc/sfx2/viewsh.hxx
@@ -298,7 +298,7 @@ public:
GetController();
::cppu::OInterfaceContainerHelper& GetContextMenuInterceptors() const;
- BOOL TryContextMenuInterception( Menu& rIn, Menu*& rpOut, ::com::sun::star::ui::ContextMenuExecuteEvent aEvent );
+ BOOL TryContextMenuInterception( Menu& rIn, const ::rtl::OUString& rMenuIdentifier, Menu*& rpOut, ::com::sun::star::ui::ContextMenuExecuteEvent aEvent );
void SetAdditionalPrintOptions( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& );
diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx
index f4db65038792..f0bb48b54261 100644
--- a/sfx2/source/menu/mnumgr.cxx
+++ b/sfx2/source/menu/mnumgr.cxx
@@ -451,7 +451,8 @@ SfxPopupMenuManager* SfxPopupMenuManager::Popup( const ResId& rResId, SfxViewFra
aEvent.SourceWindow = VCLUnoHelper::GetInterface( pWindow );
aEvent.ExecutePosition.X = rPoint.X();
aEvent.ExecutePosition.Y = rPoint.Y();
- if ( pFrame->GetViewShell()->TryContextMenuInterception( *pSVMenu, pMenu, aEvent ) )
+ ::rtl::OUString sDummyMenuName;
+ if ( pFrame->GetViewShell()->TryContextMenuInterception( *pSVMenu, sDummyMenuName, pMenu, aEvent ) )
{
if ( pMenu )
{
@@ -496,7 +497,8 @@ void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFram
aEvent.SourceWindow = VCLUnoHelper::GetInterface( pWindow );
aEvent.ExecutePosition.X = rPoint.X();
aEvent.ExecutePosition.Y = rPoint.Y();
- if ( pFrame->GetViewShell()->TryContextMenuInterception( *pSVMenu, pMenu, aEvent ) )
+ ::rtl::OUString sDummyMenuName;
+ if ( pFrame->GetViewShell()->TryContextMenuInterception( *pSVMenu, sDummyMenuName, pMenu, aEvent ) )
{
if ( pMenu )
{
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index cff2a78709e7..70bbc4a28d02 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1985,7 +1985,7 @@ void Change( Menu* pMenu, SfxViewShell* pView )
}
-BOOL SfxViewShell::TryContextMenuInterception( Menu& rIn, Menu*& rpOut, ::com::sun::star::ui::ContextMenuExecuteEvent aEvent )
+BOOL SfxViewShell::TryContextMenuInterception( Menu& rIn, const ::rtl::OUString& rMenuIdentifier, Menu*& rpOut, ::com::sun::star::ui::ContextMenuExecuteEvent aEvent )
{
rpOut = NULL;
BOOL bModified = FALSE;
@@ -1994,7 +1994,7 @@ BOOL SfxViewShell::TryContextMenuInterception( Menu& rIn, Menu*& rpOut, ::com::s
// #110897#
// aEvent.ActionTriggerContainer = ::framework::ActionTriggerHelper::CreateActionTriggerContainerFromMenu( &rIn );
aEvent.ActionTriggerContainer = ::framework::ActionTriggerHelper::CreateActionTriggerContainerFromMenu(
- ::comphelper::getProcessServiceFactory(), &rIn );
+ ::comphelper::getProcessServiceFactory(), &rIn, &rMenuIdentifier );
// get selection from controller
aEvent.Selection = ::com::sun::star::uno::Reference < ::com::sun::star::view::XSelectionSupplier > ( GetController(), ::com::sun::star::uno::UNO_QUERY );
diff --git a/svx/inc/editstat.hxx b/svx/inc/editstat.hxx
index ff91b951b021..71f65dbe6657 100644
--- a/svx/inc/editstat.hxx
+++ b/svx/inc/editstat.hxx
@@ -52,7 +52,7 @@
#define EE_CNTRL_URLSFXEXECUTE 0x00008000 // !!!OLD!!!: SFX-URL-Execute.
#define EE_CNTRL_RESTOREFONT 0x00010000 // Font im OutDev restaurieren
#define EE_CNTRL_RTFSTYLESHEETS 0x00020000 // Stylesheets bei Import verwenden
-#define EE_CNTRL_NOREDLINES 0x00040000 // Keine RedLines bei OnlineSpellError
+//#define EE_CNTRL_NOREDLINES 0x00040000 // Keine RedLines bei OnlineSpellError /* removed #i91949 */
#define EE_CNTRL_AUTOCORRECT 0x00080000 // AutoKorrektur
#define EE_CNTRL_AUTOCOMPLETE 0x00100000 // AutoComplete
#define EE_CNTRL_AUTOPAGESIZEX 0x00200000 // Papierbreite an Text anpassen
diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc
index da2d70fa0ef5..c9ae6bb34b70 100644
--- a/svx/inc/helpid.hrc
+++ b/svx/inc/helpid.hrc
@@ -808,7 +808,7 @@
#define HID_COLORPAGE_DBDETAIL_LB (HID_SVX_EXT0_START + 206)
#define HID_NUMBERFORMAT_WND_NUMBER_PREVIEW (HID_SVX_EXT0_START + 207)
-
+#define HID_SPLDLG_BUTTON_IGNORERULE (HID_SVX_EXT0_START + 208)
// please adjust ACT_SVX_HID_END2 below if you add entries here!
// -----------------------------------------------------------------------
@@ -820,7 +820,7 @@
#error Resource-Ueberlauf in #line, #file
#endif
-#define ACT_SVX_HID_END2 HID_NUMBERFORMAT_WND_NUMBER_PREVIEW
+#define ACT_SVX_HID_END2 HID_SPLDLG_BUTTON_IGNORERULE
#if ACT_SVX_HID_END2 > HID_SVX_EXT0_END
#error resource overrun in #line, #file
#endif
diff --git a/svx/inc/svx/SpellDialogChildWindow.hxx b/svx/inc/svx/SpellDialogChildWindow.hxx
index 4703df04b8c5..bf5c4c3c2476 100644
--- a/svx/inc/svx/SpellDialogChildWindow.hxx
+++ b/svx/inc/svx/SpellDialogChildWindow.hxx
@@ -101,15 +101,6 @@ protected:
/** switches grammar checking on/off
*/
virtual void SetGrammarChecking(bool bOn);
- /** This method determines if a vendor dependent Image is to be displayed in any language
- */
- virtual bool HasAnyVendor();
- /** This method returns the name of the vendor of the grammar/spell checker for a specific language
- */
- virtual String GetVendorForLanguage( LanguageType eLanguage);
- /** This method returns the vendor image for the requested language
- */
- virtual Image GetVendorLogoForLanguage( LanguageType eLanguage );
SfxBindings& GetBindings (void) const;
/** Set the spell dialog into the 'resume' state. This method should be called
diff --git a/svx/inc/svx/SpellPortions.hxx b/svx/inc/svx/SpellPortions.hxx
index f531ddd92c7f..97c79998a536 100644
--- a/svx/inc/svx/SpellPortions.hxx
+++ b/svx/inc/svx/SpellPortions.hxx
@@ -34,7 +34,8 @@
#include <i18npool/lang.h>
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/linguistic2/SingleGrammarError.hpp>
+#include <com/sun/star/linguistic2/SingleProofreadingError.hpp>
+#include <com/sun/star/linguistic2/XProofreader.hpp>
#include <vector>
namespace com{ namespace sun{ namespace star{ namespace linguistic2{
@@ -71,15 +72,25 @@ struct SpellPortion
bool bIsGrammarError;
/** contains the grammar error information
*/
- com::sun::star::linguistic2::SingleGrammarError aGrammarError;
+ com::sun::star::linguistic2::SingleProofreadingError aGrammarError;
+ /** provides access to the grammar checker interface
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker;
+ /** marks portion as to-be-ignored. This is a return parameter.
+ */
+ /** contains the proposed dialog title if the proof reading component provides one.
+ */
+ rtl::OUString sDialogTitle;
+ bool bIgnoreThisError;
SpellPortion() :
bIsField(false),
bIsHidden(false),
eLanguage(LANGUAGE_DONTKNOW),
- bIsGrammarError(false)
+ bIsGrammarError(false),
+ bIgnoreThisError(false)
{
- aGrammarError.nErrorStart = aGrammarError.nErrorLength = aGrammarError.nErrorLevel = aGrammarError.nErrorType = 0;
+ aGrammarError.nErrorStart = aGrammarError.nErrorLength = aGrammarError.nErrorType = 0;
}
};
typedef std::vector<SpellPortion> SpellPortions;
diff --git a/svx/inc/svx/editeng.hxx b/svx/inc/svx/editeng.hxx
index 01204bd053a9..6c3955683e5e 100644
--- a/svx/inc/svx/editeng.hxx
+++ b/svx/inc/svx/editeng.hxx
@@ -394,6 +394,8 @@ public:
void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
//spell and return a sentence
bool SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking );
+ // put spell position to start of current sentence
+ void PutSpellingToSentenceStart( EditView& rEditView );
//applies a changed sentence
void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bIsGrammarChecking );
//deinitialize sentence spelling
diff --git a/svx/inc/svx/optlingu.hxx b/svx/inc/svx/optlingu.hxx
index 096256b69d93..6c2a0a7ac528 100644
--- a/svx/inc/svx/optlingu.hxx
+++ b/svx/inc/svx/optlingu.hxx
@@ -52,7 +52,7 @@ namespace beans{
namespace linguistic2{
class XDictionary;
class XDictionaryList;
- class XSpellChecker1;
+ class XSpellChecker;
}}}}
class SvLBoxEntry;
@@ -83,6 +83,7 @@ class SvxEditModulesDlg : public ModalDialog
String sSpell;
String sHyph;
String sThes;
+ String sGrammar;
SvxLinguData_Impl* pDefaultLinguData;
SvxLinguData_Impl& rLinguData;
@@ -130,10 +131,8 @@ private:
String sWordsWithDigits;
String sCapitalization;
String sSpellSpecial;
- String sAllLanguages;
String sSpellAuto;
- String sHideMarkings;
- String sOldGerman;
+ String sGrammarAuto;
String sNumMinWordlen;
String sNumPreBreak;
String sNumPostBreak;
diff --git a/svx/inc/svx/outliner.hxx b/svx/inc/svx/outliner.hxx
index 961070751160..32351252c4f8 100644
--- a/svx/inc/svx/outliner.hxx
+++ b/svx/inc/svx/outliner.hxx
@@ -1031,6 +1031,8 @@ public:
void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
//spell and return a sentence
bool SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking );
+ // put spell position to start of current sentence
+ void PutSpellingToSentenceStart( EditView& rEditView );
//applies a changed sentence
void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bIsGrammarChecking );
void EndSpelling();
diff --git a/svx/inc/svx/splwrap.hxx b/svx/inc/svx/splwrap.hxx
index d29a6db2a206..e9b71d12320f 100644
--- a/svx/inc/svx/splwrap.hxx
+++ b/svx/inc/svx/splwrap.hxx
@@ -40,7 +40,7 @@
// forward ---------------------------------------------------------------
namespace com { namespace sun { namespace star { namespace linguistic2 {
- class XDictionary1;
+ class XDictionary;
class XSpellChecker1;
class XHyphenator;
}}}}
@@ -144,7 +144,7 @@ protected:
virtual void ReplaceAll( const String &rNewText, sal_Int16 nLanguage ); // Wort aus Replace-Liste ersetzen
virtual void StartThesaurus( const String &rWord, sal_uInt16 nLang ); // Thesaurus starten
virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 >
+ ::com::sun::star::linguistic2::XDictionary >
GetAllRightDic() const;
virtual void SpellEnd(); // Bereich abschliessen
virtual void ScrollArea(); // ScrollArea einstellen
diff --git a/svx/inc/svx/svxdlg.hxx b/svx/inc/svx/svxdlg.hxx
index 71dc9fc31617..6a8785823aba 100644
--- a/svx/inc/svx/svxdlg.hxx
+++ b/svx/inc/svx/svxdlg.hxx
@@ -45,7 +45,6 @@ using namespace svx;
namespace com{namespace sun{namespace star{
namespace linguistic2{
class XDictionary;
- class XDictionary1;
class XSpellChecker1;
class XSpellChecker;
}}}}
@@ -227,7 +226,7 @@ public:
class AbstractSvxNewDictionaryDialog :public VclAbstractDialog //add for SvxNewDictionaryDialog
{
public:
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary1 > GetNewDictionary() = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetNewDictionary() = 0;
};
class AbstractSvxNameDialog :public VclAbstractDialog //add for SvxNameDialog
diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc
index 800e14119957..3c5d321487f9 100644
--- a/svx/inc/svx/svxids.hrc
+++ b/svx/inc/svx/svxids.hrc
@@ -1345,7 +1345,8 @@
#define SID_TABLE_STYLE (SID_SVX_START+1088)
#define SID_TABLE_STYLE_SETTINGS (SID_SVX_START+1089)
#define SID_CHAR_DLG_PREVIEW_STRING (SID_SVX_START+1090)
-#define SID_SVX_FIRSTFREE SID_CHAR_DLG_PREVIEW_STRING + 1
+#define SID_RECHECK_DOCUMENT (SID_SVX_START+1091)
+#define SID_SVX_FIRSTFREE SID_RECHECK_DOCUMENT + 1
// --------------------------------------------------------------------------
// Overflow check for slot IDs
diff --git a/svx/inc/unolingu.hxx b/svx/inc/unolingu.hxx
index ba159f394079..d81fe9177587 100644
--- a/svx/inc/unolingu.hxx
+++ b/svx/inc/unolingu.hxx
@@ -42,7 +42,6 @@
#include <com/sun/star/linguistic2/XThesaurus.hpp>
#include <com/sun/star/linguistic2/XDictionaryList.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/linguistic2/XDictionary1.hpp>
#include "svx/svxdllapi.h"
class LinguMgrExitLstnr;
@@ -94,9 +93,9 @@ class SVX_DLLPUBLIC LinguMgr
::com::sun::star::beans::XPropertySet > xProp;
static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > xIgnoreAll;
+ ::com::sun::star::linguistic2::XDictionary > xIgnoreAll;
static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > xChangeAll;
+ ::com::sun::star::linguistic2::XDictionary > xChangeAll;
static LinguMgrExitLstnr *pExitLstnr;
static sal_Bool bExiting;
@@ -112,11 +111,11 @@ class SVX_DLLPUBLIC LinguMgr
static ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > GetProp();
static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > GetStandard();
+ ::com::sun::star::linguistic2::XDictionary > GetStandard();
static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > GetIgnoreAll();
+ ::com::sun::star::linguistic2::XDictionary > GetIgnoreAll();
static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > GetChangeAll();
+ ::com::sun::star::linguistic2::XDictionary > GetChangeAll();
// disallow access to copy-constructor and assignment-operator
LinguMgr(const LinguMgr &);
@@ -139,11 +138,11 @@ public:
::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr();
static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > GetStandardDic();
+ ::com::sun::star::linguistic2::XDictionary > GetStandardDic();
static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > GetIgnoreAllList();
+ ::com::sun::star::linguistic2::XDictionary > GetIgnoreAllList();
static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > GetChangeAllList();
+ ::com::sun::star::linguistic2::XDictionary > GetChangeAllList();
// update all configuration entries
static void UpdateAll();
@@ -212,13 +211,13 @@ SVX_DLLPUBLIC ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > SvxGetLinguPropertySet();
//TL:TODO: remove argument or provide SvxGetIgnoreAllList with the same one
SVX_DLLPUBLIC ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > SvxGetOrCreatePosDic(
+ ::com::sun::star::linguistic2::XDictionary > SvxGetOrCreatePosDic(
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XDictionaryList > xDicList );
SVX_DLLPUBLIC ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > SvxGetIgnoreAllList();
+ ::com::sun::star::linguistic2::XDictionary > SvxGetIgnoreAllList();
SVX_DLLPUBLIC ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > SvxGetChangeAllList();
+ ::com::sun::star::linguistic2::XDictionary > SvxGetChangeAllList();
///////////////////////////////////////////////////////////////////////////
// misc functions
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 4b6947697c3c..30bae65cc655 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -5691,33 +5691,6 @@ SfxVoidItem HideDetail SID_OUTLINE_HIDE
]
//--------------------------------------------------------------------------
-SfxBoolItem HideSpellMark SID_AUTOSPELL_MARKOFF
-
-[
- /* flags: */
- AutoUpdate = TRUE,
- Cachable = Cachable,
- FastCall = FALSE,
- HasCoreId = FALSE,
- HasDialog = FALSE,
- ReadOnlyDoc = TRUE,
- Toggle = TRUE,
- Container = FALSE,
- RecordAbsolute = FALSE,
- RecordPerSet;
- Synchron;
-
- Readonly = FALSE,
-
- /* config: */
- AccelConfig = TRUE,
- MenuConfig = TRUE,
- StatusBarConfig = FALSE,
- ToolBoxConfig = TRUE,
- GroupId = GID_VIEW;
-]
-
-//--------------------------------------------------------------------------
SfxBoolItem HScrollbar SID_INSERT_HSCROLLBAR
[
@@ -14884,4 +14857,30 @@ SfxVoidItem Shrink SID_SHRINK_FONT_SIZE
StatusBarConfig = FALSE,
ToolBoxConfig = TRUE,
GroupId = GID_FORMAT;
-] \ No newline at end of file
+]
+//--------------------------------------------------------------------------
+
+SfxVoidItem RecheckDocument SID_RECHECK_DOCUMENT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
diff --git a/svx/source/dialog/SpellAttrib.hxx b/svx/source/dialog/SpellAttrib.hxx
index f946c4c6b6c9..ac2bb278c594 100644
--- a/svx/source/dialog/SpellAttrib.hxx
+++ b/svx/source/dialog/SpellAttrib.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/linguistic2/XProofreader.hpp>
#include <tools/color.hxx>
//namespace com{ namespace sun{ namespace star{ namespace linguistic2{
// class XSpellAlternatives;
@@ -49,24 +50,39 @@ struct SpellErrorDescription
{
bool bIsGrammarError;
::rtl::OUString sErrorText;
+ ::rtl::OUString sDialogTitle;
::rtl::OUString sExplanation;
::com::sun::star::lang::Locale aLocale;
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker;
+ ::rtl::OUString sServiceName; //service name of GrammarChecker/SpellChecker
::com::sun::star::uno::Sequence< ::rtl::OUString > aSuggestions;
+ ::rtl::OUString sRuleId;
SpellErrorDescription() :
- bIsGrammarError( false ){};
+ bIsGrammarError( false ){}
+
SpellErrorDescription( bool bGrammar,
const ::rtl::OUString& rText,
const ::com::sun::star::lang::Locale& rLocale,
const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rSuggestions,
- const ::rtl::OUString* pExplanation = 0) :
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > rxGrammarChecker,
+ const ::rtl::OUString& rServiceName,
+ const ::rtl::OUString* pDialogTitle = 0,
+ const ::rtl::OUString* pExplanation = 0,
+ const ::rtl::OUString* pRuleId = 0 ) :
bIsGrammarError( bGrammar ),
sErrorText( rText ),
aLocale( rLocale ),
+ xGrammarChecker( rxGrammarChecker ),
+ sServiceName( rServiceName ),
aSuggestions( rSuggestions )
{
+ if( pDialogTitle )
+ sDialogTitle = *pDialogTitle;
if( pExplanation )
sExplanation = *pExplanation;
+ if( pRuleId )
+ sRuleId = *pRuleId;
};
int operator==( const SpellErrorDescription& rDesc ) const
@@ -77,7 +93,10 @@ struct SpellErrorDescription
aLocale.Country.equals( rDesc.aLocale.Country ) &&
aLocale.Variant.equals( rDesc.aLocale.Variant ) &&
aSuggestions == rDesc.aSuggestions &&
- sExplanation.equals( rDesc.sExplanation );
+ xGrammarChecker == rDesc.xGrammarChecker &&
+ sDialogTitle.equals( rDesc.sDialogTitle ) &&
+ sExplanation.equals( rDesc.sExplanation ) &&
+ sRuleId == rDesc.sRuleId;
}
};
/* -----------------10.09.2003 14:23-----------------
diff --git a/svx/source/dialog/SpellDialog.cxx b/svx/source/dialog/SpellDialog.cxx
index ae564f368319..a68e5360a6a4 100644
--- a/svx/source/dialog/SpellDialog.cxx
+++ b/svx/source/dialog/SpellDialog.cxx
@@ -49,7 +49,9 @@
#include <sfx2/dispatch.hxx>
#include <sfx2/bindings.hxx>
#include <svtools/undo.hxx>
+#include <svtools/lingucfg.hxx>
#include <svtools/textdata.hxx>
+#include <svtools/filter.hxx>
#include <unolingu.hxx>
#include <svx/splwrap.hxx>
#include <linguistic/lngprops.hxx>
@@ -58,12 +60,15 @@
#endif
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XServiceDisplayName.hpp>
#include <com/sun/star/linguistic2/SpellFailure.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <sfx2/app.hxx>
#include <vcl/help.hxx>
-
-
+#include <vcl/graph.hxx>
+#include <osl/file.hxx>
+#include <impgrf.hxx>
#include <svx/dialogs.hrc>
#include <helpid.hrc>
#include "SpellDialog.hrc"
@@ -94,6 +99,8 @@ struct SpellDialog_Impl
Sequence< Reference< XDictionary > > aDics;
};
// -----------------------------------------------------------------------
+//#define VENDOR_IMAGE_HEIGHT 44 //as specified
+
#define SPELLUNDO_CHANGE_LANGUAGE (TEXTUNDO_USER + 1)
#define SPELLUNDO_CHANGE_TEXTENGINE (TEXTUNDO_USER + 2)
#define SPELLUNDO_CHANGE_NEXTERROR (TEXTUNDO_USER + 3)
@@ -101,6 +108,7 @@ struct SpellDialog_Impl
#define SPELLUNDO_CHANGE_GROUP (TEXTUNDO_USER + 5) //undo list
#define SPELLUNDO_MOVE_ERROREND (TEXTUNDO_USER + 6)
#define SPELLUNDO_UNDO_EDIT_MODE (TEXTUNDO_USER + 7)
+#define SPELLUNDO_ADD_IGNORE_RULE (TEXTUNDO_USER + 8)
namespace svx{
class SpellUndoAction_Impl : public SfxUndoAction
@@ -116,6 +124,7 @@ class SpellUndoAction_Impl : public SfxUndoAction
long m_nOldErrorStart;
long m_nOldErrorEnd;
bool m_bIsErrorLanguageSelected;
+ ::rtl::OUString m_sRuleId;
//undo of AddToDictionary
Reference<XDictionary> m_xDictionary;
::rtl::OUString m_sAddedWord;
@@ -134,7 +143,7 @@ public:
m_nOldErrorEnd(-1),
m_bIsErrorLanguageSelected(false),
m_nOffset(0)
- {}
+ {}
~SpellUndoAction_Impl();
@@ -171,6 +180,9 @@ public:
void SetOffset(long nSet) {m_nOffset = nSet;}
long GetOffset() const {return m_nOffset;}
+ void SetErrorType( const ::rtl::OUString& rId ) { m_sRuleId = rId; }
+ const ::rtl::OUString& GetErrorType() const { return m_sRuleId; }
+
};
}//namespace svx
using namespace ::svx;
@@ -216,6 +228,7 @@ SpellDialog::SpellDialog(
aIgnorePB ( this, SVX_RES( PB_IGNORE ) ),
aIgnoreAllPB ( this, SVX_RES( PB_IGNOREALL ) ),
+ aIgnoreRulePB ( this, SVX_RES( PB_IGNORERULE ) ),
aAddToDictMB ( this, SVX_RES( MB_ADDTODICT ) ),
aChangePB ( this, SVX_RES( PB_CHANGE ) ),
@@ -242,7 +255,7 @@ SpellDialog::SpellDialog(
m_sTitleSpellingGrammarVendor ( SVX_RES( ST_SPELLING_AND_GRAMMAR_VENDORNAME ) ),
aDialogUndoLink( LINK (this, SpellDialog, DialogUndoHdl)),
bModified( false ),
- bFocusLocked( false ),
+ bFocusLocked( true ),
rParent ( *pChildWindow ),
nOldLang ( LANGUAGE_NONE )
{
@@ -255,6 +268,7 @@ SpellDialog::SpellDialog(
aClosePB. SetHelpId(HID_SPLDLG_BUTTON_CLOSE );
aIgnorePB. SetHelpId(HID_SPLDLG_BUTTON_IGNORE );
aIgnoreAllPB. SetHelpId(HID_SPLDLG_BUTTON_IGNOREALL);
+ aIgnoreRulePB. SetHelpId(HID_SPLDLG_BUTTON_IGNORERULE);
aChangePB. SetHelpId(HID_SPLDLG_BUTTON_CHANGE );
aChangeAllPB. SetHelpId(HID_SPLDLG_BUTTON_CHANGEALL);
aExplainPB. SetHelpId(HID_SPLDLG_BUTTON_EXPLAIN );
@@ -293,6 +307,7 @@ void SpellDialog::Init_Impl()
aChangeAllPB.SetClickHdl(LINK( this, SpellDialog, ChangeAllHdl ) );
aIgnorePB.SetClickHdl(LINK( this, SpellDialog, IgnoreHdl ) );
aIgnoreAllPB.SetClickHdl(LINK( this, SpellDialog, IgnoreAllHdl ) );
+ aIgnoreRulePB.SetClickHdl(LINK( this, SpellDialog, IgnoreAllHdl ) );
aUndoPB.SetClickHdl(LINK( this, SpellDialog, UndoHdl ) );
aAutoCorrPB.SetClickHdl( LINK( this, SpellDialog, ExtClickHdl ) );
@@ -331,7 +346,6 @@ void SpellDialog::UpdateBoxes_Impl()
//String aAltWord;
Sequence< ::rtl::OUString > aNewWords;
bool bIsGrammarError = false;
- ::rtl::OUString sExplanation;
if( pSpellErrorDescription )
{
nAltLanguage = SvxLocaleToLanguage( pSpellErrorDescription->aLocale );
@@ -340,8 +354,15 @@ void SpellDialog::UpdateBoxes_Impl()
bIsGrammarError = pSpellErrorDescription->bIsGrammarError;
aExplainPB.SetExplanation(pSpellErrorDescription->sExplanation );
}
-
- SetTitle_Impl( nAltLanguage );
+ if( pSpellErrorDescription && pSpellErrorDescription->sDialogTitle.getLength() )
+ {
+ // use this function to apply the correct image to be used...
+ SetTitle_Impl( nAltLanguage );
+ // then change the title to the one to be actually used
+ SetText( pSpellErrorDescription->sDialogTitle );
+ }
+ else
+ SetTitle_Impl( nAltLanguage );
SetSelectedLang_Impl( nAltLanguage );
@@ -370,7 +391,11 @@ void SpellDialog::UpdateBoxes_Impl()
bool bShowChangeAll = !bIsGrammarError;
aChangeAllPB.Show( bShowChangeAll );
aExplainPB.Show( !bShowChangeAll );
- //aExplainPB.SetExplanation( sExplanation );
+ aLanguageLB.Enable( bShowChangeAll );
+ aIgnoreAllPB.Show( bShowChangeAll );
+ aAddToDictMB.Show( bShowChangeAll );
+ aIgnoreRulePB.Show( !bShowChangeAll );
+ aIgnoreRulePB.Enable(pSpellErrorDescription && pSpellErrorDescription->sRuleId.getLength());
aExplainPB.Enable( aExplainPB.HasExplanation() );
aAutoCorrPB.Show( bShowChangeAll && rParent.HasAutoCorrection() );
@@ -382,8 +407,9 @@ void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence)
//initially or after the last error of a sentence MarkNextError will fail
//then GetNextSentence() has to be called followed again by MarkNextError()
//MarkNextError is not initally called if the UndoEdit mode is active
+ bool bNextSentence = false;
if((!aSentenceED.IsUndoEditMode() && aSentenceED.MarkNextError()) ||
- GetNextSentence_Impl(bUseSavedSentence) && aSentenceED.MarkNextError())
+ true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence) && aSentenceED.MarkNextError()))
{
const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
if( pSpellErrorDescription )
@@ -394,7 +420,6 @@ void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence)
&aNotInDictFT,
&aSentenceED,
&aLanguageFT,
- &aLanguageLB,
0
};
sal_Int32 nIdx = 0;
@@ -406,6 +431,12 @@ void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence)
}
+ if( bNextSentence )
+ {
+ //remove undo if a new sentence is active
+ aSentenceED.ResetUndo();
+ aUndoPB.Enable(FALSE);
+ }
}
}
/* -----------------10.09.2003 14:04-----------------
@@ -455,12 +486,21 @@ IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG )
}
else
{
- if( pThis->rParent.HasAnyVendor() )
+ if( SvtLinguConfig().HasAnyVendorImages() )
{
pThis->aVendorImageFI.Show();
- bool bHighContrast = pThis->GetDisplayBackground().GetColor().IsDark() != 0;
- pThis->aVendorImageFI.SetImage( bHighContrast ? pThis->aVendorImageHC : pThis->aVendorImage );
- sal_Int32 nDiff = pThis->aVendorImageFI.GetSizePixel().Height();
+ Size aVendorSize = pThis->aVendorImageFI.GetSizePixel();
+ Size aImageSize = pThis->aVendorImageFI.GetImage().GetSizePixel();
+ if( aImageSize.Height() )
+ {
+ aVendorSize.Height() = aImageSize.Height();
+ if(aVendorSize.Width() < aImageSize.Width())
+ aVendorSize.Width() = aImageSize.Width();
+ pThis->aVendorImageFI.SetSizePixel( aVendorSize );
+ }
+ //aVendorSize.Height() = nDiff;
+ sal_Int32 nDiff = aVendorSize.Height();
+ pThis->aVendorImageFI.SetSizePixel(aVendorSize);
Control* aControls[] = {
&pThis->aLanguageFT,
&pThis->aLanguageLB,
@@ -470,6 +510,7 @@ IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG )
&pThis->aSuggestionLB,
&pThis->aIgnorePB,
&pThis->aIgnoreAllPB,
+ &pThis->aIgnoreRulePB,
&pThis->aAddToDictMB,
&pThis->aChangePB,
&pThis->aChangeAllPB,
@@ -494,11 +535,12 @@ IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG )
Size aDlgSize = pThis->GetSizePixel();
aDlgSize.Height() += nDiff;
pThis->SetSizePixel( aDlgSize );
+ pThis->Invalidate();
}
}
pThis->aCheckGrammarCB.Check( pThis->rParent.IsGrammarChecking() );
pThis->SetUpdateMode( sal_True );
-
+ pThis->Show();
return 0;
};
@@ -551,7 +593,6 @@ void SpellDialog::StartSpellOptDlg_Impl()
SID_ATTR_SPELL,SID_ATTR_SPELL,
SID_SPELL_MODIFIED, SID_SPELL_MODIFIED,
SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
- SID_AUTOSPELL_MARKOFF, SID_AUTOSPELL_MARKOFF,
0
};
SfxItemSet aSet( SFX_APP()->GetPool(), aSpellInfos);
@@ -645,24 +686,42 @@ IMPL_LINK( SpellDialog, ChangeAllHdl, Button *, EMPTYARG )
}
// -----------------------------------------------------------------------
-IMPL_LINK( SpellDialog, IgnoreAllHdl, Button *, EMPTYARG )
+IMPL_LINK( SpellDialog, IgnoreAllHdl, Button *, pButton )
{
aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP );
// add word to IgnoreAll list
Reference< XDictionary > aXDictionary( SvxGetIgnoreAllList(), UNO_QUERY );
//in case the error has been changed manually it has to be restored
aSentenceED.RestoreCurrentError();
- String sErrorText(aSentenceED.GetErrorText());
- sal_uInt8 nAdded = linguistic::AddEntryToDic( aXDictionary,
- sErrorText, sal_False,
- ::rtl::OUString(), LANGUAGE_NONE );
- if(nAdded == DIC_ERR_NONE)
+ if( pButton == &aIgnoreRulePB )
{
- SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
- SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink);
- pAction->SetDictionary(aXDictionary);
- pAction->SetAddedWord(sErrorText);
- aSentenceED.AddUndoAction(pAction);
+ const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ try
+ {
+ if( pSpellErrorDescription && pSpellErrorDescription->xGrammarChecker.is() )
+ {
+ pSpellErrorDescription->xGrammarChecker->ignoreRule( pSpellErrorDescription->sRuleId,
+ pSpellErrorDescription->aLocale );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ }
+ }
+ else
+ {
+ String sErrorText(aSentenceED.GetErrorText());
+ sal_uInt8 nAdded = linguistic::AddEntryToDic( aXDictionary,
+ sErrorText, sal_False,
+ ::rtl::OUString(), LANGUAGE_NONE );
+ if(nAdded == DIC_ERR_NONE)
+ {
+ SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
+ SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink);
+ pAction->SetDictionary(aXDictionary);
+ pAction->SetAddedWord(sErrorText);
+ aSentenceED.AddUndoAction(pAction);
+ }
}
SpellContinue_Impl();
@@ -722,6 +781,9 @@ IMPL_LINK( SpellDialog, DialogUndoHdl, SpellUndoAction_Impl*, pAction )
SpellContinue_Impl(true);
}
break;
+ case SPELLUNDO_ADD_IGNORE_RULE:
+ //undo of ignored rules is not supported
+ break;
}
return 0;
@@ -748,6 +810,7 @@ IMPL_LINK( SpellDialog, IgnoreHdl, Button *, EMPTYARG )
{
//in case the error has been changed manually it has to be restored
aSentenceED.RestoreCurrentError();
+ rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true));
// the word is being ignored
SpellContinue_Impl();
bModified = false;
@@ -790,8 +853,16 @@ IMPL_LINK(SpellDialog, LanguageSelectHdl, SvxLanguageBox*, pBox)
aSuggestionLB.Clear();
if(sError.Len())
{
- aSentenceED.SetAlternatives(xSpell->spell( sError, pBox->GetSelectLanguage(),
- Sequence< PropertyValue >() ));
+ LanguageType eLanguage = pBox->GetSelectLanguage();
+ Reference <XSpellAlternatives> xAlt = xSpell->spell( sError, eLanguage,
+ Sequence< PropertyValue >() );
+ if( xAlt.is() )
+ aSentenceED.SetAlternatives( xAlt );
+ else
+ {
+ aSentenceED.ChangeMarkedWord( sError, eLanguage );
+ SpellContinue_Impl();
+ }
aSentenceED.AddUndoAction(new SpellUndoAction_Impl(SPELLUNDO_CHANGE_LANGUAGE, aDialogUndoLink));
}
@@ -817,22 +888,50 @@ void SpellDialog::SetLanguage( sal_uInt16 nLang )
/*-- 16.06.2008 11:27:02---------------------------------------------------
-----------------------------------------------------------------------*/
+static Image lcl_GetImageFromPngUrl( const ::rtl::OUString &rFileUrl )
+{
+ Image aRes;
+ ::rtl::OUString aTmp;
+ osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp );
+ Graphic aGraphic;
+ const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) );
+ if( GRFILTER_OK == LoadGraphic( aTmp, aFilterName, aGraphic ) )
+ {
+ aRes = Image( aGraphic.GetBitmapEx() );
+ }
+ return aRes;
+}
void SpellDialog::SetTitle_Impl(LanguageType nLang)
{
String sTitle( m_sTitleSpelling );
if( rParent.HasGrammarChecking() )
{
- String sVendor = rParent.GetVendorForLanguage( nLang );
+ String sVendor;
+ const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives();
+ if( pSpellErrorDescription && pSpellErrorDescription->sServiceName.getLength() )
+ {
+ bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
+ ::rtl::OUString sSuggestionImageUrl =
+ SvtLinguConfig().GetSpellAndGrammarDialogImage( pSpellErrorDescription->sServiceName, bHighContrast );
+ aVendorImageFI.SetImage( lcl_GetImageFromPngUrl( sSuggestionImageUrl ) );
+ uno::Reference< lang::XServiceDisplayName > xDisplayName( pSpellErrorDescription->xGrammarChecker, uno::UNO_QUERY );
+ if( xDisplayName.is() )
+ sVendor = xDisplayName->getServiceDisplayName( pSpellErrorDescription->aLocale );
+ }
+ else
+ {
+ bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
+ aVendorImageFI.SetImage( bHighContrast ? aVendorImageHC : aVendorImage );
+ }
+
if( sVendor.Len() )
{
sTitle = m_sTitleSpellingGrammarVendor;
sTitle.SearchAndReplaceAscii( "$VendorName", sVendor );
- aVendorImageFI.SetImage( rParent.GetVendorLogoForLanguage( nLang ) );
}
else
{
- bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
- aVendorImageFI.SetImage( bHighContrast ? aVendorImageHC : aVendorImage );
+ //bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
sTitle = m_sTitleSpellingGrammar;
}
}
@@ -855,7 +954,7 @@ void SpellDialog::InitUserDicts()
// add active, positive dictionary to dic-list (if not already done).
// This is to ensure that there is at least on dictionary to which
// words could be added.
- Reference< XDictionary1 > xDic( SvxGetOrCreatePosDic( xDicList ) );
+ Reference< XDictionary > xDic( SvxGetOrCreatePosDic( xDicList ) );
if (xDic.is())
xDic->setActive( sal_True );
@@ -870,7 +969,7 @@ void SpellDialog::InitUserDicts()
PopupMenu* pMenu = new PopupMenu;
for (i = 0; i < nSize; ++i )
{
- Reference< XDictionary1 > xDic( pDic[i], UNO_QUERY );
+ Reference< XDictionary > xDic( pDic[i], UNO_QUERY );
if (!xDic.is() || SvxGetIgnoreAllList() == xDic)
continue;
@@ -881,7 +980,7 @@ void SpellDialog::InitUserDicts()
{
sal_Bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
pMenu->InsertItem( (USHORT)i + 1, ::GetDicInfoStr( xDic->getName(),
- xDic->getLanguage(), bNegativ ) );
+ SvxLocaleToLanguage( xDic->getLocale() ), bNegativ ) );
}
}
aAddToDictMB.SetPopupMenu(pMenu);
@@ -989,7 +1088,7 @@ IMPL_LINK(SpellDialog, CancelHdl, Button *, EMPTYARG )
//apply changes first - if there are any
if(aSentenceED.IsModified())
{
- rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions());
+ rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false));
}
Close();
return 0;
@@ -1038,6 +1137,8 @@ long SpellDialog::Notify( NotifyEvent& rNEvt )
--------------------------------------------------*/
void SpellDialog::InvalidateDialog()
{
+ if( bFocusLocked )
+ return;
aIgnorePB.SetText(aResumeST);
Window* aDisableArr[] =
{
@@ -1048,6 +1149,7 @@ void SpellDialog::InvalidateDialog()
&aLanguageFT,
&aLanguageLB,
&aIgnoreAllPB,
+ &aIgnoreRulePB,
&aAddToDictMB,
&aChangePB,
&aChangeAllPB,
@@ -1072,7 +1174,7 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence)
bool bRet = false;
if(!bUseSavedSentence && aSentenceED.IsModified())
{
- rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions());
+ rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(false));
}
aSentenceED.ResetModified();
SpellPortions aSentence = bUseSavedSentence ? m_aSavedSentence : rParent.GetNextWrongSentence();
@@ -1117,17 +1219,26 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence)
nEndPosition += aStart->sText.getLength();
if(aStart->xAlternatives.is())
{
+ uno::Reference< container::XNamed > xNamed( aStart->xAlternatives, uno::UNO_QUERY );
+ ::rtl::OUString sServiceName;
+ if( xNamed.is() )
+ sServiceName = xNamed->getName();
SpellErrorDescription aDesc( false, aStart->xAlternatives->getWord(),
- aStart->xAlternatives->getLocale(), aStart->xAlternatives->getAlternatives());
+ aStart->xAlternatives->getLocale(), aStart->xAlternatives->getAlternatives(), 0, sServiceName);
aSentenceED.SetAttrib( SpellErrorAttrib(aDesc), 0, (USHORT) nStartPosition, (USHORT) nEndPosition );
}
else if(aStart->bIsGrammarError )
{
+ uno::Reference< lang::XServiceInfo > xInfo( aStart->xGrammarChecker, uno::UNO_QUERY );
SpellErrorDescription aDesc( true,
aStart->sText,
- aStart->aGrammarError.aNewLocale,
+ SvxCreateLocale( aStart->eLanguage ),
aStart->aGrammarError.aSuggestions,
- &aStart->aGrammarError.aFullComment );
+ aStart->xGrammarChecker,
+ xInfo->getImplementationName(),
+ &aStart->sDialogTitle,
+ &aStart->aGrammarError.aFullComment,
+ &aStart->aGrammarError.aRuleIdentifier );
aSentenceED.SetAttrib( SpellErrorAttrib(aDesc), 0, (USHORT) nStartPosition, (USHORT) nEndPosition );
}
if(aStart->bIsField)
@@ -1173,6 +1284,8 @@ bool SpellDialog::ApplyChangeAllList_Impl(SpellPortions& rSentence, bool &bHasRe
else
bRet = true;
}
+ else if( aStart->bIsGrammarError )
+ bRet = true;
aStart++;
}
return bRet;
@@ -1746,13 +1859,17 @@ void SentenceEditWindow_Impl::SetAlternatives( Reference< XSpellAlternatives> xA
::rtl::OUString aWord;
lang::Locale aLocale;
uno::Sequence< ::rtl::OUString > aAlts;
+ ::rtl::OUString sServiceName;
if (xAlt.is())
{
aWord = xAlt->getWord();
aLocale = xAlt->getLocale();
aAlts = xAlt->getAlternatives();
+ uno::Reference< container::XNamed > xNamed( xAlt, uno::UNO_QUERY );
+ if (xNamed.is())
+ sServiceName = xNamed->getName();
}
- SpellErrorDescription aDesc( false, aWord, aLocale, aAlts, 0);
+ SpellErrorDescription aDesc( false, aWord, aLocale, aAlts, 0, sServiceName);
GetTextEngine()->SetAttrib( SpellErrorAttrib(aDesc), 0, m_nErrorStart, m_nErrorEnd );
}
@@ -1815,7 +1932,7 @@ void lcl_InsertBreakPosition_Impl(
Returns the text in spell portions. Each portion contains text with an
equal language and attribute. The spell alternatives are empty.
-----------------------------------------------------------------------*/
-svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const
+svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions( bool bSetIgnoreFlag ) const
{
svx::SpellPortions aRet;
ExtTextEngine* pTextEngine = GetTextEngine();
@@ -1875,7 +1992,10 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const
aPortion1.eLanguage = eLang;
aPortion1.sText = pTextEngine->GetText(
TextSelection(TextPaM(0, nStart), TextPaM(0, aStart->nPosition)));
-
+ if( bSetIgnoreFlag && m_nErrorStart == nStart )
+ {
+ aPortion1.bIgnoreThisError = true;
+ }
aRet.push_back(aPortion1);
nStart = aStart->nPosition;
eLang = aStart->eLanguage;
@@ -1994,6 +2114,7 @@ void SentenceEditWindow_Impl::SetUndoEditMode(bool bSet)
&pSpellDialog->aChangeAllPB,
&pSpellDialog->aExplainPB,
&pSpellDialog->aIgnoreAllPB,
+ &pSpellDialog->aIgnoreRulePB,
&pSpellDialog->aIgnorePB,
&pSpellDialog->aSuggestionLB,
&pSpellDialog->aSuggestionFT,
diff --git a/svx/source/dialog/SpellDialog.hrc b/svx/source/dialog/SpellDialog.hrc
index f5bc964dcea1..f571525a25db 100644
--- a/svx/source/dialog/SpellDialog.hrc
+++ b/svx/source/dialog/SpellDialog.hrc
@@ -55,3 +55,4 @@
#define IMG_VENDOR 56
#define IMG_DEFAULT_VENDOR 57
#define IMG_DEFAULT_VENDOR_HC 58
+#define PB_IGNORERULE 59
diff --git a/svx/source/dialog/SpellDialog.src b/svx/source/dialog/SpellDialog.src
index b96ea8c18317..2545d7ec9627 100644
--- a/svx/source/dialog/SpellDialog.src
+++ b/svx/source/dialog/SpellDialog.src
@@ -44,6 +44,7 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
OutputSize = TRUE;
Closeable = TRUE ;
SVLook = TRUE;
+ Hide = TRUE;
Text [ en-US ] = "Spellcheck: " ;
Moveable = TRUE ;
@@ -59,7 +60,8 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
{
Pos = MAP_APPFONT( 6, 8 );
Size = MAP_APPFONT( 100, 8 );
- Text [ en-US ] = "Dictionary languag~e" ;
+ Text [ en-US ] = "Text languag~e" ;
+ Text [ de ] = "Text~sprache" ;
};
ListBox LB_LANGUAGE
{
@@ -119,6 +121,14 @@ ModelessDialog RID_SVXDLG_SPELLCHECK
Size = MAP_APPFONT( 55, 14 );
Text [ en-US ] = "I~gnore All" ;
};
+ PushButton PB_IGNORERULE
+ {
+ Pos = MAP_APPFONT( 209, 54 );
+ Size = MAP_APPFONT( 55, 14 );
+ Text [ en-US ] = "I~gnore Rule" ;
+ Text [ de ] = "Regel i~gnorieren";
+ Hide = TRUE;
+ };
MenuButton MB_ADDTODICT
{
Pos = MAP_APPFONT( 209, 71 );
diff --git a/svx/source/dialog/SpellDialogChildWindow.cxx b/svx/source/dialog/SpellDialogChildWindow.cxx
index b7a851215ee8..fa98eee5852a 100644
--- a/svx/source/dialog/SpellDialogChildWindow.cxx
+++ b/svx/source/dialog/SpellDialogChildWindow.cxx
@@ -119,26 +119,4 @@ void SpellDialogChildWindow::SetGrammarChecking(bool )
{
DBG_ERROR("Grammar checking should have been overloaded - if available");
}
-/*-- 16.06.2008 10:12:22---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-bool SpellDialogChildWindow::HasAnyVendor()
-{
- return false;
-}
-/*-- 16.06.2008 11:34:35---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-String SpellDialogChildWindow::GetVendorForLanguage( LanguageType )
-{
- return String();
-}
-/*-- 19.06.2008 15:55:08---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-Image SpellDialogChildWindow::GetVendorLogoForLanguage( LanguageType )
-{
- return Image();
-}
-
} // end of namespace ::svx
diff --git a/svx/source/dialog/dlgfact.cxx b/svx/source/dialog/dlgfact.cxx
index df686534326b..a3fd66ff04fe 100644
--- a/svx/source/dialog/dlgfact.cxx
+++ b/svx/source/dialog/dlgfact.cxx
@@ -776,7 +776,7 @@ long AbstractFmInputRecordNoDialog_Impl::GetValue() const
//for SvxNewDictionaryDialog begin
::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > AbstractSvxNewDictionaryDialog_Impl::GetNewDictionary()
+ ::com::sun::star::linguistic2::XDictionary > AbstractSvxNewDictionaryDialog_Impl::GetNewDictionary()
{
return pDlg->GetNewDictionary();
}
diff --git a/svx/source/dialog/dlgfact.hxx b/svx/source/dialog/dlgfact.hxx
index d95750431f84..afe55c740c69 100644
--- a/svx/source/dialog/dlgfact.hxx
+++ b/svx/source/dialog/dlgfact.hxx
@@ -405,7 +405,7 @@ class SvxNewDictionaryDialog;
class AbstractSvxNewDictionaryDialog_Impl :public AbstractSvxNewDictionaryDialog
{
DECL_ABSTDLG_BASE(AbstractSvxNewDictionaryDialog_Impl,SvxNewDictionaryDialog)
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary1 > GetNewDictionary();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetNewDictionary();
};
//for SvxNewDictionaryDialog end
diff --git a/svx/source/dialog/optdict.cxx b/svx/source/dialog/optdict.cxx
index d7dd07b6e78f..88674c141b36 100644
--- a/svx/source/dialog/optdict.cxx
+++ b/svx/source/dialog/optdict.cxx
@@ -181,7 +181,7 @@ IMPL_LINK( SvxNewDictionaryDialog, OKHdl_Impl, Button *, EMPTYARG )
{
lang::Locale aLocale( SvxCreateLocale(nLang) );
String aURL( linguistic::GetWritableDictionaryURL( sDict ) );
- xNewDic = Reference< XDictionary1 > (
+ xNewDic = Reference< XDictionary > (
xDicList->createDictionary( sDict, aLocale, eType, aURL ) , UNO_QUERY );
}
DBG_ASSERT(xNewDic.is(), "NULL pointer");
@@ -297,13 +297,13 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(
String aLookUpEntry;
for ( sal_Int32 i = 0; i < nCount; ++i )
{
- Reference< XDictionary1 > xDic( pDic[i], UNO_QUERY );
+ Reference< XDictionary > xDic( pDic[i], UNO_QUERY );
if (xDic.is())
{
sal_Bool bNegative = xDic->getDictionaryType() == DictionaryType_NEGATIVE ?
sal_True : sal_False;
String aDicName( xDic->getName() );
- const String aTxt( ::GetDicInfoStr( aDicName, xDic->getLanguage(),
+ const String aTxt( ::GetDicInfoStr( aDicName, SvxLocaleToLanguage( xDic->getLocale() ),
bNegative ) );
aAllDictsLB.InsertEntry( aTxt );
@@ -327,11 +327,11 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(
nPos = 0;
aAllDictsLB.SelectEntryPos( nPos );
}
- Reference< XDictionary1 > xDic;
+ Reference< XDictionary > xDic;
if (nPos != LISTBOX_ENTRY_NOTFOUND)
- xDic = Reference< XDictionary1 > ( aDics.getConstArray()[ nPos ], UNO_QUERY );
+ xDic = Reference< XDictionary > ( aDics.getConstArray()[ nPos ], UNO_QUERY );
if (xDic.is())
- SetLanguage_Impl( xDic->getLanguage() );
+ SetLanguage_Impl( SvxLocaleToLanguage( xDic->getLocale() ) );
// check if dictionary is read-only
SetDicReadonly_Impl(xDic);
@@ -372,7 +372,7 @@ void SvxEditDictionaryDialog::Paint( const Rectangle& rRect )
// -----------------------------------------------------------------------
void SvxEditDictionaryDialog::SetDicReadonly_Impl(
- Reference< XDictionary1 > &xDic )
+ Reference< XDictionary > &xDic )
{
// enable or disable new and delete button according to file attributes
bDicIsReadonly = sal_True;
@@ -448,9 +448,9 @@ IMPL_LINK( SvxEditDictionaryDialog, SelectBookHdl_Impl, ListBox *, EMPTYARG )
// Dictionary anzeigen
ShowWords_Impl( nPos );
// enable or disable new and delete button according to file attributes
- Reference< XDictionary1 > xDic( aDics.getConstArray()[ nPos ], UNO_QUERY );
+ Reference< XDictionary > xDic( aDics.getConstArray()[ nPos ], UNO_QUERY );
if (xDic.is())
- SetLanguage_Impl( xDic->getLanguage() );
+ SetLanguage_Impl( SvxLocaleToLanguage( xDic->getLocale() ) );
SetDicReadonly_Impl(xDic);
sal_Bool bEnable = !IsDicReadonly_Impl();
@@ -466,8 +466,8 @@ IMPL_LINK( SvxEditDictionaryDialog, SelectLangHdl_Impl, ListBox *, EMPTYARG )
{
sal_uInt16 nDicPos = aAllDictsLB.GetSelectEntryPos();
sal_uInt16 nLang = aLangLB.GetSelectLanguage();
- Reference< XDictionary1 > xDic( aDics.getConstArray()[ nDicPos ], UNO_QUERY );
- INT16 nOldLang = xDic->getLanguage();
+ Reference< XDictionary > xDic( aDics.getConstArray()[ nDicPos ], UNO_QUERY );
+ INT16 nOldLang = SvxLocaleToLanguage( xDic->getLocale() );
if ( nLang != nOldLang )
{
@@ -478,12 +478,12 @@ IMPL_LINK( SvxEditDictionaryDialog, SelectLangHdl_Impl, ListBox *, EMPTYARG )
if ( aBox.Execute() == RET_YES )
{
- xDic->setLanguage( nLang );
+ xDic->setLocale( SvxCreateLocale( nLang ) );
sal_Bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
const String sName(
::GetDicInfoStr( xDic->getName(),
- xDic->getLanguage(),
+ SvxLocaleToLanguage( xDic->getLocale() ),
bNegativ ) );
aAllDictsLB.RemoveEntry( nDicPos );
aAllDictsLB.InsertEntry( sName, nDicPos );
@@ -623,7 +623,7 @@ IMPL_LINK(SvxEditDictionaryDialog, NewDelHdl, PushButton*, pBtn)
if ( nPos != LISTBOX_ENTRY_NOTFOUND && aNewWord.Len() > 0)
{
DBG_ASSERT(nPos < aDics.getLength(), "invalid dictionary index");
- Reference< XDictionary1 > xDic( aDics.getConstArray()[ nPos ], UNO_QUERY );
+ Reference< XDictionary > xDic( aDics.getConstArray()[ nPos ], UNO_QUERY );
if (xDic.is())
{
// make changes in dic
@@ -643,7 +643,7 @@ IMPL_LINK(SvxEditDictionaryDialog, NewDelHdl, PushButton*, pBtn)
Reference<XDictionary> aXDictionary(xDic, UNO_QUERY);
nAddRes = linguistic::AddEntryToDic( aXDictionary,
aNewWord, bIsNegEntry,
- aRplcText, xDic->getLanguage(), sal_False );
+ aRplcText, SvxLocaleToLanguage( xDic->getLocale() ), sal_False );
}
}
if (DIC_ERR_NONE != nAddRes)
diff --git a/svx/source/dialog/optdict.hxx b/svx/source/dialog/optdict.hxx
index 843bded0fa85..b09c1d1e773e 100644
--- a/svx/source/dialog/optdict.hxx
+++ b/svx/source/dialog/optdict.hxx
@@ -54,7 +54,6 @@
namespace com{namespace sun{namespace star{
namespace linguistic2{
class XDictionary;
- class XDictionary1;
class XSpellChecker1;
class XSpellChecker;
}}}}
@@ -79,7 +78,7 @@ private:
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > xNewDic;
+ ::com::sun::star::linguistic2::XDictionary > xNewDic;
#ifdef _SVX_OPTDICT_CXX
DECL_LINK( OKHdl_Impl, Button * );
@@ -92,7 +91,7 @@ public:
::com::sun::star::linguistic2::XSpellChecker1 > &xSpl );
::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 >
+ ::com::sun::star::linguistic2::XDictionary >
GetNewDictionary() { return xNewDic; }
};
@@ -166,7 +165,7 @@ private:
void SetLanguage_Impl( ::com::sun::star::util::Language nLanguage );
sal_Bool IsDicReadonly_Impl() const { return bDicIsReadonly; }
void SetDicReadonly_Impl( ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionary1 > &xDic );
+ ::com::sun::star::linguistic2::XDictionary > &xDic );
void RemoveDictEntry(SvLBoxEntry* pEntry);
USHORT GetLBInsertPos(const String &rDicWord);
diff --git a/svx/source/dialog/splwrap.cxx b/svx/source/dialog/splwrap.cxx
index b5575380c9d5..ad3a973fc2a8 100644
--- a/svx/source/dialog/splwrap.cxx
+++ b/svx/source/dialog/splwrap.cxx
@@ -46,7 +46,6 @@
#include <sfx2/sfxuno.hxx>
#include <linguistic/lngprops.hxx>
#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/linguistic2/XDictionary1.hpp>
#include <map>
@@ -538,9 +537,9 @@ sal_Bool SvxSpellWrapper::SpellNext( )
// -----------------------------------------------------------------------
-Reference< XDictionary1 > SvxSpellWrapper::GetAllRightDic() const
+Reference< XDictionary > SvxSpellWrapper::GetAllRightDic() const
{
- Reference< XDictionary1 > xDic;
+ Reference< XDictionary > xDic;
Reference< XDictionaryList > xDicList( SvxGetDictionaryList() );
if (xDicList.is())
@@ -552,12 +551,12 @@ Reference< XDictionary1 > SvxSpellWrapper::GetAllRightDic() const
sal_Int32 i = 0;
while (!xDic.is() && i < nCount)
{
- Reference< XDictionary1 > xTmp( pDic[i], UNO_QUERY );
+ Reference< XDictionary > xTmp( pDic[i], UNO_QUERY );
if (xTmp.is())
{
if ( xTmp->isActive() &&
xTmp->getDictionaryType() != DictionaryType_NEGATIVE &&
- xTmp->getLanguage() == LANGUAGE_NONE )
+ SvxLocaleToLanguage( xTmp->getLocale() ) == LANGUAGE_NONE )
{
Reference< frame::XStorable > xStor( xTmp, UNO_QUERY );
if (xStor.is() && xStor->hasLocation() && !xStor->isReadonly())
@@ -591,7 +590,7 @@ sal_Bool SvxSpellWrapper::FindSpellError()
WAIT_ON();
sal_Bool bSpell = sal_True;
- Reference< XDictionary1 > xAllRightDic;
+ Reference< XDictionary > xAllRightDic;
if (IsAllRight())
xAllRightDic = GetAllRightDic();
@@ -611,7 +610,7 @@ sal_Bool SvxSpellWrapper::FindSpellError()
else
{
// look up in ChangeAllList for misspelled word
- Reference< XDictionary1 > xChangeAllList(
+ Reference< XDictionary > xChangeAllList(
SvxGetChangeAllList(), UNO_QUERY );
Reference< XDictionaryEntry > xEntry;
if (xChangeAllList.is())
diff --git a/svx/source/dialog/treeopt.cxx b/svx/source/dialog/treeopt.cxx
index 54ebf6cbb621..60d23158069c 100644
--- a/svx/source/dialog/treeopt.cxx
+++ b/svx/source/dialog/treeopt.cxx
@@ -1537,7 +1537,7 @@ SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
pRet = new SfxItemSet(
SFX_APP()->GetPool(),
SID_ATTR_METRIC, SID_ATTR_SPELL,
- SID_AUTOSPELL_CHECK, SID_AUTOSPELL_MARKOFF,
+ SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER,
SID_ATTR_YEAR2000, SID_ATTR_YEAR2000,
SID_HTML_MODE, SID_HTML_MODE,
@@ -1576,7 +1576,7 @@ SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
case SID_LANGUAGE_OPTIONS :
{
pRet = new SfxItemSet(SFX_APP()->GetPool(),
- SID_ATTR_LANGUAGE, SID_AUTOSPELL_MARKOFF,
+ SID_ATTR_LANGUAGE, SID_AUTOSPELL_CHECK,
SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
SID_OPT_LOCALE_CHANGED, SID_OPT_LOCALE_CHANGED,
SID_SET_DOCUMENT_LANGUAGE, SID_SET_DOCUMENT_LANGUAGE,
@@ -1630,22 +1630,6 @@ SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId )
pRet->Put(SfxBoolItem(SID_AUTOSPELL_CHECK, bVal));
}
-
- if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_AUTOSPELL_MARKOFF, pItem))
- {
- pClone = pItem->Clone();
- pRet->Put(*pClone);
- delete pClone;
- }
- else
- {
- sal_Bool bVal = sal_False;
- if (xProp.is())
- {
- xProp->getPropertyValue( String::CreateFromAscii( UPN_IS_SPELL_HIDE) ) >>= bVal;
- }
- pRet->Put(SfxBoolItem(SID_AUTOSPELL_MARKOFF, bVal));
- }
}
pRet->Put( SfxBoolItem( SID_SET_DOCUMENT_LANGUAGE, bIsForSetDocumentLanguage ) );
}
@@ -1835,19 +1819,6 @@ void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet)
}
}
- if( SFX_ITEM_SET == rSet.GetItemState(SID_AUTOSPELL_MARKOFF, sal_False, &pItem ))
- {
- sal_Bool bHideSpell = ((const SfxBoolItem*)pItem)->GetValue();
- pDispatch->Execute(SID_AUTOSPELL_MARKOFF, SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD, pItem, 0L);
-
- if (xProp.is())
- {
- xProp->setPropertyValue(
- String::CreateFromAscii(UPN_IS_SPELL_HIDE),
- makeAny(bHideSpell) );
- }
- }
-
if( bSaveSpellCheck )
{
//! the config item has changed since we modified the
diff --git a/svx/source/editeng/editeng.cxx b/svx/source/editeng/editeng.cxx
index 065f27779d8e..467fabdc8d6b 100644
--- a/svx/source/editeng/editeng.cxx
+++ b/svx/source/editeng/editeng.cxx
@@ -1751,9 +1751,8 @@ void EditEngine::SetControlWord( sal_uInt32 nWord )
}
sal_Bool bSpellingChanged = nChanges & EE_CNTRL_ONLINESPELLING ? sal_True : sal_False;
- sal_Bool bRedLinesChanged = nChanges & EE_CNTRL_NOREDLINES ? sal_True : sal_False;
- if ( bSpellingChanged || bRedLinesChanged )
+ if ( bSpellingChanged )
{
pImpEditEngine->StopOnlineSpellTimer();
if ( bSpellingChanged && ( nWord & EE_CNTRL_ONLINESPELLING ) )
@@ -2182,6 +2181,14 @@ bool EditEngine::SpellSentence(EditView& rView, ::svx::SpellPortions& rToFill, b
DBG_CHKTHIS( EditEngine, 0 );
return pImpEditEngine->SpellSentence( rView, rToFill, bIsGrammarChecking );
}
+/*-- 08.09.2008 11:38:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void EditEngine::PutSpellingToSentenceStart( EditView& rEditView )
+{
+ DBG_CHKTHIS( EditEngine, 0 );
+ pImpEditEngine->PutSpellingToSentenceStart( rEditView );
+}
/*-- 13.10.2003 16:43:27---------------------------------------------------
-----------------------------------------------------------------------*/
diff --git a/svx/source/editeng/editstt2.hxx b/svx/source/editeng/editstt2.hxx
index 205d5aa2e2ae..e8b0128cf7ee 100644
--- a/svx/source/editeng/editstt2.hxx
+++ b/svx/source/editeng/editstt2.hxx
@@ -110,9 +110,6 @@ public:
BOOL DoImportRTFStyleSheets() const
{ return ( ( nControlBits & EE_CNTRL_RTFSTYLESHEETS ) != 0 ); }
- BOOL DoDrawRedLines() const
- { return ( ( nControlBits & EE_CNTRL_NOREDLINES ) == 0 ); }
-
BOOL DoAutoCorrect() const
{ return ( ( nControlBits & EE_CNTRL_AUTOCORRECT ) != 0 ); }
diff --git a/svx/source/editeng/editview.cxx b/svx/source/editeng/editview.cxx
index 5c2b1c74b002..134e3d6c75b0 100644
--- a/svx/source/editeng/editview.cxx
+++ b/svx/source/editeng/editview.cxx
@@ -65,7 +65,6 @@
#include <fontitem.hxx>
#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/linguistic2/XDictionary1.hpp>
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HDL_
#include <com/sun/star/beans/PropertyValues.hdl>
#endif
@@ -1129,10 +1128,10 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
sal_uInt16 nDicCount = (USHORT)aDics.getLength();
for ( sal_uInt16 i = 0; i < nDicCount; i++ )
{
- Reference< XDictionary1 > xDic( pDic[i], UNO_QUERY );
+ Reference< XDictionary > xDic( pDic[i], UNO_QUERY );
if (xDic.is())
{
- sal_uInt16 nActLanguage = xDic->getLanguage();
+ sal_uInt16 nActLanguage = SvxLocaleToLanguage( xDic->getLocale() );
if( xDic->isActive() &&
xDic->getDictionaryType() == DictionaryType_POSITIVE &&
(nLanguage == nActLanguage || LANGUAGE_NONE == nActLanguage ) )
@@ -1212,7 +1211,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
}
else if ( nId >= MN_DICTSTART )
{
- Reference< XDictionary1 > xDic( pDic[nId - MN_DICTSTART], UNO_QUERY );
+ Reference< XDictionary > xDic( pDic[nId - MN_DICTSTART], UNO_QUERY );
if (xDic.is())
xDic->add( aSelected, sal_False, String() );
// save modified user-dictionary if it is persistent
diff --git a/svx/source/editeng/impedit.cxx b/svx/source/editeng/impedit.cxx
index 19b4d4faf0ae..2e27bd744637 100644
--- a/svx/source/editeng/impedit.cxx
+++ b/svx/source/editeng/impedit.cxx
@@ -45,7 +45,6 @@
#include <com/sun/star/linguistic2/XDictionaryEventListener.hpp>
#include <com/sun/star/linguistic2/DictionaryEventFlags.hpp>
#include <com/sun/star/linguistic2/XDictionary.hpp>
-#include <com/sun/star/linguistic2/XDictionary1.hpp>
#ifndef _COM_SUN_STAR_DATATRANSFER_DND_DNDCONSTANS_HPP_
#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
@@ -1162,7 +1161,7 @@ String ImpEditView::SpellIgnoreOrAddWord( sal_Bool bAdd )
}
else // Ignore
{
- Reference< XDictionary1 > xDic( SvxGetIgnoreAllList(), UNO_QUERY );
+ Reference< XDictionary > xDic( SvxGetIgnoreAllList(), UNO_QUERY );
if (xDic.is())
xDic->add( aWord, sal_False, String() );
}
diff --git a/svx/source/editeng/impedit.hxx b/svx/source/editeng/impedit.hxx
index 732c8ad426ac..983c2be2f449 100644
--- a/svx/source/editeng/impedit.hxx
+++ b/svx/source/editeng/impedit.hxx
@@ -955,6 +955,8 @@ public:
void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
//spell and return a sentence
bool SpellSentence(EditView& rView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking );
+ //put spelling back to start of current sentence - needed after switch of grammar support
+ void PutSpellingToSentenceStart( EditView& rEditView );
//applies a changed sentence
void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bIsGrammarChecking );
//deinitialize sentence spelling
diff --git a/svx/source/editeng/impedit3.cxx b/svx/source/editeng/impedit3.cxx
index 6204a13b4ae1..af201d264623 100644
--- a/svx/source/editeng/impedit3.cxx
+++ b/svx/source/editeng/impedit3.cxx
@@ -3375,7 +3375,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
}
#ifndef SVX_LIGHT
- if ( GetStatus().DoOnlineSpelling() && GetStatus().DoDrawRedLines() && pPortion->GetNode()->GetWrongList()->HasWrongs() && pTextPortion->GetLen() )
+ if ( GetStatus().DoOnlineSpelling() && pPortion->GetNode()->GetWrongList()->HasWrongs() && pTextPortion->GetLen() )
{
{//#105750# adjust LinePos for superscript or subscript text
short _nEsc = aTmpFont.GetEscapement();
diff --git a/svx/source/editeng/impedit4.cxx b/svx/source/editeng/impedit4.cxx
index d9bd6a894e66..cbccd8211aa8 100644
--- a/svx/source/editeng/impedit4.cxx
+++ b/svx/source/editeng/impedit4.cxx
@@ -2272,6 +2272,20 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView, const ::svx::Spell
aEditDoc.SetModified(TRUE);
#endif
}
+/*-- 08.09.2008 11:33:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void ImpEditEngine::PutSpellingToSentenceStart( EditView& rEditView )
+{
+#ifdef SVX_LIGHT
+#else
+ if( pSpellInfo && pSpellInfo->aLastSpellContentSelections.size() )
+ {
+ rEditView.pImpEditView->SetEditSelection( pSpellInfo->aLastSpellContentSelections.begin()->Min() );
+ }
+
+#endif
+}
void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpellAtCursorPos, sal_Bool bInteruptable )
@@ -2423,7 +2437,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel
}
// Invalidieren?
- if ( ( nPaintFrom != 0xFFFF ) && ( GetStatus().DoDrawRedLines() ) )
+ if ( ( nPaintFrom != 0xFFFF ) )
{
aStatus.GetStatusWord() |= EE_STAT_WRONGWORDCHANGED;
CallStatusHdl();
diff --git a/svx/source/editeng/unolingu.cxx b/svx/source/editeng/unolingu.cxx
index 1ee6e30c518c..39ece655d631 100644
--- a/svx/source/editeng/unolingu.cxx
+++ b/svx/source/editeng/unolingu.cxx
@@ -255,15 +255,16 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck )
SvtLinguConfig aCfg;
- const sal_Char * apServices[3] = { SN_THESAURUS, SN_SPELLCHECKER, SN_HYPHENATOR };
- const sal_Char * apCurLists[3] = { "ServiceManager/ThesaurusList", "ServiceManager/SpellCheckerList", "ServiceManager/HyphenatorList" };
- const sal_Char * apLastFoundLists[3] = { "ServiceManager/LastFoundThesauri", "ServiceManager/LastFoundSpellCheckers", "ServiceManager/LastFoundHyphenators" };
+ const int nNumServices = 4;
+ const sal_Char * apServices[nNumServices] = { SN_SPELLCHECKER, SN_GRAMMARCHECKER, SN_HYPHENATOR, SN_THESAURUS };
+ const sal_Char * apCurLists[nNumServices] = { "ServiceManager/SpellCheckerList", "ServiceManager/GrammarCheckerList", "ServiceManager/HyphenatorList", "ServiceManager/ThesaurusList" };
+ const sal_Char * apLastFoundLists[nNumServices] = { "ServiceManager/LastFoundSpellCheckers", "ServiceManager/LastFoundGrammarCheckers", "ServiceManager/LastFoundHyphenators", "ServiceManager/LastFoundThesauri" };
- // usage of indices as above: O = thesaurus, 1 = spellchecker, 2 = hyphenator
- std::vector< list_entry_map_t > aLastFoundSvcs(3);
- std::vector< list_entry_map_t > aCurSvcs(3);
+ // usage of indices as above: 0 = spell checker, 1 = grammar checker, 2 = hyphenator, 3 = thesaurus
+ std::vector< list_entry_map_t > aLastFoundSvcs(nNumServices);
+ std::vector< list_entry_map_t > aCurSvcs(nNumServices);
- for (int k = 0; k < 3; ++k)
+ for (int k = 0; k < nNumServices; ++k)
{
OUString aService( A2OU( apServices[k] ) );
OUString aActiveList( A2OU( apCurLists[k] ) );
@@ -283,6 +284,12 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck )
xLngSvcMgr->getConfiguredServices( aService, aLocale ));
Sequence< OUString > aAvailSvcs(
xLngSvcMgr->getAvailableServices( aService, aLocale ));
+#if OSL_DEBUG_LEVEL > 1
+ const OUString * pCfgSvcs = aCfgSvcs.getConstArray();;
+ const OUString * pAvailSvcs = aAvailSvcs.getConstArray();;
+ (void) pCfgSvcs;
+ (void) pAvailSvcs;
+#endif
aCfgSvcs = lcl_RemoveMissingEntries( aCfgSvcs, aAvailSvcs );
aCurSvcs[k][ pNodeName[i] ] = aCfgSvcs;
@@ -299,10 +306,18 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck )
{
Sequence< OUString > aAvailSvcs(
xLngSvcMgr->getAvailableServices( aService, pAvailLocale[i] ));
- Sequence< OUString > _aLastFoundSvcs(
+ Sequence< OUString > aLastSvcs(
lcl_GetLastFoundSvcs( aCfg, aLastFoundList , pAvailLocale[i] ));
Sequence< OUString > aNewSvcs =
- lcl_GetNewEntries( _aLastFoundSvcs, aAvailSvcs );
+ lcl_GetNewEntries( aLastSvcs, aAvailSvcs );
+#if OSL_DEBUG_LEVEL > 1
+ const OUString * pAvailSvcs = aAvailSvcs.getConstArray();
+ const OUString * pLastSvcs = aLastSvcs.getConstArray();
+ const OUString * pNewSvcs = aNewSvcs.getConstArray();
+ (void) pAvailSvcs;
+ (void) pLastSvcs;
+ (void) pNewSvcs;
+#endif
OUString aCfgLocaleStr( MsLangId::convertLanguageToIsoString(
SvxLocaleToLanguage( pAvailLocale[i] ) ) );
@@ -326,7 +341,7 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck )
for (i = 0; i < nAvailLocales; ++i)
{
Sequence< OUString > aSvcImplNames(
- xLngSvcMgr->getConfiguredServices( aService, pAvailLocale[i] ) );
+ xLngSvcMgr->getAvailableServices( aService, pAvailLocale[i] ) );
#if OSL_DEBUG_LEVEL > 1
INT32 nSvcs = aSvcImplNames.getLength();
@@ -346,7 +361,7 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck )
//
// write new data back to configuration
//
- for (int k = 0; k < 3; ++k)
+ for (int k = 0; k < nNumServices; ++k)
{
for (int i = 0; i < 2; ++i)
{
@@ -423,176 +438,12 @@ void SvxLinguConfigUpdate::UpdateAll( sal_Bool bForceCheck )
}
-static void StringUpdateHashValue( INT32 &h, const String &rString )
-{
- INT32 /*h,*/ nLen;
- /*h =*/ nLen = rString.Len();
- const sal_Unicode *pStr = rString.GetBuffer();
-
- if ( nLen < 16 )
- while ( nLen-- > 0 )
- h = (h*37) + *(pStr++);
- else
- {
- sal_Int32 nSkip;
- const sal_Unicode* pEndStr = pStr+nLen-5;
-
- /* only sample some characters */
- /* the first 3, some characters between, and the last 5 */
- h = (h*39) + *(pStr++);
- h = (h*39) + *(pStr++);
- h = (h*39) + *(pStr++);
-
- nSkip = nLen / nLen < 32 ? 4 : 8;
- nLen -= 8;
- while ( nLen > 0 )
- {
- h = (h*39) + ( *pStr );
- pStr += nSkip;
- nLen -= nSkip;
- }
-
- h = (h*39) + *(pEndStr++);
- h = (h*39) + *(pEndStr++);
- h = (h*39) + *(pEndStr++);
- h = (h*39) + *(pEndStr++);
- h = (h*39) + *(pEndStr++);
- }
- //return h;
-}
-
-
INT32 SvxLinguConfigUpdate::CalcDataFilesChangedCheckValue()
{
RTL_LOGFILE_CONTEXT( aLog, "svx: SvxLinguConfigUpdate::CalcDataFilesChangedCheckValue" );
- // get linguistic multi-path for directories to check...
- const String aLinguPath( SvtPathOptions().GetLinguisticPath() );
- const xub_StrLen nPathes ( aLinguPath.GetTokenCount(';') );
- xub_StrLen nIdx = 0;
- std::vector< String > aPathes;
- for (xub_StrLen k = 0; k < nPathes; ++k)
- {
- String aPath( aLinguPath.GetToken( 0, ';', nIdx ) );
- aPathes.push_back( aPath );
- }
- // list of directories to scan for changed/new/deleted files should be
- // 0: regular SO dictionary path
- // 1: regular OOo dictionary path
- // 2: user-dictionary path (where OOo linguistic by bad choice places downloaded dictionaries
- // when the permissions for the share tree are missing. E.g. in user installations.)
- DBG_ASSERT( nPathes == 3, "Linguistic-Path configuration changed" );
-
INT32 nHashVal = 0;
- for (int i = 0; i < nPathes; ++i )
- {
- const String rURL = aPathes[i];
-
- if( !utl::UCBContentHelper::IsFolder( rURL ) )
- continue;
-
- INetURLObject aFolderObj( rURL );
- DBG_ASSERT( aFolderObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" );
-
- try
- {
- uno::Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
-
- ::ucbhelper::Content aCnt( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ),
- new ::ucbhelper::CommandEnvironment( uno::Reference< task::XInteractionHandler >(),
- uno::Reference< CSS::ucb::XProgressHandler >() ) );
- uno::Reference< sdbc::XResultSet > xResultSet;
- Sequence< OUString > aProps(3);
- OUString* pProps = aProps.getArray();
- pProps[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
- pProps[1] = OUString::createFromAscii( "Size" );
- pProps[2] = OUString::createFromAscii( "DateModified" );
-
- try
- {
- uno::Reference< CSS::ucb::XDynamicResultSet > xDynResultSet;
- ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_DOCUMENTS_ONLY;
- xDynResultSet = aCnt.createDynamicCursor( aProps, eInclude );
-
- uno::Reference < CSS::ucb::XAnyCompareFactory > xCompare;
- uno::Reference < CSS::ucb::XSortedDynamicResultSetFactory > xSRSFac(
- xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SortedDynamicResultSetFactory") ) ), UNO_QUERY );
-
- uno::Sequence< CSS::ucb::NumberedSortingInfo > aSortInfo( 2 );
- CSS::ucb::NumberedSortingInfo* pInfo = aSortInfo.getArray();
- pInfo[ 0 ].ColumnIndex = 3;
- pInfo[ 0 ].Ascending = sal_False;
- pInfo[ 1 ].ColumnIndex = 1;
- pInfo[ 1 ].Ascending = sal_True;
-
- uno::Reference< CSS::ucb::XDynamicResultSet > xDynamicResultSet;
- xDynamicResultSet =
- xSRSFac->createSortedDynamicResultSet( xDynResultSet, aSortInfo, xCompare );
-
- if (xDynamicResultSet.is())
- xResultSet = xDynamicResultSet->getStaticResultSet();
- }
- catch( uno::Exception& )
- {
- }
-
- if (xResultSet.is())
- {
- uno::Reference< sdbc::XRow > xRow( xResultSet, UNO_QUERY );
- uno::Reference< CSS::ucb::XContentAccess > xContentAccess( xResultSet, UNO_QUERY );
-
- try
- {
- while (xResultSet->next())
- {
- //!! needed to work-around the bad directory choice for OOo downloadable
- //!! dictionaries in restricted installations.
- //!! This is required because that directory holds the user-dictionaries as well
- //!! and changing those should not trigger updating the configuration.
- //!! Especially bad is that both of those different types of dictionaries
- //!! (downloaded dictionaries and user-dictionaries) have the same extension
- //!! thus we try to evaluate the need of updating the configuration in this
- //!! directory by only looking at the dictionary.lst file(s).
- sal_Bool bUseFile = (i != 2) || /* always use the regular directories */
- xRow->getString(1).matchAsciiL( "dictionary.lst", 14, 0 );
-
- if (bUseFile)
- {
- String aTitle = xRow->getString(1);
- sal_Int64 nSize = xRow->getLong(2);
- util::DateTime aDT = xRow->getTimestamp(3);
-
- String aDateTime( String::CreateFromInt32( aDT.Day ) );
- aDateTime.Append( (sal_Unicode) '.' );
- aDateTime += String::CreateFromInt32( aDT.Month );
- aDateTime.Append( (sal_Unicode) '.' );
- aDateTime += String::CreateFromInt32( aDT.Year );
- aDateTime.Append( (sal_Unicode) ' ' );
- aDateTime += String::CreateFromInt32( aDT.Hours );
- aDateTime.Append( (sal_Unicode) ':' );
- aDateTime += String::CreateFromInt32( aDT.Minutes );
- aDateTime.Append( (sal_Unicode) '_' );
- aDateTime += String::CreateFromInt32( aDT.Seconds );
-
- String aSize( String::CreateFromInt64( nSize ) );
-
- StringUpdateHashValue( nHashVal, aTitle );
- StringUpdateHashValue( nHashVal, aSize );
- StringUpdateHashValue( nHashVal, aDateTime );
- }
- }
- }
- catch( uno::Exception& )
- {
- }
- }
- }
- catch( uno::Exception& )
- {
- }
-
- }
-
+ // nothing to be checked anymore since those old directory paths are gone by now
return nHashVal;
}
@@ -1107,8 +958,8 @@ uno::Reference< XHyphenator > LinguMgr::xHyph = 0;
uno::Reference< XThesaurus > LinguMgr::xThes = 0;
uno::Reference< XDictionaryList > LinguMgr::xDicList = 0;
uno::Reference< XPropertySet > LinguMgr::xProp = 0;
-uno::Reference< XDictionary1 > LinguMgr::xIgnoreAll = 0;
-uno::Reference< XDictionary1 > LinguMgr::xChangeAll = 0;
+uno::Reference< XDictionary > LinguMgr::xIgnoreAll = 0;
+uno::Reference< XDictionary > LinguMgr::xChangeAll = 0;
uno::Reference< XLinguServiceManager > LinguMgr::GetLngSvcMgr()
@@ -1151,7 +1002,7 @@ uno::Reference< XPropertySet > LinguMgr::GetLinguPropertySet()
return xProp.is() ? xProp : GetProp();
}
-uno::Reference< XDictionary1 > LinguMgr::GetStandardDic()
+uno::Reference< XDictionary > LinguMgr::GetStandardDic()
{
//! don't hold reference to this
//! (it may be removed from dictionary list and needs to be
@@ -1159,12 +1010,12 @@ uno::Reference< XDictionary1 > LinguMgr::GetStandardDic()
return GetStandard();
}
-uno::Reference< XDictionary1 > LinguMgr::GetIgnoreAllList()
+uno::Reference< XDictionary > LinguMgr::GetIgnoreAllList()
{
return xIgnoreAll.is() ? xIgnoreAll : GetIgnoreAll();
}
-uno::Reference< XDictionary1 > LinguMgr::GetChangeAllList()
+uno::Reference< XDictionary > LinguMgr::GetChangeAllList()
{
return xChangeAll.is() ? xChangeAll : GetChangeAll();
}
@@ -1280,7 +1131,7 @@ uno::Reference< XPropertySet > LinguMgr::GetProp()
return xProp;
}
-uno::Reference< XDictionary1 > LinguMgr::GetIgnoreAll()
+uno::Reference< XDictionary > LinguMgr::GetIgnoreAll()
{
if (bExiting)
return 0;
@@ -1291,13 +1142,13 @@ uno::Reference< XDictionary1 > LinguMgr::GetIgnoreAll()
uno::Reference< XDictionaryList > xTmpDicList( GetDictionaryList() );
if (xTmpDicList.is())
{
- xIgnoreAll = uno::Reference< XDictionary1 > ( xTmpDicList->getDictionaryByName(
+ xIgnoreAll = uno::Reference< XDictionary > ( xTmpDicList->getDictionaryByName(
A2OU("IgnoreAllList") ), UNO_QUERY );
}
return xIgnoreAll;
}
-uno::Reference< XDictionary1 > LinguMgr::GetChangeAll()
+uno::Reference< XDictionary > LinguMgr::GetChangeAll()
{
if (bExiting)
return 0;
@@ -1308,7 +1159,7 @@ uno::Reference< XDictionary1 > LinguMgr::GetChangeAll()
uno::Reference< XDictionaryList > _xDicList( GetDictionaryList() , UNO_QUERY );
if (_xDicList.is())
{
- xChangeAll = uno::Reference< XDictionary1 > (
+ xChangeAll = uno::Reference< XDictionary > (
_xDicList->createDictionary(
A2OU("ChangeAllList"),
SvxCreateLocale( LANGUAGE_NONE ),
@@ -1317,7 +1168,7 @@ uno::Reference< XDictionary1 > LinguMgr::GetChangeAll()
return xChangeAll;
}
-uno::Reference< XDictionary1 > LinguMgr::GetStandard()
+uno::Reference< XDictionary > LinguMgr::GetStandard()
{
// Tries to return a dictionary which may hold positive entries is
// persistent and not read-only.
@@ -1330,7 +1181,7 @@ uno::Reference< XDictionary1 > LinguMgr::GetStandard()
return NULL;
const OUString aDicName( RTL_CONSTASCII_USTRINGPARAM( "standard.dic" ) );
- uno::Reference< XDictionary1 > xDic( xTmpDicList->getDictionaryByName( aDicName ),
+ uno::Reference< XDictionary > xDic( xTmpDicList->getDictionaryByName( aDicName ),
UNO_QUERY );
if (!xDic.is())
{
@@ -1350,13 +1201,13 @@ uno::Reference< XDictionary1 > LinguMgr::GetStandard()
// add new dictionary to list
if (xTmp.is())
xTmpDicList->addDictionary( xTmp );
- xDic = uno::Reference< XDictionary1 > ( xTmp, UNO_QUERY );
+ xDic = uno::Reference< XDictionary > ( xTmp, UNO_QUERY );
}
#if OSL_DEBUG_LEVEL > 1
uno::Reference< XStorable > xStor( xDic, UNO_QUERY );
DBG_ASSERT( xDic.is() && xDic->getDictionaryType() == DictionaryType_POSITIVE,
"wrong dictionary type");
- DBG_ASSERT( xDic.is() && xDic->getLanguage() == LANGUAGE_NONE,
+ DBG_ASSERT( xDic.is() && SvxLocaleToLanguage( xDic->getLocale() ) == LANGUAGE_NONE,
"wrong dictionary language");
DBG_ASSERT( !xStor.is() || (xStor->hasLocation() && !xStor->isReadonly()),
"dictionary not editable" );
@@ -1393,18 +1244,18 @@ uno::Reference< XPropertySet > SvxGetLinguPropertySet()
}
//TL:TODO: remove argument or provide SvxGetIgnoreAllList with the same one
-uno::Reference< XDictionary1 > SvxGetOrCreatePosDic(
+uno::Reference< XDictionary > SvxGetOrCreatePosDic(
uno::Reference< XDictionaryList > /* xDicList */ )
{
return LinguMgr::GetStandardDic();
}
-uno::Reference< XDictionary1 > SvxGetIgnoreAllList()
+uno::Reference< XDictionary > SvxGetIgnoreAllList()
{
return LinguMgr::GetIgnoreAllList();
}
-uno::Reference< XDictionary1 > SvxGetChangeAllList()
+uno::Reference< XDictionary > SvxGetChangeAllList()
{
return LinguMgr::GetChangeAllList();
}
diff --git a/svx/source/inc/SpellDialog.hxx b/svx/source/inc/SpellDialog.hxx
index 88679e348ec3..93b1ea57338d 100644
--- a/svx/source/inc/SpellDialog.hxx
+++ b/svx/source/inc/SpellDialog.hxx
@@ -114,7 +114,7 @@ public:
bool IsUndoEditMode() const { return m_bIsUndoEditMode;}
void SetUndoEditMode(bool bSet);
- svx::SpellPortions CreateSpellPortions() const;
+ svx::SpellPortions CreateSpellPortions( bool bSetIgnoreFlag ) const;
void ResetUndo();
void Undo();
@@ -162,6 +162,7 @@ private:
PushButton aIgnorePB;
PushButton aIgnoreAllPB;
+ PushButton aIgnoreRulePB;
MenuButton aAddToDictMB;
PushButton aChangePB;
diff --git a/svx/source/options/optlingu.cxx b/svx/source/options/optlingu.cxx
index c4cd7cc196b9..9980995f5a12 100644
--- a/svx/source/options/optlingu.cxx
+++ b/svx/source/options/optlingu.cxx
@@ -35,20 +35,21 @@
#define _SVSTDARR_STRINGSDTOR
#define _SVSTDARR_USHORTS
-#ifndef _SVSTDARR_HXX
-#include <svtools/svstdarr.hxx>
-#endif
+//#ifndef _SVSTDARR_HXX
+//#include <svtools/svstdarr.hxx>
+//#endif
#include <vcl/msgbox.hxx>
#include <vcl/field.hxx>
#include <vcl/fixed.hxx>
#include <tools/shl.hxx>
#include <tools/dynary.hxx>
#include <i18npool/mslangid.hxx>
-#include <svtools/svarray.hxx>
+//#include <svtools/svarray.hxx>
#include <svtools/lingucfg.hxx>
#include <unolingu.hxx>
#include <dlgutil.hxx>
#include <linguistic/lngprops.hxx>
+#include <linguistic/misc.hxx>
#include <unolingu.hxx>
#include <sfx2/sfxuno.hxx>
#include <sfx2/dispatch.hxx>
@@ -56,6 +57,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/linguistic2/XSpellChecker.hpp>
+#include <com/sun/star/linguistic2/XProofreader.hpp>
#include <com/sun/star/linguistic2/XHyphenator.hpp>
#include <com/sun/star/linguistic2/XThesaurus.hpp>
#include <com/sun/star/linguistic2/XAvailableLocales.hpp>
@@ -105,9 +107,10 @@ namespace css = com::sun::star;
#define CBCOL_SECOND 1
#define CBCOL_BOTH 2
-static const sal_Char cSpell[] = "com.sun.star.linguistic2.SpellChecker";
-static const sal_Char cHyph[] = "com.sun.star.linguistic2.Hyphenator";
-static const sal_Char cThes[] = "com.sun.star.linguistic2.Thesaurus";
+static const sal_Char cSpell[] = SN_SPELLCHECKER;
+static const sal_Char cGrammar[] = SN_GRAMMARCHECKER;
+static const sal_Char cHyph[] = SN_HYPHENATOR;
+static const sal_Char cThes[] = SN_THESAURUS;
// static ----------------------------------------------------------------
@@ -214,13 +217,14 @@ sal_Bool KillFile_Impl( const String& rURL )
---------------------------------------------------------------------------*/
// 0x 0p 0t 0c nn
// p: 1 -> parent
-// t: 1 -> spell, 2 -> hyph, 3 -> thes
+// t: 1 -> spell, 2 -> hyph, 3 -> thes, 4 -> grammar
// c: 1 -> checked 0 -> unchecked
// n: index
-#define TYPE_SPELL (BYTE)1
-#define TYPE_HYPH (BYTE)2
-#define TYPE_THES (BYTE)3
+#define TYPE_SPELL (BYTE)1
+#define TYPE_GRAMMAR (BYTE)2
+#define TYPE_HYPH (BYTE)3
+#define TYPE_THES (BYTE)4
class ModuleUserData_Impl
{
@@ -378,13 +382,11 @@ public:
enum EID_OPTIONS
{
EID_SPELL_AUTO,
+ EID_GRAMMAR_AUTO,
EID_CAPITAL_WORDS,
EID_WORDS_WITH_DIGITS,
EID_CAPITALIZATION,
EID_SPELL_SPECIAL,
- EID_ALL_LANGUAGES,
- EID_HIDE_MARKINGS,
- EID_OLD_GERMAN,
EID_NUM_MIN_WORDLEN,
EID_NUM_PRE_BREAK,
EID_NUM_POST_BREAK,
@@ -396,19 +398,17 @@ enum EID_OPTIONS
// It is used to get the respective property name.
static const char * aEidToPropName[] =
{
- "IsSpellAuto", // EID_SPELL_AUTO
- "IsSpellUpperCase", // EID_CAPITAL_WORDS
- "IsSpellWithDigits", // EID_WORDS_WITH_DIGITS
- "IsSpellCapitalization", // EID_CAPITALIZATION
- "IsSpellSpecial", // EID_SPELL_SPECIAL
- "IsSpellInAllLanguages", // EID_ALL_LANGUAGES
- "IsSpellHide", // EID_HIDE_MARKINGS
- "IsGermanPreReform", // EID_OLD_GERMAN
- "HyphMinWordLength", // EID_NUM_MIN_WORDLEN,
- "HyphMinLeading", // EID_NUM_PRE_BREAK
- "HyphMinTrailing", // EID_NUM_POST_BREAK
- "IsHyphAuto", // EID_HYPH_AUTO
- "IsHyphSpecial" // EID_HYPH_SPECIAL
+ UPN_IS_SPELL_AUTO, // EID_SPELL_AUTO
+ UPN_IS_GRAMMAR_AUTO, // EID_GRAMMAR_AUTO
+ UPN_IS_SPELL_UPPER_CASE, // EID_CAPITAL_WORDS
+ UPN_IS_SPELL_WITH_DIGITS, // EID_WORDS_WITH_DIGITS
+ UPN_IS_SPELL_CAPITALIZATION, // EID_CAPITALIZATION
+ UPN_IS_SPELL_SPECIAL, // EID_SPELL_SPECIAL
+ UPN_HYPH_MIN_WORD_LENGTH, // EID_NUM_MIN_WORDLEN,
+ UPN_HYPH_MIN_LEADING, // EID_NUM_PRE_BREAK
+ UPN_HYPH_MIN_TRAILING, // EID_NUM_POST_BREAK
+ UPN_IS_HYPH_AUTO, // EID_HYPH_AUTO
+ UPN_IS_HYPH_SPECIAL // EID_HYPH_SPECIAL
};
@@ -537,9 +537,11 @@ struct ServiceInfo_Impl
OUString sSpellImplName;
OUString sHyphImplName;
OUString sThesImplName;
- uno::Reference <XSpellChecker> xSpell;
- uno::Reference <XHyphenator> xHyph;
- uno::Reference <XThesaurus> xThes;
+ OUString sGrammarImplName;
+ uno::Reference< XSpellChecker > xSpell;
+ uno::Reference< XHyphenator > xHyph;
+ uno::Reference< XThesaurus > xThes;
+ uno::Reference< XProofreader > xGrammar;
BOOL bConfigured;
ServiceInfo_Impl() : bConfigured(sal_False) {}
@@ -561,6 +563,7 @@ class SvxLinguData_Impl
LangImplNameTable aCfgSpellTable;
LangImplNameTable aCfgHyphTable;
LangImplNameTable aCfgThesTable;
+ LangImplNameTable aCfgGrammarTable;
uno::Reference< XMultiServiceFactory > xMSF;
uno::Reference< XLinguServiceManager > xLinguSrvcMgr;
@@ -588,6 +591,8 @@ public:
LangImplNameTable & GetHyphTable() { return aCfgHyphTable; }
const LangImplNameTable & GetThesTable() const { return aCfgThesTable; }
LangImplNameTable & GetThesTable() { return aCfgThesTable; }
+ const LangImplNameTable & GetGrammarTable() const { return aCfgGrammarTable; }
+ LangImplNameTable & GetGrammarTable() { return aCfgGrammarTable; }
const ServiceInfoArr & GetDisplayServiceArray() const { return aDisplayServiceArr; }
ServiceInfoArr & GetDisplayServiceArray() { return aDisplayServiceArr; }
@@ -627,9 +632,10 @@ Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( INT16 nLang, BYTE nT
LangImplNameTable *pTable = 0;
switch (nType)
{
- case TYPE_SPELL : pTable = &aCfgSpellTable; break;
- case TYPE_HYPH : pTable = &aCfgHyphTable; break;
- case TYPE_THES : pTable = &aCfgThesTable; break;
+ case TYPE_SPELL : pTable = &aCfgSpellTable; break;
+ case TYPE_HYPH : pTable = &aCfgHyphTable; break;
+ case TYPE_THES : pTable = &aCfgThesTable; break;
+ case TYPE_GRAMMAR : pTable = &aCfgGrammarTable; break;
}
Sequence< OUString > aRes;
if (pTable->count( nLang ))
@@ -646,9 +652,10 @@ Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( INT16 nLang, BYTE nT
OUString aImplName;
switch (nType)
{
- case TYPE_SPELL : aImplName = rInfo.sSpellImplName; break;
- case TYPE_HYPH : aImplName = rInfo.sHyphImplName; break;
- case TYPE_THES : aImplName = rInfo.sThesImplName; break;
+ case TYPE_SPELL : aImplName = rInfo.sSpellImplName; break;
+ case TYPE_HYPH : aImplName = rInfo.sHyphImplName; break;
+ case TYPE_THES : aImplName = rInfo.sThesImplName; break;
+ case TYPE_GRAMMAR : aImplName = rInfo.sGrammarImplName; break;
}
if (aImplName.getLength() && (lcl_SeqGetIndex( aRes, aImplName) == -1)) // name not yet added
@@ -674,7 +681,8 @@ ServiceInfo_Impl * SvxLinguData_Impl::GetInfoByImplName( const OUString &rSvcImp
ServiceInfo_Impl &rTmp = aDisplayServiceArr[ i ];
if (rTmp.sSpellImplName == rSvcImplName ||
rTmp.sHyphImplName == rSvcImplName ||
- rTmp.sThesImplName == rSvcImplName)
+ rTmp.sThesImplName == rSvcImplName ||
+ rTmp.sGrammarImplName == rSvcImplName)
pInfo = &rTmp;
}
return pInfo;
@@ -736,6 +744,14 @@ void lcl_MergeDisplayArray(
pEntry->sSpellImplName = rToAdd.sSpellImplName;
pEntry->xSpell = rToAdd.xSpell;
}
+ if(rToAdd.xGrammar.is())
+ {
+ DBG_ASSERT( !pEntry->xGrammar.is() &&
+ pEntry->sGrammarImplName.getLength() == 0,
+ "merge conflict" )
+ pEntry->sGrammarImplName = rToAdd.sGrammarImplName;
+ pEntry->xGrammar = rToAdd.xGrammar;
+ }
if(rToAdd.xHyph.is())
{
DBG_ASSERT( !pEntry->xHyph.is() &&
@@ -804,6 +820,30 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
}
}
+ //read grammar checker
+ Sequence< OUString > aGrammarNames = xLinguSrvcMgr->getAvailableServices(
+ C2U(cGrammar), Locale() );
+ const OUString* pGrammarNames = aGrammarNames.getConstArray();
+ for(nIdx = 0; nIdx < aGrammarNames.getLength(); nIdx++)
+ {
+ ServiceInfo_Impl aInfo;
+ aInfo.sGrammarImplName = pGrammarNames[nIdx];
+ aInfo.xGrammar = uno::Reference<XProofreader>(
+ xMSF->createInstanceWithArguments(aInfo.sGrammarImplName, aArgs), UNO_QUERY);
+
+ uno::Reference<XServiceDisplayName> xDispName(aInfo.xGrammar, UNO_QUERY);
+ if(xDispName.is())
+ aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale );
+
+ const Sequence< Locale > aLocales( aInfo.xGrammar->getLocales() );
+ //! suppress display of entries with no supported languages (see feature 110994)
+ if (aLocales.getLength())
+ {
+ lcl_MergeLocales( aAllServiceLocales, aLocales );
+ lcl_MergeDisplayArray( *this, aInfo );
+ }
+ }
+
//read hyphenator
Sequence< OUString > aHyphNames = xLinguSrvcMgr->getAvailableServices(
C2U(cHyph), Locale() );
@@ -863,6 +903,11 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
if (aCfgSvcs.getLength())
aCfgSpellTable[ nLang ] = aCfgSvcs;
+ aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cGrammar), pAllLocales[nLocale]);
+ SetChecked( aCfgSvcs );
+ if (aCfgSvcs.getLength())
+ aCfgGrammarTable[ nLang ] = aCfgSvcs;
+
aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cHyph), pAllLocales[nLocale]);
SetChecked( aCfgSvcs );
if (aCfgSvcs.getLength())
@@ -885,6 +930,7 @@ SvxLinguData_Impl::SvxLinguData_Impl( const SvxLinguData_Impl &rData ) :
aCfgSpellTable (rData.aCfgSpellTable),
aCfgHyphTable (rData.aCfgHyphTable),
aCfgThesTable (rData.aCfgThesTable),
+ aCfgGrammarTable (rData.aCfgGrammarTable),
xMSF (rData.xMSF),
xLinguSrvcMgr (rData.xLinguSrvcMgr)
{
@@ -900,6 +946,7 @@ SvxLinguData_Impl & SvxLinguData_Impl::operator = (const SvxLinguData_Impl &rDat
aCfgSpellTable = rData.aCfgSpellTable;
aCfgHyphTable = rData.aCfgHyphTable;
aCfgThesTable = rData.aCfgThesTable;
+ aCfgGrammarTable = rData.aCfgGrammarTable;
aDisplayServiceArr = rData.aDisplayServiceArr;
nDisplayServices = rData.nDisplayServices;
return *this;
@@ -927,6 +974,7 @@ void SvxLinguData_Impl::SetChecked(const Sequence<OUString>& rConfiguredServices
const OUString &rSrvcImplName = pConfiguredServices[n];
if (rSrvcImplName.getLength() &&
(pEntry->sSpellImplName == rSrvcImplName ||
+ pEntry->sGrammarImplName == rSrvcImplName ||
pEntry->sHyphImplName == rSrvcImplName ||
pEntry->sThesImplName == rSrvcImplName))
{
@@ -1011,6 +1059,22 @@ void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, BOOL bEnable
}
}
+ // update configured grammar checker entries
+ if (pInfo->xGrammar.is())
+ {
+ aLocales = pInfo->xGrammar->getLocales();
+ pLocale = aLocales.getConstArray();
+ nLocales = aLocales.getLength();
+ for (i = 0; i < nLocales; ++i)
+ {
+ INT16 nLang = SvxLocaleToLanguage( pLocale[i] );
+ if (!aCfgGrammarTable.count( nLang ) && bEnable)
+ aCfgGrammarTable[ nLang ] = Sequence< OUString >();
+ if (aCfgGrammarTable.count( nLang ))
+ AddRemove( aCfgGrammarTable[ nLang ], pInfo->sGrammarImplName, bEnable );
+ }
+ }
+
// update configured hyphenator entries
if (pInfo->xHyph.is())
{
@@ -1074,10 +1138,8 @@ SvxLinguTabPage::SvxLinguTabPage( Window* pParent,
sWordsWithDigits ( SVX_RES( STR_WORDS_WITH_DIGITS ) ),
sCapitalization ( SVX_RES( STR_CAPITALIZATION ) ),
sSpellSpecial ( SVX_RES( STR_SPELL_SPECIAL ) ),
- sAllLanguages ( SVX_RES( STR_ALL_LANGUAGES ) ),
sSpellAuto ( SVX_RES( STR_SPELL_AUTO ) ),
- sHideMarkings ( SVX_RES( STR_HIDE_MARKINGS ) ),
- sOldGerman ( SVX_RES( STR_OLD_GERMAN ) ),
+ sGrammarAuto ( SVX_RES( STR_GRAMMAR_AUTO ) ),
sNumMinWordlen ( SVX_RES( STR_NUM_MIN_WORDLEN ) ),
sNumPreBreak ( SVX_RES( STR_NUM_PRE_BREAK ) ),
sNumPostBreak ( SVX_RES( STR_NUM_POST_BREAK ) ),
@@ -1118,6 +1180,13 @@ SvxLinguTabPage::SvxLinguTabPage( Window* pParent,
RTL_CONSTASCII_STRINGPARAM( "http://extensions.services.openoffice.org/dictionary?cid=926386" ) ) );
aMoreDictsLink.SetClickHdl( LINK( this, SvxLinguTabPage, OpenURLHdl_Impl ) );
+
+ // 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())
@@ -1156,10 +1225,6 @@ SvxLinguTabPage::SvxLinguTabPage( Window* pParent,
pItem = NULL;
FreeResource();
-
- // force recalculation of hash value used for checking the need of updating
- // because new dictionaries might be installed / downloaded
- SvxLinguConfigUpdate::UpdateAll( sal_True );
}
// -----------------------------------------------------------------------
@@ -1216,8 +1281,8 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
LangImplNameTable::const_iterator aIt;
// update spellchecker configuration entries
- const LangImplNameTable &rTable1 = pLinguData->GetSpellTable();
- for (aIt = rTable1.begin(); aIt != rTable1.end(); ++aIt)
+ const LangImplNameTable *pTable = &pLinguData->GetSpellTable();
+ for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
{
INT16 nLang = aIt->first;
const Sequence< OUString > aImplNames( aIt->second );
@@ -1231,12 +1296,32 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
xMgr->setConfiguredServices( C2U(cSpell), aLocale, aImplNames );
}
+ // update grammar checker configuration entries
+ pTable = &pLinguData->GetGrammarTable();
+ for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
+ {
+ INT16 nLang = aIt->first;
+ const Sequence< OUString > aImplNames( aIt->second );
+#if OSL_DEBUG_LEVEL > 1
+ const OUString *pTmpStr;
+ pTmpStr = aImplNames.getConstArray();
+#endif
+ uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() );
+ Locale aLocale( SvxCreateLocale(nLang) );
+ if (xMgr.is())
+ xMgr->setConfiguredServices( C2U(cGrammar), aLocale, aImplNames );
+ }
+
// update hyphenator configuration entries
- const LangImplNameTable &rTable2 = pLinguData->GetHyphTable();
- for (aIt = rTable2.begin(); aIt != rTable2.end(); ++aIt)
+ pTable = &pLinguData->GetHyphTable();
+ for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
{
INT16 nLang = aIt->first;
const Sequence< OUString > aImplNames( aIt->second );
+#if OSL_DEBUG_LEVEL > 1
+ const OUString *pTmpStr;
+ pTmpStr = aImplNames.getConstArray();
+#endif
uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() );
Locale aLocale( SvxCreateLocale(nLang) );
if (xMgr.is())
@@ -1244,11 +1329,15 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
}
// update thesaurus configuration entries
- const LangImplNameTable &rTable3 = pLinguData->GetThesTable();
- for (aIt = rTable3.begin(); aIt != rTable3.end(); ++aIt)
+ pTable = &pLinguData->GetThesTable();
+ for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
{
INT16 nLang = aIt->first;
const Sequence< OUString > aImplNames( aIt->second );
+#if OSL_DEBUG_LEVEL > 1
+ const OUString *pTmpStr;
+ pTmpStr = aImplNames.getConstArray();
+#endif
uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() );
Locale aLocale( SvxCreateLocale(nLang) );
if (xMgr.is())
@@ -1302,8 +1391,6 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
aLngCfg.SetProperty( UPH_ACTIVE_DICTIONARIES, aTmp );
- BOOL bCheckAllLangChanged = FALSE;
-
nEntries = aLinguOptionsCLB.GetEntryCount();
for (USHORT j = 0; j < nEntries; ++j)
{
@@ -1312,11 +1399,6 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
OptionsUserData aData( (ULONG)pEntry->GetUserData() );
String aPropName( lcl_GetPropertyName( (EID_OPTIONS) aData.GetEntryId() ) );
- if (EID_ALL_LANGUAGES == (EID_OPTIONS) aData.GetEntryId())
- {
- bCheckAllLangChanged = aData.IsChecked() != aLinguOptionsCLB.IsChecked( j );
- }
-
Any aAny;
if (aData.IsCheckable())
{
@@ -1334,8 +1416,6 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
aLngCfg.SetProperty( aPropName, aAny );
}
- rCoreSet.Put( SfxBoolItem( SID_SPELL_MODIFIED, bCheckAllLangChanged ) );
-
SvLBoxEntry *pPreBreakEntry = aLinguOptionsCLB.GetEntry( (USHORT) EID_NUM_PRE_BREAK );
SvLBoxEntry *pPostBreakEntry = aLinguOptionsCLB.GetEntry( (USHORT) EID_NUM_POST_BREAK );
DBG_ASSERT( pPreBreakEntry, "NULL Pointer" );
@@ -1354,7 +1434,7 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
}
- // Autom. Rechtschreibung
+ // automatic spell checking
BOOL bNewAutoCheck = aLinguOptionsCLB.IsChecked( (USHORT) EID_SPELL_AUTO );
const SfxPoolItem* pOld = GetOldItem( rCoreSet, SID_AUTOSPELL_CHECK );
if ( !pOld || ( (SfxBoolItem*)pOld )->GetValue() != bNewAutoCheck )
@@ -1364,16 +1444,6 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
bModified |= sal_True;
}
- // pOld ist alte Wert wenn wert ge�ndert mit neuen Wert ins Item Set
- BOOL bNewMarkOff = aLinguOptionsCLB.IsChecked( (USHORT) EID_HIDE_MARKINGS );
- pOld = GetItem( rCoreSet, SID_AUTOSPELL_MARKOFF );
- if ( !pOld || ( (SfxBoolItem*)pOld )->GetValue() != bNewMarkOff )
- {
- rCoreSet.Put( SfxBoolItem( GetWhich( SID_AUTOSPELL_MARKOFF ),
- bNewMarkOff ) );
- bModified |= sal_True;
- }
-
return bModified;
}
@@ -1503,6 +1573,16 @@ void SvxLinguTabPage::Reset( const SfxItemSet& rSet )
pModel->Insert( pEntry );
lcl_SetCheckButton( pEntry, bVal );
+ pEntry = CreateEntry( sGrammarAuto, CBCOL_FIRST );
+ aLngCfg.GetProperty( C2U(UPN_IS_GRAMMAR_AUTO) ) >>= bVal;
+// const SfxPoolItem* pItem = GetItem( rSet, SID_AUTOSPELL_CHECK );
+// if (pItem)
+// bVal = ((SfxBoolItem *) pItem)->GetValue();
+ nUserData = OptionsUserData( EID_GRAMMAR_AUTO, FALSE, 0, TRUE, bVal).GetUserData();
+ pEntry->SetUserData( (void *)nUserData );
+ pModel->Insert( pEntry );
+ lcl_SetCheckButton( pEntry, bVal );
+
pEntry = CreateEntry( sCapitalWords, CBCOL_FIRST );
aLngCfg.GetProperty( C2U(UPN_IS_SPELL_UPPER_CASE) ) >>= bVal;
nUserData = OptionsUserData( EID_CAPITAL_WORDS, FALSE, 0, TRUE, bVal).GetUserData();
@@ -1531,30 +1611,6 @@ void SvxLinguTabPage::Reset( const SfxItemSet& rSet )
pModel->Insert( pEntry );
lcl_SetCheckButton( pEntry, bVal );
- pEntry = CreateEntry( sAllLanguages, CBCOL_FIRST );
- aLngCfg.GetProperty( C2U(UPN_IS_SPELL_IN_ALL_LANGUAGES) ) >>= bVal;
- nUserData = OptionsUserData( EID_ALL_LANGUAGES, FALSE, 0, TRUE, bVal).GetUserData();
- pEntry->SetUserData( (void *)nUserData );
- pModel->Insert( pEntry );
- lcl_SetCheckButton( pEntry, bVal );
-
- pEntry = CreateEntry( sHideMarkings, CBCOL_FIRST );
- aLngCfg.GetProperty( C2U(UPN_IS_SPELL_HIDE) ) >>= bVal;
- pItem = GetItem( rSet, SID_AUTOSPELL_MARKOFF );
- if (pItem)
- bVal = ((SfxBoolItem *) pItem)->GetValue();
- nUserData = OptionsUserData( EID_HIDE_MARKINGS, FALSE, 0, TRUE, bVal).GetUserData();
- pEntry->SetUserData( (void *)nUserData );
- pModel->Insert( pEntry );
- lcl_SetCheckButton( pEntry, bVal );
-
- pEntry = CreateEntry( sOldGerman, CBCOL_FIRST );
- aLngCfg.GetProperty( C2U(UPN_IS_GERMAN_PRE_REFORM) ) >>= bVal;
- nUserData = OptionsUserData( EID_OLD_GERMAN, FALSE, 0, TRUE, bVal).GetUserData();
- pEntry->SetUserData( (void *)nUserData );
- pModel->Insert( pEntry );
- lcl_SetCheckButton( pEntry, bVal );
-
pEntry = CreateEntry( sNumMinWordlen, CBCOL_SECOND );
aLngCfg.GetProperty( C2U(UPN_HYPH_MIN_WORD_LENGTH) ) >>= nVal;
nUserData = OptionsUserData( EID_NUM_MIN_WORDLEN, TRUE, (USHORT)nVal, FALSE, FALSE).GetUserData();
@@ -1691,6 +1747,8 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
INT16 nLang = SvxLocaleToLanguage( pAllLocales[k] );
if (pLinguData->GetSpellTable().count( nLang ))
pLinguData->SetChecked( pLinguData->GetSpellTable()[ nLang ] );
+ if (pLinguData->GetGrammarTable().count( nLang ))
+ pLinguData->SetChecked( pLinguData->GetGrammarTable()[ nLang ] );
if (pLinguData->GetHyphTable().count( nLang ))
pLinguData->SetChecked( pLinguData->GetHyphTable()[ nLang ] );
if (pLinguData->GetThesTable().count( nLang ))
@@ -1984,6 +2042,7 @@ SvxEditModulesDlg::SvxEditModulesDlg(Window* pParent, SvxLinguData_Impl& rData)
sSpell ( SVX_RES( ST_SPELL ) ),
sHyph ( SVX_RES( ST_HYPH ) ),
sThes ( SVX_RES( ST_THES ) ),
+ sGrammar ( SVX_RES( ST_GRAMMAR ) ),
rLinguData ( rData )
{
pCheckButtonData = NULL;
@@ -2143,9 +2202,10 @@ OUString lcl_GetServiceName(BYTE nType)
{
switch(nType)
{
- case TYPE_SPELL: return C2U(cSpell);
- case TYPE_HYPH: return C2U(cHyph);
- case TYPE_THES: return C2U(cThes);
+ case TYPE_SPELL : return C2U(cSpell);
+ case TYPE_GRAMMAR : return C2U(cGrammar);
+ case TYPE_HYPH : return C2U(cHyph);
+ case TYPE_THES : return C2U(cThes);
}
return OUString();
}
@@ -2182,9 +2242,10 @@ IMPL_LINK( SvxEditModulesDlg, LangSelectHdl_Impl, ListBox *, pBox )
BYTE nType = pData->GetType();
switch (nType - 1)
{
- case TYPE_SPELL : pTable = &rLinguData.GetSpellTable(); break;
- case TYPE_HYPH : pTable = &rLinguData.GetHyphTable(); break;
- case TYPE_THES : pTable = &rLinguData.GetThesTable(); break;
+ case TYPE_SPELL : pTable = &rLinguData.GetSpellTable(); break;
+ case TYPE_GRAMMAR : pTable = &rLinguData.GetGrammarTable(); break;
+ case TYPE_HYPH : pTable = &rLinguData.GetHyphTable(); break;
+ case TYPE_THES : pTable = &rLinguData.GetThesTable(); break;
}
if (pTable)
{
@@ -2274,6 +2335,50 @@ IMPL_LINK( SvxEditModulesDlg, LangSelectHdl_Impl, ListBox *, pBox )
}
//
+ // grammar checker entries
+ //
+ pEntry = CreateEntry( sGrammar, CBCOL_SECOND );
+ pUserData = new ModuleUserData_Impl( String(), TRUE, FALSE, TYPE_GRAMMAR, 0 );
+ pEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pEntry );
+ //
+ aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_GRAMMAR );
+ pName = aNames.getConstArray();
+ nNames = (ULONG) aNames.getLength();
+ nLocalIndex = 0;
+ for (n = 0; n < nNames; ++n)
+ {
+ OUString aImplName;
+ BOOL bIsSuppLang = FALSE;
+
+ pInfo = rLinguData.GetInfoByImplName( pName[n] );
+ if (pInfo)
+ {
+ bIsSuppLang = pInfo->xGrammar.is() &&
+ pInfo->xGrammar->hasLocale( aCurLocale );
+ aImplName = pInfo->sGrammarImplName;
+ }
+ if (aImplName.getLength() && bIsSuppLang)
+ {
+ String aTxt( pInfo->sDisplayName );
+ SvLBoxEntry* pNewEntry = CreateEntry( aTxt, CBCOL_FIRST );
+
+ LangImplNameTable &rTable = rLinguData.GetGrammarTable();
+ const bool bHasLang = rTable.count( eCurLanguage );
+ if (!bHasLang)
+ {
+ DBG_WARNING( "language entry missing" ); // only relevant if all languages found should be supported
+ }
+ const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0;
+ lcl_SetCheckButton( pNewEntry, bCheck );
+ pUserData = new ModuleUserData_Impl( aImplName, FALSE,
+ bCheck, TYPE_GRAMMAR, (BYTE)nLocalIndex++ );
+ pNewEntry->SetUserData( (void *)pUserData );
+ pModel->Insert( pNewEntry );
+ }
+ }
+
+ //
// hyphenator entries
//
pEntry = CreateEntry( sHyph, CBCOL_SECOND );
diff --git a/svx/source/options/optlingu.hrc b/svx/source/options/optlingu.hrc
index 2f6d220fa64a..73b481cbb6a3 100644
--- a/svx/source/options/optlingu.hrc
+++ b/svx/source/options/optlingu.hrc
@@ -45,10 +45,7 @@
#define STR_WORDS_WITH_DIGITS 202
#define STR_CAPITALIZATION 203
#define STR_SPELL_SPECIAL 204
-#define STR_ALL_LANGUAGES 205
#define STR_SPELL_AUTO 206
-#define STR_HIDE_MARKINGS 207
-#define STR_OLD_GERMAN 208
#define STR_NUM_PRE_BREAK 209
#define STR_NUM_POST_BREAK 210
#define STR_HYPH_AUTO 211
diff --git a/svx/source/options/optlingu.src b/svx/source/options/optlingu.src
index c6afb7dfc2f1..a550451193f2 100644
--- a/svx/source/options/optlingu.src
+++ b/svx/source/options/optlingu.src
@@ -309,10 +309,6 @@ TabPage RID_SFXPAGE_LINGU
{
Text [ en-US ] = "Check special regions";
};
- String STR_ALL_LANGUAGES
- {
- Text [ en-US ] = "Check in all languages";
- };
String STR_SPELL_AUTO
{
Text [ en-US ] = "Check spelling as you type";
@@ -321,14 +317,6 @@ TabPage RID_SFXPAGE_LINGU
{
Text [ en-US ] = "Check grammar as you type";
};
- String STR_HIDE_MARKINGS
- {
- Text [ en-US ] = "Do not mark errors";
- };
- String STR_OLD_GERMAN
- {
- Text [ en-US ] = "German spelling - old";
- };
String STR_NUM_MIN_WORDLEN
{
Text [ en-US ] = "Minimal number of characters for hyphenation: ";
diff --git a/svx/source/outliner/outlin2.cxx b/svx/source/outliner/outlin2.cxx
index f22a244fc8ec..eb435ca6ae7f 100644
--- a/svx/source/outliner/outlin2.cxx
+++ b/svx/source/outliner/outlin2.cxx
@@ -794,6 +794,13 @@ bool Outliner::SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill,
{
return pEditEngine->SpellSentence(rEditView, rToFill, bIsGrammarChecking );
}
+/*-- 08.09.2008 11:39:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void Outliner::PutSpellingToSentenceStart( EditView& rEditView )
+{
+ pEditEngine->PutSpellingToSentenceStart( rEditView );
+}
/*-- 13.10.2003 16:56:25---------------------------------------------------
-----------------------------------------------------------------------*/
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 596b37096f58..5ff91a10a9dd 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2085,10 +2085,7 @@ GDIMetaFile* SdrTextObj::GetTextScrollMetaFileAndRectangle(
pRetval->Record(&aBlackHole);
Point aPaintPos = aPaintRect.TopLeft();
- sal_uInt32 nStat0(rOutliner.GetControlWord());
- rOutliner.SetControlWord(nStat0|EE_CNTRL_NOREDLINES);
rOutliner.Draw(&aBlackHole, aPaintPos);
- rOutliner.SetControlWord(nStat0);
pRetval->Stop();
pRetval->WindStart();
diff --git a/svx/uiconfig/layout/delzip b/svx/uiconfig/layout/delzip
deleted file mode 100644
index 7b4d68d70fca..000000000000
--- a/svx/uiconfig/layout/delzip
+++ /dev/null
@@ -1 +0,0 @@
-empty \ No newline at end of file
diff --git a/svx/uiconfig/layout/layout.mk b/svx/uiconfig/layout/layout.mk
deleted file mode 100644
index f6bea876d898..000000000000
--- a/svx/uiconfig/layout/layout.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# TODO: move to solenv/inc
-# copies: sw/uiconfig/layout svx/uiconfig/layout
-
-TRALAY=tralay
-XML_DEST=$(DLLDEST)
-XML_LANGS=$(alllangiso)
-
-ALL_XMLS=$(foreach,i,$(XML_FILES) $(XML_DEST)/$i) $(foreach,i,$(XML_LANGS) $(foreach,j,$(XML_FILES) $(XML_DEST)/$i/$j))
-
-# Must remove the -j (no duplicate base file names) flag
-ZIPUPDATE=-u
-XML_ZIP = $(PRJNAME)-layout
-
-ALLTAR: $(XML_ZIP)
-
-$(XML_ZIP): $(ALL_XMLS)
-
-ZIP1DIR=$(XML_DEST)
-ZIP1TARGET=$(XML_ZIP)
-ZIP1LIST=$(ALL_XMLS:s@$(XML_DEST)/@@)
-
-$(foreach,i,$(XML_LANGS) $(XML_DEST)/$i/%.xml): %.xml
- -$(MKDIR) $(@:d)
- @echo $(foreach,i,$(XML_LANGS) $(XML_DEST)/$i/%.xml): %.xml
- $(TRALAY) -m localize.sdf -o $(XML_DEST) -l $(XML_LANGS:f:t" -l ") $<
-
-$(XML_DEST)/%.xml: %.xml
- -$(MKDIR) $(@:d)
- $(COPY) $< $@
-
-# Don't want to overwrite filled localize.sdf with empty template
-template.sdf:
- $(foreach,i,$(XML_FILES) $(TRALAY) -l en-US $i) > $@
diff --git a/svx/uiconfig/layout/makefile.mk b/svx/uiconfig/layout/makefile.mk
deleted file mode 100644
index d22d6eb10308..000000000000
--- a/svx/uiconfig/layout/makefile.mk
+++ /dev/null
@@ -1,50 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2008 by Sun Microsystems, Inc.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.2 $
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=../..
-PRJNAME=svx
-TARGET=layout
-
-.INCLUDE : settings.mk
-
-.IF "$(ENABLE_LAYOUT)" == "TRUE"
-
-all: ALLTAR
-
-XML_FILES=zoom.xml
-
-.INCLUDE : layout.mk
-
-.ELSE # ENABLE_LAYOUT != TRUE
-all .PHONY:
-.ENDIF # ENABLE_LAYOUT != TRUE
-
-.INCLUDE : target.mk
diff --git a/svx/uiconfig/layout/zoom.xml b/svx/uiconfig/layout/zoom.xml
deleted file mode 100644
index 78e30ee11dfd..000000000000
--- a/svx/uiconfig/layout/zoom.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- This is a template. i18n translation is not performed in-place;
- i18n translated xml files are generated from this template by
- transex3/layout/tralay. !-->
-
-<modaldialog xmlns="http://openoffice.org/2007/layout"
- xmlns:cnt="http://openoffice.org/2007/layout/container"
- id="RID_SVXDLG_ZOOM" _title="Zoom &amp; View Layout" optimumsize="true"
- help-id="SID_ATTR_ZOOM"
- has_border="true" sizeable="true" moveable="true">
- <vbox spacing="5" border="5">
- <hbox spacing="0" border="0">
- <vbox spacing="5" border="5">
- <fixedline id="FL_ZOOM" _text="Zoom factor" cnt:expand="true"/>
- <radiobutton radiogroup="zoom" id="BTN_OPTIMAL" _label="Optimal"/>
- <radiobutton radiogroup="zoom" id="BTN_WHOLE_PAGE" _label="Whole Page"/>
- <radiobutton radiogroup="zoom" id="BTN_PAGE_WIDTH" _label="Page Width"/>
- <radiobutton radiogroup="zoom" id="BTN_100" _label="100 %"/>
- <hbox cnt:expand="false" cnt:fill="true">
- <align cnt:expand="false" cnt:fill="true">
- <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_USER" _label="Variable"/>
- </align>
- <flow cnt:padding="10" cnt:expand="false"/>
- <metricfield id="ED_USER" value-step="1"
- repeat="true" has_border="true" spin="true"
- _text="100%" unit="11" custom-unit-text="%"
- right="true"
- cnt:expand="false"/>
- </hbox>
- </vbox>
- <vbox spacing="5" border="5">
- <fixedline id="FL_VIEWLAYOUT" _text="View layout" cnt:expand="true"/>
- <radiobutton radiogroup="zoom" id="BTN_AUTOMATIC" _label="~Automatic"/>
- <radiobutton radiogroup="zoom" id="BTN_SINGLE" _label="~Single page"/>
- <hbox cnt:expand="false" cnt:fill="true">
- <align cnt:expand="false" cnt:fill="true">
- <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_COLUMNS" _label="~Columns"/>
- </align>
- <flow cnt:padding="10" cnt:expand="false"/>
- <metricfield id="ED_COLUMNS" value-step="1"
- repeat="true" has_border="true" spin="true"
- _text="100%"
- right="true"
- spin-value-min="1"
- spin-value="1"
- cnt:expand="false"/>
- </hbox>
- <hbox><flow cnt:expand="false" cnt:padding="10"/><checkbox id="CHK_BOOK" _label="~Book mode"/></hbox>
- </vbox>
- </hbox>
- <fixedline cnt:padding="1" id="FL_BOTTOM"/>
- <dialogbuttonhbox border="5" spacing="5">
- <flow/>
- <okbutton id="BTN_ZOOM_OK"/>
- <cancelbutton id="BTN_ZOOM_CANCEL"/>
- <helpbutton id="BTN_ZOOM_HELP"/>
- </dialogbuttonhbox>
- </vbox>
-</modaldialog>
diff --git a/svx/util/hidother.src b/svx/util/hidother.src
index 5fe6005343cb..ea18f2c0ee97 100644
--- a/svx/util/hidother.src
+++ b/svx/util/hidother.src
@@ -308,6 +308,7 @@ hidspecial HID_REDLINING_VIEW_DG_VIEW_HEADER { HelpID = HID_REDLINING_VIEW_DG
hidspecial HID_SPLDLG_BUTTON_CLOSE { HelpID = HID_SPLDLG_BUTTON_CLOSE ; };
hidspecial HID_SPLDLG_BUTTON_IGNORE { HelpID = HID_SPLDLG_BUTTON_IGNORE ; };
hidspecial HID_SPLDLG_BUTTON_IGNOREALL { HelpID = HID_SPLDLG_BUTTON_IGNOREALL ; };
+hidspecial HID_SPLDLG_BUTTON_IGNORERULE { HelpID = HID_SPLDLG_BUTTON_IGNORERULE ; };
hidspecial HID_SPLDLG_BUTTON_CHANGE { HelpID = HID_SPLDLG_BUTTON_CHANGE ; };
hidspecial HID_SPLDLG_BUTTON_CHANGEALL { HelpID = HID_SPLDLG_BUTTON_CHANGEALL ; };
hidspecial HID_SPLDLG_BUTTON_EXPLAIN { HelpID = HID_SPLDLG_BUTTON_EXPLAIN ; };