Branch libreoffice-5-0-4
[LibreOffice.git] / linguistic / workben / sprophelp.hxx
blob939ea6b0817f30d1f7ba5f48d49a03326aa89091
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 {
30 class XPropertySet;
31 }}}};
33 namespace com { namespace sun { namespace star { namespace linguistic2 {
34 struct LinguServiceEvent;
35 }}}};
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;
43 // PropertyChgHelper
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 & );
64 public:
65 PropertyChgHelper(
66 const Reference< XInterface > &rxSource,
67 Reference< XPropertySet > &rxPropSet,
68 const char *pPropNames[], sal_uInt16 nPropCount );
69 virtual ~PropertyChgHelper();
71 // XEventListener
72 virtual void SAL_CALL
73 disposing( const EventObject& rSource )
74 throw(RuntimeException);
76 // XPropertyChangeListener
77 virtual void SAL_CALL
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);
91 // non UNO functions
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
110 // default values
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 & );
131 void SetDefault();
133 public:
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; }
155 #endif
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */