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 <tools/debug.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <com/sun/star/linguistic2/LinguServiceEvent.hpp>
30cdf0e10cSrcweir #include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp>
31cdf0e10cSrcweir #include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp>
32cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
33cdf0e10cSrcweir #include <osl/mutex.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #include <linguistic/misc.hxx>
36cdf0e10cSrcweir #include <linguistic/lngprops.hxx>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include <linguistic/lngprophelp.hxx>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 
41cdf0e10cSrcweir //using namespace utl;
42cdf0e10cSrcweir using namespace osl;
43cdf0e10cSrcweir using namespace rtl;
44cdf0e10cSrcweir using namespace com::sun::star;
45cdf0e10cSrcweir using namespace com::sun::star::beans;
46cdf0e10cSrcweir using namespace com::sun::star::lang;
47cdf0e10cSrcweir using namespace com::sun::star::uno;
48cdf0e10cSrcweir using namespace com::sun::star::linguistic2;
49cdf0e10cSrcweir using namespace linguistic;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir namespace linguistic
52cdf0e10cSrcweir {
53cdf0e10cSrcweir 
54cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
55cdf0e10cSrcweir 
56cdf0e10cSrcweir static const char *aCH[] =
57cdf0e10cSrcweir {
58cdf0e10cSrcweir 	UPN_IS_IGNORE_CONTROL_CHARACTERS,
59cdf0e10cSrcweir 	UPN_IS_USE_DICTIONARY_LIST,
60cdf0e10cSrcweir };
61cdf0e10cSrcweir 
62cdf0e10cSrcweir static int nCHCount = sizeof(aCH) / sizeof(aCH[0]);
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 
PropertyChgHelper(const Reference<XInterface> & rxSource,Reference<XPropertySet> & rxPropSet,int nAllowedEvents)65cdf0e10cSrcweir PropertyChgHelper::PropertyChgHelper(
66cdf0e10cSrcweir 		const Reference< XInterface > &rxSource,
67cdf0e10cSrcweir 		Reference< XPropertySet > &rxPropSet,
68cdf0e10cSrcweir 		int nAllowedEvents ) :
69cdf0e10cSrcweir     PropertyChgHelperBase(),
70cdf0e10cSrcweir     aPropNames          (nCHCount),
71cdf0e10cSrcweir     xMyEvtObj           (rxSource),
72cdf0e10cSrcweir     aLngSvcEvtListeners (GetLinguMutex()),
73cdf0e10cSrcweir     xPropSet            (rxPropSet),
74cdf0e10cSrcweir     nEvtFlags           (nAllowedEvents)
75cdf0e10cSrcweir {
76cdf0e10cSrcweir 	OUString *pName = aPropNames.getArray();
77cdf0e10cSrcweir 	for (sal_Int32 i = 0;  i < nCHCount;  ++i)
78cdf0e10cSrcweir 	{
79cdf0e10cSrcweir 		pName[i] = A2OU( aCH[i] );
80cdf0e10cSrcweir 	}
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	SetDefaultValues();
83cdf0e10cSrcweir }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 
PropertyChgHelper(const PropertyChgHelper & rHelper)86cdf0e10cSrcweir PropertyChgHelper::PropertyChgHelper( const PropertyChgHelper &rHelper ) :
87cdf0e10cSrcweir     PropertyChgHelperBase(),
88cdf0e10cSrcweir     aLngSvcEvtListeners (GetLinguMutex())
89cdf0e10cSrcweir {
90cdf0e10cSrcweir 	RemoveAsPropListener();
91cdf0e10cSrcweir     aPropNames  = rHelper.aPropNames;
92cdf0e10cSrcweir     xMyEvtObj   = rHelper.xMyEvtObj;
93cdf0e10cSrcweir     xPropSet    = rHelper.xPropSet;
94cdf0e10cSrcweir     nEvtFlags   = rHelper.nEvtFlags;
95cdf0e10cSrcweir     AddAsPropListener();
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	SetDefaultValues();
98cdf0e10cSrcweir 	GetCurrentValues();
99cdf0e10cSrcweir }
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 
~PropertyChgHelper()102cdf0e10cSrcweir PropertyChgHelper::~PropertyChgHelper()
103cdf0e10cSrcweir {
104cdf0e10cSrcweir }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 
AddPropNames(const char * pNewNames[],sal_Int32 nCount)107cdf0e10cSrcweir void PropertyChgHelper::AddPropNames( const char *pNewNames[], sal_Int32 nCount )
108cdf0e10cSrcweir {
109cdf0e10cSrcweir 	if (pNewNames && nCount)
110cdf0e10cSrcweir 	{
111cdf0e10cSrcweir 		sal_Int32 nLen = GetPropNames().getLength();
112cdf0e10cSrcweir 		GetPropNames().realloc( nLen + nCount );
113cdf0e10cSrcweir 		OUString *pName = GetPropNames().getArray();
114cdf0e10cSrcweir 		for (sal_Int32 i = 0;  i < nCount;  ++i)
115cdf0e10cSrcweir 		{
116cdf0e10cSrcweir 			pName[ nLen + i ] = A2OU( pNewNames[ i ] );
117cdf0e10cSrcweir 		}
118cdf0e10cSrcweir 	}
119cdf0e10cSrcweir }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 
SetDefaultValues()122cdf0e10cSrcweir void PropertyChgHelper::SetDefaultValues()
123cdf0e10cSrcweir {
124cdf0e10cSrcweir 	bResIsIgnoreControlCharacters	= bIsIgnoreControlCharacters	= sal_True;
125cdf0e10cSrcweir 	bResIsUseDictionaryList			= bIsUseDictionaryList			= sal_True;
126cdf0e10cSrcweir }
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 
GetCurrentValues()129cdf0e10cSrcweir void PropertyChgHelper::GetCurrentValues()
130cdf0e10cSrcweir {
131cdf0e10cSrcweir 	sal_Int32 nLen = GetPropNames().getLength();
132cdf0e10cSrcweir 	if (GetPropSet().is() && nLen)
133cdf0e10cSrcweir 	{
134cdf0e10cSrcweir 		const OUString *pPropName = GetPropNames().getConstArray();
135cdf0e10cSrcweir 		for (sal_Int32 i = 0;  i < nLen;  ++i)
136cdf0e10cSrcweir 		{
137cdf0e10cSrcweir 			sal_Bool *pbVal		= NULL,
138cdf0e10cSrcweir 				 *pbResVal	= NULL;
139cdf0e10cSrcweir 
140cdf0e10cSrcweir             if (pPropName[i].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UPN_IS_IGNORE_CONTROL_CHARACTERS ) ))
141cdf0e10cSrcweir 			{
142cdf0e10cSrcweir 				pbVal	 = &bIsIgnoreControlCharacters;
143cdf0e10cSrcweir 				pbResVal = &bResIsIgnoreControlCharacters;
144cdf0e10cSrcweir 			}
145cdf0e10cSrcweir             else if (pPropName[i].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UPN_IS_USE_DICTIONARY_LIST ) ))
146cdf0e10cSrcweir 			{
147cdf0e10cSrcweir 				pbVal	 = &bIsUseDictionaryList;
148cdf0e10cSrcweir 				pbResVal = &bResIsUseDictionaryList;
149cdf0e10cSrcweir 			}
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 			if (pbVal && pbResVal)
152cdf0e10cSrcweir 			{
153cdf0e10cSrcweir 				GetPropSet()->getPropertyValue( pPropName[i] ) >>= *pbVal;
154cdf0e10cSrcweir 				*pbResVal = *pbVal;
155cdf0e10cSrcweir 			}
156cdf0e10cSrcweir 		}
157cdf0e10cSrcweir 	}
158cdf0e10cSrcweir }
159cdf0e10cSrcweir 
160cdf0e10cSrcweir 
SetTmpPropVals(const PropertyValues & rPropVals)161cdf0e10cSrcweir void PropertyChgHelper::SetTmpPropVals( const PropertyValues &rPropVals )
162cdf0e10cSrcweir {
163cdf0e10cSrcweir 	// return value is default value unless there is an explicitly supplied
164cdf0e10cSrcweir 	// temporary value
165cdf0e10cSrcweir 	bResIsIgnoreControlCharacters	= bIsIgnoreControlCharacters;
166cdf0e10cSrcweir 	bResIsUseDictionaryList			= bIsUseDictionaryList;
167cdf0e10cSrcweir 	//
168cdf0e10cSrcweir 	sal_Int32 nLen = rPropVals.getLength();
169cdf0e10cSrcweir 	if (nLen)
170cdf0e10cSrcweir 	{
171cdf0e10cSrcweir 		const PropertyValue *pVal = rPropVals.getConstArray();
172cdf0e10cSrcweir 		for (sal_Int32 i = 0;  i < nLen;  ++i)
173cdf0e10cSrcweir 		{
174cdf0e10cSrcweir 			sal_Bool  *pbResVal = NULL;
175cdf0e10cSrcweir 			switch (pVal[i].Handle)
176cdf0e10cSrcweir 			{
177cdf0e10cSrcweir 				case UPH_IS_IGNORE_CONTROL_CHARACTERS :
178cdf0e10cSrcweir 						pbResVal = &bResIsIgnoreControlCharacters; break;
179cdf0e10cSrcweir 				case UPH_IS_USE_DICTIONARY_LIST		:
180cdf0e10cSrcweir 						pbResVal = &bResIsUseDictionaryList; break;
181cdf0e10cSrcweir 				default:
182cdf0e10cSrcweir 						;
183cdf0e10cSrcweir                     //DBG_ASSERT( 0, "unknown property" );
184cdf0e10cSrcweir 			}
185cdf0e10cSrcweir 			if (pbResVal)
186cdf0e10cSrcweir 				pVal[i].Value >>= *pbResVal;
187cdf0e10cSrcweir 		}
188cdf0e10cSrcweir 	}
189cdf0e10cSrcweir }
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 
propertyChange_Impl(const PropertyChangeEvent & rEvt)192cdf0e10cSrcweir sal_Bool PropertyChgHelper::propertyChange_Impl( const PropertyChangeEvent& rEvt )
193cdf0e10cSrcweir {
194cdf0e10cSrcweir 	sal_Bool bRes = sal_False;
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 	if (GetPropSet().is()  &&  rEvt.Source == GetPropSet())
197cdf0e10cSrcweir 	{
198cdf0e10cSrcweir 		sal_Int16 nLngSvcFlags = (nEvtFlags & AE_HYPHENATOR) ?
199cdf0e10cSrcweir 					LinguServiceEventFlags::HYPHENATE_AGAIN : 0;
200cdf0e10cSrcweir 		sal_Bool bSCWA = sal_False,	// SPELL_CORRECT_WORDS_AGAIN ?
201cdf0e10cSrcweir 			 bSWWA = sal_False;	// SPELL_WRONG_WORDS_AGAIN ?
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 		sal_Bool  *pbVal = NULL;
204cdf0e10cSrcweir 		switch (rEvt.PropertyHandle)
205cdf0e10cSrcweir 		{
206cdf0e10cSrcweir 			case UPH_IS_IGNORE_CONTROL_CHARACTERS :
207cdf0e10cSrcweir 			{
208cdf0e10cSrcweir 				pbVal = &bIsIgnoreControlCharacters;
209cdf0e10cSrcweir 				nLngSvcFlags = 0;
210cdf0e10cSrcweir 				break;
211cdf0e10cSrcweir 			}
212cdf0e10cSrcweir 			case UPH_IS_USE_DICTIONARY_LIST		  :
213cdf0e10cSrcweir 			{
214cdf0e10cSrcweir 				pbVal = &bIsUseDictionaryList;
215cdf0e10cSrcweir 				bSCWA = bSWWA = sal_True;
216cdf0e10cSrcweir 				break;
217cdf0e10cSrcweir 			}
218cdf0e10cSrcweir 			default:
219cdf0e10cSrcweir 			{
220cdf0e10cSrcweir 				bRes = sal_False;
221cdf0e10cSrcweir                 //DBG_ASSERT( 0, "unknown property" );
222cdf0e10cSrcweir 			}
223cdf0e10cSrcweir 		}
224cdf0e10cSrcweir 		if (pbVal)
225cdf0e10cSrcweir 			rEvt.NewValue >>= *pbVal;
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 		bRes = 0 != pbVal;	// sth changed?
228cdf0e10cSrcweir 		if (bRes)
229cdf0e10cSrcweir 		{
230cdf0e10cSrcweir 			sal_Bool bSpellEvts = (nEvtFlags & AE_SPELLCHECKER) ? sal_True : sal_False;
231cdf0e10cSrcweir 			if (bSCWA && bSpellEvts)
232cdf0e10cSrcweir 				nLngSvcFlags |= LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN;
233cdf0e10cSrcweir 			if (bSWWA && bSpellEvts)
234cdf0e10cSrcweir 				nLngSvcFlags |= LinguServiceEventFlags::SPELL_WRONG_WORDS_AGAIN;
235cdf0e10cSrcweir 			if (nLngSvcFlags)
236cdf0e10cSrcweir 			{
237cdf0e10cSrcweir 				LinguServiceEvent aEvt( GetEvtObj(), nLngSvcFlags );
238cdf0e10cSrcweir 				LaunchEvent( aEvt );
239cdf0e10cSrcweir 			}
240cdf0e10cSrcweir 		}
241cdf0e10cSrcweir 	}
242cdf0e10cSrcweir 
243cdf0e10cSrcweir 	return bRes;
244cdf0e10cSrcweir }
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 
247cdf0e10cSrcweir void SAL_CALL
propertyChange(const PropertyChangeEvent & rEvt)248cdf0e10cSrcweir 	PropertyChgHelper::propertyChange( const PropertyChangeEvent& rEvt )
249cdf0e10cSrcweir 		throw(RuntimeException)
250cdf0e10cSrcweir {
251cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
252cdf0e10cSrcweir 	propertyChange_Impl( rEvt );
253cdf0e10cSrcweir }
254cdf0e10cSrcweir 
255cdf0e10cSrcweir 
AddAsPropListener()256cdf0e10cSrcweir void PropertyChgHelper::AddAsPropListener()
257cdf0e10cSrcweir {
258cdf0e10cSrcweir 	if (xPropSet.is())
259cdf0e10cSrcweir 	{
260cdf0e10cSrcweir 		sal_Int32 nLen = aPropNames.getLength();
261cdf0e10cSrcweir 		const OUString *pPropName = aPropNames.getConstArray();
262cdf0e10cSrcweir 		for (sal_Int32 i = 0;  i < nLen;  ++i)
263cdf0e10cSrcweir 		{
264cdf0e10cSrcweir 			if (pPropName[i].getLength())
265cdf0e10cSrcweir 				xPropSet->addPropertyChangeListener( pPropName[i], this );
266cdf0e10cSrcweir 		}
267cdf0e10cSrcweir 	}
268cdf0e10cSrcweir }
269cdf0e10cSrcweir 
RemoveAsPropListener()270cdf0e10cSrcweir void PropertyChgHelper::RemoveAsPropListener()
271cdf0e10cSrcweir {
272cdf0e10cSrcweir 	if (xPropSet.is())
273cdf0e10cSrcweir 	{
274cdf0e10cSrcweir 		sal_Int32 nLen = aPropNames.getLength();
275cdf0e10cSrcweir 		const OUString *pPropName = aPropNames.getConstArray();
276cdf0e10cSrcweir 		for (sal_Int32 i = 0;  i < nLen;  ++i)
277cdf0e10cSrcweir 		{
278cdf0e10cSrcweir 			if (pPropName[i].getLength())
279cdf0e10cSrcweir 				xPropSet->removePropertyChangeListener( pPropName[i], this );
280cdf0e10cSrcweir 		}
281cdf0e10cSrcweir 	}
282cdf0e10cSrcweir }
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 
LaunchEvent(const LinguServiceEvent & rEvt)285cdf0e10cSrcweir void PropertyChgHelper::LaunchEvent( const LinguServiceEvent &rEvt )
286cdf0e10cSrcweir {
287cdf0e10cSrcweir 	cppu::OInterfaceIteratorHelper aIt( aLngSvcEvtListeners );
288cdf0e10cSrcweir 	while (aIt.hasMoreElements())
289cdf0e10cSrcweir 	{
290cdf0e10cSrcweir 		Reference< XLinguServiceEventListener > xRef( aIt.next(), UNO_QUERY );
291cdf0e10cSrcweir 		if (xRef.is())
292cdf0e10cSrcweir 			xRef->processLinguServiceEvent( rEvt );
293cdf0e10cSrcweir 	}
294cdf0e10cSrcweir }
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 
disposing(const EventObject & rSource)297cdf0e10cSrcweir void SAL_CALL PropertyChgHelper::disposing( const EventObject& rSource )
298cdf0e10cSrcweir 		throw(RuntimeException)
299cdf0e10cSrcweir {
300cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
301cdf0e10cSrcweir 	if (rSource.Source == xPropSet)
302cdf0e10cSrcweir 	{
303cdf0e10cSrcweir 		RemoveAsPropListener();
304cdf0e10cSrcweir 		xPropSet = NULL;
305cdf0e10cSrcweir 		aPropNames.realloc( 0 );
306cdf0e10cSrcweir 	}
307cdf0e10cSrcweir }
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 
310cdf0e10cSrcweir sal_Bool SAL_CALL
addLinguServiceEventListener(const Reference<XLinguServiceEventListener> & rxListener)311cdf0e10cSrcweir 	PropertyChgHelper::addLinguServiceEventListener(
312cdf0e10cSrcweir 			const Reference< XLinguServiceEventListener >& rxListener )
313cdf0e10cSrcweir 		throw(RuntimeException)
314cdf0e10cSrcweir {
315cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
316cdf0e10cSrcweir 
317cdf0e10cSrcweir 	sal_Bool bRes = sal_False;
318cdf0e10cSrcweir 	if (rxListener.is())
319cdf0e10cSrcweir 	{
320cdf0e10cSrcweir 		sal_Int32	nCount = aLngSvcEvtListeners.getLength();
321cdf0e10cSrcweir 		bRes = aLngSvcEvtListeners.addInterface( rxListener ) != nCount;
322cdf0e10cSrcweir 	}
323cdf0e10cSrcweir 	return bRes;
324cdf0e10cSrcweir }
325cdf0e10cSrcweir 
326cdf0e10cSrcweir 
327cdf0e10cSrcweir sal_Bool SAL_CALL
removeLinguServiceEventListener(const Reference<XLinguServiceEventListener> & rxListener)328cdf0e10cSrcweir 	PropertyChgHelper::removeLinguServiceEventListener(
329cdf0e10cSrcweir 			const Reference< XLinguServiceEventListener >& rxListener )
330cdf0e10cSrcweir 		throw(RuntimeException)
331cdf0e10cSrcweir {
332cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
333cdf0e10cSrcweir 
334cdf0e10cSrcweir 	sal_Bool bRes = sal_False;
335cdf0e10cSrcweir 	if (rxListener.is())
336cdf0e10cSrcweir 	{
337cdf0e10cSrcweir 		sal_Int32	nCount = aLngSvcEvtListeners.getLength();
338cdf0e10cSrcweir 		bRes = aLngSvcEvtListeners.removeInterface( rxListener ) != nCount;
339cdf0e10cSrcweir 	}
340cdf0e10cSrcweir 	return bRes;
341cdf0e10cSrcweir }
342cdf0e10cSrcweir 
343cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 
PropertyHelper_Thes(const Reference<XInterface> & rxSource,Reference<XPropertySet> & rxPropSet)346cdf0e10cSrcweir PropertyHelper_Thes::PropertyHelper_Thes(
347cdf0e10cSrcweir 		const Reference< XInterface > &rxSource,
348cdf0e10cSrcweir 		Reference< XPropertySet > &rxPropSet ) :
349cdf0e10cSrcweir 	PropertyChgHelper	( rxSource, rxPropSet, 0 )
350cdf0e10cSrcweir {
351cdf0e10cSrcweir 	SetDefaultValues();
352cdf0e10cSrcweir 	GetCurrentValues();
353cdf0e10cSrcweir }
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 
~PropertyHelper_Thes()356cdf0e10cSrcweir PropertyHelper_Thes::~PropertyHelper_Thes()
357cdf0e10cSrcweir {
358cdf0e10cSrcweir }
359cdf0e10cSrcweir 
360cdf0e10cSrcweir 
361cdf0e10cSrcweir void SAL_CALL
propertyChange(const PropertyChangeEvent & rEvt)362cdf0e10cSrcweir 	PropertyHelper_Thes::propertyChange( const PropertyChangeEvent& rEvt )
363cdf0e10cSrcweir 		throw(RuntimeException)
364cdf0e10cSrcweir {
365cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
366cdf0e10cSrcweir     PropertyChgHelper::propertyChange_Impl( rEvt );
367cdf0e10cSrcweir }
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 
370cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
371cdf0e10cSrcweir 
372cdf0e10cSrcweir // list of properties from the property set to be used
373cdf0e10cSrcweir // and listened to
374cdf0e10cSrcweir static const char *aSP[] =
375cdf0e10cSrcweir {
376cdf0e10cSrcweir 	UPN_IS_SPELL_UPPER_CASE,
377cdf0e10cSrcweir 	UPN_IS_SPELL_WITH_DIGITS,
378cdf0e10cSrcweir     UPN_IS_SPELL_CAPITALIZATION
379cdf0e10cSrcweir };
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 
PropertyHelper_Spell(const Reference<XInterface> & rxSource,Reference<XPropertySet> & rxPropSet)382cdf0e10cSrcweir PropertyHelper_Spell::PropertyHelper_Spell(
383cdf0e10cSrcweir 		const Reference< XInterface > & rxSource,
384cdf0e10cSrcweir 		Reference< XPropertySet > &rxPropSet ) :
385cdf0e10cSrcweir 	PropertyChgHelper	( rxSource, rxPropSet, AE_SPELLCHECKER )
386cdf0e10cSrcweir {
387cdf0e10cSrcweir 	AddPropNames( aSP, sizeof(aSP) / sizeof(aSP[0]) );
388cdf0e10cSrcweir 	SetDefaultValues();
389cdf0e10cSrcweir 	GetCurrentValues();
390cdf0e10cSrcweir 
391cdf0e10cSrcweir     nResMaxNumberOfSuggestions = GetDefaultNumberOfSuggestions();
392cdf0e10cSrcweir }
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 
~PropertyHelper_Spell()395cdf0e10cSrcweir PropertyHelper_Spell::~PropertyHelper_Spell()
396cdf0e10cSrcweir {
397cdf0e10cSrcweir }
398cdf0e10cSrcweir 
399cdf0e10cSrcweir 
SetDefaultValues()400cdf0e10cSrcweir void PropertyHelper_Spell::SetDefaultValues()
401cdf0e10cSrcweir {
402cdf0e10cSrcweir 	PropertyChgHelper::SetDefaultValues();
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 	bResIsSpellUpperCase		= bIsSpellUpperCase			= sal_False;
405cdf0e10cSrcweir 	bResIsSpellWithDigits		= bIsSpellWithDigits		= sal_False;
406cdf0e10cSrcweir 	bResIsSpellCapitalization	= bIsSpellCapitalization	= sal_True;
407cdf0e10cSrcweir }
408cdf0e10cSrcweir 
409cdf0e10cSrcweir 
GetCurrentValues()410cdf0e10cSrcweir void PropertyHelper_Spell::GetCurrentValues()
411cdf0e10cSrcweir {
412cdf0e10cSrcweir 	PropertyChgHelper::GetCurrentValues();
413cdf0e10cSrcweir 
414cdf0e10cSrcweir 	sal_Int32 nLen = GetPropNames().getLength();
415cdf0e10cSrcweir 	if (GetPropSet().is() && nLen)
416cdf0e10cSrcweir 	{
417cdf0e10cSrcweir 		const OUString *pPropName = GetPropNames().getConstArray();
418cdf0e10cSrcweir 		for (sal_Int32 i = 0;  i < nLen;  ++i)
419cdf0e10cSrcweir 		{
420cdf0e10cSrcweir 			sal_Bool *pbVal		= NULL,
421cdf0e10cSrcweir 				 *pbResVal	= NULL;
422cdf0e10cSrcweir 
423cdf0e10cSrcweir             if (pPropName[i].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UPN_IS_SPELL_UPPER_CASE ) ))
424cdf0e10cSrcweir 			{
425cdf0e10cSrcweir 				pbVal	 = &bIsSpellUpperCase;
426cdf0e10cSrcweir 				pbResVal = &bResIsSpellUpperCase;
427cdf0e10cSrcweir 			}
428cdf0e10cSrcweir             else if (pPropName[i].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UPN_IS_SPELL_WITH_DIGITS ) ))
429cdf0e10cSrcweir 			{
430cdf0e10cSrcweir 				pbVal	 = &bIsSpellWithDigits;
431cdf0e10cSrcweir 				pbResVal = &bResIsSpellWithDigits;
432cdf0e10cSrcweir 			}
433cdf0e10cSrcweir             else if (pPropName[i].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UPN_IS_SPELL_CAPITALIZATION ) ))
434cdf0e10cSrcweir 			{
435cdf0e10cSrcweir 				pbVal	 = &bIsSpellCapitalization;
436cdf0e10cSrcweir 				pbResVal = &bResIsSpellCapitalization;
437cdf0e10cSrcweir 			}
438cdf0e10cSrcweir 
439cdf0e10cSrcweir 			if (pbVal && pbResVal)
440cdf0e10cSrcweir 			{
441cdf0e10cSrcweir 				GetPropSet()->getPropertyValue( pPropName[i] ) >>= *pbVal;
442cdf0e10cSrcweir 				*pbResVal = *pbVal;
443cdf0e10cSrcweir 			}
444cdf0e10cSrcweir 		}
445cdf0e10cSrcweir 	}
446cdf0e10cSrcweir }
447cdf0e10cSrcweir 
448cdf0e10cSrcweir 
propertyChange_Impl(const PropertyChangeEvent & rEvt)449cdf0e10cSrcweir sal_Bool PropertyHelper_Spell::propertyChange_Impl( const PropertyChangeEvent& rEvt )
450cdf0e10cSrcweir {
451cdf0e10cSrcweir 	sal_Bool bRes = PropertyChgHelper::propertyChange_Impl( rEvt );
452cdf0e10cSrcweir 
453cdf0e10cSrcweir 	if (!bRes  &&  GetPropSet().is()  &&  rEvt.Source == GetPropSet())
454cdf0e10cSrcweir 	{
455cdf0e10cSrcweir 		sal_Int16 nLngSvcFlags = 0;
456cdf0e10cSrcweir 		sal_Bool bSCWA = sal_False,	// SPELL_CORRECT_WORDS_AGAIN ?
457cdf0e10cSrcweir 			 bSWWA = sal_False;	// SPELL_WRONG_WORDS_AGAIN ?
458cdf0e10cSrcweir 
459cdf0e10cSrcweir 		sal_Bool *pbVal = NULL;
460cdf0e10cSrcweir 		switch (rEvt.PropertyHandle)
461cdf0e10cSrcweir 		{
462cdf0e10cSrcweir 			case UPH_IS_SPELL_UPPER_CASE		  :
463cdf0e10cSrcweir 			{
464cdf0e10cSrcweir 				pbVal = &bIsSpellUpperCase;
465cdf0e10cSrcweir 				bSCWA = sal_False == *pbVal;	// sal_False->sal_True change?
466cdf0e10cSrcweir 				bSWWA = !bSCWA;				// sal_True->sal_False change?
467cdf0e10cSrcweir 				break;
468cdf0e10cSrcweir 			}
469cdf0e10cSrcweir 			case UPH_IS_SPELL_WITH_DIGITS		  :
470cdf0e10cSrcweir 			{
471cdf0e10cSrcweir 				pbVal = &bIsSpellWithDigits;
472cdf0e10cSrcweir 				bSCWA = sal_False == *pbVal;	// sal_False->sal_True change?
473cdf0e10cSrcweir 				bSWWA = !bSCWA;				// sal_True->sal_False change?
474cdf0e10cSrcweir 				break;
475cdf0e10cSrcweir 			}
476cdf0e10cSrcweir 			case UPH_IS_SPELL_CAPITALIZATION	  :
477cdf0e10cSrcweir 			{
478cdf0e10cSrcweir 				pbVal = &bIsSpellCapitalization;
479cdf0e10cSrcweir 				bSCWA = sal_False == *pbVal;	// sal_False->sal_True change?
480cdf0e10cSrcweir 				bSWWA = !bSCWA;				// sal_True->sal_False change?
481cdf0e10cSrcweir 				break;
482cdf0e10cSrcweir 			}
483cdf0e10cSrcweir 			default:
484cdf0e10cSrcweir                 DBG_ASSERT( 0, "unknown property" );
485cdf0e10cSrcweir 		}
486cdf0e10cSrcweir 		if (pbVal)
487cdf0e10cSrcweir 			rEvt.NewValue >>= *pbVal;
488cdf0e10cSrcweir 
489cdf0e10cSrcweir 		bRes = (pbVal != 0);
490cdf0e10cSrcweir 		if (bRes)
491cdf0e10cSrcweir 		{
492cdf0e10cSrcweir 			if (bSCWA)
493cdf0e10cSrcweir 				nLngSvcFlags |= LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN;
494cdf0e10cSrcweir 			if (bSWWA)
495cdf0e10cSrcweir 				nLngSvcFlags |= LinguServiceEventFlags::SPELL_WRONG_WORDS_AGAIN;
496cdf0e10cSrcweir 			if (nLngSvcFlags)
497cdf0e10cSrcweir 			{
498cdf0e10cSrcweir 				LinguServiceEvent aEvt( GetEvtObj(), nLngSvcFlags );
499cdf0e10cSrcweir 				LaunchEvent( aEvt );
500cdf0e10cSrcweir 			}
501cdf0e10cSrcweir 		}
502cdf0e10cSrcweir 	}
503cdf0e10cSrcweir 
504cdf0e10cSrcweir 	return bRes;
505cdf0e10cSrcweir }
506cdf0e10cSrcweir 
507cdf0e10cSrcweir 
508cdf0e10cSrcweir void SAL_CALL
propertyChange(const PropertyChangeEvent & rEvt)509cdf0e10cSrcweir 	PropertyHelper_Spell::propertyChange( const PropertyChangeEvent& rEvt )
510cdf0e10cSrcweir 		throw(RuntimeException)
511cdf0e10cSrcweir {
512cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
513cdf0e10cSrcweir 	propertyChange_Impl( rEvt );
514cdf0e10cSrcweir }
515cdf0e10cSrcweir 
516cdf0e10cSrcweir 
SetTmpPropVals(const PropertyValues & rPropVals)517cdf0e10cSrcweir void PropertyHelper_Spell::SetTmpPropVals( const PropertyValues &rPropVals )
518cdf0e10cSrcweir {
519cdf0e10cSrcweir 	PropertyChgHelper::SetTmpPropVals( rPropVals );
520cdf0e10cSrcweir 
521cdf0e10cSrcweir 	// return value is default value unless there is an explicitly supplied
522cdf0e10cSrcweir 	// temporary value
523cdf0e10cSrcweir     nResMaxNumberOfSuggestions  = GetDefaultNumberOfSuggestions();
524cdf0e10cSrcweir 	bResIsSpellWithDigits		= bIsSpellWithDigits;
525cdf0e10cSrcweir 	bResIsSpellCapitalization	= bIsSpellCapitalization;
526cdf0e10cSrcweir 	//
527cdf0e10cSrcweir 	sal_Int32 nLen = rPropVals.getLength();
528cdf0e10cSrcweir 	if (nLen)
529cdf0e10cSrcweir 	{
530cdf0e10cSrcweir 		const PropertyValue *pVal = rPropVals.getConstArray();
531cdf0e10cSrcweir 		for (sal_Int32 i = 0;  i < nLen;  ++i)
532cdf0e10cSrcweir 		{
533cdf0e10cSrcweir             if (pVal[i].Name.equalsAscii( UPN_MAX_NUMBER_OF_SUGGESTIONS ))
534cdf0e10cSrcweir             {
535cdf0e10cSrcweir                 pVal[i].Value >>= nResMaxNumberOfSuggestions;
536cdf0e10cSrcweir             }
537cdf0e10cSrcweir             else
538cdf0e10cSrcweir             {
539cdf0e10cSrcweir                 sal_Bool *pbResVal = NULL;
540cdf0e10cSrcweir                 switch (pVal[i].Handle)
541cdf0e10cSrcweir                 {
542cdf0e10cSrcweir                     case UPH_IS_SPELL_UPPER_CASE     : pbResVal = &bResIsSpellUpperCase; break;
543cdf0e10cSrcweir                     case UPH_IS_SPELL_WITH_DIGITS    : pbResVal = &bResIsSpellWithDigits; break;
544cdf0e10cSrcweir                     case UPH_IS_SPELL_CAPITALIZATION : pbResVal = &bResIsSpellCapitalization; break;
545cdf0e10cSrcweir                     default:
546cdf0e10cSrcweir                         DBG_ASSERT( 0, "unknown property" );
547cdf0e10cSrcweir                 }
548cdf0e10cSrcweir                 if (pbResVal)
549cdf0e10cSrcweir                     pVal[i].Value >>= *pbResVal;
550cdf0e10cSrcweir             }
551cdf0e10cSrcweir 		}
552cdf0e10cSrcweir 	}
553cdf0e10cSrcweir }
554cdf0e10cSrcweir 
GetDefaultNumberOfSuggestions() const555cdf0e10cSrcweir sal_Int16 PropertyHelper_Spell::GetDefaultNumberOfSuggestions() const
556cdf0e10cSrcweir {
557cdf0e10cSrcweir     return 16;
558cdf0e10cSrcweir }
559cdf0e10cSrcweir 
560cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
561cdf0e10cSrcweir 
562cdf0e10cSrcweir static const char *aHP[] =
563cdf0e10cSrcweir {
564cdf0e10cSrcweir 	UPN_HYPH_MIN_LEADING,
565cdf0e10cSrcweir 	UPN_HYPH_MIN_TRAILING,
566cdf0e10cSrcweir 	UPN_HYPH_MIN_WORD_LENGTH
567cdf0e10cSrcweir };
568cdf0e10cSrcweir 
569cdf0e10cSrcweir 
PropertyHelper_Hyphen(const Reference<XInterface> & rxSource,Reference<XPropertySet> & rxPropSet)570cdf0e10cSrcweir PropertyHelper_Hyphen::PropertyHelper_Hyphen(
571cdf0e10cSrcweir 		const Reference< XInterface > & rxSource,
572cdf0e10cSrcweir 		Reference< XPropertySet > &rxPropSet ) :
573cdf0e10cSrcweir 	PropertyChgHelper	( rxSource, rxPropSet, AE_HYPHENATOR )
574cdf0e10cSrcweir {
575cdf0e10cSrcweir 	AddPropNames( aHP, sizeof(aHP) / sizeof(aHP[0]) );
576cdf0e10cSrcweir 	SetDefaultValues();
577cdf0e10cSrcweir 	GetCurrentValues();
578cdf0e10cSrcweir }
579cdf0e10cSrcweir 
580cdf0e10cSrcweir 
~PropertyHelper_Hyphen()581cdf0e10cSrcweir PropertyHelper_Hyphen::~PropertyHelper_Hyphen()
582cdf0e10cSrcweir {
583cdf0e10cSrcweir }
584cdf0e10cSrcweir 
585cdf0e10cSrcweir 
SetDefaultValues()586cdf0e10cSrcweir void PropertyHelper_Hyphen::SetDefaultValues()
587cdf0e10cSrcweir {
588cdf0e10cSrcweir 	PropertyChgHelper::SetDefaultValues();
589cdf0e10cSrcweir 
590cdf0e10cSrcweir 	nResHyphMinLeading	 	= nHyphMinLeading		= 2;
591cdf0e10cSrcweir 	nResHyphMinTrailing	 	= nHyphMinTrailing		= 2;
592cdf0e10cSrcweir 	nResHyphMinWordLength	= nHyphMinWordLength	= 0;
593cdf0e10cSrcweir }
594cdf0e10cSrcweir 
595cdf0e10cSrcweir 
GetCurrentValues()596cdf0e10cSrcweir void PropertyHelper_Hyphen::GetCurrentValues()
597cdf0e10cSrcweir {
598cdf0e10cSrcweir 	PropertyChgHelper::GetCurrentValues();
599cdf0e10cSrcweir 
600cdf0e10cSrcweir 	sal_Int32 nLen = GetPropNames().getLength();
601cdf0e10cSrcweir 	if (GetPropSet().is() && nLen)
602cdf0e10cSrcweir 	{
603cdf0e10cSrcweir 		const OUString *pPropName = GetPropNames().getConstArray();
604cdf0e10cSrcweir 		for (sal_Int32 i = 0;  i < nLen;  ++i)
605cdf0e10cSrcweir 		{
606cdf0e10cSrcweir 			sal_Int16  *pnVal	 = NULL,
607cdf0e10cSrcweir 				   *pnResVal = NULL;
608cdf0e10cSrcweir 
609cdf0e10cSrcweir             if (pPropName[i].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UPN_HYPH_MIN_LEADING ) ))
610cdf0e10cSrcweir 			{
611cdf0e10cSrcweir 				pnVal	 = &nHyphMinLeading;
612cdf0e10cSrcweir 				pnResVal = &nResHyphMinLeading;
613cdf0e10cSrcweir 			}
614cdf0e10cSrcweir             else if (pPropName[i].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UPN_HYPH_MIN_TRAILING ) ))
615cdf0e10cSrcweir 			{
616cdf0e10cSrcweir 				pnVal	 = &nHyphMinTrailing;
617cdf0e10cSrcweir 				pnResVal = &nResHyphMinTrailing;
618cdf0e10cSrcweir 			}
619cdf0e10cSrcweir             else if (pPropName[i].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UPN_HYPH_MIN_WORD_LENGTH ) ))
620cdf0e10cSrcweir 			{
621cdf0e10cSrcweir 				pnVal	 = &nHyphMinWordLength;
622cdf0e10cSrcweir 				pnResVal = &nResHyphMinWordLength;
623cdf0e10cSrcweir 			}
624cdf0e10cSrcweir 
625cdf0e10cSrcweir 			if (pnVal && pnResVal)
626cdf0e10cSrcweir 			{
627cdf0e10cSrcweir 				GetPropSet()->getPropertyValue( pPropName[i] ) >>= *pnVal;
628cdf0e10cSrcweir 				*pnResVal = *pnVal;
629cdf0e10cSrcweir 			}
630cdf0e10cSrcweir 		}
631cdf0e10cSrcweir 	}
632cdf0e10cSrcweir }
633cdf0e10cSrcweir 
634cdf0e10cSrcweir 
propertyChange_Impl(const PropertyChangeEvent & rEvt)635cdf0e10cSrcweir sal_Bool PropertyHelper_Hyphen::propertyChange_Impl( const PropertyChangeEvent& rEvt )
636cdf0e10cSrcweir {
637cdf0e10cSrcweir 	sal_Bool bRes = PropertyChgHelper::propertyChange_Impl( rEvt );
638cdf0e10cSrcweir 
639cdf0e10cSrcweir 	if (!bRes  &&  GetPropSet().is()  &&  rEvt.Source == GetPropSet())
640cdf0e10cSrcweir 	{
641cdf0e10cSrcweir 		sal_Int16 nLngSvcFlags = LinguServiceEventFlags::HYPHENATE_AGAIN;
642cdf0e10cSrcweir 
643cdf0e10cSrcweir 		sal_Int16	*pnVal = NULL;
644cdf0e10cSrcweir 		switch (rEvt.PropertyHandle)
645cdf0e10cSrcweir 		{
646cdf0e10cSrcweir 			case UPH_HYPH_MIN_LEADING	  : pnVal = &nHyphMinLeading; break;
647cdf0e10cSrcweir 			case UPH_HYPH_MIN_TRAILING	  : pnVal = &nHyphMinTrailing; break;
648cdf0e10cSrcweir 			case UPH_HYPH_MIN_WORD_LENGTH : pnVal = &nHyphMinWordLength; break;
649cdf0e10cSrcweir 			default:
650cdf0e10cSrcweir                 DBG_ASSERT( 0, "unknown property" );
651cdf0e10cSrcweir 		}
652cdf0e10cSrcweir 		if (pnVal)
653cdf0e10cSrcweir 			rEvt.NewValue >>= *pnVal;
654cdf0e10cSrcweir 
655cdf0e10cSrcweir 		bRes = (pnVal != 0);
656cdf0e10cSrcweir 		if (bRes)
657cdf0e10cSrcweir 		{
658cdf0e10cSrcweir 			if (nLngSvcFlags)
659cdf0e10cSrcweir 			{
660cdf0e10cSrcweir 				LinguServiceEvent aEvt( GetEvtObj(), nLngSvcFlags );
661cdf0e10cSrcweir 				LaunchEvent( aEvt );
662cdf0e10cSrcweir 			}
663cdf0e10cSrcweir 		}
664cdf0e10cSrcweir 	}
665cdf0e10cSrcweir 
666cdf0e10cSrcweir 	return bRes;
667cdf0e10cSrcweir }
668cdf0e10cSrcweir 
669cdf0e10cSrcweir 
670cdf0e10cSrcweir void SAL_CALL
propertyChange(const PropertyChangeEvent & rEvt)671cdf0e10cSrcweir     PropertyHelper_Hyphen::propertyChange( const PropertyChangeEvent& rEvt )
672cdf0e10cSrcweir 		throw(RuntimeException)
673cdf0e10cSrcweir {
674cdf0e10cSrcweir 	MutexGuard	aGuard( GetLinguMutex() );
675cdf0e10cSrcweir 	propertyChange_Impl( rEvt );
676cdf0e10cSrcweir }
677cdf0e10cSrcweir 
678cdf0e10cSrcweir 
SetTmpPropVals(const PropertyValues & rPropVals)679cdf0e10cSrcweir void PropertyHelper_Hyphen::SetTmpPropVals( const PropertyValues &rPropVals )
680cdf0e10cSrcweir {
681cdf0e10cSrcweir 	PropertyChgHelper::SetTmpPropVals( rPropVals );
682cdf0e10cSrcweir 
683cdf0e10cSrcweir 	// return value is default value unless there is an explicitly supplied
684cdf0e10cSrcweir 	// temporary value
685cdf0e10cSrcweir 	nResHyphMinLeading	 	= nHyphMinLeading;
686cdf0e10cSrcweir 	nResHyphMinTrailing	 	= nHyphMinTrailing;
687cdf0e10cSrcweir 	nResHyphMinWordLength	= nHyphMinWordLength;
688cdf0e10cSrcweir 	//
689cdf0e10cSrcweir 	sal_Int32 nLen = rPropVals.getLength();
690cdf0e10cSrcweir 	if (nLen)
691cdf0e10cSrcweir 	{
692cdf0e10cSrcweir 		const PropertyValue *pVal = rPropVals.getConstArray();
693cdf0e10cSrcweir 		for (sal_Int32 i = 0;  i < nLen;  ++i)
694cdf0e10cSrcweir 		{
695cdf0e10cSrcweir 			sal_Int16	*pnResVal = NULL;
696cdf0e10cSrcweir 			switch (pVal[i].Handle)
697cdf0e10cSrcweir 			{
698cdf0e10cSrcweir 				case UPH_HYPH_MIN_LEADING	  : pnResVal = &nResHyphMinLeading; break;
699cdf0e10cSrcweir 				case UPH_HYPH_MIN_TRAILING	  : pnResVal = &nResHyphMinTrailing; break;
700cdf0e10cSrcweir 				case UPH_HYPH_MIN_WORD_LENGTH : pnResVal = &nResHyphMinWordLength; break;
701cdf0e10cSrcweir 				default:
702cdf0e10cSrcweir                     DBG_ASSERT( 0, "unknown property" );
703cdf0e10cSrcweir 			}
704cdf0e10cSrcweir 			if (pnResVal)
705cdf0e10cSrcweir 				pVal[i].Value >>= *pnResVal;
706cdf0e10cSrcweir 		}
707cdf0e10cSrcweir 	}
708cdf0e10cSrcweir }
709cdf0e10cSrcweir 
710cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
711cdf0e10cSrcweir 
712cdf0e10cSrcweir }   // namespace linguistic
713cdf0e10cSrcweir 
714