1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _FRM_DATABASEFORM_HXX_
29 #define _FRM_DATABASEFORM_HXX_
30 
31 #include "propertybaghelper.hxx"
32 #include <com/sun/star/sdbc/XDataSource.hpp>
33 #include <com/sun/star/sdb/XSQLErrorListener.hpp>
34 #include <com/sun/star/io/XPersistObject.hpp>
35 #include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
36 #include <com/sun/star/form/FormSubmitMethod.hpp>
37 #include <com/sun/star/form/FormSubmitEncoding.hpp>
38 #include <com/sun/star/form/XSubmit.hpp>
39 #include <com/sun/star/form/XReset.hpp>
40 #include <com/sun/star/form/XDatabaseParameterBroadcaster2.hpp>
41 #include <com/sun/star/sdb/XCompletedExecution.hpp>
42 #include <com/sun/star/sdbc/XRowSet.hpp>
43 #include <com/sun/star/sdbcx/XDeleteRows.hpp>
44 #include <com/sun/star/sdbc/XResultSetUpdate.hpp>
45 #include <com/sun/star/sdb/XRowSetApproveListener.hpp>
46 #include <com/sun/star/sdb/XRowSetApproveBroadcaster.hpp>
47 #include <com/sun/star/form/NavigationBarMode.hpp>
48 #include <com/sun/star/form/XLoadable.hpp>
49 #include <com/sun/star/form/XLoadListener.hpp>
50 #include <com/sun/star/form/XForm.hpp>
51 #include <com/sun/star/awt/XTabControllerModel.hpp>
52 #include <com/sun/star/script/XEventAttacherManager.hpp>
53 #include <com/sun/star/sdbc/XRowSetListener.hpp>
54 #include <com/sun/star/sdb/XResultSetAccess.hpp>
55 #include <com/sun/star/sdbc/XCloseable.hpp>
56 #include <com/sun/star/container/XNamed.hpp>
57 #include <com/sun/star/lang/XServiceInfo.hpp>
58 #include <com/sun/star/sdbc/XParameters.hpp>
59 #include <com/sun/star/sdbc/XConnection.hpp>
60 #include <com/sun/star/task/XInteractionHandler.hpp>
61 #include <com/sun/star/beans/XPropertyContainer.hpp>
62 #include <com/sun/star/beans/XPropertyAccess.hpp>
63 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
64 
65 
66 #include <tools/link.hxx>
67 #include "InterfaceContainer.hxx"
68 
69 #include <connectivity/parameters.hxx>
70 #include <connectivity/filtermanager.hxx>
71 #include <connectivity/warningscontainer.hxx>
72 
73 #ifndef FORMS_SOURCE_MISC_LISTENERCONTAINERS_HXX
74 #include "listenercontainers.hxx"
75 #endif
76 #include "ids.hxx"
77 #include <comphelper/propmultiplex.hxx>
78 #include <comphelper/uno3.hxx>
79 #include <comphelper/proparrhlp.hxx>
80 #include <cppuhelper/implbase12.hxx>
81 #include <cppuhelper/implbase4.hxx>
82 #include <cppuhelper/implbase7.hxx>
83 
84 namespace com { namespace sun { namespace star { namespace sdbc {
85 	class SQLException;
86 } } } }
87 
88 class Timer;
89 class INetMIMEMessage;
90 
91 //.........................................................................
92 namespace frm
93 {
94 //.........................................................................
95 
96 //========================================================================
97 //= html tools
98 //========================================================================
99 
100 const sal_uInt16 SUCCESSFUL_REPRESENT_TEXT			= 0x0001;
101 const sal_uInt16 SUCCESSFUL_REPRESENT_FILE			= 0x0002;
102 
103 //------------------------------------------------------------------------------
104 class HtmlSuccessfulObj
105 {
106 public:
107 	::rtl::OUString		aName;
108 	::rtl::OUString		aValue;
109 	sal_uInt16			nRepresentation;
110 
111 	HtmlSuccessfulObj( const ::rtl::OUString& _rName, const ::rtl::OUString& _rValue,
112 		sal_uInt16 _nRepresent = SUCCESSFUL_REPRESENT_TEXT )
113 		:aName( _rName )
114 		,aValue( _rValue )
115 		,nRepresentation( _nRepresent )
116 	{
117 	}
118 
119 	HtmlSuccessfulObj()
120 	{
121 	}
122 };
123 
124 
125 DECLARE_STL_VECTOR(HtmlSuccessfulObj, HtmlSuccessfulObjList);
126 
127 //========================================================================
128 class OGroupManager;
129 class OFormSubmitResetThread;
130 typedef ::cppu::ImplHelper12    <   ::com::sun::star::form::XForm
131 								,   ::com::sun::star::awt::XTabControllerModel
132 								,   ::com::sun::star::form::XLoadListener
133 								,   ::com::sun::star::sdbc::XRowSetListener
134 								,   ::com::sun::star::sdb::XRowSetApproveListener
135 								,   ::com::sun::star::form::XDatabaseParameterBroadcaster2
136 								,   ::com::sun::star::sdb::XSQLErrorListener
137 								,   ::com::sun::star::sdb::XSQLErrorBroadcaster
138 								,   ::com::sun::star::form::XReset
139 								,   ::com::sun::star::form::XSubmit
140 								,   ::com::sun::star::form::XLoadable
141                                 ,   ::com::sun::star::container::XNamed
142                                 >   ODatabaseForm_BASE1;
143 
144 
145 typedef ::cppu::ImplHelper4 <   ::com::sun::star::lang::XServiceInfo
146                             ,   ::com::sun::star::beans::XPropertyContainer
147                             ,   ::com::sun::star::beans::XPropertyAccess
148                             ,   ::com::sun::star::sdbc::XWarningsSupplier
149                             >   ODatabaseForm_BASE2;
150 
151 typedef ::cppu::ImplHelper7<	::com::sun::star::sdbc::XCloseable,
152 								::com::sun::star::sdbc::XRowSet,
153 								::com::sun::star::sdb::XCompletedExecution,
154 								::com::sun::star::sdb::XRowSetApproveBroadcaster,
155 								::com::sun::star::sdbc::XResultSetUpdate,
156 								::com::sun::star::sdbcx::XDeleteRows,
157 								::com::sun::star::sdbc::XParameters > ODatabaseForm_BASE3;
158 
159 
160 class ODatabaseForm	:public OFormComponents
161 					,public OPropertySetAggregationHelper
162 					,public OPropertyChangeListener
163 					,public ODatabaseForm_BASE1
164 					,public ODatabaseForm_BASE2
165 					,public ODatabaseForm_BASE3
166                     ,public IPropertyBagHelperContext
167 {
168 	friend class OFormSubmitResetThread;
169 
170 	OImplementationIdsRef				m_aHoldIdHelper;
171 
172 		// listener administration
173 	::cppu::OInterfaceContainerHelper	m_aLoadListeners;
174 	::cppu::OInterfaceContainerHelper	m_aRowSetApproveListeners;
175 	::cppu::OInterfaceContainerHelper	m_aRowSetListeners;
176 	::cppu::OInterfaceContainerHelper	m_aSubmitListeners;
177 	::cppu::OInterfaceContainerHelper	m_aErrorListeners;
178     ResetListeners                      m_aResetListeners;
179 	::osl::Mutex						m_aResetSafety;
180 	::com::sun::star::uno::Any			m_aCycle;
181 	::com::sun::star::uno::Any			m_aIgnoreResult; // set when we are a subform and our master form positioned on a new row
182 	::com::sun::star::uno::Sequence< ::rtl::OUString >						m_aMasterFields;
183 	::com::sun::star::uno::Sequence< ::rtl::OUString >						m_aDetailFields;
184 
185 	// the object doin' most of the work - an SDB-rowset
186 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> 		m_xAggregate;
187 	// same object, interface as member because of performance reasons
188 	::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet> 			m_xAggregateAsRowSet;
189 
190     PropertyBagHelper           m_aPropertyBagHelper;
191     ::dbtools::WarningsContainer    m_aWarnings;
192 	OPropertyChangeMultiplexer*	m_pAggregatePropertyMultiplexer;
193 	// Verwaltung der ControlGruppen
194 	OGroupManager*				m_pGroupManager;
195     ::dbtools::ParameterManager m_aParameterManager;
196     ::dbtools::FilterManager    m_aFilterManager;
197 	Timer*						m_pLoadTimer;
198 
199 	OFormSubmitResetThread*		m_pThread;
200 	::rtl::OUString				m_sCurrentErrorContext;
201 				// will be used as additional context information
202 				// when an exception is catched and forwarded to the listeners
203 
204 	sal_Int32						m_nResetsPending;
205 //	<overwritten_properties>
206 	sal_Int32					m_nPrivileges;
207     sal_Bool                    m_bInsertOnly;
208 //	</overwritten_properties>
209 
210 //	<properties>
211     ::com::sun::star::uno::Any  m_aControlBorderColorFocus;
212     ::com::sun::star::uno::Any  m_aControlBorderColorMouse;
213     ::com::sun::star::uno::Any  m_aControlBorderColorInvalid;
214     ::com::sun::star::uno::Any  m_aDynamicControlBorder;
215 	::rtl::OUString				m_sName;
216 	::rtl::OUString				m_aTargetURL;
217 	::rtl::OUString				m_aTargetFrame;
218 	::com::sun::star::form::FormSubmitMethod	m_eSubmitMethod;
219 	::com::sun::star::form::FormSubmitEncoding	m_eSubmitEncoding;
220 	::com::sun::star::form::NavigationBarMode	m_eNavigation;
221 	sal_Bool					m_bAllowInsert : 1;
222 	sal_Bool					m_bAllowUpdate : 1;
223 	sal_Bool					m_bAllowDelete : 1;
224 //	</properties>
225 	sal_Bool					m_bLoaded : 1;
226 	sal_Bool					m_bSubForm : 1;
227 	sal_Bool					m_bForwardingConnection : 1;	// sal_True if we're setting the ActiveConnection on the aggregate
228 	sal_Bool					m_bSharingConnection : 1;		// sal_True if the connection we're using is shared with out parent
229 
230 public:
231 	ODatabaseForm(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
232 	ODatabaseForm( const ODatabaseForm& _cloneSource );
233 	~ODatabaseForm();
234 
235 	// UNO binding
236 	DECLARE_UNO3_AGG_DEFAULTS(ODatabaseForm, OFormComponents);
237 	virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException);
238 
239 	// XTypeProvider
240     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
241     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
242 
243 	// ::com::sun::star::lang::XComponent
244 	virtual void SAL_CALL disposing();
245 
246 	// property handling
247     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
248 	virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
249 	virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
250 	virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException);
251 	virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception );
252 
253 	::com::sun::star::uno::Any	SAL_CALL getFastPropertyValue( sal_Int32 nHandle )
254 	   throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
255 	void fire( sal_Int32 * pnHandles, const ::com::sun::star::uno::Any * pNewValues, const ::com::sun::star::uno::Any * pOldValues, sal_Int32 nCount, sal_Bool bVetoable );
256 
257     // IPropertyBagHelperContext
258     virtual ::osl::Mutex&   getMutex();
259     virtual void            describeFixedAndAggregateProperties(
260         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _out_rFixedProperties,
261         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _out_rAggregateProperties
262     ) const;
263     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet >
264                             getPropertiesInterface();
265 
266 	// com::sun::star::beans::XPropertyState
267 	virtual	::com::sun::star::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle);
268 	virtual	void setPropertyToDefaultByHandle(sal_Int32 nHandle);
269 	virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const;
270 
271 	// com::sun::star::sdbc::XSQLErrorBroadcaster
272     virtual void SAL_CALL addSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
273     virtual void SAL_CALL removeSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
274 
275 	// com::sun::star::form::XForm
276 	// nothing to implement
277 
278 	// com::sun::star::form::XReset
279     virtual void SAL_CALL reset() throw(::com::sun::star::uno::RuntimeException);
280     virtual void SAL_CALL addResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
281     virtual void SAL_CALL removeResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
282 
283 	// com::sun::star::form::XSubmit
284     virtual void SAL_CALL submit(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& aControl, const ::com::sun::star::awt::MouseEvent& aMouseEvt) throw(::com::sun::star::uno::RuntimeException);
285     virtual void SAL_CALL addSubmitListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XSubmitListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
286     virtual void SAL_CALL removeSubmitListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XSubmitListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
287 
288 	// com::sun::star::container::XChild
289 	virtual InterfaceRef SAL_CALL getParent() throw ( ::com::sun::star::uno::RuntimeException) { return OFormComponents::getParent(); }
290 	virtual void SAL_CALL setParent(const InterfaceRef& Parent) throw ( :: com::sun::star::lang::NoSupportException , ::com::sun::star::uno::RuntimeException);
291 
292 	// com::sun::star::container::XNamed
293     virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
294     virtual void SAL_CALL setName(const ::rtl::OUString& aName) throw(::com::sun::star::uno::RuntimeException);
295 
296 	// com::sun::star::awt::XTabControllerModel
297     virtual sal_Bool SAL_CALL getGroupControl() throw(::com::sun::star::uno::RuntimeException);
298     virtual void SAL_CALL setGroupControl(sal_Bool /*_bGroupControl*/) throw(::com::sun::star::uno::RuntimeException) { }
299     virtual void SAL_CALL setControlModels(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& _rControls) throw(::com::sun::star::uno::RuntimeException);
300     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL getControlModels() throw(::com::sun::star::uno::RuntimeException);
301     virtual void SAL_CALL setGroup(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& _rGroup, const ::rtl::OUString& _rGroupName) throw(::com::sun::star::uno::RuntimeException);
302     virtual sal_Int32 SAL_CALL getGroupCount() throw(::com::sun::star::uno::RuntimeException);
303     virtual void SAL_CALL getGroup(sal_Int32 _nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& _rxGroup, ::rtl::OUString& _rName) throw(::com::sun::star::uno::RuntimeException);
304     virtual void SAL_CALL getGroupByName(const ::rtl::OUString& _rName, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& _rxGroup) throw(::com::sun::star::uno::RuntimeException);
305 
306 	// com::sun::star::lang::XEventListener
307 	virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException);
308 
309 	// com::sun::star::form::XLoadListener
310     virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException);
311     virtual void SAL_CALL unloading(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException);
312 	virtual void SAL_CALL unloaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException);
313     virtual void SAL_CALL reloading(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException);
314     virtual void SAL_CALL reloaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException);
315 
316 	// com::sun::star::form::XLoadable
317 	virtual void SAL_CALL load() throw(::com::sun::star::uno::RuntimeException);
318 	virtual void SAL_CALL unload() throw(::com::sun::star::uno::RuntimeException);
319     virtual void SAL_CALL reload() throw(::com::sun::star::uno::RuntimeException);
320 	virtual sal_Bool SAL_CALL isLoaded() throw(::com::sun::star::uno::RuntimeException);
321 	virtual void SAL_CALL addLoadListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
322 	virtual void SAL_CALL removeLoadListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
323 
324 	// com::sun::star::sdbc::XCloseable
325 	virtual void SAL_CALL close() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
326 
327 	// com::sun::star::sdbc::XRowSetListener
328 	virtual void SAL_CALL cursorMoved(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException);
329 	virtual void SAL_CALL rowChanged(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException);
330 	virtual void SAL_CALL rowSetChanged(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException);
331 
332 	// com::sun::star::sdb::XRowSetApproveListener
333     virtual sal_Bool SAL_CALL approveCursorMove(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException);
334     virtual sal_Bool SAL_CALL approveRowChange(const ::com::sun::star::sdb::RowChangeEvent& event) throw(::com::sun::star::uno::RuntimeException);
335     virtual sal_Bool SAL_CALL approveRowSetChange(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException);
336 
337 	// com::sun::star::sdb::XRowSetApproveBroadcaster
338     virtual void SAL_CALL addRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
339     virtual void SAL_CALL removeRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
340 
341 	// com::sun:star::form::XDatabaseParameterBroadcaster2
342 	virtual void SAL_CALL addDatabaseParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
343 	virtual void SAL_CALL removeDatabaseParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
344 
345 	// com::sun:star::form::XDatabaseParameterBroadcaster
346 	virtual void SAL_CALL addParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
347 	virtual void SAL_CALL removeParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
348 
349 	// com::sun::star::sdbc::XRowSet
350     virtual void SAL_CALL execute() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
351     virtual void SAL_CALL addRowSetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
352     virtual void SAL_CALL removeRowSetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException);
353 
354 	// com::sun::star::sdb::XCompletedExecution
355     virtual void SAL_CALL executeWithCompletion( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& handler ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
356 
357 	// com::sun::star::sdbc::XResultSet
358     virtual sal_Bool SAL_CALL next() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
359     virtual sal_Bool SAL_CALL isBeforeFirst() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
360     virtual sal_Bool SAL_CALL isAfterLast() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
361     virtual sal_Bool SAL_CALL isFirst() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
362     virtual sal_Bool SAL_CALL isLast() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
363     virtual void SAL_CALL beforeFirst() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
364     virtual void SAL_CALL afterLast() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
365     virtual sal_Bool SAL_CALL first() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
366     virtual sal_Bool SAL_CALL last() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
367     virtual sal_Int32 SAL_CALL getRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
368     virtual sal_Bool SAL_CALL absolute(sal_Int32 row) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
369     virtual sal_Bool SAL_CALL relative(sal_Int32 rows) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
370     virtual sal_Bool SAL_CALL previous() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
371     virtual void SAL_CALL refreshRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
372 	virtual sal_Bool SAL_CALL rowUpdated() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
373     virtual sal_Bool SAL_CALL rowInserted() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
374     virtual sal_Bool SAL_CALL rowDeleted() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
375     virtual InterfaceRef SAL_CALL getStatement() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
376 
377 	// com::sun::star::sdbc::XResultSetUpdate
378     virtual void SAL_CALL insertRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
379     virtual void SAL_CALL updateRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
380     virtual void SAL_CALL deleteRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
381     virtual void SAL_CALL cancelRowUpdates() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
382     virtual void SAL_CALL moveToInsertRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
383     virtual void SAL_CALL moveToCurrentRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
384 
385 	// com::sun::star::sdbcx::XDeleteRows
386 	virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& rows) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
387 
388 	// com::sun::star::lang::XServiceInfo
389 	virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName)  throw(::com::sun::star::uno::RuntimeException);
390 	virtual ::rtl::OUString	SAL_CALL getImplementationName()  throw(::com::sun::star::uno::RuntimeException);
391 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()  throw(::com::sun::star::uno::RuntimeException);
392 
393 	// com::sun::star::lang::XServiceInfo - static version
394 	static	::rtl::OUString	SAL_CALL getImplementationName_Static();
395 	static	::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static();
396 	static	::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getCurrentServiceNames_Static();
397 	static	::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getCompatibleServiceNames_Static();
398 	static	::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory );
399 
400 	// com::sun::star::io::XPersistObject
401     virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
402     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);
403     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);
404 
405 	// com::sun::star::sdbc::XSQLErrorListener
406     virtual void SAL_CALL errorOccured(const ::com::sun::star::sdb::SQLErrorEvent& aEvent) throw(::com::sun::star::uno::RuntimeException);
407 
408 	// com::sun::star::sdbc::XParameters
409 	virtual void SAL_CALL setNull(sal_Int32 parameterIndex, sal_Int32 sqlType) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
410     virtual void SAL_CALL setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
411     virtual void SAL_CALL setBoolean(sal_Int32 parameterIndex, sal_Bool x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
412     virtual void SAL_CALL setByte(sal_Int32 parameterIndex, sal_Int8 x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
413     virtual void SAL_CALL setShort(sal_Int32 parameterIndex, sal_Int16 x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
414     virtual void SAL_CALL setInt(sal_Int32 parameterIndex, sal_Int32 x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
415     virtual void SAL_CALL setLong(sal_Int32 parameterIndex, sal_Int64 x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
416     virtual void SAL_CALL setFloat(sal_Int32 parameterIndex, float x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
417     virtual void SAL_CALL setDouble(sal_Int32 parameterIndex, double x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
418     virtual void SAL_CALL setString(sal_Int32 parameterIndex, const ::rtl::OUString& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
419     virtual void SAL_CALL setBytes(sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
420     virtual void SAL_CALL setDate(sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
421     virtual void SAL_CALL setTime(sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
422     virtual void SAL_CALL setTimestamp(sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
423     virtual void SAL_CALL setBinaryStream(sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
424 	virtual void SAL_CALL setCharacterStream(sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
425     virtual void SAL_CALL setObject(sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
426     virtual void SAL_CALL setObjectWithInfo(sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
427     virtual void SAL_CALL setRef(sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef>& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
428     virtual void SAL_CALL setBlob(sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob>& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
429     virtual void SAL_CALL setClob(sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob>& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
430     virtual void SAL_CALL setArray(sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray>& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
431 	virtual void SAL_CALL clearParameters() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
432 
433     // XPropertyChangeListener
434     virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
435 
436     // XPropertyContainer
437     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);
438     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);
439 
440     // XPropertyAccess
441     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues(  ) throw (::com::sun::star::uno::RuntimeException);
442     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);
443     using OPropertySetAggregationHelper::setPropertyValues;
444 
445     // XWarningsSupplier
446     virtual ::com::sun::star::uno::Any SAL_CALL getWarnings(  ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
447     virtual void SAL_CALL clearWarnings(  ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
448 
449     // XCloneable
450     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone(  ) throw (::com::sun::star::uno::RuntimeException);
451 
452     inline void submitNBC( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& Control, const ::com::sun::star::awt::MouseEvent& MouseEvt );
453 
454 protected:
455     // OPropertySetAggregationHelper overridables
456     virtual void SAL_CALL forwardingPropertyValue( sal_Int32 _nHandle );
457     virtual void SAL_CALL forwardedPropertyValue( sal_Int32 _nHandle, bool _bSuccess );
458 
459     // OInterfaceContainer overridables
460     virtual void implInserted( const ElementDescription* _pElement );
461 	virtual void implRemoved(const InterfaceRef& _rxObject);
462 
463 	// OPropertyChangeListener
464 	virtual void _propertyChanged( const ::com::sun::star::beans::PropertyChangeEvent& ) throw(::com::sun::star::uno::RuntimeException);
465 
466 private:
467     sal_Bool executeRowSet(::osl::ResettableMutexGuard& _rClearForNotifies, sal_Bool bMoveToFirst = sal_True,
468 					const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >());
469 	bool	fillParameters(::osl::ResettableMutexGuard& _rClearForNotifies,
470 					const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >());
471 	void	updateParameterInfo();
472 	bool	hasValidParent() const;
473 
474 	// impl methods
475 	void	load_impl(sal_Bool bCausedByParentForm, sal_Bool bMoveToFirst = sal_True,
476 		const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >())
477 		throw(::com::sun::star::uno::RuntimeException);
478 	void	reload_impl(sal_Bool bMoveToFirst,
479 		const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >())
480 		throw(::com::sun::star::uno::RuntimeException);
481 	void	submit_impl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& Control, const ::com::sun::star::awt::MouseEvent& MouseEvt, bool _bAproveByListeners);
482 	void	reset_impl(bool _bAproveByListeners);
483 
484 	sal_Bool	implEnsureConnection();
485 
486 	// connection sharing
487 
488 	/// checks if we can re-use (aka share) the connection of the given parent
489 	sal_Bool	canShareConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxParentProps );
490 
491 	/// starts sharing the connection with the parent
492 	void		doShareConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxParentProps );
493 
494 	/// stops sharing the connection with the parent
495 	void		stopSharingConnection( );
496 
497 	/// called when the connection which we share with our parent is beeing disposed
498 	void		disposingSharedConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn );
499 
500 	/// checks if we currently share our connection with our parent
501 	sal_Bool	isSharingConnection( ) const { return m_bSharingConnection; }
502 
503     /** calls our row set approval listeners
504 
505         @param _rEvent
506             the event to notify
507         @param _bAllowSQLException
508             <TRUE/> if SQLExceptions are allowed to leave the method
509         @param _rGuard
510             the guard to be cleared before actually calling into the listeners, but after making
511             a copy of the listeners array to operate on.
512         @return
513             <TRUE/> if and only if the execution has been approved
514     */
515     bool    impl_approveRowChange_throw(
516         const ::com::sun::star::lang::EventObject& _rEvent,
517         const bool _bAllowSQLException,
518         ::osl::ClearableMutexGuard& _rGuard
519     );
520 
521 	/// invalidate all our parameter-related stuff
522 	void		invlidateParameters();
523 
524 	void		saveInsertOnlyState( );
525 	void		restoreInsertOnlyState( );
526 
527 	// error handling
528 	void	onError(const ::com::sun::star::sdb::SQLErrorEvent& _rEvent);
529 	void	onError(const ::com::sun::star::sdbc::SQLException&, const ::rtl::OUString& _rContextDescription);
530 
531 	// html tools
532     ::rtl::OUString         GetDataEncoded(bool _bURLEncoded,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt);
533 	::rtl::OUString			GetDataURLEncoded(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt);
534 	::rtl::OUString			GetDataTextEncoded(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt);
535 	::com::sun::star::uno::Sequence<sal_Int8>	GetDataMultiPartEncoded(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt,
536 											 ::rtl::OUString& rContentType);
537 
538 	void AppendComponent(HtmlSuccessfulObjList& rList, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xComponentSet, const ::rtl::OUString& rNamePrefix,
539 					 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& rxSubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt);
540 
541 	void FillSuccessfulList(HtmlSuccessfulObjList& rList, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& rxSubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt);
542 
543 	void InsertTextPart(INetMIMEMessage& rParent, const ::rtl::OUString& rName, const ::rtl::OUString& rData);
544 	sal_Bool InsertFilePart(INetMIMEMessage& rParent, const ::rtl::OUString& rName, const ::rtl::OUString& rFileName);
545 	void Encode(::rtl::OUString& rString) const;
546 
547 	::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > getConnection();
548 
549     void    impl_createLoadTimer();
550 
551     void    impl_construct();
552 
553 	DECL_LINK( OnTimeout, void* );
554 protected:
555     using OPropertySetHelper::getPropertyValues;
556 };
557 
558 inline void ODatabaseForm::submitNBC(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& Control, const ::com::sun::star::awt::MouseEvent& MouseEvt)
559 {
560 	submit_impl(Control, MouseEvt, sal_False);
561 }
562 
563 //.........................................................................
564 }	// namespace frm
565 //.........................................................................
566 
567 #endif // _FRM_DATABASEFORM_HXX_
568 
569 
570