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 _LINGU2_PROPHELP_HXX_
21 #define _LINGU2_PROPHELP_HXX_
23 #include <tools/solar.h>
25 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
26 #include <cppuhelper/implbase2.hxx> // helper for implementations
27 #include <cppuhelper/interfacecontainer.h>
28 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
29 #include <com/sun/star/beans/PropertyValues.hpp>
31 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
33 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{
37 namespace com
{ namespace sun
{ namespace star
{ namespace linguistic2
{
38 struct LinguServiceEvent
;
42 using namespace ::rtl
;
43 using namespace ::com::sun::star::uno
;
44 using namespace ::com::sun::star::beans
;
45 using namespace ::com::sun::star::lang
;
46 using namespace ::com::sun::star::linguistic2
;
49 // virtual base class for all XPropertyChangeListener members of the
50 // various lingu services.
51 // Only propertyChange needs to be implemented.
53 class PropertyChgHelper
:
54 public cppu::WeakImplHelper2
56 XPropertyChangeListener
,
57 XLinguServiceEventBroadcaster
60 Sequence
< OUString
> aPropNames
;
61 Reference
< XInterface
> xMyEvtObj
;
62 ::cppu::OInterfaceContainerHelper aLngSvcEvtListeners
;
63 Reference
< XPropertySet
> xPropSet
;
65 // disallow use of copy-constructor and assignment-operator
66 PropertyChgHelper( const PropertyChgHelper
& );
67 PropertyChgHelper
& operator = ( const PropertyChgHelper
& );
71 const Reference
< XInterface
> &rxSource
,
72 Reference
< XPropertySet
> &rxPropSet
,
73 const char *pPropNames
[], sal_uInt16 nPropCount
);
74 virtual ~PropertyChgHelper();
78 disposing( const EventObject
& rSource
)
79 throw(RuntimeException
);
81 // XPropertyChangeListener
83 propertyChange( const PropertyChangeEvent
& rEvt
)
84 throw(RuntimeException
) = 0;
86 // XLinguServiceEventBroadcaster
87 virtual sal_Bool SAL_CALL
88 addLinguServiceEventListener(
89 const Reference
< XLinguServiceEventListener
>& rxListener
)
90 throw(RuntimeException
);
91 virtual sal_Bool SAL_CALL
92 removeLinguServiceEventListener(
93 const Reference
< XLinguServiceEventListener
>& rxListener
)
94 throw(RuntimeException
);
97 void AddAsPropListener();
98 void RemoveAsPropListener();
99 void LaunchEvent( const LinguServiceEvent
& rEvt
);
101 const Sequence
< OUString
> &
102 GetPropNames() const { return aPropNames
; }
103 const Reference
< XPropertySet
> &
104 GetPropSet() const { return xPropSet
; }
105 const Reference
< XInterface
> &
106 GetEvtObj() const { return xMyEvtObj
; }
112 class PropertyHelper_Spell
:
113 public PropertyChgHelper
116 sal_Bool bIsGermanPreReform
;
117 sal_Bool bIsIgnoreControlCharacters
;
118 sal_Bool bIsUseDictionaryList
;
119 sal_Bool bIsSpellUpperCase
;
120 sal_Bool bIsSpellWithDigits
;
121 sal_Bool bIsSpellCapitalization
;
123 // return values, will be set to default value or current temporary value
124 sal_Bool bResIsGermanPreReform
;
125 sal_Bool bResIsIgnoreControlCharacters
;
126 sal_Bool bResIsUseDictionaryList
;
127 sal_Bool bResIsSpellUpperCase
;
128 sal_Bool bResIsSpellWithDigits
;
129 sal_Bool bResIsSpellCapitalization
;
132 // disallow use of copy-constructor and assignment-operator
133 PropertyHelper_Spell( const PropertyHelper_Spell
& );
134 PropertyHelper_Spell
& operator = ( const PropertyHelper_Spell
& );
139 PropertyHelper_Spell(
140 const Reference
< XInterface
> &rxSource
,
141 Reference
< XPropertySet
> &rxPropSet
);
142 virtual ~PropertyHelper_Spell();
144 // XPropertyChangeListener
145 virtual void SAL_CALL
146 propertyChange( const PropertyChangeEvent
& rEvt
)
147 throw(RuntimeException
);
149 void SetTmpPropVals( const PropertyValues
&rPropVals
);
151 sal_Bool
IsGermanPreReform() const { return bResIsGermanPreReform
; }
152 sal_Bool
IsIgnoreControlCharacters() const { return bResIsIgnoreControlCharacters
; }
153 sal_Bool
IsUseDictionaryList() const { return bResIsUseDictionaryList
; }
154 sal_Bool
IsSpellUpperCase() const { return bResIsSpellUpperCase
; }
155 sal_Bool
IsSpellWithDigits() const { return bResIsSpellWithDigits
; }
156 sal_Bool
IsSpellCapitalization() const { return bResIsSpellCapitalization
; }
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */