xref: /aoo41x/main/linguistic/source/lngopt.hxx (revision 63ce064a)
1*63ce064aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*63ce064aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*63ce064aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*63ce064aSAndrew Rist  * distributed with this work for additional information
6*63ce064aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*63ce064aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*63ce064aSAndrew Rist  * "License"); you may not use this file except in compliance
9*63ce064aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*63ce064aSAndrew Rist  *
11*63ce064aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*63ce064aSAndrew Rist  *
13*63ce064aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*63ce064aSAndrew Rist  * software distributed under the License is distributed on an
15*63ce064aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*63ce064aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*63ce064aSAndrew Rist  * specific language governing permissions and limitations
18*63ce064aSAndrew Rist  * under the License.
19*63ce064aSAndrew Rist  *
20*63ce064aSAndrew Rist  *************************************************************/
21*63ce064aSAndrew Rist 
22*63ce064aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _LINGUISTIC_LNGOPT_HHX_
25cdf0e10cSrcweir #define _LINGUISTIC_LNGOPT_HHX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <functional>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <uno/lbnames.h>			// CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
30cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx>	// helper for implementations
31cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
32cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
33cdf0e10cSrcweir #include <com/sun/star/beans/XFastPropertySet.hpp>
34cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
35cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyAccess.hpp>
36cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
37cdf0e10cSrcweir #include <unotools/lingucfg.hxx>
38cdf0e10cSrcweir #include <svl/itemprop.hxx>
39cdf0e10cSrcweir #include <unotools/configitem.hxx>
40cdf0e10cSrcweir #include <com/sun/star/uno/Any.h>
41cdf0e10cSrcweir #include <tools/solar.h>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir #include <svl/itemprop.hxx>
44cdf0e10cSrcweir #include "linguistic/misc.hxx"
45cdf0e10cSrcweir #include "defs.hxx"
46cdf0e10cSrcweir #include <vos/refernce.hxx>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir namespace com { namespace sun { namespace star {
49cdf0e10cSrcweir 	namespace beans {
50cdf0e10cSrcweir 		struct PropertyChangeEvent;
51cdf0e10cSrcweir 	}
52cdf0e10cSrcweir 	namespace registry {
53cdf0e10cSrcweir 		class XRegistryKey;
54cdf0e10cSrcweir 	}
55cdf0e10cSrcweir }}}
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 
59cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
60cdf0e10cSrcweir // LinguOptions
61cdf0e10cSrcweir // This class represents all Linguistik relevant options.
62cdf0e10cSrcweir //
63cdf0e10cSrcweir 
64cdf0e10cSrcweir class LinguOptions
65cdf0e10cSrcweir {
66cdf0e10cSrcweir 	static SvtLinguOptions	   *pData;
67cdf0e10cSrcweir 	static vos::ORefCount		aRefCount;	// number of objects of this class
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	//! uses default assignment-operator
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 	sal_Bool SetLocale_Impl( sal_Int16 &rLanguage,
72cdf0e10cSrcweir 			::com::sun::star::uno::Any &rOld,
73cdf0e10cSrcweir 			const ::com::sun::star::uno::Any &rVal, sal_Int16 nType );
74cdf0e10cSrcweir 
75cdf0e10cSrcweir public:
76cdf0e10cSrcweir 	LinguOptions();
77cdf0e10cSrcweir 	LinguOptions(const LinguOptions &rOpt);
78cdf0e10cSrcweir 	~LinguOptions();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	sal_Bool			SetValue( ::com::sun::star::uno::Any &rOld,
81cdf0e10cSrcweir 							const ::com::sun::star::uno::Any &rVal, sal_Int32 nWID );
82cdf0e10cSrcweir 	void			GetValue( ::com::sun::star::uno::Any &rVal, sal_Int32 nWID ) const;
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     static ::rtl::OUString    GetName( sal_Int32 nWID );
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	const ::com::sun::star::uno::Sequence< rtl::OUString >
GetActiveDics() const87cdf0e10cSrcweir 			GetActiveDics() const	{ return pData->aActiveDics; }
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     const ::com::sun::star::uno::Sequence< rtl::OUString >
GetActiveConvDics() const90cdf0e10cSrcweir             GetActiveConvDics() const   { return pData->aActiveConvDics; }
91cdf0e10cSrcweir };
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 
94cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
95cdf0e10cSrcweir 
96cdf0e10cSrcweir // uses templates from <cppuhelper/interfacecontainer.h>
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 
99cdf0e10cSrcweir // helper function call class
100cdf0e10cSrcweir struct PropHashType_Impl
101cdf0e10cSrcweir {
operator ()PropHashType_Impl102cdf0e10cSrcweir 	size_t operator()(const sal_Int32 &s) const	{ return s; }
103cdf0e10cSrcweir };
104cdf0e10cSrcweir 
105cdf0e10cSrcweir typedef cppu::OMultiTypeInterfaceContainerHelperVar
106cdf0e10cSrcweir 	<
107cdf0e10cSrcweir 		sal_Int32,
108cdf0e10cSrcweir 		PropHashType_Impl,
109cdf0e10cSrcweir 		std::equal_to< sal_Int32 >
110cdf0e10cSrcweir 	> OPropertyListenerContainerHelper;
111cdf0e10cSrcweir 
112cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 
115cdf0e10cSrcweir class LinguProps :
116cdf0e10cSrcweir 	public cppu::WeakImplHelper5
117cdf0e10cSrcweir 	<
118cdf0e10cSrcweir 		com::sun::star::beans::XPropertySet,
119cdf0e10cSrcweir 		com::sun::star::beans::XFastPropertySet,
120cdf0e10cSrcweir 		com::sun::star::beans::XPropertyAccess,
121cdf0e10cSrcweir 		com::sun::star::lang::XComponent,
122cdf0e10cSrcweir 		com::sun::star::lang::XServiceInfo
123cdf0e10cSrcweir 	>
124cdf0e10cSrcweir {
125cdf0e10cSrcweir 	::cppu::OInterfaceContainerHelper			aEvtListeners;
126cdf0e10cSrcweir 	OPropertyListenerContainerHelper			aPropListeners;
127cdf0e10cSrcweir 
128cdf0e10cSrcweir     SfxItemPropertyMap                          aPropertyMap;
129cdf0e10cSrcweir     SvtLinguConfig                              aConfig;
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 	sal_Bool										bDisposing;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	// disallow copy-constructor and assignment-operator for now
134cdf0e10cSrcweir 	LinguProps(const LinguProps &);
135cdf0e10cSrcweir 	LinguProps & operator = (const LinguProps &);
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 	void	launchEvent( const ::com::sun::star::beans::PropertyChangeEvent &rEvt ) const;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir public:
140cdf0e10cSrcweir     LinguProps();
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     // XPropertySet
143cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
144cdf0e10cSrcweir     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);
145cdf0e10cSrcweir     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);
146cdf0e10cSrcweir     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);
147cdf0e10cSrcweir     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);
148cdf0e10cSrcweir     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);
149cdf0e10cSrcweir     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);
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     // XFastPropertySet
152cdf0e10cSrcweir     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);
153cdf0e10cSrcweir     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);
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     // XPropertyAccess
156cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues() throw(::com::sun::star::uno::RuntimeException);
157cdf0e10cSrcweir     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);
158cdf0e10cSrcweir 
159cdf0e10cSrcweir     // XComponent
160cdf0e10cSrcweir     virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
161cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
162cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     // XServiceInfo
165cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
166cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
167cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 
170cdf0e10cSrcweir     static inline ::rtl::OUString getImplementationName_Static() throw();
171cdf0e10cSrcweir     static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
172cdf0e10cSrcweir };
173cdf0e10cSrcweir 
getImplementationName_Static()174cdf0e10cSrcweir inline ::rtl::OUString LinguProps::getImplementationName_Static() throw()
175cdf0e10cSrcweir {
176cdf0e10cSrcweir 	return A2OU( "com.sun.star.lingu2.LinguProps" );
177cdf0e10cSrcweir }
178cdf0e10cSrcweir 
179cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////////
180cdf0e10cSrcweir 
181cdf0e10cSrcweir #endif
182cdf0e10cSrcweir 
183