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_WORKBEN_SPROPHELP_HXX
21 #define INCLUDED_LINGUISTIC_WORKBEN_SPROPHELP_HXX
23 #include <cppuhelper/implbase2.hxx>
24 #include <cppuhelper/interfacecontainer.h>
25 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
26 #include <com/sun/star/beans/PropertyValues.hpp>
27 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
29 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{
33 namespace com
{ namespace sun
{ namespace star
{ namespace linguistic2
{
34 struct LinguServiceEvent
;
38 using namespace ::com::sun::star::uno
;
39 using namespace ::com::sun::star::beans
;
40 using namespace ::com::sun::star::lang
;
41 using namespace ::com::sun::star::linguistic2
;
44 // virtual base class for all XPropertyChangeListener members of the
45 // various lingu services.
46 // Only propertyChange needs to be implemented.
48 class PropertyChgHelper
:
49 public cppu::WeakImplHelper2
51 XPropertyChangeListener
,
52 XLinguServiceEventBroadcaster
55 Sequence
< OUString
> aPropNames
;
56 Reference
< XInterface
> xMyEvtObj
;
57 ::cppu::OInterfaceContainerHelper aLngSvcEvtListeners
;
58 Reference
< XPropertySet
> xPropSet
;
60 // disallow use of copy-constructor and assignment-operator
61 PropertyChgHelper( const PropertyChgHelper
& );
62 PropertyChgHelper
& operator = ( const PropertyChgHelper
& );
66 const Reference
< XInterface
> &rxSource
,
67 Reference
< XPropertySet
> &rxPropSet
,
68 const char *pPropNames
[], sal_uInt16 nPropCount
);
69 virtual ~PropertyChgHelper();
73 disposing( const EventObject
& rSource
)
74 throw(RuntimeException
);
76 // XPropertyChangeListener
78 propertyChange( const PropertyChangeEvent
& rEvt
)
79 throw(RuntimeException
) = 0;
81 // XLinguServiceEventBroadcaster
82 virtual sal_Bool SAL_CALL
83 addLinguServiceEventListener(
84 const Reference
< XLinguServiceEventListener
>& rxListener
)
85 throw(RuntimeException
);
86 virtual sal_Bool SAL_CALL
87 removeLinguServiceEventListener(
88 const Reference
< XLinguServiceEventListener
>& rxListener
)
89 throw(RuntimeException
);
92 void AddAsPropListener();
93 void RemoveAsPropListener();
94 void LaunchEvent( const LinguServiceEvent
& rEvt
);
96 const Sequence
< OUString
> &
97 GetPropNames() const { return aPropNames
; }
98 const Reference
< XPropertySet
> &
99 GetPropSet() const { return xPropSet
; }
100 const Reference
< XInterface
> &
101 GetEvtObj() const { return xMyEvtObj
; }
107 class PropertyHelper_Spell
:
108 public PropertyChgHelper
111 sal_Bool bIsGermanPreReform
;
112 sal_Bool bIsIgnoreControlCharacters
;
113 sal_Bool bIsUseDictionaryList
;
114 sal_Bool bIsSpellUpperCase
;
115 sal_Bool bIsSpellWithDigits
;
116 sal_Bool bIsSpellCapitalization
;
118 // return values, will be set to default value or current temporary value
119 sal_Bool bResIsGermanPreReform
;
120 sal_Bool bResIsIgnoreControlCharacters
;
121 sal_Bool bResIsUseDictionaryList
;
122 sal_Bool bResIsSpellUpperCase
;
123 sal_Bool bResIsSpellWithDigits
;
124 sal_Bool bResIsSpellCapitalization
;
127 // disallow use of copy-constructor and assignment-operator
128 PropertyHelper_Spell( const PropertyHelper_Spell
& );
129 PropertyHelper_Spell
& operator = ( const PropertyHelper_Spell
& );
134 PropertyHelper_Spell(
135 const Reference
< XInterface
> &rxSource
,
136 Reference
< XPropertySet
> &rxPropSet
);
137 virtual ~PropertyHelper_Spell();
139 // XPropertyChangeListener
140 virtual void SAL_CALL
141 propertyChange( const PropertyChangeEvent
& rEvt
)
142 throw(RuntimeException
);
144 void SetTmpPropVals( const PropertyValues
&rPropVals
);
146 sal_Bool
IsGermanPreReform() const { return bResIsGermanPreReform
; }
147 sal_Bool
IsIgnoreControlCharacters() const { return bResIsIgnoreControlCharacters
; }
148 sal_Bool
IsUseDictionaryList() const { return bResIsUseDictionaryList
; }
149 sal_Bool
IsSpellUpperCase() const { return bResIsSpellUpperCase
; }
150 sal_Bool
IsSpellWithDigits() const { return bResIsSpellWithDigits
; }
151 sal_Bool
IsSpellCapitalization() const { return bResIsSpellCapitalization
; }
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */