1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_LINGUISTIC_SOURCE_LNGOPT_HXX
21 #define INCLUDED_LINGUISTIC_SOURCE_LNGOPT_HXX
23 #include <cppuhelper/implbase5.hxx>
24 #include <cppuhelper/interfacecontainer.hxx>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/beans/XFastPropertySet.hpp>
27 #include <com/sun/star/beans/XPropertyAccess.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/lang/XComponent.hpp>
30 #include <com/sun/star/linguistic2/XLinguProperties.hpp>
31 #include <unotools/lingucfg.hxx>
32 #include <svl/itemprop.hxx>
33 #include <unotools/configitem.hxx>
34 #include <unotools/linguprops.hxx>
35 #include <com/sun/star/uno/Any.h>
36 #include "linguistic/misc.hxx"
39 namespace com
{ namespace sun
{ namespace star
{
41 struct PropertyChangeEvent
;
48 // This class represents all Linguistik relevant options.
52 static SvtLinguOptions
*pData
;
53 static oslInterlockedCount nRefCount
; // number of objects of this class
57 LinguOptions(const LinguOptions
&rOpt
);
60 static OUString
GetName( sal_Int32 nWID
);
62 const ::com::sun::star::uno::Sequence
< OUString
>
63 GetActiveDics() const { return pData
->aActiveDics
; }
65 const ::com::sun::star::uno::Sequence
< OUString
>
66 GetActiveConvDics() const { return pData
->aActiveConvDics
; }
69 typedef cppu::OMultiTypeInterfaceContainerHelperVar
<sal_Int32
>
70 OPropertyListenerContainerHelper
;
73 public cppu::WeakImplHelper5
75 com::sun::star::linguistic2::XLinguProperties
,
76 com::sun::star::beans::XFastPropertySet
,
77 com::sun::star::beans::XPropertyAccess
,
78 com::sun::star::lang::XComponent
,
79 com::sun::star::lang::XServiceInfo
82 ::cppu::OInterfaceContainerHelper aEvtListeners
;
83 OPropertyListenerContainerHelper aPropListeners
;
85 SfxItemPropertyMap aPropertyMap
;
86 SvtLinguConfig aConfig
;
90 LinguProps(const LinguProps
&) SAL_DELETED_FUNCTION
;
91 LinguProps
& operator = (const LinguProps
&) SAL_DELETED_FUNCTION
;
93 void launchEvent( const ::com::sun::star::beans::PropertyChangeEvent
&rEvt
) const;
95 bool getPropertyBool(const OUString
& aPropertyName
) throw (css::uno::RuntimeException
);
96 sal_Int16
getPropertyInt16(const OUString
& aPropertyName
) throw (css::uno::RuntimeException
);
97 css::lang::Locale
getPropertyLocale(const OUString
& aPropertyName
) throw (css::uno::RuntimeException
);
98 void setProperty(const OUString
& aPropertyName
, bool p1
) throw (css::uno::RuntimeException
)
99 { setPropertyValue( aPropertyName
, css::uno::Any(p1
) ); }
100 void setProperty(const OUString
& aPropertyName
, sal_Int16 p1
) throw (css::uno::RuntimeException
)
101 { setPropertyValue( aPropertyName
, css::uno::Any(p1
) ); }
102 void setProperty(const OUString
& aPropertyName
, css::lang::Locale p1
) throw (css::uno::RuntimeException
)
103 { setPropertyValue( aPropertyName
, css::uno::Any(p1
) ); }
108 virtual sal_Bool SAL_CALL
getIsUseDictionaryList() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
109 { return getPropertyBool(UPN_IS_USE_DICTIONARY_LIST
); }
110 virtual void SAL_CALL
setIsUseDictionaryList(sal_Bool p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
111 { setProperty(UPN_IS_USE_DICTIONARY_LIST
, (bool) p1
); }
112 virtual sal_Bool SAL_CALL
getIsIgnoreControlCharacters() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
113 { return getPropertyBool(UPN_IS_IGNORE_CONTROL_CHARACTERS
); }
114 virtual void SAL_CALL
setIsIgnoreControlCharacters(sal_Bool p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
115 { setProperty(UPN_IS_IGNORE_CONTROL_CHARACTERS
, (bool) p1
); }
116 virtual sal_Bool SAL_CALL
getIsSpellUpperCase() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
117 { return getPropertyBool(UPN_IS_SPELL_UPPER_CASE
); }
118 virtual void SAL_CALL
setIsSpellUpperCase(sal_Bool p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
119 { setProperty(UPN_IS_SPELL_UPPER_CASE
, (bool) p1
); }
120 virtual sal_Bool SAL_CALL
getIsSpellWithDigits() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
121 { return getPropertyBool(UPN_IS_SPELL_WITH_DIGITS
); }
122 virtual void SAL_CALL
setIsSpellWithDigits(sal_Bool p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
123 { setProperty(UPN_IS_SPELL_WITH_DIGITS
, (bool) p1
); }
124 virtual sal_Bool SAL_CALL
getIsSpellCapitalization() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
125 { return getPropertyBool(UPN_IS_SPELL_CAPITALIZATION
); }
126 virtual void SAL_CALL
setIsSpellCapitalization(sal_Bool p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
127 { setProperty(UPN_IS_SPELL_CAPITALIZATION
, (bool) p1
); }
128 virtual sal_Int16 SAL_CALL
getHyphMinLeading() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
129 { return getPropertyInt16(UPN_HYPH_MIN_LEADING
); }
130 virtual void SAL_CALL
setHyphMinLeading(sal_Int16 p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
131 { setProperty(UPN_HYPH_MIN_LEADING
, p1
); }
132 virtual sal_Int16 SAL_CALL
getHyphMinTrailing() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
133 { return getPropertyInt16(UPN_HYPH_MIN_TRAILING
); }
134 virtual void SAL_CALL
setHyphMinTrailing(sal_Int16 p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
135 { setProperty(UPN_HYPH_MIN_TRAILING
, p1
); }
136 virtual sal_Int16 SAL_CALL
getHyphMinWordLength() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
137 { return getPropertyInt16(UPN_HYPH_MIN_WORD_LENGTH
); }
138 virtual void SAL_CALL
setHyphMinWordLength(sal_Int16 p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
139 { setProperty(UPN_HYPH_MIN_WORD_LENGTH
, p1
); }
140 virtual com::sun::star::lang::Locale SAL_CALL
getDefaultLocale() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
141 { return getPropertyLocale(UPN_DEFAULT_LOCALE
); }
142 virtual void SAL_CALL
setDefaultLocale(const com::sun::star::lang::Locale
& p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
143 { setProperty(UPN_DEFAULT_LOCALE
, p1
); }
144 virtual sal_Bool SAL_CALL
getIsHyphAuto() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
145 { return getPropertyBool(UPN_IS_HYPH_AUTO
); }
146 virtual void SAL_CALL
setIsHyphAuto(sal_Bool p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
147 { setProperty(UPN_IS_HYPH_AUTO
, (bool) p1
); }
148 virtual sal_Bool SAL_CALL
getIsHyphSpecial() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
149 { return getPropertyBool(UPN_IS_HYPH_SPECIAL
); }
150 virtual void SAL_CALL
setIsHyphSpecial(sal_Bool p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
151 { setProperty(UPN_IS_HYPH_SPECIAL
, (bool) p1
); }
152 virtual sal_Bool SAL_CALL
getIsSpellAuto() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
153 { return getPropertyBool(UPN_IS_SPELL_AUTO
); }
154 virtual void SAL_CALL
setIsSpellAuto(sal_Bool p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
155 { setProperty(UPN_IS_SPELL_AUTO
, (bool) p1
); }
156 virtual sal_Bool SAL_CALL
getIsSpellSpecial() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
157 { return getPropertyBool(UPN_IS_SPELL_SPECIAL
); }
158 virtual void SAL_CALL
setIsSpellSpecial(sal_Bool p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
159 { setProperty(UPN_IS_SPELL_SPECIAL
, (bool) p1
); }
160 virtual sal_Bool SAL_CALL
getIsWrapReverse() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
161 { return getPropertyBool(UPN_IS_WRAP_REVERSE
); }
162 virtual void SAL_CALL
setIsWrapReverse(sal_Bool p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
163 { setProperty(UPN_IS_WRAP_REVERSE
, (bool) p1
); }
164 virtual com::sun::star::lang::Locale SAL_CALL
getDefaultLocale_CJK() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
165 { return getPropertyLocale(UPN_DEFAULT_LOCALE_CJK
); }
166 virtual void SAL_CALL
setDefaultLocale_CJK(const com::sun::star::lang::Locale
& p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
167 { setProperty(UPN_DEFAULT_LOCALE_CJK
, p1
); }
168 virtual css::lang::Locale SAL_CALL
getDefaultLocale_CTL() throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
169 { return getPropertyLocale(UPN_DEFAULT_LOCALE_CTL
); }
170 virtual void SAL_CALL
setDefaultLocale_CTL(const com::sun::star::lang::Locale
& p1
) throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
171 { setProperty(UPN_DEFAULT_LOCALE_CTL
, p1
); }
174 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
175 virtual void SAL_CALL
setPropertyValue( const 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
, std::exception
) SAL_OVERRIDE
;
176 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
177 virtual void SAL_CALL
addPropertyChangeListener( const 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
, std::exception
) SAL_OVERRIDE
;
178 virtual void SAL_CALL
removePropertyChangeListener( const 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
, std::exception
) SAL_OVERRIDE
;
179 virtual void SAL_CALL
addVetoableChangeListener( const 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
, std::exception
) SAL_OVERRIDE
;
180 virtual void SAL_CALL
removeVetoableChangeListener( const 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
, std::exception
) SAL_OVERRIDE
;
183 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
, std::exception
) SAL_OVERRIDE
;
184 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
, std::exception
) SAL_OVERRIDE
;
187 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> SAL_CALL
getPropertyValues() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
188 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
, std::exception
) SAL_OVERRIDE
;
191 virtual void SAL_CALL
dispose() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
192 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
193 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& rxListener
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
196 virtual OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
197 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
198 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
201 static inline OUString
getImplementationName_Static() throw();
202 static com::sun::star::uno::Sequence
< OUString
> getSupportedServiceNames_Static() throw();
205 inline OUString
LinguProps::getImplementationName_Static() throw()
207 return OUString( "com.sun.star.lingu2.LinguProps" );
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */