Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _LINGUISTIC_LNGOPT_HHX_
21 : #define _LINGUISTIC_LNGOPT_HHX_
22 :
23 : #include <functional>
24 :
25 : #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
26 : #include <cppuhelper/implbase5.hxx> // helper for implementations
27 : #include <cppuhelper/interfacecontainer.hxx>
28 : #include <com/sun/star/beans/XPropertySet.hpp>
29 : #include <com/sun/star/beans/XFastPropertySet.hpp>
30 : #include <com/sun/star/lang/XServiceInfo.hpp>
31 : #include <com/sun/star/beans/XPropertyAccess.hpp>
32 : #include <com/sun/star/lang/XComponent.hpp>
33 : #include <unotools/lingucfg.hxx>
34 : #include <svl/itemprop.hxx>
35 : #include <unotools/configitem.hxx>
36 : #include <com/sun/star/uno/Any.h>
37 : #include <tools/solar.h>
38 :
39 : #include <svl/itemprop.hxx>
40 : #include "linguistic/misc.hxx"
41 : #include "defs.hxx"
42 :
43 : namespace com { namespace sun { namespace star {
44 : namespace beans {
45 : struct PropertyChangeEvent;
46 : }
47 : }}}
48 :
49 :
50 :
51 : // LinguOptions
52 : // This class represents all Linguistik relevant options.
53 :
54 : class LinguOptions
55 : {
56 : static SvtLinguOptions *pData;
57 : static oslInterlockedCount nRefCount; // number of objects of this class
58 :
59 : public:
60 : LinguOptions();
61 : LinguOptions(const LinguOptions &rOpt);
62 : ~LinguOptions();
63 :
64 : static ::rtl::OUString GetName( sal_Int32 nWID );
65 :
66 : const ::com::sun::star::uno::Sequence< rtl::OUString >
67 0 : GetActiveDics() const { return pData->aActiveDics; }
68 :
69 : const ::com::sun::star::uno::Sequence< rtl::OUString >
70 : GetActiveConvDics() const { return pData->aActiveConvDics; }
71 : };
72 :
73 :
74 :
75 : // uses templates from <cppuhelper/interfacecontainer.h>
76 :
77 :
78 : // helper function call class
79 : struct PropHashType_Impl
80 : {
81 : size_t operator()(const sal_Int32 &s) const { return s; }
82 : };
83 :
84 : typedef cppu::OMultiTypeInterfaceContainerHelperVar
85 : <
86 : sal_Int32,
87 : PropHashType_Impl,
88 : std::equal_to< sal_Int32 >
89 : > OPropertyListenerContainerHelper;
90 :
91 :
92 :
93 6 : class LinguProps :
94 : public cppu::WeakImplHelper5
95 : <
96 : com::sun::star::beans::XPropertySet,
97 : com::sun::star::beans::XFastPropertySet,
98 : com::sun::star::beans::XPropertyAccess,
99 : com::sun::star::lang::XComponent,
100 : com::sun::star::lang::XServiceInfo
101 : >
102 : {
103 : ::cppu::OInterfaceContainerHelper aEvtListeners;
104 : OPropertyListenerContainerHelper aPropListeners;
105 :
106 : SfxItemPropertyMap aPropertyMap;
107 : SvtLinguConfig aConfig;
108 :
109 : sal_Bool bDisposing;
110 :
111 : // disallow copy-constructor and assignment-operator for now
112 : LinguProps(const LinguProps &);
113 : LinguProps & operator = (const LinguProps &);
114 :
115 : void launchEvent( const ::com::sun::star::beans::PropertyChangeEvent &rEvt ) const;
116 :
117 : public:
118 : LinguProps();
119 :
120 : // XPropertySet
121 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
122 : 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);
123 : 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);
124 : 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);
125 : 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);
126 : 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);
127 : 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);
128 :
129 : // XFastPropertySet
130 : 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);
131 : 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);
132 :
133 : // XPropertyAccess
134 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues() throw(::com::sun::star::uno::RuntimeException);
135 : 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);
136 :
137 : // XComponent
138 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
139 : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
140 : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
141 :
142 : // XServiceInfo
143 : virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
144 : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
145 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
146 :
147 :
148 : static inline ::rtl::OUString getImplementationName_Static() throw();
149 : static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
150 : };
151 :
152 13 : inline ::rtl::OUString LinguProps::getImplementationName_Static() throw()
153 : {
154 13 : return A2OU( "com.sun.star.lingu2.LinguProps" );
155 : }
156 :
157 :
158 : #endif
159 :
160 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|