LCOV - code coverage report
Current view: top level - libreoffice/svx/source/form - formcontrolling.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 9 179 5.0 %
Date: 2012-12-27 Functions: 3 37 8.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <sal/macros.h>
      22             : #include "formcontrolling.hxx"
      23             : #include "fmurl.hxx"
      24             : #include "svx/svxids.hrc"
      25             : #include "fmprop.hrc"
      26             : #include "svx/fmtools.hxx"
      27             : 
      28             : #include <com/sun/star/form/runtime/FormOperations.hpp>
      29             : #include <com/sun/star/form/runtime/FormFeature.hpp>
      30             : #include <com/sun/star/beans/XPropertySet.hpp>
      31             : #include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
      32             : 
      33             : #include <tools/diagnose_ex.h>
      34             : #include <comphelper/anytostring.hxx>
      35             : #include <cppuhelper/exc_hlp.hxx>
      36             : #include <osl/diagnose.h>
      37             : 
      38             : #include <functional>
      39             : #include <algorithm>
      40             : 
      41             : //........................................................................
      42             : namespace svx
      43             : {
      44             : //........................................................................
      45             : 
      46             :     /** === begin UNO using === **/
      47             :     using ::com::sun::star::uno::Reference;
      48             :     using ::com::sun::star::lang::XMultiServiceFactory;
      49             :     using ::com::sun::star::form::runtime::XFormController;
      50             :     using ::com::sun::star::form::XForm;
      51             :     using ::com::sun::star::form::runtime::FormOperations;
      52             :     using ::com::sun::star::uno::Exception;
      53             :     using ::com::sun::star::sdbc::XRowSet;
      54             :     using ::com::sun::star::form::runtime::FeatureState;
      55             :     using ::com::sun::star::uno::Any;
      56             :     using ::com::sun::star::uno::Sequence;
      57             :     using ::com::sun::star::beans::NamedValue;
      58             :     using ::com::sun::star::uno::RuntimeException;
      59             :     using ::com::sun::star::beans::XPropertySet;
      60             :     using ::com::sun::star::uno::UNO_QUERY_THROW;
      61             :     using ::com::sun::star::sdbc::SQLException;
      62             :     using ::com::sun::star::sdb::XSQLErrorBroadcaster;
      63             :     using ::com::sun::star::sdb::SQLErrorEvent;
      64             :     using ::com::sun::star::lang::EventObject;
      65             :     /** === end UNO using === **/
      66             :     namespace FormFeature = ::com::sun::star::form::runtime::FormFeature;
      67             : 
      68             :     //====================================================================
      69             :     //= FeatureSlotTranslation
      70             :     //====================================================================
      71             :     namespace
      72             :     {
      73           0 :         struct FeatureDescription
      74             :         {
      75             :             ::rtl::OUString sURL;           // the URL
      76             :             sal_Int32       nSlotId;        // the SFX-compatible slot ID
      77             :             sal_Int16       nFormFeature;   // the css.form.runtime.FormFeature ID
      78             :         };
      79             :         typedef ::std::vector< FeatureDescription > FeatureDescriptions;
      80             : 
      81             :         //................................................................
      82           0 :         const FeatureDescriptions& getFeatureDescriptions()
      83             :         {
      84           0 :             static FeatureDescriptions s_aFeatureDescriptions;
      85           0 :             if ( s_aFeatureDescriptions.empty() )
      86             :             {
      87           0 :                 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      88           0 :                 if ( s_aFeatureDescriptions.empty() )
      89             :                 {
      90             :                     FeatureDescription aDescriptions[] = {
      91             :                         { FMURL_FORM_POSITION,        SID_FM_RECORD_ABSOLUTE,     FormFeature::MoveAbsolute },
      92             :                         { FMURL_FORM_RECORDCOUNT,     SID_FM_RECORD_TOTAL,        FormFeature::TotalRecords },
      93             :                         { FMURL_RECORD_MOVEFIRST,     SID_FM_RECORD_FIRST,        FormFeature::MoveToFirst },
      94             :                         { FMURL_RECORD_MOVEPREV,      SID_FM_RECORD_PREV,         FormFeature::MoveToPrevious },
      95             :                         { FMURL_RECORD_MOVENEXT,      SID_FM_RECORD_NEXT,         FormFeature::MoveToNext },
      96             :                         { FMURL_RECORD_MOVELAST,      SID_FM_RECORD_LAST,         FormFeature::MoveToLast },
      97             :                         { FMURL_RECORD_MOVETONEW,     SID_FM_RECORD_NEW,          FormFeature::MoveToInsertRow },
      98             :                         { FMURL_RECORD_SAVE,          SID_FM_RECORD_SAVE,         FormFeature::SaveRecordChanges },
      99             :                         { FMURL_RECORD_DELETE,        SID_FM_RECORD_DELETE,       FormFeature::DeleteRecord },
     100             :                         { FMURL_FORM_REFRESH,         SID_FM_REFRESH,             FormFeature::ReloadForm },
     101             :                         { FMURL_FORM_REFRESH_CURRENT_CONTROL,
     102             :                                                       SID_FM_REFRESH_FORM_CONTROL,FormFeature::RefreshCurrentControl },
     103             :                         { FMURL_RECORD_UNDO,          SID_FM_RECORD_UNDO,         FormFeature::UndoRecordChanges },
     104             :                         { FMURL_FORM_SORT_UP,         SID_FM_SORTUP,              FormFeature::SortAscending },
     105             :                         { FMURL_FORM_SORT_DOWN,       SID_FM_SORTDOWN,            FormFeature::SortDescending },
     106             :                         { FMURL_FORM_SORT,            SID_FM_ORDERCRIT,           FormFeature::InteractiveSort },
     107             :                         { FMURL_FORM_AUTO_FILTER,     SID_FM_AUTOFILTER,          FormFeature::AutoFilter },
     108             :                         { FMURL_FORM_FILTER,          SID_FM_FILTERCRIT,          FormFeature::InteractiveFilter },
     109             :                         { FMURL_FORM_APPLY_FILTER,    SID_FM_FORM_FILTERED,       FormFeature::ToggleApplyFilter },
     110             :                         { FMURL_FORM_REMOVE_FILTER,   SID_FM_REMOVE_FILTER_SORT,  FormFeature::RemoveFilterAndSort }
     111           0 :                     };
     112           0 :                     for ( size_t i=0; i<sizeof(aDescriptions)/sizeof(aDescriptions[0]); ++i )
     113           0 :                         s_aFeatureDescriptions.push_back( aDescriptions[i] );
     114           0 :                 }
     115             :             };
     116           0 :             return s_aFeatureDescriptions;
     117             :         }
     118             :     }
     119             : 
     120             :     //--------------------------------------------------------------------
     121             :     namespace
     122             :     {
     123             :         //................................................................
     124             :         struct MatchFeatureDescriptionByURL : public ::std::unary_function< FeatureDescription, bool >
     125             :         {
     126             :             const ::rtl::OUString&  m_rURL;
     127           0 :             MatchFeatureDescriptionByURL( const ::rtl::OUString& _rURL ) :m_rURL( _rURL ) { }
     128             : 
     129           0 :             bool operator()( const FeatureDescription& _compare )
     130             :             {
     131           0 :                 return m_rURL == _compare.sURL;
     132             :             }
     133             :         };
     134             : 
     135             :         //................................................................
     136             :         struct MatchFeatureDescriptionBySlotId : public ::std::unary_function< FeatureDescription, bool >
     137             :         {
     138             :             sal_Int32   m_nSlotId;
     139           0 :             MatchFeatureDescriptionBySlotId( sal_Int32 _nSlotId ) :m_nSlotId( _nSlotId ) { }
     140             : 
     141           0 :             bool operator()( const FeatureDescription& _compare )
     142             :             {
     143           0 :                 return m_nSlotId == _compare.nSlotId;
     144             :             }
     145             :         };
     146             : 
     147             :         //................................................................
     148             :         struct MatchFeatureDescriptionByFormFeature : public ::std::unary_function< FeatureDescription, bool >
     149             :         {
     150             :             sal_Int32   m_nFormFeature;
     151           0 :             MatchFeatureDescriptionByFormFeature( sal_Int32 _nFormFeature ) :m_nFormFeature( _nFormFeature ) { }
     152             : 
     153           0 :             bool operator()( const FeatureDescription& _compare )
     154             :             {
     155           0 :                 return m_nFormFeature == _compare.nFormFeature;
     156             :             }
     157             :         };
     158             : 
     159             :         //................................................................
     160             :         struct FormFeatureToSlotId : public ::std::unary_function< sal_Int16, sal_Int32 >
     161             :         {
     162           0 :             sal_Int32 operator()( sal_Int16 _FormFeature )
     163             :             {
     164           0 :                 return FeatureSlotTranslation::getSlotIdForFormFeature( _FormFeature );
     165             :             }
     166             :         };
     167             :     }
     168             : 
     169             :     //--------------------------------------------------------------------
     170           0 :     sal_Int32 FeatureSlotTranslation::getControllerFeatureSlotIdForURL( const ::rtl::OUString& _rMainURL )
     171             :     {
     172           0 :         const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
     173           0 :         FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionByURL( _rMainURL ) );
     174           0 :         return ( pos != rDescriptions.end() ) ? pos->nSlotId : -1;
     175             :     }
     176             : 
     177             :     //--------------------------------------------------------------------
     178           0 :     sal_Int16 FeatureSlotTranslation::getFormFeatureForSlotId( sal_Int32 _nSlotId )
     179             :     {
     180           0 :         const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
     181           0 :         FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionBySlotId( _nSlotId ) );
     182             :         OSL_ENSURE( pos != rDescriptions.end(), "FeatureSlotTranslation::getFormFeatureForSlotId: not found!" );
     183           0 :         return ( pos != rDescriptions.end() ) ? pos->nFormFeature : -1;
     184             :     }
     185             : 
     186             :     //--------------------------------------------------------------------
     187           0 :     sal_Int32 FeatureSlotTranslation::getSlotIdForFormFeature( sal_Int16 _nFormFeature )
     188             :     {
     189           0 :         const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
     190           0 :         FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionByFormFeature( _nFormFeature ) );
     191             :         OSL_ENSURE( pos != rDescriptions.end(), "FeatureSlotTranslation::getSlotIdForFormFeature: not found!" );
     192           0 :         return ( pos != rDescriptions.end() ) ? pos->nSlotId : -1;
     193             :     }
     194             : 
     195             :     //====================================================================
     196             :     //= ControllerFeatures
     197             :     //====================================================================
     198             :     //--------------------------------------------------------------------
     199         472 :     ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB, IControllerFeatureInvalidation* _pInvalidationCallback )
     200             :         :m_aContext( _rxORB )
     201             :         ,m_pInvalidationCallback( _pInvalidationCallback )
     202         472 :         ,m_pImpl( NULL )
     203             :     {
     204         472 :     }
     205             : 
     206             :     //--------------------------------------------------------------------
     207           0 :     ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB,
     208             :             const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
     209             :         :m_aContext( _rxORB )
     210             :         ,m_pInvalidationCallback( _pInvalidationCallback )
     211           0 :         ,m_pImpl( NULL )
     212             :     {
     213           0 :         assign( _rxController );
     214           0 :     }
     215             : 
     216             :     //--------------------------------------------------------------------
     217           0 :     void ControllerFeatures::assign( const Reference< XFormController >& _rxController )
     218             :     {
     219           0 :         dispose();
     220           0 :         m_pImpl = new FormControllerHelper( m_aContext, _rxController, m_pInvalidationCallback );
     221           0 :         m_pImpl->acquire();
     222           0 :     }
     223             : 
     224             :     //--------------------------------------------------------------------
     225         252 :     ControllerFeatures::~ControllerFeatures()
     226             :     {
     227         126 :         dispose();
     228         126 :     }
     229             : 
     230             :     //--------------------------------------------------------------------
     231         252 :     void ControllerFeatures::dispose()
     232             :     {
     233         252 :         if ( m_pImpl )
     234             :         {
     235           0 :             m_pImpl->dispose();
     236           0 :             m_pImpl->release();
     237           0 :             m_pImpl = NULL;
     238             :         }
     239         252 :     }
     240             : 
     241             :     //====================================================================
     242             :     //= FormControllerHelper
     243             :     //====================================================================
     244             :     //--------------------------------------------------------------------
     245           0 :     FormControllerHelper::FormControllerHelper( const ::comphelper::ComponentContext& _rContext,
     246             :             const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
     247             :         :m_aContext( _rContext )
     248           0 :         ,m_pInvalidationCallback( _pInvalidationCallback )
     249             :     {
     250           0 :         osl_atomic_increment( &m_refCount );
     251             :         try
     252             :         {
     253           0 :             m_xFormOperations = FormOperations::createWithFormController( m_aContext.getUNOContext(), _rxController );
     254           0 :             if ( m_xFormOperations.is() )
     255           0 :                 m_xFormOperations->setFeatureInvalidation( this );
     256             : 
     257             :             // to prevent the controller from displaying any error messages which happen while we operate on it,
     258             :             // we add ourself as XSQLErrorListener. By contract, a FormController displays errors if and only if
     259             :             // no SQLErrorListeners are registered.
     260           0 :             Reference< XSQLErrorBroadcaster > xErrorBroadcast( _rxController, UNO_QUERY_THROW );
     261           0 :             xErrorBroadcast->addSQLErrorListener( this );
     262             :         }
     263           0 :         catch( const Exception& )
     264             :         {
     265             :             DBG_UNHANDLED_EXCEPTION();
     266             :         }
     267           0 :         osl_atomic_decrement( &m_refCount );
     268           0 :     }
     269             : 
     270             :     //--------------------------------------------------------------------
     271           0 :     FormControllerHelper::~FormControllerHelper( )
     272             :     {
     273             :         try
     274             :         {
     275           0 :             acquire();
     276           0 :             dispose();
     277             :         }
     278           0 :         catch( const Exception& )
     279             :         {
     280             :             DBG_UNHANDLED_EXCEPTION();
     281             :         }
     282           0 :     }
     283             : 
     284             :     //--------------------------------------------------------------------
     285           0 :     void FormControllerHelper::dispose()
     286             :     {
     287           0 :         if ( m_xFormOperations.is() )
     288           0 :             m_xFormOperations->dispose();
     289           0 :         m_xFormOperations.clear();
     290           0 :     }
     291             : 
     292             :     //--------------------------------------------------------------------
     293           0 :     sal_Bool FormControllerHelper::isEnabled( sal_Int32 _nSlotId ) const
     294             :     {
     295           0 :         if ( !m_xFormOperations.is() )
     296           0 :             return sal_False;
     297           0 :         return m_xFormOperations->isEnabled( FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ) );
     298             :     }
     299             : 
     300             :     //--------------------------------------------------------------------
     301           0 :     Reference< XRowSet > FormControllerHelper::getCursor() const
     302             :     {
     303           0 :         Reference< XRowSet > xCursor;
     304           0 :         if ( m_xFormOperations.is() )
     305           0 :             xCursor = m_xFormOperations->getCursor();
     306           0 :         return xCursor;
     307             :     }
     308             : 
     309             :     //--------------------------------------------------------------------
     310           0 :     void FormControllerHelper::getState( sal_Int32 _nSlotId, FeatureState& _rState ) const
     311             :     {
     312           0 :         if ( m_xFormOperations.is() )
     313           0 :             _rState = m_xFormOperations->getState( FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ) );
     314           0 :     }
     315             : 
     316             :     //--------------------------------------------------------------------
     317           0 :     sal_Bool FormControllerHelper::commitCurrentControl( ) const
     318             :     {
     319           0 :         return impl_operateForm_nothrow( COMMIT_CONTROL );
     320             :     }
     321             : 
     322             :     //--------------------------------------------------------------------
     323           0 :     sal_Bool FormControllerHelper::commitCurrentRecord() const
     324             :     {
     325           0 :         return impl_operateForm_nothrow( COMMIT_RECORD );
     326             :     }
     327             : 
     328             :     //--------------------------------------------------------------------
     329           0 :     void FormControllerHelper::execute( sal_Int32 _nSlotId, const ::rtl::OUString& _rParamName, const Any& _rParamValue ) const
     330             :     {
     331           0 :         Sequence< NamedValue > aArguments(1);
     332           0 :         aArguments[0].Name = _rParamName;
     333           0 :         aArguments[0].Value = _rParamValue;
     334             : 
     335           0 :         impl_operateForm_nothrow( EXECUTE_ARGS, FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ), aArguments );
     336           0 :     }
     337             : 
     338             :     //--------------------------------------------------------------------
     339           0 :     bool FormControllerHelper::impl_operateForm_nothrow( const FormOperation _eWhat, const sal_Int16 _nFeature,
     340             :             const Sequence< NamedValue >& _rArguments ) const
     341             :     {
     342           0 :         if ( !m_xFormOperations.is() )
     343           0 :             return false;
     344             : 
     345           0 :         Any aError;
     346           0 :         bool bSuccess = false;
     347           0 :         const_cast< FormControllerHelper* >( this )->m_aOperationError.clear();
     348             :         try
     349             :         {
     350           0 :             switch ( _eWhat )
     351             :             {
     352             :             case COMMIT_CONTROL:
     353           0 :                 bSuccess = m_xFormOperations->commitCurrentControl();
     354           0 :                 break;
     355             : 
     356             :             case COMMIT_RECORD:
     357             :             {
     358           0 :                 sal_Bool bDummy( sal_False );
     359           0 :                 bSuccess = m_xFormOperations->commitCurrentRecord( bDummy );
     360             :             }
     361           0 :             break;
     362             : 
     363             :             case EXECUTE:
     364           0 :                 m_xFormOperations->execute( _nFeature );
     365           0 :                 bSuccess = true;
     366           0 :                 break;
     367             : 
     368             :             case EXECUTE_ARGS:
     369           0 :                 m_xFormOperations->executeWithArguments( _nFeature, _rArguments );
     370           0 :                 bSuccess = true;
     371           0 :                 break;
     372             :             }
     373             :         }
     374           0 :         catch ( const SQLException& )
     375             :         {
     376           0 :             aError = ::cppu::getCaughtException();
     377             :         }
     378           0 :         catch( const Exception& )
     379             :         {
     380           0 :             SQLException aFallbackError;
     381           0 :             aFallbackError.Message = ::comphelper::anyToString( ::cppu::getCaughtException() );
     382           0 :             aError <<= aFallbackError;
     383             :         }
     384             : 
     385           0 :         if ( bSuccess )
     386           0 :             return true;
     387             : 
     388             :         // display the error. Prefer the one reported in errorOccurred over the one caught.
     389           0 :         if ( m_aOperationError.hasValue() )
     390           0 :             displayException( m_aOperationError );
     391           0 :         else if ( aError.hasValue() )
     392           0 :             displayException( aError );
     393             :         else
     394             :             OSL_FAIL( "FormControllerHelper::impl_operateForm_nothrow: no success, but no error?" );
     395             : 
     396           0 :         return false;
     397             :     }
     398             : 
     399             :     //--------------------------------------------------------------------
     400           0 :     void FormControllerHelper::execute( sal_Int32 _nSlotId ) const
     401             :     {
     402           0 :         impl_operateForm_nothrow( EXECUTE, FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ),
     403           0 :             Sequence< NamedValue >() );
     404           0 :     }
     405             : 
     406             :     //--------------------------------------------------------------------
     407           0 :     void SAL_CALL FormControllerHelper::invalidateFeatures( const Sequence< ::sal_Int16 >& _Features ) throw (RuntimeException)
     408             :     {
     409           0 :         if ( !m_pInvalidationCallback )
     410             :             // nobody's interested in ...
     411           0 :             return;
     412             : 
     413           0 :         ::std::vector< sal_Int32 > aFeatures( _Features.getLength() );
     414             :         ::std::transform(
     415             :             _Features.getConstArray(),
     416           0 :             _Features.getConstArray() + _Features.getLength(),
     417             :             aFeatures.begin(),
     418             :             FormFeatureToSlotId()
     419           0 :         );
     420             : 
     421           0 :         m_pInvalidationCallback->invalidateFeatures( aFeatures );
     422             :     }
     423             : 
     424             :     //--------------------------------------------------------------------
     425           0 :     void SAL_CALL FormControllerHelper::invalidateAllFeatures() throw (RuntimeException)
     426             :     {
     427           0 :         if ( !m_pInvalidationCallback )
     428             :             // nobody's interested in ...
     429           0 :             return;
     430             : 
     431             :         // actually, it's a little bit more than the supported features,
     432             :         // but on the medium term, we are to support everything listed
     433             :         // here
     434           0 :         ::std::vector< sal_Int32 > aSupportedFeatures;
     435             :         sal_Int32 pSupportedFeatures[] =
     436             :         {
     437             :             SID_FM_RECORD_FIRST,
     438             :             SID_FM_RECORD_NEXT,
     439             :             SID_FM_RECORD_PREV,
     440             :             SID_FM_RECORD_LAST,
     441             :             SID_FM_RECORD_NEW,
     442             :             SID_FM_RECORD_DELETE,
     443             :             SID_FM_RECORD_ABSOLUTE,
     444             :             SID_FM_RECORD_TOTAL,
     445             :             SID_FM_RECORD_SAVE,
     446             :             SID_FM_RECORD_UNDO,
     447             :             SID_FM_REMOVE_FILTER_SORT,
     448             :             SID_FM_SORTUP,
     449             :             SID_FM_SORTDOWN,
     450             :             SID_FM_ORDERCRIT,
     451             :             SID_FM_AUTOFILTER,
     452             :             SID_FM_FILTERCRIT,
     453             :             SID_FM_FORM_FILTERED,
     454             :             SID_FM_REFRESH,
     455             :             SID_FM_REFRESH_FORM_CONTROL,
     456             :             SID_FM_SEARCH,
     457             :             SID_FM_FILTER_START,
     458             :             SID_FM_VIEW_AS_GRID
     459           0 :         };
     460           0 :         sal_Int32 nFeatureCount = sizeof( pSupportedFeatures ) / sizeof( pSupportedFeatures[ 0 ] );
     461           0 :         aSupportedFeatures.resize( nFeatureCount );
     462           0 :         ::std::copy( pSupportedFeatures, pSupportedFeatures + nFeatureCount, aSupportedFeatures.begin() );
     463             : 
     464           0 :         m_pInvalidationCallback->invalidateFeatures( aSupportedFeatures );
     465             :     }
     466             : 
     467             :     //--------------------------------------------------------------------
     468           0 :     void SAL_CALL FormControllerHelper::errorOccured( const SQLErrorEvent& _Event ) throw (RuntimeException)
     469             :     {
     470             :         OSL_ENSURE( !m_aOperationError.hasValue(), "FormControllerHelper::errorOccurred: two errors during one operation?" );
     471           0 :         m_aOperationError = _Event.Reason;
     472           0 :     }
     473             : 
     474             :     //--------------------------------------------------------------------
     475           0 :     void SAL_CALL FormControllerHelper::disposing( const EventObject& /*_Source*/ ) throw (RuntimeException)
     476             :     {
     477             :         // not interested in
     478           0 :     }
     479             : 
     480             :     //--------------------------------------------------------------------
     481           0 :     sal_Bool FormControllerHelper::isInsertionRow() const
     482             :     {
     483           0 :         sal_Bool bIs = sal_False;
     484           0 :         if ( m_xFormOperations.is() )
     485           0 :             bIs = m_xFormOperations->isInsertionRow();
     486           0 :         return bIs;
     487             :     }
     488             : 
     489             :     //--------------------------------------------------------------------
     490           0 :     sal_Bool FormControllerHelper::isModifiedRow() const
     491             :     {
     492           0 :         sal_Bool bIs = sal_False;
     493           0 :         if ( m_xFormOperations.is() )
     494           0 :             bIs = m_xFormOperations->isModifiedRow();
     495           0 :         return bIs;
     496             :     }
     497             :     //--------------------------------------------------------------------
     498           0 :     bool FormControllerHelper::canDoFormFilter() const
     499             :     {
     500           0 :         if ( !m_xFormOperations.is() )
     501           0 :             return false;
     502             : 
     503           0 :         bool bCanDo = false;
     504             :         try
     505             :         {
     506           0 :             Reference< XPropertySet > xCursorProperties( m_xFormOperations->getCursor(), UNO_QUERY_THROW );
     507             : 
     508           0 :             bool bEscapeProcessing( false );
     509           0 :             OSL_VERIFY( xCursorProperties->getPropertyValue( FM_PROP_ESCAPE_PROCESSING ) >>= bEscapeProcessing );
     510             : 
     511           0 :             ::rtl::OUString sActiveCommand;
     512           0 :             OSL_VERIFY( xCursorProperties->getPropertyValue( FM_PROP_ACTIVECOMMAND ) >>= sActiveCommand );
     513             : 
     514           0 :             bool bInsertOnlyForm( false );
     515           0 :             OSL_VERIFY( xCursorProperties->getPropertyValue( FM_PROP_INSERTONLY ) >>= bInsertOnlyForm );
     516             : 
     517           0 :             bCanDo = bEscapeProcessing && !sActiveCommand.isEmpty() && !bInsertOnlyForm;
     518             :         }
     519           0 :         catch( const Exception& )
     520             :         {
     521             :             DBG_UNHANDLED_EXCEPTION();
     522             :         }
     523           0 :         return bCanDo;
     524             :     }
     525             : 
     526             : //........................................................................
     527             : }   // namespace svx
     528             : //........................................................................
     529             : 
     530             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10