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