summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-02-04 16:18:01 +0200
committerNoel Grandin <noel@peralex.com>2013-02-12 10:14:43 +0200
commit53ec703c14470cb18845fc4483ec36c13b0d744e (patch)
tree4cde768b9b70c00e34801680ac6bcc4a889c5489 /linguistic
parenta6a8a8707b6ae111f94bac094d3c2909f523ca6f (diff)
fdo#46808, Adapt linguistic2::DictionaryList UNO service to new style
Change-Id: Iaf81a38063411b8a003b78f7eb7d6aab6c9df292
Diffstat (limited to 'linguistic')
-rw-r--r--linguistic/inc/iprcache.hxx6
-rw-r--r--linguistic/inc/linguistic/misc.hxx8
-rw-r--r--linguistic/inc/linguistic/spelldta.hxx5
-rw-r--r--linguistic/source/dlistimp.cxx2
-rw-r--r--linguistic/source/hyphdsp.hxx4
-rw-r--r--linguistic/source/iprcache.cxx6
-rw-r--r--linguistic/source/lngsvcmgr.cxx6
-rw-r--r--linguistic/source/misc.cxx50
-rw-r--r--linguistic/source/spelldsp.cxx6
-rw-r--r--linguistic/source/spelldsp.hxx2
-rw-r--r--linguistic/source/spelldta.cxx4
11 files changed, 48 insertions, 51 deletions
diff --git a/linguistic/inc/iprcache.hxx b/linguistic/inc/iprcache.hxx
index c31724a8aa7b..9f67ed29c0b7 100644
--- a/linguistic/inc/iprcache.hxx
+++ b/linguistic/inc/iprcache.hxx
@@ -29,7 +29,7 @@
#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 <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
#include <rtl/string.hxx>
#include <i18npool/lang.h>
@@ -59,7 +59,7 @@ class FlushListener :
>
{
::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryList > xDicList;
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > xPropSet;
Flushable *pFlushObj;
@@ -74,7 +74,7 @@ public:
inline void SetFlushObj( Flushable *pFO) { pFlushObj = pFO; }
- void SetDicList( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryList > &rDL );
+ void SetDicList( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > &rDL );
void SetPropSet( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &rPS );
//XEventListener
diff --git a/linguistic/inc/linguistic/misc.hxx b/linguistic/inc/linguistic/misc.hxx
index df5e1eedc78c..aa6a3223918a 100644
--- a/linguistic/inc/linguistic/misc.hxx
+++ b/linguistic/inc/linguistic/misc.hxx
@@ -58,7 +58,6 @@ class LocaleDataWrapper;
#define SN_HYPHENATOR "com.sun.star.linguistic2.Hyphenator"
#define SN_THESAURUS "com.sun.star.linguistic2.Thesaurus"
#define SN_LINGU_PROPERTIES "com.sun.star.linguistic2.LinguProperties"
-#define SN_DICTIONARY_LIST "com.sun.star.linguistic2.DictionaryList"
namespace linguistic
@@ -153,8 +152,7 @@ LNG_DLLPUBLIC sal_Bool IsNumeric( const String &rText );
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetOneInstanceService( const char *pServiceName );
LNG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetLinguProperties();
-::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > GetSearchableDictionaryList();
-::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryList > GetDictionaryList();
+::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDictionaryList();
::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetIgnoreAllList();
@@ -169,7 +167,7 @@ sal_Bool IsIgnoreControlChars( const ::com::sun::star::beans::PropertyValues &rP
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XDictionaryEntry >
SearchDicList(
- const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryList >& rDicList,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList >& rDicList,
const ::rtl::OUString& rWord, sal_Int16 nLanguage,
sal_Bool bSearchPosDics, sal_Bool bSearchSpellEntry );
@@ -179,7 +177,7 @@ LNG_DLLPUBLIC sal_uInt8 AddEntryToDic(
const ::rtl::OUString &rRplcTxt, sal_Int16 nRplcLang,
sal_Bool bStripDot = sal_True );
-LNG_DLLPUBLIC sal_Bool SaveDictionaries( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryList > &xDicList );
+LNG_DLLPUBLIC sal_Bool SaveDictionaries( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > &xDicList );
// AppExitLstnr:
// virtual base class that calls it AtExit function when the application
diff --git a/linguistic/inc/linguistic/spelldta.hxx b/linguistic/inc/linguistic/spelldta.hxx
index 8eec9c19f5a9..220a406e9dd9 100644
--- a/linguistic/inc/linguistic/spelldta.hxx
+++ b/linguistic/inc/linguistic/spelldta.hxx
@@ -23,6 +23,7 @@
#include <vector>
#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
#include <com/sun/star/linguistic2/XSetSpellAlternatives.hpp>
+#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
#include <tools/solar.h>
@@ -51,7 +52,7 @@ namespace linguistic
void SeqRemoveNegEntries(
::com::sun::star::uno::Sequence< ::rtl::OUString > &rSeq,
::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryList > &rxDicList,
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > &rxDicList,
sal_Int16 nLanguage );
sal_Bool SeqHasEntry(
@@ -62,7 +63,7 @@ sal_Bool SeqHasEntry(
void SearchSimilarText( const rtl::OUString &rText, sal_Int16 nLanguage,
::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryList > &xDicList,
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > &xDicList,
std::vector< rtl::OUString > & rDicListProps );
///////////////////////////////////////////////////////////////////////////
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index ba9c6a34a004..f447738b2167 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -772,7 +772,7 @@ uno::Sequence< rtl::OUString > DicList::getSupportedServiceNames_Static() throw(
osl::MutexGuard aGuard( GetLinguMutex() );
uno::Sequence< rtl::OUString > aSNS( 1 ); // more than 1 service possible
- aSNS.getArray()[0] = SN_DICTIONARY_LIST;
+ aSNS.getArray()[0] = "com.sun.star.linguistic2.DictionaryList";
return aSNS;
}
diff --git a/linguistic/source/hyphdsp.hxx b/linguistic/source/hyphdsp.hxx
index d6e81920603e..a770f5fe9262 100644
--- a/linguistic/source/hyphdsp.hxx
+++ b/linguistic/source/hyphdsp.hxx
@@ -57,7 +57,7 @@ class HyphenatorDispatcher :
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > xPropSet;
::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
LngSvcMgr &rMgr;
@@ -152,7 +152,7 @@ inline ::com::sun::star::uno::Reference<
HyphenatorDispatcher::GetDicList()
{
return xDicList.is() ?
- xDicList : xDicList = ::linguistic::GetSearchableDictionaryList();
+ xDicList : xDicList = ::linguistic::GetDictionaryList();
}
diff --git a/linguistic/source/iprcache.cxx b/linguistic/source/iprcache.cxx
index 436859281338..513c419f3b4c 100644
--- a/linguistic/source/iprcache.cxx
+++ b/linguistic/source/iprcache.cxx
@@ -111,7 +111,7 @@ FlushListener::~FlushListener()
}
-void FlushListener::SetDicList( Reference<XDictionaryList> &rDL )
+void FlushListener::SetDicList( Reference<XSearchableDictionaryList> &rDL )
{
MutexGuard aGuard( GetLinguMutex() );
@@ -206,7 +206,7 @@ SpellCache::SpellCache()
{
pFlushLstnr = new FlushListener( this );
xFlushLstnr = pFlushLstnr;
- Reference<XDictionaryList> aDictionaryList(GetDictionaryList());
+ Reference<XSearchableDictionaryList> aDictionaryList(GetDictionaryList());
pFlushLstnr->SetDicList( aDictionaryList ); //! after reference is established
Reference<XPropertySet> aPropertySet(GetLinguProperties());
pFlushLstnr->SetPropSet( aPropertySet ); //! after reference is established
@@ -214,7 +214,7 @@ SpellCache::SpellCache()
SpellCache::~SpellCache()
{
- Reference<XDictionaryList> aEmptyList;
+ Reference<XSearchableDictionaryList> aEmptyList;
Reference<XPropertySet> aEmptySet;
pFlushLstnr->SetDicList( aEmptyList );
pFlushLstnr->SetPropSet( aEmptySet );
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index fefef1cdc009..abce09198e26 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -185,7 +185,7 @@ class LngSvcMgrListenerHelper :
::cppu::OInterfaceContainerHelper aLngSvcMgrListeners;
::cppu::OInterfaceContainerHelper aLngSvcEvtBroadcasters;
- uno::Reference< linguistic2::XDictionaryList > xDicList;
+ uno::Reference< linguistic2::XSearchableDictionaryList > xDicList;
sal_Int16 nCombinedLngSvcEvt;
@@ -199,7 +199,7 @@ class LngSvcMgrListenerHelper :
public:
LngSvcMgrListenerHelper( LngSvcMgr &rLngSvcMgr,
- const uno::Reference< linguistic2::XDictionaryList > &rxDicList );
+ const uno::Reference< linguistic2::XSearchableDictionaryList > &rxDicList );
// lang::XEventListener
virtual void SAL_CALL
@@ -233,7 +233,7 @@ public:
LngSvcMgrListenerHelper::LngSvcMgrListenerHelper(
LngSvcMgr &rLngSvcMgr,
- const uno::Reference< linguistic2::XDictionaryList > &rxDicList ) :
+ const uno::Reference< linguistic2::XSearchableDictionaryList > &rxDicList ) :
rMyManager ( rLngSvcMgr ),
aLngSvcMgrListeners ( GetLinguMutex() ),
aLngSvcEvtBroadcasters ( GetLinguMutex() ),
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 266013188728..333a6ffb6315 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -37,7 +37,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/linguistic2/DictionaryType.hpp>
-#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
+#include <com/sun/star/linguistic2/DictionaryList.hpp>
#include <comphelper/processfactory.hxx>
#include <unotools/localedatawrapper.hxx>
#include <unotools/syslocale.hxx>
@@ -273,7 +273,7 @@ static sal_Bool lcl_HasHyphInfo( const uno::Reference<XDictionaryEntry> &xEntry
uno::Reference< XDictionaryEntry > SearchDicList(
- const uno::Reference< XDictionaryList > &xDicList,
+ const uno::Reference< XSearchableDictionaryList > &xDicList,
const OUString &rWord, sal_Int16 nLanguage,
sal_Bool bSearchPosDics, sal_Bool bSearchSpellEntry )
{
@@ -321,7 +321,7 @@ uno::Reference< XDictionaryEntry > SearchDicList(
}
-sal_Bool SaveDictionaries( const uno::Reference< XDictionaryList > &xDicList )
+sal_Bool SaveDictionaries( const uno::Reference< XSearchableDictionaryList > &xDicList )
{
if (!xDicList.is())
return sal_True;
@@ -747,21 +747,15 @@ uno::Reference< XInterface > GetOneInstanceService( const char *pServiceName )
{
uno::Reference< XInterface > xRef;
- if (pServiceName)
+ uno::Reference< XMultiServiceFactory > xMgr(
+ comphelper::getProcessServiceFactory() );
+ try
{
- uno::Reference< XMultiServiceFactory > xMgr(
- comphelper::getProcessServiceFactory() );
- if (xMgr.is())
- {
- try
- {
- xRef = xMgr->createInstance( ::rtl::OUString::createFromAscii( pServiceName ) );
- }
- catch (uno::Exception &)
- {
- DBG_ASSERT( 0, "createInstance failed" );
- }
- }
+ xRef = xMgr->createInstance( ::rtl::OUString::createFromAscii( pServiceName ) );
+ }
+ catch (const uno::Exception &)
+ {
+ DBG_ASSERT( 0, "createInstance failed" );
}
return xRef;
@@ -773,22 +767,26 @@ uno::Reference< XPropertySet > GetLinguProperties()
GetOneInstanceService( SN_LINGU_PROPERTIES ), UNO_QUERY );
}
-uno::Reference< XSearchableDictionaryList > GetSearchableDictionaryList()
+uno::Reference< XSearchableDictionaryList > GetDictionaryList()
{
- return uno::Reference< XSearchableDictionaryList > (
- GetOneInstanceService( SN_DICTIONARY_LIST ), UNO_QUERY );
-}
+ uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
+ uno::Reference< XSearchableDictionaryList > xRef;
+ try
+ {
+ xRef = DictionaryList::create(xContext);
+ }
+ catch (const uno::Exception &)
+ {
+ DBG_ASSERT( 0, "createInstance failed" );
+ }
-uno::Reference< XDictionaryList > GetDictionaryList()
-{
- return uno::Reference< XDictionaryList > (
- GetOneInstanceService( SN_DICTIONARY_LIST ), UNO_QUERY );
+ return xRef;
}
uno::Reference< XDictionary > GetIgnoreAllList()
{
uno::Reference< XDictionary > xRes;
- uno::Reference< XDictionaryList > xDL( GetDictionaryList() );
+ uno::Reference< XSearchableDictionaryList > xDL( GetDictionaryList() );
if (xDL.is())
xRes = xDL->getDictionaryByName( "IgnoreAllList" );
return xRes;
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 5b6727f2e9c2..d44cbdfeee20 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -261,7 +261,7 @@ static Reference< XDictionaryEntry > lcl_GetRulingDictionaryEntry(
xRes = xIgnoreAll->getEntry( rWord );
if (!xRes.is())
{
- Reference< XDictionaryList > xDList( GetDictionaryList() );
+ Reference< XSearchableDictionaryList > xDList( GetDictionaryList() );
Reference< XDictionaryEntry > xNegEntry( SearchDicList( xDList,
rWord, nLanguage, sal_False, sal_True ) );
if (xNegEntry.is())
@@ -646,9 +646,9 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
aProposalList.Append( xRes->getAlternatives() );
eFailureType = xRes->getFailureType();
}
- Reference< XDictionaryList > xDList;
+ Reference< XSearchableDictionaryList > xDList;
if (GetDicList().is() && IsUseDicList( rProperties, GetPropSet() ))
- xDList = Reference< XDictionaryList >( GetDicList(), UNO_QUERY );
+ xDList = GetDicList();
// cross-check against results from user-dictionaries which have precedence!
if (bCheckDics && xDList.is())
diff --git a/linguistic/source/spelldsp.hxx b/linguistic/source/spelldsp.hxx
index 888652ef0976..4fef68d97351 100644
--- a/linguistic/source/spelldsp.hxx
+++ b/linguistic/source/spelldsp.hxx
@@ -150,7 +150,7 @@ inline ::com::sun::star::uno::Reference<
SpellCheckerDispatcher::GetDicList()
{
return xDicList.is() ?
- xDicList : xDicList = linguistic::GetSearchableDictionaryList();
+ xDicList : xDicList = linguistic::GetDictionaryList();
}
diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx
index 886af7072522..37089bff5d64 100644
--- a/linguistic/source/spelldta.cxx
+++ b/linguistic/source/spelldta.cxx
@@ -62,7 +62,7 @@ sal_Bool SeqHasEntry(
void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage,
- Reference< XDictionaryList > &xDicList,
+ Reference< XSearchableDictionaryList > &xDicList,
std::vector< OUString > & rDicListProps )
{
if (!xDicList.is())
@@ -108,7 +108,7 @@ void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage,
void SeqRemoveNegEntries( Sequence< OUString > &rSeq,
- Reference< XDictionaryList > &rxDicList,
+ Reference< XSearchableDictionaryList > &rxDicList,
sal_Int16 nLanguage )
{
static const OUString aEmpty;