summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-05-19 16:14:08 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-05-19 16:14:08 +0000
commit274ad24f8085df4f5ac667fd1ed211b23758ec68 (patch)
tree7ed013ff4c346096c9914fda19434aacd0ed93d3 /svx
parent807fa686e6e3edaf63bc8f542a6eae88b2295ae3 (diff)
#i10000#: fix CRLF. Sigh
Diffstat (limited to 'svx')
-rw-r--r--svx/source/form/formcontrolling.cxx1216
-rw-r--r--svx/source/inc/formcontrolling.hxx622
-rw-r--r--svx/source/outliner/outlobj.cxx2
-rw-r--r--svx/source/svdraw/svdoole2.cxx84
4 files changed, 962 insertions, 962 deletions
diff --git a/svx/source/form/formcontrolling.cxx b/svx/source/form/formcontrolling.cxx
index 668267e141..e3f2a48efc 100644
--- a/svx/source/form/formcontrolling.cxx
+++ b/svx/source/form/formcontrolling.cxx
@@ -1,608 +1,608 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: formcontrolling.cxx,v $
- * $Revision: 1.13 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svx.hxx"
-
-#include "formcontrolling.hxx"
-#include "fmurl.hxx"
-#include <svx/svxids.hrc>
-#include "fmprop.hrc"
-#include "fmtools.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/form/runtime/FormOperations.hpp>
-#include <com/sun/star/form/runtime/FormFeature.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
-/** === end UNO includes === **/
-
-#include <tools/diagnose_ex.h>
-#include <comphelper/anytostring.hxx>
-#include <cppuhelper/exc_hlp.hxx>
-#include <osl/diagnose.h>
-
-#include <functional>
-#include <algorithm>
-
-//........................................................................
-namespace svx
-{
-//........................................................................
-
- using namespace ::svxform;
- /** === begin UNO using === **/
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::lang::XMultiServiceFactory;
- using ::com::sun::star::form::XFormController;
- using ::com::sun::star::form::XForm;
- using ::com::sun::star::form::runtime::FormOperations;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::sdbc::XRowSet;
- using ::com::sun::star::form::runtime::FeatureState;
- using ::com::sun::star::uno::Any;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::beans::NamedValue;
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::beans::XPropertySet;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::sdbc::SQLException;
- using ::com::sun::star::sdb::XSQLErrorBroadcaster;
- using ::com::sun::star::sdb::SQLErrorEvent;
- using ::com::sun::star::lang::EventObject;
- /** === end UNO using === **/
- namespace FormFeature = ::com::sun::star::form::runtime::FormFeature;
-
- //====================================================================
- //= FeatureSlotTranslation
- //====================================================================
- namespace
- {
- struct FeatureDescription
- {
- ::rtl::OUString sURL; // the URL
- sal_Int32 nSlotId; // the SFX-compatible slot ID
- sal_Int16 nFormFeature; // the css.form.runtime.FormFeature ID
- };
- typedef ::std::vector< FeatureDescription > FeatureDescriptions;
-
- //................................................................
- const FeatureDescriptions& getFeatureDescriptions()
- {
- static FeatureDescriptions s_aFeatureDescriptions;
- if ( s_aFeatureDescriptions.empty() )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( s_aFeatureDescriptions.empty() )
- {
- FeatureDescription aDescriptions[] = {
- { FMURL_FORM_POSITION, SID_FM_RECORD_ABSOLUTE, FormFeature::MoveAbsolute },
- { FMURL_FORM_RECORDCOUNT, SID_FM_RECORD_TOTAL, FormFeature::TotalRecords },
- { FMURL_RECORD_MOVEFIRST, SID_FM_RECORD_FIRST, FormFeature::MoveToFirst },
- { FMURL_RECORD_MOVEPREV, SID_FM_RECORD_PREV, FormFeature::MoveToPrevious },
- { FMURL_RECORD_MOVENEXT, SID_FM_RECORD_NEXT, FormFeature::MoveToNext },
- { FMURL_RECORD_MOVELAST, SID_FM_RECORD_LAST, FormFeature::MoveToLast },
- { FMURL_RECORD_MOVETONEW, SID_FM_RECORD_NEW, FormFeature::MoveToInsertRow },
- { FMURL_RECORD_SAVE, SID_FM_RECORD_SAVE, FormFeature::SaveRecordChanges },
- { FMURL_RECORD_DELETE, SID_FM_RECORD_DELETE, FormFeature::DeleteRecord },
- { FMURL_FORM_REFRESH, SID_FM_REFRESH, FormFeature::ReloadForm },
- { FMURL_FORM_REFRESH_CURRENT_CONTROL,
- SID_FM_REFRESH_FORM_CONTROL,FormFeature::RefreshCurrentControl },
- { FMURL_RECORD_UNDO, SID_FM_RECORD_UNDO, FormFeature::UndoRecordChanges },
- { FMURL_FORM_SORT_UP, SID_FM_SORTUP, FormFeature::SortAscending },
- { FMURL_FORM_SORT_DOWN, SID_FM_SORTDOWN, FormFeature::SortDescending },
- { FMURL_FORM_SORT, SID_FM_ORDERCRIT, FormFeature::InteractiveSort },
- { FMURL_FORM_AUTO_FILTER, SID_FM_AUTOFILTER, FormFeature::AutoFilter },
- { FMURL_FORM_FILTER, SID_FM_FILTERCRIT, FormFeature::InteractiveFilter },
- { FMURL_FORM_APPLY_FILTER, SID_FM_FORM_FILTERED, FormFeature::ToggleApplyFilter },
- { FMURL_FORM_REMOVE_FILTER, SID_FM_REMOVE_FILTER_SORT, FormFeature::RemoveFilterAndSort }
- };
- for ( size_t i=0; i<sizeof(aDescriptions)/sizeof(aDescriptions[0]); ++i )
- s_aFeatureDescriptions.push_back( aDescriptions[i] );
- }
- };
- return s_aFeatureDescriptions;
- }
- }
-
- //--------------------------------------------------------------------
- namespace
- {
- //................................................................
- struct MatchFeatureDescriptionByURL : public ::std::unary_function< FeatureDescription, bool >
- {
- const ::rtl::OUString& m_rURL;
- MatchFeatureDescriptionByURL( const ::rtl::OUString& _rURL ) :m_rURL( _rURL ) { }
-
- bool operator()( const FeatureDescription& _compare )
- {
- return m_rURL == _compare.sURL;
- }
- };
-
- //................................................................
- struct MatchFeatureDescriptionBySlotId : public ::std::unary_function< FeatureDescription, bool >
- {
- sal_Int32 m_nSlotId;
- MatchFeatureDescriptionBySlotId( sal_Int32 _nSlotId ) :m_nSlotId( _nSlotId ) { }
-
- bool operator()( const FeatureDescription& _compare )
- {
- return m_nSlotId == _compare.nSlotId;
- }
- };
-
- //................................................................
- struct MatchFeatureDescriptionByFormFeature : public ::std::unary_function< FeatureDescription, bool >
- {
- sal_Int32 m_nFormFeature;
- MatchFeatureDescriptionByFormFeature( sal_Int32 _nFormFeature ) :m_nFormFeature( _nFormFeature ) { }
-
- bool operator()( const FeatureDescription& _compare )
- {
- return m_nFormFeature == _compare.nFormFeature;
- }
- };
-
- //................................................................
- struct FormFeatureToSlotId : public ::std::unary_function< sal_Int16, sal_Int32 >
- {
- sal_Int32 operator()( sal_Int16 _FormFeature )
- {
- return FeatureSlotTranslation::getSlotIdForFormFeature( _FormFeature );
- }
- };
- }
-
- //--------------------------------------------------------------------
- sal_Int32 FeatureSlotTranslation::getControllerFeatureSlotIdForURL( const ::rtl::OUString& _rMainURL )
- {
- const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
- FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionByURL( _rMainURL ) );
- return ( pos != rDescriptions.end() ) ? pos->nSlotId : -1;
- }
-
- //--------------------------------------------------------------------
- ::rtl::OUString FeatureSlotTranslation::getControllerFeatureURLForSlotId( sal_Int32 _nSlotId )
- {
- const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
- FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionBySlotId( _nSlotId ) );
- OSL_ENSURE( pos != rDescriptions.end(), "FeatureSlotTranslation::getControllerFeatureURLForSlotId: not found!" );
- return ( pos != rDescriptions.end() ) ? pos->sURL : ::rtl::OUString();
- }
-
- //--------------------------------------------------------------------
- sal_Bool FeatureSlotTranslation::isFeatureURL( const ::rtl::OUString& _rMainURL )
- {
- return ( _rMainURL.indexOf( FMURL_FORMSLOTS_PREFIX ) == 0 );
- }
-
- //--------------------------------------------------------------------
- sal_Int16 FeatureSlotTranslation::getFormFeatureForSlotId( sal_Int32 _nSlotId )
- {
- const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
- FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionBySlotId( _nSlotId ) );
- OSL_ENSURE( pos != rDescriptions.end(), "FeatureSlotTranslation::getFormFeatureForSlotId: not found!" );
- return ( pos != rDescriptions.end() ) ? pos->nFormFeature : -1;
- }
-
- //--------------------------------------------------------------------
- sal_Int32 FeatureSlotTranslation::getSlotIdForFormFeature( sal_Int16 _nFormFeature )
- {
- const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
- FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionByFormFeature( _nFormFeature ) );
- OSL_ENSURE( pos != rDescriptions.end(), "FeatureSlotTranslation::getSlotIdForFormFeature: not found!" );
- return ( pos != rDescriptions.end() ) ? pos->nSlotId : -1;
- }
-
- //====================================================================
- //= ControllerFeatures
- //====================================================================
- //--------------------------------------------------------------------
- ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB, IControllerFeatureInvalidation* _pInvalidationCallback )
- :m_aContext( _rxORB )
- ,m_pInvalidationCallback( _pInvalidationCallback )
- ,m_pImpl( NULL )
- {
- }
-
- //--------------------------------------------------------------------
- ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB,
- const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
- :m_aContext( _rxORB )
- ,m_pInvalidationCallback( _pInvalidationCallback )
- ,m_pImpl( NULL )
- {
- assign( _rxController );
- }
-
- //--------------------------------------------------------------------
- ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB,
- const Reference< XForm >& _rxForm, IControllerFeatureInvalidation* _pInvalidationCallback )
- :m_aContext( _rxORB )
- ,m_pInvalidationCallback( _pInvalidationCallback )
- ,m_pImpl( NULL )
- {
- assign( _rxForm );
- }
-
- //--------------------------------------------------------------------
- void ControllerFeatures::assign( const Reference< XFormController >& _rxController )
- {
- dispose();
- m_pImpl = new FormControllerHelper( m_aContext, _rxController, m_pInvalidationCallback );
- m_pImpl->acquire();
- }
-
- //--------------------------------------------------------------------
- void ControllerFeatures::assign( const Reference< XForm >& _rxForm )
- {
- dispose();
- m_pImpl = new FormControllerHelper( m_aContext, _rxForm, m_pInvalidationCallback );
- m_pImpl->acquire();
- }
-
- //--------------------------------------------------------------------
- ControllerFeatures::~ControllerFeatures()
- {
- dispose();
- }
-
- //--------------------------------------------------------------------
- void ControllerFeatures::dispose()
- {
- if ( m_pImpl )
- {
- m_pImpl->dispose();
- m_pImpl->release();
- m_pImpl = NULL;
- }
- }
-
- //====================================================================
- //= FormControllerHelper
- //====================================================================
- //--------------------------------------------------------------------
- FormControllerHelper::FormControllerHelper( const ::comphelper::ComponentContext& _rContext,
- const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
- :m_aContext( _rContext )
- ,m_pInvalidationCallback( _pInvalidationCallback )
- {
- osl_incrementInterlockedCount( &m_refCount );
- try
- {
- m_xFormOperations = FormOperations::createWithFormController( m_aContext.getUNOContext(), _rxController );
- if ( m_xFormOperations.is() )
- m_xFormOperations->setFeatureInvalidation( this );
-
- // to prevent the controller from displaying any error messages which happen while we operate on it,
- // we add ourself as XSQLErrorListener. By contract, a FormController displays errors if and only if
- // no SQLErrorListeners are registered.
- Reference< XSQLErrorBroadcaster > xErrorBroadcast( _rxController, UNO_QUERY_THROW );
- xErrorBroadcast->addSQLErrorListener( this );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- osl_decrementInterlockedCount( &m_refCount );
- }
-
- //--------------------------------------------------------------------
- FormControllerHelper::FormControllerHelper( const ::comphelper::ComponentContext& _rContext,
- const Reference< XForm >& _rxForm, IControllerFeatureInvalidation* _pInvalidationCallback )
- :m_aContext( _rContext )
- ,m_pInvalidationCallback( _pInvalidationCallback )
- {
- osl_incrementInterlockedCount( &m_refCount );
- try
- {
- m_xFormOperations = FormOperations::createWithForm( m_aContext.getUNOContext(), _rxForm );
- if ( m_xFormOperations.is() )
- m_xFormOperations->setFeatureInvalidation( this );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- osl_decrementInterlockedCount( &m_refCount );
- }
-
- //--------------------------------------------------------------------
- FormControllerHelper::~FormControllerHelper( )
- {
- try
- {
- acquire();
- dispose();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- //--------------------------------------------------------------------
- void FormControllerHelper::dispose()
- {
- if ( m_xFormOperations.is() )
- m_xFormOperations->dispose();
- m_xFormOperations.clear();
- }
-
- //--------------------------------------------------------------------
- sal_Bool FormControllerHelper::isEnabled( sal_Int32 _nSlotId ) const
- {
- if ( !m_xFormOperations.is() )
- return sal_False;
- return m_xFormOperations->isEnabled( FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ) );
- }
-
- //--------------------------------------------------------------------
- Reference< XRowSet > FormControllerHelper::getCursor() const
- {
- Reference< XRowSet > xCursor;
- if ( m_xFormOperations.is() )
- xCursor = m_xFormOperations->getCursor();
- return xCursor;
- }
-
- //--------------------------------------------------------------------
- void FormControllerHelper::getState( sal_Int32 _nSlotId, FeatureState& _rState ) const
- {
- if ( m_xFormOperations.is() )
- _rState = m_xFormOperations->getState( FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ) );
- }
-
- //--------------------------------------------------------------------
- sal_Bool FormControllerHelper::commitCurrentControl( ) const
- {
- return impl_operateForm_nothrow( COMMIT_CONTROL );
- }
-
- //--------------------------------------------------------------------
- sal_Bool FormControllerHelper::commitCurrentRecord() const
- {
- return impl_operateForm_nothrow( COMMIT_RECORD );
- }
-
- //--------------------------------------------------------------------
- bool FormControllerHelper::moveRight( ) const
- {
- return impl_operateForm_nothrow( FormFeature::MoveToNext );
- }
-
- //--------------------------------------------------------------------
- bool FormControllerHelper::moveLeft( ) const
- {
- return impl_operateForm_nothrow( FormFeature::MoveToPrevious );
- }
-
- //--------------------------------------------------------------------
- void FormControllerHelper::execute( sal_Int32 _nSlotId, const ::rtl::OUString& _rParamName, const Any& _rParamValue ) const
- {
- Sequence< NamedValue > aArguments(1);
- aArguments[0].Name = _rParamName;
- aArguments[0].Value = _rParamValue;
-
- impl_operateForm_nothrow( EXECUTE_ARGS, FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ), aArguments );
- }
-
- //--------------------------------------------------------------------
- bool FormControllerHelper::impl_operateForm_nothrow( const FormOperation _eWhat, const sal_Int16 _nFeature,
- const Sequence< NamedValue >& _rArguments ) const
- {
- if ( !m_xFormOperations.is() )
- return false;
-
- Any aError;
- bool bSuccess = false;
- const_cast< FormControllerHelper* >( this )->m_aOperationError.clear();
- try
- {
- switch ( _eWhat )
- {
- case COMMIT_CONTROL:
- bSuccess = m_xFormOperations->commitCurrentControl();
- break;
-
- case COMMIT_RECORD:
- {
- sal_Bool bDummy( sal_False );
- bSuccess = m_xFormOperations->commitCurrentRecord( bDummy );
- }
- break;
-
- case EXECUTE:
- m_xFormOperations->execute( _nFeature );
- bSuccess = true;
- break;
-
- case EXECUTE_ARGS:
- m_xFormOperations->executeWithArguments( _nFeature, _rArguments );
- bSuccess = true;
- break;
- }
- }
- catch ( const SQLException& )
- {
- aError = ::cppu::getCaughtException();
- }
- catch( const Exception& )
- {
- SQLException aFallbackError;
- aFallbackError.Message = ::comphelper::anyToString( ::cppu::getCaughtException() );
- aError <<= aFallbackError;
- }
-
- if ( bSuccess )
- return true;
-
- // display the error. Prefer the one reported in errorOccured over the one caught.
- if ( m_aOperationError.hasValue() )
- displayException( m_aOperationError );
- else if ( aError.hasValue() )
- displayException( aError );
- else
- OSL_ENSURE( false, "FormControllerHelper::impl_operateForm_nothrow: no success, but no error?" );
-
- return false;
- }
-
- //--------------------------------------------------------------------
- void FormControllerHelper::execute( sal_Int32 _nSlotId ) const
- {
- impl_operateForm_nothrow( EXECUTE, FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ),
- Sequence< NamedValue >() );
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL FormControllerHelper::invalidateFeatures( const Sequence< ::sal_Int16 >& _Features ) throw (RuntimeException)
- {
- if ( !m_pInvalidationCallback )
- // nobody's interested in ...
- return;
-
- ::std::vector< sal_Int32 > aFeatures( _Features.getLength() );
- ::std::transform(
- _Features.getConstArray(),
- _Features.getConstArray() + _Features.getLength(),
- aFeatures.begin(),
- FormFeatureToSlotId()
- );
-
- m_pInvalidationCallback->invalidateFeatures( aFeatures );
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL FormControllerHelper::invalidateAllFeatures() throw (RuntimeException)
- {
- if ( !m_pInvalidationCallback )
- // nobody's interested in ...
- return;
-
- // actually, it's a little bit more than the supported features,
- // but on the medium term, we are to support everything listed
- // here
- ::std::vector< sal_Int32 > aSupportedFeatures;
- sal_Int32 pSupportedFeatures[] =
- {
- SID_FM_RECORD_FIRST,
- SID_FM_RECORD_NEXT,
- SID_FM_RECORD_PREV,
- SID_FM_RECORD_LAST,
- SID_FM_RECORD_NEW,
- SID_FM_RECORD_DELETE,
- SID_FM_RECORD_ABSOLUTE,
- SID_FM_RECORD_TOTAL,
- SID_FM_RECORD_SAVE,
- SID_FM_RECORD_UNDO,
- SID_FM_REMOVE_FILTER_SORT,
- SID_FM_SORTUP,
- SID_FM_SORTDOWN,
- SID_FM_ORDERCRIT,
- SID_FM_AUTOFILTER,
- SID_FM_FILTERCRIT,
- SID_FM_FORM_FILTERED,
- SID_FM_REFRESH,
- SID_FM_REFRESH_FORM_CONTROL,
- SID_FM_SEARCH,
- SID_FM_FILTER_START,
- SID_FM_VIEW_AS_GRID
- };
- sal_Int32 nFeatureCount = sizeof( pSupportedFeatures ) / sizeof( pSupportedFeatures[ 0 ] );
- aSupportedFeatures.resize( nFeatureCount );
- ::std::copy( pSupportedFeatures, pSupportedFeatures + nFeatureCount, aSupportedFeatures.begin() );
-
- m_pInvalidationCallback->invalidateFeatures( aSupportedFeatures );
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL FormControllerHelper::errorOccured( const SQLErrorEvent& _Event ) throw (RuntimeException)
- {
- OSL_ENSURE( !m_aOperationError.hasValue(), "FormControllerHelper::errorOccured: two errors during one operation?" );
- m_aOperationError = _Event.Reason;
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL FormControllerHelper::disposing( const EventObject& /*_Source*/ ) throw (RuntimeException)
- {
- // not interested in
- }
-
- //--------------------------------------------------------------------
- sal_Bool FormControllerHelper::isInsertionRow() const
- {
- sal_Bool bIs = sal_False;
- if ( m_xFormOperations.is() )
- bIs = m_xFormOperations->isInsertionRow();
- return bIs;
- }
-
- //--------------------------------------------------------------------
- sal_Bool FormControllerHelper::isModifiedRow() const
- {
- sal_Bool bIs = sal_False;
- if ( m_xFormOperations.is() )
- bIs = m_xFormOperations->isModifiedRow();
- return bIs;
- }
- //--------------------------------------------------------------------
- bool FormControllerHelper::canDoFormFilter() const
- {
- if ( !m_xFormOperations.is() )
- return false;
-
- bool bCanDo = false;
- try
- {
- Reference< XPropertySet > xCursorProperties( m_xFormOperations->getCursor(), UNO_QUERY_THROW );
-
- bool bEscapeProcessing( false );
- OSL_VERIFY( xCursorProperties->getPropertyValue( FM_PROP_ESCAPE_PROCESSING ) >>= bEscapeProcessing );
-
- ::rtl::OUString sActiveCommand;
- OSL_VERIFY( xCursorProperties->getPropertyValue( FM_PROP_ACTIVECOMMAND ) >>= sActiveCommand );
-
- bool bInsertOnlyForm( false );
- OSL_VERIFY( xCursorProperties->getPropertyValue( FM_PROP_INSERTONLY ) >>= bInsertOnlyForm );
-
- bCanDo = bEscapeProcessing && ( sActiveCommand.getLength() > 0 ) && !bInsertOnlyForm;
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return bCanDo;
- }
-
-//........................................................................
-} // namespace svx
-//........................................................................
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: formcontrolling.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "formcontrolling.hxx"
+#include "fmurl.hxx"
+#include <svx/svxids.hrc>
+#include "fmprop.hrc"
+#include "fmtools.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/form/runtime/FormOperations.hpp>
+#include <com/sun/star/form/runtime/FormFeature.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+#include <comphelper/anytostring.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <osl/diagnose.h>
+
+#include <functional>
+#include <algorithm>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ using namespace ::svxform;
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::form::XFormController;
+ using ::com::sun::star::form::XForm;
+ using ::com::sun::star::form::runtime::FormOperations;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::sdbc::XRowSet;
+ using ::com::sun::star::form::runtime::FeatureState;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::beans::NamedValue;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::sdbc::SQLException;
+ using ::com::sun::star::sdb::XSQLErrorBroadcaster;
+ using ::com::sun::star::sdb::SQLErrorEvent;
+ using ::com::sun::star::lang::EventObject;
+ /** === end UNO using === **/
+ namespace FormFeature = ::com::sun::star::form::runtime::FormFeature;
+
+ //====================================================================
+ //= FeatureSlotTranslation
+ //====================================================================
+ namespace
+ {
+ struct FeatureDescription
+ {
+ ::rtl::OUString sURL; // the URL
+ sal_Int32 nSlotId; // the SFX-compatible slot ID
+ sal_Int16 nFormFeature; // the css.form.runtime.FormFeature ID
+ };
+ typedef ::std::vector< FeatureDescription > FeatureDescriptions;
+
+ //................................................................
+ const FeatureDescriptions& getFeatureDescriptions()
+ {
+ static FeatureDescriptions s_aFeatureDescriptions;
+ if ( s_aFeatureDescriptions.empty() )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if ( s_aFeatureDescriptions.empty() )
+ {
+ FeatureDescription aDescriptions[] = {
+ { FMURL_FORM_POSITION, SID_FM_RECORD_ABSOLUTE, FormFeature::MoveAbsolute },
+ { FMURL_FORM_RECORDCOUNT, SID_FM_RECORD_TOTAL, FormFeature::TotalRecords },
+ { FMURL_RECORD_MOVEFIRST, SID_FM_RECORD_FIRST, FormFeature::MoveToFirst },
+ { FMURL_RECORD_MOVEPREV, SID_FM_RECORD_PREV, FormFeature::MoveToPrevious },
+ { FMURL_RECORD_MOVENEXT, SID_FM_RECORD_NEXT, FormFeature::MoveToNext },
+ { FMURL_RECORD_MOVELAST, SID_FM_RECORD_LAST, FormFeature::MoveToLast },
+ { FMURL_RECORD_MOVETONEW, SID_FM_RECORD_NEW, FormFeature::MoveToInsertRow },
+ { FMURL_RECORD_SAVE, SID_FM_RECORD_SAVE, FormFeature::SaveRecordChanges },
+ { FMURL_RECORD_DELETE, SID_FM_RECORD_DELETE, FormFeature::DeleteRecord },
+ { FMURL_FORM_REFRESH, SID_FM_REFRESH, FormFeature::ReloadForm },
+ { FMURL_FORM_REFRESH_CURRENT_CONTROL,
+ SID_FM_REFRESH_FORM_CONTROL,FormFeature::RefreshCurrentControl },
+ { FMURL_RECORD_UNDO, SID_FM_RECORD_UNDO, FormFeature::UndoRecordChanges },
+ { FMURL_FORM_SORT_UP, SID_FM_SORTUP, FormFeature::SortAscending },
+ { FMURL_FORM_SORT_DOWN, SID_FM_SORTDOWN, FormFeature::SortDescending },
+ { FMURL_FORM_SORT, SID_FM_ORDERCRIT, FormFeature::InteractiveSort },
+ { FMURL_FORM_AUTO_FILTER, SID_FM_AUTOFILTER, FormFeature::AutoFilter },
+ { FMURL_FORM_FILTER, SID_FM_FILTERCRIT, FormFeature::InteractiveFilter },
+ { FMURL_FORM_APPLY_FILTER, SID_FM_FORM_FILTERED, FormFeature::ToggleApplyFilter },
+ { FMURL_FORM_REMOVE_FILTER, SID_FM_REMOVE_FILTER_SORT, FormFeature::RemoveFilterAndSort }
+ };
+ for ( size_t i=0; i<sizeof(aDescriptions)/sizeof(aDescriptions[0]); ++i )
+ s_aFeatureDescriptions.push_back( aDescriptions[i] );
+ }
+ };
+ return s_aFeatureDescriptions;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ namespace
+ {
+ //................................................................
+ struct MatchFeatureDescriptionByURL : public ::std::unary_function< FeatureDescription, bool >
+ {
+ const ::rtl::OUString& m_rURL;
+ MatchFeatureDescriptionByURL( const ::rtl::OUString& _rURL ) :m_rURL( _rURL ) { }
+
+ bool operator()( const FeatureDescription& _compare )
+ {
+ return m_rURL == _compare.sURL;
+ }
+ };
+
+ //................................................................
+ struct MatchFeatureDescriptionBySlotId : public ::std::unary_function< FeatureDescription, bool >
+ {
+ sal_Int32 m_nSlotId;
+ MatchFeatureDescriptionBySlotId( sal_Int32 _nSlotId ) :m_nSlotId( _nSlotId ) { }
+
+ bool operator()( const FeatureDescription& _compare )
+ {
+ return m_nSlotId == _compare.nSlotId;
+ }
+ };
+
+ //................................................................
+ struct MatchFeatureDescriptionByFormFeature : public ::std::unary_function< FeatureDescription, bool >
+ {
+ sal_Int32 m_nFormFeature;
+ MatchFeatureDescriptionByFormFeature( sal_Int32 _nFormFeature ) :m_nFormFeature( _nFormFeature ) { }
+
+ bool operator()( const FeatureDescription& _compare )
+ {
+ return m_nFormFeature == _compare.nFormFeature;
+ }
+ };
+
+ //................................................................
+ struct FormFeatureToSlotId : public ::std::unary_function< sal_Int16, sal_Int32 >
+ {
+ sal_Int32 operator()( sal_Int16 _FormFeature )
+ {
+ return FeatureSlotTranslation::getSlotIdForFormFeature( _FormFeature );
+ }
+ };
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 FeatureSlotTranslation::getControllerFeatureSlotIdForURL( const ::rtl::OUString& _rMainURL )
+ {
+ const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
+ FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionByURL( _rMainURL ) );
+ return ( pos != rDescriptions.end() ) ? pos->nSlotId : -1;
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString FeatureSlotTranslation::getControllerFeatureURLForSlotId( sal_Int32 _nSlotId )
+ {
+ const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
+ FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionBySlotId( _nSlotId ) );
+ OSL_ENSURE( pos != rDescriptions.end(), "FeatureSlotTranslation::getControllerFeatureURLForSlotId: not found!" );
+ return ( pos != rDescriptions.end() ) ? pos->sURL : ::rtl::OUString();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool FeatureSlotTranslation::isFeatureURL( const ::rtl::OUString& _rMainURL )
+ {
+ return ( _rMainURL.indexOf( FMURL_FORMSLOTS_PREFIX ) == 0 );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int16 FeatureSlotTranslation::getFormFeatureForSlotId( sal_Int32 _nSlotId )
+ {
+ const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
+ FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionBySlotId( _nSlotId ) );
+ OSL_ENSURE( pos != rDescriptions.end(), "FeatureSlotTranslation::getFormFeatureForSlotId: not found!" );
+ return ( pos != rDescriptions.end() ) ? pos->nFormFeature : -1;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 FeatureSlotTranslation::getSlotIdForFormFeature( sal_Int16 _nFormFeature )
+ {
+ const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
+ FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionByFormFeature( _nFormFeature ) );
+ OSL_ENSURE( pos != rDescriptions.end(), "FeatureSlotTranslation::getSlotIdForFormFeature: not found!" );
+ return ( pos != rDescriptions.end() ) ? pos->nSlotId : -1;
+ }
+
+ //====================================================================
+ //= ControllerFeatures
+ //====================================================================
+ //--------------------------------------------------------------------
+ ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB, IControllerFeatureInvalidation* _pInvalidationCallback )
+ :m_aContext( _rxORB )
+ ,m_pInvalidationCallback( _pInvalidationCallback )
+ ,m_pImpl( NULL )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB,
+ const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
+ :m_aContext( _rxORB )
+ ,m_pInvalidationCallback( _pInvalidationCallback )
+ ,m_pImpl( NULL )
+ {
+ assign( _rxController );
+ }
+
+ //--------------------------------------------------------------------
+ ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB,
+ const Reference< XForm >& _rxForm, IControllerFeatureInvalidation* _pInvalidationCallback )
+ :m_aContext( _rxORB )
+ ,m_pInvalidationCallback( _pInvalidationCallback )
+ ,m_pImpl( NULL )
+ {
+ assign( _rxForm );
+ }
+
+ //--------------------------------------------------------------------
+ void ControllerFeatures::assign( const Reference< XFormController >& _rxController )
+ {
+ dispose();
+ m_pImpl = new FormControllerHelper( m_aContext, _rxController, m_pInvalidationCallback );
+ m_pImpl->acquire();
+ }
+
+ //--------------------------------------------------------------------
+ void ControllerFeatures::assign( const Reference< XForm >& _rxForm )
+ {
+ dispose();
+ m_pImpl = new FormControllerHelper( m_aContext, _rxForm, m_pInvalidationCallback );
+ m_pImpl->acquire();
+ }
+
+ //--------------------------------------------------------------------
+ ControllerFeatures::~ControllerFeatures()
+ {
+ dispose();
+ }
+
+ //--------------------------------------------------------------------
+ void ControllerFeatures::dispose()
+ {
+ if ( m_pImpl )
+ {
+ m_pImpl->dispose();
+ m_pImpl->release();
+ m_pImpl = NULL;
+ }
+ }
+
+ //====================================================================
+ //= FormControllerHelper
+ //====================================================================
+ //--------------------------------------------------------------------
+ FormControllerHelper::FormControllerHelper( const ::comphelper::ComponentContext& _rContext,
+ const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
+ :m_aContext( _rContext )
+ ,m_pInvalidationCallback( _pInvalidationCallback )
+ {
+ osl_incrementInterlockedCount( &m_refCount );
+ try
+ {
+ m_xFormOperations = FormOperations::createWithFormController( m_aContext.getUNOContext(), _rxController );
+ if ( m_xFormOperations.is() )
+ m_xFormOperations->setFeatureInvalidation( this );
+
+ // to prevent the controller from displaying any error messages which happen while we operate on it,
+ // we add ourself as XSQLErrorListener. By contract, a FormController displays errors if and only if
+ // no SQLErrorListeners are registered.
+ Reference< XSQLErrorBroadcaster > xErrorBroadcast( _rxController, UNO_QUERY_THROW );
+ xErrorBroadcast->addSQLErrorListener( this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ FormControllerHelper::FormControllerHelper( const ::comphelper::ComponentContext& _rContext,
+ const Reference< XForm >& _rxForm, IControllerFeatureInvalidation* _pInvalidationCallback )
+ :m_aContext( _rContext )
+ ,m_pInvalidationCallback( _pInvalidationCallback )
+ {
+ osl_incrementInterlockedCount( &m_refCount );
+ try
+ {
+ m_xFormOperations = FormOperations::createWithForm( m_aContext.getUNOContext(), _rxForm );
+ if ( m_xFormOperations.is() )
+ m_xFormOperations->setFeatureInvalidation( this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ FormControllerHelper::~FormControllerHelper( )
+ {
+ try
+ {
+ acquire();
+ dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void FormControllerHelper::dispose()
+ {
+ if ( m_xFormOperations.is() )
+ m_xFormOperations->dispose();
+ m_xFormOperations.clear();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool FormControllerHelper::isEnabled( sal_Int32 _nSlotId ) const
+ {
+ if ( !m_xFormOperations.is() )
+ return sal_False;
+ return m_xFormOperations->isEnabled( FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ) );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XRowSet > FormControllerHelper::getCursor() const
+ {
+ Reference< XRowSet > xCursor;
+ if ( m_xFormOperations.is() )
+ xCursor = m_xFormOperations->getCursor();
+ return xCursor;
+ }
+
+ //--------------------------------------------------------------------
+ void FormControllerHelper::getState( sal_Int32 _nSlotId, FeatureState& _rState ) const
+ {
+ if ( m_xFormOperations.is() )
+ _rState = m_xFormOperations->getState( FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ) );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool FormControllerHelper::commitCurrentControl( ) const
+ {
+ return impl_operateForm_nothrow( COMMIT_CONTROL );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool FormControllerHelper::commitCurrentRecord() const
+ {
+ return impl_operateForm_nothrow( COMMIT_RECORD );
+ }
+
+ //--------------------------------------------------------------------
+ bool FormControllerHelper::moveRight( ) const
+ {
+ return impl_operateForm_nothrow( FormFeature::MoveToNext );
+ }
+
+ //--------------------------------------------------------------------
+ bool FormControllerHelper::moveLeft( ) const
+ {
+ return impl_operateForm_nothrow( FormFeature::MoveToPrevious );
+ }
+
+ //--------------------------------------------------------------------
+ void FormControllerHelper::execute( sal_Int32 _nSlotId, const ::rtl::OUString& _rParamName, const Any& _rParamValue ) const
+ {
+ Sequence< NamedValue > aArguments(1);
+ aArguments[0].Name = _rParamName;
+ aArguments[0].Value = _rParamValue;
+
+ impl_operateForm_nothrow( EXECUTE_ARGS, FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ), aArguments );
+ }
+
+ //--------------------------------------------------------------------
+ bool FormControllerHelper::impl_operateForm_nothrow( const FormOperation _eWhat, const sal_Int16 _nFeature,
+ const Sequence< NamedValue >& _rArguments ) const
+ {
+ if ( !m_xFormOperations.is() )
+ return false;
+
+ Any aError;
+ bool bSuccess = false;
+ const_cast< FormControllerHelper* >( this )->m_aOperationError.clear();
+ try
+ {
+ switch ( _eWhat )
+ {
+ case COMMIT_CONTROL:
+ bSuccess = m_xFormOperations->commitCurrentControl();
+ break;
+
+ case COMMIT_RECORD:
+ {
+ sal_Bool bDummy( sal_False );
+ bSuccess = m_xFormOperations->commitCurrentRecord( bDummy );
+ }
+ break;
+
+ case EXECUTE:
+ m_xFormOperations->execute( _nFeature );
+ bSuccess = true;
+ break;
+
+ case EXECUTE_ARGS:
+ m_xFormOperations->executeWithArguments( _nFeature, _rArguments );
+ bSuccess = true;
+ break;
+ }
+ }
+ catch ( const SQLException& )
+ {
+ aError = ::cppu::getCaughtException();
+ }
+ catch( const Exception& )
+ {
+ SQLException aFallbackError;
+ aFallbackError.Message = ::comphelper::anyToString( ::cppu::getCaughtException() );
+ aError <<= aFallbackError;
+ }
+
+ if ( bSuccess )
+ return true;
+
+ // display the error. Prefer the one reported in errorOccured over the one caught.
+ if ( m_aOperationError.hasValue() )
+ displayException( m_aOperationError );
+ else if ( aError.hasValue() )
+ displayException( aError );
+ else
+ OSL_ENSURE( false, "FormControllerHelper::impl_operateForm_nothrow: no success, but no error?" );
+
+ return false;
+ }
+
+ //--------------------------------------------------------------------
+ void FormControllerHelper::execute( sal_Int32 _nSlotId ) const
+ {
+ impl_operateForm_nothrow( EXECUTE, FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ),
+ Sequence< NamedValue >() );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FormControllerHelper::invalidateFeatures( const Sequence< ::sal_Int16 >& _Features ) throw (RuntimeException)
+ {
+ if ( !m_pInvalidationCallback )
+ // nobody's interested in ...
+ return;
+
+ ::std::vector< sal_Int32 > aFeatures( _Features.getLength() );
+ ::std::transform(
+ _Features.getConstArray(),
+ _Features.getConstArray() + _Features.getLength(),
+ aFeatures.begin(),
+ FormFeatureToSlotId()
+ );
+
+ m_pInvalidationCallback->invalidateFeatures( aFeatures );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FormControllerHelper::invalidateAllFeatures() throw (RuntimeException)
+ {
+ if ( !m_pInvalidationCallback )
+ // nobody's interested in ...
+ return;
+
+ // actually, it's a little bit more than the supported features,
+ // but on the medium term, we are to support everything listed
+ // here
+ ::std::vector< sal_Int32 > aSupportedFeatures;
+ sal_Int32 pSupportedFeatures[] =
+ {
+ SID_FM_RECORD_FIRST,
+ SID_FM_RECORD_NEXT,
+ SID_FM_RECORD_PREV,
+ SID_FM_RECORD_LAST,
+ SID_FM_RECORD_NEW,
+ SID_FM_RECORD_DELETE,
+ SID_FM_RECORD_ABSOLUTE,
+ SID_FM_RECORD_TOTAL,
+ SID_FM_RECORD_SAVE,
+ SID_FM_RECORD_UNDO,
+ SID_FM_REMOVE_FILTER_SORT,
+ SID_FM_SORTUP,
+ SID_FM_SORTDOWN,
+ SID_FM_ORDERCRIT,
+ SID_FM_AUTOFILTER,
+ SID_FM_FILTERCRIT,
+ SID_FM_FORM_FILTERED,
+ SID_FM_REFRESH,
+ SID_FM_REFRESH_FORM_CONTROL,
+ SID_FM_SEARCH,
+ SID_FM_FILTER_START,
+ SID_FM_VIEW_AS_GRID
+ };
+ sal_Int32 nFeatureCount = sizeof( pSupportedFeatures ) / sizeof( pSupportedFeatures[ 0 ] );
+ aSupportedFeatures.resize( nFeatureCount );
+ ::std::copy( pSupportedFeatures, pSupportedFeatures + nFeatureCount, aSupportedFeatures.begin() );
+
+ m_pInvalidationCallback->invalidateFeatures( aSupportedFeatures );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FormControllerHelper::errorOccured( const SQLErrorEvent& _Event ) throw (RuntimeException)
+ {
+ OSL_ENSURE( !m_aOperationError.hasValue(), "FormControllerHelper::errorOccured: two errors during one operation?" );
+ m_aOperationError = _Event.Reason;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FormControllerHelper::disposing( const EventObject& /*_Source*/ ) throw (RuntimeException)
+ {
+ // not interested in
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool FormControllerHelper::isInsertionRow() const
+ {
+ sal_Bool bIs = sal_False;
+ if ( m_xFormOperations.is() )
+ bIs = m_xFormOperations->isInsertionRow();
+ return bIs;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool FormControllerHelper::isModifiedRow() const
+ {
+ sal_Bool bIs = sal_False;
+ if ( m_xFormOperations.is() )
+ bIs = m_xFormOperations->isModifiedRow();
+ return bIs;
+ }
+ //--------------------------------------------------------------------
+ bool FormControllerHelper::canDoFormFilter() const
+ {
+ if ( !m_xFormOperations.is() )
+ return false;
+
+ bool bCanDo = false;
+ try
+ {
+ Reference< XPropertySet > xCursorProperties( m_xFormOperations->getCursor(), UNO_QUERY_THROW );
+
+ bool bEscapeProcessing( false );
+ OSL_VERIFY( xCursorProperties->getPropertyValue( FM_PROP_ESCAPE_PROCESSING ) >>= bEscapeProcessing );
+
+ ::rtl::OUString sActiveCommand;
+ OSL_VERIFY( xCursorProperties->getPropertyValue( FM_PROP_ACTIVECOMMAND ) >>= sActiveCommand );
+
+ bool bInsertOnlyForm( false );
+ OSL_VERIFY( xCursorProperties->getPropertyValue( FM_PROP_INSERTONLY ) >>= bInsertOnlyForm );
+
+ bCanDo = bEscapeProcessing && ( sActiveCommand.getLength() > 0 ) && !bInsertOnlyForm;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return bCanDo;
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
diff --git a/svx/source/inc/formcontrolling.hxx b/svx/source/inc/formcontrolling.hxx
index 50f27f45ff..eb99d80fd0 100644
--- a/svx/source/inc/formcontrolling.hxx
+++ b/svx/source/inc/formcontrolling.hxx
@@ -1,311 +1,311 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: formcontrolling.hxx,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SVX_FORMCONTROLLING_HXX
-#define SVX_FORMCONTROLLING_HXX
-
-#include <com/sun/star/form/XFormController.hpp>
-#include <com/sun/star/form/XForm.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/form/runtime/FeatureState.hpp>
-#include <com/sun/star/form/runtime/XFormOperations.hpp>
-#include <com/sun/star/sdb/XSQLErrorListener.hpp>
-
-#include <cppuhelper/implbase2.hxx>
-#include <comphelper/componentcontext.hxx>
-
-#include <vector>
-
-//........................................................................
-namespace svx
-{
-//........................................................................
-
- //====================================================================
- //= FeatureSlotTranslation
- //====================================================================
- class FeatureSlotTranslation
- {
- public:
- /// retrieves the feature id for a given feature URL
- static sal_Int32 getControllerFeatureSlotIdForURL( const ::rtl::OUString& _rMainURL );
-
- /// retrieves the feature URL for a given feature id
- static ::rtl::OUString getControllerFeatureURLForSlotId( sal_Int32 _nSlotId );
-
- /// determines whether the given URL is a controller feature URL
- static sal_Bool isFeatureURL( const ::rtl::OUString& _rMainURL );
-
- /// retrieves the css.form.runtime.FormFeature ID for a given slot ID
- static sal_Int16 getFormFeatureForSlotId( sal_Int32 _nSlotId );
-
- /// retrieves the slot id for a given css.form.runtime.FormFeature ID
- static sal_Int32 getSlotIdForFormFeature( sal_Int16 _nFormFeature );
- };
-
- //====================================================================
- //= IControllerFeatureInvalidation
- //====================================================================
- class IControllerFeatureInvalidation
- {
- public:
- /** invalidates the given features
-
- Invalidation means that any user interface representation (such as toolbox buttons), or
- any dispatches associated with the features in question are potentially out-of-date, and
- need to be updated
-
- @param _rFeatures
- Ids of the features to be invalidated.
- */
- virtual void invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatures ) = 0;
- };
-
- //====================================================================
- //= ControllerFeatures
- //====================================================================
- class FormControllerHelper;
- /** easier access to an FormControllerHelper instance
- */
- class ControllerFeatures
- {
- protected:
- ::comphelper::ComponentContext m_aContext;
- IControllerFeatureInvalidation* m_pInvalidationCallback; // necessary as long as m_pImpl is not yet constructed
- FormControllerHelper* m_pImpl;
-
- public:
- /** standard ctor
-
- The instance is not functional until <method>assign</method> is used.
-
- @param _rxORB
- a multi service factory for creating various needed components
-
- @param _pInvalidationCallback
- the callback for invalidating feature states
- */
- ControllerFeatures(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
- IControllerFeatureInvalidation* _pInvalidationCallback
- );
-
- /** constructs the instance from a <type scope="com::sun::star::form">XFormController<type> instance
-
- @param _rxORB
- a multi service factory for creating various needed components
-
- @param _rxController
- The form controller which the helper should be responsible for. Must not
- be <NULL/>, and must have a valid model (form).
-
- @param _pInvalidationCallback
- the callback for invalidating feature states
- */
- ControllerFeatures(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
- const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController,
- IControllerFeatureInvalidation* _pInvalidationCallback
- );
-
- /** constructs the helper form a <type scope="com::sun::star::form">XForm<type> instance
-
- Any functionality which depends on a controller will not be available.
-
- @param _rxORB
- a multi service factory for creating various needed components
-
- @param _rxForm
- The form which the helper should be responsible for. Must not be <NULL/>.
-
- @param _pInvalidationCallback
- the callback for invalidating feature states
- */
- ControllerFeatures(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
- const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
- IControllerFeatureInvalidation* _pInvalidationCallback
- );
-
- /// dtor
- ~ControllerFeatures();
-
- /// checks whether the instance is properly assigned to a form and/or controller
- inline bool isAssigned( ) const { return m_pImpl != NULL; }
-
- /** assign to a controller
- */
- void assign(
- const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController
- );
-
- /** assign to a controller
- */
- void assign(
- const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm
- );
-
- /// clears the instance so that it cannot be used afterwards
- void dispose();
-
- // access to the instance which implements the functionality. Not to be used when not assigned
- inline const FormControllerHelper* operator->() const { return m_pImpl; }
- inline FormControllerHelper* operator->() { return m_pImpl; }
- inline const FormControllerHelper& operator*() const { return *m_pImpl; }
- inline FormControllerHelper& operator*() { return *m_pImpl; }
- };
-
- //====================================================================
- //= FormControllerHelper
- //====================================================================
- typedef ::cppu::WeakImplHelper2 < ::com::sun::star::form::runtime::XFeatureInvalidation
- , ::com::sun::star::sdb::XSQLErrorListener
- > FormControllerHelper_Base;
- /** is a helper class which manages form controller functionality (such as moveNext etc.).
-
- <p>The class helps implementing form controller functionality, by providing
- methods to determine the state of, and execute, various common form features.<br/>
- A <em>feature</em> is for instance moving the form associated with the controller
- to a certain position, or reloading the form, and so on.</p>
- */
- class FormControllerHelper : public FormControllerHelper_Base
- {
- protected:
- ::comphelper::ComponentContext m_aContext;
- IControllerFeatureInvalidation* m_pInvalidationCallback;
- ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >
- m_xFormOperations;
-
- ::com::sun::star::uno::Any m_aOperationError;
-
- public:
- /** constructs the helper from a <type scope="com::sun::star::form">XFormController<type> instance
-
- @param _rContext
- the context the component lives in
- @param _rxController
- The form controller which the helper should be responsible for. Must not
- be <NULL/>, and must have a valid model (form).
- @param _pInvalidationCallback
- the callback for invalidating feature states
- */
- FormControllerHelper(
- const ::comphelper::ComponentContext& _rContext,
- const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController,
- IControllerFeatureInvalidation* _pInvalidationCallback
- );
-
- /** constructs the helper form a <type scope="com::sun::star::form">XForm<type> instance
-
- Any functionality which depends on a controller will not be available.
-
- @param _rContext
- the context the component lives in
- @param _rxForm
- The form which the helper should be responsible for. Must not be <NULL/>.
- @param _pInvalidationCallback
- the callback for invalidating feature states
- */
- FormControllerHelper(
- const ::comphelper::ComponentContext& _rContext,
- const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
- IControllerFeatureInvalidation* _pInvalidationCallback
- );
-
- // forwards to the XFormOperations implementation
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >
- getCursor() const;
- void getState(
- sal_Int32 _nSlotId,
- ::com::sun::star::form::runtime::FeatureState& _out_rState
- ) const;
- sal_Bool isEnabled( sal_Int32 _nSlotId ) const;
- void execute( sal_Int32 _nSlotId ) const;
- void execute( sal_Int32 _nSlotId, const ::rtl::OUString& _rParamName, const ::com::sun::star::uno::Any& _rParamValue ) const;
- sal_Bool commitCurrentRecord() const;
- sal_Bool commitCurrentControl( ) const;
- sal_Bool isInsertionRow() const;
- sal_Bool isModifiedRow() const;
-
- bool moveLeft( ) const;
- bool moveRight( ) const;
-
- bool canDoFormFilter() const;
-
- /** disposes this instance.
-
- After this method has been called, the instance is not functional anymore
- */
- void dispose();
-
- const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >&
- getFormOperations() const { return m_xFormOperations; }
- protected:
- /// dtor
- ~FormControllerHelper();
-
- // XFeatureInvalidation
- virtual void SAL_CALL invalidateFeatures( const ::com::sun::star::uno::Sequence< ::sal_Int16 >& Features ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL invalidateAllFeatures() throw (::com::sun::star::uno::RuntimeException);
-
- // XSQLErrorListener
- virtual void SAL_CALL errorOccured( const ::com::sun::star::sdb::SQLErrorEvent& _Event ) throw (::com::sun::star::uno::RuntimeException);
-
- // XEventListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
-
- private:
- enum FormOperation { EXECUTE, EXECUTE_ARGS, COMMIT_CONTROL, COMMIT_RECORD };
-
- bool impl_operateForm_nothrow(
- const FormOperation _eWhat,
- const sal_Int16 _nFeature, /* ignore for COMMIT_* */
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rArguments /* ignore except for EXECUTE_ARGS */
- ) const;
- bool impl_operateForm_nothrow( const FormOperation _eWhat ) const
- {
- return impl_operateForm_nothrow( _eWhat, 0, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >() );
- }
- bool impl_operateForm_nothrow( const sal_Int16 _nFeature ) const
- {
- return impl_operateForm_nothrow( EXECUTE, _nFeature, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >() );
- }
-
- private:
- FormControllerHelper(); // never implemented
- FormControllerHelper( const FormControllerHelper& ); // never implemented
- FormControllerHelper& operator=( const FormControllerHelper& ); // never implemented
- };
-
-//........................................................................
-} // namespace svx
-//........................................................................
-
-#endif // SVX_FORMCONTROLLING_HXX
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: formcontrolling.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_FORMCONTROLLING_HXX
+#define SVX_FORMCONTROLLING_HXX
+
+#include <com/sun/star/form/XFormController.hpp>
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/form/runtime/FeatureState.hpp>
+#include <com/sun/star/form/runtime/XFormOperations.hpp>
+#include <com/sun/star/sdb/XSQLErrorListener.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+#include <comphelper/componentcontext.hxx>
+
+#include <vector>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= FeatureSlotTranslation
+ //====================================================================
+ class FeatureSlotTranslation
+ {
+ public:
+ /// retrieves the feature id for a given feature URL
+ static sal_Int32 getControllerFeatureSlotIdForURL( const ::rtl::OUString& _rMainURL );
+
+ /// retrieves the feature URL for a given feature id
+ static ::rtl::OUString getControllerFeatureURLForSlotId( sal_Int32 _nSlotId );
+
+ /// determines whether the given URL is a controller feature URL
+ static sal_Bool isFeatureURL( const ::rtl::OUString& _rMainURL );
+
+ /// retrieves the css.form.runtime.FormFeature ID for a given slot ID
+ static sal_Int16 getFormFeatureForSlotId( sal_Int32 _nSlotId );
+
+ /// retrieves the slot id for a given css.form.runtime.FormFeature ID
+ static sal_Int32 getSlotIdForFormFeature( sal_Int16 _nFormFeature );
+ };
+
+ //====================================================================
+ //= IControllerFeatureInvalidation
+ //====================================================================
+ class IControllerFeatureInvalidation
+ {
+ public:
+ /** invalidates the given features
+
+ Invalidation means that any user interface representation (such as toolbox buttons), or
+ any dispatches associated with the features in question are potentially out-of-date, and
+ need to be updated
+
+ @param _rFeatures
+ Ids of the features to be invalidated.
+ */
+ virtual void invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatures ) = 0;
+ };
+
+ //====================================================================
+ //= ControllerFeatures
+ //====================================================================
+ class FormControllerHelper;
+ /** easier access to an FormControllerHelper instance
+ */
+ class ControllerFeatures
+ {
+ protected:
+ ::comphelper::ComponentContext m_aContext;
+ IControllerFeatureInvalidation* m_pInvalidationCallback; // necessary as long as m_pImpl is not yet constructed
+ FormControllerHelper* m_pImpl;
+
+ public:
+ /** standard ctor
+
+ The instance is not functional until <method>assign</method> is used.
+
+ @param _rxORB
+ a multi service factory for creating various needed components
+
+ @param _pInvalidationCallback
+ the callback for invalidating feature states
+ */
+ ControllerFeatures(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ IControllerFeatureInvalidation* _pInvalidationCallback
+ );
+
+ /** constructs the instance from a <type scope="com::sun::star::form">XFormController<type> instance
+
+ @param _rxORB
+ a multi service factory for creating various needed components
+
+ @param _rxController
+ The form controller which the helper should be responsible for. Must not
+ be <NULL/>, and must have a valid model (form).
+
+ @param _pInvalidationCallback
+ the callback for invalidating feature states
+ */
+ ControllerFeatures(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController,
+ IControllerFeatureInvalidation* _pInvalidationCallback
+ );
+
+ /** constructs the helper form a <type scope="com::sun::star::form">XForm<type> instance
+
+ Any functionality which depends on a controller will not be available.
+
+ @param _rxORB
+ a multi service factory for creating various needed components
+
+ @param _rxForm
+ The form which the helper should be responsible for. Must not be <NULL/>.
+
+ @param _pInvalidationCallback
+ the callback for invalidating feature states
+ */
+ ControllerFeatures(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
+ IControllerFeatureInvalidation* _pInvalidationCallback
+ );
+
+ /// dtor
+ ~ControllerFeatures();
+
+ /// checks whether the instance is properly assigned to a form and/or controller
+ inline bool isAssigned( ) const { return m_pImpl != NULL; }
+
+ /** assign to a controller
+ */
+ void assign(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController
+ );
+
+ /** assign to a controller
+ */
+ void assign(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm
+ );
+
+ /// clears the instance so that it cannot be used afterwards
+ void dispose();
+
+ // access to the instance which implements the functionality. Not to be used when not assigned
+ inline const FormControllerHelper* operator->() const { return m_pImpl; }
+ inline FormControllerHelper* operator->() { return m_pImpl; }
+ inline const FormControllerHelper& operator*() const { return *m_pImpl; }
+ inline FormControllerHelper& operator*() { return *m_pImpl; }
+ };
+
+ //====================================================================
+ //= FormControllerHelper
+ //====================================================================
+ typedef ::cppu::WeakImplHelper2 < ::com::sun::star::form::runtime::XFeatureInvalidation
+ , ::com::sun::star::sdb::XSQLErrorListener
+ > FormControllerHelper_Base;
+ /** is a helper class which manages form controller functionality (such as moveNext etc.).
+
+ <p>The class helps implementing form controller functionality, by providing
+ methods to determine the state of, and execute, various common form features.<br/>
+ A <em>feature</em> is for instance moving the form associated with the controller
+ to a certain position, or reloading the form, and so on.</p>
+ */
+ class FormControllerHelper : public FormControllerHelper_Base
+ {
+ protected:
+ ::comphelper::ComponentContext m_aContext;
+ IControllerFeatureInvalidation* m_pInvalidationCallback;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >
+ m_xFormOperations;
+
+ ::com::sun::star::uno::Any m_aOperationError;
+
+ public:
+ /** constructs the helper from a <type scope="com::sun::star::form">XFormController<type> instance
+
+ @param _rContext
+ the context the component lives in
+ @param _rxController
+ The form controller which the helper should be responsible for. Must not
+ be <NULL/>, and must have a valid model (form).
+ @param _pInvalidationCallback
+ the callback for invalidating feature states
+ */
+ FormControllerHelper(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController,
+ IControllerFeatureInvalidation* _pInvalidationCallback
+ );
+
+ /** constructs the helper form a <type scope="com::sun::star::form">XForm<type> instance
+
+ Any functionality which depends on a controller will not be available.
+
+ @param _rContext
+ the context the component lives in
+ @param _rxForm
+ The form which the helper should be responsible for. Must not be <NULL/>.
+ @param _pInvalidationCallback
+ the callback for invalidating feature states
+ */
+ FormControllerHelper(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
+ IControllerFeatureInvalidation* _pInvalidationCallback
+ );
+
+ // forwards to the XFormOperations implementation
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >
+ getCursor() const;
+ void getState(
+ sal_Int32 _nSlotId,
+ ::com::sun::star::form::runtime::FeatureState& _out_rState
+ ) const;
+ sal_Bool isEnabled( sal_Int32 _nSlotId ) const;
+ void execute( sal_Int32 _nSlotId ) const;
+ void execute( sal_Int32 _nSlotId, const ::rtl::OUString& _rParamName, const ::com::sun::star::uno::Any& _rParamValue ) const;
+ sal_Bool commitCurrentRecord() const;
+ sal_Bool commitCurrentControl( ) const;
+ sal_Bool isInsertionRow() const;
+ sal_Bool isModifiedRow() const;
+
+ bool moveLeft( ) const;
+ bool moveRight( ) const;
+
+ bool canDoFormFilter() const;
+
+ /** disposes this instance.
+
+ After this method has been called, the instance is not functional anymore
+ */
+ void dispose();
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >&
+ getFormOperations() const { return m_xFormOperations; }
+ protected:
+ /// dtor
+ ~FormControllerHelper();
+
+ // XFeatureInvalidation
+ virtual void SAL_CALL invalidateFeatures( const ::com::sun::star::uno::Sequence< ::sal_Int16 >& Features ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL invalidateAllFeatures() throw (::com::sun::star::uno::RuntimeException);
+
+ // XSQLErrorListener
+ virtual void SAL_CALL errorOccured( const ::com::sun::star::sdb::SQLErrorEvent& _Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ enum FormOperation { EXECUTE, EXECUTE_ARGS, COMMIT_CONTROL, COMMIT_RECORD };
+
+ bool impl_operateForm_nothrow(
+ const FormOperation _eWhat,
+ const sal_Int16 _nFeature, /* ignore for COMMIT_* */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rArguments /* ignore except for EXECUTE_ARGS */
+ ) const;
+ bool impl_operateForm_nothrow( const FormOperation _eWhat ) const
+ {
+ return impl_operateForm_nothrow( _eWhat, 0, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >() );
+ }
+ bool impl_operateForm_nothrow( const sal_Int16 _nFeature ) const
+ {
+ return impl_operateForm_nothrow( EXECUTE, _nFeature, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >() );
+ }
+
+ private:
+ FormControllerHelper(); // never implemented
+ FormControllerHelper( const FormControllerHelper& ); // never implemented
+ FormControllerHelper& operator=( const FormControllerHelper& ); // never implemented
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_FORMCONTROLLING_HXX
diff --git a/svx/source/outliner/outlobj.cxx b/svx/source/outliner/outlobj.cxx
index 728c6b944e..bdcbcf88e6 100644
--- a/svx/source/outliner/outlobj.cxx
+++ b/svx/source/outliner/outlobj.cxx
@@ -61,7 +61,7 @@ public:
mbIsEditDoc(bIsEditDoc),
mnRefCount(0)
{
- if( (maParagraphDataVector.size() == 0) && (pEditTextObject->GetParagraphCount() != 0) )
+ if( (maParagraphDataVector.size() == 0) && (pEditTextObject->GetParagraphCount() != 0) )
maParagraphDataVector.resize(pEditTextObject->GetParagraphCount());
}
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index a2fecc2053..9942aaf74c 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -1478,48 +1478,48 @@ void SdrOle2Obj::SetClosedObj( bool bIsClosed )
// -----------------------------------------------------------------------------
-SdrObject* SdrOle2Obj::getFullDragClone() const
-{
- // special handling for OLE. The default handling works, but is too
- // slow when the whole OLE needs to be cloned. Get the Metafile and
- // create a graphic object with it
- Graphic* pOLEGraphic = GetGraphic();
- SdrObject* pClone = 0;
-
- if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
- {
- pOLEGraphic = getEmbeddedObjectRef().GetHCGraphic();
- }
-
- if(pOLEGraphic)
- {
- pClone = new SdrGrafObj(*pOLEGraphic, GetSnapRect());
-
- // this would be the place where to copy all attributes
- // when OLE will support fill and line style
- // pClone->SetMergedItem(pOleObject->GetMergedItemSet());
- }
- else
- {
- // #i100710# pOLEGraphic may be zero (no visualisation available),
- // so we need to use the OLE replacement graphic
- pClone = new SdrRectObj(GetSnapRect());
-
- // gray outline
- pClone->SetMergedItem(XLineStyleItem(XLINE_SOLID));
- const svtools::ColorConfig aColorConfig;
- const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES));
- pClone->SetMergedItem(XLineColorItem(String(), aColor.nColor));
-
- // bitmap fill
- pClone->SetMergedItem(XFillStyleItem(XFILL_BITMAP));
- pClone->SetMergedItem(XFillBitmapItem(String(), GetEmtyOLEReplacementBitmap()));
- pClone->SetMergedItem(XFillBmpTileItem(false));
- pClone->SetMergedItem(XFillBmpStretchItem(false));
- }
-
- return pClone;
-}
+SdrObject* SdrOle2Obj::getFullDragClone() const
+{
+ // special handling for OLE. The default handling works, but is too
+ // slow when the whole OLE needs to be cloned. Get the Metafile and
+ // create a graphic object with it
+ Graphic* pOLEGraphic = GetGraphic();
+ SdrObject* pClone = 0;
+
+ if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ pOLEGraphic = getEmbeddedObjectRef().GetHCGraphic();
+ }
+
+ if(pOLEGraphic)
+ {
+ pClone = new SdrGrafObj(*pOLEGraphic, GetSnapRect());
+
+ // this would be the place where to copy all attributes
+ // when OLE will support fill and line style
+ // pClone->SetMergedItem(pOleObject->GetMergedItemSet());
+ }
+ else
+ {
+ // #i100710# pOLEGraphic may be zero (no visualisation available),
+ // so we need to use the OLE replacement graphic
+ pClone = new SdrRectObj(GetSnapRect());
+
+ // gray outline
+ pClone->SetMergedItem(XLineStyleItem(XLINE_SOLID));
+ const svtools::ColorConfig aColorConfig;
+ const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES));
+ pClone->SetMergedItem(XLineColorItem(String(), aColor.nColor));
+
+ // bitmap fill
+ pClone->SetMergedItem(XFillStyleItem(XFILL_BITMAP));
+ pClone->SetMergedItem(XFillBitmapItem(String(), GetEmtyOLEReplacementBitmap()));
+ pClone->SetMergedItem(XFillBmpTileItem(false));
+ pClone->SetMergedItem(XFillBmpStretchItem(false));
+ }
+
+ return pClone;
+}
// -----------------------------------------------------------------------------