1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _LINGUISTIC_LNGOPT_HHX_ 29*cdf0e10cSrcweir #define _LINGUISTIC_LNGOPT_HHX_ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <functional> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type 34*cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx> // helper for implementations 35*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 36*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/beans/XFastPropertySet.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyAccess.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 41*cdf0e10cSrcweir #include <unotools/lingucfg.hxx> 42*cdf0e10cSrcweir #include <svl/itemprop.hxx> 43*cdf0e10cSrcweir #include <unotools/configitem.hxx> 44*cdf0e10cSrcweir #include <com/sun/star/uno/Any.h> 45*cdf0e10cSrcweir #include <tools/solar.h> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir #include <svl/itemprop.hxx> 48*cdf0e10cSrcweir #include "linguistic/misc.hxx" 49*cdf0e10cSrcweir #include "defs.hxx" 50*cdf0e10cSrcweir #include <vos/refernce.hxx> 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir namespace com { namespace sun { namespace star { 53*cdf0e10cSrcweir namespace beans { 54*cdf0e10cSrcweir struct PropertyChangeEvent; 55*cdf0e10cSrcweir } 56*cdf0e10cSrcweir namespace registry { 57*cdf0e10cSrcweir class XRegistryKey; 58*cdf0e10cSrcweir } 59*cdf0e10cSrcweir }}} 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////// 64*cdf0e10cSrcweir // LinguOptions 65*cdf0e10cSrcweir // This class represents all Linguistik relevant options. 66*cdf0e10cSrcweir // 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir class LinguOptions 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir static SvtLinguOptions *pData; 71*cdf0e10cSrcweir static vos::ORefCount aRefCount; // number of objects of this class 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir //! uses default assignment-operator 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir sal_Bool SetLocale_Impl( sal_Int16 &rLanguage, 76*cdf0e10cSrcweir ::com::sun::star::uno::Any &rOld, 77*cdf0e10cSrcweir const ::com::sun::star::uno::Any &rVal, sal_Int16 nType ); 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir public: 80*cdf0e10cSrcweir LinguOptions(); 81*cdf0e10cSrcweir LinguOptions(const LinguOptions &rOpt); 82*cdf0e10cSrcweir ~LinguOptions(); 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir sal_Bool SetValue( ::com::sun::star::uno::Any &rOld, 85*cdf0e10cSrcweir const ::com::sun::star::uno::Any &rVal, sal_Int32 nWID ); 86*cdf0e10cSrcweir void GetValue( ::com::sun::star::uno::Any &rVal, sal_Int32 nWID ) const; 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir static ::rtl::OUString GetName( sal_Int32 nWID ); 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< rtl::OUString > 91*cdf0e10cSrcweir GetActiveDics() const { return pData->aActiveDics; } 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< rtl::OUString > 94*cdf0e10cSrcweir GetActiveConvDics() const { return pData->aActiveConvDics; } 95*cdf0e10cSrcweir }; 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////// 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir // uses templates from <cppuhelper/interfacecontainer.h> 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir // helper function call class 104*cdf0e10cSrcweir struct PropHashType_Impl 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir size_t operator()(const sal_Int32 &s) const { return s; } 107*cdf0e10cSrcweir }; 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir typedef cppu::OMultiTypeInterfaceContainerHelperVar 110*cdf0e10cSrcweir < 111*cdf0e10cSrcweir sal_Int32, 112*cdf0e10cSrcweir PropHashType_Impl, 113*cdf0e10cSrcweir std::equal_to< sal_Int32 > 114*cdf0e10cSrcweir > OPropertyListenerContainerHelper; 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////// 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir class LinguProps : 120*cdf0e10cSrcweir public cppu::WeakImplHelper5 121*cdf0e10cSrcweir < 122*cdf0e10cSrcweir com::sun::star::beans::XPropertySet, 123*cdf0e10cSrcweir com::sun::star::beans::XFastPropertySet, 124*cdf0e10cSrcweir com::sun::star::beans::XPropertyAccess, 125*cdf0e10cSrcweir com::sun::star::lang::XComponent, 126*cdf0e10cSrcweir com::sun::star::lang::XServiceInfo 127*cdf0e10cSrcweir > 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper aEvtListeners; 130*cdf0e10cSrcweir OPropertyListenerContainerHelper aPropListeners; 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir SfxItemPropertyMap aPropertyMap; 133*cdf0e10cSrcweir SvtLinguConfig aConfig; 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir sal_Bool bDisposing; 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir // disallow copy-constructor and assignment-operator for now 138*cdf0e10cSrcweir LinguProps(const LinguProps &); 139*cdf0e10cSrcweir LinguProps & operator = (const LinguProps &); 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir void launchEvent( const ::com::sun::star::beans::PropertyChangeEvent &rEvt ) const; 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir public: 144*cdf0e10cSrcweir LinguProps(); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir // XPropertySet 147*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); 148*cdf0e10cSrcweir 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); 149*cdf0e10cSrcweir 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); 150*cdf0e10cSrcweir 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); 151*cdf0e10cSrcweir 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); 152*cdf0e10cSrcweir 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); 153*cdf0e10cSrcweir 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); 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir // XFastPropertySet 156*cdf0e10cSrcweir 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); 157*cdf0e10cSrcweir 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); 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir // XPropertyAccess 160*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues() throw(::com::sun::star::uno::RuntimeException); 161*cdf0e10cSrcweir 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); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir // XComponent 164*cdf0e10cSrcweir virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); 165*cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException); 166*cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException); 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir // XServiceInfo 169*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); 170*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); 171*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir static inline ::rtl::OUString getImplementationName_Static() throw(); 175*cdf0e10cSrcweir static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); 176*cdf0e10cSrcweir }; 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir inline ::rtl::OUString LinguProps::getImplementationName_Static() throw() 179*cdf0e10cSrcweir { 180*cdf0e10cSrcweir return A2OU( "com.sun.star.lingu2.LinguProps" ); 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////// 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir #endif 186*cdf0e10cSrcweir 187