User: kz Date: 2008-06-25 12:40:20+0000 Modified: dba/dbaccess/source/ui/browser/dataview.cxx
Log: INTEGRATION: CWS dba30d (1.22.30); FILE MERGED 2008/05/29 11:30:23 fs 1.22.30.2: during #i80943#: refactoring: IController now passed around as reference, not as pointer 2008/05/28 21:44:46 fs 1.22.30.1: #i84016# PreNotify: allow the controller to intercept key events and mouse clicks File Changes: Directory: /dba/dbaccess/source/ui/browser/ =========================================== File [changed]: dataview.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/dataview.cxx?r1=1.22&r2=1.23 Delta lines: +20 -17 --------------------- --- dataview.cxx 2008-04-10 14:04:54+0000 1.22 +++ dataview.cxx 2008-06-25 12:40:17+0000 1.23 @@ -98,17 +98,16 @@ DBG_NAME(ODataView) // ------------------------------------------------------------------------- ODataView::ODataView( Window* pParent, - IController* _pController, + IController& _rController, const Reference< XMultiServiceFactory >& _rFactory, WinBits nStyle) :Window(pParent,nStyle) ,m_xServiceFactory(_rFactory) - ,m_pController( _pController ) + ,m_rController( _rController ) ,m_pSeparator( NULL ) { DBG_CTOR(ODataView,NULL); - OSL_ENSURE(m_pController,"Controller must be not NULL!"); - m_pController->acquire(); + m_rController.acquire(); m_pAccel.reset(::svt::AcceleratorExecute::createAcceleratorHelper()); } @@ -123,7 +122,7 @@ DBG_DTOR(ODataView,NULL); enableSeparator( sal_False ); - m_pController->release(); + m_rController.release(); } // ------------------------------------------------------------------------- @@ -190,23 +189,27 @@ resizeAll( Rectangle( Point( 0, 0), GetSizePixel() ) ); } // ----------------------------------------------------------------------------- - long ODataView::PreNotify( NotifyEvent& rNEvt ) + long ODataView::PreNotify( NotifyEvent& _rNEvt ) { - BOOL bHandled = FALSE; - switch (rNEvt.GetType()) + bool bHandled = false; + switch ( _rNEvt.GetType() ) { case EVENT_KEYINPUT: { - const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); + const KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent(); const KeyCode& aKeyCode = pKeyEvent->GetKeyCode(); - if ( m_pAccel.get() ) - { - bHandled = m_pAccel->execute(aKeyCode); - } - } + if ( m_pAccel.get() && m_pAccel->execute( aKeyCode ) ) + // the accelerator consumed the event + return 1L; + } + // NO break + case EVENT_KEYUP: + case EVENT_MOUSEBUTTONDOWN: + case EVENT_MOUSEBUTTONUP: + bHandled = m_rController.interceptUserInput( _rNEvt ); break; } - return bHandled ? 1L : Window::PreNotify(rNEvt); + return bHandled ? 1L : Window::PreNotify( _rNEvt ); } // ----------------------------------------------------------------------------- void ODataView::StateChanged( StateChangedType nType ) @@ -216,7 +219,7 @@ if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) { // Check if we need to get new images for normal/high contrast mode - m_pController->notifyHiContrastChanged(); + m_rController.notifyHiContrastChanged(); } } // ----------------------------------------------------------------------------- @@ -231,7 +234,7 @@ (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { // Check if we need to get new images for normal/high contrast mode - m_pController->notifyHiContrastChanged(); + m_rController.notifyHiContrastChanged(); } } // ----------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
