LCOV - code coverage report
Current view: top level - dbaccess/source/ui/browser - formadapter.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 948 0.0 %
Date: 2014-11-03 Functions: 0 185 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "formadapter.hxx"
      21             : #include <tools/debug.hxx>
      22             : #include <osl/diagnose.h>
      23             : #include <comphelper/types.hxx>
      24             : #include <comphelper/enumhelper.hxx>
      25             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      26             : #include "dbu_brw.hrc"
      27             : #include "dbustrings.hrc"
      28             : #include <connectivity/dbexception.hxx>
      29             : #include <cppuhelper/typeprovider.hxx>
      30             : #include <comphelper/sequence.hxx>
      31             : 
      32             : using namespace dbaui;
      33             : using namespace ::com::sun::star::uno;
      34             : using namespace ::com::sun::star::sdb;
      35             : using namespace ::com::sun::star::sdbcx;
      36             : using namespace ::com::sun::star::beans;
      37             : using namespace ::com::sun::star::container;
      38             : 
      39             : // SbaXFormAdapter
      40             : 
      41           0 : SbaXFormAdapter::SbaXFormAdapter()
      42             :             :m_aLoadListeners(*this, m_aMutex)
      43             :             ,m_aRowSetListeners(*this, m_aMutex)
      44             :             ,m_aRowSetApproveListeners(*this, m_aMutex)
      45             :             ,m_aErrorListeners(*this, m_aMutex)
      46             :             ,m_aParameterListeners(*this, m_aMutex)
      47             :             ,m_aSubmitListeners(*this, m_aMutex)
      48             :             ,m_aResetListeners(*this, m_aMutex)
      49             :             ,m_aPropertyChangeListeners(*this, m_aMutex)
      50             :             ,m_aVetoablePropertyChangeListeners(*this, m_aMutex)
      51             :             ,m_aPropertiesChangeListeners(*this, m_aMutex)
      52             :             ,m_aDisposeListeners(m_aMutex)
      53             :             ,m_aContainerListeners(m_aMutex)
      54           0 :             ,m_nNamePropHandle(-1)
      55             : {
      56             : 
      57           0 : }
      58             : 
      59           0 : SbaXFormAdapter::~SbaXFormAdapter()
      60             : {
      61             : 
      62           0 : }
      63             : 
      64           0 : Sequence< Type > SAL_CALL SbaXFormAdapter::getTypes(  ) throw (RuntimeException, std::exception)
      65             : {
      66             :     return ::comphelper::concatSequences(
      67             :         SbaXFormAdapter_BASE1::getTypes(),
      68             :         SbaXFormAdapter_BASE2::getTypes(),
      69             :         SbaXFormAdapter_BASE3::getTypes()
      70           0 :     );
      71             : }
      72             : 
      73           0 : Sequence< sal_Int8 > SAL_CALL SbaXFormAdapter::getImplementationId(  ) throw (RuntimeException, std::exception)
      74             : {
      75           0 :     return css::uno::Sequence<sal_Int8>();
      76             : }
      77             : 
      78           0 : Any SAL_CALL SbaXFormAdapter::queryInterface(const Type& _rType) throw (RuntimeException, std::exception)
      79             : {
      80           0 :     Any aReturn = SbaXFormAdapter_BASE1::queryInterface( _rType );
      81             : 
      82           0 :     if (!aReturn.hasValue())
      83           0 :         aReturn = SbaXFormAdapter_BASE2::queryInterface( _rType );
      84             : 
      85           0 :     if (!aReturn.hasValue())
      86           0 :         aReturn = SbaXFormAdapter_BASE3::queryInterface( _rType );
      87             : 
      88           0 :     return aReturn;
      89             : }
      90             : 
      91           0 : void SbaXFormAdapter::StopListening()
      92             : {
      93             :     // log off all our multiplexers
      94           0 :     STOP_MULTIPLEXER_LISTENING(LoadListener, m_aLoadListeners, ::com::sun::star::form::XLoadable, m_xMainForm);
      95           0 :     STOP_MULTIPLEXER_LISTENING(RowSetListener, m_aRowSetListeners, ::com::sun::star::sdbc::XRowSet, m_xMainForm);
      96           0 :     STOP_MULTIPLEXER_LISTENING(RowSetApproveListener, m_aRowSetApproveListeners, ::com::sun::star::sdb::XRowSetApproveBroadcaster, m_xMainForm);
      97           0 :     STOP_MULTIPLEXER_LISTENING(SQLErrorListener, m_aErrorListeners, ::com::sun::star::sdb::XSQLErrorBroadcaster, m_xMainForm);
      98           0 :     STOP_MULTIPLEXER_LISTENING(SubmitListener, m_aSubmitListeners, ::com::sun::star::form::XSubmit, m_xMainForm);
      99           0 :     STOP_MULTIPLEXER_LISTENING(ResetListener, m_aResetListeners, ::com::sun::star::form::XReset, m_xMainForm);
     100             : 
     101           0 :     if (m_aParameterListeners.getLength())
     102             :     {
     103           0 :         Reference< ::com::sun::star::form::XDatabaseParameterBroadcaster >  xBroadcaster(m_xMainForm, UNO_QUERY);
     104           0 :         if (xBroadcaster.is())
     105           0 :             xBroadcaster->removeParameterListener(&m_aParameterListeners);
     106             :     }
     107             : 
     108           0 :     STOP_PROPERTY_MULTIPLEXER_LISTENING(PropertyChangeListener, m_aPropertyChangeListeners, ::com::sun::star::beans::XPropertySet, m_xMainForm);
     109           0 :     STOP_PROPERTY_MULTIPLEXER_LISTENING(VetoableChangeListener, m_aVetoablePropertyChangeListeners, ::com::sun::star::beans::XPropertySet, m_xMainForm);
     110           0 :     if (m_aPropertiesChangeListeners.getLength())
     111             :     {
     112           0 :         Reference< ::com::sun::star::beans::XMultiPropertySet >  xBroadcaster(m_xMainForm, UNO_QUERY);
     113           0 :         if (xBroadcaster.is())
     114           0 :             xBroadcaster->removePropertiesChangeListener(&m_aPropertiesChangeListeners);
     115             :     }
     116             : 
     117             :     // log off ourself
     118           0 :     Reference< ::com::sun::star::lang::XComponent >  xComp(m_xMainForm, UNO_QUERY);
     119           0 :     if (xComp.is())
     120           0 :         xComp->removeEventListener((::com::sun::star::lang::XEventListener*)(::com::sun::star::beans::XPropertyChangeListener*)this);
     121           0 : }
     122             : 
     123           0 : void SbaXFormAdapter::StartListening()
     124             : {
     125             :     // log off all our multiplexers
     126           0 :     START_MULTIPLEXER_LISTENING(LoadListener, m_aLoadListeners, ::com::sun::star::form::XLoadable, m_xMainForm);
     127           0 :     START_MULTIPLEXER_LISTENING(RowSetListener, m_aRowSetListeners, ::com::sun::star::sdbc::XRowSet, m_xMainForm);
     128           0 :     START_MULTIPLEXER_LISTENING(RowSetApproveListener, m_aRowSetApproveListeners, ::com::sun::star::sdb::XRowSetApproveBroadcaster, m_xMainForm);
     129           0 :     START_MULTIPLEXER_LISTENING(SQLErrorListener, m_aErrorListeners, ::com::sun::star::sdb::XSQLErrorBroadcaster, m_xMainForm);
     130           0 :     START_MULTIPLEXER_LISTENING(SubmitListener, m_aSubmitListeners, ::com::sun::star::form::XSubmit, m_xMainForm);
     131           0 :     START_MULTIPLEXER_LISTENING(ResetListener, m_aResetListeners, ::com::sun::star::form::XReset, m_xMainForm);
     132             : 
     133           0 :     if (m_aParameterListeners.getLength())
     134             :     {
     135           0 :         Reference< ::com::sun::star::form::XDatabaseParameterBroadcaster >  xBroadcaster(m_xMainForm, UNO_QUERY);
     136           0 :         if (xBroadcaster.is())
     137           0 :             xBroadcaster->addParameterListener(&m_aParameterListeners);
     138             :     }
     139             : 
     140           0 :     START_PROPERTY_MULTIPLEXER_LISTENING(PropertyChangeListener, m_aPropertyChangeListeners, ::com::sun::star::beans::XPropertySet, m_xMainForm);
     141           0 :     START_PROPERTY_MULTIPLEXER_LISTENING(VetoableChangeListener, m_aVetoablePropertyChangeListeners, ::com::sun::star::beans::XPropertySet, m_xMainForm);
     142           0 :     if (m_aPropertiesChangeListeners.getLength())
     143             :     {
     144           0 :         Reference< ::com::sun::star::beans::XMultiPropertySet >  xBroadcaster(m_xMainForm, UNO_QUERY);
     145           0 :         OUString sEmpty;
     146           0 :         if (xBroadcaster.is())
     147           0 :             xBroadcaster->addPropertiesChangeListener(::comphelper::StringSequence(&sEmpty, 1), &m_aPropertiesChangeListeners);
     148             :     }
     149             : 
     150             :     // log off ourself
     151           0 :     Reference< ::com::sun::star::lang::XComponent >  xComp(m_xMainForm, UNO_QUERY);
     152           0 :     if (xComp.is())
     153           0 :         xComp->addEventListener((::com::sun::star::lang::XEventListener*)(::com::sun::star::beans::XPropertyChangeListener*)this);
     154           0 : }
     155             : 
     156           0 : void SbaXFormAdapter::AttachForm(const Reference< ::com::sun::star::sdbc::XRowSet >& xNewMaster)
     157             : {
     158           0 :     if (xNewMaster == m_xMainForm)
     159           0 :         return;
     160             : 
     161             :     OSL_ENSURE(xNewMaster.get() != static_cast< ::com::sun::star::sdbc::XRowSet* >(this), "SbaXFormAdapter::AttachForm : invalid argument !");
     162             : 
     163           0 :     if (m_xMainForm.is())
     164             :     {
     165           0 :         StopListening();
     166             : 
     167             :         // if our old master is loaded we have to send an 'unloaded' event
     168           0 :         Reference< ::com::sun::star::form::XLoadable >  xLoadable(m_xMainForm, UNO_QUERY);
     169           0 :         if (xLoadable->isLoaded())
     170             :         {
     171           0 :             ::com::sun::star::lang::EventObject aEvt(*this);
     172           0 :             ::cppu::OInterfaceIteratorHelper aIt(m_aLoadListeners);
     173           0 :             while (aIt.hasMoreElements())
     174           0 :                 static_cast< ::com::sun::star::form::XLoadListener*>(aIt.next())->unloaded(aEvt);
     175           0 :         }
     176             :     }
     177             : 
     178           0 :     m_xMainForm = xNewMaster;
     179             : 
     180           0 :     if (m_xMainForm.is())
     181             :     {
     182           0 :         StartListening();
     183             : 
     184             :         // if our new master is loaded we have to send an 'loaded' event
     185           0 :         Reference< ::com::sun::star::form::XLoadable >  xLoadable(m_xMainForm, UNO_QUERY);
     186           0 :         if (xLoadable->isLoaded())
     187             :         {
     188           0 :             ::com::sun::star::lang::EventObject aEvt(*this);
     189           0 :             ::cppu::OInterfaceIteratorHelper aIt(m_aLoadListeners);
     190           0 :             while (aIt.hasMoreElements())
     191           0 :                 static_cast< ::com::sun::star::form::XLoadListener*>(aIt.next())->loaded(aEvt);
     192           0 :         }
     193             :     }
     194             : 
     195             :     // TODO : perhaps _all_ of our listeners should be notified about our new state
     196             :     // (nearly every aspect of us may have changed with new master form)
     197             : }
     198             : 
     199             : // ::com::sun::star::sdbc::XCloseable
     200           0 : void SAL_CALL SbaXFormAdapter::close() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     201             : {
     202           0 :     Reference< ::com::sun::star::sdbc::XCloseable >  xIface(m_xMainForm, UNO_QUERY);
     203           0 :     if (xIface.is())
     204           0 :         xIface->close();
     205           0 : }
     206             : 
     207             : // ::com::sun::star::sdbc::XResultSetMetaDataSupplier
     208           0 : Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL SbaXFormAdapter::getMetaData() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     209             : {
     210           0 :     Reference< ::com::sun::star::sdbc::XResultSetMetaDataSupplier >  xIface(m_xMainForm, UNO_QUERY);
     211           0 :     if (xIface.is())
     212           0 :         return xIface->getMetaData();
     213           0 :     return Reference< ::com::sun::star::sdbc::XResultSetMetaData > ();
     214             : }
     215             : 
     216             : // ::com::sun::star::sdbc::XColumnLocate
     217           0 : sal_Int32 SAL_CALL SbaXFormAdapter::findColumn(const OUString& columnName) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     218             : {
     219           0 :     Reference< ::com::sun::star::sdbc::XColumnLocate >  xIface(m_xMainForm, UNO_QUERY);
     220           0 :     if (xIface.is())
     221           0 :         return xIface->findColumn(columnName);
     222             : 
     223           0 :     ::dbtools::throwInvalidColumnException( columnName, *this );
     224             :     assert(false);
     225           0 :     return 0; // Never reached
     226             : }
     227             : 
     228             : // ::com::sun::star::sdbcx::XColumnsSupplier
     229           0 : Reference< ::com::sun::star::container::XNameAccess > SAL_CALL SbaXFormAdapter::getColumns() throw( RuntimeException, std::exception )
     230             : {
     231           0 :     Reference< ::com::sun::star::sdbcx::XColumnsSupplier >  xIface(m_xMainForm, UNO_QUERY);
     232           0 :     if (xIface.is())
     233           0 :         return xIface->getColumns();
     234           0 :     return Reference< ::com::sun::star::container::XNameAccess > ();
     235             : }
     236             : 
     237             : // ::com::sun::star::sdbc::XRow
     238           0 : sal_Bool SAL_CALL SbaXFormAdapter::wasNull() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     239             : {
     240           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     241           0 :     if (xIface.is())
     242           0 :         return xIface->wasNull();
     243           0 :     return sal_True;
     244             : }
     245             : 
     246           0 : OUString SAL_CALL SbaXFormAdapter::getString(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     247             : {
     248           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     249           0 :     if (xIface.is())
     250           0 :         return xIface->getString(columnIndex);
     251           0 :     return OUString();
     252             : }
     253             : 
     254           0 : sal_Bool SAL_CALL SbaXFormAdapter::getBoolean(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     255             : {
     256           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     257           0 :     if (xIface.is())
     258           0 :         return xIface->getBoolean(columnIndex);
     259           0 :     return sal_False;
     260             : }
     261             : 
     262           0 : sal_Int8 SAL_CALL SbaXFormAdapter::getByte(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     263             : 
     264             : {
     265           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     266           0 :     if (xIface.is())
     267           0 :         return xIface->getByte(columnIndex);
     268           0 :     return 0;
     269             : }
     270             : 
     271           0 : sal_Int16 SAL_CALL SbaXFormAdapter::getShort(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     272             : {
     273           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     274           0 :     if (xIface.is())
     275           0 :         return xIface->getShort(columnIndex);
     276           0 :     return 0;
     277             : }
     278             : 
     279           0 : sal_Int32 SAL_CALL SbaXFormAdapter::getInt(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     280             : {
     281           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     282           0 :     if (xIface.is())
     283           0 :         return xIface->getInt(columnIndex);
     284           0 :     return 0;
     285             : }
     286             : 
     287           0 : sal_Int64 SAL_CALL SbaXFormAdapter::getLong(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     288             : {
     289           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     290           0 :     if (xIface.is())
     291           0 :         return xIface->getLong(columnIndex);
     292           0 :     return 0;
     293             : }
     294             : 
     295           0 : float SAL_CALL SbaXFormAdapter::getFloat(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     296             : {
     297           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     298           0 :     if (xIface.is())
     299           0 :         return xIface->getFloat(columnIndex);
     300           0 :     return 0.0;
     301             : }
     302             : 
     303           0 : double SAL_CALL SbaXFormAdapter::getDouble(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     304             : {
     305           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     306           0 :     if (xIface.is())
     307           0 :         return xIface->getDouble(columnIndex);
     308           0 :     return 0.0;
     309             : }
     310             : 
     311           0 : Sequence< sal_Int8 > SAL_CALL SbaXFormAdapter::getBytes(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     312             : {
     313           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     314           0 :     if (xIface.is())
     315           0 :         return xIface->getBytes(columnIndex);
     316           0 :     return Sequence <sal_Int8> ();
     317             : }
     318             : 
     319           0 : ::com::sun::star::util::Date SAL_CALL SbaXFormAdapter::getDate(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     320             : {
     321           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     322           0 :     if (xIface.is())
     323           0 :         return xIface->getDate(columnIndex);
     324           0 :     return ::com::sun::star::util::Date();
     325             : }
     326             : 
     327           0 : ::com::sun::star::util::Time SAL_CALL SbaXFormAdapter::getTime(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     328             : {
     329           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     330           0 :     if (xIface.is())
     331           0 :         return xIface->getTime(columnIndex);
     332           0 :     return ::com::sun::star::util::Time();
     333             : }
     334             : 
     335           0 : ::com::sun::star::util::DateTime SAL_CALL SbaXFormAdapter::getTimestamp(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     336             : {
     337           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     338           0 :     if (xIface.is())
     339           0 :         return xIface->getTimestamp(columnIndex);
     340           0 :     return ::com::sun::star::util::DateTime();
     341             : }
     342             : 
     343           0 : Reference< ::com::sun::star::io::XInputStream > SAL_CALL SbaXFormAdapter::getBinaryStream(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     344             : {
     345           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     346           0 :     if (xIface.is())
     347           0 :         return xIface->getBinaryStream(columnIndex);
     348           0 :     return Reference< ::com::sun::star::io::XInputStream > ();
     349             : }
     350             : 
     351           0 : Reference< ::com::sun::star::io::XInputStream > SAL_CALL SbaXFormAdapter::getCharacterStream(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     352             : {
     353           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     354           0 :     if (xIface.is())
     355           0 :         return xIface->getCharacterStream(columnIndex);
     356           0 :     return Reference< ::com::sun::star::io::XInputStream > ();
     357             : }
     358             : 
     359           0 : Any SAL_CALL SbaXFormAdapter::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     360             : {
     361           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     362           0 :     if (xIface.is())
     363           0 :         return xIface->getObject(columnIndex, typeMap);
     364           0 :     return Any();
     365             : }
     366             : 
     367           0 : Reference< ::com::sun::star::sdbc::XRef > SAL_CALL SbaXFormAdapter::getRef(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     368             : {
     369           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     370           0 :     if (xIface.is())
     371           0 :         return xIface->getRef(columnIndex);
     372           0 :     return Reference< ::com::sun::star::sdbc::XRef > ();
     373             : }
     374             : 
     375           0 : Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL SbaXFormAdapter::getBlob(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     376             : {
     377           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     378           0 :     if (xIface.is())
     379           0 :         return xIface->getBlob(columnIndex);
     380           0 :     return Reference< ::com::sun::star::sdbc::XBlob > ();
     381             : }
     382             : 
     383           0 : Reference< ::com::sun::star::sdbc::XClob > SAL_CALL SbaXFormAdapter::getClob(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     384             : {
     385           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     386           0 :     if (xIface.is())
     387           0 :         return xIface->getClob(columnIndex);
     388           0 :     return Reference< ::com::sun::star::sdbc::XClob > ();
     389             : }
     390             : 
     391           0 : Reference< ::com::sun::star::sdbc::XArray > SAL_CALL SbaXFormAdapter::getArray(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     392             : {
     393           0 :     Reference< ::com::sun::star::sdbc::XRow >  xIface(m_xMainForm, UNO_QUERY);
     394           0 :     if (xIface.is())
     395           0 :         return xIface->getArray(columnIndex);
     396           0 :     return Reference< ::com::sun::star::sdbc::XArray > ();
     397             : }
     398             : 
     399             : // ::com::sun::star::sdbcx::XRowLocate
     400           0 : Any SAL_CALL SbaXFormAdapter::getBookmark() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     401             : {
     402           0 :     Reference< ::com::sun::star::sdbcx::XRowLocate >  xIface(m_xMainForm, UNO_QUERY);
     403           0 :     if (xIface.is())
     404           0 :         return xIface->getBookmark();
     405           0 :     return Any();
     406             : }
     407             : 
     408           0 : sal_Bool SAL_CALL SbaXFormAdapter::moveToBookmark(const Any& bookmark) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     409             : {
     410           0 :     Reference< ::com::sun::star::sdbcx::XRowLocate >  xIface(m_xMainForm, UNO_QUERY);
     411           0 :     if (xIface.is())
     412           0 :         return xIface->moveToBookmark(bookmark);
     413           0 :     return sal_False;
     414             : }
     415             : 
     416           0 : sal_Bool SAL_CALL SbaXFormAdapter::moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     417             : {
     418           0 :     Reference< ::com::sun::star::sdbcx::XRowLocate >  xIface(m_xMainForm, UNO_QUERY);
     419           0 :     if (xIface.is())
     420           0 :         return xIface->moveRelativeToBookmark(bookmark,rows);
     421           0 :     return sal_False;
     422             : }
     423             : 
     424           0 : sal_Int32 SAL_CALL SbaXFormAdapter::compareBookmarks(const Any& _first, const Any& _second) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     425             : {
     426           0 :     Reference< ::com::sun::star::sdbcx::XRowLocate >  xIface(m_xMainForm, UNO_QUERY);
     427           0 :     if (xIface.is())
     428           0 :         return xIface->compareBookmarks(_first, _second);
     429           0 :     return 0;
     430             : }
     431             : 
     432           0 : sal_Bool SAL_CALL SbaXFormAdapter::hasOrderedBookmarks() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     433             : {
     434           0 :     Reference< ::com::sun::star::sdbcx::XRowLocate >  xIface(m_xMainForm, UNO_QUERY);
     435           0 :     if (xIface.is())
     436           0 :         return xIface->hasOrderedBookmarks();
     437           0 :     return sal_False;
     438             : }
     439             : 
     440           0 : sal_Int32 SAL_CALL SbaXFormAdapter::hashBookmark(const Any& bookmark) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     441             : {
     442           0 :     Reference< ::com::sun::star::sdbcx::XRowLocate >  xIface(m_xMainForm, UNO_QUERY);
     443           0 :     if (xIface.is())
     444           0 :         return xIface->hashBookmark(bookmark);
     445           0 :     return 0;
     446             : }
     447             : 
     448             : // ::com::sun::star::sdbc::XRowUpdate
     449           0 : void SAL_CALL SbaXFormAdapter::updateNull(sal_Int32 columnIndex) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     450             : {
     451           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     452           0 :     if (xIface.is())
     453           0 :         xIface->updateNull(columnIndex);
     454           0 : }
     455             : 
     456           0 : void SAL_CALL SbaXFormAdapter::updateBoolean(sal_Int32 columnIndex, sal_Bool x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     457             : {
     458           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     459           0 :     if (xIface.is())
     460           0 :         xIface->updateBoolean(columnIndex, x);
     461           0 : }
     462             : 
     463           0 : void SAL_CALL SbaXFormAdapter::updateByte(sal_Int32 columnIndex, sal_Int8 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     464             : {
     465           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     466           0 :     if (xIface.is())
     467           0 :         xIface->updateByte(columnIndex, x);
     468           0 : }
     469             : 
     470           0 : void SAL_CALL SbaXFormAdapter::updateShort(sal_Int32 columnIndex, sal_Int16 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     471             : {
     472           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     473           0 :     if (xIface.is())
     474           0 :         xIface->updateShort(columnIndex, x);
     475           0 : }
     476             : 
     477           0 : void SAL_CALL SbaXFormAdapter::updateInt(sal_Int32 columnIndex, sal_Int32 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     478             : {
     479           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     480           0 :     if (xIface.is())
     481           0 :         xIface->updateInt(columnIndex, x);
     482           0 : }
     483             : 
     484           0 : void SAL_CALL SbaXFormAdapter::updateLong(sal_Int32 columnIndex, sal_Int64 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     485             : {
     486           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     487           0 :     if (xIface.is())
     488           0 :         xIface->updateLong(columnIndex, x);
     489           0 : }
     490             : 
     491           0 : void SAL_CALL SbaXFormAdapter::updateFloat(sal_Int32 columnIndex, float x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     492             : {
     493           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     494           0 :     if (xIface.is())
     495           0 :         xIface->updateFloat(columnIndex, x);
     496           0 : }
     497             : 
     498           0 : void SAL_CALL SbaXFormAdapter::updateDouble(sal_Int32 columnIndex, double x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     499             : {
     500           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     501           0 :     if (xIface.is())
     502           0 :         xIface->updateDouble(columnIndex, x);
     503           0 : }
     504             : 
     505           0 : void SAL_CALL SbaXFormAdapter::updateString(sal_Int32 columnIndex, const OUString& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     506             : {
     507           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     508           0 :     if (xIface.is())
     509           0 :         xIface->updateString(columnIndex, x);
     510           0 : }
     511             : 
     512           0 : void SAL_CALL SbaXFormAdapter::updateBytes(sal_Int32 columnIndex, const Sequence< sal_Int8 >& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     513             : {
     514           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     515           0 :     if (xIface.is())
     516           0 :         xIface->updateBytes(columnIndex, x);
     517           0 : }
     518             : 
     519           0 : void SAL_CALL SbaXFormAdapter::updateDate(sal_Int32 columnIndex, const ::com::sun::star::util::Date& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     520             : {
     521           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     522           0 :     if (xIface.is())
     523           0 :         xIface->updateDate(columnIndex, x);
     524           0 : }
     525             : 
     526           0 : void SAL_CALL SbaXFormAdapter::updateTime(sal_Int32 columnIndex, const ::com::sun::star::util::Time& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     527             : {
     528           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     529           0 :     if (xIface.is())
     530           0 :         xIface->updateTime(columnIndex, x);
     531           0 : }
     532             : 
     533           0 : void SAL_CALL SbaXFormAdapter::updateTimestamp(sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     534             : {
     535           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     536           0 :     if (xIface.is())
     537           0 :         xIface->updateTimestamp(columnIndex, x);
     538           0 : }
     539             : 
     540           0 : 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, std::exception )
     541             : {
     542           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     543           0 :     if (xIface.is())
     544           0 :         xIface->updateBinaryStream(columnIndex, x, length);
     545           0 : }
     546             : 
     547           0 : 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, std::exception )
     548             : {
     549           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     550           0 :     if (xIface.is())
     551           0 :         xIface->updateCharacterStream(columnIndex, x, length);
     552           0 : }
     553             : 
     554           0 : void SAL_CALL SbaXFormAdapter::updateObject(sal_Int32 columnIndex, const Any& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     555             : {
     556           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     557           0 :     if (xIface.is())
     558           0 :         xIface->updateObject(columnIndex, x);
     559           0 : }
     560             : 
     561           0 : void SAL_CALL SbaXFormAdapter::updateNumericObject(sal_Int32 columnIndex, const Any& x, sal_Int32 scale) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     562             : {
     563           0 :     Reference< ::com::sun::star::sdbc::XRowUpdate >  xIface(m_xMainForm, UNO_QUERY);
     564           0 :     if (xIface.is())
     565           0 :         xIface->updateNumericObject(columnIndex, x, scale);
     566           0 : }
     567             : 
     568             : // ::com::sun::star::sdbc::XResultSet
     569           0 : sal_Bool SAL_CALL SbaXFormAdapter::next() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     570             : {
     571           0 :     if (m_xMainForm.is())
     572           0 :         return m_xMainForm->next();
     573           0 :     return sal_False;
     574             : }
     575             : 
     576           0 : sal_Bool SAL_CALL SbaXFormAdapter::isBeforeFirst() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     577             : {
     578           0 :     if (m_xMainForm.is())
     579           0 :         return m_xMainForm->isBeforeFirst();
     580           0 :     return sal_False;
     581             : }
     582             : 
     583           0 : sal_Bool SAL_CALL SbaXFormAdapter::isAfterLast() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     584             : {
     585           0 :     if (m_xMainForm.is())
     586           0 :         return m_xMainForm->isAfterLast();
     587           0 :     return sal_False;
     588             : }
     589             : 
     590           0 : sal_Bool SAL_CALL SbaXFormAdapter::isFirst() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     591             : {
     592           0 :     if (m_xMainForm.is())
     593           0 :         return m_xMainForm->isFirst();
     594           0 :     return sal_False;
     595             : }
     596             : 
     597           0 : sal_Bool SAL_CALL SbaXFormAdapter::isLast() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     598             : {
     599           0 :     if (m_xMainForm.is())
     600           0 :         return m_xMainForm->isLast();
     601           0 :     return sal_False;
     602             : }
     603             : 
     604           0 : void SAL_CALL SbaXFormAdapter::beforeFirst() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     605             : {
     606           0 :     if (m_xMainForm.is())
     607           0 :         m_xMainForm->beforeFirst();
     608           0 : }
     609             : 
     610           0 : void SAL_CALL SbaXFormAdapter::afterLast() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     611             : {
     612           0 :     if (m_xMainForm.is())
     613           0 :         m_xMainForm->afterLast();
     614           0 : }
     615             : 
     616           0 : sal_Bool SAL_CALL SbaXFormAdapter::first() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     617             : {
     618           0 :     if (m_xMainForm.is())
     619           0 :         return m_xMainForm->first();
     620           0 :     return sal_False;
     621             : }
     622             : 
     623           0 : sal_Bool SAL_CALL SbaXFormAdapter::last() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     624             : {
     625           0 :     if (m_xMainForm.is())
     626           0 :         return m_xMainForm->last();
     627           0 :     return sal_False;
     628             : }
     629             : 
     630           0 : sal_Int32 SAL_CALL SbaXFormAdapter::getRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     631             : {
     632           0 :     if (m_xMainForm.is())
     633           0 :         return m_xMainForm->getRow();
     634           0 :     return sal_False;
     635             : }
     636             : 
     637           0 : sal_Bool SAL_CALL SbaXFormAdapter::absolute(sal_Int32 row) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     638             : {
     639           0 :     if (m_xMainForm.is())
     640           0 :         return m_xMainForm->absolute(row);
     641           0 :     return sal_False;
     642             : }
     643             : 
     644           0 : sal_Bool SAL_CALL SbaXFormAdapter::relative(sal_Int32 rows) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     645             : {
     646           0 :     if (m_xMainForm.is())
     647           0 :         return m_xMainForm->relative(rows);
     648           0 :     return sal_False;
     649             : }
     650             : 
     651           0 : sal_Bool SAL_CALL SbaXFormAdapter::previous() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     652             : {
     653           0 :     if (m_xMainForm.is())
     654           0 :         return m_xMainForm->previous();
     655           0 :     return sal_False;
     656             : }
     657             : 
     658           0 : void SAL_CALL SbaXFormAdapter::refreshRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     659             : {
     660           0 :     if (m_xMainForm.is())
     661           0 :         m_xMainForm->refreshRow();
     662           0 : }
     663             : 
     664           0 : sal_Bool SAL_CALL SbaXFormAdapter::rowUpdated() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     665             : {
     666           0 :     if (m_xMainForm.is())
     667           0 :         return m_xMainForm->rowUpdated();
     668           0 :     return sal_False;
     669             : }
     670             : 
     671           0 : sal_Bool SAL_CALL SbaXFormAdapter::rowInserted() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     672             : {
     673           0 :     if (m_xMainForm.is())
     674           0 :         return m_xMainForm->rowInserted();
     675           0 :     return sal_False;
     676             : }
     677             : 
     678           0 : sal_Bool SAL_CALL SbaXFormAdapter::rowDeleted() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     679             : {
     680           0 :     if (m_xMainForm.is())
     681           0 :         return m_xMainForm->rowDeleted();
     682           0 :     return sal_False;
     683             : }
     684             : 
     685           0 : Reference< XInterface > SAL_CALL SbaXFormAdapter::getStatement() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     686             : {
     687           0 :     if (m_xMainForm.is())
     688           0 :         return m_xMainForm->getStatement();
     689           0 :     return NULL;
     690             : }
     691             : 
     692             : // ::com::sun::star::sdbc::XResultSetUpdate
     693           0 : void SAL_CALL SbaXFormAdapter::insertRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     694             : {
     695           0 :     Reference< ::com::sun::star::sdbc::XResultSetUpdate >  xIface(m_xMainForm, UNO_QUERY);
     696           0 :     if (xIface.is())
     697           0 :         xIface->insertRow();
     698           0 : }
     699             : 
     700           0 : void SAL_CALL SbaXFormAdapter::updateRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     701             : {
     702           0 :     Reference< ::com::sun::star::sdbc::XResultSetUpdate >  xIface(m_xMainForm, UNO_QUERY);
     703           0 :     if (xIface.is())
     704           0 :         xIface->updateRow();
     705           0 : }
     706             : 
     707           0 : void SAL_CALL SbaXFormAdapter::deleteRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     708             : {
     709           0 :     Reference< ::com::sun::star::sdbc::XResultSetUpdate >  xIface(m_xMainForm, UNO_QUERY);
     710           0 :     if (xIface.is())
     711           0 :         xIface->deleteRow();
     712           0 : }
     713             : 
     714           0 : void SAL_CALL SbaXFormAdapter::cancelRowUpdates() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     715             : {
     716           0 :     Reference< ::com::sun::star::sdbc::XResultSetUpdate >  xIface(m_xMainForm, UNO_QUERY);
     717           0 :     if (xIface.is())
     718           0 :         xIface->cancelRowUpdates();
     719           0 : }
     720             : 
     721           0 : void SAL_CALL SbaXFormAdapter::moveToInsertRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     722             : {
     723           0 :     Reference< ::com::sun::star::sdbc::XResultSetUpdate >  xIface(m_xMainForm, UNO_QUERY);
     724           0 :     if (xIface.is())
     725           0 :         xIface->moveToInsertRow();
     726           0 : }
     727             : 
     728           0 : void SAL_CALL SbaXFormAdapter::moveToCurrentRow() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     729             : {
     730           0 :     Reference< ::com::sun::star::sdbc::XResultSetUpdate >  xIface(m_xMainForm, UNO_QUERY);
     731           0 :     if (xIface.is())
     732           0 :         xIface->moveToCurrentRow();
     733           0 : }
     734             : 
     735             : // ::com::sun::star::sdbc::XRowSet
     736           0 : void SAL_CALL SbaXFormAdapter::execute() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     737             : {
     738           0 :     if (m_xMainForm.is())
     739           0 :         m_xMainForm->execute();
     740           0 : }
     741             : 
     742           0 : IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, sdbc, RowSetListener, m_aRowSetListeners, ::com::sun::star::sdbc::XRowSet, m_xMainForm)
     743             : 
     744             : // ::com::sun::star::sdbcx::XDeleteRows
     745           0 : Sequence<sal_Int32> SAL_CALL SbaXFormAdapter::deleteRows(const Sequence< Any >& rows) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     746             : {
     747           0 :     Reference< ::com::sun::star::sdbcx::XDeleteRows >  xIface(m_xMainForm, UNO_QUERY);
     748           0 :     if (xIface.is())
     749           0 :         return xIface->deleteRows(rows);
     750           0 :     return Sequence<sal_Int32>();
     751             : }
     752             : 
     753             : // ::com::sun::star::sdbc::XWarningsSupplier
     754           0 : Any SAL_CALL SbaXFormAdapter::getWarnings() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     755             : {
     756           0 :     Reference< ::com::sun::star::sdbc::XWarningsSupplier >  xIface(m_xMainForm, UNO_QUERY);
     757           0 :     if (xIface.is())
     758           0 :         return xIface->getWarnings();
     759           0 :     return Any();
     760             : }
     761             : 
     762           0 : void SAL_CALL SbaXFormAdapter::clearWarnings() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     763             : {
     764           0 :     Reference< ::com::sun::star::sdbc::XWarningsSupplier >  xIface(m_xMainForm, UNO_QUERY);
     765           0 :     if (xIface.is())
     766           0 :         xIface->clearWarnings();
     767           0 : }
     768             : 
     769             : // ::com::sun::star::sdb::XRowSetApproveBroadcaster
     770           0 : IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, sdb, RowSetApproveListener, m_aRowSetApproveListeners, ::com::sun::star::sdb::XRowSetApproveBroadcaster, m_xMainForm)
     771             : 
     772             : // com::sun::star::sdbc::XSQLErrorBroadcaster
     773           0 : IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, sdb, SQLErrorListener, m_aErrorListeners, ::com::sun::star::sdb::XSQLErrorBroadcaster, m_xMainForm)
     774             : 
     775             : // ::com::sun::star::sdb::XResultSetAccess
     776           0 : Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL SbaXFormAdapter::createResultSet() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     777             : {
     778           0 :     Reference< ::com::sun::star::sdb::XResultSetAccess >  xIface(m_xMainForm, UNO_QUERY);
     779           0 :     if (xIface.is())
     780           0 :         return xIface->createResultSet();
     781           0 :     return Reference< ::com::sun::star::sdbc::XResultSet > ();
     782             : }
     783             : 
     784             : // com::sun::star::form::XLoadable
     785           0 : void SAL_CALL SbaXFormAdapter::load() throw( RuntimeException, std::exception )
     786             : {
     787           0 :     Reference< ::com::sun::star::form::XLoadable >  xIface(m_xMainForm, UNO_QUERY);
     788           0 :     if (xIface.is())
     789           0 :         xIface->load();
     790           0 : }
     791             : 
     792           0 : void SAL_CALL SbaXFormAdapter::unload() throw( RuntimeException, std::exception )
     793             : {
     794           0 :     Reference< ::com::sun::star::form::XLoadable >  xIface(m_xMainForm, UNO_QUERY);
     795           0 :     if (xIface.is())
     796           0 :         xIface->unload();
     797           0 : }
     798             : 
     799           0 : void SAL_CALL SbaXFormAdapter::reload() throw( RuntimeException, std::exception )
     800             : {
     801           0 :     Reference< ::com::sun::star::form::XLoadable >  xIface(m_xMainForm, UNO_QUERY);
     802           0 :     if (xIface.is())
     803           0 :         xIface->reload();
     804           0 : }
     805             : 
     806           0 : sal_Bool SAL_CALL SbaXFormAdapter::isLoaded() throw( RuntimeException, std::exception )
     807             : {
     808           0 :     Reference< ::com::sun::star::form::XLoadable >  xIface(m_xMainForm, UNO_QUERY);
     809           0 :     if (xIface.is())
     810           0 :         return xIface->isLoaded();
     811           0 :     return sal_False;
     812             : }
     813             : 
     814           0 : IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, form, LoadListener, m_aLoadListeners, ::com::sun::star::form::XLoadable, m_xMainForm)
     815             : 
     816             : // ::com::sun::star::sdbc::XParameters
     817           0 : void SAL_CALL SbaXFormAdapter::setNull(sal_Int32 parameterIndex, sal_Int32 sqlType) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     818             : {
     819           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     820           0 :     if (xIface.is())
     821           0 :         xIface->setNull(parameterIndex, sqlType);
     822           0 : }
     823             : 
     824           0 : void SAL_CALL SbaXFormAdapter::setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     825             : {
     826           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     827           0 :     if (xIface.is())
     828           0 :         xIface->setObjectNull(parameterIndex, sqlType, typeName);
     829           0 : }
     830             : 
     831           0 : void SAL_CALL SbaXFormAdapter::setBoolean(sal_Int32 parameterIndex, sal_Bool x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     832             : {
     833           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     834           0 :     if (xIface.is())
     835           0 :         xIface->setBoolean(parameterIndex, x);
     836           0 : }
     837             : 
     838           0 : void SAL_CALL SbaXFormAdapter::setByte(sal_Int32 parameterIndex, sal_Int8 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     839             : {
     840           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     841           0 :     if (xIface.is())
     842           0 :         xIface->setByte(parameterIndex, x);
     843           0 : }
     844             : 
     845           0 : void SAL_CALL SbaXFormAdapter::setShort(sal_Int32 parameterIndex, sal_Int16 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     846             : {
     847           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     848           0 :     if (xIface.is())
     849           0 :         xIface->setShort(parameterIndex, x);
     850           0 : }
     851             : 
     852           0 : void SAL_CALL SbaXFormAdapter::setInt(sal_Int32 parameterIndex, sal_Int32 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     853             : {
     854           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     855           0 :     if (xIface.is())
     856           0 :         xIface->setInt(parameterIndex, x);
     857           0 : }
     858             : 
     859           0 : void SAL_CALL SbaXFormAdapter::setLong(sal_Int32 parameterIndex, sal_Int64 x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     860             : {
     861           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     862           0 :     if (xIface.is())
     863           0 :         xIface->setLong(parameterIndex, x);
     864           0 : }
     865             : 
     866           0 : void SAL_CALL SbaXFormAdapter::setFloat(sal_Int32 parameterIndex, float x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     867             : {
     868           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     869           0 :     if (xIface.is())
     870           0 :         xIface->setFloat(parameterIndex, x);
     871           0 : }
     872             : 
     873           0 : void SAL_CALL SbaXFormAdapter::setDouble(sal_Int32 parameterIndex, double x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     874             : {
     875           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     876           0 :     if (xIface.is())
     877           0 :         xIface->setDouble(parameterIndex, x);
     878           0 : }
     879             : 
     880           0 : void SAL_CALL SbaXFormAdapter::setString(sal_Int32 parameterIndex, const OUString& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     881             : {
     882           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     883           0 :     if (xIface.is())
     884           0 :         xIface->setString(parameterIndex, x);
     885           0 : }
     886             : 
     887           0 : void SAL_CALL SbaXFormAdapter::setBytes(sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     888             : {
     889           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     890           0 :     if (xIface.is())
     891           0 :         xIface->setBytes(parameterIndex, x);
     892           0 : }
     893             : 
     894           0 : void SAL_CALL SbaXFormAdapter::setDate(sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     895             : {
     896           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     897           0 :     if (xIface.is())
     898           0 :         xIface->setDate(parameterIndex, x);
     899           0 : }
     900             : 
     901           0 : void SAL_CALL SbaXFormAdapter::setTime(sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     902             : {
     903           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     904           0 :     if (xIface.is())
     905           0 :         xIface->setTime(parameterIndex, x);
     906           0 : }
     907             : 
     908           0 : void SAL_CALL SbaXFormAdapter::setTimestamp(sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     909             : {
     910           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     911           0 :     if (xIface.is())
     912           0 :         xIface->setTimestamp(parameterIndex, x);
     913           0 : }
     914             : 
     915           0 : 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, std::exception )
     916             : {
     917           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     918           0 :     if (xIface.is())
     919           0 :         xIface->setBinaryStream(parameterIndex, x, length);
     920           0 : }
     921             : 
     922           0 : 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, std::exception )
     923             : {
     924           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     925           0 :     if (xIface.is())
     926           0 :         xIface->setCharacterStream(parameterIndex, x, length);
     927           0 : }
     928             : 
     929           0 : void SAL_CALL SbaXFormAdapter::setObject(sal_Int32 parameterIndex, const Any& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     930             : {
     931           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     932           0 :     if (xIface.is())
     933           0 :         xIface->setObject(parameterIndex, x);
     934           0 : }
     935             : 
     936           0 : void SAL_CALL SbaXFormAdapter::setObjectWithInfo(sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 scale) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     937             : {
     938           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     939           0 :     if (xIface.is())
     940           0 :         xIface->setObjectWithInfo(parameterIndex, x, targetSqlType, scale);
     941           0 : }
     942             : 
     943           0 : void SAL_CALL SbaXFormAdapter::setRef(sal_Int32 parameterIndex, const Reference< ::com::sun::star::sdbc::XRef >& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     944             : {
     945           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     946           0 :     if (xIface.is())
     947           0 :         xIface->setRef(parameterIndex, x);
     948           0 : }
     949             : 
     950           0 : void SAL_CALL SbaXFormAdapter::setBlob(sal_Int32 parameterIndex, const Reference< ::com::sun::star::sdbc::XBlob >& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     951             : {
     952           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     953           0 :     if (xIface.is())
     954           0 :         xIface->setBlob(parameterIndex, x);
     955           0 : }
     956             : 
     957           0 : void SAL_CALL SbaXFormAdapter::setClob(sal_Int32 parameterIndex, const Reference< ::com::sun::star::sdbc::XClob >& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     958             : {
     959           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     960           0 :     if (xIface.is())
     961           0 :         xIface->setClob(parameterIndex, x);
     962           0 : }
     963             : 
     964           0 : void SAL_CALL SbaXFormAdapter::setArray(sal_Int32 parameterIndex, const Reference< ::com::sun::star::sdbc::XArray >& x) throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     965             : {
     966           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     967           0 :     if (xIface.is())
     968           0 :         xIface->setArray(parameterIndex, x);
     969           0 : }
     970             : 
     971           0 : void SAL_CALL SbaXFormAdapter::clearParameters() throw( ::com::sun::star::sdbc::SQLException, RuntimeException, std::exception )
     972             : {
     973           0 :     Reference< ::com::sun::star::sdbc::XParameters >  xIface(m_xMainForm, UNO_QUERY);
     974           0 :     if (xIface.is())
     975           0 :         xIface->clearParameters();
     976           0 : }
     977             : 
     978             : // ::com::sun::star::form::XDatabaseParameterBroadcaster
     979           0 : void SAL_CALL SbaXFormAdapter::addParameterListener(const Reference< ::com::sun::star::form::XDatabaseParameterListener >& aListener) throw( RuntimeException, std::exception )
     980             : {
     981           0 :     m_aParameterListeners.addInterface(aListener);
     982           0 :     if (m_aParameterListeners.getLength() == 1)
     983             :     {
     984           0 :         Reference< ::com::sun::star::form::XDatabaseParameterBroadcaster >  xBroadcaster(m_xMainForm, UNO_QUERY);
     985           0 :         if (xBroadcaster.is())
     986           0 :             xBroadcaster->addParameterListener(&m_aParameterListeners);
     987             :     }
     988           0 : }
     989             : 
     990           0 : void SAL_CALL SbaXFormAdapter::removeParameterListener(const Reference< ::com::sun::star::form::XDatabaseParameterListener >& aListener) throw( RuntimeException, std::exception )
     991             : {
     992           0 :     if (m_aParameterListeners.getLength() == 1)
     993             :     {
     994           0 :         Reference< ::com::sun::star::form::XDatabaseParameterBroadcaster >  xBroadcaster(m_xMainForm, UNO_QUERY);
     995           0 :         if (xBroadcaster.is())
     996           0 :             xBroadcaster->removeParameterListener(&m_aParameterListeners);
     997             :     }
     998           0 :     m_aParameterListeners.removeInterface(aListener);
     999           0 : }
    1000             : 
    1001             : // ::com::sun::star::container::XChild
    1002           0 : Reference< XInterface > SAL_CALL SbaXFormAdapter::getParent() throw( RuntimeException, std::exception )
    1003             : {
    1004           0 :     return m_xParent;
    1005             : }
    1006             : 
    1007           0 : void SAL_CALL SbaXFormAdapter::setParent(const Reference< XInterface >& Parent) throw( ::com::sun::star::lang::NoSupportException, RuntimeException, std::exception )
    1008             : {
    1009           0 :     m_xParent = Parent;
    1010           0 : }
    1011             : 
    1012             : // ::com::sun::star::form::XSubmit
    1013           0 : void SAL_CALL SbaXFormAdapter::submit(const Reference< ::com::sun::star::awt::XControl >& aControl, const ::com::sun::star::awt::MouseEvent& aMouseEvt) throw( RuntimeException, std::exception )
    1014             : {
    1015           0 :     Reference< ::com::sun::star::form::XSubmit >  xSubmit(m_xMainForm, UNO_QUERY);
    1016           0 :     if (xSubmit.is())
    1017           0 :         xSubmit->submit(aControl, aMouseEvt);
    1018           0 : }
    1019             : 
    1020           0 : IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, form, SubmitListener, m_aSubmitListeners, ::com::sun::star::form::XSubmit, m_xMainForm)
    1021             : 
    1022             : // ::com::sun::star::awt::XTabControllerModel
    1023           0 : sal_Bool SAL_CALL SbaXFormAdapter::getGroupControl() throw( RuntimeException, std::exception )
    1024             : {
    1025             :     OSL_FAIL("SAL_CALL SbaXFormAdapter::getGroupControl : not supported !");
    1026           0 :     return sal_False;
    1027             : }
    1028             : 
    1029           0 : void SAL_CALL SbaXFormAdapter::setGroupControl(sal_Bool /*GroupControl*/) throw( RuntimeException, std::exception )
    1030             : {
    1031             :     OSL_FAIL("SAL_CALL SbaXFormAdapter::setGroupControl : not supported !");
    1032           0 : }
    1033             : 
    1034           0 : void SAL_CALL SbaXFormAdapter::setControlModels(const Sequence< Reference< ::com::sun::star::awt::XControlModel >  >& /*Controls*/) throw( RuntimeException, std::exception )
    1035             : {
    1036             :     OSL_FAIL("SAL_CALL SbaXFormAdapter::setControlModels : not supported !");
    1037           0 : }
    1038             : 
    1039           0 : Sequence< Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL SbaXFormAdapter::getControlModels() throw( RuntimeException, std::exception )
    1040             : {
    1041             :     OSL_FAIL("SAL_CALL SbaXFormAdapter::getControlModels : not supported !");
    1042           0 :     return Sequence< Reference< ::com::sun::star::awt::XControlModel > >();
    1043             : }
    1044             : 
    1045           0 : void SAL_CALL SbaXFormAdapter::setGroup(const Sequence< Reference< ::com::sun::star::awt::XControlModel >  >& /*_rGroup*/, const OUString& /*GroupName*/) throw( RuntimeException, std::exception )
    1046             : {
    1047             :     OSL_FAIL("SAL_CALL SbaXFormAdapter::setGroup : not supported !");
    1048           0 : }
    1049             : 
    1050           0 : sal_Int32 SAL_CALL SbaXFormAdapter::getGroupCount() throw( RuntimeException, std::exception )
    1051             : {
    1052             :     OSL_FAIL("SAL_CALL SbaXFormAdapter::getGroupCount : not supported !");
    1053           0 :     return 0;
    1054             : }
    1055             : 
    1056           0 : void SAL_CALL SbaXFormAdapter::getGroup(sal_Int32 /*nGroup*/, Sequence< Reference< ::com::sun::star::awt::XControlModel >  >& /*_rGroup*/, OUString& /*Name*/) throw( RuntimeException, std::exception )
    1057             : {
    1058             :     OSL_FAIL("SAL_CALL SbaXFormAdapter::getGroup : not supported !");
    1059           0 : }
    1060             : 
    1061           0 : void SAL_CALL SbaXFormAdapter::getGroupByName(const OUString& /*Name*/, Sequence< Reference< ::com::sun::star::awt::XControlModel >  >& /*_rGroup*/) throw( RuntimeException, std::exception )
    1062             : {
    1063             :     OSL_FAIL("SAL_CALL SbaXFormAdapter::getGroupByName : not supported !");
    1064           0 : }
    1065             : 
    1066             : // ::com::sun::star::lang::XComponent
    1067           0 : void SAL_CALL SbaXFormAdapter::dispose() throw( RuntimeException, std::exception )
    1068             : {
    1069             :     // log off all multiplexers
    1070           0 :     if (m_xMainForm.is())
    1071           0 :         StopListening();
    1072             : 
    1073           0 :     ::com::sun::star::lang::EventObject aEvt(*this);
    1074           0 :     m_aLoadListeners.disposeAndClear(aEvt);
    1075           0 :     m_aRowSetListeners.disposeAndClear(aEvt);
    1076           0 :     m_aRowSetApproveListeners.disposeAndClear(aEvt);
    1077           0 :     m_aErrorListeners.disposeAndClear(aEvt);
    1078           0 :     m_aParameterListeners.disposeAndClear(aEvt);
    1079           0 :     m_aSubmitListeners.disposeAndClear(aEvt);
    1080           0 :     m_aResetListeners.disposeAndClear(aEvt);
    1081             : 
    1082           0 :     m_aVetoablePropertyChangeListeners.disposeAndClear();
    1083           0 :     m_aPropertyChangeListeners.disposeAndClear();
    1084           0 :     m_aPropertiesChangeListeners.disposeAndClear(aEvt);
    1085             : 
    1086           0 :     m_aDisposeListeners.disposeAndClear(aEvt);
    1087           0 :     m_aContainerListeners.disposeAndClear(aEvt);
    1088             : 
    1089             :     // dispose all children
    1090           0 :     for (   ::std::vector< Reference< ::com::sun::star::form::XFormComponent > >::iterator aIter = m_aChildren.begin();
    1091           0 :             aIter != m_aChildren.end();
    1092             :             ++aIter
    1093             :         )
    1094             :     {
    1095           0 :         Reference< ::com::sun::star::beans::XPropertySet >  xSet(*aIter, UNO_QUERY);
    1096           0 :         if (xSet.is())
    1097           0 :             xSet->removePropertyChangeListener(PROPERTY_NAME, (::com::sun::star::beans::XPropertyChangeListener*)this);
    1098             : 
    1099           0 :         Reference< ::com::sun::star::container::XChild >  xChild(*aIter, UNO_QUERY);
    1100           0 :         if (xChild.is())
    1101           0 :             xChild->setParent(Reference< XInterface > ());
    1102             : 
    1103           0 :         Reference< ::com::sun::star::lang::XComponent >  xComp(*aIter, UNO_QUERY);
    1104           0 :         if (xComp.is())
    1105           0 :             xComp->dispose();
    1106           0 :     }
    1107           0 :     m_aChildren.clear();
    1108           0 : }
    1109             : 
    1110           0 : void SAL_CALL SbaXFormAdapter::addEventListener(const Reference< ::com::sun::star::lang::XEventListener >& xListener) throw( RuntimeException, std::exception )
    1111             : {
    1112           0 :     m_aDisposeListeners.addInterface(xListener);
    1113           0 : }
    1114             : 
    1115           0 : void SAL_CALL SbaXFormAdapter::removeEventListener(const Reference< ::com::sun::star::lang::XEventListener >& aListener) throw( RuntimeException, std::exception )
    1116             : {
    1117           0 :     m_aDisposeListeners.removeInterface(aListener);
    1118           0 : }
    1119             : 
    1120             : // ::com::sun::star::beans::XFastPropertySet
    1121           0 : 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, std::exception )
    1122             : {
    1123           0 :     Reference< ::com::sun::star::beans::XFastPropertySet >  xSet(m_xMainForm, UNO_QUERY);
    1124             :     OSL_ENSURE(xSet.is(), "SAL_CALL SbaXFormAdapter::setFastPropertyValue : have no master form !");
    1125             : 
    1126           0 :     if (m_nNamePropHandle == nHandle)
    1127             :     {
    1128           0 :         if (aValue.getValueType().getTypeClass() != TypeClass_STRING)
    1129             :         {
    1130           0 :             throw ::com::sun::star::lang::IllegalArgumentException();
    1131             :         }
    1132             : 
    1133             :         // for notifying property listeners
    1134           0 :         ::com::sun::star::beans::PropertyChangeEvent aEvt;
    1135           0 :         aEvt.Source = *this;
    1136           0 :         aEvt.PropertyName = PROPERTY_NAME;
    1137           0 :         aEvt.PropertyHandle = m_nNamePropHandle;
    1138           0 :         aEvt.OldValue <<= m_sName;
    1139           0 :         aEvt.NewValue = aValue;
    1140             : 
    1141           0 :         aValue >>= m_sName;
    1142             : 
    1143           0 :         ::cppu::OInterfaceIteratorHelper aIt(*m_aPropertyChangeListeners.getContainer(PROPERTY_NAME));
    1144           0 :         while (aIt.hasMoreElements())
    1145           0 :             static_cast< ::com::sun::star::beans::XPropertyChangeListener*>(aIt.next())->propertyChange(aEvt);
    1146             : 
    1147           0 :         return;
    1148             :     }
    1149             : 
    1150           0 :     xSet->setFastPropertyValue(nHandle, aValue);
    1151             : }
    1152             : 
    1153           0 : Any SAL_CALL SbaXFormAdapter::getFastPropertyValue(sal_Int32 nHandle) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, RuntimeException, std::exception )
    1154             : {
    1155           0 :     Reference< ::com::sun::star::beans::XFastPropertySet >  xSet(m_xMainForm, UNO_QUERY);
    1156             :     OSL_ENSURE(xSet.is(), "SAL_CALL SbaXFormAdapter::getFastPropertyValue : have no master form !");
    1157             : 
    1158           0 :     if (m_nNamePropHandle == nHandle)
    1159           0 :         return makeAny(m_sName);
    1160             : 
    1161           0 :     return xSet->getFastPropertyValue(nHandle);
    1162             : }
    1163             : 
    1164             : // ::com::sun::star::container::XNamed
    1165           0 : OUString SAL_CALL SbaXFormAdapter::getName() throw( RuntimeException, std::exception )
    1166             : {
    1167           0 :     return ::comphelper::getString(getPropertyValue(PROPERTY_NAME));
    1168             : }
    1169             : 
    1170           0 : void SAL_CALL SbaXFormAdapter::setName(const OUString& aName) throw( RuntimeException, std::exception )
    1171             : {
    1172           0 :     setPropertyValue(PROPERTY_NAME, makeAny(aName));
    1173           0 : }
    1174             : 
    1175             : // ::com::sun::star::io::XPersistObject
    1176           0 : OUString SAL_CALL SbaXFormAdapter::getServiceName() throw( RuntimeException, std::exception )
    1177             : {
    1178           0 :     Reference< ::com::sun::star::io::XPersistObject >  xPersist(m_xMainForm, UNO_QUERY);
    1179           0 :     if (xPersist.is())
    1180           0 :         return xPersist->getServiceName();
    1181           0 :     return OUString();
    1182             : }
    1183             : 
    1184           0 : void SAL_CALL SbaXFormAdapter::write(const Reference< ::com::sun::star::io::XObjectOutputStream >& _rxOutStream) throw( ::com::sun::star::io::IOException, RuntimeException, std::exception )
    1185             : {
    1186           0 :     Reference< ::com::sun::star::io::XPersistObject >  xPersist(m_xMainForm, UNO_QUERY);
    1187           0 :     if (xPersist.is())
    1188           0 :         xPersist->write(_rxOutStream);
    1189           0 : }
    1190             : 
    1191           0 : void SAL_CALL SbaXFormAdapter::read(const Reference< ::com::sun::star::io::XObjectInputStream >& _rxInStream) throw( ::com::sun::star::io::IOException, RuntimeException, std::exception )
    1192             : {
    1193           0 :     Reference< ::com::sun::star::io::XPersistObject >  xPersist(m_xMainForm, UNO_QUERY);
    1194           0 :     if (xPersist.is())
    1195           0 :         xPersist->read(_rxInStream);
    1196           0 : }
    1197             : 
    1198             : // ::com::sun::star::beans::XMultiPropertySet
    1199           0 : Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL SbaXFormAdapter::getPropertySetInfo() throw( RuntimeException, std::exception )
    1200             : {
    1201           0 :     Reference< ::com::sun::star::beans::XMultiPropertySet >  xSet(m_xMainForm, UNO_QUERY);
    1202           0 :     if (!xSet.is())
    1203           0 :         return Reference< ::com::sun::star::beans::XPropertySetInfo > ();
    1204             : 
    1205           0 :     Reference< ::com::sun::star::beans::XPropertySetInfo >  xReturn = xSet->getPropertySetInfo();
    1206           0 :     if (-1 == m_nNamePropHandle)
    1207             :     {
    1208             :         // we need to determine the handle for the NAME property
    1209           0 :  Sequence< ::com::sun::star::beans::Property> aProps = xReturn->getProperties();
    1210           0 :         const ::com::sun::star::beans::Property* pProps = aProps.getConstArray();
    1211             : 
    1212           0 :         for (sal_Int32 i=0; i<aProps.getLength(); ++i, ++pProps)
    1213             :         {
    1214           0 :             if (pProps->Name.equals(PROPERTY_NAME))
    1215             :             {
    1216           0 :                 ((SbaXFormAdapter*)this)->m_nNamePropHandle = pProps->Handle;
    1217           0 :                 break;
    1218             :             }
    1219           0 :         }
    1220             :     }
    1221           0 :     return xReturn;
    1222             : }
    1223             : 
    1224           0 : void SAL_CALL SbaXFormAdapter::setPropertyValues(const Sequence< OUString >& PropertyNames, const Sequence< Any >& Values) throw( ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException, std::exception )
    1225             : {
    1226           0 :     Reference< ::com::sun::star::beans::XMultiPropertySet >  xSet(m_xMainForm, UNO_QUERY);
    1227           0 :     if (xSet.is())
    1228           0 :         xSet->setPropertyValues(PropertyNames, Values);
    1229           0 : }
    1230             : 
    1231           0 : Sequence< Any > SAL_CALL SbaXFormAdapter::getPropertyValues(const Sequence< OUString >& aPropertyNames) throw( RuntimeException, std::exception )
    1232             : {
    1233           0 :     Reference< ::com::sun::star::beans::XMultiPropertySet >  xSet(m_xMainForm, UNO_QUERY);
    1234           0 :     if (!xSet.is())
    1235           0 :         return Sequence< Any>(aPropertyNames.getLength());
    1236             : 
    1237           0 :  Sequence< Any> aReturn = xSet->getPropertyValues(aPropertyNames);
    1238             : 
    1239             :     // search for (and fake) the NAME property
    1240           0 :     const OUString* pNames = aPropertyNames.getConstArray();
    1241           0 :     Any* pValues = aReturn.getArray();
    1242             :     OSL_ENSURE(aReturn.getLength() == aPropertyNames.getLength(), "SAL_CALL SbaXFormAdapter::getPropertyValues : the main form returned an invalid-length sequence !");
    1243           0 :     for (sal_Int32 i=0; i<aPropertyNames.getLength(); ++i, ++pNames, ++pValues)
    1244           0 :         if (pNames->equals(PROPERTY_NAME))
    1245             :         {
    1246           0 :             (*pValues) <<= m_sName;
    1247           0 :             break;
    1248             :         }
    1249             : 
    1250           0 :     return aReturn;
    1251             : }
    1252             : 
    1253           0 : void SAL_CALL SbaXFormAdapter::addPropertiesChangeListener(const Sequence< OUString>& /*aPropertyNames*/, const Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener) throw( RuntimeException, std::exception )
    1254             : {
    1255             :     // we completely ignore the property names, _all_ changes of _all_ properties will be forwarded to _all_ listeners
    1256           0 :     m_aPropertiesChangeListeners.addInterface(xListener);
    1257           0 :     if (m_aPropertiesChangeListeners.getLength() == 1)
    1258             :     {
    1259           0 :         Reference< ::com::sun::star::beans::XMultiPropertySet >  xBroadcaster(m_xMainForm, UNO_QUERY);
    1260           0 :         OUString sEmpty;
    1261           0 :         if (xBroadcaster.is())
    1262           0 :             xBroadcaster->addPropertiesChangeListener(Sequence< OUString>(&sEmpty, 1), &m_aPropertiesChangeListeners);
    1263             :     }
    1264           0 : }
    1265             : 
    1266           0 : void SAL_CALL SbaXFormAdapter::removePropertiesChangeListener(const Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener) throw( RuntimeException, std::exception )
    1267             : {
    1268           0 :     if (m_aPropertiesChangeListeners.getLength() == 1)
    1269             :     {
    1270           0 :         Reference< ::com::sun::star::beans::XMultiPropertySet >  xBroadcaster(m_xMainForm, UNO_QUERY);
    1271           0 :         if (xBroadcaster.is())
    1272           0 :             xBroadcaster->removePropertiesChangeListener(&m_aPropertiesChangeListeners);
    1273             :     }
    1274           0 :     m_aPropertiesChangeListeners.removeInterface(Listener);
    1275           0 : }
    1276             : 
    1277           0 : void SAL_CALL SbaXFormAdapter::firePropertiesChangeEvent(const Sequence< OUString >& aPropertyNames, const Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener) throw( RuntimeException, std::exception )
    1278             : {
    1279           0 :     Reference< ::com::sun::star::beans::XMultiPropertySet >  xSet(m_xMainForm, UNO_QUERY);
    1280           0 :     if (xSet.is())
    1281           0 :         xSet->firePropertiesChangeEvent(aPropertyNames, xListener);
    1282           0 : }
    1283             : 
    1284             : // ::com::sun::star::beans::XPropertySet
    1285           0 : void SAL_CALL SbaXFormAdapter::setPropertyValue(const 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, std::exception )
    1286             : {
    1287           0 :     Reference< ::com::sun::star::beans::XPropertySet >  xSet(m_xMainForm, UNO_QUERY);
    1288           0 :     if (!xSet.is())
    1289           0 :         return;
    1290             : 
    1291             :     // special handling for the "name" property
    1292           0 :     if (aPropertyName.equals(PROPERTY_NAME))
    1293           0 :         setFastPropertyValue(m_nNamePropHandle, aValue);
    1294             : 
    1295           0 :     xSet->setPropertyValue(aPropertyName, aValue);
    1296             : }
    1297             : 
    1298           0 : Any SAL_CALL SbaXFormAdapter::getPropertyValue(const OUString& PropertyName) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, RuntimeException, std::exception )
    1299             : {
    1300           0 :     Reference< ::com::sun::star::beans::XPropertySet >  xSet(m_xMainForm, UNO_QUERY);
    1301           0 :     if (!xSet.is())
    1302           0 :         return Any();
    1303             : 
    1304             :     // special handling for the "name" property
    1305           0 :     if (PropertyName.equals(PROPERTY_NAME))
    1306           0 :         return getFastPropertyValue(m_nNamePropHandle);
    1307             : 
    1308           0 :     return xSet->getPropertyValue(PropertyName);
    1309             : }
    1310             : 
    1311           0 : IMPLEMENT_PROPERTY_LISTENER_ADMINISTRATION(SbaXFormAdapter, PropertyChangeListener, m_aPropertyChangeListeners, ::com::sun::star::beans::XPropertySet, m_xMainForm);
    1312           0 : IMPLEMENT_PROPERTY_LISTENER_ADMINISTRATION(SbaXFormAdapter, VetoableChangeListener, m_aVetoablePropertyChangeListeners, ::com::sun::star::beans::XPropertySet, m_xMainForm);
    1313             : 
    1314             : // ::com::sun::star::util::XCancellable
    1315           0 : void SAL_CALL SbaXFormAdapter::cancel() throw( RuntimeException, std::exception )
    1316             : {
    1317           0 :     Reference< ::com::sun::star::util::XCancellable >  xCancel(m_xMainForm, UNO_QUERY);
    1318           0 :     if (xCancel.is())
    1319           0 :         return;
    1320           0 :     xCancel->cancel();
    1321             : }
    1322             : 
    1323             : // ::com::sun::star::beans::XPropertyState
    1324           0 : ::com::sun::star::beans::PropertyState SAL_CALL SbaXFormAdapter::getPropertyState(const OUString& PropertyName) throw( ::com::sun::star::beans::UnknownPropertyException, RuntimeException, std::exception )
    1325             : {
    1326           0 :     Reference< ::com::sun::star::beans::XPropertyState >  xState(m_xMainForm, UNO_QUERY);
    1327           0 :     if (xState.is())
    1328           0 :         return xState->getPropertyState(PropertyName);
    1329           0 :     return ::com::sun::star::beans::PropertyState_DEFAULT_VALUE;
    1330             : }
    1331             : 
    1332           0 : Sequence< ::com::sun::star::beans::PropertyState> SAL_CALL SbaXFormAdapter::getPropertyStates(const Sequence< OUString >& aPropertyName) throw( ::com::sun::star::beans::UnknownPropertyException, RuntimeException, std::exception )
    1333             : {
    1334           0 :     Reference< ::com::sun::star::beans::XPropertyState >  xState(m_xMainForm, UNO_QUERY);
    1335           0 :     if (xState.is())
    1336           0 :         return xState->getPropertyStates(aPropertyName);
    1337             : 
    1338             :     // set them all to DEFAULT
    1339           0 :      Sequence< ::com::sun::star::beans::PropertyState> aReturn(aPropertyName.getLength());
    1340           0 :     ::com::sun::star::beans::PropertyState* pStates = aReturn.getArray();
    1341           0 :     for (sal_uInt16 i=0; i<aPropertyName.getLength(); ++i, ++pStates)
    1342           0 :         *pStates = ::com::sun::star::beans::PropertyState_DEFAULT_VALUE;
    1343           0 :     return aReturn;
    1344             : }
    1345             : 
    1346           0 : void SAL_CALL SbaXFormAdapter::setPropertyToDefault(const OUString& PropertyName) throw( ::com::sun::star::beans::UnknownPropertyException, RuntimeException, std::exception )
    1347             : {
    1348           0 :     Reference< ::com::sun::star::beans::XPropertyState >  xState(m_xMainForm, UNO_QUERY);
    1349           0 :     if (xState.is())
    1350           0 :         xState->setPropertyToDefault(PropertyName);
    1351           0 : }
    1352             : 
    1353           0 : Any SAL_CALL SbaXFormAdapter::getPropertyDefault(const OUString& aPropertyName) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, RuntimeException, std::exception )
    1354             : {
    1355           0 :     Reference< ::com::sun::star::beans::XPropertyState >  xState(m_xMainForm, UNO_QUERY);
    1356           0 :     if (xState.is())
    1357           0 :         return xState->getPropertyDefault(aPropertyName);
    1358           0 :     return Any();
    1359             : }
    1360             : 
    1361             : // ::com::sun::star::form::XReset
    1362           0 : void SAL_CALL SbaXFormAdapter::reset() throw( RuntimeException, std::exception )
    1363             : {
    1364           0 :     Reference< ::com::sun::star::form::XReset >  xReset(m_xMainForm, UNO_QUERY);
    1365           0 :     if (xReset.is())
    1366           0 :         xReset->reset();
    1367           0 : }
    1368             : 
    1369           0 : IMPLEMENT_LISTENER_ADMINISTRATION(SbaXFormAdapter, form, ResetListener, m_aResetListeners, ::com::sun::star::form::XReset, m_xMainForm)
    1370             : 
    1371             : // ::com::sun::star::container::XNameContainer
    1372           0 : void SbaXFormAdapter::implInsert(const Any& aElement, sal_Int32 nIndex, const OUString* pNewElName) throw( ::com::sun::star::lang::IllegalArgumentException )
    1373             : {
    1374             :     // extract the form component
    1375           0 :     if (aElement.getValueType().getTypeClass() != TypeClass_INTERFACE)
    1376             :     {
    1377           0 :         throw ::com::sun::star::lang::IllegalArgumentException();
    1378             :     }
    1379             : 
    1380           0 :     Reference< ::com::sun::star::form::XFormComponent >  xElement(*(Reference< XInterface > *)aElement.getValue(), UNO_QUERY);
    1381           0 :     if (!xElement.is())
    1382             :     {
    1383           0 :         throw ::com::sun::star::lang::IllegalArgumentException();
    1384             :     }
    1385             : 
    1386             :     // for the name we need the propset
    1387           0 :     Reference< ::com::sun::star::beans::XPropertySet >  xElementSet(xElement, UNO_QUERY);
    1388           0 :     if (!xElementSet.is())
    1389             :     {
    1390           0 :         throw ::com::sun::star::lang::IllegalArgumentException();
    1391             :      }
    1392           0 :     OUString sName;
    1393             :     try
    1394             :     {
    1395           0 :         if (pNewElName)
    1396           0 :             xElementSet->setPropertyValue(PROPERTY_NAME, makeAny(*pNewElName));
    1397             : 
    1398           0 :         xElementSet->getPropertyValue(PROPERTY_NAME) >>= sName;
    1399             :     }
    1400           0 :     catch(Exception&)
    1401             :     {
    1402             :         // the set didn't support the name prop
    1403           0 :         throw ::com::sun::star::lang::IllegalArgumentException();
    1404             :     }
    1405             : 
    1406             :     // check the index
    1407             :     OSL_ASSERT(nIndex >= 0);
    1408           0 :     if (sal::static_int_cast< sal_uInt32 >(nIndex) > m_aChildren.size())
    1409           0 :         nIndex = m_aChildren.size();
    1410             : 
    1411             :     OSL_ENSURE(m_aChildren.size() == m_aChildNames.size(), "SAL_CALL SbaXFormAdapter::implInsert : inconsistent container state !");
    1412           0 :     m_aChildren.insert(m_aChildren.begin() + nIndex, xElement);
    1413           0 :     m_aChildNames.insert(m_aChildNames.begin() + nIndex, sName);
    1414             : 
    1415             :     // listen for a changes of the name
    1416           0 :     xElementSet->addPropertyChangeListener(PROPERTY_NAME, (::com::sun::star::beans::XPropertyChangeListener*)this);
    1417             : 
    1418             :     // we are now the parent of the new element
    1419           0 :     xElement->setParent((::com::sun::star::container::XContainer*)this);
    1420             : 
    1421             :     // notify the container listeners
    1422           0 :     ::com::sun::star::container::ContainerEvent aEvt;
    1423           0 :     aEvt.Source = *this;
    1424           0 :     aEvt.Accessor <<= nIndex;
    1425           0 :     aEvt.Element <<= xElement;
    1426           0 :     ::cppu::OInterfaceIteratorHelper aIt(m_aContainerListeners);
    1427           0 :     while (aIt.hasMoreElements())
    1428           0 :         static_cast< ::com::sun::star::container::XContainerListener*>(aIt.next())->elementInserted(aEvt);
    1429           0 : }
    1430             : 
    1431           0 : sal_Int32 SbaXFormAdapter::implGetPos(const OUString& rName)
    1432             : {
    1433             :     ::std::vector< OUString>::iterator aIter = ::std::find_if(   m_aChildNames.begin(),
    1434             :                                                                 m_aChildNames.end(),
    1435           0 :                                                                 ::std::bind2nd(::std::equal_to< OUString>(),rName));
    1436             : 
    1437           0 :     if(aIter != m_aChildNames.end())
    1438           0 :         return aIter - m_aChildNames.begin();
    1439             : 
    1440           0 :     return -1;
    1441             : }
    1442             : 
    1443           0 : void SAL_CALL SbaXFormAdapter::insertByName(const OUString& aName, const Any& aElement) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, RuntimeException, std::exception )
    1444             : {
    1445           0 :     implInsert(aElement, m_aChildren.size(), &aName);
    1446           0 : }
    1447             : 
    1448           0 : void SAL_CALL SbaXFormAdapter::removeByName(const OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, RuntimeException, std::exception )
    1449             : {
    1450           0 :     sal_Int32 nPos = implGetPos(Name);
    1451           0 :     if (-1 == nPos)
    1452             :     {
    1453           0 :         throw ::com::sun::star::container::NoSuchElementException();
    1454             :     }
    1455           0 :     removeByIndex(nPos);
    1456           0 : }
    1457             : 
    1458             : // ::com::sun::star::container::XNameReplace
    1459           0 : void SAL_CALL SbaXFormAdapter::replaceByName(const OUString& aName, const Any& aElement) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, RuntimeException, std::exception )
    1460             : {
    1461           0 :     sal_Int32 nPos = implGetPos(aName);
    1462           0 :     if (-1 == nPos)
    1463             :     {
    1464           0 :         throw ::com::sun::star::container::NoSuchElementException();
    1465             :     }
    1466           0 :     replaceByIndex(nPos, aElement);
    1467           0 : }
    1468             : 
    1469             : // ::com::sun::star::container::XNameAccess
    1470           0 : Any SAL_CALL SbaXFormAdapter::getByName(const OUString& aName) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, RuntimeException, std::exception )
    1471             : {
    1472           0 :     sal_Int32 nPos = implGetPos(aName);
    1473           0 :     if (-1 == nPos)
    1474             :     {
    1475           0 :         throw ::com::sun::star::container::NoSuchElementException();
    1476             :     }
    1477           0 :     return makeAny(m_aChildren[nPos]);
    1478             : }
    1479             : 
    1480           0 : Sequence< OUString > SAL_CALL SbaXFormAdapter::getElementNames() throw( RuntimeException, std::exception )
    1481             : {
    1482           0 :     OUString *pChildNames = m_aChildNames.empty() ? 0 : &m_aChildNames[0];
    1483           0 :     return Sequence< OUString >(pChildNames, m_aChildNames.size());
    1484             : }
    1485             : 
    1486           0 : sal_Bool SAL_CALL SbaXFormAdapter::hasByName(const OUString& aName) throw( RuntimeException, std::exception )
    1487             : {
    1488           0 :     return (-1 != implGetPos(aName));
    1489             : }
    1490             : 
    1491             : // ::com::sun::star::container::XElementAccess
    1492           0 : Type SAL_CALL SbaXFormAdapter::getElementType() throw(RuntimeException, std::exception)
    1493             : {
    1494           0 :     return cppu::UnoType<com::sun::star::form::XFormComponent>::get();
    1495             : }
    1496             : 
    1497           0 : sal_Bool SAL_CALL SbaXFormAdapter::hasElements() throw(RuntimeException, std::exception)
    1498             : {
    1499           0 :     return m_aChildren.size() > 0;
    1500             : }
    1501             : 
    1502             : // ::com::sun::star::container::XIndexContainer
    1503           0 : 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, std::exception )
    1504             : {
    1505           0 :     if ( ( _rIndex < 0 ) || ( (size_t)_rIndex >= m_aChildren.size() ) )
    1506           0 :         throw ::com::sun::star::lang::IndexOutOfBoundsException();
    1507           0 :     implInsert(Element, _rIndex);
    1508           0 : }
    1509             : 
    1510           0 : void SAL_CALL SbaXFormAdapter::removeByIndex(sal_Int32 _rIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, RuntimeException, std::exception )
    1511             : {
    1512           0 :     if ( ( _rIndex < 0 ) || ( (size_t)_rIndex >= m_aChildren.size() ) )
    1513           0 :         throw ::com::sun::star::lang::IndexOutOfBoundsException();
    1514             : 
    1515           0 :     Reference< ::com::sun::star::form::XFormComponent >  xAffected = *(m_aChildren.begin() + _rIndex);
    1516             : 
    1517             :     OSL_ENSURE(m_aChildren.size() == m_aChildNames.size(), "SAL_CALL SbaXFormAdapter::removeByIndex : inconsistent container state !");
    1518           0 :     m_aChildren.erase(m_aChildren.begin() + _rIndex);
    1519           0 :     m_aChildNames.erase(m_aChildNames.begin() + _rIndex);
    1520             : 
    1521             :     // no need to listen anymore
    1522           0 :     Reference< ::com::sun::star::beans::XPropertySet >  xAffectedSet(xAffected, UNO_QUERY);
    1523           0 :     xAffectedSet->removePropertyChangeListener(PROPERTY_NAME, (::com::sun::star::beans::XPropertyChangeListener*)this);
    1524             : 
    1525             :     // we are no longer the parent
    1526           0 :     xAffected->setParent(Reference< XInterface > ());
    1527             : 
    1528             :     // notify container listeners
    1529           0 :     ::com::sun::star::container::ContainerEvent aEvt;
    1530           0 :     aEvt.Source = *this;
    1531           0 :     aEvt.Element <<= xAffected;
    1532           0 :     ::cppu::OInterfaceIteratorHelper aIt(m_aContainerListeners);
    1533           0 :     while (aIt.hasMoreElements())
    1534           0 :         static_cast< ::com::sun::star::container::XContainerListener*>(aIt.next())->elementRemoved(aEvt);
    1535             : 
    1536           0 : }
    1537             : 
    1538             : // ::com::sun::star::container::XIndexReplace
    1539           0 : 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, std::exception )
    1540             : {
    1541           0 :     if ( ( _rIndex < 0 ) || ( (size_t)_rIndex >= m_aChildren.size() ) )
    1542           0 :         throw ::com::sun::star::lang::IndexOutOfBoundsException();
    1543             : 
    1544             :     // extract the form component
    1545           0 :     if (Element.getValueType().getTypeClass() != TypeClass_INTERFACE)
    1546             :     {
    1547           0 :         throw ::com::sun::star::lang::IllegalArgumentException();
    1548             :     }
    1549             : 
    1550           0 :     Reference< ::com::sun::star::form::XFormComponent >  xElement(*(Reference< XInterface > *)Element.getValue(), UNO_QUERY);
    1551           0 :     if (!xElement.is())
    1552             :     {
    1553           0 :         throw ::com::sun::star::lang::IllegalArgumentException();
    1554             :     }
    1555             : 
    1556             :     // for the name we need the propset
    1557           0 :     Reference< ::com::sun::star::beans::XPropertySet >  xElementSet(xElement, UNO_QUERY);
    1558           0 :     if (!xElementSet.is())
    1559             :     {
    1560           0 :         throw ::com::sun::star::lang::IllegalArgumentException();
    1561             :      }
    1562           0 :     OUString sName;
    1563             :     try
    1564             :     {
    1565           0 :         xElementSet->getPropertyValue(PROPERTY_NAME) >>= sName;
    1566             :     }
    1567           0 :     catch(Exception&)
    1568             :     {
    1569             :         // the set didn't support the name prop
    1570           0 :         throw ::com::sun::star::lang::IllegalArgumentException();
    1571             :     }
    1572             : 
    1573           0 :     Reference< ::com::sun::star::form::XFormComponent >  xOld = *(m_aChildren.begin() + _rIndex);
    1574             : 
    1575             :     OSL_ENSURE(m_aChildren.size() == m_aChildNames.size(), "SAL_CALL SbaXFormAdapter::replaceByIndex : inconsistent container state !");
    1576           0 :     *(m_aChildren.begin() + _rIndex) = xElement;
    1577           0 :     *(m_aChildNames.begin() + _rIndex) = sName;
    1578             : 
    1579             :     // correct property change listening
    1580           0 :     Reference< ::com::sun::star::beans::XPropertySet >  xOldSet(xOld, UNO_QUERY);
    1581           0 :     xOldSet->removePropertyChangeListener(PROPERTY_NAME, (::com::sun::star::beans::XPropertyChangeListener*)this);
    1582           0 :     xElementSet->addPropertyChangeListener(PROPERTY_NAME, (::com::sun::star::beans::XPropertyChangeListener*)this);
    1583             : 
    1584             :     // parent reset
    1585           0 :     xOld->setParent(Reference< XInterface > ());
    1586           0 :     xElement->setParent((::com::sun::star::container::XContainer*)this);
    1587             : 
    1588             :     // notify container listeners
    1589           0 :     ::com::sun::star::container::ContainerEvent aEvt;
    1590           0 :     aEvt.Source = *this;
    1591           0 :     aEvt.Accessor <<= (sal_Int32)_rIndex;
    1592           0 :     aEvt.Element <<= xElement;
    1593           0 :     aEvt.ReplacedElement <<= xOld;
    1594             : 
    1595           0 :     ::cppu::OInterfaceIteratorHelper aIt(m_aContainerListeners);
    1596           0 :     while (aIt.hasMoreElements())
    1597           0 :         static_cast< ::com::sun::star::container::XContainerListener*>(aIt.next())->elementReplaced(aEvt);
    1598           0 : }
    1599             : 
    1600             : // ::com::sun::star::container::XIndexAccess
    1601           0 : sal_Int32 SAL_CALL SbaXFormAdapter::getCount() throw( RuntimeException, std::exception )
    1602             : {
    1603           0 :     return m_aChildren.size();
    1604             : }
    1605             : 
    1606           0 : Any SAL_CALL SbaXFormAdapter::getByIndex(sal_Int32 _rIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, RuntimeException, std::exception )
    1607             : {
    1608           0 :     if ( ( _rIndex < 0 ) || ( (size_t)_rIndex >= m_aChildren.size() ) )
    1609           0 :         throw ::com::sun::star::lang::IndexOutOfBoundsException();
    1610             : 
    1611           0 :     Reference< ::com::sun::star::form::XFormComponent >  xElement = *(m_aChildren.begin() + _rIndex);
    1612           0 :     return makeAny(xElement);
    1613             : }
    1614             : 
    1615             : // ::com::sun::star::container::XContainer
    1616           0 : void SAL_CALL SbaXFormAdapter::addContainerListener(const Reference< ::com::sun::star::container::XContainerListener >& xListener) throw( RuntimeException, std::exception )
    1617             : {
    1618           0 :     m_aContainerListeners.addInterface(xListener);
    1619           0 : }
    1620             : 
    1621           0 : void SAL_CALL SbaXFormAdapter::removeContainerListener(const Reference< ::com::sun::star::container::XContainerListener >& xListener) throw( RuntimeException, std::exception )
    1622             : {
    1623           0 :     m_aContainerListeners.removeInterface(xListener);
    1624           0 : }
    1625             : 
    1626             : // ::com::sun::star::container::XEnumerationAccess
    1627           0 : Reference< ::com::sun::star::container::XEnumeration > SAL_CALL SbaXFormAdapter::createEnumeration() throw( RuntimeException, std::exception )
    1628             : {
    1629           0 :     return new ::comphelper::OEnumerationByName(this);
    1630             : }
    1631             : 
    1632             : // ::com::sun::star::beans::XPropertyChangeListener
    1633           0 : void SAL_CALL SbaXFormAdapter::propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( RuntimeException, std::exception )
    1634             : {
    1635           0 :     if (evt.PropertyName.equals(PROPERTY_NAME))
    1636             :     {
    1637             :         ::std::vector<  ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > >::iterator aIter = ::std::find_if(  m_aChildren.begin(),
    1638             :                                                                 m_aChildren.end(),
    1639           0 :                                                                 ::std::bind2nd(::std::equal_to< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >(),evt.Source));
    1640             : 
    1641           0 :         if(aIter != m_aChildren.end())
    1642             :         {
    1643           0 :             sal_Int32 nPos = aIter - m_aChildren.begin();
    1644             :             OSL_ENSURE(*(m_aChildNames.begin() + nPos) == ::comphelper::getString(evt.OldValue), "SAL_CALL SbaXFormAdapter::propertyChange : object has a wrong name !");
    1645           0 :             *(m_aChildNames.begin() + nPos) = ::comphelper::getString(evt.NewValue);
    1646             :         }
    1647             :     }
    1648           0 : }
    1649             : 
    1650             : // ::com::sun::star::lang::XEventListener
    1651           0 : void SAL_CALL SbaXFormAdapter::disposing(const ::com::sun::star::lang::EventObject& Source) throw( RuntimeException, std::exception )
    1652             : {
    1653             :     // was it our main form ?
    1654           0 :     if (Source.Source == m_xMainForm)
    1655           0 :         dispose();
    1656             : 
    1657             :     ::std::vector<  ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > >::iterator aIter = ::std::find_if(  m_aChildren.begin(),
    1658             :                                                                 m_aChildren.end(),
    1659           0 :                                                                 ::std::bind2nd(::std::equal_to< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >(),Source.Source));
    1660           0 :     if(aIter != m_aChildren.end())
    1661           0 :             removeByIndex(aIter - m_aChildren.begin());
    1662           0 : }
    1663             : 
    1664             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10