xref: /trunk/main/forms/source/inc/FormComponent.hxx (revision 0de526bd)
12d785d7eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
32d785d7eSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
42d785d7eSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
52d785d7eSAndrew Rist  * distributed with this work for additional information
62d785d7eSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
72d785d7eSAndrew Rist  * to you under the Apache License, Version 2.0 (the
82d785d7eSAndrew Rist  * "License"); you may not use this file except in compliance
92d785d7eSAndrew Rist  * with the License.  You may obtain a copy of the License at
102d785d7eSAndrew Rist  *
112d785d7eSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
122d785d7eSAndrew Rist  *
132d785d7eSAndrew Rist  * Unless required by applicable law or agreed to in writing,
142d785d7eSAndrew Rist  * software distributed under the License is distributed on an
152d785d7eSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162d785d7eSAndrew Rist  * KIND, either express or implied.  See the License for the
172d785d7eSAndrew Rist  * specific language governing permissions and limitations
182d785d7eSAndrew Rist  * under the License.
192d785d7eSAndrew Rist  *
202d785d7eSAndrew Rist  *************************************************************/
212d785d7eSAndrew Rist 
222d785d7eSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _FORMS_FORMCOMPONENT_HXX_
25cdf0e10cSrcweir #define _FORMS_FORMCOMPONENT_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "cloneable.hxx"
28cdf0e10cSrcweir #include "ids.hxx"
29cdf0e10cSrcweir #include "property.hrc"
30cdf0e10cSrcweir #include "property.hxx"
31cdf0e10cSrcweir #include "propertybaghelper.hxx"
32cdf0e10cSrcweir #include "resettable.hxx"
33cdf0e10cSrcweir #include "services.hxx"
34cdf0e10cSrcweir #include "windowstateguard.hxx"
35cdf0e10cSrcweir 
36cdf0e10cSrcweir /** === begin UNO includes === **/
37cdf0e10cSrcweir #include <com/sun/star/awt/XControl.hpp>
38cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyAccess.hpp>
39cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyContainer.hpp>
40cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp>
41cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp>
42cdf0e10cSrcweir #include <com/sun/star/form/binding/XBindableValue.hpp>
43cdf0e10cSrcweir #include <com/sun/star/form/FormComponentType.hpp>
44cdf0e10cSrcweir #include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
45cdf0e10cSrcweir #include <com/sun/star/form/validation/XValidityConstraintListener.hpp>
46cdf0e10cSrcweir #include <com/sun/star/form/XBoundComponent.hpp>
47cdf0e10cSrcweir #include <com/sun/star/form/XBoundControl.hpp>
48cdf0e10cSrcweir #include <com/sun/star/form/XFormComponent.hpp>
49cdf0e10cSrcweir #include <com/sun/star/form/XLoadListener.hpp>
50cdf0e10cSrcweir #include <com/sun/star/form/XReset.hpp>
51cdf0e10cSrcweir #include <com/sun/star/io/XMarkableStream.hpp>
52cdf0e10cSrcweir #include <com/sun/star/io/XPersistObject.hpp>
53cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
54cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp>
55cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
56cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
57cdf0e10cSrcweir #include <com/sun/star/sdb/XColumn.hpp>
58cdf0e10cSrcweir #include <com/sun/star/sdb/XColumnUpdate.hpp>
59cdf0e10cSrcweir #include <com/sun/star/sdb/XRowSetChangeListener.hpp>
60cdf0e10cSrcweir #include <com/sun/star/sdbc/XRowSet.hpp>
61cdf0e10cSrcweir #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
62cdf0e10cSrcweir #include <com/sun/star/uno/XAggregation.hpp>
63cdf0e10cSrcweir #include <com/sun/star/util/XCloneable.hpp>
64cdf0e10cSrcweir #include <com/sun/star/util/XModifyListener.hpp>
65cdf0e10cSrcweir #include <com/sun/star/form/XLoadable.hpp>
66cdf0e10cSrcweir /** === end UNO includes === **/
67cdf0e10cSrcweir 
68cdf0e10cSrcweir #include <comphelper/componentcontext.hxx>
69cdf0e10cSrcweir #include <comphelper/propagg.hxx>
70cdf0e10cSrcweir #include <comphelper/propertybag.hxx>
71cdf0e10cSrcweir #include <comphelper/propmultiplex.hxx>
72cdf0e10cSrcweir #include <comphelper/sequence.hxx>
73cdf0e10cSrcweir #include <comphelper/uno3.hxx>
74cdf0e10cSrcweir #include <cppuhelper/component.hxx>
75cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
76cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
77cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
78cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx>
79cdf0e10cSrcweir #include <cppuhelper/implbase7.hxx>
80cdf0e10cSrcweir #include <osl/mutex.hxx>
81cdf0e10cSrcweir #include <rtl/ustring.hxx>
82cdf0e10cSrcweir 
83cdf0e10cSrcweir #include <memory>
84cdf0e10cSrcweir 
85cdf0e10cSrcweir //.........................................................................
86cdf0e10cSrcweir namespace frm
87cdf0e10cSrcweir {
88cdf0e10cSrcweir //.........................................................................
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     // default tab index for components
91cdf0e10cSrcweir     const sal_Int16 FRM_DEFAULT_TABINDEX = 0;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     // macros for quickly declaring/implementing XServiceInfo
94cdf0e10cSrcweir     #define DECLARE_XPERSISTOBJECT() \
95cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);    \
96cdf0e10cSrcweir     virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);    \
97cdf0e10cSrcweir     virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);   \
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     // old macro for quickly implementing XServiceInfo::getImplementationName
100cdf0e10cSrcweir     #define IMPLEMENTATION_NAME(ImplName)										\
101cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException) \
102cdf0e10cSrcweir 		{ return ::rtl::OUString::createFromAscii("com.sun.star.comp.forms.") + ::rtl::OUString::createFromAscii(#ImplName); }
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     class OControlModel;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     //=========================================================================
107cdf0e10cSrcweir     //= ControlModelLock
108cdf0e10cSrcweir     //=========================================================================
109cdf0e10cSrcweir     /** class whose instances lock a OControlModel
110cdf0e10cSrcweir 
111cdf0e10cSrcweir         Locking here merely means locking the OControlModel's mutex.
112cdf0e10cSrcweir 
113cdf0e10cSrcweir         In addition to the locking facility, the class is also able to fire property
114cdf0e10cSrcweir         change notifications. This happens when the last ControlModelLock instance on a stack
115cdf0e10cSrcweir         dies.
116cdf0e10cSrcweir     */
117cdf0e10cSrcweir     class ControlModelLock
118cdf0e10cSrcweir     {
119cdf0e10cSrcweir     public:
120cdf0e10cSrcweir         ControlModelLock( OControlModel& _rModel )
121cdf0e10cSrcweir             :m_rModel( _rModel )
122cdf0e10cSrcweir             ,m_bLocked( false )
123cdf0e10cSrcweir         {
124cdf0e10cSrcweir             acquire();
125cdf0e10cSrcweir         }
126cdf0e10cSrcweir 
127cdf0e10cSrcweir         ~ControlModelLock()
128cdf0e10cSrcweir         {
129cdf0e10cSrcweir             if ( m_bLocked )
130cdf0e10cSrcweir                 release();
131cdf0e10cSrcweir         }
132cdf0e10cSrcweir         inline void acquire();
133cdf0e10cSrcweir         inline void release();
134cdf0e10cSrcweir 
135cdf0e10cSrcweir         inline OControlModel& getModel() const { return m_rModel; };
136cdf0e10cSrcweir 
137cdf0e10cSrcweir         /** adds a property change notification, which is to be fired when the last lock on the model
138cdf0e10cSrcweir             (in the current thread) is released.
139cdf0e10cSrcweir         */
140cdf0e10cSrcweir         void    addPropertyNotification(
141cdf0e10cSrcweir                     const sal_Int32 _nHandle,
142cdf0e10cSrcweir                     const ::com::sun::star::uno::Any& _rOldValue,
143cdf0e10cSrcweir                     const ::com::sun::star::uno::Any& _rNewValue
144cdf0e10cSrcweir                 );
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     private:
147cdf0e10cSrcweir         void    impl_notifyAll_nothrow();
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     private:
150cdf0e10cSrcweir         OControlModel&                                                  m_rModel;
151cdf0e10cSrcweir         bool                                                            m_bLocked;
152cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< sal_Int32 >                    m_aHandles;
153cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >   m_aOldValues;
154cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >   m_aNewValues;
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     private:
157cdf0e10cSrcweir         ControlModelLock();                                     // never implemented
158cdf0e10cSrcweir         ControlModelLock( const ControlModelLock& );            // never implemented
159cdf0e10cSrcweir         ControlModelLock& operator=( const ControlModelLock& ); // never implemented
160cdf0e10cSrcweir     };
161cdf0e10cSrcweir 
162cdf0e10cSrcweir //=========================================================================
163cdf0e10cSrcweir //= OControl
164cdf0e10cSrcweir //= base class for form layer controls
165cdf0e10cSrcweir //=========================================================================
166cdf0e10cSrcweir typedef ::cppu::ImplHelper3	<	::com::sun::star::awt::XControl
167cdf0e10cSrcweir 							,	::com::sun::star::lang::XEventListener
168cdf0e10cSrcweir 							,	::com::sun::star::lang::XServiceInfo
169cdf0e10cSrcweir 							> OControl_BASE;
170cdf0e10cSrcweir 
171cdf0e10cSrcweir class OControl	:public ::cppu::OComponentHelper
172cdf0e10cSrcweir 				,public OControl_BASE
173cdf0e10cSrcweir {
174cdf0e10cSrcweir protected:
175cdf0e10cSrcweir     ::osl::Mutex                                m_aMutex;
176cdf0e10cSrcweir 	OImplementationIdsRef						m_aHoldIdHelper;
177cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
178cdf0e10cSrcweir 												m_xControl;
179cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation>
180cdf0e10cSrcweir 												m_xAggregate;
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     ::comphelper::ComponentContext              m_aContext;
183cdf0e10cSrcweir     WindowStateGuard                            m_aWindowStateGuard;
184cdf0e10cSrcweir 
185cdf0e10cSrcweir public:
186cdf0e10cSrcweir     /** constructs a control
187cdf0e10cSrcweir 
188cdf0e10cSrcweir         @param _rFactory
189cdf0e10cSrcweir             the service factory for this control
190cdf0e10cSrcweir         @param _rAggregateService
191cdf0e10cSrcweir             the service name of the component to aggregate
192cdf0e10cSrcweir         @param _bSetDelegator
193cdf0e10cSrcweir             set this to <FALSE/> if you don't want the constructor to set the delegator at
194cdf0e10cSrcweir             the aggregate. In this case, you <em>have</em> to call doSetDelegator within your
195cdf0e10cSrcweir             own constructor.
196cdf0e10cSrcweir 
197cdf0e10cSrcweir             This is helpfull, if your derived class wants to cache an interface of the aggregate.
198cdf0e10cSrcweir             In this case, the aggregate needs to be queried for this interface <b>before</b> the
199cdf0e10cSrcweir             <member scope="com::sun::star::uno">XAggregation::setDelegator</member> call.
200cdf0e10cSrcweir 
201cdf0e10cSrcweir             In such a case, pass <FALSE/> to this parameter. Then, cache the aggregate's interface(s)
202cdf0e10cSrcweir             as needed. Afterwards, call <member>doSetDelegator</member>.
203cdf0e10cSrcweir 
204cdf0e10cSrcweir             In your destructor, you need to call <member>doResetDelegator</member> before
205cdf0e10cSrcweir             resetting the cached interfaces. This will reset the aggregates delegator to <NULL/>,
206cdf0e10cSrcweir             which will ensure that the <member scope="com::sun::star::uno">XInterface::release</member>
207cdf0e10cSrcweir             calls on the cached interfaces are really applied to the aggregate, instead of
208cdf0e10cSrcweir             the <type>OControl</type> itself.
209cdf0e10cSrcweir     */
210cdf0e10cSrcweir 	OControl(
211cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rFactory,
212cdf0e10cSrcweir         const ::rtl::OUString& _rAggregateService,
213cdf0e10cSrcweir         const sal_Bool _bSetDelegator = sal_True
214cdf0e10cSrcweir     );
215cdf0e10cSrcweir 
216cdf0e10cSrcweir     /** initializes the given peer with various settings necessary for form controls
217cdf0e10cSrcweir     */
218cdf0e10cSrcweir     static  void    initFormControlPeer(
219cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& _rxPeer );
220cdf0e10cSrcweir 
221cdf0e10cSrcweir protected:
222cdf0e10cSrcweir 	virtual ~OControl();
223cdf0e10cSrcweir 
224cdf0e10cSrcweir     /** sets the control as delegator at the aggregate
225cdf0e10cSrcweir 
226cdf0e10cSrcweir         This has to be called from within your derived class' constructor, if and only
227cdf0e10cSrcweir         if you passed <FALSE/> to the <arg>_bSetDelegator</arg> parameter of the
228cdf0e10cSrcweir         <type>OControl</type> constructor.
229cdf0e10cSrcweir     */
230cdf0e10cSrcweir 	void	doSetDelegator();
231cdf0e10cSrcweir 	void	doResetDelegator();
232cdf0e10cSrcweir 
233cdf0e10cSrcweir // UNO
234cdf0e10cSrcweir 	DECLARE_UNO3_AGG_DEFAULTS(OControl, OComponentHelper);
235cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
236cdf0e10cSrcweir 
237cdf0e10cSrcweir // XTypeProvider
238cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence<sal_Int8>			SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
239cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type>	SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
240cdf0e10cSrcweir 
241cdf0e10cSrcweir // OComponentHelper
242cdf0e10cSrcweir 	virtual void SAL_CALL disposing();
243cdf0e10cSrcweir 
244cdf0e10cSrcweir // XComponent (as base of XControl)
245cdf0e10cSrcweir     virtual void SAL_CALL dispose(  ) throw(::com::sun::star::uno::RuntimeException)
246cdf0e10cSrcweir 		{ OComponentHelper::dispose(); }
247cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException)
248cdf0e10cSrcweir 		{ OComponentHelper::addEventListener(_rxListener); }
249cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException)
250cdf0e10cSrcweir 		{ OComponentHelper::removeEventListener(_rxListener); }
251cdf0e10cSrcweir 
252cdf0e10cSrcweir // XEventListener
253cdf0e10cSrcweir 	virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException);
254cdf0e10cSrcweir 
255cdf0e10cSrcweir // XServiceInfo
256cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL			supportsService(const ::rtl::OUString& ServiceName) throw (::com::sun::star::uno::RuntimeException);
257cdf0e10cSrcweir 	virtual StringSequence SAL_CALL		getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
258cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL	getImplementationName() throw(::com::sun::star::uno::RuntimeException) = 0;
259cdf0e10cSrcweir 
260cdf0e10cSrcweir // XServiceInfo - static version
261cdf0e10cSrcweir 	static  StringSequence SAL_CALL		getSupportedServiceNames_Static() throw(::com::sun::star::uno::RuntimeException);
262cdf0e10cSrcweir 
263cdf0e10cSrcweir // XControl
264cdf0e10cSrcweir 	virtual void										SAL_CALL setContext(const InterfaceRef& Context) throw (::com::sun::star::uno::RuntimeException);
265cdf0e10cSrcweir 	virtual InterfaceRef								SAL_CALL getContext() throw (::com::sun::star::uno::RuntimeException);
266cdf0e10cSrcweir 	virtual void										SAL_CALL createPeer(const ::com::sun::star::uno::Reference<starawt::XToolkit>& Toolkit, const ::com::sun::star::uno::Reference<starawt::XWindowPeer>& Parent) throw (::com::sun::star::uno::RuntimeException);
267cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference<starawt::XWindowPeer>	SAL_CALL getPeer() throw (::com::sun::star::uno::RuntimeException);
268cdf0e10cSrcweir 	virtual sal_Bool									SAL_CALL setModel(const ::com::sun::star::uno::Reference<starawt::XControlModel>& Model) throw (::com::sun::star::uno::RuntimeException);
269cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference<starawt::XControlModel>	SAL_CALL getModel() throw (::com::sun::star::uno::RuntimeException);
270cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference<starawt::XView>			SAL_CALL getView() throw (::com::sun::star::uno::RuntimeException);
271cdf0e10cSrcweir 	virtual void										SAL_CALL setDesignMode(sal_Bool bOn) throw (::com::sun::star::uno::RuntimeException);
272cdf0e10cSrcweir 	virtual sal_Bool									SAL_CALL isDesignMode() throw (::com::sun::star::uno::RuntimeException);
273cdf0e10cSrcweir 	virtual sal_Bool									SAL_CALL isTransparent() throw (::com::sun::star::uno::RuntimeException);
274cdf0e10cSrcweir 
275cdf0e10cSrcweir protected:
276cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type>	_getTypes();
277cdf0e10cSrcweir 		// overwrite this and call the base class if you have additional types
278cdf0e10cSrcweir 
279cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::rtl::OUString > getAggregateServiceNames();
280cdf0e10cSrcweir 
281cdf0e10cSrcweir private:
282cdf0e10cSrcweir     void    impl_resetStateGuard_nothrow();
283cdf0e10cSrcweir };
284cdf0e10cSrcweir 
285cdf0e10cSrcweir //==================================================================
286cdf0e10cSrcweir //= OBoundControl
287cdf0e10cSrcweir //= a form control implementing the XBoundControl interface
288cdf0e10cSrcweir //==================================================================
289cdf0e10cSrcweir typedef ::cppu::ImplHelper1 <   ::com::sun::star::form::XBoundControl
290cdf0e10cSrcweir                             >  OBoundControl_BASE;
291cdf0e10cSrcweir class OBoundControl	:public OControl
292cdf0e10cSrcweir 					,public OBoundControl_BASE
293cdf0e10cSrcweir {
294cdf0e10cSrcweir protected:
295cdf0e10cSrcweir 	sal_Bool	m_bLocked : 1;
296cdf0e10cSrcweir 
297cdf0e10cSrcweir     ::rtl::OUString m_sOriginalHelpText;                // as long as the text/value is invalid, we change the help text of our peer
298cdf0e10cSrcweir     ::com::sun::star::awt::FontDescriptor
299cdf0e10cSrcweir                     m_aOriginalFont;                    // as long as the text/value is invalid, we also change the font
300cdf0e10cSrcweir     sal_Int32       m_nOriginalTextLineColor;           // (we add red underlining)
301cdf0e10cSrcweir 
302cdf0e10cSrcweir public:
303cdf0e10cSrcweir     OBoundControl(
304cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,
305cdf0e10cSrcweir         const ::rtl::OUString& _rAggregateService,
306cdf0e10cSrcweir         const sal_Bool _bSetDelegator = sal_True
307cdf0e10cSrcweir     );
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 	virtual ~OBoundControl();
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 	DECLARE_UNO3_AGG_DEFAULTS(OBoundControl, OControl);
312cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
313cdf0e10cSrcweir 
314cdf0e10cSrcweir     // XBoundControl
315cdf0e10cSrcweir     virtual sal_Bool SAL_CALL	getLock() throw(::com::sun::star::uno::RuntimeException);
316cdf0e10cSrcweir     virtual void SAL_CALL		setLock(sal_Bool _bLock) throw(::com::sun::star::uno::RuntimeException);
317cdf0e10cSrcweir 		// default implementation just disables the controls, overwrite _setLock to change this behaviour
318cdf0e10cSrcweir 
319cdf0e10cSrcweir     // XControl
320cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw (::com::sun::star::uno::RuntimeException);
321cdf0e10cSrcweir 
322cdf0e10cSrcweir     // XEventListener
323cdf0e10cSrcweir 	virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException);
324cdf0e10cSrcweir 
325cdf0e10cSrcweir     // OComponentHelper
326cdf0e10cSrcweir 	virtual void SAL_CALL disposing();
327cdf0e10cSrcweir 
328cdf0e10cSrcweir protected:
329cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type>	_getTypes();
330cdf0e10cSrcweir 	// implement the lock setting
331cdf0e10cSrcweir 	virtual void		 _setLock(sal_Bool _bLock);
332cdf0e10cSrcweir };
333cdf0e10cSrcweir 
334cdf0e10cSrcweir //==================================================================
335cdf0e10cSrcweir //= OControlModel
336cdf0e10cSrcweir //= model of a form layer control
337cdf0e10cSrcweir //==================================================================
338*0de526bdSJianyuan Li //added for exporting OCX control
339*0de526bdSJianyuan Li #define INVALID_OBJ_ID_IN_MSO     0xFFFF
340cdf0e10cSrcweir 
341cdf0e10cSrcweir typedef ::cppu::ImplHelper7	<	::com::sun::star::form::XFormComponent
342cdf0e10cSrcweir 							,	::com::sun::star::io::XPersistObject
343cdf0e10cSrcweir 							,	::com::sun::star::container::XNamed
344cdf0e10cSrcweir 							,	::com::sun::star::lang::XServiceInfo
345cdf0e10cSrcweir 							,	::com::sun::star::util::XCloneable
346cdf0e10cSrcweir 							,	::com::sun::star::beans::XPropertyContainer
347cdf0e10cSrcweir 							,	::com::sun::star::beans::XPropertyAccess
348cdf0e10cSrcweir 							>	OControlModel_BASE;
349cdf0e10cSrcweir 
350cdf0e10cSrcweir class OControlModel	:public ::cppu::OComponentHelper
351cdf0e10cSrcweir 					,public OPropertySetAggregationHelper
352cdf0e10cSrcweir 					,public OControlModel_BASE
353cdf0e10cSrcweir 					,public OCloneableAggregation
354cdf0e10cSrcweir                     ,public IPropertyBagHelperContext
355cdf0e10cSrcweir {
356cdf0e10cSrcweir 
357cdf0e10cSrcweir protected:
358cdf0e10cSrcweir     ::comphelper::ComponentContext  m_aContext;
359cdf0e10cSrcweir 
360cdf0e10cSrcweir     ::osl::Mutex                    m_aMutex;
361cdf0e10cSrcweir     oslInterlockedCount             m_lockCount;
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 	InterfaceRef					m_xParent;					// ParentComponent
364cdf0e10cSrcweir 	OImplementationIdsRef			m_aHoldIdHelper;
365cdf0e10cSrcweir     PropertyBagHelper               m_aPropertyBagHelper;
366cdf0e10cSrcweir 
367cdf0e10cSrcweir     const ::comphelper::ComponentContext&
368cdf0e10cSrcweir         getContext() const { return m_aContext; }
369cdf0e10cSrcweir 
370cdf0e10cSrcweir // <properties>
371cdf0e10cSrcweir 	::rtl::OUString					m_aName;					// name of the control
372cdf0e10cSrcweir 	::rtl::OUString					m_aTag;						// tag for additional data
373cdf0e10cSrcweir 	sal_Int16						m_nTabIndex;				// index within the taborder
374cdf0e10cSrcweir 	sal_Int16						m_nClassId;					// type of the control
375cdf0e10cSrcweir     sal_Bool                        m_bNativeLook;              // should the control use the native platform look?
376*0de526bdSJianyuan Li     //added for exporting OCX control
377*0de526bdSJianyuan Li     sal_Int16						m_nControlTypeinMSO;		//keep the MS office control type for exporting to MS binarary file
378*0de526bdSJianyuan Li     sal_uInt16						m_nObjIDinMSO;				//keep the OCX control obj id for exporting to MS binarary file
379cdf0e10cSrcweir // </properties>
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 
382cdf0e10cSrcweir protected:
383cdf0e10cSrcweir 	OControlModel(
384cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rFactory,	// factory to create the aggregate with
385cdf0e10cSrcweir 		const ::rtl::OUString& _rUnoControlModelTypeName,						// service name of te model to aggregate
386cdf0e10cSrcweir 		const ::rtl::OUString& rDefault = ::rtl::OUString(),					// service name of the default control
387cdf0e10cSrcweir 		const sal_Bool _bSetDelegator = sal_True								// set to sal_False if you want to call setDelegator later (after returning from this ctor)
388cdf0e10cSrcweir 	);
389cdf0e10cSrcweir 	OControlModel(
390cdf0e10cSrcweir 		const OControlModel* _pOriginal,										// the original object to clone
391cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rFactory,	// factory to create the aggregate with
392cdf0e10cSrcweir         const sal_Bool _bCloneAggregate = sal_True,                             // should the aggregate of the original be cloned, too?
393cdf0e10cSrcweir 		const sal_Bool _bSetDelegator = sal_True								// set to sal_False if you want to call setDelegator later (after returning from this ctor)
394cdf0e10cSrcweir 	);
395cdf0e10cSrcweir 	virtual ~OControlModel();
396cdf0e10cSrcweir 
397cdf0e10cSrcweir     /** to be called after a OBoundControlModel (a derivee, respectively) has been cloned
398cdf0e10cSrcweir 
399cdf0e10cSrcweir         <p>This method contains late initializations which cannot be done in the
400cdf0e10cSrcweir         constructor of this base class, since the virtual method of derived classes do
401cdf0e10cSrcweir         not yet work there.</p>
402cdf0e10cSrcweir     */
403cdf0e10cSrcweir     virtual void clonedFrom( const OControlModel* _pOriginal );
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 	using OComponentHelper::rBHelper;
406cdf0e10cSrcweir 
407cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type>	_getTypes();
408cdf0e10cSrcweir 
409cdf0e10cSrcweir 	void	readHelpTextCompatibly(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& _rxInStream);
410cdf0e10cSrcweir 	void	writeHelpTextCompatibly(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& _rxOutStream);
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 	void	doSetDelegator();
413cdf0e10cSrcweir 	void	doResetDelegator();
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 	::com::sun::star::uno::Sequence< ::rtl::OUString > getAggregateServiceNames();
416cdf0e10cSrcweir 
417cdf0e10cSrcweir public:
418cdf0e10cSrcweir 	DECLARE_UNO3_AGG_DEFAULTS(OControl, OComponentHelper);
419cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
420cdf0e10cSrcweir 
421cdf0e10cSrcweir // XTypeProvider
422cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence<sal_Int8>			SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
423cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type>	SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
424cdf0e10cSrcweir 
425cdf0e10cSrcweir // OComponentHelper
426cdf0e10cSrcweir 	virtual void SAL_CALL disposing();
427cdf0e10cSrcweir 
428cdf0e10cSrcweir // XNamed
429cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL	getName() throw(::com::sun::star::uno::RuntimeException);
430cdf0e10cSrcweir 	virtual void SAL_CALL				setName(const ::rtl::OUString& aName) throw(::com::sun::star::uno::RuntimeException);
431cdf0e10cSrcweir 
432cdf0e10cSrcweir // XServiceInfo
433cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL			supportsService(const ::rtl::OUString& ServiceName) throw (::com::sun::star::uno::RuntimeException);
434cdf0e10cSrcweir 	virtual StringSequence SAL_CALL		getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
435cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL	getImplementationName() throw(::com::sun::star::uno::RuntimeException) = 0;
436cdf0e10cSrcweir 
437cdf0e10cSrcweir // XSericeInfo - static version(s)
438cdf0e10cSrcweir 	static  StringSequence SAL_CALL		getSupportedServiceNames_Static() throw(::com::sun::star::uno::RuntimeException);
439cdf0e10cSrcweir 
440cdf0e10cSrcweir // XPersistObject
441cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL	getServiceName() throw(::com::sun::star::uno::RuntimeException) = 0;
442cdf0e10cSrcweir     virtual void SAL_CALL
443cdf0e10cSrcweir 		write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
444cdf0e10cSrcweir     virtual void SAL_CALL
445cdf0e10cSrcweir 		read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
446cdf0e10cSrcweir 
447cdf0e10cSrcweir // XChild (base of XFormComponent)
448cdf0e10cSrcweir     virtual InterfaceRef SAL_CALL	getParent() throw(::com::sun::star::uno::RuntimeException);
449cdf0e10cSrcweir     virtual void SAL_CALL			setParent(const InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
450cdf0e10cSrcweir 
451cdf0e10cSrcweir // XEventListener
452cdf0e10cSrcweir 	virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException);
453cdf0e10cSrcweir 
454cdf0e10cSrcweir // XPropertySet
455cdf0e10cSrcweir 	virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const;
456cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL convertFastPropertyValue(
457cdf0e10cSrcweir 				::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue )
458cdf0e10cSrcweir 				throw (::com::sun::star::lang::IllegalArgumentException);
459cdf0e10cSrcweir 	virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
460cdf0e10cSrcweir 				throw (::com::sun::star::uno::Exception);
461cdf0e10cSrcweir     using ::cppu::OPropertySetHelper::getFastPropertyValue;
462cdf0e10cSrcweir 
463cdf0e10cSrcweir // ::com::sun::star::beans::XPropertyState
464cdf0e10cSrcweir 	virtual	::com::sun::star::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle);
465cdf0e10cSrcweir 	virtual	void setPropertyToDefaultByHandle(sal_Int32 nHandle);
466cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const;
467cdf0e10cSrcweir 
468cdf0e10cSrcweir // XCloneable
469cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone(  ) throw (::com::sun::star::uno::RuntimeException) = 0;
470cdf0e10cSrcweir 
471cdf0e10cSrcweir // XPropertyContainer
472cdf0e10cSrcweir     virtual void SAL_CALL addProperty( const ::rtl::OUString& Name, ::sal_Int16 Attributes, const ::com::sun::star::uno::Any& DefaultValue ) throw (::com::sun::star::beans::PropertyExistException, ::com::sun::star::beans::IllegalTypeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
473cdf0e10cSrcweir     virtual void SAL_CALL removeProperty( const ::rtl::OUString& Name ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::NotRemoveableException, ::com::sun::star::uno::RuntimeException);
474cdf0e10cSrcweir 
475cdf0e10cSrcweir // XPropertyAccess
476cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues(  ) throw (::com::sun::star::uno::RuntimeException);
477cdf0e10cSrcweir     virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
478cdf0e10cSrcweir 
479cdf0e10cSrcweir protected:
480cdf0e10cSrcweir     using OPropertySetAggregationHelper::setPropertyValues;
481cdf0e10cSrcweir     using OPropertySetAggregationHelper::getPropertyValues;
482cdf0e10cSrcweir 
483cdf0e10cSrcweir protected:
484cdf0e10cSrcweir     virtual void writeAggregate( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& _rxOutStream ) const;
485cdf0e10cSrcweir     virtual void readAggregate( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& _rxInStream );
486cdf0e10cSrcweir 
487cdf0e10cSrcweir protected:
488cdf0e10cSrcweir 	// XPropertySet
489cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException);
490cdf0e10cSrcweir     // OPropertySetHelper
491cdf0e10cSrcweir 	virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
492cdf0e10cSrcweir 
493cdf0e10cSrcweir     /** describes the properties provided by this class, or its respective
494cdf0e10cSrcweir         derived class
495cdf0e10cSrcweir 
496cdf0e10cSrcweir         Derived classes usually call the base class first, and then append own properties.
497cdf0e10cSrcweir     */
498cdf0e10cSrcweir 	virtual void describeFixedProperties(
499cdf0e10cSrcweir 		::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
500cdf0e10cSrcweir     ) const;
501cdf0e10cSrcweir 
502cdf0e10cSrcweir     // IPropertyBagHelperContext
503cdf0e10cSrcweir     virtual ::osl::Mutex&   getMutex();
504cdf0e10cSrcweir     virtual void            describeFixedAndAggregateProperties(
505cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _out_rFixedProperties,
506cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _out_rAggregateProperties
507cdf0e10cSrcweir     ) const;
508cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet >
509cdf0e10cSrcweir                             getPropertiesInterface();
510cdf0e10cSrcweir 
511cdf0e10cSrcweir     /** describes the properties of our aggregate
512cdf0e10cSrcweir 
513cdf0e10cSrcweir         The default implementation simply asks m_xAggregateSet for its properties.
514cdf0e10cSrcweir 
515cdf0e10cSrcweir         You usually only need to overload this method if you want to filter the aggregate
516cdf0e10cSrcweir         properties.
517cdf0e10cSrcweir     */
518cdf0e10cSrcweir     virtual void describeAggregateProperties(
519cdf0e10cSrcweir 		::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
520cdf0e10cSrcweir     ) const;
521cdf0e10cSrcweir 
522cdf0e10cSrcweir public:
523cdf0e10cSrcweir     struct LockAccess { friend class ControlModelLock; private: LockAccess() { } };
524cdf0e10cSrcweir 
525cdf0e10cSrcweir     void                lockInstance( LockAccess );
526cdf0e10cSrcweir     oslInterlockedCount unlockInstance( LockAccess );
527cdf0e10cSrcweir 
528cdf0e10cSrcweir     void                firePropertyChanges(
529cdf0e10cSrcweir                             const ::com::sun::star::uno::Sequence< sal_Int32 >& _rHandles,
530cdf0e10cSrcweir                             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rOldValues,
531cdf0e10cSrcweir                             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rNewValues,
532cdf0e10cSrcweir                             LockAccess
533cdf0e10cSrcweir                         );
534cdf0e10cSrcweir 
535cdf0e10cSrcweir     inline ::osl::Mutex&
536cdf0e10cSrcweir                         getInstanceMutex() { return m_aMutex; }
537cdf0e10cSrcweir };
538cdf0e10cSrcweir 
539cdf0e10cSrcweir //==================================================================
540cdf0e10cSrcweir // simple destructor
541cdf0e10cSrcweir #define DECLARE_DEFAULT_DTOR( classname )	\
542cdf0e10cSrcweir 	~classname() \
543cdf0e10cSrcweir 
544cdf0e10cSrcweir // constructor for cloning a class
545cdf0e10cSrcweir #define DECLARE_DEFAULT_CLONE_CTOR( classname )  \
546cdf0e10cSrcweir 	classname( \
547cdf0e10cSrcweir 		const classname* _pOriginal, \
548cdf0e10cSrcweir 		const	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory \
549cdf0e10cSrcweir 	); \
550cdf0e10cSrcweir 
551cdf0e10cSrcweir // all xtors for an inner class of the object hierarchy
552cdf0e10cSrcweir #define DECLARE_DEFAULT_XTOR( classname )	\
553cdf0e10cSrcweir 	classname( \
554cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, \
555cdf0e10cSrcweir 		const ::rtl::OUString& _rUnoControlModelTypeName, \
556cdf0e10cSrcweir 		const ::rtl::OUString& _rDefault \
557cdf0e10cSrcweir 	); \
558cdf0e10cSrcweir     DECLARE_DEFAULT_CLONE_CTOR( classname )  \
559cdf0e10cSrcweir     DECLARE_DEFAULT_DTOR( classname )   \
560cdf0e10cSrcweir 
561cdf0e10cSrcweir // all xtors for an inner class of the object hierarchy which is *bound*
562cdf0e10cSrcweir #define DECLARE_DEFAULT_BOUND_XTOR( classname )	\
563cdf0e10cSrcweir 	classname( \
564cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, \
565cdf0e10cSrcweir 		const ::rtl::OUString& _rUnoControlModelTypeName, \
566cdf0e10cSrcweir 		const ::rtl::OUString& _rDefault, \
567cdf0e10cSrcweir         const sal_Bool _bSupportExternalBinding, \
568cdf0e10cSrcweir         const sal_Bool _bSupportsValidation \
569cdf0e10cSrcweir 	); \
570cdf0e10cSrcweir     DECLARE_DEFAULT_CLONE_CTOR( classname )  \
571cdf0e10cSrcweir     DECLARE_DEFAULT_DTOR( classname )   \
572cdf0e10cSrcweir 
573cdf0e10cSrcweir // all xtors for a leas class of the object hierarchy
574cdf0e10cSrcweir #define DECLARE_DEFAULT_LEAF_XTOR( classname )	\
575cdf0e10cSrcweir 	classname( \
576cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory \
577cdf0e10cSrcweir 	); \
578cdf0e10cSrcweir 	classname( \
579cdf0e10cSrcweir 		const classname* _pOriginal, \
580cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory \
581cdf0e10cSrcweir 	); \
582cdf0e10cSrcweir     DECLARE_DEFAULT_DTOR( classname )   \
583cdf0e10cSrcweir 
584cdf0e10cSrcweir //==================================================================
585cdf0e10cSrcweir // XCloneable
586cdf0e10cSrcweir #define DECLARE_XCLONEABLE( ) \
587cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone(  ) throw (::com::sun::star::uno::RuntimeException)
588cdf0e10cSrcweir 
589cdf0e10cSrcweir #define IMPLEMENT_DEFAULT_CLONING( classname ) \
590cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL classname::createClone( ) throw (::com::sun::star::uno::RuntimeException) \
591cdf0e10cSrcweir 	{ \
592cdf0e10cSrcweir         classname* pClone = new classname( this, getContext().getLegacyServiceFactory() ); \
593cdf0e10cSrcweir         pClone->clonedFrom( this ); \
594cdf0e10cSrcweir         return pClone; \
595cdf0e10cSrcweir 	}
596cdf0e10cSrcweir 
597cdf0e10cSrcweir //==================================================================
598cdf0e10cSrcweir //= OBoundControlModel
599cdf0e10cSrcweir //= model of a form layer control which is bound to a data source field
600cdf0e10cSrcweir //==================================================================
601cdf0e10cSrcweir typedef ::cppu::ImplHelper4 <	::com::sun::star::form::XLoadListener
602cdf0e10cSrcweir 						    ,   ::com::sun::star::form::XReset
603cdf0e10cSrcweir 							,	::com::sun::star::beans::XPropertyChangeListener
604cdf0e10cSrcweir 							,	::com::sun::star::sdb::XRowSetChangeListener
605cdf0e10cSrcweir                             >	OBoundControlModel_BASE1;
606cdf0e10cSrcweir 
607cdf0e10cSrcweir // separated into an own base class since derivees can disable the support for this
608cdf0e10cSrcweir // interface, thus we want to easily exclude it in the queryInterface and getTypes
609cdf0e10cSrcweir typedef ::cppu::ImplHelper1 <   ::com::sun::star::form::XBoundComponent
610cdf0e10cSrcweir                             >   OBoundControlModel_COMMITTING;
611cdf0e10cSrcweir 
612cdf0e10cSrcweir // dito
613cdf0e10cSrcweir typedef ::cppu::ImplHelper2 <   ::com::sun::star::form::binding::XBindableValue
614cdf0e10cSrcweir                             ,   ::com::sun::star::util::XModifyListener
615cdf0e10cSrcweir                             >   OBoundControlModel_BINDING;
616cdf0e10cSrcweir 
617cdf0e10cSrcweir // dito
618cdf0e10cSrcweir typedef ::cppu::ImplHelper2 <   ::com::sun::star::form::validation::XValidityConstraintListener
619cdf0e10cSrcweir                             ,   ::com::sun::star::form::validation::XValidatableFormComponent
620cdf0e10cSrcweir                             >   OBoundControlModel_VALIDATION;
621cdf0e10cSrcweir 
622cdf0e10cSrcweir class OBoundControlModel	:public OControlModel
623cdf0e10cSrcweir 							,public OBoundControlModel_BASE1
624cdf0e10cSrcweir 							,public OBoundControlModel_COMMITTING
625cdf0e10cSrcweir 							,public OBoundControlModel_BINDING
626cdf0e10cSrcweir                             ,public OBoundControlModel_VALIDATION
627cdf0e10cSrcweir                             ,public ::comphelper::OPropertyChangeListener
628cdf0e10cSrcweir {
629cdf0e10cSrcweir protected:
630cdf0e10cSrcweir     enum ValueChangeInstigator
631cdf0e10cSrcweir     {
632cdf0e10cSrcweir         eDbColumnBinding,
633cdf0e10cSrcweir         eExternalBinding,
634cdf0e10cSrcweir         eOther
635cdf0e10cSrcweir     };
636cdf0e10cSrcweir 
637cdf0e10cSrcweir private:
638cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
639cdf0e10cSrcweir                                         m_xField;
640cdf0e10cSrcweir     // the form which controls supplies the field we bind to.
641cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable >
642cdf0e10cSrcweir                                         m_xAmbientForm;
643cdf0e10cSrcweir 
644cdf0e10cSrcweir 	::rtl::OUString					    m_sValuePropertyName;
645cdf0e10cSrcweir     sal_Int32                           m_nValuePropertyAggregateHandle;
646cdf0e10cSrcweir     sal_Int32                           m_nFieldType;
647cdf0e10cSrcweir     ::com::sun::star::uno::Type         m_aValuePropertyType;
648cdf0e10cSrcweir     bool                                m_bValuePropertyMayBeVoid;
649cdf0e10cSrcweir 
650cdf0e10cSrcweir     ResetHelper                         m_aResetHelper;
651cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper   m_aUpdateListeners;
652cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper   m_aFormComponentListeners;
653cdf0e10cSrcweir 
654cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >
655cdf0e10cSrcweir                                         m_xExternalBinding;
656cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XValidator >
657cdf0e10cSrcweir                                         m_xValidator;
658cdf0e10cSrcweir     ::com::sun::star::uno::Type         m_aExternalValueType;
659cdf0e10cSrcweir 
660cdf0e10cSrcweir // <properties>
661cdf0e10cSrcweir 	::rtl::OUString						m_aControlSource;			// Datenquelle, Name des Feldes
662cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
663cdf0e10cSrcweir                                         m_xLabelControl;			// reference to a sibling control (model) which is our label
664cdf0e10cSrcweir     sal_Bool                            m_bInputRequired;
665cdf0e10cSrcweir // </properties>
666cdf0e10cSrcweir 
667cdf0e10cSrcweir     ::comphelper::OPropertyChangeMultiplexer*
668cdf0e10cSrcweir                                 m_pAggPropMultiplexer;
669cdf0e10cSrcweir 
670cdf0e10cSrcweir     bool                        m_bFormListening            : 1;    // are we currently a XLoadListener at our ambient form?
671cdf0e10cSrcweir 	sal_Bool					m_bLoaded		            : 1;
672cdf0e10cSrcweir 	sal_Bool					m_bRequired		            : 1;
673cdf0e10cSrcweir 	const sal_Bool              m_bCommitable	            : 1;    // do we support XBoundComponent?
674cdf0e10cSrcweir     const sal_Bool              m_bSupportsExternalBinding  : 1;    // do we support XBindableValue?
675cdf0e10cSrcweir     const sal_Bool			    m_bSupportsValidation       : 1;    // do we support XValidatable?
676cdf0e10cSrcweir 	sal_Bool					m_bForwardValueChanges      : 1;    // do we currently handle changes in the bound database field?
677cdf0e10cSrcweir     sal_Bool			        m_bTransferingValue         : 1;    // true if we're currently transfering our value to an external binding
678cdf0e10cSrcweir     sal_Bool                    m_bIsCurrentValueValid      : 1;    // flag specifying whether our current value is valid, relative to our external validator
679cdf0e10cSrcweir     sal_Bool                    m_bBindingControlsRO        : 1;    // is our ReadOnly property currently controlled by our external binding?
680cdf0e10cSrcweir     sal_Bool                    m_bBindingControlsEnable    : 1;    // is our Enabled property currently controlled by our external binding?
681cdf0e10cSrcweir 
682cdf0e10cSrcweir     ValueChangeInstigator       m_eControlValueChangeInstigator;
683cdf0e10cSrcweir 
684cdf0e10cSrcweir protected:
685cdf0e10cSrcweir 	::rtl::OUString					    m_aLabelServiceName;
686cdf0e10cSrcweir 		// when setting the label for our control (property FM_PROP_CONTROLLABEL, member m_xLabelControl),
687cdf0e10cSrcweir 		// we accept only objects supporting an XControlModel interface, an XServiceInfo interface and
688cdf0e10cSrcweir 		// support for a service (XServiceInfo::supportsService) determined by this string.
689cdf0e10cSrcweir 		// Any other arguments will throw an IllegalArgumentException.
690cdf0e10cSrcweir 		// The default value is FM_COMPONENT_FIXEDTEXT.
691cdf0e10cSrcweir 
692cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >
693cdf0e10cSrcweir                                         m_xCursor;
694cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate >
695cdf0e10cSrcweir                                         m_xColumnUpdate;
696cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >
697cdf0e10cSrcweir                                         m_xColumn;
698cdf0e10cSrcweir 
699cdf0e10cSrcweir protected:
700cdf0e10cSrcweir     inline const ::rtl::OUString&   getValuePropertyName( ) const       { return m_sValuePropertyName; }
701cdf0e10cSrcweir     inline sal_Int32                getValuePropertyAggHandle( ) const  { return m_nValuePropertyAggregateHandle; }
702cdf0e10cSrcweir     inline const ::rtl::OUString&   getControlSource( ) const           { return m_aControlSource; }
703cdf0e10cSrcweir     inline sal_Bool                 isRequired() const                  { return m_bRequired; }
704cdf0e10cSrcweir     inline sal_Bool                 isLoaded() const                    { return m_bLoaded; }
705cdf0e10cSrcweir 
706cdf0e10cSrcweir protected:
707cdf0e10cSrcweir 
708cdf0e10cSrcweir 	OBoundControlModel(
709cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rFactory,
710cdf0e10cSrcweir                                                             // factory to create the aggregate with
711cdf0e10cSrcweir 		const ::rtl::OUString& _rUnoControlModelTypeName,	// service name of te model to aggregate
712cdf0e10cSrcweir 		const ::rtl::OUString& _rDefault,					// service name of the default control
713cdf0e10cSrcweir 		const sal_Bool _bCommitable,						// is the control (model) commitable ?
714cdf0e10cSrcweir         const sal_Bool _bSupportExternalBinding,            // set to sal_True if you want to support XBindableValue
715cdf0e10cSrcweir         const sal_Bool _bSupportsValidation                 // set to sal_True if you want to support XValidatable
716cdf0e10cSrcweir 	);
717cdf0e10cSrcweir 	OBoundControlModel(
718cdf0e10cSrcweir 		const OBoundControlModel* _pOriginal,				// the original object to clone
719cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rFactory
720cdf0e10cSrcweir                                                             // factory to create the aggregate with
721cdf0e10cSrcweir 	);
722cdf0e10cSrcweir 	virtual ~OBoundControlModel();
723cdf0e10cSrcweir 
724cdf0e10cSrcweir     /// late ctor after cloning
725cdf0e10cSrcweir     virtual void clonedFrom( const OControlModel* _pOriginal );
726cdf0e10cSrcweir 
727cdf0e10cSrcweir     /** initializes the part of the class which is related to the control value.
728cdf0e10cSrcweir 
729cdf0e10cSrcweir         <p>Kind of late ctor, to be called for derivees which have a dedicated value property.<br/>
730cdf0e10cSrcweir         The value property is the property which's value is synced with either the database
731cdf0e10cSrcweir         column the object is bound to, or with the external value binding, if present.<br/>
732cdf0e10cSrcweir         E.g. for a text control model, this property will most probably be "Text".</p>
733cdf0e10cSrcweir 
734cdf0e10cSrcweir         <p>Derived classes are stronly recommend to call this method - at least the
735cdf0e10cSrcweir         "DataFieldProperty" (exposed in getFastPropertyValue) relies on the information
736cdf0e10cSrcweir         given herein, and needs to be supplied otherwise else.</p>
737cdf0e10cSrcweir 
738cdf0e10cSrcweir         <p>If this method has been called properly, then <member>setControlValue</member>
739cdf0e10cSrcweir         does not need to be overridden - it will simply set the property value at the
740cdf0e10cSrcweir         aggregate then.</p>
741cdf0e10cSrcweir 
742cdf0e10cSrcweir         @precond
743cdf0e10cSrcweir             The method has not be called before during the life time of the object.
744cdf0e10cSrcweir 
745cdf0e10cSrcweir         @param _rValuePropertyName
746cdf0e10cSrcweir             the name of the value property
747cdf0e10cSrcweir         @param _nValuePropertyExternalHandle
748cdf0e10cSrcweir             the handle of the property, as exposed to external components.<br/>
749cdf0e10cSrcweir             Normally, this information can be obtained dynamically (e.g. from describeFixedProperties),
750cdf0e10cSrcweir             but since this method is to be called from within the constructor of derived classes,
751cdf0e10cSrcweir             we prefer to be on the *really* safe side here ....
752cdf0e10cSrcweir 
753cdf0e10cSrcweir         @see setControlValue
754cdf0e10cSrcweir         @see suspendValueListening
755cdf0e10cSrcweir         @see resumeValueListening
756cdf0e10cSrcweir         @see describeFixedProperties
757cdf0e10cSrcweir     */
758cdf0e10cSrcweir     void                    initValueProperty(
759cdf0e10cSrcweir                                 const ::rtl::OUString& _rValuePropertyName,
760cdf0e10cSrcweir                                 sal_Int32 _nValuePropertyExternalHandle
761cdf0e10cSrcweir                             );
762cdf0e10cSrcweir 
763cdf0e10cSrcweir     /** initializes the part of the class which is related to the control value.
764cdf0e10cSrcweir 
765cdf0e10cSrcweir         <p>In opposite to ->initValueProperty, this method is to be used for value properties which are <em>not</em>
766cdf0e10cSrcweir         implemented by our aggregate, but by ourselves.</p>
767cdf0e10cSrcweir 
768cdf0e10cSrcweir         <p>Certain functionality is not available when using own value properties. This includes binding to an external
769cdf0e10cSrcweir         value and external validation. (This is not a conceptual limit, but simply missing implementation.)</p>
770cdf0e10cSrcweir     */
771cdf0e10cSrcweir     void                    initOwnValueProperty(
772cdf0e10cSrcweir                                 const ::rtl::OUString& i_rValuePropertyName
773cdf0e10cSrcweir                             );
774cdf0e10cSrcweir 
775cdf0e10cSrcweir     /** suspends listening at the value property
776cdf0e10cSrcweir 
777cdf0e10cSrcweir         <p>As long as this listening is suspended, changes in the value property will not be
778cdf0e10cSrcweir         recognized and not be handled.</p>
779cdf0e10cSrcweir 
780cdf0e10cSrcweir         @see initValueProperty
781cdf0e10cSrcweir         @see resumeValueListening
782cdf0e10cSrcweir     */
783cdf0e10cSrcweir     void                    suspendValueListening( );
784cdf0e10cSrcweir 
785cdf0e10cSrcweir     /** resumes listening at the value property
786cdf0e10cSrcweir 
787cdf0e10cSrcweir         <p>As long as this listening is suspended, changes in the value property will not be
788cdf0e10cSrcweir         recognized and not be handled.</p>
789cdf0e10cSrcweir 
790cdf0e10cSrcweir         @precond
791cdf0e10cSrcweir             listening at the value property is currently suspended
792cdf0e10cSrcweir 
793cdf0e10cSrcweir         @see initValueProperty
794cdf0e10cSrcweir         @see resumeValueListening
795cdf0e10cSrcweir     */
796cdf0e10cSrcweir     void                    resumeValueListening( );
797cdf0e10cSrcweir 
798cdf0e10cSrcweir     /** (to be) called when the value property changed
799cdf0e10cSrcweir 
800cdf0e10cSrcweir         Normally, this is done automatically, since the value property is a property of our aggregate, and we're
801cdf0e10cSrcweir         a listener at this property.
802cdf0e10cSrcweir         However, in some cases the value property might not be an aggregate property, but a property of the
803cdf0e10cSrcweir         delegator instance. In this case, you'll need to call <code>onValuePropertyChange</code> whenever this
804cdf0e10cSrcweir         property changes.
805cdf0e10cSrcweir     */
806cdf0e10cSrcweir     void                    onValuePropertyChange( ControlModelLock& i_rControLock );
807cdf0e10cSrcweir 
808cdf0e10cSrcweir     /** starts listening at the aggregate, for changes in the given property
809cdf0e10cSrcweir 
810cdf0e10cSrcweir         <p>The OBoundControlModel automatically registers a multiplexer which listens for
811cdf0e10cSrcweir         changes in the aggregate property values. By default, only the control value property
812cdf0e10cSrcweir         is observed. You may add additional properties to be observed with this method.</p>
813cdf0e10cSrcweir 
814cdf0e10cSrcweir         @see initValueProperty
815cdf0e10cSrcweir         @see _propertyChanged
816cdf0e10cSrcweir     */
817cdf0e10cSrcweir     void                    startAggregatePropertyListening( const ::rtl::OUString& _rPropertyName );
818cdf0e10cSrcweir 
819cdf0e10cSrcweir     /** returns the default which should be used when resetting the control
820cdf0e10cSrcweir 
821cdf0e10cSrcweir         <p>The default implementation returns an empty Any.</p>
822cdf0e10cSrcweir 
823cdf0e10cSrcweir         @see resetNoBroadcast
824cdf0e10cSrcweir     */
825cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any
826cdf0e10cSrcweir                             getDefaultForReset() const;
827cdf0e10cSrcweir 
828cdf0e10cSrcweir     /** translates a db column value into a control value.
829cdf0e10cSrcweir 
830cdf0e10cSrcweir         <p>Must transform the very current value of the database column we're bound to
831cdf0e10cSrcweir         (<member>m_xColumn</member>) into a value which can be used as current value
832cdf0e10cSrcweir         for the control.</p>
833cdf0e10cSrcweir 
834cdf0e10cSrcweir         @see setControlValue
835cdf0e10cSrcweir         @pure
836cdf0e10cSrcweir     */
837cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any
838cdf0e10cSrcweir                             translateDbColumnToControlValue( ) = 0;
839cdf0e10cSrcweir 
840cdf0e10cSrcweir     /** returns the data types which the control could use to exchange data with
841cdf0e10cSrcweir         an external value binding
842cdf0e10cSrcweir 
843cdf0e10cSrcweir         The types returned here are completely independent from the concrete value binding,
844cdf0e10cSrcweir         they're just candidates which depend on the control type, and possible the concrete state
845cdf0e10cSrcweir         of the control (i.e. some property value).
846cdf0e10cSrcweir 
847cdf0e10cSrcweir         If a control implementation supports multiple types, the ordering in the returned
848cdf0e10cSrcweir         sequence indicates preference: Preferred types are mentioned first.
849cdf0e10cSrcweir 
850cdf0e10cSrcweir         The default implementation returns the type of our value property.
851cdf0e10cSrcweir     */
852cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
853cdf0e10cSrcweir                             getSupportedBindingTypes();
854cdf0e10cSrcweir 
855cdf0e10cSrcweir     /** translates the given value, which was obtained from the current external value binding,
856cdf0e10cSrcweir         to a value which can be used in setControlValue
857cdf0e10cSrcweir 
858cdf0e10cSrcweir         <p>The default implementation returns the value itself, exception when it is VOID, and
859cdf0e10cSrcweir         our value property is not allowed to be void - in this case, the returned value is a
860cdf0e10cSrcweir         default-constructed value of the type required by our value property.
861cdf0e10cSrcweir 
862cdf0e10cSrcweir         @see hasExternalValueBinding
863cdf0e10cSrcweir         @see getExternalValueType
864cdf0e10cSrcweir     */
865cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any
866cdf0e10cSrcweir                             translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const;
867cdf0e10cSrcweir 
868cdf0e10cSrcweir     /** commits the current control value to our external value binding
869cdf0e10cSrcweir 
870cdf0e10cSrcweir         <p>The default implementation simply calls getControlValue.</p>
871cdf0e10cSrcweir 
872cdf0e10cSrcweir         @see hasExternalValueBinding
873cdf0e10cSrcweir         @see initValueProperty
874cdf0e10cSrcweir     */
875cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any
876cdf0e10cSrcweir                             translateControlValueToExternalValue( ) const;
877cdf0e10cSrcweir 
878cdf0e10cSrcweir     /** commits the current control value to the database column we're bound to
879cdf0e10cSrcweir         @precond
880cdf0e10cSrcweir             we're properly bound to a database column, especially <member>m_xColumnUpdate</member>
881cdf0e10cSrcweir             is not <NULL/>
882cdf0e10cSrcweir         @param _bPostReset
883cdf0e10cSrcweir             <TRUE/> if and only if the current control value results from a reset (<member>getDefaultForReset</member>)
884cdf0e10cSrcweir         @pure
885cdf0e10cSrcweir     */
886cdf0e10cSrcweir     virtual sal_Bool        commitControlValueToDbColumn(
887cdf0e10cSrcweir                                 bool _bPostReset
888cdf0e10cSrcweir                             ) = 0;
889cdf0e10cSrcweir 
890cdf0e10cSrcweir     /** sets the given value as new current value for the control
891cdf0e10cSrcweir 
892cdf0e10cSrcweir         Besides some administrative work (such as caring for <member>m_eControlValueChangeInstigator</member>),
893cdf0e10cSrcweir         this method simply calls <member>doSetControlValue</member>.
894cdf0e10cSrcweir 
895cdf0e10cSrcweir         @precond
896cdf0e10cSrcweir             Our own mutex is locked.
897cdf0e10cSrcweir         @param _rValue
898cdf0e10cSrcweir             The value to set. This value is guaranteed to be created by
899cdf0e10cSrcweir             <member>translateDbColumnToControlValue</member> or
900cdf0e10cSrcweir             <member>translateExternalValueToControlValue</member>
901cdf0e10cSrcweir         @param _eInstigator
902cdf0e10cSrcweir             the instigator of the value change
903cdf0e10cSrcweir     */
904cdf0e10cSrcweir             void            setControlValue(
905cdf0e10cSrcweir                                 const ::com::sun::star::uno::Any& _rValue,
906cdf0e10cSrcweir                                 ValueChangeInstigator _eInstigator
907cdf0e10cSrcweir                             );
908cdf0e10cSrcweir     /**
909cdf0e10cSrcweir         <p>The default implementation will forward the given value to the aggregate, using
910cdf0e10cSrcweir         m_nValuePropertyAggregateHandle and/or m_sValuePropertyName.</p>
911cdf0e10cSrcweir 
912cdf0e10cSrcweir         @precond
913cdf0e10cSrcweir             Our own mutex is locked.
914cdf0e10cSrcweir         @param _rValue
915cdf0e10cSrcweir             The value to set. This value is guaranteed to be created by
916cdf0e10cSrcweir             <member>translateDbColumnToControlValue</member> or
917cdf0e10cSrcweir             <member>translateExternalValueToControlValue</member>
918cdf0e10cSrcweir     */
919cdf0e10cSrcweir     virtual void            doSetControlValue(
920cdf0e10cSrcweir                                 const ::com::sun::star::uno::Any& _rValue
921cdf0e10cSrcweir                             );
922cdf0e10cSrcweir 
923cdf0e10cSrcweir     /** retrieves the current value of the control
924cdf0e10cSrcweir 
925cdf0e10cSrcweir         <p>The default implementation will ask the aggregate for the property value
926cdf0e10cSrcweir         determined by either m_nValuePropertyAggregateHandle and/or m_sValuePropertyName.</p>
927cdf0e10cSrcweir 
928cdf0e10cSrcweir         @precond
929cdf0e10cSrcweir             Our own mutex is locked.
930cdf0e10cSrcweir     */
931cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any
932cdf0e10cSrcweir                             getControlValue( ) const;
933cdf0e10cSrcweir 
934cdf0e10cSrcweir     /** called whenever a connection to a database column has been established
935cdf0e10cSrcweir     */
936cdf0e10cSrcweir 	virtual void            onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
937cdf0e10cSrcweir     /** called whenever a connection to a database column has been suspended
938cdf0e10cSrcweir     */
939cdf0e10cSrcweir 	virtual void            onDisconnectedDbColumn();
940cdf0e10cSrcweir 
941cdf0e10cSrcweir     /** called whenever a connection to an external supplier of values (XValueBinding) has been established
942cdf0e10cSrcweir         @see m_xExternalBinding
943cdf0e10cSrcweir     */
944cdf0e10cSrcweir 	virtual void            onConnectedExternalValue( );
945cdf0e10cSrcweir     /** called whenever a connection to an external supplier of values (XValueBinding) has been suspended
946cdf0e10cSrcweir     */
947cdf0e10cSrcweir 	virtual void            onDisconnectedExternalValue();
948cdf0e10cSrcweir 
949cdf0e10cSrcweir     /** called whenever an external validator has been registered
950cdf0e10cSrcweir     */
951cdf0e10cSrcweir 	virtual void            onConnectedValidator( );
952cdf0e10cSrcweir     /** called whenever an external validator has been revoked
953cdf0e10cSrcweir     */
954cdf0e10cSrcweir 	virtual void            onDisconnectedValidator( );
955cdf0e10cSrcweir 
956cdf0e10cSrcweir 	/**	nFieldType ist der Typ des Feldes, an das das Model gebunden werden soll.
957cdf0e10cSrcweir 		Das Binden erfolgt genau dann, wenn Rueckgabewert sal_True.
958cdf0e10cSrcweir 		Die Standard-Implementation erlaubt alles ausser den drei binary-Typen und
959cdf0e10cSrcweir 		FieldType_OTHER.
960cdf0e10cSrcweir 	*/
961cdf0e10cSrcweir 	virtual sal_Bool		approveDbColumnType(sal_Int32 _nColumnType);
962cdf0e10cSrcweir 
963cdf0e10cSrcweir     /** retrieves the current value of the control, in a shape which can be used with our
964cdf0e10cSrcweir         external validator.
965cdf0e10cSrcweir 
966cdf0e10cSrcweir         The default implementation simply calls <member>>translateControlValueToExternalValue</member>.
967cdf0e10cSrcweir 
968cdf0e10cSrcweir         @precond
969cdf0e10cSrcweir             Our own mutex is locked.
970cdf0e10cSrcweir     */
971cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any
972cdf0e10cSrcweir                             translateControlValueToValidatableValue( ) const;
973cdf0e10cSrcweir 
974cdf0e10cSrcweir     /** retrieves the current value of the form component
975cdf0e10cSrcweir 
976cdf0e10cSrcweir         This is the implementation method for XValidatableFormComponent::getCurrentValue. The default implementation
977cdf0e10cSrcweir         calls translateControlValueToValidatableValue if a validator is present, otherwise getControlValue.
978cdf0e10cSrcweir 
979cdf0e10cSrcweir         @precond
980cdf0e10cSrcweir             our mutex is locked when this method is called
981cdf0e10cSrcweir     */
982cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any
983cdf0e10cSrcweir                             getCurrentFormComponentValue() const;
984cdf0e10cSrcweir 
985cdf0e10cSrcweir 	/** We can't write (new) common properties in this base class, as the file format doesn't allow this
986cdf0e10cSrcweir 	    (unfortunally). So derived classes may use the following to methods. They secure the written
987cdf0e10cSrcweir 	    data with marks, so any new common properties in newer versions will be skipped by older ones.
988cdf0e10cSrcweir     */
989cdf0e10cSrcweir 	void	writeCommonProperties(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream);
990cdf0e10cSrcweir 	void	readCommonProperties(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream);
991cdf0e10cSrcweir 	// the next method may be used in derived classes's read when an unknown version is encountered
992cdf0e10cSrcweir 	void	defaultCommonProperties();
993cdf0e10cSrcweir 
994cdf0e10cSrcweir     /** called to reset the control to some kind of default.
995cdf0e10cSrcweir 
996cdf0e10cSrcweir         <p>The semantics of "default" is finally defined by the derived class (in particular,
997cdf0e10cSrcweir         by <member>getDefaultForReset</member>).</p>
998cdf0e10cSrcweir 
999cdf0e10cSrcweir         <p>No listener notification needs to be done in the derived class.</p>
1000cdf0e10cSrcweir 
1001cdf0e10cSrcweir         <p>Normally, you won't override this method, but <member>getDefaultForReset</member> instead.</p>
1002cdf0e10cSrcweir 
1003cdf0e10cSrcweir         @see getDefaultForReset
1004cdf0e10cSrcweir     */
1005cdf0e10cSrcweir 	virtual void            resetNoBroadcast();
1006cdf0e10cSrcweir 
1007cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type>	_getTypes();
1008cdf0e10cSrcweir 
1009cdf0e10cSrcweir     /// sets m_xField to the given new value, without notifying our listeners
1010cdf0e10cSrcweir 	void    impl_setField_noNotify(
1011cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxField
1012cdf0e10cSrcweir             );
1013cdf0e10cSrcweir     inline bool hasField() const
1014cdf0e10cSrcweir     {
1015cdf0e10cSrcweir         return m_xField.is();
1016cdf0e10cSrcweir     }
1017cdf0e10cSrcweir     inline sal_Int32 getFieldType() const
1018cdf0e10cSrcweir     {
1019cdf0e10cSrcweir         return m_nFieldType;
1020cdf0e10cSrcweir     }
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir     // OControlModel's property handling
1023cdf0e10cSrcweir 	virtual void describeFixedProperties(
1024cdf0e10cSrcweir 		::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
1025cdf0e10cSrcweir     ) const;
1026cdf0e10cSrcweir 
1027cdf0e10cSrcweir public:
1028cdf0e10cSrcweir 	inline const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& getField() const
1029cdf0e10cSrcweir 	{
1030cdf0e10cSrcweir 		return m_xField;
1031cdf0e10cSrcweir 	}
1032cdf0e10cSrcweir 
1033cdf0e10cSrcweir public:
1034cdf0e10cSrcweir 	// UNO Anbindung
1035cdf0e10cSrcweir 	DECLARE_UNO3_AGG_DEFAULTS(OBoundControlModel, OControlModel);
1036cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
1037cdf0e10cSrcweir 
1038cdf0e10cSrcweir     // OComponentHelper
1039cdf0e10cSrcweir 	virtual void SAL_CALL disposing();
1040cdf0e10cSrcweir 
1041cdf0e10cSrcweir     // XReset
1042cdf0e10cSrcweir     virtual void SAL_CALL reset(  ) throw(::com::sun::star::uno::RuntimeException);
1043cdf0e10cSrcweir     virtual void SAL_CALL addResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
1044cdf0e10cSrcweir     virtual void SAL_CALL removeResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
1045cdf0e10cSrcweir 
1046cdf0e10cSrcweir     // XServiceInfo
1047cdf0e10cSrcweir     virtual StringSequence SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
1048cdf0e10cSrcweir 
1049cdf0e10cSrcweir     // XServiceInfo - static version
1050cdf0e10cSrcweir 	static  StringSequence SAL_CALL	getSupportedServiceNames_Static() throw(::com::sun::star::uno::RuntimeException);
1051cdf0e10cSrcweir 
1052cdf0e10cSrcweir     // XChild
1053cdf0e10cSrcweir     virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
1054cdf0e10cSrcweir 
1055cdf0e10cSrcweir     // XPersistObject
1056cdf0e10cSrcweir     virtual void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
1057cdf0e10cSrcweir     virtual void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
1058cdf0e10cSrcweir 
1059cdf0e10cSrcweir     // XBoundComponent
1060cdf0e10cSrcweir     virtual sal_Bool SAL_CALL commit() throw(::com::sun::star::uno::RuntimeException);
1061cdf0e10cSrcweir 
1062cdf0e10cSrcweir     // XUpdateBroadcaster (base of XBoundComponent)
1063cdf0e10cSrcweir     virtual void SAL_CALL addUpdateListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
1064cdf0e10cSrcweir     virtual void SAL_CALL removeUpdateListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
1065cdf0e10cSrcweir 
1066cdf0e10cSrcweir     // XPropertySet
1067cdf0e10cSrcweir 	virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const;
1068cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL convertFastPropertyValue(
1069cdf0e10cSrcweir 				::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue )
1070cdf0e10cSrcweir 				throw (::com::sun::star::lang::IllegalArgumentException);
1071cdf0e10cSrcweir 	virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
1072cdf0e10cSrcweir 				throw (::com::sun::star::uno::Exception);
1073cdf0e10cSrcweir     using ::cppu::OPropertySetHelper::getFastPropertyValue;
1074cdf0e10cSrcweir 
1075cdf0e10cSrcweir // ::com::sun::star::beans::XPropertyState
1076cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const;
1077cdf0e10cSrcweir 
1078cdf0e10cSrcweir // XEventListener
1079cdf0e10cSrcweir 	virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException);
1080cdf0e10cSrcweir 
1081cdf0e10cSrcweir // XPropertyChangeListener
1082cdf0e10cSrcweir     virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException);
1083cdf0e10cSrcweir 
1084cdf0e10cSrcweir     // XRowSetChangeListener
1085cdf0e10cSrcweir     virtual void SAL_CALL onRowSetChanged( const ::com::sun::star::lang::EventObject& i_Event ) throw (::com::sun::star::uno::RuntimeException);
1086cdf0e10cSrcweir 
1087cdf0e10cSrcweir // XLoadListener
1088cdf0e10cSrcweir     virtual void SAL_CALL loaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
1089cdf0e10cSrcweir     virtual void SAL_CALL unloading( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
1090cdf0e10cSrcweir     virtual void SAL_CALL unloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
1091cdf0e10cSrcweir     virtual void SAL_CALL reloading( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
1092cdf0e10cSrcweir     virtual void SAL_CALL reloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
1093cdf0e10cSrcweir 
1094cdf0e10cSrcweir private:
1095cdf0e10cSrcweir     // XBindableValue
1096cdf0e10cSrcweir     virtual void SAL_CALL setValueBinding( const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding ) throw (::com::sun::star::form::binding::IncompatibleTypesException, ::com::sun::star::uno::RuntimeException);
1097cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding > SAL_CALL getValueBinding(  ) throw (::com::sun::star::uno::RuntimeException);
1098cdf0e10cSrcweir 
1099cdf0e10cSrcweir     // XModifyListener
1100cdf0e10cSrcweir     virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
1101cdf0e10cSrcweir 
1102cdf0e10cSrcweir     // XValidatable
1103cdf0e10cSrcweir     virtual void SAL_CALL setValidator( const ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XValidator >& Validator ) throw (::com::sun::star::util::VetoException, ::com::sun::star::uno::RuntimeException);
1104cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XValidator > SAL_CALL getValidator(  ) throw (::com::sun::star::uno::RuntimeException);
1105cdf0e10cSrcweir 
1106cdf0e10cSrcweir     // XValidityConstraintListener
1107cdf0e10cSrcweir     virtual void SAL_CALL validityConstraintChanged( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
1108cdf0e10cSrcweir 
1109cdf0e10cSrcweir     // XValidatableFormComponent
1110cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isValid(  ) throw (::com::sun::star::uno::RuntimeException);
1111cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue(  ) throw (::com::sun::star::uno::RuntimeException);
1112cdf0e10cSrcweir     virtual void SAL_CALL addFormComponentValidityListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XFormComponentValidityListener >& Listener ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
1113cdf0e10cSrcweir     virtual void SAL_CALL removeFormComponentValidityListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XFormComponentValidityListener >& Listener ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
1114cdf0e10cSrcweir 
1115cdf0e10cSrcweir protected:
1116cdf0e10cSrcweir     // OPropertyChangeListener
1117cdf0e10cSrcweir 	virtual void
1118cdf0e10cSrcweir                 _propertyChanged( const ::com::sun::star::beans::PropertyChangeEvent& _rEvt ) throw ( ::com::sun::star::uno::RuntimeException );
1119cdf0e10cSrcweir 
1120cdf0e10cSrcweir     /// checks whether we currently have an external value binding in place
1121cdf0e10cSrcweir     inline  bool    hasExternalValueBinding() const { return m_xExternalBinding.is(); }
1122cdf0e10cSrcweir 
1123cdf0e10cSrcweir     // checks whether we currently have an external validator
1124cdf0e10cSrcweir     inline  bool    hasValidator() const { return m_xValidator.is(); }
1125cdf0e10cSrcweir 
1126cdf0e10cSrcweir     /** transfers the very current value of the db column we're bound to the control
1127cdf0e10cSrcweir         @precond
1128cdf0e10cSrcweir             our own mutex is locked
1129cdf0e10cSrcweir         @precond
1130cdf0e10cSrcweir             we don't have an external binding in place
1131cdf0e10cSrcweir     */
1132cdf0e10cSrcweir     void        transferDbValueToControl( );
1133cdf0e10cSrcweir 
1134cdf0e10cSrcweir     /** transfers the current value of the active external binding to the control
1135cdf0e10cSrcweir         @precond
1136cdf0e10cSrcweir             we do have an active external binding in place
1137cdf0e10cSrcweir     */
1138cdf0e10cSrcweir     void        transferExternalValueToControl( ControlModelLock& _rInstanceLock );
1139cdf0e10cSrcweir 
1140cdf0e10cSrcweir     /** transfers the control value to the external binding
1141cdf0e10cSrcweir         @precond
1142cdf0e10cSrcweir             our own mutex is locked, and _rInstanceLock is the guard locking it
1143cdf0e10cSrcweir         @precond
1144cdf0e10cSrcweir             we do have an active external binding in place
1145cdf0e10cSrcweir     */
1146cdf0e10cSrcweir     void        transferControlValueToExternal( ControlModelLock& _rInstanceLock );
1147cdf0e10cSrcweir 
1148cdf0e10cSrcweir     /** calculates the type which is to be used to communicate with the current external binding,
1149cdf0e10cSrcweir         and stores it in m_aExternalValueType
1150cdf0e10cSrcweir 
1151cdf0e10cSrcweir         The method checks the possible type candidates as returned by getSupportedBindingTypes,
1152cdf0e10cSrcweir         and the types supported by the current external binding, if any.
1153cdf0e10cSrcweir     */
1154cdf0e10cSrcweir     void        calculateExternalValueType();
1155cdf0e10cSrcweir 
1156cdf0e10cSrcweir     /** returns the type which should be used to exchange data with our external value binding
1157cdf0e10cSrcweir 
1158cdf0e10cSrcweir         @see initValueProperty
1159cdf0e10cSrcweir     */
1160cdf0e10cSrcweir     const ::com::sun::star::uno::Type&
1161cdf0e10cSrcweir                 getExternalValueType() const { return m_aExternalValueType; }
1162cdf0e10cSrcweir 
1163cdf0e10cSrcweir     /** initializes the control from m_xField
1164cdf0e10cSrcweir 
1165cdf0e10cSrcweir         Basically, this method calls transferDbValueToControl - but only if our cursor is positioned
1166cdf0e10cSrcweir         on a valid row. Otherwise, the control is reset.
1167cdf0e10cSrcweir 
1168cdf0e10cSrcweir         @precond
1169cdf0e10cSrcweir             m_xField is not <NULL/>
1170cdf0e10cSrcweir     */
1171cdf0e10cSrcweir     void        initFromField( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxForm );
1172cdf0e10cSrcweir 
1173cdf0e10cSrcweir private:
1174cdf0e10cSrcweir 	sal_Bool    connectToField( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxForm );
1175cdf0e10cSrcweir 	void        resetField();
1176cdf0e10cSrcweir 
1177cdf0e10cSrcweir     /** does a new validation of the control value
1178cdf0e10cSrcweir 
1179cdf0e10cSrcweir         If necessary, our <member>m_bIsCurrentValueValid</member> member will be adjusted,
1180cdf0e10cSrcweir         and changes will be notified.
1181cdf0e10cSrcweir 
1182cdf0e10cSrcweir         Note that it's not necessary that we're connected to a validator. If we are not,
1183cdf0e10cSrcweir         it's assumed that our value is valid, and this is handled appropriately.
1184cdf0e10cSrcweir 
1185cdf0e10cSrcweir         Use this method if there is a potential that <b>only</b> the validity flag changed. If
1186cdf0e10cSrcweir         any of the other aspects (our current value, or our current text) changed, then
1187cdf0e10cSrcweir         pass <TRUE/> for <member>_bForceNotification</member>.
1188cdf0e10cSrcweir 
1189cdf0e10cSrcweir         @param _bForceNotification
1190cdf0e10cSrcweir             if <TRUE/>, then the validity listeners will be notified, not matter whether the validity
1191cdf0e10cSrcweir             changed.
1192cdf0e10cSrcweir     */
1193cdf0e10cSrcweir     void        recheckValidity( bool _bForceNotification );
1194cdf0e10cSrcweir 
1195cdf0e10cSrcweir     /// initializes m_pAggPropMultiplexer
1196cdf0e10cSrcweir     void        implInitAggMultiplexer( );
1197cdf0e10cSrcweir 
1198cdf0e10cSrcweir     /// initializes listening at the value property
1199cdf0e10cSrcweir     void        implInitValuePropertyListening( ) const;
1200cdf0e10cSrcweir 
1201cdf0e10cSrcweir     /** adds or removes the component as load listener to/from our form, and (if necessary) as RowSetChange listener at
1202cdf0e10cSrcweir         our parent.
1203cdf0e10cSrcweir 
1204cdf0e10cSrcweir         @precond there must no external value binding be in place
1205cdf0e10cSrcweir     */
1206cdf0e10cSrcweir     void        doFormListening( const bool _bStart );
1207cdf0e10cSrcweir 
1208cdf0e10cSrcweir     inline bool isFormListening() const { return m_bFormListening; }
1209cdf0e10cSrcweir 
1210cdf0e10cSrcweir     /** determines the new value of m_xAmbientForm
1211cdf0e10cSrcweir     */
1212cdf0e10cSrcweir     void        impl_determineAmbientForm_nothrow();
1213cdf0e10cSrcweir 
1214cdf0e10cSrcweir     /** connects to a value supplier which is an database column.
1215cdf0e10cSrcweir 
1216cdf0e10cSrcweir         The column is take from our parent, which must be a database form respectively row set.
1217cdf0e10cSrcweir 
1218cdf0e10cSrcweir         @precond The control does not have an external value supplier
1219cdf0e10cSrcweir 
1220cdf0e10cSrcweir         @param _bFromReload
1221cdf0e10cSrcweir             Determines whether the connection is made after the row set has been loaded (<FALSE/>)
1222cdf0e10cSrcweir             or reloaded (<TRUE/>)
1223cdf0e10cSrcweir 
1224cdf0e10cSrcweir         @see impl_disconnectDatabaseColumn_noNotify
1225cdf0e10cSrcweir     */
1226cdf0e10cSrcweir     void        impl_connectDatabaseColumn_noNotify(
1227cdf0e10cSrcweir                     bool  _bFromReload
1228cdf0e10cSrcweir                 );
1229cdf0e10cSrcweir 
1230cdf0e10cSrcweir     /** disconnects from a value supplier which is an database column
1231cdf0e10cSrcweir 
1232cdf0e10cSrcweir         @precond The control does not have an external value supplier
1233cdf0e10cSrcweir         @see impl_connectDatabaseColumn_noNotify
1234cdf0e10cSrcweir     */
1235cdf0e10cSrcweir     void        impl_disconnectDatabaseColumn_noNotify();
1236cdf0e10cSrcweir 
1237cdf0e10cSrcweir     /** connects to an external value binding
1238cdf0e10cSrcweir 
1239cdf0e10cSrcweir         <p>Note that by definition, external data bindings superseede the SQL data binding which
1240cdf0e10cSrcweir         is defined by our RowSet-column-related properties. This means that in case we're currently
1241cdf0e10cSrcweir         connected to a database column when this is called, this connection is suspended.</p>
1242cdf0e10cSrcweir 
1243cdf0e10cSrcweir         @precond
1244cdf0e10cSrcweir                 the new external binding has already been approved (see <member>impl_approveValueBinding_nolock</member>)
1245cdf0e10cSrcweir         @precond
1246cdf0e10cSrcweir                 there currently is no external binding in place
1247cdf0e10cSrcweir     */
1248cdf0e10cSrcweir     void        connectExternalValueBinding(
1249cdf0e10cSrcweir                     const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding,
1250cdf0e10cSrcweir                     ControlModelLock& _rInstanceLock
1251cdf0e10cSrcweir                 );
1252cdf0e10cSrcweir 
1253cdf0e10cSrcweir     /** disconnects from an external value binding
1254cdf0e10cSrcweir 
1255cdf0e10cSrcweir         @precond
1256cdf0e10cSrcweir                 there currently is an external binding in place
1257cdf0e10cSrcweir     */
1258cdf0e10cSrcweir     void        disconnectExternalValueBinding( );
1259cdf0e10cSrcweir 
1260cdf0e10cSrcweir     /** connects the component to an external validator
1261cdf0e10cSrcweir 
1262cdf0e10cSrcweir         @precond
1263cdf0e10cSrcweir             there currently is no active validator
1264cdf0e10cSrcweir         @precond
1265cdf0e10cSrcweir             our mutex is currently locked exactly once
1266cdf0e10cSrcweir     */
1267cdf0e10cSrcweir     void        connectValidator(
1268cdf0e10cSrcweir                     const ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XValidator >& _rxValidator
1269cdf0e10cSrcweir                 );
1270cdf0e10cSrcweir 
1271cdf0e10cSrcweir     /** disconnects the component from it's current an external validator
1272cdf0e10cSrcweir 
1273cdf0e10cSrcweir         @precond
1274cdf0e10cSrcweir             there currently is an active validator
1275cdf0e10cSrcweir         @precond
1276cdf0e10cSrcweir             our mutex is currently locked exactly once
1277cdf0e10cSrcweir     */
1278cdf0e10cSrcweir     void        disconnectValidator( );
1279cdf0e10cSrcweir 
1280cdf0e10cSrcweir     /** called from within <member scope="com::sun::star:::form::binding">XBindableValue::setValueBinding</member>
1281cdf0e10cSrcweir         to approve the new binding
1282cdf0e10cSrcweir 
1283cdf0e10cSrcweir         The default implementation approves the binding if and only if it is not <NULL/>, and supports
1284cdf0e10cSrcweir         the type returned by getExternalValueType.
1285cdf0e10cSrcweir 
1286cdf0e10cSrcweir         @param _rxBinding
1287cdf0e10cSrcweir             the binding which applies for being responsible for our value, Must not be
1288cdf0e10cSrcweir             <NULL/>
1289cdf0e10cSrcweir         @return
1290cdf0e10cSrcweir             <TRUE/> if and only if the given binding can supply values in the proper type
1291cdf0e10cSrcweir 
1292cdf0e10cSrcweir         @seealso getExternalValueType
1293cdf0e10cSrcweir     */
1294cdf0e10cSrcweir     sal_Bool    impl_approveValueBinding_nolock(
1295cdf0e10cSrcweir                     const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding
1296cdf0e10cSrcweir                 );
1297cdf0e10cSrcweir };
1298cdf0e10cSrcweir 
1299cdf0e10cSrcweir     //=========================================================================
1300cdf0e10cSrcweir     //= inlines
1301cdf0e10cSrcweir     //=========================================================================
1302cdf0e10cSrcweir     inline void ControlModelLock::acquire()
1303cdf0e10cSrcweir     {
1304cdf0e10cSrcweir         m_rModel.lockInstance( OControlModel::LockAccess() );
1305cdf0e10cSrcweir         m_bLocked = true;
1306cdf0e10cSrcweir     }
1307cdf0e10cSrcweir     inline void ControlModelLock::release()
1308cdf0e10cSrcweir     {
1309cdf0e10cSrcweir         OSL_ENSURE( m_bLocked, "ControlModelLock::release: not locked!" );
1310cdf0e10cSrcweir         m_bLocked = false;
1311cdf0e10cSrcweir 
1312cdf0e10cSrcweir         if ( 0 == m_rModel.unlockInstance( OControlModel::LockAccess() ) )
1313cdf0e10cSrcweir             impl_notifyAll_nothrow();
1314cdf0e10cSrcweir     }
1315cdf0e10cSrcweir 
1316cdf0e10cSrcweir //.........................................................................
1317cdf0e10cSrcweir }
1318cdf0e10cSrcweir //.........................................................................
1319cdf0e10cSrcweir 
1320cdf0e10cSrcweir #endif // _FORMS_FORMCOMPONENT_HXX_
1321cdf0e10cSrcweir 
1322