diff options
author | Daniel Rentz <dr@openoffice.org> | 2002-07-11 14:39:48 +0000 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2002-07-11 14:39:48 +0000 |
commit | 23074672fa9ee36ef883fe52ba30dbabb682336a (patch) | |
tree | 9bba4828b659433fc68d560348adaa818969a324 /sc/source/ui/dbgui/csvruler.cxx | |
parent | 8018ea44dc24809cd9e8e8006d53bb46cd8f81f7 (diff) |
#100032# mouse drag for column selection, performance
Diffstat (limited to 'sc/source/ui/dbgui/csvruler.cxx')
-rw-r--r-- | sc/source/ui/dbgui/csvruler.cxx | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx index 9865d0cd9..5044f806d 100644 --- a/sc/source/ui/dbgui/csvruler.cxx +++ b/sc/source/ui/dbgui/csvruler.cxx @@ -2,9 +2,9 @@ * * $RCSfile: csvruler.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: obo $ $Date: 2002-07-10 14:58:17 $ + * last change: $Author: dr $ $Date: 2002-07-11 15:39:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -117,21 +117,24 @@ void ScCsvRuler::InitSizeData() void ScCsvRuler::ApplyLayout( const ScCsvLayoutData& rOldData ) { - if( !GetLayoutData().IsHorzEqual( rOldData ) ) + sal_uInt32 nDiff = GetLayoutData().GetDiff( rOldData ); + + if( nDiff & (CSV_DIFF_HORIZONTAL | CSV_DIFF_RULERCURSOR) ) { - InitSizeData(); DisableRepaint(); - if( GetRulerCursorPos() >= GetPosCount() ) - MoveCursor( GetPosCount() - 1 ); + if( nDiff & CSV_DIFF_HORIZONTAL ) + { + InitSizeData(); + if( GetRulerCursorPos() >= GetPosCount() ) + MoveCursor( GetPosCount() - 1 ); + } + if( nDiff & CSV_DIFF_RULERCURSOR ) + { + ImplEraseCursor( rOldData.mnPosCursor ); + ImplDrawCursor( GetRulerCursorPos() ); + } EnableRepaint(); } - - if( GetRulerCursorPos() != rOldData.mnPosCursor ) - { - ImplEraseCursor( rOldData.mnPosCursor ); - ImplDrawCursor( GetRulerCursorPos() ); - Repaint(); - } } sal_Int32 ScCsvRuler::FindEmptyPos( sal_Int32 nPos, ScMoveMode eDir ) const @@ -161,13 +164,8 @@ sal_Int32 ScCsvRuler::FindEmptyPos( sal_Int32 nPos, ScMoveMode eDir ) const void ScCsvRuler::MoveCursor( sal_Int32 nPos, bool bScroll ) { DisableRepaint(); - if( bScroll && IsValidSplitPos( nPos ) ) - { - if( nPos - SCROLL_DIST + 1 <= GetFirstVisPos() ) - CommitRequest( CSVREQ_POSOFFSET, nPos - SCROLL_DIST ); - else if( nPos + SCROLL_DIST >= GetLastVisPos() ) - CommitRequest( CSVREQ_POSOFFSET, nPos - GetVisPosCount() + SCROLL_DIST + 1 ); - } + if( bScroll ) + CommitRequest( CSVREQ_MAKEPOSVISIBLE, nPos ); CommitRequest( CSVREQ_MOVERULERCURSOR, IsVisibleSplitPos( nPos ) ? nPos : POS_INVALID ); EnableRepaint(); } @@ -335,12 +333,15 @@ void ScCsvRuler::MoveMouseTracking( sal_Int32 nPos ) { if( mnPosMTCurr != nPos ) { + DisableRepaint(); + MoveCursor( nPos ); if( (mnPosMTCurr != mnPosMTStart) && maOldSplits.HasSplit( mnPosMTCurr ) ) InsertSplit( nPos ); else MoveSplit( mnPosMTCurr, nPos ); mnPosMTCurr = nPos; mbPosMTMoved = true; + EnableRepaint(); } } @@ -354,6 +355,7 @@ void ScCsvRuler::EndMouseTracking( bool bApply ) } else // tracking cancelled { + MoveCursor( mnPosMTStart ); // move split to origin if( maOldSplits.HasSplit( mnPosMTStart ) ) MoveMouseTracking( mnPosMTStart ); @@ -432,14 +434,11 @@ void ScCsvRuler::MouseMove( const MouseEvent& rMEvt ) { // on mouse tracking: keep position valid nPos = Max( Min( nPos, GetPosCount() - 1L ), 1L ); - DisableRepaint(); - MoveCursor( nPos ); MoveMouseTracking( nPos ); - EnableRepaint(); } else { - Point aPoint; + Point aPoint; Rectangle aRect( aPoint, maWinSize ); if( !IsVisibleSplitPos( nPos ) || !aRect.IsInside( rMEvt.GetPosPixel() ) ) // if focused, keep old cursor position for key input @@ -508,9 +507,9 @@ void ScCsvRuler::ImplRedraw() { if( !IsValidGfx() ) { + ValidateGfx(); ImplDrawBackgrDev(); ImplDrawRulerDev(); - ValidateGfx(); } DrawOutDev( Point(), maWinSize, Point(), maWinSize, maRulerDev ); ImplDrawTrackingRect(); |