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/implbase.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::sun::star::beans
{
33 namespace com::sun::star::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::WeakImplHelper
51 XPropertyChangeListener
,
52 XLinguServiceEventBroadcaster
55 Sequence
< OUString
> aPropNames
;
56 Reference
< XInterface
> xMyEvtObj
;
57 ::comphelper::OInterfaceContainerHelper2 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
; }
105 class PropertyHelper_Spell
:
106 public PropertyChgHelper
109 sal_Bool bIsGermanPreReform
;
110 sal_Bool bIsIgnoreControlCharacters
;
111 sal_Bool bIsUseDictionaryList
;
112 sal_Bool bIsSpellUpperCase
;
113 sal_Bool bIsSpellWithDigits
;
114 sal_Bool bIsSpellCapitalization
;
116 // return values, will be set to default value or current temporary value
117 sal_Bool bResIsGermanPreReform
;
118 sal_Bool bResIsIgnoreControlCharacters
;
119 sal_Bool bResIsUseDictionaryList
;
120 sal_Bool bResIsSpellUpperCase
;
121 sal_Bool bResIsSpellWithDigits
;
122 sal_Bool bResIsSpellCapitalization
;
125 // disallow use of copy-constructor and assignment-operator
126 PropertyHelper_Spell( const PropertyHelper_Spell
& );
127 PropertyHelper_Spell
& operator = ( const PropertyHelper_Spell
& );
132 PropertyHelper_Spell(
133 const Reference
< XInterface
> &rxSource
,
134 Reference
< XPropertySet
> &rxPropSet
);
135 virtual ~PropertyHelper_Spell();
137 // XPropertyChangeListener
138 virtual void SAL_CALL
139 propertyChange( const PropertyChangeEvent
& rEvt
)
140 throw(RuntimeException
);
142 void SetTmpPropVals( const PropertyValues
&rPropVals
);
144 sal_Bool
IsGermanPreReform() const { return bResIsGermanPreReform
; }
145 sal_Bool
IsIgnoreControlCharacters() const { return bResIsIgnoreControlCharacters
; }
146 sal_Bool
IsUseDictionaryList() const { return bResIsUseDictionaryList
; }
147 sal_Bool
IsSpellUpperCase() const { return bResIsSpellUpperCase
; }
148 sal_Bool
IsSpellWithDigits() const { return bResIsSpellWithDigits
; }
149 sal_Bool
IsSpellCapitalization() const { return bResIsSpellCapitalization
; }
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */