xref: /aoo41x/main/linguistic/source/lngopt.cxx (revision 3b8558fd)
1*3b8558fdSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3b8558fdSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3b8558fdSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3b8558fdSAndrew Rist  * distributed with this work for additional information
6*3b8558fdSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3b8558fdSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3b8558fdSAndrew Rist  * "License"); you may not use this file except in compliance
9*3b8558fdSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*3b8558fdSAndrew Rist  *
11*3b8558fdSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*3b8558fdSAndrew Rist  *
13*3b8558fdSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3b8558fdSAndrew Rist  * software distributed under the License is distributed on an
15*3b8558fdSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3b8558fdSAndrew Rist  * KIND, either express or implied.  See the License for the
17*3b8558fdSAndrew Rist  * specific language governing permissions and limitations
18*3b8558fdSAndrew Rist  * under the License.
19*3b8558fdSAndrew Rist  *
20*3b8558fdSAndrew Rist  *************************************************************/
21*3b8558fdSAndrew Rist 
22*3b8558fdSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_linguistic.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "lngopt.hxx"
28cdf0e10cSrcweir #include "linguistic/lngprops.hxx"
29cdf0e10cSrcweir #include "linguistic/misc.hxx"
30cdf0e10cSrcweir #include <tools/debug.hxx>
31cdf0e10cSrcweir #include <unotools/lingucfg.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <uno/lbnames.h>			// CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
34cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>	// helper for implementations
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <cppuhelper/factory.hxx>	// helper for factories
37cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
38cdf0e10cSrcweir #include <com/sun/star/registry/XSimpleRegistry.hpp>
39cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp>
40cdf0e10cSrcweir #include <com/sun/star/lang/Locale.hpp>
41cdf0e10cSrcweir #include <com/sun/star/i18n/ScriptType.hpp>
42cdf0e10cSrcweir #include <unotools/processfactory.hxx>
43cdf0e10cSrcweir #include <i18npool/mslangid.hxx>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir using namespace utl;
46cdf0e10cSrcweir using namespace osl;
47cdf0e10cSrcweir using namespace rtl;
48cdf0e10cSrcweir using namespace com::sun::star;
49cdf0e10cSrcweir using namespace com::sun::star::container;
50cdf0e10cSrcweir using namespace com::sun::star::beans;
51cdf0e10cSrcweir using namespace com::sun::star::lang;
52cdf0e10cSrcweir using namespace com::sun::star::uno;
53cdf0e10cSrcweir using namespace com::sun::star::linguistic2;
54cdf0e10cSrcweir using namespace linguistic;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir using namespace com::sun::star::registry;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 
61cdf0e10cSrcweir // static member intialization
62cdf0e10cSrcweir SvtLinguOptions *	LinguOptions::pData	= NULL;
63cdf0e10cSrcweir vos::ORefCount		LinguOptions::aRefCount;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
LinguOptions()66cdf0e10cSrcweir LinguOptions::LinguOptions()
67cdf0e10cSrcweir {
68cdf0e10cSrcweir 	if (!pData)
69cdf0e10cSrcweir 	{
70cdf0e10cSrcweir 		pData = new SvtLinguOptions;
71cdf0e10cSrcweir 		SvtLinguConfig aLinguCfg;
72cdf0e10cSrcweir 		aLinguCfg.GetOptions( *pData );
73cdf0e10cSrcweir 	}
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	++aRefCount;
76cdf0e10cSrcweir }
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 
LinguOptions(const LinguOptions &)79cdf0e10cSrcweir LinguOptions::LinguOptions(const LinguOptions & /*rOpt*/)
80cdf0e10cSrcweir {
81cdf0e10cSrcweir 	DBG_ASSERT( pData, "lng : data missing" );
82cdf0e10cSrcweir 	++aRefCount;
83cdf0e10cSrcweir }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 
~LinguOptions()86cdf0e10cSrcweir LinguOptions::~LinguOptions()
87cdf0e10cSrcweir {
88cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 	if (--aRefCount == 0)
91cdf0e10cSrcweir 	{
92cdf0e10cSrcweir 		delete pData;	pData  = NULL;
93cdf0e10cSrcweir 	}
94cdf0e10cSrcweir }
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 
SetLocale_Impl(sal_Int16 & rLanguage,Any & rOld,const Any & rVal,sal_Int16 nType)97cdf0e10cSrcweir sal_Bool LinguOptions::SetLocale_Impl( sal_Int16 &rLanguage, Any &rOld, const Any &rVal, sal_Int16 nType)
98cdf0e10cSrcweir {
99cdf0e10cSrcweir 	sal_Bool bRes = sal_False;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	Locale	aNew;
102cdf0e10cSrcweir 	rVal >>= aNew;
103cdf0e10cSrcweir         sal_Int16 nNew = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aNew), nType);
104cdf0e10cSrcweir 	if (nNew != rLanguage)
105cdf0e10cSrcweir 	{
106cdf0e10cSrcweir 		Locale	aLocale( CreateLocale( rLanguage ) );
107cdf0e10cSrcweir 		rOld.setValue( &aLocale, ::getCppuType((Locale*)0 ));
108cdf0e10cSrcweir 		rLanguage = nNew;
109cdf0e10cSrcweir 		bRes = sal_True;
110cdf0e10cSrcweir 	}
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 	return bRes;
113cdf0e10cSrcweir }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 
SetValue(Any & rOld,const Any & rVal,sal_Int32 nWID)116cdf0e10cSrcweir sal_Bool LinguOptions::SetValue( Any &rOld, const Any &rVal, sal_Int32 nWID )
117cdf0e10cSrcweir {
118cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	sal_Bool bRes = sal_False;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	sal_Int16 *pnVal = 0;
123cdf0e10cSrcweir 	sal_Bool  *pbVal = 0;
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	switch( nWID )
126cdf0e10cSrcweir 	{
127cdf0e10cSrcweir         case WID_IS_GERMAN_PRE_REFORM :     /*! deprecated !*/ break;
128cdf0e10cSrcweir 		case WID_IS_USE_DICTIONARY_LIST :	pbVal = &pData->bIsUseDictionaryList;	break;
129cdf0e10cSrcweir 		case WID_IS_IGNORE_CONTROL_CHARACTERS :	pbVal = &pData->bIsIgnoreControlCharacters;	break;
130cdf0e10cSrcweir 		case WID_IS_HYPH_AUTO : 			pbVal = &pData->bIsHyphAuto;	break;
131cdf0e10cSrcweir 		case WID_IS_HYPH_SPECIAL : 			pbVal = &pData->bIsHyphSpecial;	break;
132cdf0e10cSrcweir 		case WID_IS_SPELL_AUTO : 			pbVal = &pData->bIsSpellAuto;	break;
133cdf0e10cSrcweir         case WID_IS_SPELL_HIDE :            /*! deprecated !*/ break;
134cdf0e10cSrcweir         case WID_IS_SPELL_IN_ALL_LANGUAGES :/*! deprecated !*/ break;
135cdf0e10cSrcweir 		case WID_IS_SPELL_SPECIAL : 		pbVal = &pData->bIsSpellSpecial;	break;
136cdf0e10cSrcweir 		case WID_IS_WRAP_REVERSE : 			pbVal = &pData->bIsSpellReverse;	break;
137cdf0e10cSrcweir 		case WID_DEFAULT_LANGUAGE :			pnVal = &pData->nDefaultLanguage;	break;
138cdf0e10cSrcweir 		case WID_IS_SPELL_CAPITALIZATION :	pbVal = &pData->bIsSpellCapitalization;		break;
139cdf0e10cSrcweir 		case WID_IS_SPELL_WITH_DIGITS :		pbVal = &pData->bIsSpellWithDigits;	break;
140cdf0e10cSrcweir 		case WID_IS_SPELL_UPPER_CASE :		pbVal = &pData->bIsSpellUpperCase;		break;
141cdf0e10cSrcweir 		case WID_HYPH_MIN_LEADING :			pnVal = &pData->nHyphMinLeading;		break;
142cdf0e10cSrcweir 		case WID_HYPH_MIN_TRAILING :		pnVal = &pData->nHyphMinTrailing;	break;
143cdf0e10cSrcweir 		case WID_HYPH_MIN_WORD_LENGTH :		pnVal = &pData->nHyphMinWordLength;	break;
144cdf0e10cSrcweir 		case WID_DEFAULT_LOCALE :
145cdf0e10cSrcweir 		{
146cdf0e10cSrcweir 			bRes = SetLocale_Impl( pData->nDefaultLanguage, rOld, rVal, ::com::sun::star::i18n::ScriptType::LATIN );
147cdf0e10cSrcweir 			break;
148cdf0e10cSrcweir 		}
149cdf0e10cSrcweir 		case WID_DEFAULT_LOCALE_CJK :
150cdf0e10cSrcweir 		{
151cdf0e10cSrcweir 			bRes = SetLocale_Impl( pData->nDefaultLanguage_CJK, rOld, rVal, ::com::sun::star::i18n::ScriptType::ASIAN );
152cdf0e10cSrcweir 			break;
153cdf0e10cSrcweir 		}
154cdf0e10cSrcweir 		case WID_DEFAULT_LOCALE_CTL :
155cdf0e10cSrcweir 		{
156cdf0e10cSrcweir 			bRes = SetLocale_Impl( pData->nDefaultLanguage_CTL, rOld, rVal, ::com::sun::star::i18n::ScriptType::COMPLEX );
157cdf0e10cSrcweir 			break;
158cdf0e10cSrcweir 		}
159cdf0e10cSrcweir 		default :
160cdf0e10cSrcweir 		{
161cdf0e10cSrcweir             DBG_ASSERT( 0,"lng : unknown WID");
162cdf0e10cSrcweir 			bRes = sal_False;
163cdf0e10cSrcweir 		}
164cdf0e10cSrcweir 	}
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 	if (pbVal)
167cdf0e10cSrcweir 	{
168cdf0e10cSrcweir         sal_Bool bNew = sal_False;
169cdf0e10cSrcweir 		rVal >>= bNew;
170cdf0e10cSrcweir 		if (bNew != *pbVal)
171cdf0e10cSrcweir 		{
172cdf0e10cSrcweir 			rOld <<= *pbVal;
173cdf0e10cSrcweir 			*pbVal = bNew;
174cdf0e10cSrcweir 			bRes = sal_True;
175cdf0e10cSrcweir 		}
176cdf0e10cSrcweir 	}
177cdf0e10cSrcweir 	if (pnVal)
178cdf0e10cSrcweir 	{
179cdf0e10cSrcweir         sal_Int16 nNew = 0;
180cdf0e10cSrcweir 		rVal >>= nNew;
181cdf0e10cSrcweir 		if (nNew != *pnVal)
182cdf0e10cSrcweir 		{
183cdf0e10cSrcweir 			rOld <<= *pnVal;
184cdf0e10cSrcweir 			*pnVal = nNew;
185cdf0e10cSrcweir 			bRes = sal_True;
186cdf0e10cSrcweir 		}
187cdf0e10cSrcweir 	}
188cdf0e10cSrcweir 
189cdf0e10cSrcweir //	if (bRes)
190cdf0e10cSrcweir //		pData->SetModified();
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 	return bRes;
193cdf0e10cSrcweir }
194cdf0e10cSrcweir 
GetValue(Any & rVal,sal_Int32 nWID) const195cdf0e10cSrcweir void LinguOptions::GetValue( Any &rVal, sal_Int32 nWID ) const
196cdf0e10cSrcweir {
197cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 	sal_Int16 *pnVal = 0;
200cdf0e10cSrcweir 	sal_Bool  *pbVal = 0;
201cdf0e10cSrcweir     sal_Bool  bDummy = sal_False;
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 	switch( nWID )
204cdf0e10cSrcweir 	{
205cdf0e10cSrcweir         case WID_IS_GERMAN_PRE_REFORM :     pbVal = &bDummy; /*! deprecated !*/ break;
206cdf0e10cSrcweir 		case WID_IS_USE_DICTIONARY_LIST :	pbVal = &pData->bIsUseDictionaryList;	break;
207cdf0e10cSrcweir 		case WID_IS_IGNORE_CONTROL_CHARACTERS :	pbVal = &pData->bIsIgnoreControlCharacters;	break;
208cdf0e10cSrcweir 		case WID_IS_HYPH_AUTO : 			pbVal = &pData->bIsHyphAuto;	break;
209cdf0e10cSrcweir 		case WID_IS_HYPH_SPECIAL : 			pbVal = &pData->bIsHyphSpecial;	break;
210cdf0e10cSrcweir 		case WID_IS_SPELL_AUTO : 			pbVal = &pData->bIsSpellAuto;	break;
211cdf0e10cSrcweir         case WID_IS_SPELL_HIDE :            pbVal = &bDummy; /*! deprecated !*/ break;
212cdf0e10cSrcweir         case WID_IS_SPELL_IN_ALL_LANGUAGES :pbVal = &bDummy; /*! deprecated !*/ break;
213cdf0e10cSrcweir 		case WID_IS_SPELL_SPECIAL : 		pbVal = &pData->bIsSpellSpecial;	break;
214cdf0e10cSrcweir 		case WID_IS_WRAP_REVERSE : 			pbVal = &pData->bIsSpellReverse;	break;
215cdf0e10cSrcweir 		case WID_DEFAULT_LANGUAGE :			pnVal = &pData->nDefaultLanguage;	break;
216cdf0e10cSrcweir 		case WID_IS_SPELL_CAPITALIZATION :	pbVal = &pData->bIsSpellCapitalization;		break;
217cdf0e10cSrcweir 		case WID_IS_SPELL_WITH_DIGITS :		pbVal = &pData->bIsSpellWithDigits;	break;
218cdf0e10cSrcweir 		case WID_IS_SPELL_UPPER_CASE :		pbVal = &pData->bIsSpellUpperCase;		break;
219cdf0e10cSrcweir 		case WID_HYPH_MIN_LEADING :			pnVal = &pData->nHyphMinLeading;		break;
220cdf0e10cSrcweir 		case WID_HYPH_MIN_TRAILING :		pnVal = &pData->nHyphMinTrailing;	break;
221cdf0e10cSrcweir 		case WID_HYPH_MIN_WORD_LENGTH :		pnVal = &pData->nHyphMinWordLength;	break;
222cdf0e10cSrcweir 		case WID_DEFAULT_LOCALE :
223cdf0e10cSrcweir 		{
224cdf0e10cSrcweir 			Locale aLocale( MsLangId::convertLanguageToLocale( pData->nDefaultLanguage ) );
225cdf0e10cSrcweir 			rVal.setValue( &aLocale, ::getCppuType((Locale*)0 ));
226cdf0e10cSrcweir 			break;
227cdf0e10cSrcweir 		}
228cdf0e10cSrcweir 		case WID_DEFAULT_LOCALE_CJK :
229cdf0e10cSrcweir 		{
230cdf0e10cSrcweir 			Locale aLocale( MsLangId::convertLanguageToLocale( pData->nDefaultLanguage_CJK ) );
231cdf0e10cSrcweir 			rVal.setValue( &aLocale, ::getCppuType((Locale*)0 ));
232cdf0e10cSrcweir 			break;
233cdf0e10cSrcweir 		}
234cdf0e10cSrcweir 		case WID_DEFAULT_LOCALE_CTL :
235cdf0e10cSrcweir 		{
236cdf0e10cSrcweir 			Locale aLocale( MsLangId::convertLanguageToLocale( pData->nDefaultLanguage_CTL ) );
237cdf0e10cSrcweir 			rVal.setValue( &aLocale, ::getCppuType((Locale*)0 ));
238cdf0e10cSrcweir 			break;
239cdf0e10cSrcweir 		}
240cdf0e10cSrcweir 		default :
241cdf0e10cSrcweir 		{
242cdf0e10cSrcweir             DBG_ASSERT( 0,"lng : unknown WID");
243cdf0e10cSrcweir 		}
244cdf0e10cSrcweir 	}
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 	if (pbVal)
247cdf0e10cSrcweir 		rVal <<= *pbVal;
248cdf0e10cSrcweir 	if (pnVal)
249cdf0e10cSrcweir 		rVal <<= *pnVal;
250cdf0e10cSrcweir }
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 
253cdf0e10cSrcweir struct WID_Name
254cdf0e10cSrcweir {
255cdf0e10cSrcweir 	sal_Int32		 nWID;
256cdf0e10cSrcweir 	const char	*pPropertyName;
257cdf0e10cSrcweir };
258cdf0e10cSrcweir 
259cdf0e10cSrcweir //! order of entries is import (see LinguOptions::GetName)
260cdf0e10cSrcweir //! since the WID is used as index in this table!
261cdf0e10cSrcweir WID_Name aWID_Name[] =
262cdf0e10cSrcweir {
263cdf0e10cSrcweir     { 0,                                  0 },
264cdf0e10cSrcweir     { WID_IS_USE_DICTIONARY_LIST,         UPN_IS_USE_DICTIONARY_LIST },
265cdf0e10cSrcweir     { WID_IS_IGNORE_CONTROL_CHARACTERS,   UPN_IS_IGNORE_CONTROL_CHARACTERS },
266cdf0e10cSrcweir     { WID_IS_SPELL_UPPER_CASE,            UPN_IS_SPELL_UPPER_CASE },
267cdf0e10cSrcweir     { WID_IS_SPELL_WITH_DIGITS,           UPN_IS_SPELL_WITH_DIGITS },
268cdf0e10cSrcweir     { WID_IS_SPELL_CAPITALIZATION,        UPN_IS_SPELL_CAPITALIZATION },
269cdf0e10cSrcweir     { WID_HYPH_MIN_LEADING,               UPN_HYPH_MIN_LEADING },
270cdf0e10cSrcweir     { WID_HYPH_MIN_TRAILING,              UPN_HYPH_MIN_TRAILING },
271cdf0e10cSrcweir     { WID_HYPH_MIN_WORD_LENGTH,           UPN_HYPH_MIN_WORD_LENGTH },
272cdf0e10cSrcweir     { WID_DEFAULT_LOCALE,                 UPN_DEFAULT_LOCALE },
273cdf0e10cSrcweir     { WID_IS_SPELL_AUTO,                  UPN_IS_SPELL_AUTO },
274cdf0e10cSrcweir     { 0,                                  0 },
275cdf0e10cSrcweir     { 0,                                  0 },
276cdf0e10cSrcweir     { WID_IS_SPELL_SPECIAL,               UPN_IS_SPELL_SPECIAL },
277cdf0e10cSrcweir     { WID_IS_HYPH_AUTO,                   UPN_IS_HYPH_AUTO },
278cdf0e10cSrcweir     { WID_IS_HYPH_SPECIAL,                UPN_IS_HYPH_SPECIAL },
279cdf0e10cSrcweir     { WID_IS_WRAP_REVERSE,                UPN_IS_WRAP_REVERSE },
280cdf0e10cSrcweir     { 0,                                  0 },
281cdf0e10cSrcweir     { 0,                                  0 },
282cdf0e10cSrcweir     { 0,                                  0 },
283cdf0e10cSrcweir     { 0,                                  0 },
284cdf0e10cSrcweir     { WID_DEFAULT_LANGUAGE,               UPN_DEFAULT_LANGUAGE },
285cdf0e10cSrcweir     { WID_DEFAULT_LOCALE_CJK,             UPN_DEFAULT_LOCALE_CJK },
286cdf0e10cSrcweir     { WID_DEFAULT_LOCALE_CTL,             UPN_DEFAULT_LOCALE_CTL }
287cdf0e10cSrcweir };
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 
GetName(sal_Int32 nWID)290cdf0e10cSrcweir OUString LinguOptions::GetName( sal_Int32 nWID )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 	OUString aRes;
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	sal_Int32 nLen = sizeof( aWID_Name ) / sizeof( aWID_Name[0] );
297cdf0e10cSrcweir 	if (0 <= nWID  &&  nWID < nLen
298cdf0e10cSrcweir 		&& aWID_Name[ nWID ].nWID == nWID)
299cdf0e10cSrcweir 	{
300cdf0e10cSrcweir 		aRes = OUString( RTL_CONSTASCII_USTRINGPARAM(
301cdf0e10cSrcweir 				aWID_Name[ nWID ].pPropertyName ) );
302cdf0e10cSrcweir 	}
303cdf0e10cSrcweir 	else
304cdf0e10cSrcweir 	{
305cdf0e10cSrcweir         DBG_ASSERT( 0,"lng : unknown WID");
306cdf0e10cSrcweir 	}
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 	return aRes;
309cdf0e10cSrcweir }
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 
312cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
313cdf0e10cSrcweir 
314cdf0e10cSrcweir //! map must be sorted by first entry in alphabetical increasing order.
lcl_GetLinguProps()315cdf0e10cSrcweir const SfxItemPropertyMapEntry* lcl_GetLinguProps()
316cdf0e10cSrcweir {
317cdf0e10cSrcweir     static const SfxItemPropertyMapEntry aLinguProps[] =
318cdf0e10cSrcweir     {
319cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_DEFAULT_LANGUAGE),           WID_DEFAULT_LANGUAGE,
320cdf0e10cSrcweir                 &::getCppuType( (sal_Int16*)0 ),    0, 0 },
321cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_DEFAULT_LOCALE),             WID_DEFAULT_LOCALE,
322cdf0e10cSrcweir                 &::getCppuType( (Locale* )0),       0, 0 },
323cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_DEFAULT_LOCALE_CJK),         WID_DEFAULT_LOCALE_CJK,
324cdf0e10cSrcweir                 &::getCppuType( (Locale* )0),       0, 0 },
325cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_DEFAULT_LOCALE_CTL),         WID_DEFAULT_LOCALE_CTL,
326cdf0e10cSrcweir                 &::getCppuType( (Locale* )0),       0, 0 },
327cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_HYPH_MIN_LEADING),           WID_HYPH_MIN_LEADING,
328cdf0e10cSrcweir                 &::getCppuType( (sal_Int16*)0 ),    0, 0 },
329cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_HYPH_MIN_TRAILING),          WID_HYPH_MIN_TRAILING,
330cdf0e10cSrcweir                 &::getCppuType( (sal_Int16*)0 ),    0, 0 },
331cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_HYPH_MIN_WORD_LENGTH),       WID_HYPH_MIN_WORD_LENGTH,
332cdf0e10cSrcweir                 &::getCppuType( (sal_Int16*)0 ),    0, 0 },
333cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_IS_GERMAN_PRE_REFORM),       WID_IS_GERMAN_PRE_REFORM,       /*! deprecated !*/
334cdf0e10cSrcweir                 &::getBooleanCppuType(),            0, 0 },
335cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_IS_HYPH_AUTO),               WID_IS_HYPH_AUTO,
336cdf0e10cSrcweir                 &::getBooleanCppuType(),            0, 0 },
337cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_IS_HYPH_SPECIAL),            WID_IS_HYPH_SPECIAL,
338cdf0e10cSrcweir                 &::getBooleanCppuType(),            0, 0 },
339cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_IS_IGNORE_CONTROL_CHARACTERS),   WID_IS_IGNORE_CONTROL_CHARACTERS,
340cdf0e10cSrcweir                 &::getBooleanCppuType(),            0, 0 },
341cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_IS_SPELL_AUTO),              WID_IS_SPELL_AUTO,
342cdf0e10cSrcweir                 &::getBooleanCppuType(),            0, 0 },
343cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_IS_SPELL_CAPITALIZATION),    WID_IS_SPELL_CAPITALIZATION,
344cdf0e10cSrcweir                 &::getBooleanCppuType(),            0, 0 },
345cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_IS_SPELL_HIDE),              WID_IS_SPELL_HIDE,              /*! deprecated !*/
346cdf0e10cSrcweir                 &::getBooleanCppuType(),            0, 0 },
347cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_IS_SPELL_IN_ALL_LANGUAGES),  WID_IS_SPELL_IN_ALL_LANGUAGES,  /*! deprecated !*/
348cdf0e10cSrcweir                 &::getBooleanCppuType(),            0, 0 },
349cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_IS_SPELL_SPECIAL),           WID_IS_SPELL_SPECIAL,
350cdf0e10cSrcweir                 &::getBooleanCppuType(),            0, 0 },
351cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_IS_SPELL_UPPER_CASE),        WID_IS_SPELL_UPPER_CASE,
352cdf0e10cSrcweir                 &::getBooleanCppuType(),            0, 0 },
353cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_IS_SPELL_WITH_DIGITS),       WID_IS_SPELL_WITH_DIGITS,
354cdf0e10cSrcweir                 &::getBooleanCppuType(),            0, 0 },
355cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_IS_USE_DICTIONARY_LIST),     WID_IS_USE_DICTIONARY_LIST,
356cdf0e10cSrcweir                 &::getBooleanCppuType(),            0, 0 },
357cdf0e10cSrcweir         { MAP_CHAR_LEN(UPN_IS_WRAP_REVERSE),            WID_IS_WRAP_REVERSE,
358cdf0e10cSrcweir                 &::getBooleanCppuType(),            0, 0 },
359cdf0e10cSrcweir         { 0,0,0,0,0,0 }
360cdf0e10cSrcweir     };
361cdf0e10cSrcweir     return aLinguProps;
362cdf0e10cSrcweir }
LinguProps()363cdf0e10cSrcweir LinguProps::LinguProps() :
364cdf0e10cSrcweir 	aEvtListeners	(GetLinguMutex()),
365cdf0e10cSrcweir 	aPropListeners	(GetLinguMutex()),
366cdf0e10cSrcweir     aPropertyMap(lcl_GetLinguProps())
367cdf0e10cSrcweir {
368cdf0e10cSrcweir 	bDisposing = sal_False;
369cdf0e10cSrcweir }
370cdf0e10cSrcweir 
launchEvent(const PropertyChangeEvent & rEvt) const371cdf0e10cSrcweir void LinguProps::launchEvent( const PropertyChangeEvent &rEvt ) const
372cdf0e10cSrcweir {
373cdf0e10cSrcweir 	cppu::OInterfaceContainerHelper *pContainer =
374cdf0e10cSrcweir 			aPropListeners.getContainer( rEvt.PropertyHandle );
375cdf0e10cSrcweir 	if (pContainer)
376cdf0e10cSrcweir 	{
377cdf0e10cSrcweir 		cppu::OInterfaceIteratorHelper aIt( *pContainer );
378cdf0e10cSrcweir 		while (aIt.hasMoreElements())
379cdf0e10cSrcweir 		{
380cdf0e10cSrcweir             Reference< XPropertyChangeListener > xRef( aIt.next(), UNO_QUERY );
381cdf0e10cSrcweir 			if (xRef.is())
382cdf0e10cSrcweir 				xRef->propertyChange( rEvt );
383cdf0e10cSrcweir 		}
384cdf0e10cSrcweir 	}
385cdf0e10cSrcweir }
386cdf0e10cSrcweir 
LinguProps_CreateInstance(const Reference<XMultiServiceFactory> &)387cdf0e10cSrcweir Reference< XInterface > SAL_CALL LinguProps_CreateInstance(
388cdf0e10cSrcweir             const Reference< XMultiServiceFactory > & /*rSMgr*/ )
389cdf0e10cSrcweir 		throw(Exception)
390cdf0e10cSrcweir {
391cdf0e10cSrcweir 	Reference< XInterface > xService = (cppu::OWeakObject*)new LinguProps;
392cdf0e10cSrcweir 	return xService;
393cdf0e10cSrcweir }
394cdf0e10cSrcweir 
getPropertySetInfo()395cdf0e10cSrcweir Reference< XPropertySetInfo > SAL_CALL LinguProps::getPropertySetInfo()
396cdf0e10cSrcweir 		throw(RuntimeException)
397cdf0e10cSrcweir {
398cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
399cdf0e10cSrcweir 
400cdf0e10cSrcweir 	static Reference< XPropertySetInfo > aRef =
401cdf0e10cSrcweir             new SfxItemPropertySetInfo( &aPropertyMap );
402cdf0e10cSrcweir 	return aRef;
403cdf0e10cSrcweir }
404cdf0e10cSrcweir 
setPropertyValue(const OUString & rPropertyName,const Any & rValue)405cdf0e10cSrcweir void SAL_CALL LinguProps::setPropertyValue(
406cdf0e10cSrcweir             const OUString& rPropertyName, const Any& rValue )
407cdf0e10cSrcweir 		throw(UnknownPropertyException, PropertyVetoException,
408cdf0e10cSrcweir 			  IllegalArgumentException, WrappedTargetException, RuntimeException)
409cdf0e10cSrcweir {
410cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
411cdf0e10cSrcweir 
412cdf0e10cSrcweir     const SfxItemPropertySimpleEntry* pCur = aPropertyMap.getByName( rPropertyName );
413cdf0e10cSrcweir 	if (pCur)
414cdf0e10cSrcweir 	{
415cdf0e10cSrcweir         Any aOld( aConfig.GetProperty( pCur->nWID ) );
416cdf0e10cSrcweir         if (aOld != rValue && aConfig.SetProperty( pCur->nWID, rValue ))
417cdf0e10cSrcweir 		{
418cdf0e10cSrcweir 			PropertyChangeEvent aChgEvt( (XPropertySet *) this, rPropertyName,
419cdf0e10cSrcweir                     sal_False, pCur->nWID, aOld, rValue );
420cdf0e10cSrcweir 			launchEvent( aChgEvt );
421cdf0e10cSrcweir 		}
422cdf0e10cSrcweir 	}
423cdf0e10cSrcweir #ifdef LINGU_EXCEPTIONS
424cdf0e10cSrcweir 	else
425cdf0e10cSrcweir 	{
426cdf0e10cSrcweir 		throw UnknownPropertyException();
427cdf0e10cSrcweir 	}
428cdf0e10cSrcweir #endif
429cdf0e10cSrcweir }
430cdf0e10cSrcweir 
getPropertyValue(const OUString & rPropertyName)431cdf0e10cSrcweir Any SAL_CALL LinguProps::getPropertyValue( const OUString& rPropertyName )
432cdf0e10cSrcweir 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
433cdf0e10cSrcweir {
434cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
435cdf0e10cSrcweir 
436cdf0e10cSrcweir 	Any aRet;
437cdf0e10cSrcweir 
438cdf0e10cSrcweir     const SfxItemPropertySimpleEntry* pCur = aPropertyMap.getByName( rPropertyName );
439cdf0e10cSrcweir 	if(pCur)
440cdf0e10cSrcweir 	{
441cdf0e10cSrcweir         aRet = aConfig.GetProperty( pCur->nWID );
442cdf0e10cSrcweir 	}
443cdf0e10cSrcweir #ifdef LINGU_EXCEPTIONS
444cdf0e10cSrcweir 	else
445cdf0e10cSrcweir 	{
446cdf0e10cSrcweir 		throw UnknownPropertyException();
447cdf0e10cSrcweir 	}
448cdf0e10cSrcweir #endif
449cdf0e10cSrcweir 
450cdf0e10cSrcweir 	return aRet;
451cdf0e10cSrcweir }
452cdf0e10cSrcweir 
addPropertyChangeListener(const OUString & rPropertyName,const Reference<XPropertyChangeListener> & rxListener)453cdf0e10cSrcweir void SAL_CALL LinguProps::addPropertyChangeListener(
454cdf0e10cSrcweir 			const OUString& rPropertyName,
455cdf0e10cSrcweir 			const Reference< XPropertyChangeListener >& rxListener )
456cdf0e10cSrcweir 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
457cdf0e10cSrcweir {
458cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
459cdf0e10cSrcweir 
460cdf0e10cSrcweir 	if (!bDisposing && rxListener.is())
461cdf0e10cSrcweir 	{
462cdf0e10cSrcweir         const SfxItemPropertySimpleEntry* pCur = aPropertyMap.getByName( rPropertyName );
463cdf0e10cSrcweir 		if(pCur)
464cdf0e10cSrcweir 			aPropListeners.addInterface( pCur->nWID, rxListener );
465cdf0e10cSrcweir #ifdef LINGU_EXCEPTIONS
466cdf0e10cSrcweir 		else
467cdf0e10cSrcweir 		{
468cdf0e10cSrcweir 			throw UnknownPropertyException();
469cdf0e10cSrcweir 		}
470cdf0e10cSrcweir #endif
471cdf0e10cSrcweir 	}
472cdf0e10cSrcweir }
473cdf0e10cSrcweir 
removePropertyChangeListener(const OUString & rPropertyName,const Reference<XPropertyChangeListener> & rxListener)474cdf0e10cSrcweir void SAL_CALL LinguProps::removePropertyChangeListener(
475cdf0e10cSrcweir 			const OUString& rPropertyName,
476cdf0e10cSrcweir 			const Reference< XPropertyChangeListener >& rxListener )
477cdf0e10cSrcweir 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
478cdf0e10cSrcweir {
479cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
480cdf0e10cSrcweir 
481cdf0e10cSrcweir 	if (!bDisposing && rxListener.is())
482cdf0e10cSrcweir 	{
483cdf0e10cSrcweir         const SfxItemPropertySimpleEntry* pCur = aPropertyMap.getByName( rPropertyName );
484cdf0e10cSrcweir 		if(pCur)
485cdf0e10cSrcweir 			aPropListeners.removeInterface( pCur->nWID, rxListener );
486cdf0e10cSrcweir #ifdef LINGU_EXCEPTIONS
487cdf0e10cSrcweir 		else
488cdf0e10cSrcweir 		{
489cdf0e10cSrcweir 			throw UnknownPropertyException();
490cdf0e10cSrcweir 		}
491cdf0e10cSrcweir #endif
492cdf0e10cSrcweir 	}
493cdf0e10cSrcweir }
494cdf0e10cSrcweir 
addVetoableChangeListener(const OUString &,const Reference<XVetoableChangeListener> &)495cdf0e10cSrcweir void SAL_CALL LinguProps::addVetoableChangeListener(
496cdf0e10cSrcweir             const OUString& /*rPropertyName*/,
497cdf0e10cSrcweir             const Reference< XVetoableChangeListener >& /*xListener*/ )
498cdf0e10cSrcweir 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
499cdf0e10cSrcweir {
500cdf0e10cSrcweir //	MutexGuard	aGuard( GetLinguMutex() );
501cdf0e10cSrcweir }
502cdf0e10cSrcweir 
removeVetoableChangeListener(const OUString &,const Reference<XVetoableChangeListener> &)503cdf0e10cSrcweir void SAL_CALL LinguProps::removeVetoableChangeListener(
504cdf0e10cSrcweir             const OUString& /*rPropertyName*/,
505cdf0e10cSrcweir             const Reference< XVetoableChangeListener >& /*xListener*/ )
506cdf0e10cSrcweir 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
507cdf0e10cSrcweir {
508cdf0e10cSrcweir //	MutexGuard	aGuard( GetLinguMutex() );
509cdf0e10cSrcweir }
510cdf0e10cSrcweir 
511cdf0e10cSrcweir 
setFastPropertyValue(sal_Int32 nHandle,const Any & rValue)512cdf0e10cSrcweir void SAL_CALL LinguProps::setFastPropertyValue( sal_Int32 nHandle, const Any& rValue )
513cdf0e10cSrcweir 		throw(UnknownPropertyException, PropertyVetoException,
514cdf0e10cSrcweir 			  IllegalArgumentException, WrappedTargetException, RuntimeException)
515cdf0e10cSrcweir {
516cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
517cdf0e10cSrcweir 
518cdf0e10cSrcweir     Any aOld( aConfig.GetProperty( nHandle ) );
519cdf0e10cSrcweir     if (aOld != rValue && aConfig.SetProperty( nHandle, rValue ))
520cdf0e10cSrcweir 	{
521cdf0e10cSrcweir 		PropertyChangeEvent aChgEvt( (XPropertySet *) this,
522cdf0e10cSrcweir                 LinguOptions::GetName( nHandle ), sal_False, nHandle, aOld, rValue );
523cdf0e10cSrcweir 		launchEvent( aChgEvt );
524cdf0e10cSrcweir 	}
525cdf0e10cSrcweir }
526cdf0e10cSrcweir 
527cdf0e10cSrcweir 
getFastPropertyValue(sal_Int32 nHandle)528cdf0e10cSrcweir Any SAL_CALL LinguProps::getFastPropertyValue( sal_Int32 nHandle )
529cdf0e10cSrcweir 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
530cdf0e10cSrcweir {
531cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
532cdf0e10cSrcweir 
533cdf0e10cSrcweir     Any aRes( aConfig.GetProperty( nHandle ) );
534cdf0e10cSrcweir 	return aRes;
535cdf0e10cSrcweir }
536cdf0e10cSrcweir 
537cdf0e10cSrcweir 
538cdf0e10cSrcweir Sequence< PropertyValue > SAL_CALL
getPropertyValues()539cdf0e10cSrcweir 	LinguProps::getPropertyValues()
540cdf0e10cSrcweir 		throw(RuntimeException)
541cdf0e10cSrcweir {
542cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
543cdf0e10cSrcweir 
544cdf0e10cSrcweir     sal_Int32 nLen = aPropertyMap.getSize();
545cdf0e10cSrcweir 	Sequence< PropertyValue > aProps( nLen );
546cdf0e10cSrcweir     PropertyValue *pProp = aProps.getArray();
547cdf0e10cSrcweir     PropertyEntryVector_t aPropEntries = aPropertyMap.getPropertyEntries();
548cdf0e10cSrcweir     PropertyEntryVector_t::const_iterator aIt = aPropEntries.begin();
549cdf0e10cSrcweir     for (sal_Int32 i = 0;  i < nLen;  ++i, ++aIt)
550cdf0e10cSrcweir 	{
551cdf0e10cSrcweir 		PropertyValue &rVal = pProp[i];
552cdf0e10cSrcweir         Any aAny( aConfig.GetProperty( aIt->nWID ) );
553cdf0e10cSrcweir 
554cdf0e10cSrcweir         rVal.Name   = aIt->sName;
555cdf0e10cSrcweir         rVal.Handle = aIt->nWID;
556cdf0e10cSrcweir     	rVal.Value	= aAny;
557cdf0e10cSrcweir     	rVal.State	= PropertyState_DIRECT_VALUE ;
558cdf0e10cSrcweir 	}
559cdf0e10cSrcweir 	return aProps;
560cdf0e10cSrcweir }
561cdf0e10cSrcweir 
562cdf0e10cSrcweir void SAL_CALL
setPropertyValues(const Sequence<PropertyValue> & rProps)563cdf0e10cSrcweir 	LinguProps::setPropertyValues( const Sequence< PropertyValue >& rProps )
564cdf0e10cSrcweir 		throw(UnknownPropertyException, PropertyVetoException,
565cdf0e10cSrcweir 			  IllegalArgumentException, WrappedTargetException, RuntimeException)
566cdf0e10cSrcweir {
567cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
568cdf0e10cSrcweir 
569cdf0e10cSrcweir 	sal_Int32 nLen = rProps.getLength();
570cdf0e10cSrcweir 	const PropertyValue *pVal = rProps.getConstArray();
571cdf0e10cSrcweir 	for (sal_Int32 i = 0;  i < nLen;  ++i)
572cdf0e10cSrcweir 	{
573cdf0e10cSrcweir         const PropertyValue &rVal = pVal[i];
574cdf0e10cSrcweir         setPropertyValue( rVal.Name, rVal.Value );
575cdf0e10cSrcweir 	}
576cdf0e10cSrcweir }
577cdf0e10cSrcweir 
578cdf0e10cSrcweir void SAL_CALL
dispose()579cdf0e10cSrcweir 	LinguProps::dispose()
580cdf0e10cSrcweir 		throw(RuntimeException)
581cdf0e10cSrcweir {
582cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
583cdf0e10cSrcweir 
584cdf0e10cSrcweir 	if (!bDisposing)
585cdf0e10cSrcweir 	{
586cdf0e10cSrcweir 		bDisposing = sal_True;
587cdf0e10cSrcweir 
588cdf0e10cSrcweir 		//! its too late to save the options here!
589cdf0e10cSrcweir 		// (see AppExitListener for saving)
590cdf0e10cSrcweir 		//aOpt.Save();	// save (possible) changes before exiting
591cdf0e10cSrcweir 
592cdf0e10cSrcweir 		EventObject	aEvtObj( (XPropertySet *) this );
593cdf0e10cSrcweir 		aEvtListeners.disposeAndClear( aEvtObj );
594cdf0e10cSrcweir 		aPropListeners.disposeAndClear( aEvtObj );
595cdf0e10cSrcweir 	}
596cdf0e10cSrcweir }
597cdf0e10cSrcweir 
598cdf0e10cSrcweir void SAL_CALL
addEventListener(const Reference<XEventListener> & rxListener)599cdf0e10cSrcweir 	LinguProps::addEventListener( const Reference< XEventListener >& rxListener )
600cdf0e10cSrcweir 		throw(RuntimeException)
601cdf0e10cSrcweir {
602cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
603cdf0e10cSrcweir 
604cdf0e10cSrcweir 	if (!bDisposing && rxListener.is())
605cdf0e10cSrcweir 		aEvtListeners.addInterface( rxListener );
606cdf0e10cSrcweir }
607cdf0e10cSrcweir 
608cdf0e10cSrcweir void SAL_CALL
removeEventListener(const Reference<XEventListener> & rxListener)609cdf0e10cSrcweir 	LinguProps::removeEventListener( const Reference< XEventListener >& rxListener )
610cdf0e10cSrcweir 		throw(RuntimeException)
611cdf0e10cSrcweir {
612cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
613cdf0e10cSrcweir 
614cdf0e10cSrcweir 	if (!bDisposing && rxListener.is())
615cdf0e10cSrcweir 		aEvtListeners.removeInterface( rxListener );
616cdf0e10cSrcweir }
617cdf0e10cSrcweir 
618cdf0e10cSrcweir 
619cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
620cdf0e10cSrcweir // Service specific part
621cdf0e10cSrcweir //
622cdf0e10cSrcweir 
623cdf0e10cSrcweir // XServiceInfo
getImplementationName()624cdf0e10cSrcweir OUString SAL_CALL LinguProps::getImplementationName()
625cdf0e10cSrcweir 		throw(RuntimeException)
626cdf0e10cSrcweir {
627cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
628cdf0e10cSrcweir 	return getImplementationName_Static();
629cdf0e10cSrcweir }
630cdf0e10cSrcweir 
631cdf0e10cSrcweir // XServiceInfo
supportsService(const OUString & ServiceName)632cdf0e10cSrcweir sal_Bool SAL_CALL LinguProps::supportsService( const OUString& ServiceName )
633cdf0e10cSrcweir 		throw(RuntimeException)
634cdf0e10cSrcweir {
635cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
636cdf0e10cSrcweir 
637cdf0e10cSrcweir 	uno::Sequence< OUString > aSNL = getSupportedServiceNames();
638cdf0e10cSrcweir 	const OUString * pArray = aSNL.getConstArray();
639cdf0e10cSrcweir 	for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
640cdf0e10cSrcweir 		if( pArray[i] == ServiceName )
641cdf0e10cSrcweir 			return sal_True;
642cdf0e10cSrcweir 	return sal_False;
643cdf0e10cSrcweir }
644cdf0e10cSrcweir 
645cdf0e10cSrcweir // XServiceInfo
getSupportedServiceNames()646cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL LinguProps::getSupportedServiceNames()
647cdf0e10cSrcweir 		throw(RuntimeException)
648cdf0e10cSrcweir {
649cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
650cdf0e10cSrcweir 	return getSupportedServiceNames_Static();
651cdf0e10cSrcweir }
652cdf0e10cSrcweir 
653cdf0e10cSrcweir // ORegistryServiceManager_Static
getSupportedServiceNames_Static()654cdf0e10cSrcweir uno::Sequence< OUString > LinguProps::getSupportedServiceNames_Static()
655cdf0e10cSrcweir 		throw()
656cdf0e10cSrcweir {
657cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
658cdf0e10cSrcweir 
659cdf0e10cSrcweir 	uno::Sequence< OUString > aSNS( 1 );	// auch mehr als 1 Service moeglich
660cdf0e10cSrcweir 	aSNS.getArray()[0] = A2OU( SN_LINGU_PROPERTIES );
661cdf0e10cSrcweir 	return aSNS;
662cdf0e10cSrcweir }
663cdf0e10cSrcweir 
LinguProps_getFactory(const sal_Char * pImplName,XMultiServiceFactory * pServiceManager,void *)664cdf0e10cSrcweir void * SAL_CALL LinguProps_getFactory( const sal_Char * pImplName,
665cdf0e10cSrcweir 			XMultiServiceFactory *pServiceManager, void * )
666cdf0e10cSrcweir {
667cdf0e10cSrcweir 	void * pRet = 0;
668cdf0e10cSrcweir 	if ( !LinguProps::getImplementationName_Static().compareToAscii( pImplName ) )
669cdf0e10cSrcweir 	{
670cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory =
671cdf0e10cSrcweir 			cppu::createOneInstanceFactory(
672cdf0e10cSrcweir 				pServiceManager,
673cdf0e10cSrcweir 				LinguProps::getImplementationName_Static(),
674cdf0e10cSrcweir 				LinguProps_CreateInstance,
675cdf0e10cSrcweir 				LinguProps::getSupportedServiceNames_Static());
676cdf0e10cSrcweir 		// acquire, because we return an interface pointer instead of a reference
677cdf0e10cSrcweir 		xFactory->acquire();
678cdf0e10cSrcweir 		pRet = xFactory.get();
679cdf0e10cSrcweir 	}
680cdf0e10cSrcweir 	return pRet;
681cdf0e10cSrcweir }
682cdf0e10cSrcweir 
683cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
684cdf0e10cSrcweir 
685