summaryrefslogtreecommitdiff
path: root/sc/source/ui/dbgui/csvruler.cxx
diff options
context:
space:
mode:
authorDaniel Rentz <dr@openoffice.org>2002-07-11 14:39:48 +0000
committerDaniel Rentz <dr@openoffice.org>2002-07-11 14:39:48 +0000
commitb53c4cfb5d5bb0cab1b69c0c895ac8c1af443c10 (patch)
treed55838237801f0c91f8c238f9c5d2a1048d57c57 /sc/source/ui/dbgui/csvruler.cxx
parentb2276ff593b1be77621a9cdef5dbe1619ecaf496 (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.cxx49
1 files changed, 24 insertions, 25 deletions
diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx
index 9865d0cd91b6..5044f806d395 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();