diff options
Diffstat (limited to 'svtools/source/table/tabledatawindow.cxx')
-rw-r--r-- | svtools/source/table/tabledatawindow.cxx | 84 |
1 files changed, 77 insertions, 7 deletions
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index 246710488b42..e307071e2699 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -30,6 +30,7 @@ #include "svtools/table/tablecontrol.hxx" #include "svtools/table/tabledatawindow.hxx" #include "tablecontrol_impl.hxx" +#include <vcl/help.hxx> //........................................................................ namespace svt { namespace table @@ -44,10 +45,8 @@ namespace svt { namespace table TableDataWindow::TableDataWindow( TableControl_Impl& _rTableControl ) :Window( &_rTableControl.getAntiImpl() ) ,m_rTableControl ( _rTableControl ) + ,m_nRowAlreadySelected( -1 ) { - Color backgroundColor = m_rTableControl.getAntiImpl().GetSettings().GetStyleSettings().GetFieldColor(); - SetBackground( backgroundColor ); - SetControlBackground( backgroundColor ); } //-------------------------------------------------------------------- @@ -55,28 +54,99 @@ namespace svt { namespace table { m_rTableControl.doPaintContent( rUpdateRect ); } + //-------------------------------------------------------------------- void TableDataWindow::MouseMove( const MouseEvent& rMEvt ) { + Point aPoint = rMEvt.GetPosPixel(); if ( !m_rTableControl.getInputHandler()->MouseMove( m_rTableControl, rMEvt ) ) - Window::MouseMove( rMEvt ); + { + if(m_rTableControl.getCurrentRow(aPoint)>=0 ) + { + SetPointer(POINTER_ARROW); + rtl::OUString& rHelpText = m_rTableControl.setTooltip(aPoint); + Help::EnableBalloonHelp(); + Window::SetHelpText( rHelpText.getStr()); + } + else if(m_rTableControl.getCurrentRow(aPoint) == -1) + { + if(Help::IsBalloonHelpEnabled()) + Help::DisableBalloonHelp(); + m_rTableControl.resizeColumn(aPoint); + } + else + { + if(Help::IsBalloonHelpEnabled()) + Help::DisableBalloonHelp(); + Window::MouseMove( rMEvt ); + } + } } + //-------------------------------------------------------------------- void TableDataWindow::MouseButtonDown( const MouseEvent& rMEvt ) { + Point aPoint = rMEvt.GetPosPixel(); + RowPos nCurRow = m_rTableControl.getCurrentRow(aPoint); if ( !m_rTableControl.getInputHandler()->MouseButtonDown( m_rTableControl, rMEvt ) ) Window::MouseButtonDown( rMEvt ); else - m_aMouseButtonDownHdl.Call( (MouseEvent*) &rMEvt); + { + if(nCurRow >= 0 && m_rTableControl.getSelEngine()->GetSelectionMode() != NO_SELECTION) + { + if( m_nRowAlreadySelected != nCurRow ) + { + m_nRowAlreadySelected = nCurRow; + m_aSelectHdl.Call( NULL ); + } + else + m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt); + } + else + m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt); + } m_rTableControl.getAntiImpl().LoseFocus(); } + //-------------------------------------------------------------------- void TableDataWindow::MouseButtonUp( const MouseEvent& rMEvt ) { if ( !m_rTableControl.getInputHandler()->MouseButtonUp( m_rTableControl, rMEvt ) ) Window::MouseButtonUp( rMEvt ); else - m_aMouseButtonUpHdl.Call( (MouseEvent*) &rMEvt); + m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt); m_rTableControl.getAntiImpl().GetFocus(); } - + //-------------------------------------------------------------------- + void TableDataWindow::SetPointer( const Pointer& rPointer ) + { + Window::SetPointer(rPointer); + } + //-------------------------------------------------------------------- + void TableDataWindow::CaptureMouse() + { + Window::CaptureMouse(); + } + //-------------------------------------------------------------------- + void TableDataWindow::ReleaseMouse( ) + { + Window::ReleaseMouse(); + } + // ----------------------------------------------------------------------- + long TableDataWindow::Notify(NotifyEvent& rNEvt ) + { + long nDone = 0; + if ( rNEvt.GetType() == EVENT_COMMAND ) + { + const CommandEvent& rCEvt = *rNEvt.GetCommandEvent(); + if ( rCEvt.GetCommand() == COMMAND_WHEEL ) + { + const CommandWheelData* pData = rCEvt.GetWheelData(); + if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) ) + { + nDone = HandleScrollCommand( rCEvt, m_rTableControl.getHorzScrollbar(), m_rTableControl.getVertScrollbar() ); + } + } + } + return nDone ? nDone : Window::Notify( rNEvt ); + } //........................................................................ } } // namespace svt::table //........................................................................ |