1*63ce064aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*63ce064aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*63ce064aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*63ce064aSAndrew Rist * distributed with this work for additional information 6*63ce064aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*63ce064aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*63ce064aSAndrew Rist * "License"); you may not use this file except in compliance 9*63ce064aSAndrew Rist * with the License. You may obtain a copy of the License at 10*63ce064aSAndrew Rist * 11*63ce064aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*63ce064aSAndrew Rist * 13*63ce064aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*63ce064aSAndrew Rist * software distributed under the License is distributed on an 15*63ce064aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*63ce064aSAndrew Rist * KIND, either express or implied. See the License for the 17*63ce064aSAndrew Rist * specific language governing permissions and limitations 18*63ce064aSAndrew Rist * under the License. 19*63ce064aSAndrew Rist * 20*63ce064aSAndrew Rist *************************************************************/ 21*63ce064aSAndrew Rist 22*63ce064aSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _LINGU2_PROPHELP_HXX_ 25cdf0e10cSrcweir #define _LINGU2_PROPHELP_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <tools/solar.h> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type 30cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> // helper for implementations 31cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 32cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp> 33cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValues.hpp> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp> 36cdf0e10cSrcweir 37cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace beans { 38cdf0e10cSrcweir class XPropertySet; 39cdf0e10cSrcweir }}}}; 40cdf0e10cSrcweir 41cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace linguistic2 { 42cdf0e10cSrcweir struct LinguServiceEvent; 43cdf0e10cSrcweir }}}}; 44cdf0e10cSrcweir 45cdf0e10cSrcweir 46cdf0e10cSrcweir using namespace ::rtl; 47cdf0e10cSrcweir using namespace ::com::sun::star::uno; 48cdf0e10cSrcweir using namespace ::com::sun::star::beans; 49cdf0e10cSrcweir using namespace ::com::sun::star::lang; 50cdf0e10cSrcweir using namespace ::com::sun::star::linguistic2; 51cdf0e10cSrcweir 52cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////// 53cdf0e10cSrcweir // PropertyChgHelper 54cdf0e10cSrcweir // virtual base class for all XPropertyChangeListener members of the 55cdf0e10cSrcweir // various lingu services. 56cdf0e10cSrcweir // Only propertyChange needs to be implemented. 57cdf0e10cSrcweir 58cdf0e10cSrcweir class PropertyChgHelper : 59cdf0e10cSrcweir public cppu::WeakImplHelper2 60cdf0e10cSrcweir < 61cdf0e10cSrcweir XPropertyChangeListener, 62cdf0e10cSrcweir XLinguServiceEventBroadcaster 63cdf0e10cSrcweir > 64cdf0e10cSrcweir { 65cdf0e10cSrcweir Sequence< OUString > aPropNames; 66cdf0e10cSrcweir Reference< XInterface > xMyEvtObj; 67cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper aLngSvcEvtListeners; 68cdf0e10cSrcweir Reference< XPropertySet > xPropSet; 69cdf0e10cSrcweir 70cdf0e10cSrcweir // disallow use of copy-constructor and assignment-operator 71cdf0e10cSrcweir PropertyChgHelper( const PropertyChgHelper & ); 72cdf0e10cSrcweir PropertyChgHelper & operator = ( const PropertyChgHelper & ); 73cdf0e10cSrcweir 74cdf0e10cSrcweir public: 75cdf0e10cSrcweir PropertyChgHelper( 76cdf0e10cSrcweir const Reference< XInterface > &rxSource, 77cdf0e10cSrcweir Reference< XPropertySet > &rxPropSet, 78cdf0e10cSrcweir const char *pPropNames[], USHORT nPropCount ); 79cdf0e10cSrcweir virtual ~PropertyChgHelper(); 80cdf0e10cSrcweir 81cdf0e10cSrcweir // XEventListener 82cdf0e10cSrcweir virtual void SAL_CALL 83cdf0e10cSrcweir disposing( const EventObject& rSource ) 84cdf0e10cSrcweir throw(RuntimeException); 85cdf0e10cSrcweir 86cdf0e10cSrcweir // XPropertyChangeListener 87cdf0e10cSrcweir virtual void SAL_CALL 88cdf0e10cSrcweir propertyChange( const PropertyChangeEvent& rEvt ) 89cdf0e10cSrcweir throw(RuntimeException) = 0; 90cdf0e10cSrcweir 91cdf0e10cSrcweir // XLinguServiceEventBroadcaster 92cdf0e10cSrcweir virtual sal_Bool SAL_CALL 93cdf0e10cSrcweir addLinguServiceEventListener( 94cdf0e10cSrcweir const Reference< XLinguServiceEventListener >& rxListener ) 95cdf0e10cSrcweir throw(RuntimeException); 96cdf0e10cSrcweir virtual sal_Bool SAL_CALL 97cdf0e10cSrcweir removeLinguServiceEventListener( 98cdf0e10cSrcweir const Reference< XLinguServiceEventListener >& rxListener ) 99cdf0e10cSrcweir throw(RuntimeException); 100cdf0e10cSrcweir 101cdf0e10cSrcweir // non UNO functions 102cdf0e10cSrcweir void AddAsPropListener(); 103cdf0e10cSrcweir void RemoveAsPropListener(); 104cdf0e10cSrcweir void LaunchEvent( const LinguServiceEvent& rEvt ); 105cdf0e10cSrcweir 106cdf0e10cSrcweir const Sequence< OUString > & GetPropNames() const107cdf0e10cSrcweir GetPropNames() const { return aPropNames; } 108cdf0e10cSrcweir const Reference< XPropertySet > & GetPropSet() const109cdf0e10cSrcweir GetPropSet() const { return xPropSet; } 110cdf0e10cSrcweir const Reference< XInterface > & GetEvtObj() const111cdf0e10cSrcweir GetEvtObj() const { return xMyEvtObj; } 112cdf0e10cSrcweir }; 113cdf0e10cSrcweir 114cdf0e10cSrcweir 115cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////// 116cdf0e10cSrcweir 117cdf0e10cSrcweir 118cdf0e10cSrcweir class PropertyHelper_Spell : 119cdf0e10cSrcweir public PropertyChgHelper 120cdf0e10cSrcweir { 121cdf0e10cSrcweir // default values 122cdf0e10cSrcweir BOOL bIsGermanPreReform; 123cdf0e10cSrcweir BOOL bIsIgnoreControlCharacters; 124cdf0e10cSrcweir BOOL bIsUseDictionaryList; 125cdf0e10cSrcweir BOOL bIsSpellUpperCase; 126cdf0e10cSrcweir BOOL bIsSpellWithDigits; 127cdf0e10cSrcweir BOOL bIsSpellCapitalization; 128cdf0e10cSrcweir 129cdf0e10cSrcweir // return values, will be set to default value or current temporary value 130cdf0e10cSrcweir BOOL bResIsGermanPreReform; 131cdf0e10cSrcweir BOOL bResIsIgnoreControlCharacters; 132cdf0e10cSrcweir BOOL bResIsUseDictionaryList; 133cdf0e10cSrcweir BOOL bResIsSpellUpperCase; 134cdf0e10cSrcweir BOOL bResIsSpellWithDigits; 135cdf0e10cSrcweir BOOL bResIsSpellCapitalization; 136cdf0e10cSrcweir 137cdf0e10cSrcweir 138cdf0e10cSrcweir // disallow use of copy-constructor and assignment-operator 139cdf0e10cSrcweir PropertyHelper_Spell( const PropertyHelper_Spell & ); 140cdf0e10cSrcweir PropertyHelper_Spell & operator = ( const PropertyHelper_Spell & ); 141cdf0e10cSrcweir 142cdf0e10cSrcweir void SetDefault(); 143cdf0e10cSrcweir 144cdf0e10cSrcweir public: 145cdf0e10cSrcweir PropertyHelper_Spell( 146cdf0e10cSrcweir const Reference< XInterface > &rxSource, 147cdf0e10cSrcweir Reference< XPropertySet > &rxPropSet ); 148cdf0e10cSrcweir virtual ~PropertyHelper_Spell(); 149cdf0e10cSrcweir 150cdf0e10cSrcweir // XPropertyChangeListener 151cdf0e10cSrcweir virtual void SAL_CALL 152cdf0e10cSrcweir propertyChange( const PropertyChangeEvent& rEvt ) 153cdf0e10cSrcweir throw(RuntimeException); 154cdf0e10cSrcweir 155cdf0e10cSrcweir void SetTmpPropVals( const PropertyValues &rPropVals ); 156cdf0e10cSrcweir IsGermanPreReform() const157cdf0e10cSrcweir BOOL IsGermanPreReform() const { return bResIsGermanPreReform; } IsIgnoreControlCharacters() const158cdf0e10cSrcweir BOOL IsIgnoreControlCharacters() const { return bResIsIgnoreControlCharacters; } IsUseDictionaryList() const159cdf0e10cSrcweir BOOL IsUseDictionaryList() const { return bResIsUseDictionaryList; } IsSpellUpperCase() const160cdf0e10cSrcweir BOOL IsSpellUpperCase() const { return bResIsSpellUpperCase; } IsSpellWithDigits() const161cdf0e10cSrcweir BOOL IsSpellWithDigits() const { return bResIsSpellWithDigits; } IsSpellCapitalization() const162cdf0e10cSrcweir BOOL IsSpellCapitalization() const { return bResIsSpellCapitalization; } 163cdf0e10cSrcweir }; 164cdf0e10cSrcweir 165cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////// 166cdf0e10cSrcweir 167cdf0e10cSrcweir #endif 168cdf0e10cSrcweir 169