LCOV - code coverage report
Current view: top level - forms/source/component - DatabaseForm.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 493 1900 25.9 %
Date: 2012-08-25 Functions: 64 185 34.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 455 3736 12.2 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "componenttools.hxx"
      31                 :            : #include "DatabaseForm.hxx"
      32                 :            : #include "EventThread.hxx"
      33                 :            : #include "frm_module.hxx"
      34                 :            : #include "frm_resource.hrc"
      35                 :            : #include "frm_resource.hxx"
      36                 :            : #include "GroupManager.hxx"
      37                 :            : #include "property.hrc"
      38                 :            : #include "property.hxx"
      39                 :            : #include "services.hxx"
      40                 :            : 
      41                 :            : #include <com/sun/star/awt/XControlContainer.hpp>
      42                 :            : #include <com/sun/star/awt/XTextComponent.hpp>
      43                 :            : #include <com/sun/star/form/DataSelectionType.hpp>
      44                 :            : #include <com/sun/star/form/FormComponentType.hpp>
      45                 :            : #include <com/sun/star/form/TabulatorCycle.hpp>
      46                 :            : #include <com/sun/star/frame/FrameSearchFlag.hpp>
      47                 :            : #include <com/sun/star/frame/XDispatch.hpp>
      48                 :            : #include <com/sun/star/frame/XDispatchProvider.hpp>
      49                 :            : #include <com/sun/star/frame/XModel.hpp>
      50                 :            : #include <com/sun/star/io/XObjectInputStream.hpp>
      51                 :            : #include <com/sun/star/io/XObjectOutputStream.hpp>
      52                 :            : #include <com/sun/star/sdb/CommandType.hpp>
      53                 :            : #include <com/sun/star/sdb/RowSetVetoException.hpp>
      54                 :            : #include <com/sun/star/sdb/SQLContext.hpp>
      55                 :            : #include <com/sun/star/sdb/XColumnUpdate.hpp>
      56                 :            : #include <com/sun/star/sdbc/DataType.hpp>
      57                 :            : #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
      58                 :            : #include <com/sun/star/sdbc/ResultSetType.hpp>
      59                 :            : #include <com/sun/star/sdbc/XRowSet.hpp>
      60                 :            : #include <com/sun/star/sdbcx/Privilege.hpp>
      61                 :            : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
      62                 :            : #include <com/sun/star/util/XCancellable.hpp>
      63                 :            : #include <com/sun/star/util/URLTransformer.hpp>
      64                 :            : #include <com/sun/star/util/XURLTransformer.hpp>
      65                 :            : #include <com/sun/star/util/XModifiable2.hpp>
      66                 :            : 
      67                 :            : #include <comphelper/componentcontext.hxx>
      68                 :            : #include <comphelper/basicio.hxx>
      69                 :            : #include <comphelper/container.hxx>
      70                 :            : #include <comphelper/enumhelper.hxx>
      71                 :            : #include <comphelper/extract.hxx>
      72                 :            : #include <comphelper/seqstream.hxx>
      73                 :            : #include <comphelper/sequence.hxx>
      74                 :            : #include <comphelper/stl_types.hxx>
      75                 :            : #include <comphelper/uno3.hxx>
      76                 :            : #include <connectivity/dbtools.hxx>
      77                 :            : #include <cppuhelper/exc_hlp.hxx>
      78                 :            : #include <cppuhelper/implbase2.hxx>
      79                 :            : #include <rtl/math.hxx>
      80                 :            : #include <rtl/tencinfo.h>
      81                 :            : #include <svl/inetstrm.hxx>
      82                 :            : #include <svl/inettype.hxx>
      83                 :            : #include <tools/debug.hxx>
      84                 :            : #include <tools/diagnose_ex.h>
      85                 :            : #include <tools/fsys.hxx>
      86                 :            : #include <tools/inetmsg.hxx>
      87                 :            : #include <tools/urlobj.hxx>
      88                 :            : #include <unotools/ucblockbytes.hxx>
      89                 :            : #include <unotools/ucbstreamhelper.hxx>
      90                 :            : #include <vcl/svapp.hxx>
      91                 :            : #include <vcl/timer.hxx>
      92                 :            : #include <osl/mutex.hxx>
      93                 :            : 
      94                 :            : #include <ctype.h>
      95                 :            : #include <boost/unordered_map.hpp>
      96                 :            : 
      97                 :            : // compatiblity: DatabaseCursorType is dead, but for compatiblity reasons we still have to write it ...
      98                 :            : namespace com {
      99                 :            : namespace sun {
     100                 :            : namespace star {
     101                 :            : namespace data {
     102                 :            : 
     103                 :            : enum DatabaseCursorType
     104                 :            : {
     105                 :            :     DatabaseCursorType_FORWARD = 0,
     106                 :            :     DatabaseCursorType_SNAPSHOT = 1,
     107                 :            :     DatabaseCursorType_KEYSET = 2,
     108                 :            :     DatabaseCursorType_DYNAMIC = 3,
     109                 :            :     DatabaseCursorType_MAKE_FIXED_SIZE = SAL_MAX_ENUM
     110                 :            : };
     111                 :            : 
     112                 :            : } } } }
     113                 :            : 
     114                 :            : using namespace ::dbtools;
     115                 :            : using namespace ::comphelper;
     116                 :            : using namespace ::com::sun::star::uno;
     117                 :            : using namespace ::com::sun::star::sdb;
     118                 :            : using namespace ::com::sun::star::sdbc;
     119                 :            : using namespace ::com::sun::star::sdbcx;
     120                 :            : using namespace ::com::sun::star::beans;
     121                 :            : using namespace ::com::sun::star::container;
     122                 :            : using namespace ::com::sun::star::task;
     123                 :            : using namespace ::com::sun::star::frame;
     124                 :            : using namespace ::com::sun::star::form;
     125                 :            : using namespace ::com::sun::star::awt;
     126                 :            : using namespace ::com::sun::star::io;
     127                 :            : using namespace ::com::sun::star::lang;
     128                 :            : using namespace ::com::sun::star::data;
     129                 :            : using namespace ::com::sun::star::util;
     130                 :            : 
     131                 :            : //--------------------------------------------------------------------------
     132                 :         30 : extern "C" void SAL_CALL createRegistryInfo_ODatabaseForm()
     133                 :            : {
     134 [ +  - ][ +  - ]:         30 :     static ::frm::OMultiInstanceAutoRegistration< ::frm::ODatabaseForm > aAutoRegistration;
         [ +  - ][ #  # ]
     135                 :         30 : }
     136                 :            : 
     137                 :            : //.........................................................................
     138                 :            : namespace frm
     139                 :            : {
     140                 :            : //.........................................................................
     141                 :            : 
     142                 :            : //==================================================================
     143                 :            : //= DocumentModifyGuard
     144                 :            : //==================================================================
     145                 :            : class DocumentModifyGuard
     146                 :            : {
     147                 :            : public:
     148                 :          0 :     DocumentModifyGuard( const Reference< XInterface >& _rxFormComponent )
     149         [ #  # ]:          0 :         :m_xDocumentModify( getXModel( _rxFormComponent ), UNO_QUERY )
     150                 :            :     {
     151         [ #  # ]:          0 :         impl_changeModifiableFlag_nothrow( false );
     152                 :          0 :     }
     153                 :          0 :     ~DocumentModifyGuard()
     154                 :          0 :     {
     155         [ #  # ]:          0 :         impl_changeModifiableFlag_nothrow( true );
     156                 :          0 :     }
     157                 :            : 
     158                 :            : private:
     159                 :          0 :     void    impl_changeModifiableFlag_nothrow( const bool _enable )
     160                 :            :     {
     161                 :            :         try
     162                 :            :         {
     163         [ #  # ]:          0 :             if ( m_xDocumentModify.is() )
     164 [ #  # ][ #  # ]:          0 :                 _enable ? m_xDocumentModify->enableSetModified() : m_xDocumentModify->disableSetModified();
         [ #  # ][ #  # ]
                 [ #  # ]
     165                 :            :         }
     166                 :          0 :         catch(const Exception&)
     167                 :            :         {
     168                 :            :             DBG_UNHANDLED_EXCEPTION();
     169                 :            :         }
     170         [ #  # ]:          0 :     }
     171                 :            : 
     172                 :            : private:
     173                 :            :     Reference< XModifiable2 >   m_xDocumentModify;
     174                 :            : };
     175                 :            : 
     176                 :            : //==================================================================
     177                 :            : //= OFormSubmitResetThread
     178                 :            : //=-----------------------------------------------------------------
     179                 :            : //= submitting and resetting html-forms asynchronously
     180                 :            : //==================================================================
     181                 :            : 
     182                 :            : //------------------------------------------------------------------
     183         [ #  # ]:          0 : class OFormSubmitResetThread: public OComponentEventThread
     184                 :            : {
     185                 :            : protected:
     186                 :            : 
     187                 :            :     // duplicate an event with respect to it's type
     188                 :            :     virtual EventObject *cloneEvent( const EventObject *pEvt ) const;
     189                 :            : 
     190                 :            :     // process an event. while processing the mutex isn't locked, and pCompImpl
     191                 :            :     // is made sure to remain valid
     192                 :            :     virtual void processEvent( ::cppu::OComponentHelper* _pCompImpl,
     193                 :            :                                const EventObject* _pEvt,
     194                 :            :                                const Reference<XControl>& _rControl,
     195                 :            :                                sal_Bool _bSubmit);
     196                 :            : 
     197                 :            : public:
     198                 :            : 
     199                 :          0 :     OFormSubmitResetThread(ODatabaseForm* pControl) : OComponentEventThread(pControl) { }
     200                 :            : };
     201                 :            : 
     202                 :            : //------------------------------------------------------------------
     203                 :          0 : EventObject* OFormSubmitResetThread::cloneEvent(
     204                 :            :         const EventObject *pEvt ) const
     205                 :            : {
     206         [ #  # ]:          0 :     return new ::com::sun::star::awt::MouseEvent( *(::com::sun::star::awt::MouseEvent *)pEvt );
     207                 :            : }
     208                 :            : 
     209                 :            : //------------------------------------------------------------------
     210                 :          0 : void OFormSubmitResetThread::processEvent(
     211                 :            :         ::cppu::OComponentHelper* pCompImpl,
     212                 :            :         const EventObject *_pEvt,
     213                 :            :         const Reference<XControl>& _rControl,
     214                 :            :         sal_Bool _bSubmit)
     215                 :            : {
     216         [ #  # ]:          0 :     if (_bSubmit)
     217                 :          0 :         ((ODatabaseForm *)pCompImpl)->submit_impl(_rControl, *static_cast<const ::com::sun::star::awt::MouseEvent*>(_pEvt), true);
     218                 :            :     else
     219                 :          0 :         ((ODatabaseForm *)pCompImpl)->reset_impl(true);
     220                 :          0 : }
     221                 :            : 
     222                 :            : //==================================================================
     223                 :            : //= ODatabaseForm
     224                 :            : //==================================================================
     225                 :            : 
     226                 :            : //------------------------------------------------------------------
     227                 :        278 : Reference< XInterface > SAL_CALL ODatabaseForm::Create( const Reference< XMultiServiceFactory >& _rxFactory )
     228                 :            : {
     229         [ +  - ]:        278 :     return *( new ODatabaseForm( _rxFactory ) );
     230                 :            : }
     231                 :            : 
     232                 :            : //------------------------------------------------------------------------------
     233                 :          0 : Sequence<sal_Int8> SAL_CALL ODatabaseForm::getImplementationId() throw(RuntimeException)
     234                 :            : {
     235         [ #  # ]:          0 :     return OImplementationIds::getImplementationId(getTypes());
     236                 :            : }
     237                 :            : 
     238                 :            : //------------------------------------------------------------------
     239                 :          0 : Sequence<Type> SAL_CALL ODatabaseForm::getTypes() throw(RuntimeException)
     240                 :            : {
     241                 :            :     // ask the aggregate
     242         [ #  # ]:          0 :     Sequence<Type> aAggregateTypes;
     243                 :          0 :     Reference<XTypeProvider> xAggregateTypes;
     244 [ #  # ][ #  # ]:          0 :     if (query_aggregation(m_xAggregate, xAggregateTypes))
     245 [ #  # ][ #  # ]:          0 :         aAggregateTypes = xAggregateTypes->getTypes();
         [ #  # ][ #  # ]
     246                 :            : 
     247                 :            :     Sequence< Type > aRet = concatSequences(
     248                 :            :         aAggregateTypes, ODatabaseForm_BASE1::getTypes(), OFormComponents::getTypes()
     249 [ #  # ][ #  # ]:          0 :     );
         [ #  # ][ #  # ]
                 [ #  # ]
     250 [ #  # ][ #  # ]:          0 :     aRet = concatSequences( aRet, ODatabaseForm_BASE2::getTypes(), ODatabaseForm_BASE3::getTypes() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     251 [ #  # ][ #  # ]:          0 :     return concatSequences( aRet, OPropertySetAggregationHelper::getTypes() );
         [ #  # ][ #  # ]
                 [ #  # ]
     252                 :            : }
     253                 :            : 
     254                 :            : //------------------------------------------------------------------
     255                 :      34464 : Any SAL_CALL ODatabaseForm::queryAggregation(const Type& _rType) throw(RuntimeException)
     256                 :            : {
     257                 :      34464 :     Any aReturn = ODatabaseForm_BASE1::queryInterface(_rType);
     258                 :            :     // our own interfaces
     259         [ +  + ]:      34464 :     if (!aReturn.hasValue())
     260                 :            :     {
     261         [ +  - ]:      13647 :         aReturn = ODatabaseForm_BASE2::queryInterface(_rType);
     262                 :            :         // property set related interfaces
     263         [ +  + ]:      13647 :         if (!aReturn.hasValue())
     264                 :            :         {
     265         [ +  - ]:      13629 :             aReturn = OPropertySetAggregationHelper::queryInterface(_rType);
     266                 :            : 
     267                 :            :             // form component collection related interfaces
     268         [ +  + ]:      13629 :             if (!aReturn.hasValue())
     269                 :            :             {
     270         [ +  - ]:       9776 :                 aReturn = OFormComponents::queryAggregation(_rType);
     271                 :            : 
     272                 :            :                 // interfaces already present in the aggregate which we want to reroute
     273                 :            :                 // only available if we could create the aggregate
     274 [ +  - ][ +  + ]:       9776 :                 if (!aReturn.hasValue() && m_xAggregateAsRowSet.is())
                 [ +  + ]
     275         [ +  - ]:       2407 :                     aReturn = ODatabaseForm_BASE3::queryInterface(_rType);
     276                 :            : 
     277                 :            :                 // aggregate interfaces
     278                 :            :                 // (ask the aggregated object _after_ the OComponentHelper (base of OFormComponents),
     279                 :            :                 // so calls to the XComponent interface reach us and not the aggreagtion)
     280 [ +  + ][ +  - ]:       9776 :                 if (!aReturn.hasValue() && m_xAggregate.is())
                 [ +  + ]
     281 [ +  - ][ +  - ]:       2010 :                     aReturn = m_xAggregate->queryAggregation(_rType);
     282                 :            :             }
     283                 :            :         }
     284                 :            :     }
     285                 :            : 
     286                 :      34464 :     return aReturn;
     287                 :            : }
     288                 :            : 
     289                 :            : DBG_NAME(ODatabaseForm);
     290                 :            : //------------------------------------------------------------------
     291                 :        278 : ODatabaseForm::ODatabaseForm(const Reference<XMultiServiceFactory>& _rxFactory)
     292                 :            :     :OFormComponents(_rxFactory)
     293                 :            :     ,OPropertySetAggregationHelper(OComponentHelper::rBHelper)
     294                 :            :     ,OPropertyChangeListener(m_aMutex)
     295                 :            :     ,m_aLoadListeners(m_aMutex)
     296                 :            :     ,m_aRowSetApproveListeners(m_aMutex)
     297                 :            :     ,m_aRowSetListeners(m_aMutex)
     298                 :            :     ,m_aSubmitListeners(m_aMutex)
     299                 :            :     ,m_aErrorListeners(m_aMutex)
     300                 :            :     ,m_aResetListeners( *this, m_aMutex )
     301                 :            :     ,m_aPropertyBagHelper( *this )
     302                 :            :     ,m_pAggregatePropertyMultiplexer(NULL)
     303                 :            :     ,m_pGroupManager( NULL )
     304                 :            :     ,m_aParameterManager( m_aMutex, _rxFactory )
     305                 :            :     ,m_aFilterManager( _rxFactory )
     306                 :            :     ,m_pLoadTimer(NULL)
     307                 :            :     ,m_pThread(NULL)
     308                 :            :     ,m_nResetsPending(0)
     309                 :            :     ,m_nPrivileges(0)
     310                 :            :     ,m_bInsertOnly( sal_False )
     311                 :            :     ,m_eSubmitMethod(FormSubmitMethod_GET)
     312                 :            :     ,m_eSubmitEncoding(FormSubmitEncoding_URL)
     313                 :            :     ,m_eNavigation(NavigationBarMode_CURRENT)
     314                 :            :     ,m_bAllowInsert(sal_True)
     315                 :            :     ,m_bAllowUpdate(sal_True)
     316                 :            :     ,m_bAllowDelete(sal_True)
     317                 :            :     ,m_bLoaded(sal_False)
     318                 :            :     ,m_bSubForm(sal_False)
     319                 :            :     ,m_bForwardingConnection(sal_False)
     320 [ +  - ][ +  - ]:        278 :     ,m_bSharingConnection( sal_False )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     321                 :            : {
     322                 :            :     DBG_CTOR( ODatabaseForm, NULL );
     323         [ +  - ]:        278 :     impl_construct();
     324                 :        278 : }
     325                 :            : 
     326                 :            : //------------------------------------------------------------------
     327                 :          0 : ODatabaseForm::ODatabaseForm( const ODatabaseForm& _cloneSource )
     328                 :            :     :OFormComponents( _cloneSource )
     329                 :            :     ,OPropertySetAggregationHelper( OComponentHelper::rBHelper )
     330                 :            :     ,OPropertyChangeListener( m_aMutex )
     331                 :            :     ,ODatabaseForm_BASE1()
     332                 :            :     ,ODatabaseForm_BASE2()
     333                 :            :     ,ODatabaseForm_BASE3()
     334                 :            :     ,IPropertyBagHelperContext()
     335                 :            :     ,m_aLoadListeners( m_aMutex )
     336                 :            :     ,m_aRowSetApproveListeners( m_aMutex )
     337                 :            :     ,m_aRowSetListeners( m_aMutex )
     338                 :            :     ,m_aSubmitListeners( m_aMutex )
     339                 :            :     ,m_aErrorListeners( m_aMutex )
     340                 :            :     ,m_aResetListeners( *this, m_aMutex )
     341                 :            :     ,m_aPropertyBagHelper( *this )
     342                 :            :     ,m_pAggregatePropertyMultiplexer( NULL )
     343                 :            :     ,m_pGroupManager( NULL )
     344                 :            :     ,m_aParameterManager( m_aMutex, _cloneSource.m_xServiceFactory )
     345                 :            :     ,m_aFilterManager( _cloneSource.m_xServiceFactory )
     346                 :            :     ,m_pLoadTimer( NULL )
     347                 :            :     ,m_pThread( NULL )
     348                 :            :     ,m_nResetsPending( 0 )
     349                 :            :     ,m_nPrivileges( 0 )
     350                 :            :     ,m_bInsertOnly( _cloneSource.m_bInsertOnly )
     351                 :            :     ,m_aControlBorderColorFocus( _cloneSource.m_aControlBorderColorFocus )
     352                 :            :     ,m_aControlBorderColorMouse( _cloneSource.m_aControlBorderColorMouse )
     353                 :            :     ,m_aControlBorderColorInvalid( _cloneSource.m_aControlBorderColorInvalid )
     354                 :            :     ,m_aDynamicControlBorder( _cloneSource.m_aDynamicControlBorder )
     355                 :            :     ,m_sName( _cloneSource.m_sName )
     356                 :            :     ,m_aTargetURL( _cloneSource.m_aTargetURL )
     357                 :            :     ,m_aTargetFrame( _cloneSource.m_aTargetFrame )
     358                 :            :     ,m_eSubmitMethod( _cloneSource.m_eSubmitMethod )
     359                 :            :     ,m_eSubmitEncoding( _cloneSource.m_eSubmitEncoding )
     360                 :            :     ,m_eNavigation( _cloneSource.m_eNavigation )
     361                 :            :     ,m_bAllowInsert( _cloneSource.m_bAllowInsert )
     362                 :            :     ,m_bAllowUpdate( _cloneSource.m_bAllowUpdate )
     363                 :            :     ,m_bAllowDelete( _cloneSource.m_bAllowDelete )
     364                 :            :     ,m_bLoaded( sal_False )
     365                 :            :     ,m_bSubForm( sal_False )
     366                 :            :     ,m_bForwardingConnection( sal_False )
     367 [ #  # ][ #  # ]:          0 :     ,m_bSharingConnection( sal_False )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     368                 :            : {
     369                 :            :     DBG_CTOR( ODatabaseForm, NULL );
     370                 :            : 
     371         [ #  # ]:          0 :     impl_construct();
     372                 :            : 
     373         [ #  # ]:          0 :     osl_incrementInterlockedCount( &m_refCount );
     374                 :            :     {
     375                 :            :         // our aggregated rowset itself is not cloneable, so simply copy the properties
     376         [ #  # ]:          0 :         ::comphelper::copyProperties( _cloneSource.m_xAggregateSet, m_xAggregateSet );
     377                 :            : 
     378                 :            :         // also care for the dynamic properties: If the clone source has properties which we do not have,
     379                 :            :         // then add them
     380                 :            :         try
     381                 :            :         {
     382                 :            :             Reference< XPropertySet > xSourceProps( const_cast< ODatabaseForm& >( _cloneSource ).queryAggregation(
     383 [ #  # ][ #  # ]:          0 :                 XPropertySet::static_type() ), UNO_QUERY_THROW );
                 [ #  # ]
     384 [ #  # ][ #  # ]:          0 :             Reference< XPropertySetInfo > xSourcePSI( xSourceProps->getPropertySetInfo(), UNO_SET_THROW );
                 [ #  # ]
     385         [ #  # ]:          0 :             Reference< XPropertyState > xSourcePropState( xSourceProps, UNO_QUERY );
     386                 :            : 
     387 [ #  # ][ #  # ]:          0 :             Reference< XPropertySetInfo > xDestPSI( getPropertySetInfo(), UNO_QUERY_THROW );
     388                 :            : 
     389 [ #  # ][ #  # ]:          0 :             Sequence< Property > aSourceProperties( xSourcePSI->getProperties() );
     390         [ #  # ]:          0 :             for (   const Property* pSourceProperty = aSourceProperties.getConstArray();
     391                 :          0 :                     pSourceProperty != aSourceProperties.getConstArray() + aSourceProperties.getLength();
     392                 :            :                     ++pSourceProperty
     393                 :            :                 )
     394                 :            :             {
     395 [ #  # ][ #  # ]:          0 :                 if ( xDestPSI->hasPropertyByName( pSourceProperty->Name ) )
                 [ #  # ]
     396                 :          0 :                     continue;
     397                 :            : 
     398                 :            :                 // the initial value passed to XPropertyContainer is also used as default, usually. So, try
     399                 :            :                 // to retrieve the default of the source property
     400                 :          0 :                 Any aInitialValue;
     401         [ #  # ]:          0 :                 if ( xSourcePropState.is() )
     402                 :            :                 {
     403 [ #  # ][ #  # ]:          0 :                     aInitialValue = xSourcePropState->getPropertyDefault( pSourceProperty->Name );
     404                 :            :                 }
     405                 :            :                 else
     406                 :            :                 {
     407 [ #  # ][ #  # ]:          0 :                     aInitialValue = xSourceProps->getPropertyValue( pSourceProperty->Name );
     408                 :            :                 }
     409         [ #  # ]:          0 :                 addProperty( pSourceProperty->Name, pSourceProperty->Attributes, aInitialValue );
     410 [ #  # ][ #  # ]:          0 :                 setPropertyValue( pSourceProperty->Name, xSourceProps->getPropertyValue( pSourceProperty->Name ) );
                 [ #  # ]
     411         [ #  # ]:          0 :             }
     412                 :            :         }
     413         [ #  # ]:          0 :         catch(const Exception&)
     414                 :            :         {
     415                 :            :             throw WrappedTargetException(
     416                 :            :                 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Could not clone the given database form." ) ),
     417                 :            :                 *const_cast< ODatabaseForm* >( &_cloneSource ),
     418                 :            :                 ::cppu::getCaughtException()
     419   [ #  #  #  #  :          0 :             );
             #  #  #  # ]
     420                 :            :         }
     421                 :            :     }
     422         [ #  # ]:          0 :     osl_decrementInterlockedCount( &m_refCount );
     423                 :          0 : }
     424                 :            : 
     425                 :            : //------------------------------------------------------------------
     426                 :        278 : void ODatabaseForm::impl_construct()
     427                 :            : {
     428                 :            :     // aggregate a row set
     429                 :        278 :     increment(m_refCount);
     430                 :            :     {
     431 [ +  - ][ +  - ]:        278 :         m_xAggregate = Reference< XAggregation >( m_xServiceFactory->createInstance( SRV_SDB_ROWSET ), UNO_QUERY_THROW );
                 [ +  - ]
     432                 :        278 :         m_xAggregateAsRowSet.set( m_xAggregate, UNO_QUERY_THROW );
     433                 :        278 :         setAggregation( m_xAggregate );
     434                 :            :     }
     435                 :            : 
     436                 :            :     // listen for the properties, important for Parameters
     437         [ +  - ]:        278 :     if ( m_xAggregateSet.is() )
     438                 :            :     {
     439         [ +  - ]:        278 :         m_pAggregatePropertyMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet, sal_False);
     440                 :        278 :         m_pAggregatePropertyMultiplexer->acquire();
     441         [ +  - ]:        278 :         m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_COMMAND);
     442         [ +  - ]:        278 :         m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_ACTIVE_CONNECTION);
     443                 :            :     }
     444                 :            : 
     445                 :            :     {
     446         [ +  - ]:        278 :         Reference< XWarningsSupplier > xRowSetWarnings( m_xAggregate, UNO_QUERY );
     447         [ +  - ]:        278 :         m_aWarnings.setExternalWarnings( xRowSetWarnings );
     448                 :            :     }
     449                 :            : 
     450         [ +  - ]:        278 :     if ( m_xAggregate.is() )
     451                 :            :     {
     452         [ +  - ]:        278 :         m_xAggregate->setDelegator( static_cast< XWeak* >( this ) );
     453                 :            :     }
     454                 :            : 
     455                 :            :     {
     456                 :        278 :         m_aFilterManager.initialize( m_xAggregateSet );
     457         [ +  - ]:        278 :         m_aParameterManager.initialize( this, m_xAggregate );
     458                 :            : 
     459                 :        278 :         declareForwardedProperty( PROPERTY_ID_ACTIVE_CONNECTION );
     460                 :            :     }
     461                 :        278 :     decrement( m_refCount );
     462                 :            : 
     463         [ +  - ]:        278 :     m_pGroupManager = new OGroupManager( this );
     464                 :        278 :     m_pGroupManager->acquire();
     465                 :        278 : }
     466                 :            : 
     467                 :            : //------------------------------------------------------------------
     468 [ +  - ][ +  - ]:        271 : ODatabaseForm::~ODatabaseForm()
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     469                 :            : {
     470                 :            :     DBG_DTOR(ODatabaseForm,NULL);
     471                 :            : 
     472                 :        271 :     m_pGroupManager->release();
     473                 :        271 :     m_pGroupManager = NULL;
     474                 :            : 
     475         [ +  - ]:        271 :     if (m_xAggregate.is())
     476 [ +  - ][ +  - ]:        271 :         m_xAggregate->setDelegator( NULL );
                 [ +  - ]
     477                 :            : 
     478 [ +  - ][ +  - ]:        271 :     m_aWarnings.setExternalWarnings( NULL );
     479                 :            : 
     480         [ +  - ]:        271 :     if (m_pAggregatePropertyMultiplexer)
     481                 :            :     {
     482         [ +  - ]:        271 :         m_pAggregatePropertyMultiplexer->dispose();
     483                 :        271 :         m_pAggregatePropertyMultiplexer->release();
     484                 :        271 :         m_pAggregatePropertyMultiplexer = NULL;
     485                 :            :     }
     486         [ -  + ]:        542 : }
     487                 :            : 
     488                 :            : //==============================================================================
     489                 :            : // html tools
     490                 :            : //------------------------------------------------------------------------
     491                 :          0 : ::rtl::OUString ODatabaseForm::GetDataURLEncoded(const Reference<XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt)
     492                 :            : {
     493                 :          0 :     return GetDataEncoded(true,SubmitButton,MouseEvt);
     494                 :            : }
     495                 :            : // -----------------------------------------------------------------------------
     496                 :          0 : ::rtl::OUString ODatabaseForm::GetDataEncoded(bool _bURLEncoded,const Reference<XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt)
     497                 :            : {
     498                 :            :     // Fill List of successful Controls
     499         [ #  # ]:          0 :     HtmlSuccessfulObjList aSuccObjList;
     500         [ #  # ]:          0 :     FillSuccessfulList( aSuccObjList, SubmitButton, MouseEvt );
     501                 :            : 
     502                 :            : 
     503                 :            :     // Aggregate Liste to ::rtl::OUString
     504                 :          0 :     ::rtl::OUStringBuffer aResult;
     505                 :          0 :     ::rtl::OUString aName;
     506                 :          0 :     ::rtl::OUString aValue;
     507                 :            : 
     508 [ #  # ][ #  # ]:          0 :     for (   HtmlSuccessfulObjListIterator pSuccObj = aSuccObjList.begin();
     509                 :          0 :             pSuccObj < aSuccObjList.end();
     510                 :            :             ++pSuccObj
     511                 :            :         )
     512                 :            :     {
     513                 :          0 :         aName = pSuccObj->aName;
     514                 :          0 :         aValue = pSuccObj->aValue;
     515 [ #  # ][ #  # ]:          0 :         if( pSuccObj->nRepresentation == SUCCESSFUL_REPRESENT_FILE && !aValue.isEmpty() )
                 [ #  # ]
     516                 :            :         {
     517                 :            :             // For File URLs we transfer the file name and not a URL, because Netscape does it like that
     518         [ #  # ]:          0 :             INetURLObject aURL;
     519                 :          0 :             aURL.SetSmartProtocol(INET_PROT_FILE);
     520         [ #  # ]:          0 :             aURL.SetSmartURL(aValue);
     521         [ #  # ]:          0 :             if( INET_PROT_FILE == aURL.GetProtocol() )
     522 [ #  # ][ #  # ]:          0 :                 aValue = INetURLObject::decode(aURL.PathToFileName(), '%', INetURLObject::DECODE_UNAMBIGUOUS);
                 [ #  # ]
     523                 :            :         }
     524         [ #  # ]:          0 :         Encode( aName );
     525         [ #  # ]:          0 :         Encode( aValue );
     526                 :            : 
     527         [ #  # ]:          0 :         aResult.append(aName);
     528         [ #  # ]:          0 :         aResult.append(sal_Unicode('='));
     529         [ #  # ]:          0 :         aResult.append(aValue);
     530                 :            : 
     531 [ #  # ][ #  # ]:          0 :         if (pSuccObj < aSuccObjList.end() - 1)
                 [ #  # ]
     532                 :            :         {
     533         [ #  # ]:          0 :             if ( _bURLEncoded )
     534         [ #  # ]:          0 :                 aResult.append(sal_Unicode('&'));
     535                 :            :             else
     536         [ #  # ]:          0 :                 aResult.appendAscii("\r\n");
     537                 :            :         }
     538                 :            :     }
     539                 :            : 
     540                 :            : 
     541                 :          0 :     aSuccObjList.clear();
     542                 :            : 
     543         [ #  # ]:          0 :     return aResult.makeStringAndClear();
     544                 :            : }
     545                 :            : 
     546                 :            : //==============================================================================
     547                 :            : // html tools
     548                 :            : //------------------------------------------------------------------------
     549                 :          0 : ::rtl::OUString ODatabaseForm::GetDataTextEncoded(const Reference<XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt)
     550                 :            : {
     551                 :          0 :     return GetDataEncoded(false,SubmitButton,MouseEvt);
     552                 :            : }
     553                 :            : 
     554                 :            : //------------------------------------------------------------------------
     555                 :          0 : Sequence<sal_Int8> ODatabaseForm::GetDataMultiPartEncoded(const Reference<XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt, ::rtl::OUString& rContentType)
     556                 :            : {
     557                 :            : 
     558                 :            :     // Create Parent
     559         [ #  # ]:          0 :     INetMIMEMessage aParent;
     560         [ #  # ]:          0 :     aParent.EnableAttachChild( INETMSG_MULTIPART_FORM_DATA );
     561                 :            : 
     562                 :            : 
     563                 :            :     // Fill List of successful Controls
     564         [ #  # ]:          0 :     HtmlSuccessfulObjList aSuccObjList;
     565         [ #  # ]:          0 :     FillSuccessfulList( aSuccObjList, SubmitButton, MouseEvt );
     566                 :            : 
     567                 :            : 
     568                 :            :     // Aggregate Liste to ::rtl::OUString
     569                 :          0 :     ::rtl::OUString aResult;
     570 [ #  # ][ #  # ]:          0 :     for (   HtmlSuccessfulObjListIterator pSuccObj = aSuccObjList.begin();
     571                 :          0 :             pSuccObj < aSuccObjList.end();
     572                 :            :             ++pSuccObj
     573                 :            :         )
     574                 :            :     {
     575         [ #  # ]:          0 :         if( pSuccObj->nRepresentation == SUCCESSFUL_REPRESENT_TEXT )
     576         [ #  # ]:          0 :             InsertTextPart( aParent, pSuccObj->aName, pSuccObj->aValue );
     577         [ #  # ]:          0 :         else if( pSuccObj->nRepresentation == SUCCESSFUL_REPRESENT_FILE )
     578         [ #  # ]:          0 :             InsertFilePart( aParent, pSuccObj->aName, pSuccObj->aValue );
     579                 :            :     }
     580                 :            : 
     581                 :            : 
     582                 :            :     // Delete List
     583                 :          0 :     aSuccObjList.clear();
     584                 :            : 
     585                 :            :     // Create MessageStream for parent
     586         [ #  # ]:          0 :     INetMIMEMessageStream aMessStream;
     587                 :          0 :     aMessStream.SetSourceMessage( &aParent );
     588                 :          0 :     aMessStream.GenerateHeader( sal_False );
     589                 :            : 
     590                 :            :     // Copy MessageStream to SvStream
     591         [ #  # ]:          0 :     SvMemoryStream aMemStream;
     592         [ #  # ]:          0 :     char* pBuf = new char[1025];
     593                 :            :     int nRead;
     594 [ #  # ][ #  # ]:          0 :     while( (nRead = aMessStream.Read(pBuf, 1024)) > 0 )
     595         [ #  # ]:          0 :         aMemStream.Write( pBuf, nRead );
     596         [ #  # ]:          0 :     delete[] pBuf;
     597                 :            : 
     598         [ #  # ]:          0 :     aMemStream.Flush();
     599         [ #  # ]:          0 :     aMemStream.Seek( 0 );
     600         [ #  # ]:          0 :     void* pData = (void*)aMemStream.GetData();
     601         [ #  # ]:          0 :     sal_Int32 nLen = aMemStream.Seek(STREAM_SEEK_TO_END);
     602                 :            : 
     603 [ #  # ][ #  # ]:          0 :     rContentType = aParent.GetContentType();
                 [ #  # ]
     604 [ #  # ][ #  # ]:          0 :     return Sequence<sal_Int8>((sal_Int8*)pData, nLen);
         [ #  # ][ #  # ]
     605                 :            : }
     606                 :            : 
     607                 :            : //------------------------------------------------------------------------
     608                 :            : namespace
     609                 :            : {
     610                 :          0 :     static void appendDigits( sal_Int32 _nNumber, sal_Int8 nDigits, ::rtl::OUStringBuffer& _rOut )
     611                 :            :     {
     612                 :          0 :         sal_Int32 nCurLen = _rOut.getLength();
     613                 :          0 :         _rOut.append( _nNumber );
     614         [ #  # ]:          0 :         while ( _rOut.getLength() - nCurLen < nDigits )
     615                 :          0 :             _rOut.insert( nCurLen, (sal_Unicode)'0' );
     616                 :          0 :     }
     617                 :            : }
     618                 :            : 
     619                 :            : //------------------------------------------------------------------------
     620                 :          0 : void ODatabaseForm::AppendComponent(HtmlSuccessfulObjList& rList, const Reference<XPropertySet>& xComponentSet, const ::rtl::OUString& rNamePrefix,
     621                 :            :                      const Reference<XControl>& rxSubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt)
     622                 :            : {
     623         [ #  # ]:          0 :     if (!xComponentSet.is())
     624                 :            :         return;
     625                 :            : 
     626                 :            :     // MIB 25.6.98: Catch nested Forms; or would we need to submit them?
     627 [ #  # ][ #  # ]:          0 :     if (!hasProperty(PROPERTY_CLASSID, xComponentSet))
                 [ #  # ]
     628                 :            :         return;
     629                 :            : 
     630                 :            :     // Get names
     631 [ #  # ][ #  # ]:          0 :     if (!hasProperty(PROPERTY_NAME, xComponentSet))
                 [ #  # ]
     632                 :            :         return;
     633                 :            : 
     634                 :          0 :     sal_Int16 nClassId = 0;
     635 [ #  # ][ #  # ]:          0 :     xComponentSet->getPropertyValue(PROPERTY_CLASSID) >>= nClassId;
                 [ #  # ]
     636                 :          0 :     ::rtl::OUString aName;
     637 [ #  # ][ #  # ]:          0 :     xComponentSet->getPropertyValue( PROPERTY_NAME ) >>= aName;
                 [ #  # ]
     638 [ #  # ][ #  # ]:          0 :     if( aName.isEmpty() && nClassId != FormComponentType::IMAGEBUTTON)
                 [ #  # ]
     639                 :            :         return;
     640                 :            :     else    // Extend name with the prefix
     641                 :          0 :         aName = rNamePrefix + aName;
     642                 :            : 
     643   [ #  #  #  #  :          0 :     switch( nClassId )
          #  #  #  #  #  
             #  #  #  # ]
     644                 :            :     {
     645                 :            :         // Buttons
     646                 :            :         case FormComponentType::COMMANDBUTTON:
     647                 :            :         {
     648                 :            :             // We only evaluate the pressed Submit button
     649                 :            :             // MIB: If one is passed at all
     650         [ #  # ]:          0 :             if( rxSubmitButton.is() )
     651                 :            :             {
     652 [ #  # ][ #  # ]:          0 :                 Reference<XPropertySet>  xSubmitButtonComponent(rxSubmitButton->getModel(), UNO_QUERY);
                 [ #  # ]
     653 [ #  # ][ #  # ]:          0 :                 if (xSubmitButtonComponent == xComponentSet && hasProperty(PROPERTY_LABEL, xComponentSet))
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     654                 :            :                 {
     655                 :            :                     // <name>=<label>
     656                 :          0 :                     ::rtl::OUString aLabel;
     657 [ #  # ][ #  # ]:          0 :                     xComponentSet->getPropertyValue( PROPERTY_LABEL ) >>= aLabel;
                 [ #  # ]
     658         [ #  # ]:          0 :                     rList.push_back( HtmlSuccessfulObj(aName, aLabel) );
     659                 :          0 :                 }
     660                 :            :             }
     661                 :          0 :         } break;
     662                 :            : 
     663                 :            :         // ImageButtons
     664                 :            :         case FormComponentType::IMAGEBUTTON:
     665                 :            :         {
     666                 :            :             // We only evaluate the pressed Submit button
     667                 :            :             // MIB: If one is passed at all
     668         [ #  # ]:          0 :             if( rxSubmitButton.is() )
     669                 :            :             {
     670 [ #  # ][ #  # ]:          0 :                 Reference<XPropertySet>  xSubmitButtonComponent(rxSubmitButton->getModel(), UNO_QUERY);
                 [ #  # ]
     671 [ #  # ][ #  # ]:          0 :                 if (xSubmitButtonComponent == xComponentSet)
     672                 :            :                 {
     673                 :            :                     // <name>.x=<pos.X>&<name>.y=<pos.Y>
     674                 :          0 :                     ::rtl::OUString aRhs = ::rtl::OUString::valueOf( MouseEvt.X );
     675                 :            : 
     676                 :            :                     // Only if a name is available we have a name.x
     677         [ #  # ]:          0 :                     rtl::OUStringBuffer aLhs(aName);
     678         [ #  # ]:          0 :                     if (!aName.isEmpty())
     679         [ #  # ]:          0 :                         aLhs.append(".x");
     680                 :            :                     else
     681         [ #  # ]:          0 :                         aLhs.append("x");
     682 [ #  # ][ #  # ]:          0 :                     rList.push_back( HtmlSuccessfulObj(aLhs.makeStringAndClear(), aRhs) );
     683                 :            : 
     684         [ #  # ]:          0 :                     aLhs.append(aName);
     685                 :          0 :                     aRhs = ::rtl::OUString::valueOf( MouseEvt.Y );
     686         [ #  # ]:          0 :                     if (!aName.isEmpty())
     687         [ #  # ]:          0 :                         aLhs.append(".y");
     688                 :            :                     else
     689         [ #  # ]:          0 :                         aLhs.append("y");
     690 [ #  # ][ #  # ]:          0 :                     rList.push_back( HtmlSuccessfulObj(aLhs.makeStringAndClear(), aRhs) );
     691                 :          0 :                 }
     692                 :            :             }
     693                 :          0 :         } break;
     694                 :            : 
     695                 :            :         // CheckBoxen / RadioButtons
     696                 :            :         case FormComponentType::CHECKBOX:
     697                 :            :         case FormComponentType::RADIOBUTTON:
     698                 :            :         {
     699                 :            :             // <name>=<refValue>
     700 [ #  # ][ #  # ]:          0 :             if( !hasProperty(PROPERTY_STATE, xComponentSet) )
                 [ #  # ]
     701                 :            :                 break;
     702                 :          0 :             sal_Int16 nChecked = 0;
     703 [ #  # ][ #  # ]:          0 :             xComponentSet->getPropertyValue( PROPERTY_STATE ) >>= nChecked;
                 [ #  # ]
     704         [ #  # ]:          0 :             if( nChecked != 1 )
     705                 :            :                 break;
     706                 :            : 
     707                 :          0 :             ::rtl::OUString aStrValue;
     708 [ #  # ][ #  # ]:          0 :             if( hasProperty(PROPERTY_REFVALUE, xComponentSet) )
                 [ #  # ]
     709 [ #  # ][ #  # ]:          0 :                 xComponentSet->getPropertyValue( PROPERTY_REFVALUE ) >>= aStrValue;
                 [ #  # ]
     710                 :            : 
     711         [ #  # ]:          0 :             rList.push_back( HtmlSuccessfulObj(aName, aStrValue) );
     712                 :          0 :         } break;
     713                 :            : 
     714                 :            :         // Edit
     715                 :            :         case FormComponentType::TEXTFIELD:
     716                 :            :         {
     717                 :            :             // <name>=<text>
     718 [ #  # ][ #  # ]:          0 :             if( !hasProperty(PROPERTY_TEXT, xComponentSet) )
                 [ #  # ]
     719                 :            :                 break;
     720                 :            : 
     721                 :            :             // MIB: Special treatment for multiline edit only if we have a control for it
     722 [ #  # ][ #  # ]:          0 :             Any aTmp = xComponentSet->getPropertyValue( PROPERTY_MULTILINE );
                 [ #  # ]
     723                 :          0 :             sal_Bool bMulti =   rxSubmitButton.is()
     724                 :          0 :                             && (aTmp.getValueType().getTypeClass() == TypeClass_BOOLEAN)
     725 [ #  # ][ #  # ]:          0 :                             && getBOOL(aTmp);
           [ #  #  #  # ]
     726                 :          0 :             ::rtl::OUString sText;
     727         [ #  # ]:          0 :             if ( bMulti )   // For multiline edit, get the text at the control
     728                 :            :             {
     729                 :            : 
     730 [ #  # ][ #  # ]:          0 :                 Reference<XControlContainer>  xControlContainer(rxSubmitButton->getContext(), UNO_QUERY);
                 [ #  # ]
     731         [ #  # ]:          0 :                 if( !xControlContainer.is() ) break;
     732                 :            : 
     733 [ #  # ][ #  # ]:          0 :                 Sequence<Reference<XControl> > aControlSeq = xControlContainer->getControls();
     734                 :          0 :                 Reference<XControl>  xControl;
     735                 :          0 :                 Reference<XFormComponent>  xControlComponent;
     736                 :            : 
     737                 :            :                 // Find the right control
     738                 :            :                 sal_Int32 i;
     739         [ #  # ]:          0 :                 for( i=0; i<aControlSeq.getLength(); i++ )
     740                 :            :                 {
     741         [ #  # ]:          0 :                     xControl = aControlSeq.getConstArray()[i];
     742 [ #  # ][ #  # ]:          0 :                     Reference<XPropertySet>  xModel(xControl->getModel(), UNO_QUERY);
                 [ #  # ]
     743 [ #  # ][ #  # ]:          0 :                     if (xModel == xComponentSet)
     744                 :            :                     {
     745         [ #  # ]:          0 :                         Reference<XTextComponent>  xTextComponent(xControl, UNO_QUERY);
     746         [ #  # ]:          0 :                         if( xTextComponent.is() )
     747 [ #  # ][ #  # ]:          0 :                             sText = xTextComponent->getText();
     748                 :          0 :                         break;
     749                 :            :                     }
     750         [ #  # ]:          0 :                 }
     751                 :            :                 // Couldn't find control or it does not exist (edit in the grid)
     752         [ #  # ]:          0 :                 if (i == aControlSeq.getLength())
     753 [ #  # ][ #  # ]:          0 :                     xComponentSet->getPropertyValue( PROPERTY_TEXT ) >>= sText;
         [ #  # ][ #  # ]
                 [ #  # ]
     754                 :            :             }
     755                 :            :             else
     756 [ #  # ][ #  # ]:          0 :                 xComponentSet->getPropertyValue( PROPERTY_TEXT ) >>= sText;
                 [ #  # ]
     757                 :            : 
     758 [ #  # ][ #  # ]:          0 :             rList.push_back( HtmlSuccessfulObj(aName, sText) );
                 [ #  # ]
     759                 :          0 :         } break;
     760                 :            : 
     761                 :            :         // ComboBox, Patternfield
     762                 :            :         case FormComponentType::COMBOBOX:
     763                 :            :         case FormComponentType::PATTERNFIELD:
     764                 :            :         {
     765                 :            :             // <name>=<text>
     766 [ #  # ][ #  # ]:          0 :             if( hasProperty(PROPERTY_TEXT, xComponentSet) )
                 [ #  # ]
     767                 :            :             {
     768                 :          0 :                 ::rtl::OUString aText;
     769 [ #  # ][ #  # ]:          0 :                 xComponentSet->getPropertyValue( PROPERTY_TEXT ) >>= aText;
                 [ #  # ]
     770         [ #  # ]:          0 :                 rList.push_back( HtmlSuccessfulObj(aName, aText) );
     771                 :            :             }
     772                 :          0 :         } break;
     773                 :            :         case FormComponentType::CURRENCYFIELD:
     774                 :            :         case FormComponentType::NUMERICFIELD:
     775                 :            :         {
     776                 :            :             // <name>=<wert> // Value is a double with dot as decimal delimiter
     777                 :            :                              // no value (NULL) means empty value
     778 [ #  # ][ #  # ]:          0 :             if( hasProperty(PROPERTY_VALUE, xComponentSet) )
                 [ #  # ]
     779                 :            :             {
     780                 :          0 :                 ::rtl::OUString aText;
     781 [ #  # ][ #  # ]:          0 :                 Any aVal  = xComponentSet->getPropertyValue( PROPERTY_VALUE );
                 [ #  # ]
     782                 :            : 
     783                 :          0 :                 double aDoubleVal = 0;
     784         [ #  # ]:          0 :                 if (aVal >>= aDoubleVal)
     785                 :            :                 {
     786                 :          0 :                     sal_Int16 nScale = 0;
     787 [ #  # ][ #  # ]:          0 :                     xComponentSet->getPropertyValue( PROPERTY_DECIMAL_ACCURACY ) >>= nScale;
                 [ #  # ]
     788                 :          0 :                     aText = ::rtl::math::doubleToUString(aDoubleVal, rtl_math_StringFormat_F, nScale, '.', sal_True);
     789                 :            :                 }
     790         [ #  # ]:          0 :                 rList.push_back( HtmlSuccessfulObj(aName, aText) );
     791                 :            :             }
     792                 :          0 :         }   break;
     793                 :            :         case FormComponentType::DATEFIELD:
     794                 :            :         {
     795                 :            :             // <name>=<wert> // Value is a Date with the format MM-DD-YYYY
     796                 :            :                              // no value (NULL) means empty value
     797 [ #  # ][ #  # ]:          0 :             if( hasProperty(PROPERTY_DATE, xComponentSet) )
                 [ #  # ]
     798                 :            :             {
     799                 :          0 :                 ::rtl::OUString aText;
     800 [ #  # ][ #  # ]:          0 :                 Any aVal  = xComponentSet->getPropertyValue( PROPERTY_DATE );
                 [ #  # ]
     801                 :          0 :                 sal_Int32 nInt32Val = 0;
     802         [ #  # ]:          0 :                 if (aVal >>= nInt32Val)
     803                 :            :                 {
     804                 :          0 :                     ::Date aDate( nInt32Val );
     805                 :          0 :                     ::rtl::OUStringBuffer aBuffer;
     806         [ #  # ]:          0 :                     appendDigits( aDate.GetMonth(), 2, aBuffer );
     807         [ #  # ]:          0 :                     aBuffer.append( (sal_Unicode)'-' );
     808         [ #  # ]:          0 :                     appendDigits( aDate.GetDay(), 2, aBuffer );
     809         [ #  # ]:          0 :                     aBuffer.append( (sal_Unicode)'-' );
     810         [ #  # ]:          0 :                     appendDigits( aDate.GetYear(), 4, aBuffer );
     811         [ #  # ]:          0 :                     aText = aBuffer.makeStringAndClear();
     812                 :            :                 }
     813         [ #  # ]:          0 :                 rList.push_back( HtmlSuccessfulObj(aName, aText) );
     814                 :            :             }
     815                 :          0 :         }   break;
     816                 :            :         case FormComponentType::TIMEFIELD:
     817                 :            :         {
     818                 :            :             // <name>=<wert> // Value is a Time with the format HH:MM:SS
     819                 :            :                              // no value (NULL) means empty value
     820 [ #  # ][ #  # ]:          0 :             if( hasProperty(PROPERTY_TIME, xComponentSet) )
                 [ #  # ]
     821                 :            :             {
     822                 :          0 :                 ::rtl::OUString aText;
     823 [ #  # ][ #  # ]:          0 :                 Any aVal  = xComponentSet->getPropertyValue( PROPERTY_TIME );
                 [ #  # ]
     824                 :          0 :                 sal_Int32 nInt32Val = 0;
     825         [ #  # ]:          0 :                 if (aVal >>= nInt32Val)
     826                 :            :                 {
     827                 :          0 :                     ::Time aTime(nInt32Val);
     828                 :          0 :                     ::rtl::OUStringBuffer aBuffer;
     829         [ #  # ]:          0 :                     appendDigits( aTime.GetHour(), 2, aBuffer );
     830         [ #  # ]:          0 :                     aBuffer.append( (sal_Unicode)'-' );
     831         [ #  # ]:          0 :                     appendDigits( aTime.GetMin(), 2, aBuffer );
     832         [ #  # ]:          0 :                     aBuffer.append( (sal_Unicode)'-' );
     833         [ #  # ]:          0 :                     appendDigits( aTime.GetSec(), 2, aBuffer );
     834         [ #  # ]:          0 :                     aText = aBuffer.makeStringAndClear();
     835                 :            :                 }
     836         [ #  # ]:          0 :                 rList.push_back( HtmlSuccessfulObj(aName, aText) );
     837                 :            :             }
     838                 :          0 :         }   break;
     839                 :            : 
     840                 :            :         // starform
     841                 :            :         case FormComponentType::HIDDENCONTROL:
     842                 :            :         {
     843                 :            : 
     844                 :            :             // <name>=<value>
     845 [ #  # ][ #  # ]:          0 :             if( hasProperty(PROPERTY_HIDDEN_VALUE, xComponentSet) )
                 [ #  # ]
     846                 :            :             {
     847                 :          0 :                 ::rtl::OUString aText;
     848 [ #  # ][ #  # ]:          0 :                 xComponentSet->getPropertyValue( PROPERTY_HIDDEN_VALUE ) >>= aText;
                 [ #  # ]
     849         [ #  # ]:          0 :                 rList.push_back( HtmlSuccessfulObj(aName, aText) );
     850                 :            :             }
     851                 :          0 :         } break;
     852                 :            : 
     853                 :            :         // starform
     854                 :            :         case FormComponentType::FILECONTROL:
     855                 :            :         {
     856                 :            :             // <name>=<text>
     857 [ #  # ][ #  # ]:          0 :             if( hasProperty(PROPERTY_TEXT, xComponentSet) )
                 [ #  # ]
     858                 :            :             {
     859                 :            : 
     860                 :          0 :                 ::rtl::OUString aText;
     861 [ #  # ][ #  # ]:          0 :                 xComponentSet->getPropertyValue( PROPERTY_TEXT ) >>= aText;
                 [ #  # ]
     862         [ #  # ]:          0 :                 rList.push_back( HtmlSuccessfulObj(aName, aText, SUCCESSFUL_REPRESENT_FILE) );
     863                 :            :             }
     864                 :          0 :         } break;
     865                 :            : 
     866                 :            :         // starform
     867                 :            :         case FormComponentType::LISTBOX:
     868                 :            :         {
     869                 :            : 
     870                 :            :             // <name>=<Token0>&<name>=<Token1>&...&<name>=<TokenN> (multiple selection)
     871 [ #  # ][ #  # ]:          0 :             if (!hasProperty(PROPERTY_SELECT_SEQ, xComponentSet) ||
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     872 [ #  # ][ #  # ]:          0 :                 !hasProperty(PROPERTY_STRINGITEMLIST, xComponentSet))
         [ #  # ][ #  # ]
     873                 :            :                 break;
     874                 :            : 
     875                 :            :             // Displayed values
     876         [ #  # ]:          0 :             Sequence< ::rtl::OUString > aVisibleList;
     877 [ #  # ][ #  # ]:          0 :             xComponentSet->getPropertyValue( PROPERTY_STRINGITEMLIST ) >>= aVisibleList;
         [ #  # ][ #  # ]
     878                 :          0 :             sal_Int32 nStringCnt = aVisibleList.getLength();
     879                 :          0 :             const ::rtl::OUString* pStrings = aVisibleList.getConstArray();
     880                 :            : 
     881                 :            :             // Value list
     882         [ #  # ]:          0 :             Sequence< ::rtl::OUString > aValueList;
     883 [ #  # ][ #  # ]:          0 :             xComponentSet->getPropertyValue( PROPERTY_VALUE_SEQ ) >>= aValueList;
         [ #  # ][ #  # ]
     884                 :          0 :             sal_Int32 nValCnt = aValueList.getLength();
     885                 :          0 :             const ::rtl::OUString* pVals = aValueList.getConstArray();
     886                 :            : 
     887                 :            :             // Selection
     888         [ #  # ]:          0 :             Sequence<sal_Int16> aSelectList;
     889 [ #  # ][ #  # ]:          0 :             xComponentSet->getPropertyValue( PROPERTY_SELECT_SEQ ) >>= aSelectList;
         [ #  # ][ #  # ]
     890                 :          0 :             sal_Int32 nSelCount = aSelectList.getLength();
     891                 :          0 :             const sal_Int16* pSels = aSelectList.getConstArray();
     892                 :            : 
     893                 :            :             // Simple or multiple selection
     894                 :            :             // For simple selections MT only accounts for the list's first entry.
     895 [ #  # ][ #  # ]:          0 :             if (nSelCount > 1 && !getBOOL(xComponentSet->getPropertyValue(PROPERTY_MULTISELECTION)))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
             #  #  #  # ]
                 [ #  # ]
     896                 :          0 :                 nSelCount = 1;
     897                 :            : 
     898                 :            :             // The indices in the selection list can also be invalid, so we first have to
     899                 :            :             // find the valid ones to determine the length of the new list.
     900                 :          0 :             sal_Int32 nCurCnt = 0;
     901                 :            :             sal_Int32 i;
     902         [ #  # ]:          0 :             for( i=0; i<nSelCount; ++i )
     903                 :            :             {
     904         [ #  # ]:          0 :                 if( pSels[i] < nStringCnt )
     905                 :          0 :                     ++nCurCnt;
     906                 :            :             }
     907                 :            : 
     908                 :          0 :             ::rtl::OUString aSubValue;
     909         [ #  # ]:          0 :             for(i=0; i<nCurCnt; ++i )
     910                 :            :             {
     911                 :          0 :                 sal_Int16  nSelPos = pSels[i];
     912 [ #  # ][ #  # ]:          0 :                 if (nSelPos < nValCnt && !pVals[nSelPos].isEmpty())
                 [ #  # ]
     913                 :            :                 {
     914                 :          0 :                     aSubValue = pVals[nSelPos];
     915                 :            :                 }
     916                 :            :                 else
     917                 :            :                 {
     918                 :          0 :                     aSubValue = pStrings[nSelPos];
     919                 :            :                 }
     920         [ #  # ]:          0 :                 rList.push_back( HtmlSuccessfulObj(aName, aSubValue) );
     921 [ #  # ][ #  # ]:          0 :             }
                 [ #  # ]
     922                 :          0 :         } break;
     923                 :            :         case FormComponentType::GRIDCONTROL:
     924                 :            :         {
     925                 :            :             // Each of the column values is sent;
     926                 :            :             // the name is extended by the grid's prefix.
     927         [ #  # ]:          0 :             Reference<XIndexAccess>  xContainer(xComponentSet, UNO_QUERY);
     928         [ #  # ]:          0 :             if (!xContainer.is())
     929                 :            :                 break;
     930                 :            : 
     931                 :          0 :             aName += rtl::OUString(static_cast<sal_Unicode>('.'));
     932                 :            : 
     933                 :          0 :             Reference<XPropertySet>  xSet;
     934 [ #  # ][ #  # ]:          0 :             sal_Int32 nCount = xContainer->getCount();
     935                 :            :             // we know already how many objects should be appended,
     936                 :            :             // so why not allocate the space for them
     937         [ #  # ]:          0 :             rList.reserve( nCount + rList.capacity() ); // not size()
     938         [ #  # ]:          0 :             for (sal_Int32 i = 0; i < nCount; ++i)
     939                 :            :             {
     940 [ #  # ][ #  # ]:          0 :                 xContainer->getByIndex(i) >>= xSet;
                 [ #  # ]
     941         [ #  # ]:          0 :                 if (xSet.is())
     942         [ #  # ]:          0 :                     AppendComponent(rList, xSet, aName, rxSubmitButton, MouseEvt);
     943         [ #  # ]:          0 :             }
     944                 :            :         }
     945         [ #  # ]:          0 :     }
     946                 :            : }
     947                 :            : 
     948                 :            : //------------------------------------------------------------------------
     949                 :          0 : void ODatabaseForm::FillSuccessfulList( HtmlSuccessfulObjList& rList,
     950                 :            :     const Reference<XControl>& rxSubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt )
     951                 :            : {
     952                 :            :     // Delete list
     953                 :          0 :     rList.clear();
     954                 :            :     // Iterate over Components
     955                 :          0 :     Reference<XPropertySet>         xComponentSet;
     956                 :          0 :     ::rtl::OUString aPrefix;
     957                 :            : 
     958                 :            :     // we know already how many objects should be appended,
     959                 :            :     // so why not allocate the space for them
     960 [ #  # ][ #  # ]:          0 :     rList.reserve( getCount() );
     961 [ #  # ][ #  # ]:          0 :     for( sal_Int32 nIndex=0; nIndex < getCount(); nIndex++ )
     962                 :            :     {
     963 [ #  # ][ #  # ]:          0 :         getByIndex( nIndex ) >>= xComponentSet;
     964         [ #  # ]:          0 :         AppendComponent(rList, xComponentSet, aPrefix, rxSubmitButton, MouseEvt);
     965                 :          0 :     }
     966                 :          0 : }
     967                 :            : 
     968                 :            : //------------------------------------------------------------------------
     969                 :          0 : void ODatabaseForm::Encode( ::rtl::OUString& rString ) const
     970                 :            : {
     971                 :          0 :     ::rtl::OUStringBuffer aResult;
     972                 :            : 
     973                 :            :     // Line endings are represented as CR
     974         [ #  # ]:          0 :     rString = convertLineEnd(rString, LINEEND_CR);
     975                 :            : 
     976                 :            :     // Check each character
     977                 :          0 :     sal_Int32 nStrLen = rString.getLength();
     978                 :            :     sal_Unicode nCharCode;
     979         [ #  # ]:          0 :     for( sal_Int32 nCurPos=0; nCurPos < nStrLen; ++nCurPos )
     980                 :            :     {
     981                 :          0 :         nCharCode = rString[nCurPos];
     982                 :            : 
     983                 :            :         // Handle chars, which are not an alphanumeric character and character codes > 127
     984 [ #  # ][ #  # ]:          0 :         if( (!isalnum(nCharCode) && nCharCode != (sal_Unicode)' ') || nCharCode > 127 )
                 [ #  # ]
     985                 :            :         {
     986      [ #  #  # ]:          0 :             switch( nCharCode )
     987                 :            :             {
     988                 :            :                 case 13:    // CR
     989         [ #  # ]:          0 :                     aResult.append("%0D%0A"); // CR LF in hex
     990                 :          0 :                     break;
     991                 :            : 
     992                 :            : 
     993                 :            :                 // Special treatment for Netscape
     994                 :            :                 case 42:    // '*'
     995                 :            :                 case 45:    // '-'
     996                 :            :                 case 46:    // '.'
     997                 :            :                 case 64:    // '@'
     998                 :            :                 case 95:    // '_'
     999         [ #  # ]:          0 :                     aResult.append(nCharCode);
    1000                 :          0 :                     break;
    1001                 :            : 
    1002                 :            :                 default:
    1003                 :            :                 {
    1004                 :            :                     // Convert to hex
    1005                 :          0 :                     short nHi = ((sal_Int16)nCharCode) / 16;
    1006                 :          0 :                     short nLo = ((sal_Int16)nCharCode) - (nHi*16);
    1007         [ #  # ]:          0 :                     if( nHi > 9 ) nHi += (int)'A'-10; else nHi += (int)'0';
    1008         [ #  # ]:          0 :                     if( nLo > 9 ) nLo += (int)'A'-10; else nLo += (int)'0';
    1009         [ #  # ]:          0 :                     aResult.append('%');
    1010         [ #  # ]:          0 :                     aResult.append((sal_Unicode)nHi);
    1011         [ #  # ]:          0 :                     aResult.append((sal_Unicode)nLo);
    1012                 :            :                 }
    1013                 :          0 :             }
    1014                 :            :         }
    1015                 :            :         else
    1016         [ #  # ]:          0 :             aResult.append(nCharCode);
    1017                 :            :     }
    1018                 :            : 
    1019                 :            :     // Replace spaces with '+'
    1020         [ #  # ]:          0 :     rString = aResult.makeStringAndClear().replace(' ', '+');
    1021                 :          0 : }
    1022                 :            : 
    1023                 :            : //------------------------------------------------------------------------
    1024                 :          0 : void ODatabaseForm::InsertTextPart( INetMIMEMessage& rParent, const ::rtl::OUString& rName,
    1025                 :            :     const ::rtl::OUString& rData )
    1026                 :            : {
    1027                 :            : 
    1028                 :            :     // Create part as MessageChild
    1029 [ #  # ][ #  # ]:          0 :     INetMIMEMessage* pChild = new INetMIMEMessage();
    1030                 :            : 
    1031                 :            : 
    1032                 :            :     // Header
    1033                 :          0 :     ::rtl::OUStringBuffer aContentDisp;
    1034         [ #  # ]:          0 :     aContentDisp.append("form-data; name=\"");
    1035         [ #  # ]:          0 :     aContentDisp.append(rName);
    1036         [ #  # ]:          0 :     aContentDisp.append('\"');
    1037 [ #  # ][ #  # ]:          0 :     pChild->SetContentDisposition(aContentDisp.makeStringAndClear());
         [ #  # ][ #  # ]
    1038 [ #  # ][ #  # ]:          0 :     pChild->SetContentType(::rtl::OUString("text/plain"));
                 [ #  # ]
    1039                 :            : 
    1040         [ #  # ]:          0 :     rtl_TextEncoding eSystemEncoding = osl_getThreadTextEncoding();
    1041         [ #  # ]:          0 :     const sal_Char* pBestMatchingEncoding = rtl_getBestMimeCharsetFromTextEncoding( eSystemEncoding );
    1042                 :          0 :     rtl::OUString aBestMatchingEncoding = rtl::OUString::createFromAscii(pBestMatchingEncoding);
    1043         [ #  # ]:          0 :     pChild->SetContentTransferEncoding(aBestMatchingEncoding);
    1044                 :            : 
    1045                 :            :     // Body
    1046 [ #  # ][ #  # ]:          0 :     SvMemoryStream* pStream = new SvMemoryStream;
    1047 [ #  # ][ #  # ]:          0 :     pStream->WriteLine( rtl::OUStringToOString(rData, rtl_getTextEncodingFromMimeCharset(pBestMatchingEncoding)) );
                 [ #  # ]
    1048         [ #  # ]:          0 :     pStream->Flush();
    1049         [ #  # ]:          0 :     pStream->Seek( 0 );
    1050 [ #  # ][ #  # ]:          0 :     pChild->SetDocumentLB( new SvLockBytes(pStream, sal_True) );
                 [ #  # ]
    1051         [ #  # ]:          0 :     rParent.AttachChild( *pChild );
    1052                 :          0 : }
    1053                 :            : 
    1054                 :            : //------------------------------------------------------------------------
    1055                 :          0 : sal_Bool ODatabaseForm::InsertFilePart( INetMIMEMessage& rParent, const ::rtl::OUString& rName,
    1056                 :            :     const ::rtl::OUString& rFileName )
    1057                 :            : {
    1058                 :          0 :     rtl::OUString aFileName(rFileName);
    1059                 :          0 :     rtl::OUString aContentType(CONTENT_TYPE_STR_TEXT_PLAIN);
    1060                 :          0 :     SvStream *pStream = 0;
    1061                 :            : 
    1062         [ #  # ]:          0 :     if (!aFileName.isEmpty())
    1063                 :            :     {
    1064                 :            :         // We can only process File URLs yet
    1065         [ #  # ]:          0 :         INetURLObject aURL;
    1066                 :          0 :         aURL.SetSmartProtocol(INET_PROT_FILE);
    1067         [ #  # ]:          0 :         aURL.SetSmartURL(rFileName);
    1068         [ #  # ]:          0 :         if( INET_PROT_FILE == aURL.GetProtocol() )
    1069                 :            :         {
    1070 [ #  # ][ #  # ]:          0 :             aFileName = INetURLObject::decode(aURL.PathToFileName(), '%', INetURLObject::DECODE_UNAMBIGUOUS);
    1071 [ #  # ][ #  # ]:          0 :             DirEntry aDirEntry( aFileName );
                 [ #  # ]
    1072 [ #  # ][ #  # ]:          0 :             if( aDirEntry.Exists() )
    1073                 :            :             {
    1074 [ #  # ][ #  # ]:          0 :                 pStream = ::utl::UcbStreamHelper::CreateStream(aFileName, STREAM_READ);
                 [ #  # ]
    1075 [ #  # ][ #  # ]:          0 :                 if (!pStream || (pStream->GetError() != ERRCODE_NONE))
                 [ #  # ]
    1076                 :            :                 {
    1077 [ #  # ][ #  # ]:          0 :                     delete pStream;
    1078                 :          0 :                     pStream = 0;
    1079                 :            :                 }
    1080                 :            :             }
    1081                 :            :             INetContentType eContentType = INetContentTypes::GetContentType4Extension(
    1082 [ #  # ][ #  # ]:          0 :                                                                 aDirEntry.GetExtension() );
                 [ #  # ]
    1083         [ #  # ]:          0 :             if (eContentType != CONTENT_TYPE_UNKNOWN)
    1084 [ #  # ][ #  # ]:          0 :                 aContentType = INetContentTypes::GetContentType(eContentType);
    1085         [ #  # ]:          0 :         }
    1086                 :            :     }
    1087                 :            : 
    1088                 :            :     // If something didn't work, we create an empty MemoryStream
    1089         [ #  # ]:          0 :     if( !pStream )
    1090 [ #  # ][ #  # ]:          0 :         pStream = new SvMemoryStream;
    1091                 :            : 
    1092                 :            : 
    1093                 :            :     // Create part as MessageChild
    1094 [ #  # ][ #  # ]:          0 :     INetMIMEMessage* pChild = new INetMIMEMessage;
    1095                 :            : 
    1096                 :            : 
    1097                 :            :     // Header
    1098                 :          0 :     ::rtl::OUStringBuffer aContentDisp;
    1099         [ #  # ]:          0 :     aContentDisp.append("form-data; name=\"");
    1100         [ #  # ]:          0 :     aContentDisp.append(rName);
    1101         [ #  # ]:          0 :     aContentDisp.append('\"');
    1102         [ #  # ]:          0 :     aContentDisp.append("; filename=\"");
    1103         [ #  # ]:          0 :     aContentDisp.append(aFileName);
    1104         [ #  # ]:          0 :     aContentDisp.append('\"');
    1105 [ #  # ][ #  # ]:          0 :     pChild->SetContentDisposition(aContentDisp.makeStringAndClear());
         [ #  # ][ #  # ]
    1106 [ #  # ][ #  # ]:          0 :     pChild->SetContentType( aContentType );
                 [ #  # ]
    1107         [ #  # ]:          0 :     pChild->SetContentTransferEncoding(::rtl::OUString("8bit"));
    1108                 :            : 
    1109                 :            : 
    1110                 :            :     // Body
    1111 [ #  # ][ #  # ]:          0 :     pChild->SetDocumentLB( new SvLockBytes(pStream, sal_True) );
                 [ #  # ]
    1112         [ #  # ]:          0 :     rParent.AttachChild( *pChild );
    1113                 :            : 
    1114                 :          0 :     return sal_True;
    1115                 :            : }
    1116                 :            : 
    1117                 :            : //==============================================================================
    1118                 :            : // internals
    1119                 :            : //------------------------------------------------------------------------------
    1120                 :          0 : void ODatabaseForm::onError( const SQLErrorEvent& _rEvent )
    1121                 :            : {
    1122                 :          0 :     m_aErrorListeners.notifyEach( &XSQLErrorListener::errorOccured, _rEvent );
    1123                 :          0 : }
    1124                 :            : 
    1125                 :            : //------------------------------------------------------------------------------
    1126                 :         22 : void ODatabaseForm::onError( const SQLException& _rException, const ::rtl::OUString& _rContextDescription )
    1127                 :            : {
    1128 [ +  - ][ -  + ]:         22 :     if ( !m_aErrorListeners.getLength() )
    1129                 :         22 :         return;
    1130                 :            : 
    1131 [ #  # ][ #  # ]:          0 :     SQLErrorEvent aEvent( *this, makeAny( prependErrorInfo( _rException, *this, _rContextDescription ) ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1132 [ #  # ][ #  # ]:         22 :     onError( aEvent );
    1133                 :            : }
    1134                 :            : 
    1135                 :            : //------------------------------------------------------------------------------
    1136                 :         24 : void ODatabaseForm::updateParameterInfo()
    1137                 :            : {
    1138                 :         24 :     m_aParameterManager.updateParameterInfo( m_aFilterManager );
    1139                 :         24 : }
    1140                 :            : 
    1141                 :            : //------------------------------------------------------------------------------
    1142                 :          0 : bool ODatabaseForm::hasValidParent() const
    1143                 :            : {
    1144                 :            :     // do we have to fill the parameters again?
    1145         [ #  # ]:          0 :     if (m_bSubForm)
    1146                 :            :     {
    1147         [ #  # ]:          0 :         Reference<XResultSet>  xResultSet(m_xParent, UNO_QUERY);
    1148         [ #  # ]:          0 :         if (!xResultSet.is())
    1149                 :            :         {
    1150                 :            :             OSL_FAIL("ODatabaseForm::hasValidParent() : no parent resultset !");
    1151                 :          0 :             return false;
    1152                 :            :         }
    1153                 :            :         try
    1154                 :            :         {
    1155         [ #  # ]:          0 :             Reference< XPropertySet >  xSet( m_xParent, UNO_QUERY );
    1156         [ #  # ]:          0 :             Reference< XLoadable > xLoad( m_xParent, UNO_QUERY );
    1157 [ #  # ][ #  # ]:          0 :             if  (   xLoad->isLoaded()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1158 [ #  # ][ #  # ]:          0 :                 &&  (   xResultSet->isBeforeFirst()
    1159 [ #  # ][ #  # ]:          0 :                     ||  xResultSet->isAfterLast()
    1160 [ #  # ][ #  # ]:          0 :                     ||  getBOOL( xSet->getPropertyValue( PROPERTY_ISNEW ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1161                 :            :                     )
    1162                 :            :                 )
    1163                 :            :                 // the parent form is loaded and on a "virtual" row -> not valid
    1164 [ #  # ][ #  # ]:          0 :                 return false;
                 [ #  # ]
    1165                 :            :         }
    1166         [ #  # ]:          0 :         catch(const Exception&)
    1167                 :            :         {
    1168                 :            :             // parent could be forwardonly?
    1169                 :          0 :             return false;
    1170         [ #  # ]:          0 :         }
    1171                 :            :     }
    1172                 :          0 :     return true;
    1173                 :            : }
    1174                 :            : 
    1175                 :            : //------------------------------------------------------------------------------
    1176                 :         24 : bool ODatabaseForm::fillParameters( ::osl::ResettableMutexGuard& _rClearForNotifies, const Reference< XInteractionHandler >& _rxCompletionHandler )
    1177                 :            : {
    1178                 :            :     // do we have to fill the parameters again?
    1179         [ +  - ]:         24 :     if ( !m_aParameterManager.isUpToDate() )
    1180                 :         24 :         updateParameterInfo();
    1181                 :            : 
    1182                 :            :     // is there a valid parent?
    1183 [ -  + ][ #  # ]:         24 :     if ( m_bSubForm && !hasValidParent() )
                 [ -  + ]
    1184                 :          0 :         return true;
    1185                 :            : 
    1186                 :            :     // ensure we're connected
    1187         [ -  + ]:         24 :     if ( !implEnsureConnection() )
    1188                 :          0 :         return false;
    1189                 :            : 
    1190         [ +  - ]:         24 :     if ( m_aParameterManager.isUpToDate() )
    1191                 :         24 :         return m_aParameterManager.fillParameterValues( _rxCompletionHandler, _rClearForNotifies );
    1192                 :            : 
    1193                 :         24 :     return true;
    1194                 :            : }
    1195                 :            : 
    1196                 :            : //------------------------------------------------------------------------------
    1197                 :          0 : void ODatabaseForm::saveInsertOnlyState( )
    1198                 :            : {
    1199                 :            :     OSL_ENSURE( !m_aIgnoreResult.hasValue(), "ODatabaseForm::saveInsertOnlyState: overriding old value!" );
    1200         [ #  # ]:          0 :     m_aIgnoreResult = m_xAggregateSet->getPropertyValue( PROPERTY_INSERTONLY );
    1201                 :          0 : }
    1202                 :            : 
    1203                 :            : //------------------------------------------------------------------------------
    1204                 :         48 : void ODatabaseForm::restoreInsertOnlyState( )
    1205                 :            : {
    1206         [ -  + ]:         48 :     if ( m_aIgnoreResult.hasValue() )
    1207                 :            :     {
    1208         [ #  # ]:          0 :         m_xAggregateSet->setPropertyValue( PROPERTY_INSERTONLY, m_aIgnoreResult );
    1209                 :          0 :         m_aIgnoreResult = Any();
    1210                 :            :     }
    1211                 :         48 : }
    1212                 :            : 
    1213                 :            : //------------------------------------------------------------------------------
    1214                 :         24 : sal_Bool ODatabaseForm::executeRowSet(::osl::ResettableMutexGuard& _rClearForNotifies, sal_Bool bMoveToFirst, const Reference< XInteractionHandler >& _rxCompletionHandler)
    1215                 :            : {
    1216         [ -  + ]:         24 :     if (!m_xAggregateAsRowSet.is())
    1217                 :          0 :         return sal_False;
    1218                 :            : 
    1219         [ -  + ]:         24 :     if (!fillParameters(_rClearForNotifies, _rxCompletionHandler))
    1220                 :          0 :         return sal_False;
    1221                 :            : 
    1222                 :         24 :     restoreInsertOnlyState( );
    1223                 :            : 
    1224                 :            :     // ensure the aggregated row set has the correct properties
    1225                 :         24 :     sal_Int32 nConcurrency = ResultSetConcurrency::READ_ONLY;
    1226                 :            : 
    1227                 :            :     // if we have a parent, who is not positioned on a valid row
    1228                 :            :     // we can't be updatable!
    1229 [ #  # ][ -  + ]:         24 :     if (m_bSubForm && !hasValidParent())
                 [ -  + ]
    1230                 :            :     {
    1231                 :          0 :         nConcurrency = ResultSetConcurrency::READ_ONLY;
    1232                 :            : 
    1233                 :            :         // don't use any parameters if we don't have a valid parent
    1234                 :          0 :         m_aParameterManager.setAllParametersNull();
    1235                 :            : 
    1236                 :            :         // switch to "insert only" mode
    1237                 :          0 :         saveInsertOnlyState( );
    1238 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->setPropertyValue( PROPERTY_INSERTONLY, makeAny( sal_True ) );
                 [ #  # ]
    1239                 :            :     }
    1240 [ -  + ][ #  # ]:         24 :     else if (m_bAllowInsert || m_bAllowUpdate || m_bAllowDelete)
                 [ #  # ]
    1241                 :         24 :         nConcurrency = ResultSetConcurrency::UPDATABLE;
    1242                 :            :     else
    1243                 :          0 :         nConcurrency = ResultSetConcurrency::READ_ONLY;
    1244                 :            : 
    1245 [ +  - ][ +  - ]:         24 :     m_xAggregateSet->setPropertyValue( PROPERTY_RESULTSET_CONCURRENCY, makeAny( (sal_Int32)nConcurrency ) );
                 [ +  - ]
    1246 [ +  - ][ +  - ]:         24 :     m_xAggregateSet->setPropertyValue( PROPERTY_RESULTSET_TYPE, makeAny( (sal_Int32)ResultSetType::SCROLL_SENSITIVE ) );
                 [ +  - ]
    1247                 :            : 
    1248                 :         24 :     sal_Bool bSuccess = sal_False;
    1249                 :            :     try
    1250                 :            :     {
    1251 [ +  + ][ +  - ]:         24 :         m_xAggregateAsRowSet->execute();
    1252                 :          2 :         bSuccess = sal_True;
    1253                 :            :     }
    1254                 :          0 :     catch(const RowSetVetoException&)
    1255                 :            :     {
    1256                 :            :     }
    1257      [ -  -  + ]:         44 :     catch(const SQLException& eDb)
    1258                 :            :     {
    1259         [ -  + ]:         22 :         _rClearForNotifies.clear();
    1260         [ +  - ]:         22 :         if (!m_sCurrentErrorContext.isEmpty())
    1261         [ -  + ]:         22 :             onError(eDb, m_sCurrentErrorContext);
    1262                 :            :         else
    1263   [ #  #  #  # ]:          0 :             onError(eDb, FRM_RES_STRING(RID_STR_READERROR));
    1264         [ -  + ]:         22 :         _rClearForNotifies.reset();
    1265                 :            : 
    1266         [ -  + ]:         22 :         restoreInsertOnlyState( );
    1267                 :            :     }
    1268                 :            : 
    1269         [ +  + ]:         24 :     if (bSuccess)
    1270                 :            :     {
    1271                 :            :         // adjust the privilege property
    1272                 :            :         //  m_nPrivileges;
    1273         [ +  - ]:          2 :         m_xAggregateSet->getPropertyValue(PROPERTY_PRIVILEGES) >>= m_nPrivileges;
    1274         [ -  + ]:          2 :         if (!m_bAllowInsert)
    1275                 :          0 :             m_nPrivileges &= ~Privilege::INSERT;
    1276         [ -  + ]:          2 :         if (!m_bAllowUpdate)
    1277                 :          0 :             m_nPrivileges &= ~Privilege::UPDATE;
    1278         [ -  + ]:          2 :         if (!m_bAllowDelete)
    1279                 :          0 :             m_nPrivileges &= ~Privilege::DELETE;
    1280                 :            : 
    1281         [ +  - ]:          2 :         if (bMoveToFirst)
    1282                 :            :         {
    1283                 :            :             // the row set is positioned _before_ the first row (per definitionem), so move the set ...
    1284                 :            :             try
    1285                 :            :             {
    1286                 :            :                 // if we have an insert only rowset we move to the insert row
    1287         [ +  - ]:          2 :                 next();
    1288 [ +  - ][ -  + ]:          4 :                 if (((m_nPrivileges & Privilege::INSERT) == Privilege::INSERT)
                 [ -  + ]
    1289         [ +  - ]:          2 :                     && isAfterLast())
    1290                 :            :                 {
    1291                 :            :                     // move on the insert row of set
    1292                 :            :                     // resetting must be done later, after the load events have been posted
    1293                 :            :                     // see :moveToInsertRow and load , reload
    1294                 :          0 :                     Reference<XResultSetUpdate>  xUpdate;
    1295 [ #  # ][ #  # ]:          0 :                     if (query_aggregation( m_xAggregate, xUpdate))
    1296 [ #  # ][ #  # ]:          0 :                         xUpdate->moveToInsertRow();
    1297                 :            :                 }
    1298                 :            :             }
    1299         [ #  # ]:          0 :             catch(const SQLException& eDB)
    1300                 :            :             {
    1301         [ #  # ]:          0 :                 _rClearForNotifies.clear();
    1302         [ #  # ]:          0 :                 if (!m_sCurrentErrorContext.isEmpty())
    1303         [ #  # ]:          0 :                     onError(eDB, m_sCurrentErrorContext);
    1304                 :            :                 else
    1305   [ #  #  #  # ]:          0 :                     onError(eDB, FRM_RES_STRING(RID_STR_READERROR));
    1306         [ #  # ]:          0 :                 _rClearForNotifies.reset();
    1307                 :          0 :                 bSuccess = sal_False;
    1308                 :            :             }
    1309                 :            :         }
    1310                 :            :     }
    1311                 :         24 :     return bSuccess;
    1312                 :            : }
    1313                 :            : 
    1314                 :            : //------------------------------------------------------------------
    1315                 :        274 : void ODatabaseForm::disposing()
    1316                 :            : {
    1317         [ +  - ]:        274 :     if (m_pAggregatePropertyMultiplexer)
    1318         [ +  - ]:        274 :         m_pAggregatePropertyMultiplexer->dispose();
    1319                 :            : 
    1320         [ +  + ]:        274 :     if (m_bLoaded)
    1321         [ +  - ]:          2 :         unload();
    1322                 :            : 
    1323                 :            :     // cancel the submit/reset-thread
    1324                 :            :     {
    1325         [ +  - ]:        274 :         ::osl::MutexGuard aGuard( m_aMutex );
    1326         [ -  + ]:        274 :         if (m_pThread)
    1327                 :            :         {
    1328                 :          0 :             m_pThread->release();
    1329                 :          0 :             m_pThread = NULL;
    1330         [ +  - ]:        274 :         }
    1331                 :            :     }
    1332                 :            : 
    1333 [ +  - ][ +  - ]:        274 :     EventObject aEvt(static_cast<XWeak*>(this));
    1334         [ +  - ]:        274 :     m_aLoadListeners.disposeAndClear(aEvt);
    1335         [ +  - ]:        274 :     m_aRowSetApproveListeners.disposeAndClear(aEvt);
    1336         [ +  - ]:        274 :     m_aParameterManager.disposing( aEvt );
    1337         [ +  - ]:        274 :     m_aResetListeners.disposing();
    1338         [ +  - ]:        274 :     m_aSubmitListeners.disposeAndClear(aEvt);
    1339         [ +  - ]:        274 :     m_aErrorListeners.disposeAndClear(aEvt);
    1340                 :            : 
    1341         [ +  - ]:        274 :     m_aParameterManager.dispose();   // (to free any references it may have to me)
    1342         [ +  - ]:        274 :     m_aFilterManager.dispose();      // (dito)
    1343                 :            : 
    1344         [ +  - ]:        274 :     OFormComponents::disposing();
    1345         [ +  - ]:        274 :     OPropertySetAggregationHelper::disposing();
    1346                 :            : 
    1347                 :            :     // stop listening on the aggregate
    1348         [ +  - ]:        274 :     if (m_xAggregateAsRowSet.is())
    1349 [ +  - ][ +  - ]:        274 :         m_xAggregateAsRowSet->removeRowSetListener(this);
                 [ +  - ]
    1350                 :            : 
    1351                 :            :     // dispose the active connection
    1352                 :        274 :     Reference<XComponent>  xAggregationComponent;
    1353 [ +  - ][ +  - ]:        274 :     if (query_aggregation(m_xAggregate, xAggregationComponent))
    1354 [ +  - ][ +  - ]:        274 :         xAggregationComponent->dispose();
    1355                 :            : 
    1356 [ +  - ][ +  - ]:        274 :     m_aPropertyBagHelper.dispose();
    1357                 :        274 : }
    1358                 :            : 
    1359                 :            : //------------------------------------------------------------------------------
    1360                 :         50 : Reference< XConnection > ODatabaseForm::getConnection()
    1361                 :            : {
    1362                 :         50 :     Reference< XConnection > xConn;
    1363 [ +  - ][ +  - ]:         50 :     m_xAggregateSet->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xConn;
         [ +  - ][ +  - ]
    1364                 :         50 :     return xConn;
    1365                 :            : }
    1366                 :            : 
    1367                 :            : //------------------------------------------------------------------------------
    1368                 :        277 : ::osl::Mutex& ODatabaseForm::getMutex()
    1369                 :            : {
    1370                 :        277 :     return m_aMutex;
    1371                 :            : }
    1372                 :            : 
    1373                 :            : //==============================================================================
    1374                 :            : // property handling
    1375                 :            : //------------------------------------------------------------------------------
    1376                 :        277 : void ODatabaseForm::describeFixedAndAggregateProperties(
    1377                 :            :         Sequence< Property >& _rProps,
    1378                 :            :         Sequence< Property >& _rAggregateProps ) const
    1379                 :            : {
    1380 [ +  - ][ +  - ]:        277 :     BEGIN_DESCRIBE_AGGREGATION_PROPERTIES(22, m_xAggregateSet)
         [ +  - ][ +  - ]
                 [ +  - ]
    1381                 :            :         // we want to "override" the privileges, since we have additional "AllowInsert" etc. properties
    1382         [ +  - ]:        277 :         RemoveProperty( _rAggregateProps, PROPERTY_PRIVILEGES );
    1383                 :            : 
    1384                 :            :         // InsertOnly is also to be overridden, since we sometimes change it ourself
    1385         [ +  - ]:        277 :         RemoveProperty( _rAggregateProps, PROPERTY_INSERTONLY );
    1386                 :            : 
    1387                 :            :         // we remove and re-declare the DataSourceName property, 'cause we want it to be constrained, and the
    1388                 :            :         // original property of our aggregate isn't
    1389         [ +  - ]:        277 :         RemoveProperty( _rAggregateProps, PROPERTY_DATASOURCE );
    1390                 :            : 
    1391                 :            :         // for connection sharing, we need to override the ActiveConnection property, too
    1392         [ +  - ]:        277 :         RemoveProperty( _rAggregateProps, PROPERTY_ACTIVE_CONNECTION );
    1393                 :            : 
    1394                 :            :         // the Filter property is also overwritten, since we have some implicit filters
    1395                 :            :         // (e.g. the ones which result from linking master fields to detail fields
    1396                 :            :         // via column names instead of parameters)
    1397         [ +  - ]:        277 :         RemoveProperty( _rAggregateProps, PROPERTY_FILTER );
    1398         [ +  - ]:        277 :         RemoveProperty( _rAggregateProps, PROPERTY_APPLYFILTER );
    1399                 :            : 
    1400 [ +  - ][ +  - ]:        277 :         DECL_IFACE_PROP4(ACTIVE_CONNECTION, XConnection,                    BOUND, TRANSIENT, MAYBEVOID, CONSTRAINED);
    1401 [ +  - ][ +  - ]:        277 :         DECL_BOOL_PROP2 ( APPLYFILTER,                                      BOUND, MAYBEDEFAULT            );
    1402         [ +  - ]:        277 :         DECL_PROP1      ( NAME,             ::rtl::OUString,                BOUND                          );
    1403         [ +  - ]:        277 :         DECL_PROP1      ( MASTERFIELDS,     Sequence< ::rtl::OUString >,    BOUND                          );
    1404         [ +  - ]:        277 :         DECL_PROP1      ( DETAILFIELDS,     Sequence< ::rtl::OUString >,    BOUND                          );
    1405 [ +  - ][ +  - ]:        277 :         DECL_PROP2      ( DATASOURCE,       ::rtl::OUString,                BOUND, CONSTRAINED             );
    1406 [ +  - ][ +  - ]:        277 :         DECL_PROP3      ( CYCLE,            TabulatorCycle,                 BOUND, MAYBEVOID, MAYBEDEFAULT );
    1407 [ +  - ][ +  - ]:        277 :         DECL_PROP2      ( FILTER,           ::rtl::OUString,                BOUND, MAYBEDEFAULT            );
    1408 [ +  - ][ +  - ]:        277 :         DECL_BOOL_PROP2 ( INSERTONLY,                                       BOUND, MAYBEDEFAULT            );
    1409         [ +  - ]:        277 :         DECL_PROP1      ( NAVIGATION,       NavigationBarMode,              BOUND                          );
    1410         [ +  - ]:        277 :         DECL_BOOL_PROP1 ( ALLOWADDITIONS,                                   BOUND                          );
    1411         [ +  - ]:        277 :         DECL_BOOL_PROP1 ( ALLOWEDITS,                                       BOUND                          );
    1412         [ +  - ]:        277 :         DECL_BOOL_PROP1 ( ALLOWDELETIONS,                                   BOUND                          );
    1413 [ +  - ][ +  - ]:        277 :         DECL_PROP2      ( PRIVILEGES,       sal_Int32,                      TRANSIENT, READONLY            );
    1414         [ +  - ]:        277 :         DECL_PROP1      ( TARGET_URL,       ::rtl::OUString,                BOUND                          );
    1415         [ +  - ]:        277 :         DECL_PROP1      ( TARGET_FRAME,     ::rtl::OUString,                BOUND                          );
    1416         [ +  - ]:        277 :         DECL_PROP1      ( SUBMIT_METHOD,    FormSubmitMethod,               BOUND                          );
    1417         [ +  - ]:        277 :         DECL_PROP1      ( SUBMIT_ENCODING,  FormSubmitEncoding,             BOUND                          );
    1418 [ +  - ][ +  - ]:        277 :         DECL_BOOL_PROP3 ( DYNAMIC_CONTROL_BORDER,                           BOUND, MAYBEVOID, MAYBEDEFAULT );
    1419 [ +  - ][ +  - ]:        277 :         DECL_PROP3      ( CONTROL_BORDER_COLOR_FOCUS,   sal_Int32,          BOUND, MAYBEVOID, MAYBEDEFAULT );
    1420 [ +  - ][ +  - ]:        277 :         DECL_PROP3      ( CONTROL_BORDER_COLOR_MOUSE,   sal_Int32,          BOUND, MAYBEVOID, MAYBEDEFAULT );
    1421 [ +  - ][ +  - ]:        277 :         DECL_PROP3      ( CONTROL_BORDER_COLOR_INVALID, sal_Int32,          BOUND, MAYBEVOID, MAYBEDEFAULT );
    1422                 :            :     END_DESCRIBE_PROPERTIES();
    1423                 :        277 : }
    1424                 :            : 
    1425                 :            : //------------------------------------------------------------------------------
    1426                 :          0 : Reference< XMultiPropertySet > ODatabaseForm::getPropertiesInterface()
    1427                 :            : {
    1428         [ #  # ]:          0 :     return Reference< XMultiPropertySet >( *this, UNO_QUERY );
    1429                 :            : }
    1430                 :            : 
    1431                 :            : //------------------------------------------------------------------------------
    1432                 :      14793 : ::cppu::IPropertyArrayHelper& ODatabaseForm::getInfoHelper()
    1433                 :            : {
    1434                 :      14793 :     return m_aPropertyBagHelper.getInfoHelper();
    1435                 :            : }
    1436                 :            : 
    1437                 :            : //------------------------------------------------------------------------------
    1438                 :       1157 : Reference< XPropertySetInfo > ODatabaseForm::getPropertySetInfo() throw( RuntimeException )
    1439                 :            : {
    1440                 :       1157 :     return createPropertySetInfo( getInfoHelper() );
    1441                 :            : }
    1442                 :            : 
    1443                 :            : //--------------------------------------------------------------------
    1444                 :          0 : void SAL_CALL ODatabaseForm::addProperty( const ::rtl::OUString& _rName, ::sal_Int16 _nAttributes, const Any& _rInitialValue ) throw (PropertyExistException, IllegalTypeException, IllegalArgumentException, RuntimeException)
    1445                 :            : {
    1446                 :          0 :     m_aPropertyBagHelper.addProperty( _rName, _nAttributes, _rInitialValue );
    1447                 :          0 : }
    1448                 :            : 
    1449                 :            : //--------------------------------------------------------------------
    1450                 :          0 : void SAL_CALL ODatabaseForm::removeProperty( const ::rtl::OUString& _rName ) throw (UnknownPropertyException, NotRemoveableException, RuntimeException)
    1451                 :            : {
    1452                 :          0 :     m_aPropertyBagHelper.removeProperty( _rName );
    1453                 :          0 : }
    1454                 :            : 
    1455                 :            : //--------------------------------------------------------------------
    1456                 :          0 : Sequence< PropertyValue > SAL_CALL ODatabaseForm::getPropertyValues() throw (RuntimeException)
    1457                 :            : {
    1458                 :          0 :     return m_aPropertyBagHelper.getPropertyValues();
    1459                 :            : }
    1460                 :            : 
    1461                 :            : //--------------------------------------------------------------------
    1462                 :          0 : void SAL_CALL ODatabaseForm::setPropertyValues( const Sequence< PropertyValue >& _rProps ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
    1463                 :            : {
    1464                 :          0 :     m_aPropertyBagHelper.setPropertyValues( _rProps );
    1465                 :          0 : }
    1466                 :            : 
    1467                 :            : //------------------------------------------------------------------------------
    1468                 :          4 : Any SAL_CALL ODatabaseForm::getWarnings(  ) throw (SQLException, RuntimeException)
    1469                 :            : {
    1470                 :          4 :     return m_aWarnings.getWarnings();
    1471                 :            : }
    1472                 :            : 
    1473                 :            : //------------------------------------------------------------------------------
    1474                 :          4 : void SAL_CALL ODatabaseForm::clearWarnings(  ) throw (SQLException, RuntimeException)
    1475                 :            : {
    1476                 :          4 :     m_aWarnings.clearWarnings();
    1477                 :          4 : }
    1478                 :            : 
    1479                 :            : //------------------------------------------------------------------------------
    1480                 :          0 : Reference< XCloneable > SAL_CALL ODatabaseForm::createClone(  ) throw (RuntimeException)
    1481                 :            : {
    1482         [ #  # ]:          0 :     ODatabaseForm* pClone = new ODatabaseForm( *this );
    1483                 :          0 :     osl_incrementInterlockedCount( &pClone->m_refCount );
    1484                 :          0 :     pClone->clonedFrom( *this );
    1485                 :          0 :     osl_decrementInterlockedCount( &pClone->m_refCount );
    1486         [ #  # ]:          0 :     return pClone;
    1487                 :            : }
    1488                 :            : 
    1489                 :            : //------------------------------------------------------------------------------
    1490                 :         24 : void ODatabaseForm::fire( sal_Int32* pnHandles, const Any* pNewValues, const Any* pOldValues, sal_Int32 nCount, sal_Bool bVetoable )
    1491                 :            : {
    1492                 :            :     // same as in getFastPropertyValue(sal_Int32) : if we're resetting currently don't fire any changes of the
    1493                 :            :     // IsModified property from sal_False to sal_True, as this is only temporary 'til the reset is done
    1494         [ -  + ]:         24 :     if (m_nResetsPending > 0)
    1495                 :            :     {
    1496                 :            :         // look for the PROPERTY_ID_ISMODIFIED
    1497                 :          0 :         sal_Int32 nPos = 0;
    1498         [ #  # ]:          0 :         for (nPos=0; nPos<nCount; ++nPos)
    1499         [ #  # ]:          0 :             if (pnHandles[nPos] == PROPERTY_ID_ISMODIFIED)
    1500                 :          0 :                 break;
    1501                 :            : 
    1502 [ #  # ][ #  # ]:          0 :         if ((nPos < nCount) && (pNewValues[nPos].getValueType().getTypeClass() == TypeClass_BOOLEAN) && getBOOL(pNewValues[nPos]))
         [ #  # ][ #  # ]
    1503                 :            :         {   // yeah, we found it, and it changed to TRUE
    1504         [ #  # ]:          0 :             if (nPos == 0)
    1505                 :            :             {   // just cut the first element
    1506                 :          0 :                 ++pnHandles;
    1507                 :          0 :                 ++pNewValues;
    1508                 :          0 :                 ++pOldValues;
    1509                 :          0 :                 --nCount;
    1510                 :            :             }
    1511         [ #  # ]:          0 :             else if (nPos == nCount - 1)
    1512                 :            :                 // just cut the last element
    1513                 :          0 :                 --nCount;
    1514                 :            :             else
    1515                 :            :             {   // split into two base class calls
    1516                 :          0 :                 OPropertySetAggregationHelper::fire(pnHandles, pNewValues, pOldValues, nPos, bVetoable);
    1517                 :          0 :                 ++nPos;
    1518                 :          0 :                 OPropertySetAggregationHelper::fire(pnHandles + nPos, pNewValues + nPos, pOldValues + nPos, nCount - nPos, bVetoable);
    1519                 :         24 :                 return;
    1520                 :            :             }
    1521                 :            :         }
    1522                 :            :     }
    1523                 :            : 
    1524                 :         24 :     OPropertySetAggregationHelper::fire(pnHandles, pNewValues, pOldValues, nCount, bVetoable);
    1525                 :            : }
    1526                 :            : 
    1527                 :            : //------------------------------------------------------------------------------
    1528                 :       1692 : Any SAL_CALL ODatabaseForm::getFastPropertyValue( sal_Int32 nHandle )
    1529                 :            :        throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1530                 :            : {
    1531 [ +  + ][ -  + ]:       1692 :     if ((nHandle == PROPERTY_ID_ISMODIFIED) && (m_nResetsPending > 0))
    1532                 :          0 :         return ::cppu::bool2any((sal_False));
    1533                 :            :         // don't allow the aggregate which is currently being reset to return a (temporary) "yes"
    1534                 :            :     else
    1535                 :       1692 :         return OPropertySetAggregationHelper::getFastPropertyValue(nHandle);
    1536                 :            : }
    1537                 :            : 
    1538                 :            : //------------------------------------------------------------------------------
    1539                 :       1487 : void ODatabaseForm::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
    1540                 :            : {
    1541   [ +  +  +  +  :       1487 :     switch (nHandle)
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
                +  +  + ]
    1542                 :            :     {
    1543                 :            :         case PROPERTY_ID_INSERTONLY:
    1544                 :          2 :             rValue <<= m_bInsertOnly;
    1545                 :          2 :             break;
    1546                 :            : 
    1547                 :            :         case PROPERTY_ID_FILTER:
    1548                 :         30 :             rValue <<= m_aFilterManager.getFilterComponent( FilterManager::fcPublicFilter );
    1549                 :         30 :             break;
    1550                 :            : 
    1551                 :            :         case PROPERTY_ID_APPLYFILTER:
    1552         [ +  - ]:         26 :             rValue <<= m_aFilterManager.isApplyPublicFilter();
    1553                 :         26 :             break;
    1554                 :            : 
    1555                 :            :         case PROPERTY_ID_DATASOURCE:
    1556         [ +  - ]:        247 :             rValue = m_xAggregateSet->getPropertyValue( PROPERTY_DATASOURCE );
    1557                 :        247 :             break;
    1558                 :            : 
    1559                 :            :         case PROPERTY_ID_TARGET_URL:
    1560                 :          2 :             rValue <<= m_aTargetURL;
    1561                 :          2 :             break;
    1562                 :            :         case PROPERTY_ID_TARGET_FRAME:
    1563                 :          2 :             rValue <<= m_aTargetFrame;
    1564                 :          2 :             break;
    1565                 :            :         case PROPERTY_ID_SUBMIT_METHOD:
    1566                 :          2 :             rValue <<= m_eSubmitMethod;
    1567                 :          2 :             break;
    1568                 :            :         case PROPERTY_ID_SUBMIT_ENCODING:
    1569                 :          2 :             rValue <<= m_eSubmitEncoding;
    1570                 :          2 :             break;
    1571                 :            :         case PROPERTY_ID_NAME:
    1572                 :        315 :             rValue <<= m_sName;
    1573                 :        315 :             break;
    1574                 :            :         case PROPERTY_ID_MASTERFIELDS:
    1575                 :         26 :             rValue <<= m_aMasterFields;
    1576                 :         26 :             break;
    1577                 :            :         case PROPERTY_ID_DETAILFIELDS:
    1578                 :         26 :             rValue <<= m_aDetailFields;
    1579                 :         26 :             break;
    1580                 :            :         case PROPERTY_ID_CYCLE:
    1581                 :          2 :             rValue = m_aCycle;
    1582                 :          2 :             break;
    1583                 :            :         case PROPERTY_ID_NAVIGATION:
    1584                 :          2 :             rValue <<= m_eNavigation;
    1585                 :          2 :             break;
    1586                 :            :         case PROPERTY_ID_ALLOWADDITIONS:
    1587         [ +  - ]:         10 :             rValue <<= (sal_Bool)m_bAllowInsert;
    1588                 :         10 :             break;
    1589                 :            :         case PROPERTY_ID_ALLOWEDITS:
    1590         [ +  - ]:          6 :             rValue <<= (sal_Bool)m_bAllowUpdate;
    1591                 :          6 :             break;
    1592                 :            :         case PROPERTY_ID_ALLOWDELETIONS:
    1593         [ +  - ]:         10 :             rValue <<= (sal_Bool)m_bAllowDelete;
    1594                 :         10 :             break;
    1595                 :            :         case PROPERTY_ID_PRIVILEGES:
    1596         [ +  - ]:         10 :             rValue <<= (sal_Int32)m_nPrivileges;
    1597                 :         10 :             break;
    1598                 :            :         case PROPERTY_ID_DYNAMIC_CONTROL_BORDER:
    1599                 :         22 :             rValue = m_aDynamicControlBorder;
    1600                 :         22 :             break;
    1601                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_FOCUS:
    1602                 :         22 :             rValue = m_aControlBorderColorFocus;
    1603                 :         22 :             break;
    1604                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_MOUSE:
    1605                 :         22 :             rValue = m_aControlBorderColorMouse;
    1606                 :         22 :             break;
    1607                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_INVALID:
    1608                 :         22 :             rValue = m_aControlBorderColorInvalid;
    1609                 :         22 :             break;
    1610                 :            :         default:
    1611         [ -  + ]:        679 :             if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( nHandle ) )
    1612                 :          0 :                 m_aPropertyBagHelper.getDynamicFastPropertyValue( nHandle, rValue );
    1613                 :            :             else
    1614                 :        679 :                 OPropertySetAggregationHelper::getFastPropertyValue( rValue, nHandle );
    1615                 :        679 :             break;
    1616                 :            :     }
    1617                 :       1487 : }
    1618                 :            : 
    1619                 :            : //------------------------------------------------------------------------------
    1620                 :       1017 : sal_Bool ODatabaseForm::convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue,
    1621                 :            :                                                 sal_Int32 nHandle, const Any& rValue ) throw( IllegalArgumentException )
    1622                 :            : {
    1623                 :       1017 :     sal_Bool bModified(sal_False);
    1624   [ -  +  +  +  :       1017 :     switch (nHandle)
          +  +  -  -  +  
          -  -  -  -  -  
          -  -  -  -  -  
                   -  + ]
    1625                 :            :     {
    1626                 :            :         case PROPERTY_ID_INSERTONLY:
    1627                 :          0 :             bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_bInsertOnly );
    1628                 :          0 :             break;
    1629                 :            : 
    1630                 :            :         case PROPERTY_ID_FILTER:
    1631                 :          2 :             bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_aFilterManager.getFilterComponent( FilterManager::fcPublicFilter ) );
    1632                 :          2 :             break;
    1633                 :            : 
    1634                 :            :         case PROPERTY_ID_APPLYFILTER:
    1635                 :          9 :             bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_aFilterManager.isApplyPublicFilter() );
    1636                 :          9 :             break;
    1637                 :            : 
    1638                 :            :         case PROPERTY_ID_DATASOURCE:
    1639                 :            :         {
    1640                 :        154 :             Any aAggregateProperty;
    1641         [ +  - ]:        154 :             getFastPropertyValue(aAggregateProperty, PROPERTY_ID_DATASOURCE);
    1642 [ +  - ][ +  - ]:        154 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, aAggregateProperty, ::getCppuType(static_cast<const ::rtl::OUString*>(NULL)));
    1643                 :            :         }
    1644                 :        154 :         break;
    1645                 :            :         case PROPERTY_ID_TARGET_URL:
    1646                 :         12 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aTargetURL);
    1647                 :         12 :             break;
    1648                 :            :         case PROPERTY_ID_TARGET_FRAME:
    1649                 :         12 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aTargetFrame);
    1650                 :         12 :             break;
    1651                 :            :         case PROPERTY_ID_SUBMIT_METHOD:
    1652                 :          0 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_eSubmitMethod);
    1653                 :          0 :             break;
    1654                 :            :         case PROPERTY_ID_SUBMIT_ENCODING:
    1655                 :          0 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_eSubmitEncoding);
    1656                 :          0 :             break;
    1657                 :            :         case PROPERTY_ID_NAME:
    1658                 :        521 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sName);
    1659                 :        521 :             break;
    1660                 :            :         case PROPERTY_ID_MASTERFIELDS:
    1661                 :          0 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aMasterFields);
    1662                 :          0 :             break;
    1663                 :            :         case PROPERTY_ID_DETAILFIELDS:
    1664                 :          0 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDetailFields);
    1665                 :          0 :             break;
    1666                 :            :         case PROPERTY_ID_CYCLE:
    1667                 :          0 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aCycle, ::getCppuType(static_cast<const TabulatorCycle*>(NULL)));
    1668                 :          0 :             break;
    1669                 :            :         case PROPERTY_ID_NAVIGATION:
    1670                 :          0 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_eNavigation);
    1671                 :          0 :             break;
    1672                 :            :         case PROPERTY_ID_ALLOWADDITIONS:
    1673                 :          0 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAllowInsert);
    1674                 :          0 :             break;
    1675                 :            :         case PROPERTY_ID_ALLOWEDITS:
    1676                 :          0 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAllowUpdate);
    1677                 :          0 :             break;
    1678                 :            :         case PROPERTY_ID_ALLOWDELETIONS:
    1679                 :          0 :             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAllowDelete);
    1680                 :          0 :             break;
    1681                 :            :         case PROPERTY_ID_DYNAMIC_CONTROL_BORDER:
    1682                 :          0 :             bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_aDynamicControlBorder, ::getBooleanCppuType() );
    1683                 :          0 :             break;
    1684                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_FOCUS:
    1685                 :          0 :             bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_aControlBorderColorFocus, getCppuType( static_cast< sal_Int32* >( NULL ) ) );
    1686                 :          0 :             break;
    1687                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_MOUSE:
    1688                 :          0 :             bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_aControlBorderColorMouse, getCppuType( static_cast< sal_Int32* >( NULL ) ) );
    1689                 :          0 :             break;
    1690                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_INVALID:
    1691                 :          0 :             bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_aControlBorderColorInvalid, getCppuType( static_cast< sal_Int32* >( NULL ) ) );
    1692                 :          0 :             break;
    1693                 :            :         default:
    1694         [ -  + ]:        307 :             if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle ( nHandle ) )
    1695                 :          0 :                 bModified = m_aPropertyBagHelper.convertDynamicFastPropertyValue( nHandle, rValue, rConvertedValue, rOldValue );
    1696                 :            :             else
    1697                 :        307 :                 bModified = OPropertySetAggregationHelper::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
    1698                 :        307 :             break;
    1699                 :            :     }
    1700                 :       1017 :     return bModified;
    1701                 :            : }
    1702                 :            : 
    1703                 :            : //------------------------------------------------------------------------------
    1704                 :        714 : void ODatabaseForm::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw( Exception )
    1705                 :            : {
    1706   [ -  -  +  +  :        714 :     switch (nHandle)
          -  -  -  -  +  
          -  -  -  -  -  
          -  -  -  -  -  
                -  +  - ]
    1707                 :            :     {
    1708                 :            :         case PROPERTY_ID_INSERTONLY:
    1709                 :          0 :             rValue >>= m_bInsertOnly;
    1710         [ #  # ]:          0 :             if ( m_aIgnoreResult.hasValue() )
    1711                 :          0 :                 m_aIgnoreResult <<= m_bInsertOnly;
    1712                 :            :             else
    1713 [ #  # ][ #  # ]:          0 :                 m_xAggregateSet->setPropertyValue( PROPERTY_INSERTONLY, makeAny( m_bInsertOnly ) );
    1714                 :          0 :             break;
    1715                 :            : 
    1716                 :            :         case PROPERTY_ID_FILTER:
    1717                 :            :         {
    1718                 :          0 :             ::rtl::OUString sNewFilter;
    1719                 :          0 :             rValue >>= sNewFilter;
    1720         [ #  # ]:          0 :             m_aFilterManager.setFilterComponent( FilterManager::fcPublicFilter, sNewFilter );
    1721                 :            :         }
    1722                 :          0 :         break;
    1723                 :            : 
    1724                 :            :         case PROPERTY_ID_APPLYFILTER:
    1725                 :            :         {
    1726                 :          2 :             sal_Bool bApply = sal_True;
    1727                 :          2 :             rValue >>= bApply;
    1728         [ +  - ]:          2 :             m_aFilterManager.setApplyPublicFilter( bApply );
    1729                 :            :         }
    1730                 :          2 :         break;
    1731                 :            : 
    1732                 :            :         case PROPERTY_ID_DATASOURCE:
    1733                 :            :         {
    1734                 :        154 :             Reference< XConnection > xSomeConnection;
    1735 [ +  - ][ -  + ]:        154 :             if ( ::dbtools::isEmbeddedInDatabase( getParent(), xSomeConnection ) )
                 [ +  - ]
    1736         [ #  # ]:          0 :                 throw PropertyVetoException();
    1737                 :            : 
    1738                 :            :             try
    1739                 :            :             {
    1740 [ +  - ][ +  - ]:        154 :                 m_xAggregateSet->setPropertyValue(PROPERTY_DATASOURCE, rValue);
         [ +  - ][ #  # ]
    1741                 :            :             }
    1742         [ #  # ]:          0 :             catch(const Exception&)
    1743                 :            :             {
    1744                 :        154 :             }
    1745                 :            :         }
    1746                 :        154 :         break;
    1747                 :            :         case PROPERTY_ID_TARGET_URL:
    1748                 :          0 :             rValue >>= m_aTargetURL;
    1749                 :          0 :             break;
    1750                 :            :         case PROPERTY_ID_TARGET_FRAME:
    1751                 :          0 :             rValue >>= m_aTargetFrame;
    1752                 :          0 :             break;
    1753                 :            :         case PROPERTY_ID_SUBMIT_METHOD:
    1754                 :          0 :             rValue >>= m_eSubmitMethod;
    1755                 :          0 :             break;
    1756                 :            :         case PROPERTY_ID_SUBMIT_ENCODING:
    1757                 :          0 :             rValue >>= m_eSubmitEncoding;
    1758                 :          0 :             break;
    1759                 :            :         case PROPERTY_ID_NAME:
    1760                 :        275 :             rValue >>= m_sName;
    1761                 :        275 :             break;
    1762                 :            :         case PROPERTY_ID_MASTERFIELDS:
    1763                 :          0 :             rValue >>= m_aMasterFields;
    1764                 :          0 :             invlidateParameters();
    1765                 :          0 :             break;
    1766                 :            :         case PROPERTY_ID_DETAILFIELDS:
    1767                 :          0 :             rValue >>= m_aDetailFields;
    1768                 :          0 :             invlidateParameters();
    1769                 :          0 :             break;
    1770                 :            :         case PROPERTY_ID_CYCLE:
    1771                 :          0 :             m_aCycle = rValue;
    1772                 :          0 :             break;
    1773                 :            :         case PROPERTY_ID_NAVIGATION:
    1774                 :          0 :             rValue >>= m_eNavigation;
    1775                 :          0 :             break;
    1776                 :            :         case PROPERTY_ID_ALLOWADDITIONS:
    1777                 :          0 :             m_bAllowInsert = getBOOL(rValue);
    1778                 :          0 :             break;
    1779                 :            :         case PROPERTY_ID_ALLOWEDITS:
    1780                 :          0 :             m_bAllowUpdate = getBOOL(rValue);
    1781                 :          0 :             break;
    1782                 :            :         case PROPERTY_ID_ALLOWDELETIONS:
    1783                 :          0 :             m_bAllowDelete = getBOOL(rValue);
    1784                 :          0 :             break;
    1785                 :            :         case PROPERTY_ID_DYNAMIC_CONTROL_BORDER:
    1786                 :          0 :             m_aDynamicControlBorder = rValue;
    1787                 :          0 :             break;
    1788                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_FOCUS:
    1789                 :          0 :             m_aControlBorderColorFocus = rValue;
    1790                 :          0 :             break;
    1791                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_MOUSE:
    1792                 :          0 :             m_aControlBorderColorMouse = rValue;
    1793                 :          0 :             break;
    1794                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_INVALID:
    1795                 :          0 :             m_aControlBorderColorInvalid = rValue;
    1796                 :          0 :             break;
    1797                 :            : 
    1798                 :            :         case PROPERTY_ID_ACTIVE_CONNECTION:
    1799                 :            :         {
    1800                 :        283 :             Reference< XConnection > xOuterConnection;
    1801 [ +  - ][ -  + ]:        283 :             if ( ::dbtools::isEmbeddedInDatabase( getParent(), xOuterConnection ) )
                 [ +  - ]
    1802                 :            :             {
    1803 [ #  # ][ #  # ]:          0 :                 if ( xOuterConnection != Reference< XConnection >( rValue, UNO_QUERY ) )
                 [ #  # ]
    1804                 :            :                     // somebody's trying to set a connection which is not equal the connection
    1805                 :            :                     // implied by the database we're embedded in
    1806         [ #  # ]:          0 :                     throw PropertyVetoException();
    1807                 :            :             }
    1808         [ +  - ]:        283 :             OPropertySetAggregationHelper::setFastPropertyValue_NoBroadcast( nHandle, rValue );
    1809                 :        283 :             break;
    1810                 :            :         }
    1811                 :            : 
    1812                 :            :         default:
    1813         [ #  # ]:          0 :             if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( nHandle ) )
    1814                 :          0 :                 m_aPropertyBagHelper.setDynamicFastPropertyValue( nHandle, rValue );
    1815                 :            :             else
    1816                 :          0 :                 OPropertySetAggregationHelper::setFastPropertyValue_NoBroadcast( nHandle, rValue );
    1817                 :          0 :             break;
    1818                 :            :     }
    1819                 :        714 : }
    1820                 :            : 
    1821                 :            : //------------------------------------------------------------------
    1822                 :        283 : void SAL_CALL ODatabaseForm::forwardingPropertyValue( sal_Int32 _nHandle )
    1823                 :            : {
    1824                 :            :     OSL_ENSURE( _nHandle == PROPERTY_ID_ACTIVE_CONNECTION, "ODatabaseForm::forwardingPropertyValue: unexpected property!" );
    1825         [ +  - ]:        283 :     if ( _nHandle == PROPERTY_ID_ACTIVE_CONNECTION )
    1826                 :            :     {
    1827         [ -  + ]:        283 :         if ( m_bSharingConnection )
    1828                 :          0 :             stopSharingConnection( );
    1829                 :        283 :         m_bForwardingConnection = sal_True;
    1830                 :            :     }
    1831                 :        283 : }
    1832                 :            : 
    1833                 :            : //------------------------------------------------------------------
    1834                 :        283 : void SAL_CALL ODatabaseForm::forwardedPropertyValue( sal_Int32 _nHandle, bool /*_bSuccess*/ )
    1835                 :            : {
    1836                 :            :     OSL_ENSURE( _nHandle == PROPERTY_ID_ACTIVE_CONNECTION, "ODatabaseForm::forwardedPropertyValue: unexpected property!" );
    1837         [ +  - ]:        283 :     if ( _nHandle == PROPERTY_ID_ACTIVE_CONNECTION )
    1838                 :            :     {
    1839                 :        283 :         m_bForwardingConnection = sal_False;
    1840                 :            :     }
    1841                 :        283 : }
    1842                 :            : 
    1843                 :            : //==============================================================================
    1844                 :            : // com::sun::star::beans::XPropertyState
    1845                 :            : //------------------------------------------------------------------
    1846                 :          0 : PropertyState ODatabaseForm::getPropertyStateByHandle(sal_Int32 nHandle)
    1847                 :            : {
    1848                 :            :     PropertyState eState;
    1849   [ #  #  #  #  :          0 :     switch (nHandle)
          #  #  #  #  #  
                      # ]
    1850                 :            :     {
    1851                 :            :         case PROPERTY_ID_NAVIGATION:
    1852         [ #  # ]:          0 :             return (NavigationBarMode_CURRENT == m_eNavigation) ? PropertyState_DEFAULT_VALUE : PropertyState_DIRECT_VALUE;
    1853                 :            : 
    1854                 :            :         case PROPERTY_ID_CYCLE:
    1855                 :          0 :             eState = m_aCycle.hasValue() ? PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
    1856                 :          0 :             break;
    1857                 :            : 
    1858                 :            :         case PROPERTY_ID_INSERTONLY:
    1859                 :          0 :             eState = m_bInsertOnly ? PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
    1860                 :          0 :             break;
    1861                 :            : 
    1862                 :            :         case PROPERTY_ID_FILTER:
    1863         [ #  # ]:          0 :             if ( m_aFilterManager.getFilterComponent( FilterManager::fcPublicFilter ).isEmpty() )
    1864                 :          0 :                 eState = PropertyState_DEFAULT_VALUE;
    1865                 :            :             else
    1866                 :          0 :                 eState = PropertyState_DIRECT_VALUE;
    1867                 :          0 :             break;
    1868                 :            : 
    1869                 :            :         case PROPERTY_ID_APPLYFILTER:
    1870         [ #  # ]:          0 :             eState = m_aFilterManager.isApplyPublicFilter() ? PropertyState_DEFAULT_VALUE : PropertyState_DIRECT_VALUE;
    1871                 :          0 :             break;
    1872                 :            : 
    1873                 :            :         case PROPERTY_ID_DYNAMIC_CONTROL_BORDER:
    1874                 :          0 :             eState = m_aDynamicControlBorder.hasValue() ? PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
    1875                 :          0 :             break;
    1876                 :            : 
    1877                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_FOCUS:
    1878                 :          0 :             eState = m_aControlBorderColorFocus.hasValue() ? PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
    1879                 :          0 :             break;
    1880                 :            : 
    1881                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_MOUSE:
    1882                 :          0 :             eState = m_aControlBorderColorMouse.hasValue() ? PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
    1883                 :          0 :             break;
    1884                 :            : 
    1885                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_INVALID:
    1886                 :          0 :             eState = m_aControlBorderColorInvalid.hasValue() ? PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
    1887                 :          0 :             break;
    1888                 :            : 
    1889                 :            :         default:
    1890                 :          0 :             eState = OPropertySetAggregationHelper::getPropertyStateByHandle(nHandle);
    1891                 :            :     }
    1892                 :          0 :     return eState;
    1893                 :            : }
    1894                 :            : 
    1895                 :            : //------------------------------------------------------------------
    1896                 :          0 : void ODatabaseForm::setPropertyToDefaultByHandle(sal_Int32 nHandle)
    1897                 :            : {
    1898         [ #  # ]:          0 :     switch (nHandle)
    1899                 :            :     {
    1900                 :            :         case PROPERTY_ID_INSERTONLY:
    1901                 :            :         case PROPERTY_ID_FILTER:
    1902                 :            :         case PROPERTY_ID_APPLYFILTER:
    1903                 :            :         case PROPERTY_ID_NAVIGATION:
    1904                 :            :         case PROPERTY_ID_CYCLE:
    1905                 :            :         case PROPERTY_ID_DYNAMIC_CONTROL_BORDER:
    1906                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_FOCUS:
    1907                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_MOUSE:
    1908                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_INVALID:
    1909         [ #  # ]:          0 :             setFastPropertyValue( nHandle, getPropertyDefaultByHandle( nHandle ) );
    1910                 :          0 :             break;
    1911                 :            : 
    1912                 :            :         default:
    1913                 :          0 :             OPropertySetAggregationHelper::setPropertyToDefaultByHandle(nHandle);
    1914                 :            :     }
    1915                 :          0 : }
    1916                 :            : 
    1917                 :            : //------------------------------------------------------------------
    1918                 :          0 : Any ODatabaseForm::getPropertyDefaultByHandle( sal_Int32 nHandle ) const
    1919                 :            : {
    1920                 :          0 :     Any aReturn;
    1921   [ #  #  #  #  :          0 :     switch (nHandle)
                   #  # ]
    1922                 :            :     {
    1923                 :            :         case PROPERTY_ID_INSERTONLY:
    1924                 :            :         case PROPERTY_ID_DYNAMIC_CONTROL_BORDER:
    1925         [ #  # ]:          0 :             aReturn <<= sal_False;
    1926                 :          0 :             break;
    1927                 :            : 
    1928                 :            :         case PROPERTY_ID_FILTER:
    1929         [ #  # ]:          0 :             aReturn <<= ::rtl::OUString();
    1930                 :          0 :             break;
    1931                 :            : 
    1932                 :            :         case PROPERTY_ID_APPLYFILTER:
    1933         [ #  # ]:          0 :             aReturn <<= sal_True;
    1934                 :          0 :             break;
    1935                 :            : 
    1936                 :            :         case PROPERTY_ID_NAVIGATION:
    1937         [ #  # ]:          0 :             aReturn = makeAny(NavigationBarMode_CURRENT);
    1938                 :          0 :             break;
    1939                 :            : 
    1940                 :            :         case PROPERTY_ID_CYCLE:
    1941                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_FOCUS:
    1942                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_MOUSE:
    1943                 :            :         case PROPERTY_ID_CONTROL_BORDER_COLOR_INVALID:
    1944                 :          0 :             break;
    1945                 :            : 
    1946                 :            :         default:
    1947 [ #  # ][ #  # ]:          0 :             if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( nHandle ) )
    1948         [ #  # ]:          0 :                 m_aPropertyBagHelper.getDynamicPropertyDefaultByHandle( nHandle, aReturn );
    1949                 :            :             else
    1950         [ #  # ]:          0 :                 aReturn = OPropertySetAggregationHelper::getPropertyDefaultByHandle( nHandle );
    1951                 :          0 :             break;
    1952                 :            :     }
    1953                 :          0 :     return aReturn;
    1954                 :            : }
    1955                 :            : 
    1956                 :            : //==============================================================================
    1957                 :            : // com::sun::star::form::XReset
    1958                 :            : //------------------------------------------------------------------------------
    1959                 :          0 : void SAL_CALL ODatabaseForm::reset() throw( RuntimeException )
    1960                 :            : {
    1961         [ #  # ]:          0 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
    1962                 :            : 
    1963 [ #  # ][ #  # ]:          0 :     if (isLoaded())
    1964                 :            :     {
    1965         [ #  # ]:          0 :         ::osl::MutexGuard aResetGuard(m_aResetSafety);
    1966                 :          0 :         ++m_nResetsPending;
    1967         [ #  # ]:          0 :         reset_impl(true);
    1968         [ #  # ]:          0 :         return;
    1969                 :            :     }
    1970                 :            : 
    1971 [ #  # ][ #  # ]:          0 :     if ( !m_aResetListeners.empty() )
    1972                 :            :     {
    1973         [ #  # ]:          0 :         ::osl::MutexGuard aResetGuard(m_aResetSafety);
    1974                 :          0 :         ++m_nResetsPending;
    1975                 :            :         // create an own thread if we have (approve-)reset-listeners (so the listeners can't do that much damage
    1976                 :            :         // to this thread which is probably the main one)
    1977         [ #  # ]:          0 :         if (!m_pThread)
    1978                 :            :         {
    1979 [ #  # ][ #  # ]:          0 :             m_pThread = new OFormSubmitResetThread(this);
    1980                 :          0 :             m_pThread->acquire();
    1981         [ #  # ]:          0 :             m_pThread->create();
    1982                 :            :         }
    1983         [ #  # ]:          0 :         EventObject aEvt;
    1984 [ #  # ][ #  # ]:          0 :         m_pThread->addEvent(&aEvt, sal_False);
                 [ #  # ]
    1985                 :            :     }
    1986                 :            :     else
    1987                 :            :     {
    1988                 :            :         // direct call without any approving by the listeners
    1989         [ #  # ]:          0 :         aGuard.clear();
    1990                 :            : 
    1991         [ #  # ]:          0 :         ::osl::MutexGuard aResetGuard(m_aResetSafety);
    1992                 :          0 :         ++m_nResetsPending;
    1993 [ #  # ][ #  # ]:          0 :         reset_impl(false);
    1994 [ #  # ][ #  # ]:          0 :     }
    1995                 :            : }
    1996                 :            : 
    1997                 :            : //-----------------------------------------------------------------------------
    1998                 :          0 : void ODatabaseForm::reset_impl(bool _bAproveByListeners)
    1999                 :            : {
    2000         [ #  # ]:          0 :     if ( _bAproveByListeners )
    2001 [ #  # ][ #  # ]:          0 :         if ( !m_aResetListeners.approveReset() )
    2002                 :          0 :             return;
    2003                 :            : 
    2004         [ #  # ]:          0 :     ::osl::ResettableMutexGuard aResetGuard(m_aResetSafety);
    2005                 :            :     // do we have a database connected form and stay on the insert row
    2006                 :          0 :     sal_Bool bInsertRow = sal_False;
    2007         [ #  # ]:          0 :     if (m_xAggregateSet.is())
    2008 [ #  # ][ #  # ]:          0 :         bInsertRow = getBOOL(m_xAggregateSet->getPropertyValue(PROPERTY_ISNEW));
         [ #  # ][ #  # ]
    2009         [ #  # ]:          0 :     if (bInsertRow)
    2010                 :            :     {
    2011                 :            :         try
    2012                 :            :         {
    2013                 :            :             // Iterate through all columns and set the default value
    2014         [ #  # ]:          0 :             Reference< XColumnsSupplier > xColsSuppl( m_xAggregateSet, UNO_QUERY );
    2015 [ #  # ][ #  # ]:          0 :             Reference< XIndexAccess > xIndexCols( xColsSuppl->getColumns(), UNO_QUERY );
                 [ #  # ]
    2016 [ #  # ][ #  # ]:          0 :             for (sal_Int32 i = 0; i < xIndexCols->getCount(); ++i)
                 [ #  # ]
    2017                 :            :             {
    2018                 :          0 :                 Reference< XPropertySet > xColProps;
    2019 [ #  # ][ #  # ]:          0 :                 xIndexCols->getByIndex(i) >>= xColProps;
                 [ #  # ]
    2020                 :            : 
    2021         [ #  # ]:          0 :                 Reference< XColumnUpdate > xColUpdate( xColProps, UNO_QUERY );
    2022         [ #  # ]:          0 :                 if ( !xColUpdate.is() )
    2023                 :          0 :                     continue;
    2024                 :            : 
    2025                 :          0 :                 Reference< XPropertySetInfo > xPSI;
    2026         [ #  # ]:          0 :                 if ( xColProps.is() )
    2027 [ #  # ][ #  # ]:          0 :                     xPSI = xColProps->getPropertySetInfo( );
                 [ #  # ]
    2028                 :            : 
    2029 [ #  # ][ #  # ]:          0 :                 static const ::rtl::OUString PROPERTY_CONTROLDEFAULT( RTL_CONSTASCII_USTRINGPARAM( "ControlDefault" ) );
         [ #  # ][ #  # ]
    2030 [ #  # ][ #  # ]:          0 :                 if ( xPSI.is() && xPSI->hasPropertyByName( PROPERTY_CONTROLDEFAULT ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    2031                 :            :                 {
    2032 [ #  # ][ #  # ]:          0 :                     Any aDefault = xColProps->getPropertyValue( PROPERTY_CONTROLDEFAULT );
    2033                 :            : 
    2034                 :          0 :                     sal_Bool bReadOnly = sal_False;
    2035 [ #  # ][ #  # ]:          0 :                     if ( xPSI->hasPropertyByName( PROPERTY_ISREADONLY ) )
         [ #  # ][ #  # ]
    2036 [ #  # ][ #  # ]:          0 :                         xColProps->getPropertyValue( PROPERTY_ISREADONLY ) >>= bReadOnly;
         [ #  # ][ #  # ]
    2037                 :            : 
    2038         [ #  # ]:          0 :                     if ( !bReadOnly )
    2039                 :            :                     {
    2040                 :            :                         try
    2041                 :            :                         {
    2042         [ #  # ]:          0 :                             if ( aDefault.hasValue() )
    2043 [ #  # ][ #  # ]:          0 :                                 xColUpdate->updateObject( aDefault );
    2044                 :            :                         }
    2045         [ #  # ]:          0 :                         catch(const Exception&)
    2046                 :            :                         {
    2047                 :            :                             DBG_UNHANDLED_EXCEPTION();
    2048                 :            :                         }
    2049                 :          0 :                     }
    2050                 :            :                 }
    2051 [ #  # ][ #  # ]:          0 :             }
                 [ #  # ]
    2052                 :            :         }
    2053         [ #  # ]:          0 :         catch(const Exception&)
    2054                 :            :         {
    2055                 :            :         }
    2056                 :            : 
    2057         [ #  # ]:          0 :         if (m_bSubForm)
    2058                 :            :         {
    2059         [ #  # ]:          0 :             Reference< XColumnsSupplier > xParentColSupp( m_xParent, UNO_QUERY );
    2060                 :          0 :             Reference< XNameAccess >      xParentCols;
    2061         [ #  # ]:          0 :             if ( xParentColSupp.is() )
    2062 [ #  # ][ #  # ]:          0 :                 xParentCols = xParentColSupp->getColumns();
         [ #  # ][ #  # ]
    2063                 :            : 
    2064 [ #  # ][ #  # ]:          0 :             if ( xParentCols.is() && xParentCols->hasElements() && m_aMasterFields.getLength() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2065                 :            :             {
    2066                 :            :                 try
    2067                 :            :                 {
    2068                 :            :                     // analyze our parameters
    2069         [ #  # ]:          0 :                     if ( !m_aParameterManager.isUpToDate() )
    2070         [ #  # ]:          0 :                         updateParameterInfo();
    2071                 :            : 
    2072         [ #  # ]:          0 :                     m_aParameterManager.resetParameterValues( );
    2073                 :            :                 }
    2074         [ #  # ]:          0 :                 catch(const Exception&)
    2075                 :            :                 {
    2076                 :            :                     OSL_FAIL("ODatabaseForm::reset_impl: could not initialize the master-detail-driven parameters!");
    2077                 :            :                 }
    2078                 :          0 :             }
    2079                 :            :         }
    2080                 :            :     }
    2081                 :            : 
    2082         [ #  # ]:          0 :     aResetGuard.clear();
    2083                 :            :     // iterate through all components. don't use an XIndexAccess as this will cause massive
    2084                 :            :     // problems with the count.
    2085         [ #  # ]:          0 :     Reference<XEnumeration>  xIter = createEnumeration();
    2086 [ #  # ][ #  # ]:          0 :     while (xIter->hasMoreElements())
                 [ #  # ]
    2087                 :            :     {
    2088                 :          0 :         Reference<XReset> xReset;
    2089 [ #  # ][ #  # ]:          0 :         xIter->nextElement() >>= xReset;
                 [ #  # ]
    2090         [ #  # ]:          0 :         if (xReset.is())
    2091                 :            :         {
    2092                 :            :             // TODO : all reset-methods have to be thread-safe
    2093 [ #  # ][ #  # ]:          0 :             xReset->reset();
    2094                 :            :         }
    2095                 :          0 :     }
    2096                 :            : 
    2097         [ #  # ]:          0 :     aResetGuard.reset();
    2098                 :            :     // ensure that the row isn't modified
    2099                 :            :     // (do this _before_ the listeners are notified ! their reaction (maybe asynchronous) may depend
    2100                 :            :     // on the modified state of the row)
    2101         [ #  # ]:          0 :     if (bInsertRow)
    2102 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->setPropertyValue(PROPERTY_ISMODIFIED, ::cppu::bool2any(sal_Bool(sal_False)));
         [ #  # ][ #  # ]
    2103                 :            : 
    2104         [ #  # ]:          0 :     aResetGuard.clear();
    2105                 :            :     {
    2106         [ #  # ]:          0 :         m_aResetListeners.resetted();
    2107                 :            :     }
    2108                 :            : 
    2109         [ #  # ]:          0 :     aResetGuard.reset();
    2110                 :            :     // and again : ensure the row isn't modified
    2111                 :            :     // we already did this after we (and maybe our dependents) resetted the values, but the listeners may have changed the row, too
    2112         [ #  # ]:          0 :     if (bInsertRow)
    2113 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->setPropertyValue(PROPERTY_ISMODIFIED, ::cppu::bool2any((sal_False)));
         [ #  # ][ #  # ]
    2114                 :            : 
    2115         [ #  # ]:          0 :     --m_nResetsPending;
    2116                 :            : }
    2117                 :            : 
    2118                 :            : //-----------------------------------------------------------------------------
    2119                 :          2 : void SAL_CALL ODatabaseForm::addResetListener(const Reference<XResetListener>& _rListener) throw( RuntimeException )
    2120                 :            : {
    2121                 :          2 :     m_aResetListeners.addTypedListener( _rListener );
    2122                 :          2 : }
    2123                 :            : 
    2124                 :            : //-----------------------------------------------------------------------------
    2125                 :          0 : void SAL_CALL ODatabaseForm::removeResetListener(const Reference<XResetListener>& _rListener) throw( RuntimeException )
    2126                 :            : {
    2127                 :          0 :     m_aResetListeners.removeTypedListener( _rListener );
    2128                 :          0 : }
    2129                 :            : 
    2130                 :            : //==============================================================================
    2131                 :            : // com::sun::star::form::XSubmit
    2132                 :            : //------------------------------------------------------------------------------
    2133                 :          0 : void SAL_CALL ODatabaseForm::submit( const Reference<XControl>& Control,
    2134                 :            :                               const ::com::sun::star::awt::MouseEvent& MouseEvt ) throw( RuntimeException )
    2135                 :            : {
    2136                 :            :     {
    2137         [ #  # ]:          0 :         ::osl::MutexGuard aGuard(m_aMutex);
    2138                 :            :         // Do we have controls and a Submit URL?
    2139 [ #  # ][ #  # ]:          0 :         if( !getCount() || m_aTargetURL.isEmpty() )
         [ #  # ][ #  # ]
    2140 [ #  # ][ #  # ]:          0 :             return;
    2141                 :            :     }
    2142                 :            : 
    2143         [ #  # ]:          0 :     ::osl::ClearableMutexGuard aGuard(m_aMutex);
    2144 [ #  # ][ #  # ]:          0 :     if (m_aSubmitListeners.getLength())
    2145                 :            :     {
    2146                 :            :         // create an own thread if we have (approve-)submit-listeners (so the listeners can't do that much damage
    2147                 :            :         // to this thread which is probably the main one)
    2148         [ #  # ]:          0 :         if (!m_pThread)
    2149                 :            :         {
    2150 [ #  # ][ #  # ]:          0 :             m_pThread = new OFormSubmitResetThread(this);
    2151                 :          0 :             m_pThread->acquire();
    2152         [ #  # ]:          0 :             m_pThread->create();
    2153                 :            :         }
    2154         [ #  # ]:          0 :         m_pThread->addEvent(&MouseEvt, Control, sal_True);
    2155                 :            :     }
    2156                 :            :     else
    2157                 :            :     {
    2158                 :            :         // direct call without any approving by the listeners
    2159         [ #  # ]:          0 :         aGuard.clear();
    2160         [ #  # ]:          0 :         submit_impl( Control, MouseEvt, true );
    2161         [ #  # ]:          0 :     }
    2162                 :            : }
    2163                 :            : // -----------------------------------------------------------------------------
    2164                 :          0 : void lcl_dispatch(const Reference< XFrame >& xFrame,const Reference<XURLTransformer>& xTransformer,const ::rtl::OUString& aURLStr,const ::rtl::OUString& aReferer,const ::rtl::OUString& aTargetName
    2165                 :            :                   ,const ::rtl::OUString& aData,rtl_TextEncoding _eEncoding)
    2166                 :            : {
    2167                 :          0 :     URL aURL;
    2168                 :          0 :     aURL.Complete = aURLStr;
    2169 [ #  # ][ #  # ]:          0 :     xTransformer->parseStrict(aURL);
    2170                 :            : 
    2171 [ #  # ][ #  # ]:          0 :     Reference< XDispatch >  xDisp = Reference< XDispatchProvider > (xFrame,UNO_QUERY)->queryDispatch(aURL, aTargetName,
    2172                 :            :         FrameSearchFlag::SELF | FrameSearchFlag::PARENT | FrameSearchFlag::CHILDREN |
    2173         [ #  # ]:          0 :         FrameSearchFlag::SIBLINGS | FrameSearchFlag::CREATE | FrameSearchFlag::TASKS);
    2174                 :            : 
    2175         [ #  # ]:          0 :     if (xDisp.is())
    2176                 :            :     {
    2177         [ #  # ]:          0 :         Sequence<PropertyValue> aArgs(2);
    2178 [ #  # ][ #  # ]:          0 :         aArgs.getArray()[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer") );
    2179 [ #  # ][ #  # ]:          0 :         aArgs.getArray()[0].Value <<= aReferer;
    2180                 :            : 
    2181                 :            :         // build a sequence from the to-be-submitted string
    2182         [ #  # ]:          0 :         rtl::OString a8BitData(rtl::OUStringToOString(aData, _eEncoding));
    2183                 :            :         // always ANSI #58641
    2184         [ #  # ]:          0 :         Sequence< sal_Int8 > aPostData((const sal_Int8*)a8BitData.getStr(), a8BitData.getLength());
    2185 [ #  # ][ #  # ]:          0 :         Reference< XInputStream > xPostData = new SequenceInputStream(aPostData);
                 [ #  # ]
    2186                 :            : 
    2187 [ #  # ][ #  # ]:          0 :         aArgs.getArray()[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PostData") );
    2188 [ #  # ][ #  # ]:          0 :         aArgs.getArray()[1].Value <<= xPostData;
    2189                 :            : 
    2190 [ #  # ][ #  # ]:          0 :         xDisp->dispatch(aURL, aArgs);
         [ #  # ][ #  # ]
    2191                 :          0 :     } // if (xDisp.is())
    2192                 :          0 : }
    2193                 :            : //------------------------------------------------------------------------------
    2194                 :          0 : void ODatabaseForm::submit_impl(const Reference<XControl>& Control, const ::com::sun::star::awt::MouseEvent& MouseEvt, bool _bAproveByListeners)
    2195                 :            : {
    2196                 :            : 
    2197         [ #  # ]:          0 :     if (_bAproveByListeners)
    2198                 :            :     {
    2199         [ #  # ]:          0 :         ::cppu::OInterfaceIteratorHelper aIter(m_aSubmitListeners);
    2200 [ #  # ][ #  # ]:          0 :         EventObject aEvt(static_cast<XWeak*>(this));
    2201                 :          0 :         sal_Bool bCanceled = sal_False;
    2202 [ #  # ][ #  # ]:          0 :         while (aIter.hasMoreElements() && !bCanceled)
                 [ #  # ]
    2203                 :            :         {
    2204 [ #  # ][ #  # ]:          0 :             if (!((XSubmitListener*)aIter.next())->approveSubmit(aEvt))
                 [ #  # ]
    2205                 :          0 :                 bCanceled = sal_True;
    2206                 :            :         }
    2207                 :            : 
    2208         [ #  # ]:          0 :         if (bCanceled)
    2209 [ #  # ][ #  # ]:          0 :             return;
         [ #  # ][ #  # ]
    2210                 :            :     }
    2211                 :            : 
    2212                 :            :     FormSubmitEncoding eSubmitEncoding;
    2213                 :            :     FormSubmitMethod eSubmitMethod;
    2214                 :          0 :     ::rtl::OUString aURLStr;
    2215                 :          0 :     ::rtl::OUString aReferer;
    2216                 :          0 :     ::rtl::OUString aTargetName;
    2217                 :          0 :     Reference< XModel >  xModel;
    2218                 :            :     {
    2219         [ #  # ]:          0 :         SolarMutexGuard aGuard;
    2220                 :            :         // starform->Forms
    2221                 :            : 
    2222         [ #  # ]:          0 :         Reference<XChild>  xParent(m_xParent, UNO_QUERY);
    2223                 :            : 
    2224         [ #  # ]:          0 :         if (xParent.is())
    2225 [ #  # ][ #  # ]:          0 :             xModel = getXModel(xParent->getParent());
         [ #  # ][ #  # ]
    2226                 :            : 
    2227         [ #  # ]:          0 :         if (xModel.is())
    2228 [ #  # ][ #  # ]:          0 :             aReferer = xModel->getURL();
    2229                 :            : 
    2230                 :            :         // TargetItem
    2231                 :          0 :         aTargetName = m_aTargetFrame;
    2232                 :            : 
    2233                 :          0 :         eSubmitEncoding = m_eSubmitEncoding;
    2234                 :          0 :         eSubmitMethod = m_eSubmitMethod;
    2235         [ #  # ]:          0 :         aURLStr = m_aTargetURL;
    2236                 :            :     }
    2237                 :            : 
    2238         [ #  # ]:          0 :     if (!xModel.is())
    2239                 :            :         return;
    2240 [ #  # ][ #  # ]:          0 :     Reference< XFrame >  xFrame = xModel->getCurrentController()->getFrame();
         [ #  # ][ #  # ]
    2241         [ #  # ]:          0 :     if (!xFrame.is())
    2242                 :            :         return;
    2243                 :            : 
    2244 [ #  # ][ #  # ]:          0 :     Reference<XURLTransformer> xTransformer(URLTransformer::create(comphelper::ComponentContext(m_xServiceFactory).getUNOContext()));
         [ #  # ][ #  # ]
    2245                 :            : 
    2246                 :            :     // URL encoding
    2247         [ #  # ]:          0 :     if( eSubmitEncoding == FormSubmitEncoding_URL )
    2248                 :            :     {
    2249                 :          0 :         ::rtl::OUString aData;
    2250                 :            :         {
    2251         [ #  # ]:          0 :             SolarMutexGuard aGuard;
    2252 [ #  # ][ #  # ]:          0 :             aData = GetDataURLEncoded( Control, MouseEvt );
    2253                 :            :         }
    2254                 :            : 
    2255                 :          0 :         URL aURL;
    2256                 :            :         // FormMethod GET
    2257         [ #  # ]:          0 :         if( eSubmitMethod == FormSubmitMethod_GET )
    2258                 :            :         {
    2259         [ #  # ]:          0 :             INetURLObject aUrlObj( aURLStr, INetURLObject::WAS_ENCODED );
    2260         [ #  # ]:          0 :             aUrlObj.SetParam( aData, INetURLObject::ENCODE_ALL );
    2261         [ #  # ]:          0 :             aURL.Complete = aUrlObj.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
    2262         [ #  # ]:          0 :             if (xTransformer.is())
    2263 [ #  # ][ #  # ]:          0 :                 xTransformer->parseStrict(aURL);
    2264                 :            : 
    2265 [ #  # ][ #  # ]:          0 :             Reference< XDispatch >  xDisp = Reference< XDispatchProvider > (xFrame,UNO_QUERY)->queryDispatch(aURL, aTargetName,
    2266                 :            :                     FrameSearchFlag::SELF | FrameSearchFlag::PARENT | FrameSearchFlag::CHILDREN |
    2267         [ #  # ]:          0 :                     FrameSearchFlag::SIBLINGS | FrameSearchFlag::CREATE | FrameSearchFlag::TASKS);
    2268                 :            : 
    2269         [ #  # ]:          0 :             if (xDisp.is())
    2270                 :            :             {
    2271         [ #  # ]:          0 :                 Sequence<PropertyValue> aArgs(1);
    2272 [ #  # ][ #  # ]:          0 :                 aArgs.getArray()->Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer") );
    2273 [ #  # ][ #  # ]:          0 :                 aArgs.getArray()->Value <<= aReferer;
    2274 [ #  # ][ #  # ]:          0 :                 xDisp->dispatch(aURL, aArgs);
                 [ #  # ]
    2275         [ #  # ]:          0 :             }
    2276                 :            :         }
    2277                 :            :         // FormMethod POST
    2278         [ #  # ]:          0 :         else if( eSubmitMethod == FormSubmitMethod_POST )
    2279                 :            :         {
    2280         [ #  # ]:          0 :             lcl_dispatch(xFrame,xTransformer,aURLStr,aReferer,aTargetName,aData,RTL_TEXTENCODING_MS_1252);
    2281                 :          0 :         }
    2282                 :            :     }
    2283         [ #  # ]:          0 :     else if( eSubmitEncoding == FormSubmitEncoding_MULTIPART )
    2284                 :            :     {
    2285                 :          0 :         URL aURL;
    2286                 :          0 :         aURL.Complete = aURLStr;
    2287 [ #  # ][ #  # ]:          0 :         xTransformer->parseStrict(aURL);
    2288                 :            : 
    2289 [ #  # ][ #  # ]:          0 :         Reference< XDispatch >  xDisp = Reference< XDispatchProvider > (xFrame,UNO_QUERY)->queryDispatch(aURL, aTargetName,
    2290                 :            :                 FrameSearchFlag::SELF | FrameSearchFlag::PARENT | FrameSearchFlag::CHILDREN |
    2291         [ #  # ]:          0 :                 FrameSearchFlag::SIBLINGS | FrameSearchFlag::CREATE | FrameSearchFlag::TASKS);
    2292                 :            : 
    2293         [ #  # ]:          0 :         if (xDisp.is())
    2294                 :            :         {
    2295                 :          0 :             ::rtl::OUString aContentType;
    2296         [ #  # ]:          0 :             Sequence<sal_Int8> aData;
    2297                 :            :             {
    2298         [ #  # ]:          0 :                 SolarMutexGuard aGuard;
    2299 [ #  # ][ #  # ]:          0 :                 aData = GetDataMultiPartEncoded(Control, MouseEvt, aContentType);
         [ #  # ][ #  # ]
    2300                 :            :             }
    2301         [ #  # ]:          0 :             if (!aData.getLength())
    2302                 :            :                 return;
    2303                 :            : 
    2304         [ #  # ]:          0 :             Sequence<PropertyValue> aArgs(3);
    2305 [ #  # ][ #  # ]:          0 :             aArgs.getArray()[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer") );
    2306 [ #  # ][ #  # ]:          0 :             aArgs.getArray()[0].Value <<= aReferer;
    2307 [ #  # ][ #  # ]:          0 :             aArgs.getArray()[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ContentType") );
    2308 [ #  # ][ #  # ]:          0 :             aArgs.getArray()[1].Value <<= aContentType;
    2309                 :            : 
    2310                 :            :             // build a sequence from the to-be-submitted string
    2311 [ #  # ][ #  # ]:          0 :             Reference< XInputStream > xPostData = new SequenceInputStream(aData);
                 [ #  # ]
    2312                 :            : 
    2313 [ #  # ][ #  # ]:          0 :             aArgs.getArray()[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PostData") );
    2314 [ #  # ][ #  # ]:          0 :             aArgs.getArray()[2].Value <<= xPostData;
    2315                 :            : 
    2316 [ #  # ][ #  # ]:          0 :             xDisp->dispatch(aURL, aArgs);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2317 [ #  # ][ #  # ]:          0 :         }
    2318                 :            :     }
    2319         [ #  # ]:          0 :     else if( eSubmitEncoding == FormSubmitEncoding_TEXT )
    2320                 :            :     {
    2321                 :          0 :         ::rtl::OUString aData;
    2322                 :            :         {
    2323         [ #  # ]:          0 :             SolarMutexGuard aGuard;
    2324 [ #  # ][ #  # ]:          0 :             aData = GetDataTextEncoded( Reference<XControl> (), MouseEvt );
    2325                 :            :         }
    2326                 :            : 
    2327 [ #  # ][ #  # ]:          0 :         lcl_dispatch(xFrame,xTransformer,aURLStr,aReferer,aTargetName,aData,osl_getThreadTextEncoding());
    2328                 :            :     }
    2329                 :            :     else {
    2330                 :            :         OSL_FAIL("ODatabaseForm::submit_Impl : wrong encoding !");
    2331 [ #  # ][ #  # ]:          0 :     }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2332                 :            : 
    2333                 :            : }
    2334                 :            : 
    2335                 :            : // XSubmit
    2336                 :            : //------------------------------------------------------------------------------
    2337                 :          0 : void SAL_CALL ODatabaseForm::addSubmitListener(const Reference<XSubmitListener>& _rListener) throw( RuntimeException )
    2338                 :            : {
    2339                 :          0 :     m_aSubmitListeners.addInterface(_rListener);
    2340                 :          0 : }
    2341                 :            : 
    2342                 :            : //------------------------------------------------------------------------------
    2343                 :          0 : void SAL_CALL ODatabaseForm::removeSubmitListener(const Reference<XSubmitListener>& _rListener) throw( RuntimeException )
    2344                 :            : {
    2345                 :          0 :     m_aSubmitListeners.removeInterface(_rListener);
    2346                 :          0 : }
    2347                 :            : 
    2348                 :            : //==============================================================================
    2349                 :            : // com::sun::star::sdbc::XSQLErrorBroadcaster
    2350                 :            : //------------------------------------------------------------------------------
    2351                 :         22 : void SAL_CALL ODatabaseForm::addSQLErrorListener(const Reference<XSQLErrorListener>& _rListener) throw( RuntimeException )
    2352                 :            : {
    2353                 :         22 :     m_aErrorListeners.addInterface(_rListener);
    2354                 :         22 : }
    2355                 :            : 
    2356                 :            : //------------------------------------------------------------------------------
    2357                 :         19 : void SAL_CALL ODatabaseForm::removeSQLErrorListener(const Reference<XSQLErrorListener>& _rListener) throw( RuntimeException )
    2358                 :            : {
    2359                 :         19 :     m_aErrorListeners.removeInterface(_rListener);
    2360                 :         19 : }
    2361                 :            : 
    2362                 :            : //------------------------------------------------------------------------------
    2363                 :        417 : void ODatabaseForm::invlidateParameters()
    2364                 :            : {
    2365         [ +  - ]:        417 :     ::osl::MutexGuard aGuard(m_aMutex);
    2366 [ +  - ][ +  - ]:        417 :     m_aParameterManager.clearAllParameterInformation();
    2367                 :        417 : }
    2368                 :            : 
    2369                 :            : //==============================================================================
    2370                 :            : // OChangeListener
    2371                 :            : //------------------------------------------------------------------------------
    2372                 :        439 : void ODatabaseForm::_propertyChanged(const PropertyChangeEvent& evt) throw( RuntimeException )
    2373                 :            : {
    2374 [ +  + ][ +  + ]:        439 :     if ((evt.PropertyName.equalsAsciiL(PROPERTY_ACTIVE_CONNECTION.ascii, PROPERTY_ACTIVE_CONNECTION.length)) && !m_bForwardingConnection)
                 [ +  + ]
    2375                 :            :     {
    2376                 :            :         // the rowset changed its active connection itself (without interaction from our side), so
    2377                 :            :         // we need to fire this event, too
    2378                 :         24 :         sal_Int32 nHandle = PROPERTY_ID_ACTIVE_CONNECTION;
    2379         [ +  - ]:         24 :         fire(&nHandle, &evt.NewValue, &evt.OldValue, 1, sal_False);
    2380                 :            :     }
    2381                 :            :     else    // it was one of the statement relevant props
    2382                 :            :     {
    2383                 :            :         // if the statement has changed we have to delete the parameter info
    2384                 :        415 :         invlidateParameters();
    2385                 :            :     }
    2386                 :        439 : }
    2387                 :            : 
    2388                 :            : //==============================================================================
    2389                 :            : // smartXChild
    2390                 :            : //------------------------------------------------------------------------------
    2391                 :        275 : void SAL_CALL ODatabaseForm::setParent(const InterfaceRef& Parent) throw ( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException)
    2392                 :            : {
    2393                 :            :     // SYNCHRONIZED ----->
    2394         [ +  - ]:        275 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
    2395                 :            : 
    2396 [ +  - ][ +  - ]:        275 :     Reference<XForm>  xParentForm(getParent(), UNO_QUERY);
    2397         [ -  + ]:        275 :     if (xParentForm.is())
    2398                 :            :     {
    2399                 :            :         try
    2400                 :            :         {
    2401         [ #  # ]:          0 :             Reference< XRowSetApproveBroadcaster > xParentApprBroadcast( xParentForm, UNO_QUERY_THROW );
    2402 [ #  # ][ #  # ]:          0 :             xParentApprBroadcast->removeRowSetApproveListener( this );
                 [ #  # ]
    2403                 :            : 
    2404         [ #  # ]:          0 :             Reference< XLoadable > xParentLoadable( xParentForm, UNO_QUERY_THROW );
    2405 [ #  # ][ #  # ]:          0 :             xParentLoadable->removeLoadListener( this );
                 [ #  # ]
    2406                 :            : 
    2407         [ #  # ]:          0 :             Reference< XPropertySet > xParentProperties( xParentForm, UNO_QUERY_THROW );
    2408 [ #  # ][ #  # ]:          0 :             xParentProperties->removePropertyChangeListener( PROPERTY_ISNEW, this );
         [ #  # ][ #  # ]
                 [ #  # ]
    2409                 :            :         }
    2410         [ #  # ]:          0 :         catch(const Exception&)
    2411                 :            :         {
    2412                 :            :             DBG_UNHANDLED_EXCEPTION();
    2413                 :            :         }
    2414                 :            :     }
    2415                 :            : 
    2416         [ +  - ]:        275 :     OFormComponents::setParent(Parent);
    2417                 :            : 
    2418 [ +  - ][ +  - ]:        275 :     xParentForm.set(getParent(), UNO_QUERY);
    2419         [ -  + ]:        275 :     if ( xParentForm.is() )
    2420                 :            :     {
    2421                 :            :         try
    2422                 :            :         {
    2423         [ #  # ]:          0 :             Reference< XRowSetApproveBroadcaster > xParentApprBroadcast( xParentForm, UNO_QUERY_THROW );
    2424 [ #  # ][ #  # ]:          0 :             xParentApprBroadcast->addRowSetApproveListener( this );
                 [ #  # ]
    2425                 :            : 
    2426         [ #  # ]:          0 :             Reference< XLoadable > xParentLoadable( xParentForm, UNO_QUERY_THROW );
    2427 [ #  # ][ #  # ]:          0 :             xParentLoadable->addLoadListener( this );
                 [ #  # ]
    2428                 :            : 
    2429         [ #  # ]:          0 :             Reference< XPropertySet > xParentProperties( xParentForm, UNO_QUERY_THROW );
    2430 [ #  # ][ #  # ]:          0 :             xParentProperties->addPropertyChangeListener( PROPERTY_ISNEW, this );
         [ #  # ][ #  # ]
                 [ #  # ]
    2431                 :            :         }
    2432         [ #  # ]:          0 :         catch(const Exception&)
    2433                 :            :         {
    2434                 :            :             DBG_UNHANDLED_EXCEPTION();
    2435                 :            :         }
    2436                 :            :     }
    2437                 :            : 
    2438                 :        275 :     Reference< XPropertySet > xAggregateProperties( m_xAggregateSet );
    2439         [ +  - ]:        275 :     aGuard.clear();
    2440                 :            :     // <----- SYNCHRONIZED
    2441                 :            : 
    2442                 :        275 :     Reference< XConnection > xOuterConnection;
    2443         [ +  - ]:        275 :     sal_Bool bIsEmbedded = ::dbtools::isEmbeddedInDatabase( Parent, xOuterConnection );
    2444                 :            : 
    2445         [ -  + ]:        275 :     if ( bIsEmbedded )
    2446 [ #  # ][ #  # ]:        275 :         xAggregateProperties->setPropertyValue( PROPERTY_DATASOURCE, makeAny( ::rtl::OUString() ) );
         [ #  # ][ #  # ]
                 [ +  - ]
    2447                 :        275 : }
    2448                 :            : 
    2449                 :            : //==============================================================================
    2450                 :            : // smartXTabControllerModel
    2451                 :            : //------------------------------------------------------------------------------
    2452                 :         40 : sal_Bool SAL_CALL ODatabaseForm::getGroupControl() throw(com::sun::star::uno::RuntimeException)
    2453                 :            : {
    2454         [ +  - ]:         40 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
    2455                 :            : 
    2456                 :            :     // Should controls be combined into a TabOrder group?
    2457         [ -  + ]:         40 :     if (m_aCycle.hasValue())
    2458                 :            :     {
    2459                 :          0 :         sal_Int32 nCycle = 0;
    2460                 :          0 :         ::cppu::enum2int(nCycle, m_aCycle);
    2461                 :          0 :         return nCycle != TabulatorCycle_PAGE;
    2462                 :            :     }
    2463                 :            : 
    2464 [ +  - ][ -  + ]:         40 :     if (isLoaded() && getConnection().is())
         [ #  # ][ #  # ]
                 [ -  + ]
           [ -  +  #  # ]
    2465                 :          0 :         return sal_True;
    2466                 :            : 
    2467         [ +  - ]:         40 :     return sal_False;
    2468                 :            : }
    2469                 :            : 
    2470                 :            : //------------------------------------------------------------------------------
    2471                 :          2 : void SAL_CALL ODatabaseForm::setControlModels(const Sequence<Reference<XControlModel> >& rControls) throw( RuntimeException )
    2472                 :            : {
    2473         [ +  - ]:          2 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
    2474                 :            : 
    2475                 :            :     // Set TabIndex in the order of the sequence
    2476                 :          2 :     const Reference<XControlModel>* pControls = rControls.getConstArray();
    2477         [ +  - ]:          2 :     sal_Int32 nCount = getCount();
    2478                 :          2 :     sal_Int32 nNewCount = rControls.getLength();
    2479                 :            : 
    2480                 :            :     // HiddenControls and forms are not listed
    2481         [ +  - ]:          2 :     if (nNewCount <= nCount)
    2482                 :            :     {
    2483                 :          2 :         Any aElement;
    2484                 :          2 :         sal_Int16 nTabIndex = 1;
    2485         [ +  + ]:          4 :         for (sal_Int32 i=0; i < nNewCount; ++i, ++pControls)
    2486                 :            :         {
    2487         [ +  - ]:          2 :             Reference<XFormComponent>  xComp(*pControls, UNO_QUERY);
    2488         [ +  - ]:          2 :             if (xComp.is())
    2489                 :            :             {
    2490                 :            :                 // Find component in the list
    2491         [ +  - ]:          4 :                 for (sal_Int32 j = 0; j < nCount; ++j)
    2492                 :            :                 {
    2493                 :          2 :                     Reference<XFormComponent> xElement;
    2494 [ +  - ][ +  - ]:          2 :                     ::cppu::extractInterface(xElement, getByIndex(j));
    2495 [ +  - ][ +  - ]:          2 :                     if (xComp == xElement)
    2496                 :            :                     {
    2497         [ +  - ]:          2 :                         Reference<XPropertySet>  xSet(xComp, UNO_QUERY);
    2498 [ +  - ][ +  - ]:          2 :                         if (xSet.is() && hasProperty(PROPERTY_TABINDEX, xSet))
         [ +  - ][ +  - ]
                 [ +  - ]
           [ +  -  #  # ]
    2499 [ +  - ][ +  - ]:          2 :                             xSet->setPropertyValue( PROPERTY_TABINDEX, makeAny(nTabIndex++) );
         [ +  - ][ +  - ]
    2500                 :          2 :                         break;
    2501                 :            :                     }
    2502         [ -  + ]:          2 :                 }
    2503                 :            :             }
    2504                 :          4 :         }
    2505         [ +  - ]:          2 :     }
    2506                 :          2 : }
    2507                 :            : 
    2508                 :            : //------------------------------------------------------------------------------
    2509                 :         81 : Sequence<Reference<XControlModel> > SAL_CALL ODatabaseForm::getControlModels() throw( RuntimeException )
    2510                 :            : {
    2511         [ +  - ]:         81 :     ::osl::MutexGuard aGuard(m_aMutex);
    2512 [ +  - ][ +  - ]:         81 :     return m_pGroupManager->getControlModels();
    2513                 :            : }
    2514                 :            : 
    2515                 :            : //------------------------------------------------------------------------------
    2516                 :          0 : void SAL_CALL ODatabaseForm::setGroup( const Sequence<Reference<XControlModel> >& _rGroup, const ::rtl::OUString& Name ) throw( RuntimeException )
    2517                 :            : {
    2518         [ #  # ]:          0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2519                 :            : 
    2520                 :            :     // The controls are grouped by adjusting their names to the name of the
    2521                 :            :     // first control of the sequence
    2522                 :          0 :     const Reference<XControlModel>* pControls = _rGroup.getConstArray();
    2523                 :          0 :     Reference< XPropertySet > xSet;
    2524                 :          0 :     ::rtl::OUString sGroupName( Name );
    2525                 :            : 
    2526         [ #  # ]:          0 :     for( sal_Int32 i=0; i<_rGroup.getLength(); ++i, ++pControls )
    2527                 :            :     {
    2528 [ #  # ][ #  # ]:          0 :         xSet = xSet.query( *pControls );
    2529         [ #  # ]:          0 :         if ( !xSet.is() )
    2530                 :            :         {
    2531                 :            :             // can't throw an exception other than a RuntimeException (which would not be appropriate),
    2532                 :            :             // so we ignore (and only assert) this
    2533                 :            :             OSL_FAIL( "ODatabaseForm::setGroup: invalid arguments!" );
    2534                 :          0 :             continue;
    2535                 :            :         }
    2536                 :            : 
    2537         [ #  # ]:          0 :         if (sGroupName.isEmpty())
    2538 [ #  # ][ #  # ]:          0 :             xSet->getPropertyValue(PROPERTY_NAME) >>= sGroupName;
                 [ #  # ]
    2539                 :            :         else
    2540 [ #  # ][ #  # ]:          0 :             xSet->setPropertyValue(PROPERTY_NAME, makeAny(sGroupName));
         [ #  # ][ #  # ]
    2541         [ #  # ]:          0 :     }
    2542                 :          0 : }
    2543                 :            : 
    2544                 :            : //------------------------------------------------------------------------------
    2545                 :         40 : sal_Int32 SAL_CALL ODatabaseForm::getGroupCount() throw( RuntimeException )
    2546                 :            : {
    2547         [ +  - ]:         40 :     ::osl::MutexGuard aGuard(m_aMutex);
    2548 [ +  - ][ +  - ]:         40 :     return m_pGroupManager->getGroupCount();
    2549                 :            : }
    2550                 :            : 
    2551                 :            : //------------------------------------------------------------------------------
    2552                 :          6 : void SAL_CALL ODatabaseForm::getGroup( sal_Int32 nGroup, Sequence<Reference<XControlModel> >& _rGroup, ::rtl::OUString& _rName ) throw( RuntimeException )
    2553                 :            : {
    2554         [ +  - ]:          6 :     ::osl::MutexGuard aGuard(m_aMutex);
    2555         [ +  - ]:          6 :     _rGroup.realloc(0);
    2556                 :          6 :     _rName = ::rtl::OUString();
    2557                 :            : 
    2558 [ +  - ][ -  + ]:          6 :     if ((nGroup < 0) || (nGroup >= m_pGroupManager->getGroupCount()))
         [ -  + ][ +  - ]
    2559                 :          6 :         return;
    2560 [ +  - ][ +  - ]:          6 :     m_pGroupManager->getGroup( nGroup, _rGroup, _rName  );
                 [ +  - ]
    2561                 :            : }
    2562                 :            : 
    2563                 :            : //------------------------------------------------------------------------------
    2564                 :          0 : void SAL_CALL ODatabaseForm::getGroupByName(const ::rtl::OUString& Name, Sequence< Reference<XControlModel>  >& _rGroup) throw( RuntimeException )
    2565                 :            : {
    2566         [ #  # ]:          0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2567         [ #  # ]:          0 :     _rGroup.realloc(0);
    2568 [ #  # ][ #  # ]:          0 :     m_pGroupManager->getGroupByName( Name, _rGroup );
    2569                 :          0 : }
    2570                 :            : 
    2571                 :            : //==============================================================================
    2572                 :            : // com::sun::star::lang::XEventListener
    2573                 :            : //------------------------------------------------------------------------------
    2574                 :         68 : void SAL_CALL ODatabaseForm::disposing(const EventObject& Source) throw( RuntimeException )
    2575                 :            : {
    2576                 :            :     // does the call come from the connection which we are sharing with our parent?
    2577         [ -  + ]:         68 :     if ( isSharingConnection() )
    2578                 :            :     {
    2579         [ #  # ]:          0 :         Reference< XConnection > xConnSource( Source.Source, UNO_QUERY );
    2580         [ #  # ]:          0 :         if ( xConnSource.is() )
    2581                 :            :         {
    2582                 :            : #if OSL_DEBUG_LEVEL > 0
    2583                 :            :             Reference< XConnection > xActiveConn;
    2584                 :            :             m_xAggregateSet->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xActiveConn;
    2585                 :            :             OSL_ENSURE( xActiveConn.get() == xConnSource.get(), "ODatabaseForm::disposing: where did this come from?" );
    2586                 :            :                 // there should be exactly one XConnection object we're listening at - our aggregate connection
    2587                 :            : #endif
    2588         [ #  # ]:          0 :             disposingSharedConnection( xConnSource );
    2589                 :          0 :         }
    2590                 :            :     }
    2591                 :            : 
    2592                 :         68 :     OInterfaceContainer::disposing(Source);
    2593                 :            : 
    2594                 :            :     // does the disposing come from the aggregate ?
    2595         [ +  - ]:         68 :     if (m_xAggregate.is())
    2596                 :            :     {   // no -> forward it
    2597                 :         68 :         com::sun::star::uno::Reference<com::sun::star::lang::XEventListener> xListener;
    2598 [ +  - ][ +  - ]:         68 :         if (query_aggregation(m_xAggregate, xListener))
    2599 [ +  - ][ +  - ]:         68 :             xListener->disposing(Source);
    2600                 :            :     }
    2601                 :         68 : }
    2602                 :            : 
    2603                 :            : //------------------------------------------------------------------------------
    2604                 :          0 : void ODatabaseForm::impl_createLoadTimer()
    2605                 :            : {
    2606                 :            :     OSL_PRECOND( m_pLoadTimer == NULL, "ODatabaseForm::impl_createLoadTimer: timer already exists!" );
    2607         [ #  # ]:          0 :     m_pLoadTimer = new Timer();
    2608                 :          0 :     m_pLoadTimer->SetTimeout(100);
    2609                 :          0 :     m_pLoadTimer->SetTimeoutHdl(LINK(this,ODatabaseForm,OnTimeout));
    2610                 :          0 : }
    2611                 :            : 
    2612                 :            : //==============================================================================
    2613                 :            : // com::sun::star::form::XLoadListener
    2614                 :            : //------------------------------------------------------------------------------
    2615                 :          0 : void SAL_CALL ODatabaseForm::loaded(const EventObject& /*aEvent*/) throw( RuntimeException )
    2616                 :            : {
    2617                 :            :     {
    2618         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( m_aMutex );
    2619         [ #  # ]:          0 :         Reference< XRowSet > xParentRowSet( m_xParent, UNO_QUERY_THROW );
    2620 [ #  # ][ #  # ]:          0 :         xParentRowSet->addRowSetListener( this );
                 [ #  # ]
    2621                 :            : 
    2622 [ #  # ][ #  # ]:          0 :         impl_createLoadTimer();
    2623                 :            :     }
    2624                 :            : 
    2625         [ #  # ]:          0 :     load_impl( sal_True );
    2626                 :          0 : }
    2627                 :            : 
    2628                 :            : //------------------------------------------------------------------------------
    2629                 :          0 : void SAL_CALL ODatabaseForm::unloading(const EventObject& /*aEvent*/) throw( RuntimeException )
    2630                 :            : {
    2631                 :            :     {
    2632                 :            :         // now stop the rowset listening if we are a subform
    2633         [ #  # ]:          0 :         ::osl::MutexGuard aGuard( m_aMutex );
    2634                 :            : 
    2635 [ #  # ][ #  # ]:          0 :         if ( m_pLoadTimer && m_pLoadTimer->IsActive() )
                 [ #  # ]
    2636         [ #  # ]:          0 :             m_pLoadTimer->Stop();
    2637 [ #  # ][ #  # ]:          0 :         DELETEZ( m_pLoadTimer );
    2638                 :            : 
    2639         [ #  # ]:          0 :         Reference< XRowSet > xParentRowSet( m_xParent, UNO_QUERY_THROW );
    2640 [ #  # ][ #  # ]:          0 :         xParentRowSet->removeRowSetListener( this );
         [ #  # ][ #  # ]
    2641                 :            :     }
    2642                 :            : 
    2643                 :          0 :     unload();
    2644                 :          0 : }
    2645                 :            : 
    2646                 :            : //------------------------------------------------------------------------------
    2647                 :          0 : void SAL_CALL ODatabaseForm::unloaded(const EventObject& /*aEvent*/) throw( RuntimeException )
    2648                 :            : {
    2649                 :            :     // nothing to do
    2650                 :          0 : }
    2651                 :            : 
    2652                 :            : //------------------------------------------------------------------------------
    2653                 :          0 : void SAL_CALL ODatabaseForm::reloading(const EventObject& /*aEvent*/) throw( RuntimeException )
    2654                 :            : {
    2655                 :            :     // now stop the rowset listening if we are a subform
    2656         [ #  # ]:          0 :     ::osl::MutexGuard aGuard(m_aMutex);
    2657         [ #  # ]:          0 :     Reference<XRowSet>  xParentRowSet(m_xParent, UNO_QUERY);
    2658         [ #  # ]:          0 :     if (xParentRowSet.is())
    2659 [ #  # ][ #  # ]:          0 :         xParentRowSet->removeRowSetListener(this);
                 [ #  # ]
    2660                 :            : 
    2661 [ #  # ][ #  # ]:          0 :     if (m_pLoadTimer && m_pLoadTimer->IsActive())
                 [ #  # ]
    2662 [ #  # ][ #  # ]:          0 :         m_pLoadTimer->Stop();
    2663                 :          0 : }
    2664                 :            : 
    2665                 :            : //------------------------------------------------------------------------------
    2666                 :          0 : void SAL_CALL ODatabaseForm::reloaded(const EventObject& /*aEvent*/) throw( RuntimeException )
    2667                 :            : {
    2668         [ #  # ]:          0 :     reload_impl(sal_True);
    2669                 :            :     {
    2670         [ #  # ]:          0 :         ::osl::MutexGuard aGuard(m_aMutex);
    2671         [ #  # ]:          0 :         Reference<XRowSet>  xParentRowSet(m_xParent, UNO_QUERY);
    2672         [ #  # ]:          0 :         if (xParentRowSet.is())
    2673 [ #  # ][ #  # ]:          0 :             xParentRowSet->addRowSetListener(this);
         [ #  # ][ #  # ]
    2674                 :            :     }
    2675                 :          0 : }
    2676                 :            : 
    2677                 :            : //------------------------------------------------------------------------------
    2678                 :          0 : IMPL_LINK_NOARG(ODatabaseForm, OnTimeout)
    2679                 :            : {
    2680         [ #  # ]:          0 :     reload_impl(sal_True);
    2681                 :          0 :     return 1;
    2682                 :            : }
    2683                 :            : 
    2684                 :            : //==============================================================================
    2685                 :            : // com::sun::star::form::XLoadable
    2686                 :            : //------------------------------------------------------------------------------
    2687                 :         26 : void SAL_CALL ODatabaseForm::load() throw( RuntimeException )
    2688                 :            : {
    2689         [ +  - ]:         26 :     load_impl(sal_False);
    2690                 :         26 : }
    2691                 :            : 
    2692                 :            : //------------------------------------------------------------------------------
    2693                 :          0 : sal_Bool ODatabaseForm::canShareConnection( const Reference< XPropertySet >& _rxParentProps )
    2694                 :            : {
    2695                 :            :     // our own data source
    2696                 :          0 :     ::rtl::OUString sOwnDatasource;
    2697 [ #  # ][ #  # ]:          0 :     m_xAggregateSet->getPropertyValue( PROPERTY_DATASOURCE ) >>= sOwnDatasource;
                 [ #  # ]
    2698                 :            : 
    2699                 :            :     // our parents data source
    2700                 :          0 :     ::rtl::OUString sParentDataSource;
    2701                 :            :     OSL_ENSURE( _rxParentProps.is() && _rxParentProps->getPropertySetInfo().is() && _rxParentProps->getPropertySetInfo()->hasPropertyByName( PROPERTY_DATASOURCE ),
    2702                 :            :         "ODatabaseForm::doShareConnection: invalid parent form!" );
    2703         [ #  # ]:          0 :     if ( _rxParentProps.is() )
    2704 [ #  # ][ #  # ]:          0 :         _rxParentProps->getPropertyValue( PROPERTY_DATASOURCE ) >>= sParentDataSource;
                 [ #  # ]
    2705                 :            : 
    2706                 :          0 :     sal_Bool bCanShareConnection = sal_False;
    2707                 :            : 
    2708                 :            :     // both rowsets share are connected to the same data source
    2709         [ #  # ]:          0 :     if ( sParentDataSource == sOwnDatasource )
    2710                 :            :     {
    2711         [ #  # ]:          0 :         if ( !sParentDataSource.isEmpty() )
    2712                 :            :             // and it's really a data source name (not empty)
    2713                 :          0 :             bCanShareConnection = sal_True;
    2714                 :            :         else
    2715                 :            :         {   // the data source name is empty
    2716                 :            :             // -> ook for the URL
    2717                 :          0 :             ::rtl::OUString sParentURL;
    2718                 :          0 :             ::rtl::OUString sMyURL;
    2719 [ #  # ][ #  # ]:          0 :             _rxParentProps->getPropertyValue( PROPERTY_URL ) >>= sParentURL;
                 [ #  # ]
    2720 [ #  # ][ #  # ]:          0 :             m_xAggregateSet->getPropertyValue( PROPERTY_URL ) >>= sMyURL;
                 [ #  # ]
    2721                 :            : 
    2722                 :          0 :             bCanShareConnection = (sParentURL == sMyURL);
    2723                 :            :         }
    2724                 :            :     }
    2725                 :            : 
    2726         [ #  # ]:          0 :     if ( bCanShareConnection )
    2727                 :            :     {
    2728                 :            :         // check for the user/password
    2729                 :            : 
    2730                 :            :         // take the user property on the rowset (if any) into account
    2731                 :          0 :         ::rtl::OUString sParentUser, sParentPwd;
    2732 [ #  # ][ #  # ]:          0 :         _rxParentProps->getPropertyValue( PROPERTY_USER ) >>= sParentUser;
                 [ #  # ]
    2733 [ #  # ][ #  # ]:          0 :         _rxParentProps->getPropertyValue( PROPERTY_PASSWORD ) >>= sParentPwd;
                 [ #  # ]
    2734                 :            : 
    2735                 :          0 :         ::rtl::OUString sMyUser, sMyPwd;
    2736 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->getPropertyValue( PROPERTY_USER ) >>= sMyUser;
                 [ #  # ]
    2737 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->getPropertyValue( PROPERTY_PASSWORD ) >>= sMyPwd;
                 [ #  # ]
    2738                 :            : 
    2739                 :            :         bCanShareConnection =
    2740                 :          0 :                 ( sParentUser == sMyUser )
    2741 [ #  # ][ #  # ]:          0 :             &&  ( sParentPwd == sMyPwd );
    2742                 :            :     }
    2743                 :            : 
    2744                 :          0 :     return bCanShareConnection;
    2745                 :            : }
    2746                 :            : 
    2747                 :            : //------------------------------------------------------------------------------
    2748                 :          0 : void ODatabaseForm::doShareConnection( const Reference< XPropertySet >& _rxParentProps )
    2749                 :            : {
    2750                 :            :     // get the conneciton of the parent
    2751                 :          0 :     Reference< XConnection > xParentConn;
    2752 [ #  # ][ #  # ]:          0 :     _rxParentProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xParentConn;
         [ #  # ][ #  # ]
    2753                 :            :     OSL_ENSURE( xParentConn.is(), "ODatabaseForm::doShareConnection: we're a valid sub-form, but the parent has no connection?!" );
    2754                 :            : 
    2755         [ #  # ]:          0 :     if ( xParentConn.is() )
    2756                 :            :     {
    2757                 :            :         // add as dispose listener to the connection
    2758         [ #  # ]:          0 :         Reference< XComponent > xParentConnComp( xParentConn, UNO_QUERY );
    2759                 :            :         OSL_ENSURE( xParentConnComp.is(), "ODatabaseForm::doShareConnection: invalid connection!" );
    2760 [ #  # ][ #  # ]:          0 :         xParentConnComp->addEventListener( static_cast< XLoadListener* >( this ) );
                 [ #  # ]
    2761                 :            : 
    2762                 :            :         // forward the connection to our own aggreagte
    2763                 :          0 :         m_bForwardingConnection = sal_True;
    2764 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( xParentConn ) );
         [ #  # ][ #  # ]
    2765                 :          0 :         m_bForwardingConnection = sal_False;
    2766                 :            : 
    2767                 :          0 :         m_bSharingConnection = sal_True;
    2768                 :            :     }
    2769                 :            :     else
    2770                 :          0 :         m_bSharingConnection = sal_False;
    2771                 :          0 : }
    2772                 :            : 
    2773                 :            : //------------------------------------------------------------------------------
    2774                 :          0 : void ODatabaseForm::disposingSharedConnection( const Reference< XConnection >& /*_rxConn*/ )
    2775                 :            : {
    2776                 :          0 :     stopSharingConnection();
    2777                 :            : 
    2778                 :            :     // TODO: we could think about whether or not to re-connect.
    2779                 :          0 :     unload( );
    2780                 :          0 : }
    2781                 :            : 
    2782                 :            : //------------------------------------------------------------------------------
    2783                 :          0 : void ODatabaseForm::stopSharingConnection( )
    2784                 :            : {
    2785                 :            :     OSL_ENSURE( m_bSharingConnection, "ODatabaseForm::stopSharingConnection: invalid call!" );
    2786                 :            : 
    2787         [ #  # ]:          0 :     if ( m_bSharingConnection )
    2788                 :            :     {
    2789                 :            :         // get the connection
    2790                 :          0 :         Reference< XConnection > xSharedConn;
    2791 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xSharedConn;
         [ #  # ][ #  # ]
    2792                 :            :         OSL_ENSURE( xSharedConn.is(), "ODatabaseForm::stopSharingConnection: there's no conn!" );
    2793                 :            : 
    2794                 :            :         // remove ourself as event listener
    2795         [ #  # ]:          0 :         Reference< XComponent > xSharedConnComp( xSharedConn, UNO_QUERY );
    2796         [ #  # ]:          0 :         if ( xSharedConnComp.is() )
    2797 [ #  # ][ #  # ]:          0 :             xSharedConnComp->removeEventListener( static_cast< XLoadListener* >( this ) );
                 [ #  # ]
    2798                 :            : 
    2799                 :            :         // no need to dispose the conn: we're not the owner, this is our parent
    2800                 :            :         // (in addition, this method may be called if the connection is beeing disposed while we use it)
    2801                 :            : 
    2802                 :            :         // reset the property
    2803                 :          0 :         xSharedConn.clear();
    2804                 :          0 :         m_bForwardingConnection = sal_True;
    2805 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( xSharedConn ) );
         [ #  # ][ #  # ]
    2806                 :          0 :         m_bForwardingConnection = sal_False;
    2807                 :            : 
    2808                 :            :         // reset the flag
    2809                 :          0 :         m_bSharingConnection = sal_False;
    2810                 :            :     }
    2811                 :          0 : }
    2812                 :            : 
    2813                 :            : //------------------------------------------------------------------------------
    2814                 :         50 : sal_Bool ODatabaseForm::implEnsureConnection()
    2815                 :            : {
    2816                 :            :     try
    2817                 :            :     {
    2818 [ +  - ][ +  + ]:         50 :         if ( getConnection( ).is() )
    2819                 :            :             // if our aggregate already has a connection, nothing needs to be done about it
    2820                 :         26 :             return sal_True;
    2821                 :            : 
    2822                 :            :         // see whether we're an embedded form
    2823                 :         24 :         Reference< XConnection > xOuterConnection;
    2824 [ +  - ][ -  + ]:         24 :         if ( ::dbtools::isEmbeddedInDatabase( getParent(), xOuterConnection ) )
                 [ +  - ]
    2825                 :            :         {
    2826 [ #  # ][ #  # ]:          0 :             m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( xOuterConnection ) );
         [ #  # ][ #  # ]
    2827                 :          0 :             return xOuterConnection.is();
    2828                 :            :         }
    2829                 :            : 
    2830                 :         24 :         m_bSharingConnection = sal_False;
    2831                 :            : 
    2832                 :            :         // if we're a sub form, we try to re-use the connection of our parent
    2833         [ -  + ]:         24 :         if (m_bSubForm)
    2834                 :            :         {
    2835                 :            :             OSL_ENSURE( Reference< XForm >( getParent(), UNO_QUERY ).is(),
    2836                 :            :                 "ODatabaseForm::implEnsureConnection: m_bSubForm is TRUE, but the parent is no form?" );
    2837                 :            : 
    2838 [ #  # ][ #  # ]:          0 :             Reference< XPropertySet > xParentProps( getParent(), UNO_QUERY );
    2839                 :            : 
    2840                 :            :             // can we re-use (aka share) the connection of the parent?
    2841 [ #  # ][ #  # ]:          0 :             if ( canShareConnection( xParentProps ) )
    2842                 :            :             {
    2843                 :            :                 // yep -> do it
    2844         [ #  # ]:          0 :                 doShareConnection( xParentProps );
    2845                 :            :                 // success?
    2846         [ #  # ]:          0 :                 if ( m_bSharingConnection )
    2847                 :            :                     // yes -> outta here
    2848                 :          0 :                     return sal_True;
    2849         [ #  # ]:          0 :             }
    2850                 :            :         }
    2851                 :            : 
    2852         [ +  - ]:         24 :         if (m_xAggregateSet.is())
    2853                 :            :         {
    2854                 :            :             Reference< XConnection >  xConnection = connectRowset(
    2855                 :            :                 Reference<XRowSet> (m_xAggregate, UNO_QUERY),
    2856                 :            :                 m_xServiceFactory,
    2857                 :            :                 sal_True    // set a calculated connection as ActiveConnection
    2858 [ +  - ][ +  - ]:         24 :             );
    2859                 :         24 :             return xConnection.is();
    2860         [ -  + ]:         50 :         }
    2861                 :            :     }
    2862      [ #  #  # ]:          0 :     catch(const SQLException& eDB)
    2863                 :            :     {
    2864   [ #  #  #  # ]:          0 :         onError(eDB, FRM_RES_STRING(RID_STR_CONNECTERROR));
    2865                 :            :     }
    2866                 :          0 :     catch(const Exception&)
    2867                 :            :     {
    2868                 :            :         DBG_UNHANDLED_EXCEPTION();
    2869                 :            :     }
    2870                 :            : 
    2871                 :         50 :     return sal_False;
    2872                 :            : }
    2873                 :            : 
    2874                 :            : //------------------------------------------------------------------------------
    2875                 :         26 : void ODatabaseForm::load_impl(sal_Bool bCausedByParentForm, sal_Bool bMoveToFirst, const Reference< XInteractionHandler >& _rxCompletionHandler ) throw( RuntimeException )
    2876                 :            : {
    2877         [ +  - ]:         26 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
    2878                 :            : 
    2879                 :            :     // are we already loaded?
    2880 [ +  - ][ -  + ]:         26 :     if (isLoaded())
    2881                 :         26 :         return;
    2882                 :            : 
    2883                 :         26 :     m_bSubForm = bCausedByParentForm;
    2884                 :            : 
    2885                 :            :     // if we don't have a connection, we are not intended to be a database form or the aggregate was not able
    2886                 :            :     // to establish a connection
    2887         [ +  - ]:         26 :     sal_Bool bConnected = implEnsureConnection();
    2888                 :            : 
    2889                 :            :     // we don't have to execute if we do not have a command to execute
    2890 [ +  + ][ +  - ]:         26 :     sal_Bool bExecute = bConnected && m_xAggregateSet.is() && !getString(m_xAggregateSet->getPropertyValue(PROPERTY_COMMAND)).isEmpty();
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
         [ +  + ][ +  + ]
           [ #  #  #  #  
                   #  # ]
    2891                 :            : 
    2892                 :            :     // a database form always uses caching
    2893                 :            :     // we use starting fetchsize with at least 10 rows
    2894         [ +  + ]:         26 :     if (bConnected)
    2895 [ +  - ][ +  - ]:         24 :         m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)40));
         [ +  - ][ +  - ]
    2896                 :            : 
    2897                 :            :     // if we're loaded as sub form we got a "rowSetChanged" from the parent rowset _before_ we got the "loaded"
    2898                 :            :     // so we don't need to execute the statement again, this was already done
    2899                 :            :     // (and there were no relevant changes between these two listener calls, the "load" of a form is quite an
    2900                 :            :     // atomar operation.)
    2901                 :            : 
    2902                 :         26 :     sal_Bool bSuccess = sal_False;
    2903         [ +  + ]:         26 :     if (bExecute)
    2904                 :            :     {
    2905         [ +  - ]:         24 :         m_sCurrentErrorContext = FRM_RES_STRING(RID_ERR_LOADING_FORM);
    2906         [ +  - ]:         24 :         bSuccess = executeRowSet(aGuard, bMoveToFirst, _rxCompletionHandler);
    2907                 :            :     }
    2908                 :            : 
    2909         [ +  + ]:         26 :     if (bSuccess)
    2910                 :            :     {
    2911                 :          2 :         m_bLoaded = sal_True;
    2912         [ +  - ]:          2 :         aGuard.clear();
    2913 [ +  - ][ +  - ]:          2 :         EventObject aEvt(static_cast<XWeak*>(this));
    2914         [ +  - ]:          2 :         m_aLoadListeners.notifyEach( &XLoadListener::loaded, aEvt );
    2915                 :            : 
    2916                 :            :         // if we are on the insert row, we have to reset all controls
    2917                 :            :         // to set the default values
    2918 [ +  - ][ +  - ]:          2 :         if (bExecute && getBOOL(m_xAggregateSet->getPropertyValue(PROPERTY_ISNEW)))
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
         [ +  - ][ +  - ]
           [ -  +  #  #  
                   #  # ]
    2919 [ #  # ][ +  - ]:         26 :             reset();
    2920 [ +  - ][ +  - ]:         26 :     }
    2921                 :            : }
    2922                 :            : 
    2923                 :            : //------------------------------------------------------------------------------
    2924                 :         24 : void SAL_CALL ODatabaseForm::unload() throw( RuntimeException )
    2925                 :            : {
    2926         [ +  - ]:         24 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
    2927 [ +  - ][ +  + ]:         24 :     if (!isLoaded())
    2928                 :         24 :         return;
    2929                 :            : 
    2930 [ -  + ][ #  # ]:          2 :     DELETEZ(m_pLoadTimer);
    2931                 :            : 
    2932         [ +  - ]:          2 :     aGuard.clear();
    2933 [ +  - ][ +  - ]:          2 :     EventObject aEvt(static_cast<XWeak*>(this));
    2934         [ +  - ]:          2 :     m_aLoadListeners.notifyEach( &XLoadListener::unloading, aEvt );
    2935                 :            : 
    2936         [ +  - ]:          2 :     if (m_xAggregateAsRowSet.is())
    2937                 :            :     {
    2938                 :            :         // we may have reset the InsertOnly property on the aggregate - restore it
    2939         [ +  - ]:          2 :         restoreInsertOnlyState( );
    2940                 :            : 
    2941                 :            :         // clear the parameters if there are any
    2942         [ +  - ]:          2 :         invlidateParameters();
    2943                 :            : 
    2944                 :            :         try
    2945                 :            :         {
    2946                 :            :             // close the aggregate
    2947                 :          2 :             Reference<XCloseable>  xCloseable;
    2948         [ +  - ]:          2 :             query_aggregation( m_xAggregate, xCloseable);
    2949         [ +  - ]:          2 :             aGuard.clear();
    2950         [ +  - ]:          2 :             if (xCloseable.is())
    2951 [ +  - ][ +  - ]:          2 :                 xCloseable->close();
                 [ #  # ]
    2952                 :            :         }
    2953         [ #  # ]:          0 :         catch(const SQLException&)
    2954                 :            :         {
    2955                 :            :         }
    2956         [ +  - ]:          2 :         aGuard.reset();
    2957                 :            :     }
    2958                 :            : 
    2959                 :          2 :     m_bLoaded = sal_False;
    2960                 :            : 
    2961                 :            :     // if the connection we used while we were loaded is only shared with our parent, we
    2962                 :            :     // reset it
    2963         [ -  + ]:          2 :     if ( isSharingConnection() )
    2964         [ #  # ]:          0 :         stopSharingConnection();
    2965                 :            : 
    2966         [ +  - ]:          2 :     aGuard.clear();
    2967 [ +  - ][ +  - ]:         24 :     m_aLoadListeners.notifyEach( &XLoadListener::unloaded, aEvt );
         [ +  - ][ +  + ]
    2968                 :            : }
    2969                 :            : 
    2970                 :            : //------------------------------------------------------------------------------
    2971                 :          0 : void SAL_CALL ODatabaseForm::reload() throw( RuntimeException )
    2972                 :            : {
    2973         [ #  # ]:          0 :     reload_impl(sal_True);
    2974                 :          0 : }
    2975                 :            : 
    2976                 :            : //------------------------------------------------------------------------------
    2977                 :          0 : void ODatabaseForm::reload_impl(sal_Bool bMoveToFirst, const Reference< XInteractionHandler >& _rxCompletionHandler ) throw( RuntimeException )
    2978                 :            : {
    2979         [ #  # ]:          0 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
    2980 [ #  # ][ #  # ]:          0 :     if (!isLoaded())
    2981                 :          0 :         return;
    2982                 :            : 
    2983 [ #  # ][ #  # ]:          0 :     DocumentModifyGuard aModifyGuard( *this );
    2984                 :            :         // ensures the document is not marked as "modified" just because we change some control's content during
    2985                 :            :         // reloading ...
    2986                 :            : 
    2987 [ #  # ][ #  # ]:          0 :     EventObject aEvent(static_cast<XWeak*>(this));
    2988                 :            :     {
    2989                 :            :         // only if there is no approve listener we can post the event at this time
    2990                 :            :         // otherwise see approveRowsetChange
    2991                 :            :         // the aprrovement is done by the aggregate
    2992 [ #  # ][ #  # ]:          0 :         if (!m_aRowSetApproveListeners.getLength())
    2993                 :            :         {
    2994         [ #  # ]:          0 :             ::cppu::OInterfaceIteratorHelper aIter(m_aLoadListeners);
    2995         [ #  # ]:          0 :             aGuard.clear();
    2996                 :            : 
    2997         [ #  # ]:          0 :             while (aIter.hasMoreElements())
    2998 [ #  # ][ #  # ]:          0 :                 ((XLoadListener*)aIter.next())->reloading(aEvent);
    2999                 :            : 
    3000 [ #  # ][ #  # ]:          0 :             aGuard.reset();
                 [ #  # ]
    3001                 :            :         }
    3002                 :            :     }
    3003                 :            : 
    3004                 :          0 :     sal_Bool bSuccess = sal_True;
    3005                 :            :     try
    3006                 :            :     {
    3007         [ #  # ]:          0 :         m_sCurrentErrorContext = FRM_RES_STRING(RID_ERR_REFRESHING_FORM);
    3008         [ #  # ]:          0 :         bSuccess = executeRowSet(aGuard, bMoveToFirst, _rxCompletionHandler);
    3009                 :            :     }
    3010         [ #  # ]:          0 :     catch(const SQLException&)
    3011                 :            :     {
    3012                 :            :         OSL_FAIL("ODatabaseForm::reload_impl : shouldn't executeRowSet catch this exception?");
    3013                 :            :     }
    3014                 :            : 
    3015         [ #  # ]:          0 :     if (bSuccess)
    3016                 :            :     {
    3017         [ #  # ]:          0 :         ::cppu::OInterfaceIteratorHelper aIter(m_aLoadListeners);
    3018         [ #  # ]:          0 :         aGuard.clear();
    3019         [ #  # ]:          0 :         while (aIter.hasMoreElements())
    3020 [ #  # ][ #  # ]:          0 :             ((XLoadListener*)aIter.next())->reloaded(aEvent);
    3021                 :            : 
    3022                 :            :         // if we are on the insert row, we have to reset all controls
    3023                 :            :         // to set the default values
    3024 [ #  # ][ #  # ]:          0 :         if (getBOOL(m_xAggregateSet->getPropertyValue(PROPERTY_ISNEW)))
         [ #  # ][ #  # ]
                 [ #  # ]
    3025 [ #  # ][ #  # ]:          0 :             reset();
    3026                 :            :     }
    3027                 :            :     else
    3028 [ #  # ][ #  # ]:          0 :         m_bLoaded = sal_False;
         [ #  # ][ #  # ]
    3029                 :            : }
    3030                 :            : 
    3031                 :            : //------------------------------------------------------------------------------
    3032                 :        791 : sal_Bool SAL_CALL ODatabaseForm::isLoaded() throw( RuntimeException )
    3033                 :            : {
    3034                 :        791 :     return m_bLoaded;
    3035                 :            : }
    3036                 :            : 
    3037                 :            : //------------------------------------------------------------------------------
    3038                 :        426 : void SAL_CALL ODatabaseForm::addLoadListener(const Reference<XLoadListener>& aListener) throw( RuntimeException )
    3039                 :            : {
    3040                 :        426 :     m_aLoadListeners.addInterface(aListener);
    3041                 :        426 : }
    3042                 :            : 
    3043                 :            : //------------------------------------------------------------------------------
    3044                 :        326 : void SAL_CALL ODatabaseForm::removeLoadListener(const Reference<XLoadListener>& aListener) throw( RuntimeException )
    3045                 :            : {
    3046                 :        326 :     m_aLoadListeners.removeInterface(aListener);
    3047                 :        326 : }
    3048                 :            : 
    3049                 :            : //==============================================================================
    3050                 :            : // com::sun::star::sdbc::XCloseable
    3051                 :            : //==============================================================================
    3052                 :          0 : void SAL_CALL ODatabaseForm::close() throw( SQLException, RuntimeException )
    3053                 :            : {
    3054                 :            :     // unload will close the aggregate
    3055                 :          0 :     unload();
    3056                 :          0 : }
    3057                 :            : 
    3058                 :            : //==============================================================================
    3059                 :            : // com::sun::star::sdbc::XRowSetListener
    3060                 :            : //------------------------------------------------------------------------------
    3061                 :          0 : void SAL_CALL ODatabaseForm::cursorMoved(const EventObject& /*event*/) throw( RuntimeException )
    3062                 :            : {
    3063                 :            :     // reload the subform with the new parameters of the parent
    3064                 :            :     // do this handling delayed to provide of execute too many SQL Statements
    3065         [ #  # ]:          0 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
    3066                 :            : 
    3067                 :            :     DBG_ASSERT( m_pLoadTimer, "ODatabaseForm::cursorMoved: how can this happen?!" );
    3068         [ #  # ]:          0 :     if ( !m_pLoadTimer )
    3069         [ #  # ]:          0 :         impl_createLoadTimer();
    3070                 :            : 
    3071         [ #  # ]:          0 :     if ( m_pLoadTimer->IsActive() )
    3072         [ #  # ]:          0 :         m_pLoadTimer->Stop();
    3073                 :            : 
    3074                 :            :     // and start the timer again
    3075 [ #  # ][ #  # ]:          0 :     m_pLoadTimer->Start();
    3076                 :          0 : }
    3077                 :            : 
    3078                 :            : //------------------------------------------------------------------------------
    3079                 :          0 : void SAL_CALL ODatabaseForm::rowChanged(const EventObject& /*event*/) throw( RuntimeException )
    3080                 :            : {
    3081                 :            :     // ignore it
    3082                 :          0 : }
    3083                 :            : 
    3084                 :            : //------------------------------------------------------------------------------
    3085                 :          0 : void SAL_CALL ODatabaseForm::rowSetChanged(const EventObject& /*event*/) throw( RuntimeException )
    3086                 :            : {
    3087                 :            :     // not interested in :
    3088                 :            :     // if our parent is an ODatabaseForm, too, then after this rowSetChanged we'll get a "reloaded"
    3089                 :            :     // or a "loaded" event.
    3090                 :            :     // If somebody gave us another parent which is an XRowSet but doesn't handle an execute as
    3091                 :            :     // "load" respectivly "reload" ... can't do anything ....
    3092                 :          0 : }
    3093                 :            : 
    3094                 :            : //------------------------------------------------------------------------------
    3095                 :          0 : bool ODatabaseForm::impl_approveRowChange_throw( const EventObject& _rEvent, const bool _bAllowSQLException,
    3096                 :            :     ::osl::ClearableMutexGuard& _rGuard )
    3097                 :            : {
    3098         [ #  # ]:          0 :     ::cppu::OInterfaceIteratorHelper aIter( m_aRowSetApproveListeners );
    3099         [ #  # ]:          0 :     _rGuard.clear();
    3100         [ #  # ]:          0 :     while ( aIter.hasMoreElements() )
    3101                 :            :     {
    3102 [ #  # ][ #  # ]:          0 :         Reference< XRowSetApproveListener > xListener( static_cast< XRowSetApproveListener* >( aIter.next() ) );
    3103         [ #  # ]:          0 :         if ( !xListener.is() )
    3104                 :          0 :             continue;
    3105                 :            : 
    3106                 :            :         try
    3107                 :            :         {
    3108 [ #  # ][ #  # ]:          0 :             if ( !xListener->approveRowSetChange( _rEvent ) )
                 [ #  # ]
    3109                 :          0 :                 return false;
    3110                 :            :         }
    3111         [ #  # ]:          0 :         catch (const DisposedException& e)
    3112                 :            :         {
    3113   [ #  #  #  # ]:          0 :             if ( e.Context == xListener )
    3114         [ #  # ]:          0 :                 aIter.remove();
    3115                 :            :         }
    3116                 :          0 :         catch (const RuntimeException&)
    3117                 :            :         {
    3118                 :          0 :             throw;
    3119                 :            :         }
    3120   [ #  #  #  #  :          0 :         catch (const SQLException&)
                #  #  # ]
    3121                 :            :         {
    3122         [ #  # ]:          0 :             if ( _bAllowSQLException )
    3123                 :          0 :                 throw;
    3124                 :            :             DBG_UNHANDLED_EXCEPTION();
    3125                 :            :         }
    3126         [ #  # ]:          0 :         catch (const Exception&)
    3127                 :            :         {
    3128                 :            :             DBG_UNHANDLED_EXCEPTION();
    3129                 :            :         }
    3130      [ #  #  # ]:          0 :     }
    3131         [ #  # ]:          0 :     return true;
    3132                 :            : }
    3133                 :            : 
    3134                 :            : //------------------------------------------------------------------------------
    3135                 :          0 : sal_Bool SAL_CALL ODatabaseForm::approveCursorMove(const EventObject& event) throw( RuntimeException )
    3136                 :            : {
    3137                 :            :     // is our aggregate calling?
    3138 [ #  # ][ #  # ]:          0 :     if (event.Source == InterfaceRef(static_cast<XWeak*>(this)))
    3139                 :            :     {
    3140                 :            :         // Our aggregate doesn't have any ApproveRowSetListeners (expect ourself), as we re-routed the queryInterface
    3141                 :            :         // for XRowSetApproveBroadcaster-interface.
    3142                 :            :         // So we have to multiplex this approve request.
    3143         [ #  # ]:          0 :         ::cppu::OInterfaceIteratorHelper aIter( m_aRowSetApproveListeners );
    3144         [ #  # ]:          0 :         while ( aIter.hasMoreElements() )
    3145                 :            :         {
    3146 [ #  # ][ #  # ]:          0 :             Reference< XRowSetApproveListener > xListener( static_cast< XRowSetApproveListener* >( aIter.next() ) );
    3147         [ #  # ]:          0 :             if ( !xListener.is() )
    3148                 :          0 :                 continue;
    3149                 :            : 
    3150                 :            :             try
    3151                 :            :             {
    3152 [ #  # ][ #  # ]:          0 :                 if ( !xListener->approveCursorMove( event ) )
                 [ #  # ]
    3153                 :          0 :                     return sal_False;
    3154                 :            :             }
    3155         [ #  # ]:          0 :             catch (const DisposedException& e)
    3156                 :            :             {
    3157   [ #  #  #  # ]:          0 :                 if ( e.Context == xListener )
    3158         [ #  # ]:          0 :                     aIter.remove();
    3159                 :            :             }
    3160   [ #  #  #  # ]:          0 :             catch (const RuntimeException&)
    3161                 :            :             {
    3162                 :          0 :                 throw;
    3163                 :            :             }
    3164         [ #  # ]:          0 :             catch (const Exception&)
    3165                 :            :             {
    3166                 :            :                 DBG_UNHANDLED_EXCEPTION();
    3167                 :            :             }
    3168      [ #  #  # ]:          0 :         }
    3169         [ #  # ]:          0 :         return true;
    3170                 :            :     }
    3171                 :            :     else
    3172                 :            :     {
    3173                 :            :         // this is a call from our parent ...
    3174                 :            :         // a parent's cursor move will result in a re-execute of our own row-set, so we have to
    3175                 :            :         // ask our own RowSetChangesListeners, too
    3176         [ #  # ]:          0 :         ::osl::ClearableMutexGuard aGuard( m_aMutex );
    3177 [ #  # ][ #  # ]:          0 :         if ( !impl_approveRowChange_throw( event, false, aGuard ) )
    3178 [ #  # ][ #  # ]:          0 :             return sal_False;
    3179                 :            :     }
    3180                 :          0 :     return sal_True;
    3181                 :            : }
    3182                 :            : 
    3183                 :            : //------------------------------------------------------------------------------
    3184                 :          0 : sal_Bool SAL_CALL ODatabaseForm::approveRowChange(const RowChangeEvent& event) throw( RuntimeException )
    3185                 :            : {
    3186                 :            :     // is our aggregate calling?
    3187 [ #  # ][ #  # ]:          0 :     if (event.Source == InterfaceRef(static_cast<XWeak*>(this)))
    3188                 :            :     {
    3189                 :            :         // Our aggregate doesn't have any ApproveRowSetListeners (expect ourself), as we re-routed the queryInterface
    3190                 :            :         // for XRowSetApproveBroadcaster-interface.
    3191                 :            :         // So we have to multiplex this approve request.
    3192         [ #  # ]:          0 :         ::cppu::OInterfaceIteratorHelper aIter( m_aRowSetApproveListeners );
    3193         [ #  # ]:          0 :         while ( aIter.hasMoreElements() )
    3194                 :            :         {
    3195 [ #  # ][ #  # ]:          0 :             Reference< XRowSetApproveListener > xListener( static_cast< XRowSetApproveListener* >( aIter.next() ) );
    3196         [ #  # ]:          0 :             if ( !xListener.is() )
    3197                 :          0 :                 continue;
    3198                 :            : 
    3199                 :            :             try
    3200                 :            :             {
    3201 [ #  # ][ #  # ]:          0 :                 if ( !xListener->approveRowChange( event ) )
                 [ #  # ]
    3202                 :          0 :                     return false;
    3203                 :            :             }
    3204         [ #  # ]:          0 :             catch (const DisposedException& e)
    3205                 :            :             {
    3206   [ #  #  #  # ]:          0 :                 if ( e.Context == xListener )
    3207         [ #  # ]:          0 :                     aIter.remove();
    3208                 :            :             }
    3209   [ #  #  #  # ]:          0 :             catch (const RuntimeException&)
    3210                 :            :             {
    3211                 :          0 :                 throw;
    3212                 :            :             }
    3213         [ #  # ]:          0 :             catch (const Exception&)
    3214                 :            :             {
    3215                 :            :                 DBG_UNHANDLED_EXCEPTION();
    3216                 :            :             }
    3217      [ #  #  # ]:          0 :         }
    3218         [ #  # ]:          0 :         return true;
    3219                 :            :     }
    3220                 :          0 :     return sal_True;
    3221                 :            : }
    3222                 :            : 
    3223                 :            : //------------------------------------------------------------------------------
    3224                 :          0 : sal_Bool SAL_CALL ODatabaseForm::approveRowSetChange(const EventObject& event) throw( RuntimeException )
    3225                 :            : {
    3226 [ #  # ][ #  # ]:          0 :     if (event.Source == InterfaceRef(static_cast<XWeak*>(this)))    // ignore our aggregate as we handle this approve ourself
    3227                 :            :     {
    3228         [ #  # ]:          0 :         ::osl::ClearableMutexGuard aGuard( m_aMutex );
    3229         [ #  # ]:          0 :         bool bWasLoaded = isLoaded();
    3230 [ #  # ][ #  # ]:          0 :         if ( !impl_approveRowChange_throw( event, false, aGuard ) )
    3231                 :          0 :             return sal_False;
    3232                 :            : 
    3233         [ #  # ]:          0 :         if ( bWasLoaded )
    3234                 :            :         {
    3235         [ #  # ]:          0 :             m_aLoadListeners.notifyEach( &XLoadListener::reloading, event );
    3236 [ #  # ][ #  # ]:          0 :         }
    3237                 :            :     }
    3238                 :            :     else
    3239                 :            :     {
    3240                 :            :         // this is a call from our parent ...
    3241                 :            :         // a parent's cursor move will result in a re-execute of our own row-set, so we have to
    3242                 :            :         // ask our own RowSetChangesListeners, too
    3243         [ #  # ]:          0 :         ::osl::ClearableMutexGuard aGuard( m_aMutex );
    3244 [ #  # ][ #  # ]:          0 :         if ( !impl_approveRowChange_throw( event, false, aGuard ) )
    3245 [ #  # ][ #  # ]:          0 :             return sal_False;
    3246                 :            :     }
    3247                 :          0 :     return sal_True;
    3248                 :            : }
    3249                 :            : 
    3250                 :            : //==============================================================================
    3251                 :            : // com::sun::star::sdb::XRowSetApproveBroadcaster
    3252                 :            : //------------------------------------------------------------------------------
    3253                 :          0 : void SAL_CALL ODatabaseForm::addRowSetApproveListener(const Reference<XRowSetApproveListener>& _rListener) throw( RuntimeException )
    3254                 :            : {
    3255         [ #  # ]:          0 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
    3256         [ #  # ]:          0 :     m_aRowSetApproveListeners.addInterface(_rListener);
    3257                 :            : 
    3258                 :            :     // do we have to multiplex ?
    3259 [ #  # ][ #  # ]:          0 :     if (m_aRowSetApproveListeners.getLength() == 1)
    3260                 :            :     {
    3261                 :          0 :         Reference<XRowSetApproveBroadcaster>  xBroadcaster;
    3262 [ #  # ][ #  # ]:          0 :         if (query_aggregation( m_xAggregate, xBroadcaster))
    3263                 :            :         {
    3264         [ #  # ]:          0 :             Reference<XRowSetApproveListener>  xListener((XRowSetApproveListener*)this);
    3265 [ #  # ][ #  # ]:          0 :             xBroadcaster->addRowSetApproveListener(xListener);
    3266                 :          0 :         }
    3267         [ #  # ]:          0 :     }
    3268                 :          0 : }
    3269                 :            : 
    3270                 :            : //------------------------------------------------------------------------------
    3271                 :          0 : void SAL_CALL ODatabaseForm::removeRowSetApproveListener(const Reference<XRowSetApproveListener>& _rListener) throw( RuntimeException )
    3272                 :            : {
    3273         [ #  # ]:          0 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
    3274                 :            :     // do we have to remove the multiplex ?
    3275         [ #  # ]:          0 :     m_aRowSetApproveListeners.removeInterface(_rListener);
    3276 [ #  # ][ #  # ]:          0 :     if ( m_aRowSetApproveListeners.getLength() == 0 )
    3277                 :            :     {
    3278                 :          0 :         Reference<XRowSetApproveBroadcaster>  xBroadcaster;
    3279 [ #  # ][ #  # ]:          0 :         if (query_aggregation( m_xAggregate, xBroadcaster))
    3280                 :            :         {
    3281         [ #  # ]:          0 :             Reference<XRowSetApproveListener>  xListener((XRowSetApproveListener*)this);
    3282 [ #  # ][ #  # ]:          0 :             xBroadcaster->removeRowSetApproveListener(xListener);
    3283                 :          0 :         }
    3284         [ #  # ]:          0 :     }
    3285                 :          0 : }
    3286                 :            : 
    3287                 :            : //==============================================================================
    3288                 :            : // com::sun:star::form::XDatabaseParameterBroadcaster
    3289                 :            : //------------------------------------------------------------------------------
    3290                 :         22 : void SAL_CALL ODatabaseForm::addDatabaseParameterListener(const Reference<XDatabaseParameterListener>& _rListener) throw( RuntimeException )
    3291                 :            : {
    3292                 :         22 :     m_aParameterManager.addParameterListener( _rListener );
    3293                 :         22 : }
    3294                 :            : //------------------------------------------------------------------------------
    3295                 :         19 : void SAL_CALL ODatabaseForm::removeDatabaseParameterListener(const Reference<XDatabaseParameterListener>& _rListener) throw( RuntimeException )
    3296                 :            : {
    3297                 :         19 :     m_aParameterManager.removeParameterListener( _rListener );
    3298                 :         19 : }
    3299                 :            : 
    3300                 :            : //------------------------------------------------------------------------------
    3301                 :         22 : void SAL_CALL ODatabaseForm::addParameterListener(const Reference<XDatabaseParameterListener>& _rListener) throw( RuntimeException )
    3302                 :            : {
    3303                 :         22 :     ODatabaseForm::addDatabaseParameterListener( _rListener );
    3304                 :         22 : }
    3305                 :            : 
    3306                 :            : //------------------------------------------------------------------------------
    3307                 :         19 : void SAL_CALL ODatabaseForm::removeParameterListener(const Reference<XDatabaseParameterListener>& _rListener) throw( RuntimeException )
    3308                 :            : {
    3309                 :         19 :     ODatabaseForm::removeDatabaseParameterListener( _rListener );
    3310                 :         19 : }
    3311                 :            : 
    3312                 :            : //==============================================================================
    3313                 :            : // com::sun::star::sdb::XCompletedExecution
    3314                 :            : //------------------------------------------------------------------------------
    3315                 :          0 : void SAL_CALL ODatabaseForm::executeWithCompletion( const Reference< XInteractionHandler >& _rxHandler ) throw(SQLException, RuntimeException)
    3316                 :            : {
    3317         [ #  # ]:          0 :     ::osl::ClearableMutexGuard aGuard(m_aMutex);
    3318                 :            :     // the difference between execute and load is, that we position on the first row in case of load
    3319                 :            :     // after execute we remain before the first row
    3320 [ #  # ][ #  # ]:          0 :     if (!isLoaded())
    3321                 :            :     {
    3322         [ #  # ]:          0 :         aGuard.clear();
    3323         [ #  # ]:          0 :         load_impl(sal_False, sal_False, _rxHandler);
    3324                 :            :     }
    3325                 :            :     else
    3326                 :            :     {
    3327 [ #  # ][ #  # ]:          0 :         EventObject event(static_cast< XWeak* >(this));
    3328 [ #  # ][ #  # ]:          0 :         if ( !impl_approveRowChange_throw( event, true, aGuard ) )
    3329                 :          0 :             return;
    3330                 :            : 
    3331                 :            :         // we're loaded and somebody want's to execute ourself -> this means a reload
    3332 [ #  # ][ #  # ]:          0 :         reload_impl(sal_False, _rxHandler);
                 [ #  # ]
    3333 [ #  # ][ #  # ]:          0 :     }
    3334                 :            : }
    3335                 :            : 
    3336                 :            : //==============================================================================
    3337                 :            : // com::sun::star::sdbc::XRowSet
    3338                 :            : //------------------------------------------------------------------------------
    3339                 :          0 : void SAL_CALL ODatabaseForm::execute() throw( SQLException, RuntimeException )
    3340                 :            : {
    3341         [ #  # ]:          0 :     ::osl::ResettableMutexGuard aGuard(m_aMutex);
    3342                 :            :     // if somebody calls an execute and we're not loaded we reroute this call to our load method.
    3343                 :            : 
    3344                 :            :     // the difference between execute and load is, that we position on the first row in case of load
    3345                 :            :     // after execute we remain before the first row
    3346 [ #  # ][ #  # ]:          0 :     if (!isLoaded())
    3347                 :            :     {
    3348         [ #  # ]:          0 :         aGuard.clear();
    3349         [ #  # ]:          0 :         load_impl(sal_False, sal_False);
    3350                 :            :     }
    3351                 :            :     else
    3352                 :            :     {
    3353 [ #  # ][ #  # ]:          0 :         EventObject event(static_cast< XWeak* >(this));
    3354 [ #  # ][ #  # ]:          0 :         if ( !impl_approveRowChange_throw( event, true, aGuard ) )
    3355                 :          0 :             return;
    3356                 :            : 
    3357                 :            :         // we're loaded and somebody want's to execute ourself -> this means a reload
    3358 [ #  # ][ #  # ]:          0 :         reload_impl(sal_False);
                 [ #  # ]
    3359 [ #  # ][ #  # ]:          0 :     }
    3360                 :            : }
    3361                 :            : 
    3362                 :            : //------------------------------------------------------------------------------
    3363                 :         46 : void SAL_CALL ODatabaseForm::addRowSetListener(const Reference<XRowSetListener>& _rListener) throw( RuntimeException )
    3364                 :            : {
    3365         [ +  - ]:         46 :     if (m_xAggregateAsRowSet.is())
    3366                 :         46 :         m_xAggregateAsRowSet->addRowSetListener(_rListener);
    3367                 :         46 : }
    3368                 :            : 
    3369                 :            : //------------------------------------------------------------------------------
    3370                 :         41 : void SAL_CALL ODatabaseForm::removeRowSetListener(const Reference<XRowSetListener>& _rListener) throw( RuntimeException )
    3371                 :            : {
    3372         [ +  - ]:         41 :     if (m_xAggregateAsRowSet.is())
    3373                 :         41 :         m_xAggregateAsRowSet->removeRowSetListener(_rListener);
    3374                 :         41 : }
    3375                 :            : 
    3376                 :            : //==============================================================================
    3377                 :            : // com::sun::star::sdbc::XResultSet
    3378                 :            : //------------------------------------------------------------------------------
    3379                 :          2 : sal_Bool SAL_CALL ODatabaseForm::next() throw( SQLException, RuntimeException )
    3380                 :            : {
    3381                 :          2 :     return m_xAggregateAsRowSet->next();
    3382                 :            : }
    3383                 :            : 
    3384                 :            : //------------------------------------------------------------------------------
    3385                 :        340 : sal_Bool SAL_CALL ODatabaseForm::isBeforeFirst() throw( SQLException, RuntimeException )
    3386                 :            : {
    3387                 :        340 :     return m_xAggregateAsRowSet->isBeforeFirst();
    3388                 :            : }
    3389                 :            : 
    3390                 :            : //------------------------------------------------------------------------------
    3391                 :        342 : sal_Bool SAL_CALL ODatabaseForm::isAfterLast() throw( SQLException, RuntimeException )
    3392                 :            : {
    3393                 :        342 :     return m_xAggregateAsRowSet->isAfterLast();
    3394                 :            : }
    3395                 :            : 
    3396                 :            : //------------------------------------------------------------------------------
    3397                 :          0 : sal_Bool SAL_CALL ODatabaseForm::isFirst() throw( SQLException, RuntimeException )
    3398                 :            : {
    3399                 :          0 :     return m_xAggregateAsRowSet->isFirst();
    3400                 :            : }
    3401                 :            : 
    3402                 :            : //------------------------------------------------------------------------------
    3403                 :          0 : sal_Bool SAL_CALL ODatabaseForm::isLast() throw( SQLException, RuntimeException )
    3404                 :            : {
    3405                 :          0 :     return m_xAggregateAsRowSet->isLast();
    3406                 :            : }
    3407                 :            : 
    3408                 :            : //------------------------------------------------------------------------------
    3409                 :          0 : void SAL_CALL ODatabaseForm::beforeFirst() throw( SQLException, RuntimeException )
    3410                 :            : {
    3411                 :          0 :     m_xAggregateAsRowSet->beforeFirst();
    3412                 :          0 : }
    3413                 :            : 
    3414                 :            : //------------------------------------------------------------------------------
    3415                 :          0 : void SAL_CALL ODatabaseForm::afterLast() throw( SQLException, RuntimeException )
    3416                 :            : {
    3417                 :          0 :     m_xAggregateAsRowSet->afterLast();
    3418                 :          0 : }
    3419                 :            : 
    3420                 :            : //------------------------------------------------------------------------------
    3421                 :          0 : sal_Bool SAL_CALL ODatabaseForm::first() throw( SQLException, RuntimeException )
    3422                 :            : {
    3423                 :          0 :     return m_xAggregateAsRowSet->first();
    3424                 :            : }
    3425                 :            : 
    3426                 :            : //------------------------------------------------------------------------------
    3427                 :          0 : sal_Bool SAL_CALL ODatabaseForm::last() throw( SQLException, RuntimeException )
    3428                 :            : {
    3429                 :          0 :     return m_xAggregateAsRowSet->last();
    3430                 :            : }
    3431                 :            : 
    3432                 :            : //------------------------------------------------------------------------------
    3433                 :          0 : sal_Int32 SAL_CALL ODatabaseForm::getRow() throw( SQLException, RuntimeException )
    3434                 :            : {
    3435                 :          0 :     return m_xAggregateAsRowSet->getRow();
    3436                 :            : }
    3437                 :            : 
    3438                 :            : //------------------------------------------------------------------------------
    3439                 :          0 : sal_Bool SAL_CALL ODatabaseForm::absolute(sal_Int32 row) throw( SQLException, RuntimeException )
    3440                 :            : {
    3441                 :          0 :     return m_xAggregateAsRowSet->absolute(row);
    3442                 :            : }
    3443                 :            : 
    3444                 :            : //------------------------------------------------------------------------------
    3445                 :          0 : sal_Bool SAL_CALL ODatabaseForm::relative(sal_Int32 rows) throw( SQLException, RuntimeException )
    3446                 :            : {
    3447                 :          0 :     return m_xAggregateAsRowSet->relative(rows);
    3448                 :            : }
    3449                 :            : 
    3450                 :            : //------------------------------------------------------------------------------
    3451                 :          0 : sal_Bool SAL_CALL ODatabaseForm::previous() throw( SQLException, RuntimeException )
    3452                 :            : {
    3453                 :          0 :     return m_xAggregateAsRowSet->previous();
    3454                 :            : }
    3455                 :            : 
    3456                 :            : //------------------------------------------------------------------------------
    3457                 :          0 : void SAL_CALL ODatabaseForm::refreshRow() throw( SQLException, RuntimeException )
    3458                 :            : {
    3459                 :          0 :     m_xAggregateAsRowSet->refreshRow();
    3460                 :          0 : }
    3461                 :            : 
    3462                 :            : //------------------------------------------------------------------------------
    3463                 :          0 : sal_Bool SAL_CALL ODatabaseForm::rowUpdated() throw( SQLException, RuntimeException )
    3464                 :            : {
    3465                 :          0 :     return m_xAggregateAsRowSet->rowUpdated();
    3466                 :            : }
    3467                 :            : 
    3468                 :            : //------------------------------------------------------------------------------
    3469                 :          0 : sal_Bool SAL_CALL ODatabaseForm::rowInserted() throw( SQLException, RuntimeException )
    3470                 :            : {
    3471                 :          0 :     return m_xAggregateAsRowSet->rowInserted();
    3472                 :            : }
    3473                 :            : 
    3474                 :            : //------------------------------------------------------------------------------
    3475                 :         19 : sal_Bool SAL_CALL ODatabaseForm::rowDeleted() throw( SQLException, RuntimeException )
    3476                 :            : {
    3477                 :         19 :     return m_xAggregateAsRowSet->rowDeleted();
    3478                 :            : }
    3479                 :            : 
    3480                 :            : //------------------------------------------------------------------------------
    3481                 :          0 : InterfaceRef SAL_CALL ODatabaseForm::getStatement() throw( SQLException, RuntimeException )
    3482                 :            : {
    3483                 :          0 :     return m_xAggregateAsRowSet->getStatement();
    3484                 :            : }
    3485                 :            : 
    3486                 :            : // com::sun::star::sdbc::XResultSetUpdate
    3487                 :            : // exceptions during insert update and delete will be forwarded to the errorlistener
    3488                 :            : //------------------------------------------------------------------------------
    3489                 :          0 : void SAL_CALL ODatabaseForm::insertRow() throw( SQLException, RuntimeException )
    3490                 :            : {
    3491                 :            :     try
    3492                 :            :     {
    3493                 :          0 :         Reference<XResultSetUpdate>  xUpdate;
    3494 [ #  # ][ #  # ]:          0 :         if (query_aggregation( m_xAggregate, xUpdate))
    3495 [ #  # ][ #  # ]:          0 :             xUpdate->insertRow();
    3496                 :            :     }
    3497                 :          0 :     catch(const RowSetVetoException&)
    3498                 :            :     {
    3499                 :          0 :         throw;
    3500                 :            :     }
    3501      [ #  #  # ]:          0 :     catch(const SQLException& eDb)
    3502                 :            :     {
    3503   [ #  #  #  # ]:          0 :         onError(eDb, FRM_RES_STRING(RID_STR_ERR_INSERTRECORD));
    3504                 :          0 :         throw;
    3505                 :            :     }
    3506                 :          0 : }
    3507                 :            : 
    3508                 :            : //------------------------------------------------------------------------------
    3509                 :          0 : void SAL_CALL ODatabaseForm::updateRow() throw( SQLException, RuntimeException )
    3510                 :            : {
    3511                 :            :     try
    3512                 :            :     {
    3513                 :          0 :         Reference<XResultSetUpdate>  xUpdate;
    3514 [ #  # ][ #  # ]:          0 :         if (query_aggregation( m_xAggregate, xUpdate))
    3515 [ #  # ][ #  # ]:          0 :             xUpdate->updateRow();
    3516                 :            :     }
    3517                 :          0 :     catch(const RowSetVetoException&)
    3518                 :            :     {
    3519                 :          0 :         throw;
    3520                 :            :     }
    3521      [ #  #  # ]:          0 :     catch(const SQLException& eDb)
    3522                 :            :     {
    3523   [ #  #  #  # ]:          0 :         onError(eDb, FRM_RES_STRING(RID_STR_ERR_UPDATERECORD));
    3524                 :          0 :         throw;
    3525                 :            :     }
    3526                 :          0 : }
    3527                 :            : 
    3528                 :            : //------------------------------------------------------------------------------
    3529                 :          0 : void SAL_CALL ODatabaseForm::deleteRow() throw( SQLException, RuntimeException )
    3530                 :            : {
    3531                 :            :     try
    3532                 :            :     {
    3533                 :          0 :         Reference<XResultSetUpdate>  xUpdate;
    3534 [ #  # ][ #  # ]:          0 :         if (query_aggregation( m_xAggregate, xUpdate))
    3535 [ #  # ][ #  # ]:          0 :             xUpdate->deleteRow();
    3536                 :            :     }
    3537                 :          0 :     catch(const RowSetVetoException&)
    3538                 :            :     {
    3539                 :          0 :         throw;
    3540                 :            :     }
    3541      [ #  #  # ]:          0 :     catch(const SQLException& eDb)
    3542                 :            :     {
    3543   [ #  #  #  # ]:          0 :         onError(eDb, FRM_RES_STRING(RID_STR_ERR_DELETERECORD));
    3544                 :          0 :         throw;
    3545                 :            :     }
    3546                 :          0 : }
    3547                 :            : 
    3548                 :            : //------------------------------------------------------------------------------
    3549                 :          0 : void SAL_CALL ODatabaseForm::cancelRowUpdates() throw( SQLException, RuntimeException )
    3550                 :            : {
    3551                 :            :     try
    3552                 :            :     {
    3553                 :          0 :         Reference<XResultSetUpdate>  xUpdate;
    3554 [ #  # ][ #  # ]:          0 :         if (query_aggregation( m_xAggregate, xUpdate))
    3555 [ #  # ][ #  # ]:          0 :             xUpdate->cancelRowUpdates();
    3556                 :            :     }
    3557                 :          0 :     catch(const RowSetVetoException&)
    3558                 :            :     {
    3559                 :          0 :         throw;
    3560                 :            :     }
    3561      [ #  #  # ]:          0 :     catch(const SQLException& eDb)
    3562                 :            :     {
    3563   [ #  #  #  # ]:          0 :         onError(eDb, FRM_RES_STRING(RID_STR_ERR_INSERTRECORD));
    3564                 :          0 :         throw;
    3565                 :            :     }
    3566                 :          0 : }
    3567                 :            : 
    3568                 :            : //------------------------------------------------------------------------------
    3569                 :          0 : void SAL_CALL ODatabaseForm::moveToInsertRow() throw( SQLException, RuntimeException )
    3570                 :            : {
    3571                 :          0 :     Reference<XResultSetUpdate>  xUpdate;
    3572 [ #  # ][ #  # ]:          0 :     if (query_aggregation( m_xAggregate, xUpdate))
    3573                 :            :     {
    3574                 :            :         // _always_ move to the insert row
    3575                 :            :         //
    3576                 :            :         // Formerly, the following line was conditioned with a "not is new", means we did not move the aggregate
    3577                 :            :         // to the insert row if it was already positioned there.
    3578                 :            :         //
    3579                 :            :         // This prevented the RowSet implementation from resetting it's column values. We, ourself, formerly
    3580                 :            :         // did this reset of columns in reset_impl, where we set every column to the ControlDefault, or, if this
    3581                 :            :         // was not present, to NULL. However, the problem with setting to NULL was #88888#, the problem with
    3582                 :            :         // _not_ setting to NULL (which was the original fix for #88888#) was #97955#.
    3583                 :            :         //
    3584                 :            :         // So now we
    3585                 :            :         // * move our aggregate to the insert row
    3586                 :            :         // * in reset_impl
    3587                 :            :         //   - set the control defaults into the columns if not void
    3588                 :            :         //   - do _not_ set the columns to NULL if no control default is set
    3589                 :            :         //
    3590                 :            :         // Still, there is #72756#. During fixing this bug, DG introduced not calling the aggregate here. So
    3591                 :            :         // in theory, we re-introduced #72756#. But the bug described therein does not happen anymore, as the
    3592                 :            :         // preliminaries for it changed (no display of guessed values for new records with autoinc fields)
    3593                 :            :         //
    3594                 :            :         // BTW: the public Issuezilla bug is #i2815#
    3595                 :            :         //
    3596 [ #  # ][ #  # ]:          0 :         xUpdate->moveToInsertRow();
    3597                 :            : 
    3598                 :            :         // then set the default values and the parameters given from the parent
    3599         [ #  # ]:          0 :         reset();
    3600                 :          0 :     }
    3601                 :          0 : }
    3602                 :            : 
    3603                 :            : //------------------------------------------------------------------------------
    3604                 :          0 : void SAL_CALL ODatabaseForm::moveToCurrentRow() throw( SQLException, RuntimeException )
    3605                 :            : {
    3606                 :          0 :     Reference<XResultSetUpdate>  xUpdate;
    3607 [ #  # ][ #  # ]:          0 :     if (query_aggregation( m_xAggregate, xUpdate))
    3608 [ #  # ][ #  # ]:          0 :         xUpdate->moveToCurrentRow();
    3609                 :          0 : }
    3610                 :            : 
    3611                 :            : // com::sun::star::sdbcx::XDeleteRows
    3612                 :            : //------------------------------------------------------------------------------
    3613                 :          0 : Sequence<sal_Int32> SAL_CALL ODatabaseForm::deleteRows(const Sequence<Any>& rows) throw( SQLException, RuntimeException )
    3614                 :            : {
    3615                 :            :     try
    3616                 :            :     {
    3617                 :          0 :         Reference<XDeleteRows>  xDelete;
    3618 [ #  # ][ #  # ]:          0 :         if (query_aggregation( m_xAggregate, xDelete))
    3619 [ #  # ][ #  # ]:          0 :             return xDelete->deleteRows(rows);
                 [ #  # ]
    3620                 :            :     }
    3621                 :          0 :     catch(const RowSetVetoException&)
    3622                 :            :     {
    3623                 :          0 :         throw;
    3624                 :            :     }
    3625      [ #  #  # ]:          0 :     catch(const SQLException& eDb)
    3626                 :            :     {
    3627   [ #  #  #  # ]:          0 :         onError(eDb, FRM_RES_STRING(RID_STR_ERR_DELETERECORDS));
    3628                 :          0 :         throw;
    3629                 :            :     }
    3630                 :            : 
    3631                 :          0 :     return Sequence< sal_Int32 >();
    3632                 :            : }
    3633                 :            : 
    3634                 :            : // com::sun::star::sdbc::XParameters
    3635                 :            : //------------------------------------------------------------------------------
    3636                 :          0 : void SAL_CALL ODatabaseForm::setNull(sal_Int32 parameterIndex, sal_Int32 sqlType) throw( SQLException, RuntimeException )
    3637                 :            : {
    3638                 :          0 :     m_aParameterManager.setNull(parameterIndex, sqlType);
    3639                 :          0 : }
    3640                 :            : 
    3641                 :            : //------------------------------------------------------------------------------
    3642                 :          0 : void SAL_CALL ODatabaseForm::setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName) throw( SQLException, RuntimeException )
    3643                 :            : {
    3644                 :          0 :     m_aParameterManager.setObjectNull(parameterIndex, sqlType, typeName);
    3645                 :          0 : }
    3646                 :            : 
    3647                 :            : //------------------------------------------------------------------------------
    3648                 :          0 : void SAL_CALL ODatabaseForm::setBoolean(sal_Int32 parameterIndex, sal_Bool x) throw( SQLException, RuntimeException )
    3649                 :            : {
    3650                 :          0 :     m_aParameterManager.setBoolean(parameterIndex, x);
    3651                 :          0 : }
    3652                 :            : 
    3653                 :            : //------------------------------------------------------------------------------
    3654                 :          0 : void SAL_CALL ODatabaseForm::setByte(sal_Int32 parameterIndex, sal_Int8 x) throw( SQLException, RuntimeException )
    3655                 :            : {
    3656                 :          0 :     m_aParameterManager.setByte(parameterIndex, x);
    3657                 :          0 : }
    3658                 :            : 
    3659                 :            : //------------------------------------------------------------------------------
    3660                 :          0 : void SAL_CALL ODatabaseForm::setShort(sal_Int32 parameterIndex, sal_Int16 x) throw( SQLException, RuntimeException )
    3661                 :            : {
    3662                 :          0 :     m_aParameterManager.setShort(parameterIndex, x);
    3663                 :          0 : }
    3664                 :            : 
    3665                 :            : //------------------------------------------------------------------------------
    3666                 :          0 : void SAL_CALL ODatabaseForm::setInt(sal_Int32 parameterIndex, sal_Int32 x) throw( SQLException, RuntimeException )
    3667                 :            : {
    3668                 :          0 :     m_aParameterManager.setInt(parameterIndex, x);
    3669                 :          0 : }
    3670                 :            : 
    3671                 :            : //------------------------------------------------------------------------------
    3672                 :          0 : void SAL_CALL ODatabaseForm::setLong(sal_Int32 parameterIndex, sal_Int64 x) throw( SQLException, RuntimeException )
    3673                 :            : {
    3674                 :          0 :     m_aParameterManager.setLong(parameterIndex, x);
    3675                 :          0 : }
    3676                 :            : 
    3677                 :            : //------------------------------------------------------------------------------
    3678                 :          0 : void SAL_CALL ODatabaseForm::setFloat(sal_Int32 parameterIndex, float x) throw( SQLException, RuntimeException )
    3679                 :            : {
    3680                 :          0 :     m_aParameterManager.setFloat(parameterIndex, x);
    3681                 :          0 : }
    3682                 :            : 
    3683                 :            : //------------------------------------------------------------------------------
    3684                 :          0 : void SAL_CALL ODatabaseForm::setDouble(sal_Int32 parameterIndex, double x) throw( SQLException, RuntimeException )
    3685                 :            : {
    3686                 :          0 :     m_aParameterManager.setDouble(parameterIndex, x);
    3687                 :          0 : }
    3688                 :            : 
    3689                 :            : //------------------------------------------------------------------------------
    3690                 :          0 : void SAL_CALL ODatabaseForm::setString(sal_Int32 parameterIndex, const ::rtl::OUString& x) throw( SQLException, RuntimeException )
    3691                 :            : {
    3692                 :          0 :     m_aParameterManager.setString(parameterIndex, x);
    3693                 :          0 : }
    3694                 :            : 
    3695                 :            : //------------------------------------------------------------------------------
    3696                 :          0 : void SAL_CALL ODatabaseForm::setBytes(sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException )
    3697                 :            : {
    3698                 :          0 :     m_aParameterManager.setBytes(parameterIndex, x);
    3699                 :          0 : }
    3700                 :            : 
    3701                 :            : //------------------------------------------------------------------------------
    3702                 :          0 : void SAL_CALL ODatabaseForm::setDate(sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x) throw( SQLException, RuntimeException )
    3703                 :            : {
    3704                 :          0 :     m_aParameterManager.setDate(parameterIndex, x);
    3705                 :          0 : }
    3706                 :            : 
    3707                 :            : //------------------------------------------------------------------------------
    3708                 :          0 : void SAL_CALL ODatabaseForm::setTime(sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x) throw( SQLException, RuntimeException )
    3709                 :            : {
    3710                 :          0 :     m_aParameterManager.setTime(parameterIndex, x);
    3711                 :          0 : }
    3712                 :            : 
    3713                 :            : //------------------------------------------------------------------------------
    3714                 :          0 : void SAL_CALL ODatabaseForm::setTimestamp(sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException )
    3715                 :            : {
    3716                 :          0 :     m_aParameterManager.setTimestamp(parameterIndex, x);
    3717                 :          0 : }
    3718                 :            : 
    3719                 :            : //------------------------------------------------------------------------------
    3720                 :          0 : void SAL_CALL ODatabaseForm::setBinaryStream(sal_Int32 parameterIndex, const Reference<XInputStream>& x, sal_Int32 length) throw( SQLException, RuntimeException )
    3721                 :            : {
    3722                 :          0 :     m_aParameterManager.setBinaryStream(parameterIndex, x, length);
    3723                 :          0 : }
    3724                 :            : 
    3725                 :            : //------------------------------------------------------------------------------
    3726                 :          0 : void SAL_CALL ODatabaseForm::setCharacterStream(sal_Int32 parameterIndex, const Reference<XInputStream>& x, sal_Int32 length) throw( SQLException, RuntimeException )
    3727                 :            : {
    3728                 :          0 :     m_aParameterManager.setCharacterStream(parameterIndex, x, length);
    3729                 :          0 : }
    3730                 :            : 
    3731                 :            : //------------------------------------------------------------------------------
    3732                 :          0 : void SAL_CALL ODatabaseForm::setObjectWithInfo(sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 scale) throw( SQLException, RuntimeException )
    3733                 :            : {
    3734                 :          0 :     m_aParameterManager.setObjectWithInfo(parameterIndex, x, targetSqlType, scale);
    3735                 :          0 : }
    3736                 :            : 
    3737                 :            : //------------------------------------------------------------------------------
    3738                 :          0 : void SAL_CALL ODatabaseForm::setObject(sal_Int32 parameterIndex, const Any& x) throw( SQLException, RuntimeException )
    3739                 :            : {
    3740                 :          0 :     m_aParameterManager.setObject(parameterIndex, x);
    3741                 :          0 : }
    3742                 :            : 
    3743                 :            : //------------------------------------------------------------------------------
    3744                 :          0 : void SAL_CALL ODatabaseForm::setRef(sal_Int32 parameterIndex, const Reference<XRef>& x) throw( SQLException, RuntimeException )
    3745                 :            : {
    3746                 :          0 :     m_aParameterManager.setRef(parameterIndex, x);
    3747                 :          0 : }
    3748                 :            : 
    3749                 :            : //------------------------------------------------------------------------------
    3750                 :          0 : void SAL_CALL ODatabaseForm::setBlob(sal_Int32 parameterIndex, const Reference<XBlob>& x) throw( SQLException, RuntimeException )
    3751                 :            : {
    3752                 :          0 :     m_aParameterManager.setBlob(parameterIndex, x);
    3753                 :          0 : }
    3754                 :            : 
    3755                 :            : //------------------------------------------------------------------------------
    3756                 :          0 : void SAL_CALL ODatabaseForm::setClob(sal_Int32 parameterIndex, const Reference<XClob>& x) throw( SQLException, RuntimeException )
    3757                 :            : {
    3758                 :          0 :     m_aParameterManager.setClob(parameterIndex, x);
    3759                 :          0 : }
    3760                 :            : 
    3761                 :            : //------------------------------------------------------------------------------
    3762                 :          0 : void SAL_CALL ODatabaseForm::setArray(sal_Int32 parameterIndex, const Reference<XArray>& x) throw( SQLException, RuntimeException )
    3763                 :            : {
    3764                 :          0 :     m_aParameterManager.setArray(parameterIndex, x);
    3765                 :          0 : }
    3766                 :            : 
    3767                 :            : //------------------------------------------------------------------------------
    3768                 :          0 : void SAL_CALL ODatabaseForm::clearParameters() throw( SQLException, RuntimeException )
    3769                 :            : {
    3770                 :          0 :     m_aParameterManager.clearParameters();
    3771                 :          0 : }
    3772                 :            : 
    3773                 :            : //------------------------------------------------------------------------------
    3774                 :        465 : void SAL_CALL ODatabaseForm::propertyChange( const PropertyChangeEvent& evt ) throw (RuntimeException)
    3775                 :            : {
    3776         [ -  + ]:        465 :     if ( evt.Source == m_xParent )
    3777                 :            :     {
    3778         [ #  # ]:          0 :         if ( evt.PropertyName == PROPERTY_ISNEW )
    3779                 :            :         {
    3780                 :          0 :             sal_Bool bCurrentIsNew( sal_False );
    3781                 :          0 :             OSL_VERIFY( evt.NewValue >>= bCurrentIsNew );
    3782         [ #  # ]:          0 :             if ( !bCurrentIsNew )
    3783         [ #  # ]:          0 :                 reload_impl( sal_True );
    3784                 :            :         }
    3785                 :        465 :         return;
    3786                 :            :     }
    3787                 :        465 :     OFormComponents::propertyChange( evt );
    3788                 :            : }
    3789                 :            : 
    3790                 :            : // com::sun::star::lang::XServiceInfo
    3791                 :            : //------------------------------------------------------------------------------
    3792                 :         60 : ::rtl::OUString SAL_CALL ODatabaseForm::getImplementationName_Static()
    3793                 :            : {
    3794                 :         60 :     return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.forms.ODatabaseForm" ) );
    3795                 :            : }
    3796                 :            : 
    3797                 :            : //------------------------------------------------------------------------------
    3798                 :         30 : Sequence< ::rtl::OUString > SAL_CALL ODatabaseForm::getCompatibleServiceNames_Static()
    3799                 :            : {
    3800                 :         30 :     Sequence< ::rtl::OUString > aServices( 1 );
    3801         [ +  - ]:         30 :     ::rtl::OUString* pServices = aServices.getArray();
    3802                 :            : 
    3803         [ +  - ]:         30 :     *pServices++ = FRM_COMPONENT_FORM;
    3804                 :            : 
    3805                 :         30 :     return aServices;
    3806                 :            : }
    3807                 :            : 
    3808                 :            : //------------------------------------------------------------------------------
    3809                 :         30 : Sequence< ::rtl::OUString > SAL_CALL ODatabaseForm::getCurrentServiceNames_Static()
    3810                 :            : {
    3811                 :         30 :     Sequence< ::rtl::OUString > aServices( 5 );
    3812         [ +  - ]:         30 :     ::rtl::OUString* pServices = aServices.getArray();
    3813                 :            : 
    3814         [ +  - ]:         30 :     *pServices++ = FRM_SUN_FORMCOMPONENT;
    3815         [ +  - ]:         30 :     *pServices++ = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.FormComponents") );
    3816         [ +  - ]:         30 :     *pServices++ = FRM_SUN_COMPONENT_FORM;
    3817         [ +  - ]:         30 :     *pServices++ = FRM_SUN_COMPONENT_HTMLFORM;
    3818         [ +  - ]:         30 :     *pServices++ = FRM_SUN_COMPONENT_DATAFORM;
    3819                 :            : 
    3820                 :         30 :     return aServices;
    3821                 :            : }
    3822                 :            : 
    3823                 :            : //------------------------------------------------------------------------------
    3824                 :         30 : Sequence< ::rtl::OUString > SAL_CALL ODatabaseForm::getSupportedServiceNames_Static()
    3825                 :            : {
    3826                 :            :     return ::comphelper::concatSequences(
    3827                 :            :         getCurrentServiceNames_Static(),
    3828                 :            :         getCompatibleServiceNames_Static()
    3829 [ +  - ][ +  - ]:         30 :     );
                 [ +  - ]
    3830                 :            : }
    3831                 :            : 
    3832                 :            : //------------------------------------------------------------------------------
    3833                 :          0 : ::rtl::OUString SAL_CALL ODatabaseForm::getImplementationName() throw( RuntimeException )
    3834                 :            : {
    3835                 :          0 :     return getImplementationName_Static();
    3836                 :            : }
    3837                 :            : 
    3838                 :            : //------------------------------------------------------------------------------
    3839                 :          0 : Sequence< ::rtl::OUString > SAL_CALL ODatabaseForm::getSupportedServiceNames() throw( RuntimeException )
    3840                 :            : {
    3841                 :            :     // the services of our aggregate
    3842         [ #  # ]:          0 :     Sequence< ::rtl::OUString > aServices;
    3843                 :          0 :     Reference< XServiceInfo > xInfo;
    3844 [ #  # ][ #  # ]:          0 :     if (query_aggregation(m_xAggregate, xInfo))
    3845 [ #  # ][ #  # ]:          0 :         aServices = xInfo->getSupportedServiceNames();
         [ #  # ][ #  # ]
    3846                 :            : 
    3847                 :            :     // concat with out own services
    3848                 :            :     return ::comphelper::concatSequences(
    3849                 :            :         getCurrentServiceNames_Static(),
    3850                 :            :         aServices
    3851 [ #  # ][ #  # ]:          0 :     );
         [ #  # ][ #  # ]
    3852                 :            :     // use getCurrentXXX instead of getSupportedXXX, because at runtime, we do not want to have
    3853                 :            :     // the compatible names
    3854                 :            :     // This is maily to be consistent with the implementation before fixing #97083#, though the
    3855                 :            :     // better solution _may_ be to return the compatible names at runtime, too
    3856                 :            : }
    3857                 :            : 
    3858                 :            : //------------------------------------------------------------------------------
    3859                 :          0 : sal_Bool SAL_CALL ODatabaseForm::supportsService(const ::rtl::OUString& ServiceName) throw( RuntimeException )
    3860                 :            : {
    3861         [ #  # ]:          0 :     Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() );
    3862                 :          0 :     const ::rtl::OUString* pArray = aSupported.getConstArray();
    3863         [ #  # ]:          0 :     for( sal_Int32 i = 0; i < aSupported.getLength(); ++i, ++pArray )
    3864         [ #  # ]:          0 :         if( pArray->equals( ServiceName ) )
    3865                 :          0 :             return sal_True;
    3866         [ #  # ]:          0 :     return sal_False;
    3867                 :            : }
    3868                 :            : 
    3869                 :            : //==============================================================================
    3870                 :            : // com::sun::star::io::XPersistObject
    3871                 :            : //------------------------------------------------------------------------------
    3872                 :            : 
    3873                 :            : const sal_uInt16 CYCLE              = 0x0001;
    3874                 :            : const sal_uInt16 DONTAPPLYFILTER    = 0x0002;
    3875                 :            : 
    3876                 :            : //------------------------------------------------------------------------------
    3877                 :          0 : ::rtl::OUString ODatabaseForm::getServiceName() throw( RuntimeException )
    3878                 :            : {
    3879                 :          0 :     return FRM_COMPONENT_FORM;  // old (non-sun) name for compatibility !
    3880                 :            : }
    3881                 :            : 
    3882                 :            : //------------------------------------------------------------------------------
    3883                 :          0 : void SAL_CALL ODatabaseForm::write(const Reference<XObjectOutputStream>& _rxOutStream) throw( IOException, RuntimeException )
    3884                 :            : {
    3885                 :            :     DBG_ASSERT(m_xAggregateSet.is(), "ODatabaseForm::write : only to be called if the aggregate exists !");
    3886                 :            : 
    3887                 :            :     // all children
    3888         [ #  # ]:          0 :     OFormComponents::write(_rxOutStream);
    3889                 :            : 
    3890                 :            :     // version
    3891 [ #  # ][ #  # ]:          0 :     _rxOutStream->writeShort(0x0003);
    3892                 :            : 
    3893                 :            :     // Name
    3894         [ #  # ]:          0 :     _rxOutStream << m_sName;
    3895                 :            : 
    3896                 :          0 :     ::rtl::OUString sDataSource;
    3897         [ #  # ]:          0 :     if (m_xAggregateSet.is())
    3898 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->getPropertyValue(PROPERTY_DATASOURCE) >>= sDataSource;
                 [ #  # ]
    3899         [ #  # ]:          0 :     _rxOutStream << sDataSource;
    3900                 :            : 
    3901                 :            :     // former CursorSource
    3902                 :          0 :     ::rtl::OUString sCommand;
    3903         [ #  # ]:          0 :     if (m_xAggregateSet.is())
    3904 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->getPropertyValue(PROPERTY_COMMAND) >>= sCommand;
                 [ #  # ]
    3905         [ #  # ]:          0 :     _rxOutStream << sCommand;
    3906                 :            : 
    3907                 :            :     // former MasterFields
    3908         [ #  # ]:          0 :     _rxOutStream << m_aMasterFields;
    3909                 :            :     // former DetailFields
    3910         [ #  # ]:          0 :     _rxOutStream << m_aDetailFields;
    3911                 :            : 
    3912                 :            :     // former DataSelectionType
    3913                 :          0 :     DataSelectionType eTranslated = DataSelectionType_TABLE;
    3914         [ #  # ]:          0 :     if (m_xAggregateSet.is())
    3915                 :            :     {
    3916                 :          0 :         sal_Int32 nCommandType = 0;
    3917 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->getPropertyValue(PROPERTY_COMMANDTYPE) >>= nCommandType;
                 [ #  # ]
    3918   [ #  #  #  # ]:          0 :         switch (nCommandType)
    3919                 :            :         {
    3920                 :          0 :             case CommandType::TABLE : eTranslated = DataSelectionType_TABLE; break;
    3921                 :          0 :             case CommandType::QUERY : eTranslated = DataSelectionType_QUERY; break;
    3922                 :            :             case CommandType::COMMAND:
    3923                 :            :             {
    3924 [ #  # ][ #  # ]:          0 :                 sal_Bool bEscapeProcessing = getBOOL(m_xAggregateSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING));
         [ #  # ][ #  # ]
    3925         [ #  # ]:          0 :                 eTranslated = bEscapeProcessing ? DataSelectionType_SQL : DataSelectionType_SQLPASSTHROUGH;
    3926                 :            :             }
    3927                 :          0 :             break;
    3928                 :            :             default : OSL_FAIL("ODatabaseForm::write : wrong CommandType !");
    3929                 :            :         }
    3930                 :            :     }
    3931 [ #  # ][ #  # ]:          0 :     _rxOutStream->writeShort((sal_Int16)eTranslated);           // former DataSelectionType
    3932                 :            : 
    3933                 :            :     // very old versions expect a CursorType here
    3934 [ #  # ][ #  # ]:          0 :     _rxOutStream->writeShort(DatabaseCursorType_KEYSET);
    3935                 :            : 
    3936 [ #  # ][ #  # ]:          0 :     _rxOutStream->writeBoolean(m_eNavigation != NavigationBarMode_NONE);
    3937                 :            : 
    3938                 :            :     // former DataEntry
    3939         [ #  # ]:          0 :     if (m_xAggregateSet.is())
    3940 [ #  # ][ #  # ]:          0 :         _rxOutStream->writeBoolean(getBOOL(m_xAggregateSet->getPropertyValue(PROPERTY_INSERTONLY)));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    3941                 :            :     else
    3942 [ #  # ][ #  # ]:          0 :         _rxOutStream->writeBoolean(sal_False);
    3943                 :            : 
    3944 [ #  # ][ #  # ]:          0 :     _rxOutStream->writeBoolean(m_bAllowInsert);
    3945 [ #  # ][ #  # ]:          0 :     _rxOutStream->writeBoolean(m_bAllowUpdate);
    3946 [ #  # ][ #  # ]:          0 :     _rxOutStream->writeBoolean(m_bAllowDelete);
    3947                 :            : 
    3948                 :            :     // html form stuff
    3949         [ #  # ]:          0 :     ::rtl::OUString sTmp = INetURLObject::decode( m_aTargetURL, '%', INetURLObject::DECODE_UNAMBIGUOUS);
    3950         [ #  # ]:          0 :     _rxOutStream << sTmp;
    3951 [ #  # ][ #  # ]:          0 :     _rxOutStream->writeShort( (sal_Int16)m_eSubmitMethod );
    3952 [ #  # ][ #  # ]:          0 :     _rxOutStream->writeShort( (sal_Int16)m_eSubmitEncoding );
    3953         [ #  # ]:          0 :     _rxOutStream << m_aTargetFrame;
    3954                 :            : 
    3955                 :            :     // version 2 didn't know some options and the "default" state
    3956                 :          0 :     sal_Int32 nCycle = TabulatorCycle_RECORDS;
    3957         [ #  # ]:          0 :     if (m_aCycle.hasValue())
    3958                 :            :     {
    3959                 :          0 :         ::cppu::enum2int(nCycle, m_aCycle);
    3960 [ #  # ][ #  # ]:          0 :         if (m_aCycle == TabulatorCycle_PAGE)
    3961                 :            :                 // unknown in earlier versions
    3962                 :          0 :             nCycle = TabulatorCycle_RECORDS;
    3963                 :            :     }
    3964 [ #  # ][ #  # ]:          0 :     _rxOutStream->writeShort((sal_Int16) nCycle);
    3965                 :            : 
    3966 [ #  # ][ #  # ]:          0 :     _rxOutStream->writeShort((sal_Int16)m_eNavigation);
    3967                 :            : 
    3968                 :          0 :     ::rtl::OUString sFilter;
    3969                 :          0 :     ::rtl::OUString sOrder;
    3970         [ #  # ]:          0 :     if (m_xAggregateSet.is())
    3971                 :            :     {
    3972 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->getPropertyValue(PROPERTY_FILTER) >>= sFilter;
                 [ #  # ]
    3973 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->getPropertyValue(PROPERTY_SORT) >>= sOrder;
                 [ #  # ]
    3974                 :            :     }
    3975         [ #  # ]:          0 :     _rxOutStream << sFilter;
    3976         [ #  # ]:          0 :     _rxOutStream << sOrder;
    3977                 :            : 
    3978                 :            : 
    3979                 :            :     // version 3
    3980                 :          0 :     sal_uInt16 nAnyMask = 0;
    3981         [ #  # ]:          0 :     if (m_aCycle.hasValue())
    3982                 :          0 :         nAnyMask |= CYCLE;
    3983                 :            : 
    3984 [ #  # ][ #  # ]:          0 :     if (m_xAggregateSet.is() && !getBOOL(m_xAggregateSet->getPropertyValue(PROPERTY_APPLYFILTER)))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    3985                 :          0 :         nAnyMask |= DONTAPPLYFILTER;
    3986                 :            : 
    3987 [ #  # ][ #  # ]:          0 :     _rxOutStream->writeShort(nAnyMask);
    3988                 :            : 
    3989         [ #  # ]:          0 :     if (nAnyMask & CYCLE)
    3990                 :            :     {
    3991                 :          0 :         sal_Int32 nRealCycle = 0;
    3992                 :          0 :         ::cppu::enum2int(nRealCycle, m_aCycle);
    3993 [ #  # ][ #  # ]:          0 :         _rxOutStream->writeShort((sal_Int16)nRealCycle);
    3994                 :          0 :     }
    3995                 :          0 : }
    3996                 :            : 
    3997                 :            : //------------------------------------------------------------------------------
    3998                 :          0 : void SAL_CALL ODatabaseForm::read(const Reference<XObjectInputStream>& _rxInStream) throw( IOException, RuntimeException )
    3999                 :            : {
    4000                 :            :     DBG_ASSERT(m_xAggregateSet.is(), "ODatabaseForm::read : only to be called if the aggregate exists !");
    4001                 :            : 
    4002         [ #  # ]:          0 :     OFormComponents::read(_rxInStream);
    4003                 :            : 
    4004                 :            :     // version
    4005 [ #  # ][ #  # ]:          0 :     sal_uInt16 nVersion = _rxInStream->readShort();
    4006                 :            : 
    4007         [ #  # ]:          0 :     _rxInStream >> m_sName;
    4008                 :            : 
    4009                 :          0 :     ::rtl::OUString sAggregateProp;
    4010         [ #  # ]:          0 :     _rxInStream >> sAggregateProp;
    4011         [ #  # ]:          0 :     if (m_xAggregateSet.is())
    4012 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->setPropertyValue(PROPERTY_DATASOURCE, makeAny(sAggregateProp));
         [ #  # ][ #  # ]
    4013         [ #  # ]:          0 :     _rxInStream >> sAggregateProp;
    4014         [ #  # ]:          0 :     if (m_xAggregateSet.is())
    4015 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->setPropertyValue(PROPERTY_COMMAND, makeAny(sAggregateProp));
         [ #  # ][ #  # ]
    4016                 :            : 
    4017         [ #  # ]:          0 :     _rxInStream >> m_aMasterFields;
    4018         [ #  # ]:          0 :     _rxInStream >> m_aDetailFields;
    4019                 :            : 
    4020 [ #  # ][ #  # ]:          0 :     sal_Int16 nCursorSourceType = _rxInStream->readShort();
    4021                 :          0 :     sal_Int32 nCommandType = 0;
    4022   [ #  #  #  # ]:          0 :     switch ((DataSelectionType)nCursorSourceType)
    4023                 :            :     {
    4024                 :          0 :         case DataSelectionType_TABLE : nCommandType = CommandType::TABLE; break;
    4025                 :          0 :         case DataSelectionType_QUERY : nCommandType = CommandType::QUERY; break;
    4026                 :            :         case DataSelectionType_SQL:
    4027                 :            :         case DataSelectionType_SQLPASSTHROUGH:
    4028                 :            :         {
    4029                 :          0 :             nCommandType = CommandType::COMMAND;
    4030                 :          0 :             sal_Bool bEscapeProcessing = ((DataSelectionType)nCursorSourceType) != DataSelectionType_SQLPASSTHROUGH;
    4031 [ #  # ][ #  # ]:          0 :             m_xAggregateSet->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, makeAny((sal_Bool)bEscapeProcessing));
         [ #  # ][ #  # ]
    4032                 :            :         }
    4033                 :          0 :         break;
    4034                 :            :         default : OSL_FAIL("ODatabaseForm::read : wrong CommandType !");
    4035                 :            :     }
    4036         [ #  # ]:          0 :     if (m_xAggregateSet.is())
    4037 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->setPropertyValue(PROPERTY_COMMANDTYPE, makeAny(nCommandType));
         [ #  # ][ #  # ]
    4038                 :            : 
    4039                 :            :     // obsolete
    4040 [ #  # ][ #  # ]:          0 :     _rxInStream->readShort();
    4041                 :            : 
    4042                 :            :     // navigation mode was a boolean in version 1
    4043                 :            :     // was a sal_Bool in version 1
    4044 [ #  # ][ #  # ]:          0 :     sal_Bool bNavigation = _rxInStream->readBoolean();
    4045         [ #  # ]:          0 :     if (nVersion == 1)
    4046         [ #  # ]:          0 :         m_eNavigation = bNavigation ? NavigationBarMode_CURRENT : NavigationBarMode_NONE;
    4047                 :            : 
    4048 [ #  # ][ #  # ]:          0 :     sal_Bool bInsertOnly = _rxInStream->readBoolean();
    4049         [ #  # ]:          0 :     if (m_xAggregateSet.is())
    4050 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->setPropertyValue(PROPERTY_INSERTONLY, makeAny(bInsertOnly));
         [ #  # ][ #  # ]
    4051                 :            : 
    4052 [ #  # ][ #  # ]:          0 :     m_bAllowInsert      = _rxInStream->readBoolean();
    4053 [ #  # ][ #  # ]:          0 :     m_bAllowUpdate      = _rxInStream->readBoolean();
    4054 [ #  # ][ #  # ]:          0 :     m_bAllowDelete      = _rxInStream->readBoolean();
    4055                 :            : 
    4056                 :            :     // html stuff
    4057                 :          0 :     ::rtl::OUString sTmp;
    4058         [ #  # ]:          0 :     _rxInStream >> sTmp;
    4059         [ #  # ]:          0 :     m_aTargetURL = INetURLObject::decode( sTmp, '%', INetURLObject::DECODE_UNAMBIGUOUS);
    4060 [ #  # ][ #  # ]:          0 :     m_eSubmitMethod     = (FormSubmitMethod)_rxInStream->readShort();
    4061 [ #  # ][ #  # ]:          0 :     m_eSubmitEncoding       = (FormSubmitEncoding)_rxInStream->readShort();
    4062         [ #  # ]:          0 :     _rxInStream >> m_aTargetFrame;
    4063                 :            : 
    4064         [ #  # ]:          0 :     if (nVersion > 1)
    4065                 :            :     {
    4066 [ #  # ][ #  # ]:          0 :         sal_Int32 nCycle = _rxInStream->readShort();
    4067         [ #  # ]:          0 :         m_aCycle = ::cppu::int2enum(nCycle, ::getCppuType(static_cast<const TabulatorCycle*>(NULL)));
    4068 [ #  # ][ #  # ]:          0 :         m_eNavigation = (NavigationBarMode)_rxInStream->readShort();
    4069                 :            : 
    4070         [ #  # ]:          0 :         _rxInStream >> sAggregateProp;
    4071 [ #  # ][ #  # ]:          0 :         setPropertyValue(PROPERTY_FILTER, makeAny(sAggregateProp));
                 [ #  # ]
    4072                 :            : 
    4073         [ #  # ]:          0 :         _rxInStream >> sAggregateProp;
    4074         [ #  # ]:          0 :         if (m_xAggregateSet.is())
    4075 [ #  # ][ #  # ]:          0 :             m_xAggregateSet->setPropertyValue(PROPERTY_SORT, makeAny(sAggregateProp));
         [ #  # ][ #  # ]
    4076                 :            :     }
    4077                 :            : 
    4078                 :          0 :     sal_uInt16 nAnyMask = 0;
    4079         [ #  # ]:          0 :     if (nVersion > 2)
    4080                 :            :     {
    4081 [ #  # ][ #  # ]:          0 :         nAnyMask = _rxInStream->readShort();
    4082         [ #  # ]:          0 :         if (nAnyMask & CYCLE)
    4083                 :            :         {
    4084 [ #  # ][ #  # ]:          0 :             sal_Int32 nCycle = _rxInStream->readShort();
    4085         [ #  # ]:          0 :             m_aCycle = ::cppu::int2enum(nCycle, ::getCppuType(static_cast<const TabulatorCycle*>(NULL)));
    4086                 :            :         }
    4087                 :            :         else
    4088                 :          0 :             m_aCycle.clear();
    4089                 :            :     }
    4090         [ #  # ]:          0 :     if (m_xAggregateSet.is())
    4091 [ #  # ][ #  # ]:          0 :         m_xAggregateSet->setPropertyValue(PROPERTY_APPLYFILTER, makeAny((sal_Bool)((nAnyMask & DONTAPPLYFILTER) == 0)));
         [ #  # ][ #  # ]
    4092                 :          0 : }
    4093                 :            : 
    4094                 :            : //------------------------------------------------------------------------------
    4095                 :        543 : void ODatabaseForm::implInserted( const ElementDescription* _pElement )
    4096                 :            : {
    4097         [ +  - ]:        543 :     OFormComponents::implInserted( _pElement );
    4098                 :            : 
    4099         [ +  - ]:        543 :     Reference< XSQLErrorBroadcaster >   xBroadcaster( _pElement->xInterface, UNO_QUERY );
    4100         [ +  - ]:        543 :     Reference< XForm >                  xForm       ( _pElement->xInterface, UNO_QUERY );
    4101                 :            : 
    4102 [ +  + ][ +  - ]:        543 :     if ( xBroadcaster.is() && !xForm.is() )
                 [ +  + ]
    4103                 :            :     {   // the object is an error broadcaster, but no form itself -> add ourself as listener
    4104 [ +  - ][ +  - ]:         50 :         xBroadcaster->addSQLErrorListener( this );
                 [ +  - ]
    4105                 :        543 :     }
    4106                 :        543 : }
    4107                 :            : 
    4108                 :            : //------------------------------------------------------------------------------
    4109                 :        443 : void ODatabaseForm::implRemoved(const InterfaceRef& _rxObject)
    4110                 :            : {
    4111         [ +  - ]:        443 :     OFormComponents::implRemoved( _rxObject );
    4112                 :            : 
    4113         [ +  - ]:        443 :     Reference<XSQLErrorBroadcaster>  xBroadcaster(_rxObject, UNO_QUERY);
    4114         [ +  - ]:        443 :     Reference<XForm>  xForm(_rxObject, UNO_QUERY);
    4115 [ +  + ][ +  - ]:        443 :     if (xBroadcaster.is() && !xForm.is())
                 [ +  + ]
    4116                 :            :     {   // the object is an error broadcaster, but no form itself -> remove ourself as listener
    4117 [ +  - ][ +  - ]:         42 :         xBroadcaster->removeSQLErrorListener(this);
                 [ +  - ]
    4118                 :        443 :     }
    4119                 :        443 : }
    4120                 :            : 
    4121                 :            : //------------------------------------------------------------------------------
    4122                 :          0 : void SAL_CALL ODatabaseForm::errorOccured(const SQLErrorEvent& _rEvent) throw( RuntimeException )
    4123                 :            : {
    4124                 :            :     // give it to my own error listener
    4125                 :          0 :     onError(_rEvent);
    4126                 :            :     // TODO : think about extending the chain with an SQLContext object saying
    4127                 :            :     // "this was an error of one of my children"
    4128                 :          0 : }
    4129                 :            : 
    4130                 :            : // com::sun::star::container::XNamed
    4131                 :            : //------------------------------------------------------------------------------
    4132                 :         38 : ::rtl::OUString SAL_CALL ODatabaseForm::getName() throw( RuntimeException )
    4133                 :            : {
    4134                 :         38 :     ::rtl::OUString sReturn;
    4135         [ +  - ]:         38 :     OPropertySetHelper::getFastPropertyValue(PROPERTY_ID_NAME) >>= sReturn;
    4136                 :         38 :     return sReturn;
    4137                 :            : }
    4138                 :            : 
    4139                 :            : //------------------------------------------------------------------------------
    4140                 :          0 : void SAL_CALL ODatabaseForm::setName(const ::rtl::OUString& aName) throw( RuntimeException )
    4141                 :            : {
    4142         [ #  # ]:          0 :     setFastPropertyValue(PROPERTY_ID_NAME, makeAny(aName));
    4143                 :          0 : }
    4144                 :            : 
    4145                 :            : //.........................................................................
    4146                 :            : }   // namespace frm
    4147                 :            : //.........................................................................
    4148                 :            : 
    4149                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10