Update ooo320-m1
[ooovba.git] / linguistic / workben / sprophelp.hxx
blob6322e5a50af865c85be73c6ae5ef0455a55de916
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sprophelp.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _LINGU2_PROPHELP_HXX_
32 #define _LINGU2_PROPHELP_HXX_
34 #include <tools/solar.h>
36 #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
37 #include <cppuhelper/implbase2.hxx> // helper for implementations
38 #include <cppuhelper/interfacecontainer.h>
39 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
40 #include <com/sun/star/beans/PropertyValues.hpp>
42 #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
44 namespace com { namespace sun { namespace star { namespace beans {
45 class XPropertySet;
46 }}}};
48 namespace com { namespace sun { namespace star { namespace linguistic2 {
49 struct LinguServiceEvent;
50 }}}};
53 using namespace ::rtl;
54 using namespace ::com::sun::star::uno;
55 using namespace ::com::sun::star::beans;
56 using namespace ::com::sun::star::lang;
57 using namespace ::com::sun::star::linguistic2;
59 ///////////////////////////////////////////////////////////////////////////
60 // PropertyChgHelper
61 // virtual base class for all XPropertyChangeListener members of the
62 // various lingu services.
63 // Only propertyChange needs to be implemented.
65 class PropertyChgHelper :
66 public cppu::WeakImplHelper2
68 XPropertyChangeListener,
69 XLinguServiceEventBroadcaster
72 Sequence< OUString > aPropNames;
73 Reference< XInterface > xMyEvtObj;
74 ::cppu::OInterfaceContainerHelper aLngSvcEvtListeners;
75 Reference< XPropertySet > xPropSet;
77 // disallow use of copy-constructor and assignment-operator
78 PropertyChgHelper( const PropertyChgHelper & );
79 PropertyChgHelper & operator = ( const PropertyChgHelper & );
81 public:
82 PropertyChgHelper(
83 const Reference< XInterface > &rxSource,
84 Reference< XPropertySet > &rxPropSet,
85 const char *pPropNames[], USHORT nPropCount );
86 virtual ~PropertyChgHelper();
88 // XEventListener
89 virtual void SAL_CALL
90 disposing( const EventObject& rSource )
91 throw(RuntimeException);
93 // XPropertyChangeListener
94 virtual void SAL_CALL
95 propertyChange( const PropertyChangeEvent& rEvt )
96 throw(RuntimeException) = 0;
98 // XLinguServiceEventBroadcaster
99 virtual sal_Bool SAL_CALL
100 addLinguServiceEventListener(
101 const Reference< XLinguServiceEventListener >& rxListener )
102 throw(RuntimeException);
103 virtual sal_Bool SAL_CALL
104 removeLinguServiceEventListener(
105 const Reference< XLinguServiceEventListener >& rxListener )
106 throw(RuntimeException);
108 // non UNO functions
109 void AddAsPropListener();
110 void RemoveAsPropListener();
111 void LaunchEvent( const LinguServiceEvent& rEvt );
113 const Sequence< OUString > &
114 GetPropNames() const { return aPropNames; }
115 const Reference< XPropertySet > &
116 GetPropSet() const { return xPropSet; }
117 const Reference< XInterface > &
118 GetEvtObj() const { return xMyEvtObj; }
122 ///////////////////////////////////////////////////////////////////////////
125 class PropertyHelper_Spell :
126 public PropertyChgHelper
128 // default values
129 BOOL bIsGermanPreReform;
130 BOOL bIsIgnoreControlCharacters;
131 BOOL bIsUseDictionaryList;
132 BOOL bIsSpellUpperCase;
133 BOOL bIsSpellWithDigits;
134 BOOL bIsSpellCapitalization;
136 // return values, will be set to default value or current temporary value
137 BOOL bResIsGermanPreReform;
138 BOOL bResIsIgnoreControlCharacters;
139 BOOL bResIsUseDictionaryList;
140 BOOL bResIsSpellUpperCase;
141 BOOL bResIsSpellWithDigits;
142 BOOL bResIsSpellCapitalization;
145 // disallow use of copy-constructor and assignment-operator
146 PropertyHelper_Spell( const PropertyHelper_Spell & );
147 PropertyHelper_Spell & operator = ( const PropertyHelper_Spell & );
149 void SetDefault();
151 public:
152 PropertyHelper_Spell(
153 const Reference< XInterface > &rxSource,
154 Reference< XPropertySet > &rxPropSet );
155 virtual ~PropertyHelper_Spell();
157 // XPropertyChangeListener
158 virtual void SAL_CALL
159 propertyChange( const PropertyChangeEvent& rEvt )
160 throw(RuntimeException);
162 void SetTmpPropVals( const PropertyValues &rPropVals );
164 BOOL IsGermanPreReform() const { return bResIsGermanPreReform; }
165 BOOL IsIgnoreControlCharacters() const { return bResIsIgnoreControlCharacters; }
166 BOOL IsUseDictionaryList() const { return bResIsUseDictionaryList; }
167 BOOL IsSpellUpperCase() const { return bResIsSpellUpperCase; }
168 BOOL IsSpellWithDigits() const { return bResIsSpellWithDigits; }
169 BOOL IsSpellCapitalization() const { return bResIsSpellCapitalization; }
172 ///////////////////////////////////////////////////////////////////////////
174 #endif