merge the formfield patch from ooo-build
[ooovba.git] / linguistic / source / lngopt.hxx
blob2188ef4d88d8ba02960649436822b4ae2a7f7cf2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: lngopt.hxx,v $
10 * $Revision: 1.16 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _LINGUISTIC_LNGOPT_HHX_
32 #define _LINGUISTIC_LNGOPT_HHX_
34 #include <functional>
36 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
37 #include <cppuhelper/implbase5.hxx> // helper for implementations
38 #include <cppuhelper/interfacecontainer.hxx>
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <com/sun/star/beans/XFastPropertySet.hpp>
41 #include <com/sun/star/lang/XServiceInfo.hpp>
42 #include <com/sun/star/beans/XPropertyAccess.hpp>
43 #include <com/sun/star/lang/XComponent.hpp>
44 #include <svtools/lingucfg.hxx>
45 #include <svtools/itemprop.hxx>
46 #include <unotools/configitem.hxx>
47 #include <com/sun/star/uno/Any.h>
48 #include <tools/solar.h>
50 #include <vcl/timer.hxx>
51 #include <svtools/itemprop.hxx>
52 #include "misc.hxx"
53 #include "defs.hxx"
55 namespace com { namespace sun { namespace star {
56 namespace beans {
57 struct PropertyChangeEvent;
59 namespace registry {
60 class XRegistryKey;
62 }}}
66 ///////////////////////////////////////////////////////////////////////////
67 // LinguOptions
68 // This class represents all Linguistik relevant options.
71 class LinguOptions
73 static SvtLinguOptions *pData;
74 static vos::ORefCount aRefCount; // number of objects of this class
76 //! uses default assignment-operator
78 BOOL SetLocale_Impl( INT16 &rLanguage,
79 ::com::sun::star::uno::Any &rOld,
80 const ::com::sun::star::uno::Any &rVal, sal_Int16 nType );
82 public:
83 LinguOptions();
84 LinguOptions(const LinguOptions &rOpt);
85 ~LinguOptions();
87 BOOL SetValue( ::com::sun::star::uno::Any &rOld,
88 const ::com::sun::star::uno::Any &rVal, INT32 nWID );
89 void GetValue( ::com::sun::star::uno::Any &rVal, INT32 nWID ) const;
91 static ::rtl::OUString GetName( INT32 nWID );
93 const ::com::sun::star::uno::Sequence< rtl::OUString >
94 GetActiveDics() const { return pData->aActiveDics; }
96 const ::com::sun::star::uno::Sequence< rtl::OUString >
97 GetActiveConvDics() const { return pData->aActiveConvDics; }
101 ///////////////////////////////////////////////////////////////////////////
103 // uses templates from <cppuhelper/interfacecontainer.h>
106 // helper function call class
107 struct PropHashType_Impl
109 size_t operator()(const INT32 &s) const { return s; }
112 typedef cppu::OMultiTypeInterfaceContainerHelperVar
114 INT32,
115 PropHashType_Impl,
116 std::equal_to< INT32 >
117 > OPropertyListenerContainerHelper;
119 ///////////////////////////////////////////////////////////////////////////
122 class LinguProps :
123 public cppu::WeakImplHelper5
125 com::sun::star::beans::XPropertySet,
126 com::sun::star::beans::XFastPropertySet,
127 com::sun::star::beans::XPropertyAccess,
128 com::sun::star::lang::XComponent,
129 com::sun::star::lang::XServiceInfo
132 ::cppu::OInterfaceContainerHelper aEvtListeners;
133 OPropertyListenerContainerHelper aPropListeners;
135 SfxItemPropertyMap aPropertyMap;
136 SvtLinguConfig aConfig;
138 BOOL bDisposing;
140 // disallow copy-constructor and assignment-operator for now
141 LinguProps(const LinguProps &);
142 LinguProps & operator = (const LinguProps &);
144 void launchEvent( const ::com::sun::star::beans::PropertyChangeEvent &rEvt ) const;
146 public:
147 LinguProps();
149 // XPropertySet
150 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
151 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);
152 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);
153 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);
154 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);
155 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);
156 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);
158 // XFastPropertySet
159 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);
160 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);
162 // XPropertyAccess
163 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues() throw(::com::sun::star::uno::RuntimeException);
164 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);
166 // XComponent
167 virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
168 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
169 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
171 // XServiceInfo
172 virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
173 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
174 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
177 static inline ::rtl::OUString getImplementationName_Static() throw();
178 static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
181 inline ::rtl::OUString LinguProps::getImplementationName_Static() throw()
183 return A2OU( "com.sun.star.lingu2.LinguProps" );
186 ///////////////////////////////////////////////////////////////////////////
188 #endif