tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / linguistic / workben / sprophelp.hxx
blob3882c0abba5a74f00313b7415860e83f3e586c90
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/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 {
30 class XPropertySet;
31 }}}};
33 namespace com::sun::star::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::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 & );
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; }
105 class PropertyHelper_Spell :
106 public PropertyChgHelper
108 // default values
109 sal_Bool bIsIgnoreControlCharacters;
110 sal_Bool bIsUseDictionaryList;
111 sal_Bool bIsSpellUpperCase;
112 sal_Bool bIsSpellWithDigits;
113 sal_Bool bIsSpellCapitalization;
115 // return values, will be set to default value or current temporary value
116 sal_Bool bResIsIgnoreControlCharacters;
117 sal_Bool bResIsUseDictionaryList;
118 sal_Bool bResIsSpellUpperCase;
119 sal_Bool bResIsSpellWithDigits;
120 sal_Bool bResIsSpellCapitalization;
123 // disallow use of copy-constructor and assignment-operator
124 PropertyHelper_Spell( const PropertyHelper_Spell & );
125 PropertyHelper_Spell & operator = ( const PropertyHelper_Spell & );
127 void SetDefault();
129 public:
130 PropertyHelper_Spell(
131 const Reference< XInterface > &rxSource,
132 Reference< XPropertySet > &rxPropSet );
133 virtual ~PropertyHelper_Spell();
135 // XPropertyChangeListener
136 virtual void SAL_CALL
137 propertyChange( const PropertyChangeEvent& rEvt )
138 throw(RuntimeException);
140 void SetTmpPropVals( const PropertyValues &rPropVals );
142 sal_Bool IsIgnoreControlCharacters() const { return bResIsIgnoreControlCharacters; }
143 sal_Bool IsUseDictionaryList() const { return bResIsUseDictionaryList; }
144 sal_Bool IsSpellUpperCase() const { return bResIsSpellUpperCase; }
145 sal_Bool IsSpellWithDigits() const { return bResIsSpellWithDigits; }
146 sal_Bool IsSpellCapitalization() const { return bResIsSpellCapitalization; }
150 #endif
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */