1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: formadapter.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #ifndef _SBA_FORMADAPTER_HXX
35 #include "formadapter.hxx"
37 #ifndef _TOOLS_DEBUG_HXX //autogen
38 #include <tools/debug.hxx>
40 #ifndef _COMPHELPER_TYPES_HXX_
41 #include <comphelper/types.hxx>
43 #ifndef _COMPHELPER_ENUMHELPER_HXX_
44 #include <comphelper/enumhelper.hxx>
46 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
47 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
50 #include <tools/string.hxx>
53 #include "dbu_brw.hrc"
55 #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
56 #include "dbustrings.hrc"
58 #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
59 #include <cppuhelper/typeprovider.hxx>
61 #ifndef _COMPHELPER_SEQUENCE_HXX_
62 #include <comphelper/sequence.hxx>
65 using namespace dbaui
;
66 using namespace ::com::sun::star::uno
;
67 using namespace ::com::sun::star::sdb
;
68 using namespace ::com::sun::star::sdbcx
;
69 using namespace ::com::sun::star::beans
;
70 using namespace ::com::sun::star::container
;
72 //==================================================================
74 //==================================================================
76 DBG_NAME(SbaXFormAdapter
)
77 // -------------------------------------------------------------------------
78 SbaXFormAdapter::SbaXFormAdapter()
79 :m_aLoadListeners(*this, m_aMutex
)
80 ,m_aRowSetListeners(*this, m_aMutex
)
81 ,m_aRowSetApproveListeners(*this, m_aMutex
)
82 ,m_aErrorListeners(*this, m_aMutex
)
83 ,m_aParameterListeners(*this, m_aMutex
)
84 ,m_aSubmitListeners(*this, m_aMutex
)
85 ,m_aResetListeners(*this, m_aMutex
)
86 ,m_aPropertyChangeListeners(*this, m_aMutex
)
87 ,m_aVetoablePropertyChangeListeners(*this, m_aMutex
)
88 ,m_aPropertiesChangeListeners(*this, m_aMutex
)
89 ,m_aDisposeListeners(m_aMutex
)
90 ,m_aContainerListeners(m_aMutex
)
91 ,m_nNamePropHandle(-1)
93 DBG_CTOR(SbaXFormAdapter
,NULL
);
97 // -------------------------------------------------------------------------
98 SbaXFormAdapter::~SbaXFormAdapter()
101 DBG_DTOR(SbaXFormAdapter
,NULL
);
104 // -------------------------------------------------------------------------
105 Sequence
< Type
> SAL_CALL
SbaXFormAdapter::getTypes( ) throw (RuntimeException
)
107 return ::comphelper::concatSequences(
108 SbaXFormAdapter_BASE1::getTypes(),
109 SbaXFormAdapter_BASE2::getTypes(),
110 SbaXFormAdapter_BASE3::getTypes()
114 // -------------------------------------------------------------------------
115 Sequence
< sal_Int8
> SAL_CALL
SbaXFormAdapter::getImplementationId( ) throw (RuntimeException
)
117 static ::cppu::OImplementationId
* pId
= 0;
120 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
123 static ::cppu::OImplementationId aId
;
127 return pId
->getImplementationId();
130 // -------------------------------------------------------------------------
131 Any SAL_CALL
SbaXFormAdapter::queryInterface(const Type
& _rType
) throw (RuntimeException
)
133 Any aReturn
= SbaXFormAdapter_BASE1::queryInterface( _rType
);
135 if (!aReturn
.hasValue())
136 aReturn
= SbaXFormAdapter_BASE2::queryInterface( _rType
);
138 if (!aReturn
.hasValue())
139 aReturn
= SbaXFormAdapter_BASE3::queryInterface( _rType
);
144 // -------------------------------------------------------------------------
145 void SbaXFormAdapter::StopListening()
147 // log off all our multiplexers
148 STOP_MULTIPLEXER_LISTENING(LoadListener
, m_aLoadListeners
, ::com::sun::star::form::XLoadable
, m_xMainForm
);
149 STOP_MULTIPLEXER_LISTENING(RowSetListener
, m_aRowSetListeners
, ::com::sun::star::sdbc::XRowSet
, m_xMainForm
);
150 STOP_MULTIPLEXER_LISTENING(RowSetApproveListener
, m_aRowSetApproveListeners
, ::com::sun::star::sdb::XRowSetApproveBroadcaster
, m_xMainForm
);
151 STOP_MULTIPLEXER_LISTENING(SQLErrorListener
, m_aErrorListeners
, ::com::sun::star::sdb::XSQLErrorBroadcaster
, m_xMainForm
);
152 STOP_MULTIPLEXER_LISTENING(SubmitListener
, m_aSubmitListeners
, ::com::sun::star::form::XSubmit
, m_xMainForm
);
153 STOP_MULTIPLEXER_LISTENING(ResetListener
, m_aResetListeners
, ::com::sun::star::form::XReset
, m_xMainForm
);
155 if (m_aParameterListeners
.getLength())
157 Reference
< ::com::sun::star::form::XDatabaseParameterBroadcaster
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
158 if (xBroadcaster
.is())
159 xBroadcaster
->removeParameterListener(&m_aParameterListeners
);
162 STOP_PROPERTY_MULTIPLEXER_LISTENING(PropertyChangeListener
, m_aPropertyChangeListeners
, ::com::sun::star::beans::XPropertySet
, m_xMainForm
);
163 STOP_PROPERTY_MULTIPLEXER_LISTENING(VetoableChangeListener
, m_aVetoablePropertyChangeListeners
, ::com::sun::star::beans::XPropertySet
, m_xMainForm
);
164 if (m_aPropertiesChangeListeners
.getLength())
166 Reference
< ::com::sun::star::beans::XMultiPropertySet
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
167 if (xBroadcaster
.is())
168 xBroadcaster
->removePropertiesChangeListener(&m_aPropertiesChangeListeners
);
172 Reference
< ::com::sun::star::lang::XComponent
> xComp(m_xMainForm
, UNO_QUERY
);
174 xComp
->removeEventListener((::com::sun::star::lang::XEventListener
*)(::com::sun::star::beans::XPropertyChangeListener
*)this);
177 // -------------------------------------------------------------------------
178 void SbaXFormAdapter::StartListening()
180 // log off all our multiplexers
181 START_MULTIPLEXER_LISTENING(LoadListener
, m_aLoadListeners
, ::com::sun::star::form::XLoadable
, m_xMainForm
);
182 START_MULTIPLEXER_LISTENING(RowSetListener
, m_aRowSetListeners
, ::com::sun::star::sdbc::XRowSet
, m_xMainForm
);
183 START_MULTIPLEXER_LISTENING(RowSetApproveListener
, m_aRowSetApproveListeners
, ::com::sun::star::sdb::XRowSetApproveBroadcaster
, m_xMainForm
);
184 START_MULTIPLEXER_LISTENING(SQLErrorListener
, m_aErrorListeners
, ::com::sun::star::sdb::XSQLErrorBroadcaster
, m_xMainForm
);
185 START_MULTIPLEXER_LISTENING(SubmitListener
, m_aSubmitListeners
, ::com::sun::star::form::XSubmit
, m_xMainForm
);
186 START_MULTIPLEXER_LISTENING(ResetListener
, m_aResetListeners
, ::com::sun::star::form::XReset
, m_xMainForm
);
188 if (m_aParameterListeners
.getLength())
190 Reference
< ::com::sun::star::form::XDatabaseParameterBroadcaster
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
191 if (xBroadcaster
.is())
192 xBroadcaster
->addParameterListener(&m_aParameterListeners
);
195 START_PROPERTY_MULTIPLEXER_LISTENING(PropertyChangeListener
, m_aPropertyChangeListeners
, ::com::sun::star::beans::XPropertySet
, m_xMainForm
);
196 START_PROPERTY_MULTIPLEXER_LISTENING(VetoableChangeListener
, m_aVetoablePropertyChangeListeners
, ::com::sun::star::beans::XPropertySet
, m_xMainForm
);
197 if (m_aPropertiesChangeListeners
.getLength())
199 Reference
< ::com::sun::star::beans::XMultiPropertySet
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
200 ::rtl::OUString sEmpty
;
201 if (xBroadcaster
.is())
202 xBroadcaster
->addPropertiesChangeListener(::comphelper::StringSequence(&sEmpty
, 1), &m_aPropertiesChangeListeners
);
206 Reference
< ::com::sun::star::lang::XComponent
> xComp(m_xMainForm
, UNO_QUERY
);
208 xComp
->addEventListener((::com::sun::star::lang::XEventListener
*)(::com::sun::star::beans::XPropertyChangeListener
*)this);
211 // -------------------------------------------------------------------------
212 void SbaXFormAdapter::AttachForm(const Reference
< ::com::sun::star::sdbc::XRowSet
>& xNewMaster
)
214 if (xNewMaster
== m_xMainForm
)
217 DBG_ASSERT(xNewMaster
.get() != static_cast< ::com::sun::star::sdbc::XRowSet
* >(this), "SbaXFormAdapter::AttachForm : invalid argument !");
219 if (m_xMainForm
.is())
223 // if our old master is loaded we have to send an 'unloaded' event
224 Reference
< ::com::sun::star::form::XLoadable
> xLoadable(m_xMainForm
, UNO_QUERY
);
225 if (xLoadable
->isLoaded())
227 ::com::sun::star::lang::EventObject
aEvt(*this);
228 ::cppu::OInterfaceIteratorHelper
aIt(m_aLoadListeners
);
229 while (aIt
.hasMoreElements())
230 ((::com::sun::star::form::XLoadListener
*)aIt
.next())->unloaded(aEvt
);
234 m_xMainForm
= xNewMaster
;
236 if (m_xMainForm
.is())
240 // if our new master is loaded we have to send an 'loaded' event
241 Reference
< ::com::sun::star::form::XLoadable
> xLoadable(m_xMainForm
, UNO_QUERY
);
242 if (xLoadable
->isLoaded())
244 ::com::sun::star::lang::EventObject
aEvt(*this);
245 ::cppu::OInterfaceIteratorHelper
aIt(m_aLoadListeners
);
246 while (aIt
.hasMoreElements())
247 ((::com::sun::star::form::XLoadListener
*)aIt
.next())->loaded(aEvt
);
251 // TODO : perhaps _all_ of our listeners should be notified about our new state
252 // (nearly every aspect of us may have changed with new master form)
255 // ::com::sun::star::sdbc::XCloseable
256 // -------------------------------------------------------------------------
257 void SAL_CALL
SbaXFormAdapter::close() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
259 Reference
< ::com::sun::star::sdbc::XCloseable
> xIface(m_xMainForm
, UNO_QUERY
);
264 // ::com::sun::star::sdbc::XResultSetMetaDataSupplier
265 // -------------------------------------------------------------------------
266 Reference
< ::com::sun::star::sdbc::XResultSetMetaData
> SAL_CALL
SbaXFormAdapter::getMetaData() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
268 Reference
< ::com::sun::star::sdbc::XResultSetMetaDataSupplier
> xIface(m_xMainForm
, UNO_QUERY
);
270 return xIface
->getMetaData();
271 return Reference
< ::com::sun::star::sdbc::XResultSetMetaData
> ();
274 // ::com::sun::star::sdbc::XColumnLocate
275 // -------------------------------------------------------------------------
276 sal_Int32 SAL_CALL
SbaXFormAdapter::findColumn(const ::rtl::OUString
& columnName
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
278 Reference
< ::com::sun::star::sdbc::XColumnLocate
> xIface(m_xMainForm
, UNO_QUERY
);
280 return xIface
->findColumn(columnName
);
284 // ::com::sun::star::sdbcx::XColumnsSupplier
285 // -------------------------------------------------------------------------
286 Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
SbaXFormAdapter::getColumns() throw( RuntimeException
)
288 Reference
< ::com::sun::star::sdbcx::XColumnsSupplier
> xIface(m_xMainForm
, UNO_QUERY
);
290 return xIface
->getColumns();
291 return Reference
< ::com::sun::star::container::XNameAccess
> ();
294 // ::com::sun::star::sdbc::XRow
295 // -------------------------------------------------------------------------
296 sal_Bool SAL_CALL
SbaXFormAdapter::wasNull() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
298 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
300 return xIface
->wasNull();
303 // -------------------------------------------------------------------------
304 ::rtl::OUString SAL_CALL
SbaXFormAdapter::getString(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
306 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
308 return xIface
->getString(columnIndex
);
309 return ::rtl::OUString();
311 // -------------------------------------------------------------------------
312 sal_Bool SAL_CALL
SbaXFormAdapter::getBoolean(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
314 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
316 return xIface
->getBoolean(columnIndex
);
319 // -------------------------------------------------------------------------
320 sal_Int8 SAL_CALL
SbaXFormAdapter::getByte(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
322 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
324 return xIface
->getByte(columnIndex
);
327 // -------------------------------------------------------------------------
328 sal_Int16 SAL_CALL
SbaXFormAdapter::getShort(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
330 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
332 return xIface
->getShort(columnIndex
);
335 // -------------------------------------------------------------------------
336 sal_Int32 SAL_CALL
SbaXFormAdapter::getInt(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
338 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
340 return xIface
->getInt(columnIndex
);
343 // -------------------------------------------------------------------------
344 sal_Int64 SAL_CALL
SbaXFormAdapter::getLong(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
346 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
348 return xIface
->getLong(columnIndex
);
351 // -------------------------------------------------------------------------
352 float SAL_CALL
SbaXFormAdapter::getFloat(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
354 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
356 return xIface
->getFloat(columnIndex
);
359 // -------------------------------------------------------------------------
360 double SAL_CALL
SbaXFormAdapter::getDouble(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
362 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
364 return xIface
->getDouble(columnIndex
);
367 // -------------------------------------------------------------------------
368 Sequence
< sal_Int8
> SAL_CALL
SbaXFormAdapter::getBytes(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
370 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
372 return xIface
->getBytes(columnIndex
);
373 return Sequence
<sal_Int8
> ();
375 // -------------------------------------------------------------------------
376 ::com::sun::star::util::Date SAL_CALL
SbaXFormAdapter::getDate(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
378 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
380 return xIface
->getDate(columnIndex
);
381 return ::com::sun::star::util::Date();
383 // -------------------------------------------------------------------------
384 ::com::sun::star::util::Time SAL_CALL
SbaXFormAdapter::getTime(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
386 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
388 return xIface
->getTime(columnIndex
);
389 return ::com::sun::star::util::Time();
391 // -------------------------------------------------------------------------
392 ::com::sun::star::util::DateTime SAL_CALL
SbaXFormAdapter::getTimestamp(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
394 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
396 return xIface
->getTimestamp(columnIndex
);
397 return ::com::sun::star::util::DateTime();
399 // -------------------------------------------------------------------------
400 Reference
< ::com::sun::star::io::XInputStream
> SAL_CALL
SbaXFormAdapter::getBinaryStream(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
402 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
404 return xIface
->getBinaryStream(columnIndex
);
405 return Reference
< ::com::sun::star::io::XInputStream
> ();
407 // -------------------------------------------------------------------------
408 Reference
< ::com::sun::star::io::XInputStream
> SAL_CALL
SbaXFormAdapter::getCharacterStream(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
410 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
412 return xIface
->getCharacterStream(columnIndex
);
413 return Reference
< ::com::sun::star::io::XInputStream
> ();
415 // -------------------------------------------------------------------------
416 Any SAL_CALL
SbaXFormAdapter::getObject(sal_Int32 columnIndex
, const Reference
< ::com::sun::star::container::XNameAccess
>& typeMap
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
418 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
420 return xIface
->getObject(columnIndex
, typeMap
);
423 // -------------------------------------------------------------------------
424 Reference
< ::com::sun::star::sdbc::XRef
> SAL_CALL
SbaXFormAdapter::getRef(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
426 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
428 return xIface
->getRef(columnIndex
);
429 return Reference
< ::com::sun::star::sdbc::XRef
> ();
431 // -------------------------------------------------------------------------
432 Reference
< ::com::sun::star::sdbc::XBlob
> SAL_CALL
SbaXFormAdapter::getBlob(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
434 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
436 return xIface
->getBlob(columnIndex
);
437 return Reference
< ::com::sun::star::sdbc::XBlob
> ();
439 // -------------------------------------------------------------------------
440 Reference
< ::com::sun::star::sdbc::XClob
> SAL_CALL
SbaXFormAdapter::getClob(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
442 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
444 return xIface
->getClob(columnIndex
);
445 return Reference
< ::com::sun::star::sdbc::XClob
> ();
447 // -------------------------------------------------------------------------
448 Reference
< ::com::sun::star::sdbc::XArray
> SAL_CALL
SbaXFormAdapter::getArray(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
450 Reference
< ::com::sun::star::sdbc::XRow
> xIface(m_xMainForm
, UNO_QUERY
);
452 return xIface
->getArray(columnIndex
);
453 return Reference
< ::com::sun::star::sdbc::XArray
> ();
456 // ::com::sun::star::sdbcx::XRowLocate
457 // -------------------------------------------------------------------------
458 Any SAL_CALL
SbaXFormAdapter::getBookmark() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
460 Reference
< ::com::sun::star::sdbcx::XRowLocate
> xIface(m_xMainForm
, UNO_QUERY
);
462 return xIface
->getBookmark();
465 // -------------------------------------------------------------------------
466 sal_Bool SAL_CALL
SbaXFormAdapter::moveToBookmark(const Any
& bookmark
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
468 Reference
< ::com::sun::star::sdbcx::XRowLocate
> xIface(m_xMainForm
, UNO_QUERY
);
470 return xIface
->moveToBookmark(bookmark
);
473 // -------------------------------------------------------------------------
474 sal_Bool SAL_CALL
SbaXFormAdapter::moveRelativeToBookmark(const Any
& bookmark
, sal_Int32 rows
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
476 Reference
< ::com::sun::star::sdbcx::XRowLocate
> xIface(m_xMainForm
, UNO_QUERY
);
478 return xIface
->moveRelativeToBookmark(bookmark
,rows
);
481 // -------------------------------------------------------------------------
482 sal_Int32 SAL_CALL
SbaXFormAdapter::compareBookmarks(const Any
& _first
, const Any
& _second
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
484 Reference
< ::com::sun::star::sdbcx::XRowLocate
> xIface(m_xMainForm
, UNO_QUERY
);
486 return xIface
->compareBookmarks(_first
, _second
);
490 // -------------------------------------------------------------------------
491 sal_Bool SAL_CALL
SbaXFormAdapter::hasOrderedBookmarks() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
493 Reference
< ::com::sun::star::sdbcx::XRowLocate
> xIface(m_xMainForm
, UNO_QUERY
);
495 return xIface
->hasOrderedBookmarks();
499 // -------------------------------------------------------------------------
500 sal_Int32 SAL_CALL
SbaXFormAdapter::hashBookmark(const Any
& bookmark
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
502 Reference
< ::com::sun::star::sdbcx::XRowLocate
> xIface(m_xMainForm
, UNO_QUERY
);
504 return xIface
->hashBookmark(bookmark
);
508 // ::com::sun::star::sdbc::XRowUpdate
509 // -------------------------------------------------------------------------
510 void SAL_CALL
SbaXFormAdapter::updateNull(sal_Int32 columnIndex
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
512 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
514 xIface
->updateNull(columnIndex
);
516 // -------------------------------------------------------------------------
517 void SAL_CALL
SbaXFormAdapter::updateBoolean(sal_Int32 columnIndex
, sal_Bool x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
519 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
521 xIface
->updateBoolean(columnIndex
, x
);
523 // -------------------------------------------------------------------------
524 void SAL_CALL
SbaXFormAdapter::updateByte(sal_Int32 columnIndex
, sal_Int8 x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
526 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
528 xIface
->updateByte(columnIndex
, x
);
530 // -------------------------------------------------------------------------
531 void SAL_CALL
SbaXFormAdapter::updateShort(sal_Int32 columnIndex
, sal_Int16 x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
533 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
535 xIface
->updateShort(columnIndex
, x
);
537 // -------------------------------------------------------------------------
538 void SAL_CALL
SbaXFormAdapter::updateInt(sal_Int32 columnIndex
, sal_Int32 x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
540 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
542 xIface
->updateInt(columnIndex
, x
);
544 // -------------------------------------------------------------------------
545 void SAL_CALL
SbaXFormAdapter::updateLong(sal_Int32 columnIndex
, sal_Int64 x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
547 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
549 xIface
->updateLong(columnIndex
, x
);
551 // -------------------------------------------------------------------------
552 void SAL_CALL
SbaXFormAdapter::updateFloat(sal_Int32 columnIndex
, float x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
554 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
556 xIface
->updateFloat(columnIndex
, x
);
558 // -------------------------------------------------------------------------
559 void SAL_CALL
SbaXFormAdapter::updateDouble(sal_Int32 columnIndex
, double x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
561 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
563 xIface
->updateDouble(columnIndex
, x
);
565 // -------------------------------------------------------------------------
566 void SAL_CALL
SbaXFormAdapter::updateString(sal_Int32 columnIndex
, const ::rtl::OUString
& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
568 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
570 xIface
->updateString(columnIndex
, x
);
572 // -------------------------------------------------------------------------
573 void SAL_CALL
SbaXFormAdapter::updateBytes(sal_Int32 columnIndex
, const Sequence
< sal_Int8
>& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
575 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
577 xIface
->updateBytes(columnIndex
, x
);
579 // -------------------------------------------------------------------------
580 void SAL_CALL
SbaXFormAdapter::updateDate(sal_Int32 columnIndex
, const ::com::sun::star::util::Date
& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
582 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
584 xIface
->updateDate(columnIndex
, x
);
586 // -------------------------------------------------------------------------
587 void SAL_CALL
SbaXFormAdapter::updateTime(sal_Int32 columnIndex
, const ::com::sun::star::util::Time
& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
589 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
591 xIface
->updateTime(columnIndex
, x
);
593 // -------------------------------------------------------------------------
594 void SAL_CALL
SbaXFormAdapter::updateTimestamp(sal_Int32 columnIndex
, const ::com::sun::star::util::DateTime
& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
596 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
598 xIface
->updateTimestamp(columnIndex
, x
);
600 // -------------------------------------------------------------------------
601 void SAL_CALL
SbaXFormAdapter::updateBinaryStream(sal_Int32 columnIndex
, const Reference
< ::com::sun::star::io::XInputStream
>& x
, sal_Int32 length
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
603 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
605 xIface
->updateBinaryStream(columnIndex
, x
, length
);
607 // -------------------------------------------------------------------------
608 void SAL_CALL
SbaXFormAdapter::updateCharacterStream(sal_Int32 columnIndex
, const Reference
< ::com::sun::star::io::XInputStream
>& x
, sal_Int32 length
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
610 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
612 xIface
->updateCharacterStream(columnIndex
, x
, length
);
614 // -------------------------------------------------------------------------
615 void SAL_CALL
SbaXFormAdapter::updateObject(sal_Int32 columnIndex
, const Any
& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
617 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
619 xIface
->updateObject(columnIndex
, x
);
621 // -------------------------------------------------------------------------
622 void SAL_CALL
SbaXFormAdapter::updateNumericObject(sal_Int32 columnIndex
, const Any
& x
, sal_Int32 scale
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
624 Reference
< ::com::sun::star::sdbc::XRowUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
626 xIface
->updateNumericObject(columnIndex
, x
, scale
);
629 // ::com::sun::star::sdbc::XResultSet
630 // -------------------------------------------------------------------------
631 sal_Bool SAL_CALL
SbaXFormAdapter::next() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
633 if (m_xMainForm
.is())
634 return m_xMainForm
->next();
637 // -------------------------------------------------------------------------
638 sal_Bool SAL_CALL
SbaXFormAdapter::isBeforeFirst() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
640 if (m_xMainForm
.is())
641 return m_xMainForm
->isBeforeFirst();
644 // -------------------------------------------------------------------------
645 sal_Bool SAL_CALL
SbaXFormAdapter::isAfterLast() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
647 if (m_xMainForm
.is())
648 return m_xMainForm
->isAfterLast();
651 // -------------------------------------------------------------------------
652 sal_Bool SAL_CALL
SbaXFormAdapter::isFirst() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
654 if (m_xMainForm
.is())
655 return m_xMainForm
->isFirst();
658 // -------------------------------------------------------------------------
659 sal_Bool SAL_CALL
SbaXFormAdapter::isLast() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
661 if (m_xMainForm
.is())
662 return m_xMainForm
->isLast();
665 // -------------------------------------------------------------------------
666 void SAL_CALL
SbaXFormAdapter::beforeFirst() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
668 if (m_xMainForm
.is())
669 m_xMainForm
->beforeFirst();
671 // -------------------------------------------------------------------------
672 void SAL_CALL
SbaXFormAdapter::afterLast() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
674 if (m_xMainForm
.is())
675 m_xMainForm
->afterLast();
677 // -------------------------------------------------------------------------
678 sal_Bool SAL_CALL
SbaXFormAdapter::first() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
680 if (m_xMainForm
.is())
681 return m_xMainForm
->first();
684 // -------------------------------------------------------------------------
685 sal_Bool SAL_CALL
SbaXFormAdapter::last() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
687 if (m_xMainForm
.is())
688 return m_xMainForm
->last();
691 // -------------------------------------------------------------------------
692 sal_Int32 SAL_CALL
SbaXFormAdapter::getRow() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
694 if (m_xMainForm
.is())
695 return m_xMainForm
->getRow();
698 // -------------------------------------------------------------------------
699 sal_Bool SAL_CALL
SbaXFormAdapter::absolute(sal_Int32 row
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
701 if (m_xMainForm
.is())
702 return m_xMainForm
->absolute(row
);
705 // -------------------------------------------------------------------------
706 sal_Bool SAL_CALL
SbaXFormAdapter::relative(sal_Int32 rows
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
708 if (m_xMainForm
.is())
709 return m_xMainForm
->relative(rows
);
712 // -------------------------------------------------------------------------
713 sal_Bool SAL_CALL
SbaXFormAdapter::previous() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
715 if (m_xMainForm
.is())
716 return m_xMainForm
->previous();
719 // -------------------------------------------------------------------------
720 void SAL_CALL
SbaXFormAdapter::refreshRow() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
722 if (m_xMainForm
.is())
723 m_xMainForm
->refreshRow();
726 // -------------------------------------------------------------------------
727 sal_Bool SAL_CALL
SbaXFormAdapter::rowUpdated() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
729 if (m_xMainForm
.is())
730 return m_xMainForm
->rowUpdated();
733 // -------------------------------------------------------------------------
734 sal_Bool SAL_CALL
SbaXFormAdapter::rowInserted() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
736 if (m_xMainForm
.is())
737 return m_xMainForm
->rowInserted();
740 // -------------------------------------------------------------------------
741 sal_Bool SAL_CALL
SbaXFormAdapter::rowDeleted() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
743 if (m_xMainForm
.is())
744 return m_xMainForm
->rowDeleted();
747 // -------------------------------------------------------------------------
748 Reference
< XInterface
> SAL_CALL
SbaXFormAdapter::getStatement() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
750 if (m_xMainForm
.is())
751 return m_xMainForm
->getStatement();
755 // ::com::sun::star::sdbc::XResultSetUpdate
756 // -------------------------------------------------------------------------
757 void SAL_CALL
SbaXFormAdapter::insertRow() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
759 Reference
< ::com::sun::star::sdbc::XResultSetUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
763 // -------------------------------------------------------------------------
764 void SAL_CALL
SbaXFormAdapter::updateRow() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
766 Reference
< ::com::sun::star::sdbc::XResultSetUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
770 // -------------------------------------------------------------------------
771 void SAL_CALL
SbaXFormAdapter::deleteRow() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
773 Reference
< ::com::sun::star::sdbc::XResultSetUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
777 // -------------------------------------------------------------------------
778 void SAL_CALL
SbaXFormAdapter::cancelRowUpdates() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
780 Reference
< ::com::sun::star::sdbc::XResultSetUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
782 xIface
->cancelRowUpdates();
784 // -------------------------------------------------------------------------
785 void SAL_CALL
SbaXFormAdapter::moveToInsertRow() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
787 Reference
< ::com::sun::star::sdbc::XResultSetUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
789 xIface
->moveToInsertRow();
791 // -------------------------------------------------------------------------
792 void SAL_CALL
SbaXFormAdapter::moveToCurrentRow() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
794 Reference
< ::com::sun::star::sdbc::XResultSetUpdate
> xIface(m_xMainForm
, UNO_QUERY
);
796 xIface
->moveToCurrentRow();
799 // ::com::sun::star::sdbc::XRowSet
800 // -------------------------------------------------------------------------
801 void SAL_CALL
SbaXFormAdapter::execute() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
803 if (m_xMainForm
.is())
804 m_xMainForm
->execute();
806 // -------------------------------------------------------------------------
807 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter
, sdbc
, RowSetListener
, m_aRowSetListeners
, ::com::sun::star::sdbc::XRowSet
, m_xMainForm
)
809 // ::com::sun::star::sdbcx::XDeleteRows
810 // -------------------------------------------------------------------------
811 Sequence
<sal_Int32
> SAL_CALL
SbaXFormAdapter::deleteRows(const Sequence
< Any
>& rows
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
813 Reference
< ::com::sun::star::sdbcx::XDeleteRows
> xIface(m_xMainForm
, UNO_QUERY
);
815 return xIface
->deleteRows(rows
);
816 return Sequence
<sal_Int32
>();
819 // ::com::sun::star::sdbc::XWarningsSupplier
820 // -------------------------------------------------------------------------
821 Any SAL_CALL
SbaXFormAdapter::getWarnings() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
823 Reference
< ::com::sun::star::sdbc::XWarningsSupplier
> xIface(m_xMainForm
, UNO_QUERY
);
825 return xIface
->getWarnings();
828 // -------------------------------------------------------------------------
829 void SAL_CALL
SbaXFormAdapter::clearWarnings() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
831 Reference
< ::com::sun::star::sdbc::XWarningsSupplier
> xIface(m_xMainForm
, UNO_QUERY
);
833 xIface
->clearWarnings();
836 // ::com::sun::star::sdb::XRowSetApproveBroadcaster
837 // -------------------------------------------------------------------------
838 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter
, sdb
, RowSetApproveListener
, m_aRowSetApproveListeners
, ::com::sun::star::sdb::XRowSetApproveBroadcaster
, m_xMainForm
)
840 // com::sun::star::sdbc::XSQLErrorBroadcaster
841 // -------------------------------------------------------------------------
842 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter
, sdb
, SQLErrorListener
, m_aErrorListeners
, ::com::sun::star::sdb::XSQLErrorBroadcaster
, m_xMainForm
)
844 // ::com::sun::star::sdb::XResultSetAccess
845 // -------------------------------------------------------------------------
846 Reference
< ::com::sun::star::sdbc::XResultSet
> SAL_CALL
SbaXFormAdapter::createResultSet() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
848 Reference
< ::com::sun::star::sdb::XResultSetAccess
> xIface(m_xMainForm
, UNO_QUERY
);
850 return xIface
->createResultSet();
851 return Reference
< ::com::sun::star::sdbc::XResultSet
> ();
854 // com::sun::star::form::XLoadable
855 // -------------------------------------------------------------------------
856 void SAL_CALL
SbaXFormAdapter::load() throw( RuntimeException
)
858 Reference
< ::com::sun::star::form::XLoadable
> xIface(m_xMainForm
, UNO_QUERY
);
862 // -------------------------------------------------------------------------
863 void SAL_CALL
SbaXFormAdapter::unload() throw( RuntimeException
)
865 Reference
< ::com::sun::star::form::XLoadable
> xIface(m_xMainForm
, UNO_QUERY
);
869 // -------------------------------------------------------------------------
870 void SAL_CALL
SbaXFormAdapter::reload() throw( RuntimeException
)
872 Reference
< ::com::sun::star::form::XLoadable
> xIface(m_xMainForm
, UNO_QUERY
);
876 // -------------------------------------------------------------------------
877 sal_Bool SAL_CALL
SbaXFormAdapter::isLoaded() throw( RuntimeException
)
879 Reference
< ::com::sun::star::form::XLoadable
> xIface(m_xMainForm
, UNO_QUERY
);
881 return xIface
->isLoaded();
884 // -------------------------------------------------------------------------
885 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter
, form
, LoadListener
, m_aLoadListeners
, ::com::sun::star::form::XLoadable
, m_xMainForm
)
887 // ::com::sun::star::sdbc::XParameters
888 // -------------------------------------------------------------------------
889 void SAL_CALL
SbaXFormAdapter::setNull(sal_Int32 parameterIndex
, sal_Int32 sqlType
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
891 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
893 xIface
->setNull(parameterIndex
, sqlType
);
895 // -------------------------------------------------------------------------
896 void SAL_CALL
SbaXFormAdapter::setObjectNull(sal_Int32 parameterIndex
, sal_Int32 sqlType
, const ::rtl::OUString
& typeName
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
898 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
900 xIface
->setObjectNull(parameterIndex
, sqlType
, typeName
);
902 // -------------------------------------------------------------------------
903 void SAL_CALL
SbaXFormAdapter::setBoolean(sal_Int32 parameterIndex
, sal_Bool x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
905 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
907 xIface
->setBoolean(parameterIndex
, x
);
909 // -------------------------------------------------------------------------
910 void SAL_CALL
SbaXFormAdapter::setByte(sal_Int32 parameterIndex
, sal_Int8 x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
912 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
914 xIface
->setByte(parameterIndex
, x
);
916 // -------------------------------------------------------------------------
917 void SAL_CALL
SbaXFormAdapter::setShort(sal_Int32 parameterIndex
, sal_Int16 x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
919 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
921 xIface
->setShort(parameterIndex
, x
);
923 // -------------------------------------------------------------------------
924 void SAL_CALL
SbaXFormAdapter::setInt(sal_Int32 parameterIndex
, sal_Int32 x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
926 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
928 xIface
->setInt(parameterIndex
, x
);
930 // -------------------------------------------------------------------------
931 void SAL_CALL
SbaXFormAdapter::setLong(sal_Int32 parameterIndex
, sal_Int64 x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
933 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
935 xIface
->setLong(parameterIndex
, x
);
937 // -------------------------------------------------------------------------
938 void SAL_CALL
SbaXFormAdapter::setFloat(sal_Int32 parameterIndex
, float x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
940 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
942 xIface
->setFloat(parameterIndex
, x
);
944 // -------------------------------------------------------------------------
945 void SAL_CALL
SbaXFormAdapter::setDouble(sal_Int32 parameterIndex
, double x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
947 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
949 xIface
->setDouble(parameterIndex
, x
);
951 // -------------------------------------------------------------------------
952 void SAL_CALL
SbaXFormAdapter::setString(sal_Int32 parameterIndex
, const ::rtl::OUString
& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
954 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
956 xIface
->setString(parameterIndex
, x
);
958 // -------------------------------------------------------------------------
959 void SAL_CALL
SbaXFormAdapter::setBytes(sal_Int32 parameterIndex
, const Sequence
< sal_Int8
>& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
961 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
963 xIface
->setBytes(parameterIndex
, x
);
965 // -------------------------------------------------------------------------
966 void SAL_CALL
SbaXFormAdapter::setDate(sal_Int32 parameterIndex
, const ::com::sun::star::util::Date
& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
968 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
970 xIface
->setDate(parameterIndex
, x
);
972 // -------------------------------------------------------------------------
973 void SAL_CALL
SbaXFormAdapter::setTime(sal_Int32 parameterIndex
, const ::com::sun::star::util::Time
& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
975 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
977 xIface
->setTime(parameterIndex
, x
);
979 // -------------------------------------------------------------------------
980 void SAL_CALL
SbaXFormAdapter::setTimestamp(sal_Int32 parameterIndex
, const ::com::sun::star::util::DateTime
& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
982 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
984 xIface
->setTimestamp(parameterIndex
, x
);
986 // -------------------------------------------------------------------------
987 void SAL_CALL
SbaXFormAdapter::setBinaryStream(sal_Int32 parameterIndex
, const Reference
< ::com::sun::star::io::XInputStream
>& x
, sal_Int32 length
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
989 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
991 xIface
->setBinaryStream(parameterIndex
, x
, length
);
993 // -------------------------------------------------------------------------
994 void SAL_CALL
SbaXFormAdapter::setCharacterStream(sal_Int32 parameterIndex
, const Reference
< ::com::sun::star::io::XInputStream
>& x
, sal_Int32 length
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
996 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
998 xIface
->setCharacterStream(parameterIndex
, x
, length
);
1000 // -------------------------------------------------------------------------
1001 void SAL_CALL
SbaXFormAdapter::setObject(sal_Int32 parameterIndex
, const Any
& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
1003 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
1005 xIface
->setObject(parameterIndex
, x
);
1007 // -------------------------------------------------------------------------
1008 void SAL_CALL
SbaXFormAdapter::setObjectWithInfo(sal_Int32 parameterIndex
, const Any
& x
, sal_Int32 targetSqlType
, sal_Int32 scale
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
1010 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
1012 xIface
->setObjectWithInfo(parameterIndex
, x
, targetSqlType
, scale
);
1014 // -------------------------------------------------------------------------
1015 void SAL_CALL
SbaXFormAdapter::setRef(sal_Int32 parameterIndex
, const Reference
< ::com::sun::star::sdbc::XRef
>& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
1017 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
1019 xIface
->setRef(parameterIndex
, x
);
1021 // -------------------------------------------------------------------------
1022 void SAL_CALL
SbaXFormAdapter::setBlob(sal_Int32 parameterIndex
, const Reference
< ::com::sun::star::sdbc::XBlob
>& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
1024 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
1026 xIface
->setBlob(parameterIndex
, x
);
1028 // -------------------------------------------------------------------------
1029 void SAL_CALL
SbaXFormAdapter::setClob(sal_Int32 parameterIndex
, const Reference
< ::com::sun::star::sdbc::XClob
>& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
1031 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
1033 xIface
->setClob(parameterIndex
, x
);
1035 // -------------------------------------------------------------------------
1036 void SAL_CALL
SbaXFormAdapter::setArray(sal_Int32 parameterIndex
, const Reference
< ::com::sun::star::sdbc::XArray
>& x
) throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
1038 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
1040 xIface
->setArray(parameterIndex
, x
);
1042 // -------------------------------------------------------------------------
1043 void SAL_CALL
SbaXFormAdapter::clearParameters() throw( ::com::sun::star::sdbc::SQLException
, RuntimeException
)
1045 Reference
< ::com::sun::star::sdbc::XParameters
> xIface(m_xMainForm
, UNO_QUERY
);
1047 xIface
->clearParameters();
1050 // ::com::sun::star::form::XDatabaseParameterBroadcaster
1051 // -------------------------------------------------------------------------
1052 void SAL_CALL
SbaXFormAdapter::addParameterListener(const Reference
< ::com::sun::star::form::XDatabaseParameterListener
>& aListener
) throw( RuntimeException
)
1054 m_aParameterListeners
.addInterface(aListener
);
1055 if (m_aParameterListeners
.getLength() == 1)
1057 Reference
< ::com::sun::star::form::XDatabaseParameterBroadcaster
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
1058 if (xBroadcaster
.is())
1059 xBroadcaster
->addParameterListener(&m_aParameterListeners
);
1063 // -------------------------------------------------------------------------
1064 void SAL_CALL
SbaXFormAdapter::removeParameterListener(const Reference
< ::com::sun::star::form::XDatabaseParameterListener
>& aListener
) throw( RuntimeException
)
1066 if (m_aParameterListeners
.getLength() == 1)
1068 Reference
< ::com::sun::star::form::XDatabaseParameterBroadcaster
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
1069 if (xBroadcaster
.is())
1070 xBroadcaster
->removeParameterListener(&m_aParameterListeners
);
1072 m_aParameterListeners
.removeInterface(aListener
);
1075 // ::com::sun::star::container::XChild
1076 // -------------------------------------------------------------------------
1077 Reference
< XInterface
> SAL_CALL
SbaXFormAdapter::getParent() throw( RuntimeException
)
1082 // -------------------------------------------------------------------------
1083 void SAL_CALL
SbaXFormAdapter::setParent(const Reference
< XInterface
>& Parent
) throw( ::com::sun::star::lang::NoSupportException
, RuntimeException
)
1088 // ::com::sun::star::form::XSubmit
1089 // -------------------------------------------------------------------------
1090 void SAL_CALL
SbaXFormAdapter::submit(const Reference
< ::com::sun::star::awt::XControl
>& aControl
, const ::com::sun::star::awt::MouseEvent
& aMouseEvt
) throw( RuntimeException
)
1092 Reference
< ::com::sun::star::form::XSubmit
> xSubmit(m_xMainForm
, UNO_QUERY
);
1094 xSubmit
->submit(aControl
, aMouseEvt
);
1097 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter
, form
, SubmitListener
, m_aSubmitListeners
, ::com::sun::star::form::XSubmit
, m_xMainForm
)
1099 // ::com::sun::star::awt::XTabControllerModel
1100 // -------------------------------------------------------------------------
1101 sal_Bool SAL_CALL
SbaXFormAdapter::getGroupControl() throw( RuntimeException
)
1103 DBG_ERROR("SAL_CALL SbaXFormAdapter::getGroupControl : not supported !");
1107 // -------------------------------------------------------------------------
1108 void SAL_CALL
SbaXFormAdapter::setGroupControl(sal_Bool
/*GroupControl*/) throw( RuntimeException
)
1110 DBG_ERROR("SAL_CALL SbaXFormAdapter::setGroupControl : not supported !");
1113 // -------------------------------------------------------------------------
1114 void SAL_CALL
SbaXFormAdapter::setControlModels(const Sequence
< Reference
< ::com::sun::star::awt::XControlModel
> >& /*Controls*/) throw( RuntimeException
)
1116 DBG_ERROR("SAL_CALL SbaXFormAdapter::setControlModels : not supported !");
1119 // -------------------------------------------------------------------------
1120 Sequence
< Reference
< ::com::sun::star::awt::XControlModel
> > SAL_CALL
SbaXFormAdapter::getControlModels() throw( RuntimeException
)
1122 DBG_ERROR("SAL_CALL SbaXFormAdapter::getControlModels : not supported !");
1123 return Sequence
< Reference
< ::com::sun::star::awt::XControlModel
> >();
1126 // -------------------------------------------------------------------------
1127 void SAL_CALL
SbaXFormAdapter::setGroup(const Sequence
< Reference
< ::com::sun::star::awt::XControlModel
> >& /*_rGroup*/, const ::rtl::OUString
& /*GroupName*/) throw( RuntimeException
)
1129 DBG_ERROR("SAL_CALL SbaXFormAdapter::setGroup : not supported !");
1132 // -------------------------------------------------------------------------
1133 sal_Int32 SAL_CALL
SbaXFormAdapter::getGroupCount() throw( RuntimeException
)
1135 DBG_ERROR("SAL_CALL SbaXFormAdapter::getGroupCount : not supported !");
1139 // -------------------------------------------------------------------------
1140 void SAL_CALL
SbaXFormAdapter::getGroup(sal_Int32
/*nGroup*/, Sequence
< Reference
< ::com::sun::star::awt::XControlModel
> >& /*_rGroup*/, ::rtl::OUString
& /*Name*/) throw( RuntimeException
)
1142 DBG_ERROR("SAL_CALL SbaXFormAdapter::getGroup : not supported !");
1145 // -------------------------------------------------------------------------
1146 void SAL_CALL
SbaXFormAdapter::getGroupByName(const ::rtl::OUString
& /*Name*/, Sequence
< Reference
< ::com::sun::star::awt::XControlModel
> >& /*_rGroup*/) throw( RuntimeException
)
1148 DBG_ERROR("SAL_CALL SbaXFormAdapter::getGroupByName : not supported !");
1151 // ::com::sun::star::lang::XComponent
1152 // -------------------------------------------------------------------------
1153 void SAL_CALL
SbaXFormAdapter::dispose() throw( RuntimeException
)
1155 // log off all multiplexers
1156 if (m_xMainForm
.is())
1159 ::com::sun::star::lang::EventObject
aEvt(*this);
1160 m_aLoadListeners
.disposeAndClear(aEvt
);
1161 m_aRowSetListeners
.disposeAndClear(aEvt
);
1162 m_aRowSetApproveListeners
.disposeAndClear(aEvt
);
1163 m_aErrorListeners
.disposeAndClear(aEvt
);
1164 m_aParameterListeners
.disposeAndClear(aEvt
);
1165 m_aSubmitListeners
.disposeAndClear(aEvt
);
1166 m_aResetListeners
.disposeAndClear(aEvt
);
1168 m_aVetoablePropertyChangeListeners
.disposeAndClear();
1169 m_aPropertyChangeListeners
.disposeAndClear();
1170 m_aPropertiesChangeListeners
.disposeAndClear(aEvt
);
1172 m_aDisposeListeners
.disposeAndClear(aEvt
);
1173 m_aContainerListeners
.disposeAndClear(aEvt
);
1175 // dispose all childs
1176 for ( ::std::vector
< Reference
< ::com::sun::star::form::XFormComponent
> >::iterator aIter
= m_aChildren
.begin();
1177 aIter
!= m_aChildren
.end();
1181 Reference
< ::com::sun::star::beans::XPropertySet
> xSet(*aIter
, UNO_QUERY
);
1183 xSet
->removePropertyChangeListener(PROPERTY_NAME
, (::com::sun::star::beans::XPropertyChangeListener
*)this);
1185 Reference
< ::com::sun::star::container::XChild
> xChild(*aIter
, UNO_QUERY
);
1187 xChild
->setParent(Reference
< XInterface
> ());
1189 Reference
< ::com::sun::star::lang::XComponent
> xComp(*aIter
, UNO_QUERY
);
1193 m_aChildren
.clear();
1196 // -------------------------------------------------------------------------
1197 void SAL_CALL
SbaXFormAdapter::addEventListener(const Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw( RuntimeException
)
1199 m_aDisposeListeners
.addInterface(xListener
);
1202 // -------------------------------------------------------------------------
1203 void SAL_CALL
SbaXFormAdapter::removeEventListener(const Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw( RuntimeException
)
1205 m_aDisposeListeners
.removeInterface(aListener
);
1208 // ::com::sun::star::beans::XFastPropertySet
1209 // -------------------------------------------------------------------------
1210 void SAL_CALL
SbaXFormAdapter::setFastPropertyValue(sal_Int32 nHandle
, const Any
& aValue
) throw( ::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1212 Reference
< ::com::sun::star::beans::XFastPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1213 DBG_ASSERT(xSet
.is(), "SAL_CALL SbaXFormAdapter::setFastPropertyValue : have no master form !");
1215 if (m_nNamePropHandle
== nHandle
)
1217 if (aValue
.getValueType().getTypeClass() != TypeClass_STRING
)
1219 throw ::com::sun::star::lang::IllegalArgumentException();
1222 // for notifying property listeners
1223 ::com::sun::star::beans::PropertyChangeEvent aEvt
;
1224 aEvt
.Source
= *this;
1225 aEvt
.PropertyName
= PROPERTY_NAME
;
1226 aEvt
.PropertyHandle
= m_nNamePropHandle
;
1227 aEvt
.OldValue
<<= m_sName
;
1228 aEvt
.NewValue
= aValue
;
1232 ::cppu::OInterfaceIteratorHelper
aIt(*m_aPropertyChangeListeners
.getContainer(PROPERTY_NAME
));
1233 while (aIt
.hasMoreElements())
1234 ((::com::sun::star::beans::XPropertyChangeListener
*)aIt
.next())->propertyChange(aEvt
);
1239 xSet
->setFastPropertyValue(nHandle
, aValue
);
1242 // -------------------------------------------------------------------------
1243 Any SAL_CALL
SbaXFormAdapter::getFastPropertyValue(sal_Int32 nHandle
) throw( ::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1245 Reference
< ::com::sun::star::beans::XFastPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1246 DBG_ASSERT(xSet
.is(), "SAL_CALL SbaXFormAdapter::getFastPropertyValue : have no master form !");
1248 if (m_nNamePropHandle
== nHandle
)
1249 return makeAny(m_sName
);
1251 return xSet
->getFastPropertyValue(nHandle
);
1254 // ::com::sun::star::container::XNamed
1255 // -------------------------------------------------------------------------
1256 ::rtl::OUString SAL_CALL
SbaXFormAdapter::getName() throw( RuntimeException
)
1258 return ::comphelper::getString(getPropertyValue(PROPERTY_NAME
));
1261 // -------------------------------------------------------------------------
1262 void SAL_CALL
SbaXFormAdapter::setName(const ::rtl::OUString
& aName
) throw( RuntimeException
)
1264 setPropertyValue(PROPERTY_NAME
, makeAny(aName
));
1267 // ::com::sun::star::io::XPersistObject
1268 // -------------------------------------------------------------------------
1269 ::rtl::OUString SAL_CALL
SbaXFormAdapter::getServiceName() throw( RuntimeException
)
1271 Reference
< ::com::sun::star::io::XPersistObject
> xPersist(m_xMainForm
, UNO_QUERY
);
1273 return xPersist
->getServiceName();
1274 return ::rtl::OUString();
1277 // -------------------------------------------------------------------------
1278 void SAL_CALL
SbaXFormAdapter::write(const Reference
< ::com::sun::star::io::XObjectOutputStream
>& _rxOutStream
) throw( ::com::sun::star::io::IOException
, RuntimeException
)
1280 Reference
< ::com::sun::star::io::XPersistObject
> xPersist(m_xMainForm
, UNO_QUERY
);
1282 xPersist
->write(_rxOutStream
);
1285 // -------------------------------------------------------------------------
1286 void SAL_CALL
SbaXFormAdapter::read(const Reference
< ::com::sun::star::io::XObjectInputStream
>& _rxInStream
) throw( ::com::sun::star::io::IOException
, RuntimeException
)
1288 Reference
< ::com::sun::star::io::XPersistObject
> xPersist(m_xMainForm
, UNO_QUERY
);
1290 xPersist
->read(_rxInStream
);
1293 // ::com::sun::star::beans::XMultiPropertySet
1294 // -------------------------------------------------------------------------
1295 Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
SbaXFormAdapter::getPropertySetInfo() throw( RuntimeException
)
1297 Reference
< ::com::sun::star::beans::XMultiPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1299 return Reference
< ::com::sun::star::beans::XPropertySetInfo
> ();
1301 Reference
< ::com::sun::star::beans::XPropertySetInfo
> xReturn
= xSet
->getPropertySetInfo();
1302 if (-1 == m_nNamePropHandle
)
1304 // we need to determine the handle for the NAME property
1305 Sequence
< ::com::sun::star::beans::Property
> aProps
= xReturn
->getProperties();
1306 const ::com::sun::star::beans::Property
* pProps
= aProps
.getConstArray();
1308 for (sal_Int32 i
=0; i
<aProps
.getLength(); ++i
, ++pProps
)
1310 if (pProps
->Name
.equals(PROPERTY_NAME
))
1312 ((SbaXFormAdapter
*)this)->m_nNamePropHandle
= pProps
->Handle
;
1320 // -------------------------------------------------------------------------
1321 void SAL_CALL
SbaXFormAdapter::setPropertyValues(const Sequence
< ::rtl::OUString
>& PropertyNames
, const Sequence
< Any
>& Values
) throw( ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1323 Reference
< ::com::sun::star::beans::XMultiPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1325 xSet
->setPropertyValues(PropertyNames
, Values
);
1328 // -------------------------------------------------------------------------
1329 Sequence
< Any
> SAL_CALL
SbaXFormAdapter::getPropertyValues(const Sequence
< ::rtl::OUString
>& aPropertyNames
) throw( RuntimeException
)
1331 Reference
< ::com::sun::star::beans::XMultiPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1333 return Sequence
< Any
>(aPropertyNames
.getLength());
1335 Sequence
< Any
> aReturn
= xSet
->getPropertyValues(aPropertyNames
);
1337 // search for (and fake) the NAME property
1338 const ::rtl::OUString
* pNames
= aPropertyNames
.getConstArray();
1339 Any
* pValues
= aReturn
.getArray();
1340 DBG_ASSERT(aReturn
.getLength() == aPropertyNames
.getLength(), "SAL_CALL SbaXFormAdapter::getPropertyValues : the main form returned an invalid-length sequence !");
1341 for (sal_Int32 i
=0; i
<aPropertyNames
.getLength(); ++i
, ++pNames
, ++pValues
)
1342 if (pNames
->equals(PROPERTY_NAME
))
1344 (*pValues
) <<= m_sName
;
1351 // -------------------------------------------------------------------------
1352 void SAL_CALL
SbaXFormAdapter::addPropertiesChangeListener(const Sequence
< ::rtl::OUString
>& /*aPropertyNames*/, const Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
) throw( RuntimeException
)
1354 // we completely ignore the property names, _all_ changes of _all_ properties will be forwarded to _all_ listeners
1355 m_aPropertiesChangeListeners
.addInterface(xListener
);
1356 if (m_aPropertiesChangeListeners
.getLength() == 1)
1358 Reference
< ::com::sun::star::beans::XMultiPropertySet
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
1359 ::rtl::OUString sEmpty
;
1360 if (xBroadcaster
.is())
1361 xBroadcaster
->addPropertiesChangeListener(Sequence
< ::rtl::OUString
>(&sEmpty
, 1), &m_aPropertiesChangeListeners
);
1365 // -------------------------------------------------------------------------
1366 void SAL_CALL
SbaXFormAdapter::removePropertiesChangeListener(const Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& Listener
) throw( RuntimeException
)
1368 if (m_aPropertiesChangeListeners
.getLength() == 1)
1370 Reference
< ::com::sun::star::beans::XMultiPropertySet
> xBroadcaster(m_xMainForm
, UNO_QUERY
);
1371 if (xBroadcaster
.is())
1372 xBroadcaster
->removePropertiesChangeListener(&m_aPropertiesChangeListeners
);
1374 m_aPropertiesChangeListeners
.removeInterface(Listener
);
1377 // -------------------------------------------------------------------------
1378 void SAL_CALL
SbaXFormAdapter::firePropertiesChangeEvent(const Sequence
< ::rtl::OUString
>& aPropertyNames
, const Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
) throw( RuntimeException
)
1380 Reference
< ::com::sun::star::beans::XMultiPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1382 xSet
->firePropertiesChangeEvent(aPropertyNames
, xListener
);
1386 // ::com::sun::star::beans::XPropertySet
1387 // -------------------------------------------------------------------------
1388 void SAL_CALL
SbaXFormAdapter::setPropertyValue(const ::rtl::OUString
& aPropertyName
, const Any
& aValue
) throw( ::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1390 Reference
< ::com::sun::star::beans::XPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1394 // special handling for the "name" property
1395 if (aPropertyName
.equals(PROPERTY_NAME
))
1396 setFastPropertyValue(m_nNamePropHandle
, aValue
);
1398 xSet
->setPropertyValue(aPropertyName
, aValue
);
1401 // -------------------------------------------------------------------------
1402 Any SAL_CALL
SbaXFormAdapter::getPropertyValue(const ::rtl::OUString
& PropertyName
) throw( ::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1404 Reference
< ::com::sun::star::beans::XPropertySet
> xSet(m_xMainForm
, UNO_QUERY
);
1408 // special handling for the "name" property
1409 if (PropertyName
.equals(PROPERTY_NAME
))
1410 return getFastPropertyValue(m_nNamePropHandle
);
1412 return xSet
->getPropertyValue(PropertyName
);
1415 IMPLEMENT_PROPERTY_LISTENER_ADMINISTRATION(SbaXFormAdapter
, PropertyChangeListener
, m_aPropertyChangeListeners
, ::com::sun::star::beans::XPropertySet
, m_xMainForm
);
1416 IMPLEMENT_PROPERTY_LISTENER_ADMINISTRATION(SbaXFormAdapter
, VetoableChangeListener
, m_aVetoablePropertyChangeListeners
, ::com::sun::star::beans::XPropertySet
, m_xMainForm
);
1418 // ::com::sun::star::util::XCancellable
1419 // -------------------------------------------------------------------------
1420 void SAL_CALL
SbaXFormAdapter::cancel() throw( RuntimeException
)
1422 Reference
< ::com::sun::star::util::XCancellable
> xCancel(m_xMainForm
, UNO_QUERY
);
1428 // ::com::sun::star::beans::XPropertyState
1429 // -------------------------------------------------------------------------
1430 ::com::sun::star::beans::PropertyState SAL_CALL
SbaXFormAdapter::getPropertyState(const ::rtl::OUString
& PropertyName
) throw( ::com::sun::star::beans::UnknownPropertyException
, RuntimeException
)
1432 Reference
< ::com::sun::star::beans::XPropertyState
> xState(m_xMainForm
, UNO_QUERY
);
1434 return xState
->getPropertyState(PropertyName
);
1435 return ::com::sun::star::beans::PropertyState_DEFAULT_VALUE
;
1438 // -------------------------------------------------------------------------
1439 Sequence
< ::com::sun::star::beans::PropertyState
> SAL_CALL
SbaXFormAdapter::getPropertyStates(const Sequence
< ::rtl::OUString
>& aPropertyName
) throw( ::com::sun::star::beans::UnknownPropertyException
, RuntimeException
)
1441 Reference
< ::com::sun::star::beans::XPropertyState
> xState(m_xMainForm
, UNO_QUERY
);
1443 return xState
->getPropertyStates(aPropertyName
);
1445 // set them all to DEFAULT
1446 Sequence
< ::com::sun::star::beans::PropertyState
> aReturn(aPropertyName
.getLength());
1447 ::com::sun::star::beans::PropertyState
* pStates
= aReturn
.getArray();
1448 for (sal_uInt16 i
=0; i
<aPropertyName
.getLength(); ++i
, ++pStates
)
1449 *pStates
= ::com::sun::star::beans::PropertyState_DEFAULT_VALUE
;
1453 // -------------------------------------------------------------------------
1454 void SAL_CALL
SbaXFormAdapter::setPropertyToDefault(const ::rtl::OUString
& PropertyName
) throw( ::com::sun::star::beans::UnknownPropertyException
, RuntimeException
)
1456 Reference
< ::com::sun::star::beans::XPropertyState
> xState(m_xMainForm
, UNO_QUERY
);
1458 xState
->setPropertyToDefault(PropertyName
);
1461 // -------------------------------------------------------------------------
1462 Any SAL_CALL
SbaXFormAdapter::getPropertyDefault(const ::rtl::OUString
& aPropertyName
) throw( ::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1464 Reference
< ::com::sun::star::beans::XPropertyState
> xState(m_xMainForm
, UNO_QUERY
);
1466 return xState
->getPropertyDefault(aPropertyName
);
1470 // ::com::sun::star::form::XReset
1471 // -------------------------------------------------------------------------
1472 void SAL_CALL
SbaXFormAdapter::reset() throw( RuntimeException
)
1474 Reference
< ::com::sun::star::form::XReset
> xReset(m_xMainForm
, UNO_QUERY
);
1479 IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter
, form
, ResetListener
, m_aResetListeners
, ::com::sun::star::form::XReset
, m_xMainForm
)
1481 // ::com::sun::star::container::XNameContainer
1482 // -------------------------------------------------------------------------
1483 void SbaXFormAdapter::implInsert(const Any
& aElement
, sal_Int32 nIndex
, const ::rtl::OUString
* pNewElName
) throw( ::com::sun::star::lang::IllegalArgumentException
)
1485 // extract the form component
1486 if (aElement
.getValueType().getTypeClass() != TypeClass_INTERFACE
)
1488 throw ::com::sun::star::lang::IllegalArgumentException();
1491 Reference
< ::com::sun::star::form::XFormComponent
> xElement(*(Reference
< XInterface
> *)aElement
.getValue(), UNO_QUERY
);
1494 throw ::com::sun::star::lang::IllegalArgumentException();
1497 // for the name we need the propset
1498 Reference
< ::com::sun::star::beans::XPropertySet
> xElementSet(xElement
, UNO_QUERY
);
1499 if (!xElementSet
.is())
1501 throw ::com::sun::star::lang::IllegalArgumentException();
1503 ::rtl::OUString sName
;
1507 xElementSet
->setPropertyValue(PROPERTY_NAME
, makeAny(*pNewElName
));
1509 xElementSet
->getPropertyValue(PROPERTY_NAME
) >>= sName
;
1513 // the set didn't support the name prop
1514 throw ::com::sun::star::lang::IllegalArgumentException();
1518 OSL_ASSERT(nIndex
>= 0);
1519 if (sal::static_int_cast
< sal_uInt32
>(nIndex
) > m_aChildren
.size())
1520 nIndex
= m_aChildren
.size();
1522 DBG_ASSERT(m_aChildren
.size() == m_aChildNames
.size(), "SAL_CALL SbaXFormAdapter::implInsert : inconsistent container state !");
1523 m_aChildren
.insert(m_aChildren
.begin() + nIndex
, xElement
);
1524 m_aChildNames
.insert(m_aChildNames
.begin() + nIndex
, sName
);
1526 // listen for a changes of the name
1527 xElementSet
->addPropertyChangeListener(PROPERTY_NAME
, (::com::sun::star::beans::XPropertyChangeListener
*)this);
1529 // we are now the parent of the new element
1530 xElement
->setParent((::com::sun::star::container::XContainer
*)this);
1532 // notify the container listeners
1533 ::com::sun::star::container::ContainerEvent aEvt
;
1534 aEvt
.Source
= *this;
1535 aEvt
.Accessor
<<= nIndex
;
1536 aEvt
.Element
<<= xElement
;
1537 ::cppu::OInterfaceIteratorHelper
aIt(m_aContainerListeners
);
1538 while (aIt
.hasMoreElements())
1539 ((::com::sun::star::container::XContainerListener
*)aIt
.next())->elementInserted(aEvt
);
1542 // -------------------------------------------------------------------------
1543 sal_Int32
SbaXFormAdapter::implGetPos(const ::rtl::OUString
& rName
)
1545 ::std::vector
< ::rtl::OUString
>::iterator aIter
= ::std::find_if( m_aChildNames
.begin(),
1546 m_aChildNames
.end(),
1547 ::std::bind2nd(::std::equal_to
< rtl::OUString
>(),rName
));
1549 if(aIter
!= m_aChildNames
.end())
1550 return aIter
- m_aChildNames
.begin();
1555 // -------------------------------------------------------------------------
1556 void SAL_CALL
SbaXFormAdapter::insertByName(const ::rtl::OUString
& aName
, const Any
& aElement
) throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::container::ElementExistException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1558 implInsert(aElement
, m_aChildren
.size(), &aName
);
1561 // -------------------------------------------------------------------------
1562 void SAL_CALL
SbaXFormAdapter::removeByName(const ::rtl::OUString
& Name
) throw( ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1564 sal_Int32 nPos
= implGetPos(Name
);
1567 throw ::com::sun::star::container::NoSuchElementException();
1569 removeByIndex(nPos
);
1572 // ::com::sun::star::container::XNameReplace
1573 // -------------------------------------------------------------------------
1574 void SAL_CALL
SbaXFormAdapter::replaceByName(const ::rtl::OUString
& aName
, const Any
& aElement
) throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1576 sal_Int32 nPos
= implGetPos(aName
);
1579 throw ::com::sun::star::container::NoSuchElementException();
1581 replaceByIndex(nPos
, aElement
);
1584 // ::com::sun::star::container::XNameAccess
1585 // -------------------------------------------------------------------------
1586 Any SAL_CALL
SbaXFormAdapter::getByName(const ::rtl::OUString
& aName
) throw( ::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1588 sal_Int32 nPos
= implGetPos(aName
);
1591 throw ::com::sun::star::container::NoSuchElementException();
1593 return makeAny(m_aChildren
[nPos
]);
1596 // -------------------------------------------------------------------------
1597 Sequence
< ::rtl::OUString
> SAL_CALL
SbaXFormAdapter::getElementNames() throw( RuntimeException
)
1599 ::rtl::OUString
*pChildNames
= m_aChildNames
.empty() ? 0 : &m_aChildNames
[0];
1600 return Sequence
< ::rtl::OUString
>(pChildNames
, m_aChildNames
.size());
1603 // -------------------------------------------------------------------------
1604 sal_Bool SAL_CALL
SbaXFormAdapter::hasByName(const ::rtl::OUString
& aName
) throw( RuntimeException
)
1606 return (-1 != implGetPos(aName
));
1609 // ::com::sun::star::container::XElementAccess
1610 // -------------------------------------------------------------------------
1611 Type SAL_CALL
SbaXFormAdapter::getElementType() throw(RuntimeException
)
1613 return ::getCppuType(
1614 static_cast< Reference
< ::com::sun::star::form::XFormComponent
>* >(NULL
));
1617 // -------------------------------------------------------------------------
1618 sal_Bool SAL_CALL
SbaXFormAdapter::hasElements() throw(RuntimeException
)
1620 return m_aChildren
.size() > 0;
1624 // ::com::sun::star::container::XIndexContainer
1625 // -------------------------------------------------------------------------
1626 void SAL_CALL
SbaXFormAdapter::insertByIndex(sal_Int32 _rIndex
, const Any
& Element
) throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1628 if ( ( _rIndex
< 0 ) || ( (size_t)_rIndex
>= m_aChildren
.size() ) )
1629 throw ::com::sun::star::lang::IndexOutOfBoundsException();
1630 implInsert(Element
, _rIndex
);
1633 // -------------------------------------------------------------------------
1634 void SAL_CALL
SbaXFormAdapter::removeByIndex(sal_Int32 _rIndex
) throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1636 if ( ( _rIndex
< 0 ) || ( (size_t)_rIndex
>= m_aChildren
.size() ) )
1637 throw ::com::sun::star::lang::IndexOutOfBoundsException();
1639 Reference
< ::com::sun::star::form::XFormComponent
> xAffected
= *(m_aChildren
.begin() + _rIndex
);
1641 DBG_ASSERT(m_aChildren
.size() == m_aChildNames
.size(), "SAL_CALL SbaXFormAdapter::removeByIndex : inconsistent container state !");
1642 m_aChildren
.erase(m_aChildren
.begin() + _rIndex
);
1643 m_aChildNames
.erase(m_aChildNames
.begin() + _rIndex
);
1645 // no need to listen anymore
1646 Reference
< ::com::sun::star::beans::XPropertySet
> xAffectedSet(xAffected
, UNO_QUERY
);
1647 xAffectedSet
->removePropertyChangeListener(PROPERTY_NAME
, (::com::sun::star::beans::XPropertyChangeListener
*)this);
1649 // we are no longer the parent
1650 xAffected
->setParent(Reference
< XInterface
> ());
1652 // notify container listeners
1653 ::com::sun::star::container::ContainerEvent aEvt
;
1654 aEvt
.Source
= *this;
1655 aEvt
.Element
<<= xAffected
;
1656 ::cppu::OInterfaceIteratorHelper
aIt(m_aContainerListeners
);
1657 while (aIt
.hasMoreElements())
1658 ((::com::sun::star::container::XContainerListener
*)aIt
.next())->elementRemoved(aEvt
);
1662 // ::com::sun::star::container::XIndexReplace
1663 // -------------------------------------------------------------------------
1664 void SAL_CALL
SbaXFormAdapter::replaceByIndex(sal_Int32 _rIndex
, const Any
& Element
) throw( ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1666 if ( ( _rIndex
< 0 ) || ( (size_t)_rIndex
>= m_aChildren
.size() ) )
1667 throw ::com::sun::star::lang::IndexOutOfBoundsException();
1669 // extract the form component
1670 if (Element
.getValueType().getTypeClass() != TypeClass_INTERFACE
)
1672 throw ::com::sun::star::lang::IllegalArgumentException();
1675 Reference
< ::com::sun::star::form::XFormComponent
> xElement(*(Reference
< XInterface
> *)Element
.getValue(), UNO_QUERY
);
1678 throw ::com::sun::star::lang::IllegalArgumentException();
1681 // for the name we need the propset
1682 Reference
< ::com::sun::star::beans::XPropertySet
> xElementSet(xElement
, UNO_QUERY
);
1683 if (!xElementSet
.is())
1685 throw ::com::sun::star::lang::IllegalArgumentException();
1687 ::rtl::OUString sName
;
1690 xElementSet
->getPropertyValue(PROPERTY_NAME
) >>= sName
;
1694 // the set didn't support the name prop
1695 throw ::com::sun::star::lang::IllegalArgumentException();
1698 Reference
< ::com::sun::star::form::XFormComponent
> xOld
= *(m_aChildren
.begin() + _rIndex
);
1700 DBG_ASSERT(m_aChildren
.size() == m_aChildNames
.size(), "SAL_CALL SbaXFormAdapter::replaceByIndex : inconsistent container state !");
1701 *(m_aChildren
.begin() + _rIndex
) = xElement
;
1702 *(m_aChildNames
.begin() + _rIndex
) = sName
;
1704 // correct property change listening
1705 Reference
< ::com::sun::star::beans::XPropertySet
> xOldSet(xOld
, UNO_QUERY
);
1706 xOldSet
->removePropertyChangeListener(PROPERTY_NAME
, (::com::sun::star::beans::XPropertyChangeListener
*)this);
1707 xElementSet
->addPropertyChangeListener(PROPERTY_NAME
, (::com::sun::star::beans::XPropertyChangeListener
*)this);
1710 xOld
->setParent(Reference
< XInterface
> ());
1711 xElement
->setParent((::com::sun::star::container::XContainer
*)this);
1713 // notify container listeners
1714 ::com::sun::star::container::ContainerEvent aEvt
;
1715 aEvt
.Source
= *this;
1716 aEvt
.Accessor
<<= (sal_Int32
)_rIndex
;
1717 aEvt
.Element
<<= xElement
;
1718 aEvt
.ReplacedElement
<<= xOld
;
1720 ::cppu::OInterfaceIteratorHelper
aIt(m_aContainerListeners
);
1721 while (aIt
.hasMoreElements())
1722 ((::com::sun::star::container::XContainerListener
*)aIt
.next())->elementReplaced(aEvt
);
1725 // ::com::sun::star::container::XIndexAccess
1726 // -------------------------------------------------------------------------
1727 sal_Int32 SAL_CALL
SbaXFormAdapter::getCount() throw( RuntimeException
)
1729 return m_aChildren
.size();
1732 // -------------------------------------------------------------------------
1733 Any SAL_CALL
SbaXFormAdapter::getByIndex(sal_Int32 _rIndex
) throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, RuntimeException
)
1735 if ( ( _rIndex
< 0 ) || ( (size_t)_rIndex
>= m_aChildren
.size() ) )
1736 throw ::com::sun::star::lang::IndexOutOfBoundsException();
1738 Reference
< ::com::sun::star::form::XFormComponent
> xElement
= *(m_aChildren
.begin() + _rIndex
);
1739 return makeAny(xElement
);
1742 // ::com::sun::star::container::XContainer
1743 // -------------------------------------------------------------------------
1744 void SAL_CALL
SbaXFormAdapter::addContainerListener(const Reference
< ::com::sun::star::container::XContainerListener
>& xListener
) throw( RuntimeException
)
1746 m_aContainerListeners
.addInterface(xListener
);
1749 // -------------------------------------------------------------------------
1750 void SAL_CALL
SbaXFormAdapter::removeContainerListener(const Reference
< ::com::sun::star::container::XContainerListener
>& xListener
) throw( RuntimeException
)
1752 m_aContainerListeners
.removeInterface(xListener
);
1755 // ::com::sun::star::container::XEnumerationAccess
1756 // -------------------------------------------------------------------------
1757 Reference
< ::com::sun::star::container::XEnumeration
> SAL_CALL
SbaXFormAdapter::createEnumeration() throw( RuntimeException
)
1759 return new ::comphelper::OEnumerationByName(this);
1762 // ::com::sun::star::beans::XPropertyChangeListener
1763 // -------------------------------------------------------------------------
1764 void SAL_CALL
SbaXFormAdapter::propertyChange(const ::com::sun::star::beans::PropertyChangeEvent
& evt
) throw( RuntimeException
)
1766 if (evt
.PropertyName
.equals(PROPERTY_NAME
))
1768 ::std::vector
< ::com::sun::star::uno::Reference
< ::com::sun::star::form::XFormComponent
> >::iterator aIter
= ::std::find_if( m_aChildren
.begin(),
1770 ::std::bind2nd(::std::equal_to
< ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> >(),evt
.Source
));
1772 if(aIter
!= m_aChildren
.end())
1774 sal_Int32 nPos
= aIter
- m_aChildren
.begin();
1775 DBG_ASSERT(*(m_aChildNames
.begin() + nPos
) == ::comphelper::getString(evt
.OldValue
), "SAL_CALL SbaXFormAdapter::propertyChange : object has a wrong name !");
1776 *(m_aChildNames
.begin() + nPos
) = ::comphelper::getString(evt
.NewValue
);
1781 // ::com::sun::star::lang::XEventListener
1782 // -------------------------------------------------------------------------
1783 void SAL_CALL
SbaXFormAdapter::disposing(const ::com::sun::star::lang::EventObject
& Source
) throw( RuntimeException
)
1785 // was it our main form ?
1786 if (Source
.Source
== m_xMainForm
)
1789 ::std::vector
< ::com::sun::star::uno::Reference
< ::com::sun::star::form::XFormComponent
> >::iterator aIter
= ::std::find_if( m_aChildren
.begin(),
1791 ::std::bind2nd(::std::equal_to
< ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> >(),Source
.Source
));
1792 if(aIter
!= m_aChildren
.end())
1793 removeByIndex(aIter
- m_aChildren
.begin());
1795 // -----------------------------------------------------------------------------