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

Generated by: LCOV version 1.10