1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_svtools.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "datwin.hxx" 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #ifndef GCC 34*cdf0e10cSrcweir #endif 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #ifndef _APP_HXX //autogen 37*cdf0e10cSrcweir #include <vcl/svapp.hxx> 38*cdf0e10cSrcweir #endif 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #ifndef _HELP_HXX 41*cdf0e10cSrcweir #include <vcl/help.hxx> 42*cdf0e10cSrcweir #endif 43*cdf0e10cSrcweir #ifndef _IMAGE_HXX 44*cdf0e10cSrcweir #include <vcl/image.hxx> 45*cdf0e10cSrcweir #endif 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir #include <tools/debug.hxx> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir DECLARE_LIST( BrowserColumns, BrowserColumn* ) 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir //=================================================================== 52*cdf0e10cSrcweir void ButtonFrame::Draw( OutputDevice& rDev ) 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir Color aOldFillColor = rDev.GetFillColor(); 55*cdf0e10cSrcweir Color aOldLineColor = rDev.GetLineColor(); 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir const StyleSettings &rSettings = rDev.GetSettings().GetStyleSettings(); 58*cdf0e10cSrcweir Color aColLight( rSettings.GetLightColor() ); 59*cdf0e10cSrcweir Color aColShadow( rSettings.GetShadowColor() ); 60*cdf0e10cSrcweir Color aColFace( rSettings.GetFaceColor() ); 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir rDev.SetLineColor( aColFace ); 63*cdf0e10cSrcweir rDev.SetFillColor( aColFace ); 64*cdf0e10cSrcweir rDev.DrawRect( aRect ); 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir if( rDev.GetOutDevType() == OUTDEV_WINDOW ) 67*cdf0e10cSrcweir { 68*cdf0e10cSrcweir Window *pWin = (Window*) &rDev; 69*cdf0e10cSrcweir if( bPressed ) 70*cdf0e10cSrcweir pWin->DrawSelectionBackground( aRect, 0, sal_True, sal_False, sal_False ); 71*cdf0e10cSrcweir } 72*cdf0e10cSrcweir else 73*cdf0e10cSrcweir { 74*cdf0e10cSrcweir rDev.SetLineColor( bPressed ? aColShadow : aColLight ); 75*cdf0e10cSrcweir rDev.DrawLine( aRect.TopLeft(), Point( aRect.Right(), aRect.Top() ) ); 76*cdf0e10cSrcweir rDev.DrawLine( aRect.TopLeft(), Point( aRect.Left(), aRect.Bottom() - 1 ) ); 77*cdf0e10cSrcweir rDev.SetLineColor( bPressed ? aColLight : aColShadow ); 78*cdf0e10cSrcweir rDev.DrawLine( aRect.BottomRight(), Point( aRect.Right(), aRect.Top() ) ); 79*cdf0e10cSrcweir rDev.DrawLine( aRect.BottomRight(), Point( aRect.Left(), aRect.Bottom() ) ); 80*cdf0e10cSrcweir } 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir if ( aText.Len() ) 83*cdf0e10cSrcweir { 84*cdf0e10cSrcweir String aVal = rDev.GetEllipsisString(aText,aInnerRect.GetWidth() - 2*MIN_COLUMNWIDTH); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir Font aFont( rDev.GetFont() ); 87*cdf0e10cSrcweir sal_Bool bOldTransp = aFont.IsTransparent(); 88*cdf0e10cSrcweir if ( !bOldTransp ) 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir aFont.SetTransparent( sal_True ); 91*cdf0e10cSrcweir rDev.SetFont( aFont ); 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir Color aOldColor = rDev.GetTextColor(); 95*cdf0e10cSrcweir if (m_bDrawDisabled) 96*cdf0e10cSrcweir rDev.SetTextColor(rSettings.GetDisableColor()); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir rDev.DrawText( Point( 99*cdf0e10cSrcweir ( aInnerRect.Left() + aInnerRect.Right() ) / 2 - ( rDev.GetTextWidth(aVal) / 2 ), 100*cdf0e10cSrcweir aInnerRect.Top() ), aVal ); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir // restore settings 103*cdf0e10cSrcweir if ( !bOldTransp ) 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir aFont.SetTransparent(sal_False); 106*cdf0e10cSrcweir rDev.SetFont( aFont ); 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir if (m_bDrawDisabled) 109*cdf0e10cSrcweir rDev.SetTextColor(aOldColor); 110*cdf0e10cSrcweir } 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir if ( bCurs ) 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir rDev.SetLineColor( Color( COL_BLACK ) ); 115*cdf0e10cSrcweir rDev.SetFillColor(); 116*cdf0e10cSrcweir rDev.DrawRect( Rectangle( 117*cdf0e10cSrcweir Point( aRect.Left(), aRect.Top() ), Point( aRect.Right(), aRect.Bottom() ) ) ); 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir rDev.SetLineColor( aOldLineColor ); 121*cdf0e10cSrcweir rDev.SetFillColor( aOldFillColor ); 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir //------------------------------------------------------------------- 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir BrowserColumn::BrowserColumn( sal_uInt16 nItemId, const class Image &rImage, 127*cdf0e10cSrcweir const String& rTitle, sal_uLong nWidthPixel, const Fraction& rCurrentZoom, 128*cdf0e10cSrcweir HeaderBarItemBits nFlags ) 129*cdf0e10cSrcweir : _nId( nItemId ), 130*cdf0e10cSrcweir _nWidth( nWidthPixel ), 131*cdf0e10cSrcweir _aImage( rImage ), 132*cdf0e10cSrcweir _aTitle( rTitle ), 133*cdf0e10cSrcweir _bFrozen( sal_False ), 134*cdf0e10cSrcweir _nFlags( nFlags ) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir double n = (double)_nWidth; 137*cdf0e10cSrcweir n *= (double)rCurrentZoom.GetDenominator(); 138*cdf0e10cSrcweir n /= (double)rCurrentZoom.GetNumerator(); 139*cdf0e10cSrcweir _nOriginalWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5); 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir BrowserColumn::~BrowserColumn() 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir } 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir //------------------------------------------------------------------- 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir void BrowserColumn::SetWidth(sal_uLong nNewWidthPixel, const Fraction& rCurrentZoom) 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir _nWidth = nNewWidthPixel; 151*cdf0e10cSrcweir double n = (double)_nWidth; 152*cdf0e10cSrcweir n *= (double)rCurrentZoom.GetDenominator(); 153*cdf0e10cSrcweir n /= (double)rCurrentZoom.GetNumerator(); 154*cdf0e10cSrcweir _nOriginalWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5); 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir //------------------------------------------------------------------- 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir void BrowserColumn::Draw( BrowseBox& rBox, OutputDevice& rDev, const Point& rPos, sal_Bool bCurs ) 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir if ( _nId == 0 ) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir // paint handle column 164*cdf0e10cSrcweir ButtonFrame( rPos, Size( Width()-1, rBox.GetDataRowHeight()-1 ), 165*cdf0e10cSrcweir String(), sal_False, bCurs, 166*cdf0e10cSrcweir 0 != (BROWSER_COLUMN_TITLEABBREVATION&_nFlags) ).Draw( rDev ); 167*cdf0e10cSrcweir Color aOldLineColor = rDev.GetLineColor(); 168*cdf0e10cSrcweir rDev.SetLineColor( Color( COL_BLACK ) ); 169*cdf0e10cSrcweir rDev.DrawLine( 170*cdf0e10cSrcweir Point( rPos.X(), rPos.Y()+rBox.GetDataRowHeight()-1 ), 171*cdf0e10cSrcweir Point( rPos.X() + Width() - 1, rPos.Y()+rBox.GetDataRowHeight()-1 ) ); 172*cdf0e10cSrcweir rDev.DrawLine( 173*cdf0e10cSrcweir Point( rPos.X() + Width() - 1, rPos.Y() ), 174*cdf0e10cSrcweir Point( rPos.X() + Width() - 1, rPos.Y()+rBox.GetDataRowHeight()-1 ) ); 175*cdf0e10cSrcweir rDev.SetLineColor( aOldLineColor ); 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir rBox.DoPaintField( rDev, 178*cdf0e10cSrcweir Rectangle( 179*cdf0e10cSrcweir Point( rPos.X() + 2, rPos.Y() + 2 ), 180*cdf0e10cSrcweir Size( Width()-1, rBox.GetDataRowHeight()-1 ) ), 181*cdf0e10cSrcweir GetId(), 182*cdf0e10cSrcweir BrowseBox::BrowserColumnAccess() ); 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir else 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir // paint data column 187*cdf0e10cSrcweir long nWidth = Width() == LONG_MAX ? rBox.GetDataWindow().GetSizePixel().Width() : Width(); 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir rBox.DoPaintField( rDev, 190*cdf0e10cSrcweir Rectangle( 191*cdf0e10cSrcweir Point( rPos.X() + MIN_COLUMNWIDTH, rPos.Y() ), 192*cdf0e10cSrcweir Size( nWidth-2*MIN_COLUMNWIDTH, rBox.GetDataRowHeight()-1 ) ), 193*cdf0e10cSrcweir GetId(), 194*cdf0e10cSrcweir BrowseBox::BrowserColumnAccess() ); 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir } 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir //------------------------------------------------------------------- 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir void BrowserColumn::ZoomChanged(const Fraction& rNewZoom) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir double n = (double)_nOriginalWidth; 203*cdf0e10cSrcweir n *= (double)rNewZoom.GetNumerator(); 204*cdf0e10cSrcweir n /= (double)rNewZoom.GetDenominator(); 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir _nWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5); 207*cdf0e10cSrcweir } 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir //------------------------------------------------------------------- 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir BrowserDataWin::BrowserDataWin( BrowseBox* pParent ) 212*cdf0e10cSrcweir :Control( pParent, WinBits(WB_CLIPCHILDREN) ) 213*cdf0e10cSrcweir ,DragSourceHelper( this ) 214*cdf0e10cSrcweir ,DropTargetHelper( this ) 215*cdf0e10cSrcweir ,pHeaderBar( 0 ) 216*cdf0e10cSrcweir ,pEventWin( pParent ) 217*cdf0e10cSrcweir ,pCornerWin( 0 ) 218*cdf0e10cSrcweir ,pDtorNotify( 0 ) 219*cdf0e10cSrcweir ,bInPaint( sal_False ) 220*cdf0e10cSrcweir ,bInCommand( sal_False ) 221*cdf0e10cSrcweir ,bNoScrollBack( sal_False ) 222*cdf0e10cSrcweir ,bNoHScroll( sal_False ) 223*cdf0e10cSrcweir ,bNoVScroll( sal_False ) 224*cdf0e10cSrcweir ,bUpdateMode( sal_True ) 225*cdf0e10cSrcweir ,bResizeOnPaint( sal_False ) 226*cdf0e10cSrcweir ,bUpdateOnUnlock( sal_False ) 227*cdf0e10cSrcweir ,bInUpdateScrollbars( sal_False ) 228*cdf0e10cSrcweir ,bHadRecursion( sal_False ) 229*cdf0e10cSrcweir ,bOwnDataChangedHdl( sal_False ) 230*cdf0e10cSrcweir ,bCallingDropCallback( sal_False ) 231*cdf0e10cSrcweir ,nUpdateLock( 0 ) 232*cdf0e10cSrcweir ,nCursorHidden( 0 ) 233*cdf0e10cSrcweir ,m_nDragRowDividerLimit( 0 ) 234*cdf0e10cSrcweir ,m_nDragRowDividerOffset( 0 ) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir aMouseTimer.SetTimeoutHdl( LINK( this, BrowserDataWin, RepeatedMouseMove ) ); 237*cdf0e10cSrcweir aMouseTimer.SetTimeout( 100 ); 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir //------------------------------------------------------------------- 241*cdf0e10cSrcweir BrowserDataWin::~BrowserDataWin() 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir if( pDtorNotify ) 244*cdf0e10cSrcweir *pDtorNotify = sal_True; 245*cdf0e10cSrcweir } 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir //------------------------------------------------------------------- 248*cdf0e10cSrcweir void BrowserDataWin::LeaveUpdateLock() 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir if ( !--nUpdateLock ) 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir DoOutstandingInvalidations(); 253*cdf0e10cSrcweir if (bUpdateOnUnlock ) 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir Control::Update(); 256*cdf0e10cSrcweir bUpdateOnUnlock = sal_False; 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir } 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir //------------------------------------------------------------------- 262*cdf0e10cSrcweir void InitSettings_Impl( Window *pWin, 263*cdf0e10cSrcweir sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ) 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir const StyleSettings& rStyleSettings = 266*cdf0e10cSrcweir pWin->GetSettings().GetStyleSettings(); 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir if ( bFont ) 269*cdf0e10cSrcweir { 270*cdf0e10cSrcweir Font aFont = rStyleSettings.GetFieldFont(); 271*cdf0e10cSrcweir if ( pWin->IsControlFont() ) 272*cdf0e10cSrcweir aFont.Merge( pWin->GetControlFont() ); 273*cdf0e10cSrcweir pWin->SetZoomedPointFont( aFont ); 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir if ( bFont || bForeground ) 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir Color aTextColor = rStyleSettings.GetWindowTextColor(); 279*cdf0e10cSrcweir if ( pWin->IsControlForeground() ) 280*cdf0e10cSrcweir aTextColor = pWin->GetControlForeground(); 281*cdf0e10cSrcweir pWin->SetTextColor( aTextColor ); 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir if ( bBackground ) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir if( pWin->IsControlBackground() ) 287*cdf0e10cSrcweir pWin->SetBackground( pWin->GetControlBackground() ); 288*cdf0e10cSrcweir else 289*cdf0e10cSrcweir pWin->SetBackground( rStyleSettings.GetWindowColor() ); 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir } 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir //------------------------------------------------------------------- 294*cdf0e10cSrcweir void BrowserDataWin::Update() 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir if ( !nUpdateLock ) 297*cdf0e10cSrcweir Control::Update(); 298*cdf0e10cSrcweir else 299*cdf0e10cSrcweir bUpdateOnUnlock = sal_True; 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir //------------------------------------------------------------------- 303*cdf0e10cSrcweir void BrowserDataWin::DataChanged( const DataChangedEvent& rDCEvt ) 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 306*cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir if( !bOwnDataChangedHdl ) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir InitSettings_Impl( this, sal_True, sal_True, sal_True ); 311*cdf0e10cSrcweir Invalidate(); 312*cdf0e10cSrcweir InitSettings_Impl( GetParent(), sal_True, sal_True, sal_True ); 313*cdf0e10cSrcweir GetParent()->Invalidate(); 314*cdf0e10cSrcweir GetParent()->Resize(); 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir else 318*cdf0e10cSrcweir Control::DataChanged( rDCEvt ); 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir //------------------------------------------------------------------- 322*cdf0e10cSrcweir void BrowserDataWin::Paint( const Rectangle& rRect ) 323*cdf0e10cSrcweir { 324*cdf0e10cSrcweir if ( !nUpdateLock && GetUpdateMode() ) 325*cdf0e10cSrcweir { 326*cdf0e10cSrcweir if ( bInPaint ) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir aInvalidRegion.Insert( new Rectangle( rRect ) ); 329*cdf0e10cSrcweir return; 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir bInPaint = sal_True; 332*cdf0e10cSrcweir ( (BrowseBox*) GetParent() )->PaintData( *this, rRect ); 333*cdf0e10cSrcweir bInPaint = sal_False; 334*cdf0e10cSrcweir DoOutstandingInvalidations(); 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir else 337*cdf0e10cSrcweir aInvalidRegion.Insert( new Rectangle( rRect ) ); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir //------------------------------------------------------------------- 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir BrowseEvent BrowserDataWin::CreateBrowseEvent( const Point& rPosPixel ) 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir BrowseBox *pBox = GetParent(); 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir // seek to row under mouse 347*cdf0e10cSrcweir long nRelRow = rPosPixel.Y() < 0 348*cdf0e10cSrcweir ? -1 349*cdf0e10cSrcweir : rPosPixel.Y() / pBox->GetDataRowHeight(); 350*cdf0e10cSrcweir long nRow = nRelRow < 0 ? -1 : nRelRow + pBox->nTopRow; 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir // find column under mouse 353*cdf0e10cSrcweir long nMouseX = rPosPixel.X(); 354*cdf0e10cSrcweir long nColX = 0; 355*cdf0e10cSrcweir sal_uInt16 nCol; 356*cdf0e10cSrcweir for ( nCol = 0; 357*cdf0e10cSrcweir nCol < pBox->pCols->Count() && nColX < GetSizePixel().Width(); 358*cdf0e10cSrcweir ++nCol ) 359*cdf0e10cSrcweir if ( pBox->pCols->GetObject(nCol)->IsFrozen() || nCol >= pBox->nFirstCol ) 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir nColX += pBox->pCols->GetObject(nCol)->Width(); 362*cdf0e10cSrcweir if ( nMouseX < nColX ) 363*cdf0e10cSrcweir break; 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir sal_uInt16 nColId = BROWSER_INVALIDID; 366*cdf0e10cSrcweir if ( nCol < pBox->pCols->Count() ) 367*cdf0e10cSrcweir nColId = pBox->pCols->GetObject(nCol)->GetId(); 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir // compute the field rectangle and field relative MouseEvent 370*cdf0e10cSrcweir Rectangle aFieldRect; 371*cdf0e10cSrcweir if ( nCol < pBox->pCols->Count() ) 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir nColX -= pBox->pCols->GetObject(nCol)->Width(); 374*cdf0e10cSrcweir aFieldRect = Rectangle( 375*cdf0e10cSrcweir Point( nColX, nRelRow * pBox->GetDataRowHeight() ), 376*cdf0e10cSrcweir Size( pBox->pCols->GetObject(nCol)->Width(), 377*cdf0e10cSrcweir pBox->GetDataRowHeight() ) ); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir // assemble and return the BrowseEvent 381*cdf0e10cSrcweir return BrowseEvent( this, nRow, nCol, nColId, aFieldRect ); 382*cdf0e10cSrcweir } 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir //------------------------------------------------------------------- 385*cdf0e10cSrcweir sal_Int8 BrowserDataWin::AcceptDrop( const AcceptDropEvent& _rEvt ) 386*cdf0e10cSrcweir { 387*cdf0e10cSrcweir bCallingDropCallback = sal_True; 388*cdf0e10cSrcweir sal_Int8 nReturn = DND_ACTION_NONE; 389*cdf0e10cSrcweir nReturn = GetParent()->AcceptDrop( BrowserAcceptDropEvent( this, _rEvt ) ); 390*cdf0e10cSrcweir bCallingDropCallback = sal_False; 391*cdf0e10cSrcweir return nReturn; 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir //------------------------------------------------------------------- 395*cdf0e10cSrcweir sal_Int8 BrowserDataWin::ExecuteDrop( const ExecuteDropEvent& _rEvt ) 396*cdf0e10cSrcweir { 397*cdf0e10cSrcweir bCallingDropCallback = sal_True; 398*cdf0e10cSrcweir sal_Int8 nReturn = DND_ACTION_NONE; 399*cdf0e10cSrcweir nReturn = GetParent()->ExecuteDrop( BrowserExecuteDropEvent( this, _rEvt ) ); 400*cdf0e10cSrcweir bCallingDropCallback = sal_False; 401*cdf0e10cSrcweir return nReturn; 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir //------------------------------------------------------------------- 405*cdf0e10cSrcweir void BrowserDataWin::StartDrag( sal_Int8 _nAction, const Point& _rPosPixel ) 406*cdf0e10cSrcweir { 407*cdf0e10cSrcweir if ( !GetParent()->bRowDividerDrag ) 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir Point aEventPos( _rPosPixel ); 410*cdf0e10cSrcweir aEventPos.Y() += GetParent()->GetTitleHeight(); 411*cdf0e10cSrcweir GetParent()->StartDrag( _nAction, aEventPos ); 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir //------------------------------------------------------------------- 416*cdf0e10cSrcweir void BrowserDataWin::Command( const CommandEvent& rEvt ) 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir // Scrollmaus-Event? 419*cdf0e10cSrcweir BrowseBox *pBox = GetParent(); 420*cdf0e10cSrcweir if ( ( (rEvt.GetCommand() == COMMAND_WHEEL) || 421*cdf0e10cSrcweir (rEvt.GetCommand() == COMMAND_STARTAUTOSCROLL) || 422*cdf0e10cSrcweir (rEvt.GetCommand() == COMMAND_AUTOSCROLL) ) && 423*cdf0e10cSrcweir ( HandleScrollCommand( rEvt, &pBox->aHScroll, pBox->pVScroll ) ) ) 424*cdf0e10cSrcweir return; 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir Point aEventPos( rEvt.GetMousePosPixel() ); 427*cdf0e10cSrcweir long nRow = pBox->GetRowAtYPosPixel( aEventPos.Y(), sal_False); 428*cdf0e10cSrcweir MouseEvent aMouseEvt( aEventPos, 1, MOUSE_SELECT, MOUSE_LEFT ); 429*cdf0e10cSrcweir if ( COMMAND_CONTEXTMENU == rEvt.GetCommand() && rEvt.IsMouseEvent() && 430*cdf0e10cSrcweir nRow < pBox->GetRowCount() && !pBox->IsRowSelected(nRow) ) 431*cdf0e10cSrcweir { 432*cdf0e10cSrcweir sal_Bool bDeleted = sal_False; 433*cdf0e10cSrcweir pDtorNotify = &bDeleted; 434*cdf0e10cSrcweir bInCommand = sal_True; 435*cdf0e10cSrcweir MouseButtonDown( aMouseEvt ); 436*cdf0e10cSrcweir if( bDeleted ) 437*cdf0e10cSrcweir return; 438*cdf0e10cSrcweir MouseButtonUp( aMouseEvt ); 439*cdf0e10cSrcweir if( bDeleted ) 440*cdf0e10cSrcweir return; 441*cdf0e10cSrcweir pDtorNotify = 0; 442*cdf0e10cSrcweir bInCommand = sal_False; 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir aEventPos.Y() += GetParent()->GetTitleHeight(); 446*cdf0e10cSrcweir CommandEvent aEvt( aEventPos, rEvt.GetCommand(), 447*cdf0e10cSrcweir rEvt.IsMouseEvent(), rEvt.GetData() ); 448*cdf0e10cSrcweir bInCommand = sal_True; 449*cdf0e10cSrcweir sal_Bool bDeleted = sal_False; 450*cdf0e10cSrcweir pDtorNotify = &bDeleted; 451*cdf0e10cSrcweir GetParent()->Command( aEvt ); 452*cdf0e10cSrcweir if( bDeleted ) 453*cdf0e10cSrcweir return; 454*cdf0e10cSrcweir pDtorNotify = 0; 455*cdf0e10cSrcweir bInCommand = sal_False; 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir if ( COMMAND_STARTDRAG == rEvt.GetCommand() ) 458*cdf0e10cSrcweir MouseButtonUp( aMouseEvt ); 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir Control::Command( rEvt ); 461*cdf0e10cSrcweir } 462*cdf0e10cSrcweir 463*cdf0e10cSrcweir //------------------------------------------------------------------- 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir sal_Bool BrowserDataWin::ImplRowDividerHitTest( const BrowserMouseEvent& _rEvent ) 466*cdf0e10cSrcweir { 467*cdf0e10cSrcweir if ( ! ( GetParent()->IsInteractiveRowHeightEnabled() 468*cdf0e10cSrcweir && ( _rEvent.GetRow() >= 0 ) 469*cdf0e10cSrcweir && ( _rEvent.GetRow() < GetParent()->GetRowCount() ) 470*cdf0e10cSrcweir && ( _rEvent.GetColumnId() == 0 ) 471*cdf0e10cSrcweir ) 472*cdf0e10cSrcweir ) 473*cdf0e10cSrcweir return sal_False; 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir long nDividerDistance = GetParent()->GetDataRowHeight() - ( _rEvent.GetPosPixel().Y() % GetParent()->GetDataRowHeight() ); 476*cdf0e10cSrcweir return ( nDividerDistance <= 4 ); 477*cdf0e10cSrcweir } 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir //------------------------------------------------------------------- 480*cdf0e10cSrcweir 481*cdf0e10cSrcweir void BrowserDataWin::MouseButtonDown( const MouseEvent& rEvt ) 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir aLastMousePos = OutputToScreenPixel( rEvt.GetPosPixel() ); 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir BrowserMouseEvent aBrowserEvent( this, rEvt ); 486*cdf0e10cSrcweir if ( ( aBrowserEvent.GetClicks() == 1 ) && ImplRowDividerHitTest( aBrowserEvent ) ) 487*cdf0e10cSrcweir { 488*cdf0e10cSrcweir StartRowDividerDrag( aBrowserEvent.GetPosPixel() ); 489*cdf0e10cSrcweir return; 490*cdf0e10cSrcweir } 491*cdf0e10cSrcweir 492*cdf0e10cSrcweir GetParent()->MouseButtonDown( BrowserMouseEvent( this, rEvt ) ); 493*cdf0e10cSrcweir } 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir //------------------------------------------------------------------- 496*cdf0e10cSrcweir 497*cdf0e10cSrcweir void BrowserDataWin::MouseMove( const MouseEvent& rEvt ) 498*cdf0e10cSrcweir { 499*cdf0e10cSrcweir // Pseudo MouseMoves verhindern 500*cdf0e10cSrcweir Point aNewPos = OutputToScreenPixel( rEvt.GetPosPixel() ); 501*cdf0e10cSrcweir if ( ( aNewPos == aLastMousePos ) ) 502*cdf0e10cSrcweir return; 503*cdf0e10cSrcweir aLastMousePos = aNewPos; 504*cdf0e10cSrcweir 505*cdf0e10cSrcweir // transform to a BrowseEvent 506*cdf0e10cSrcweir BrowserMouseEvent aBrowserEvent( this, rEvt ); 507*cdf0e10cSrcweir GetParent()->MouseMove( aBrowserEvent ); 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir // pointer shape 510*cdf0e10cSrcweir PointerStyle ePointerStyle = POINTER_ARROW; 511*cdf0e10cSrcweir if ( ImplRowDividerHitTest( aBrowserEvent ) ) 512*cdf0e10cSrcweir ePointerStyle = POINTER_VSIZEBAR; 513*cdf0e10cSrcweir SetPointer( Pointer( ePointerStyle ) ); 514*cdf0e10cSrcweir 515*cdf0e10cSrcweir // dragging out of the visible area? 516*cdf0e10cSrcweir if ( rEvt.IsLeft() && 517*cdf0e10cSrcweir ( rEvt.GetPosPixel().Y() > GetSizePixel().Height() || 518*cdf0e10cSrcweir rEvt.GetPosPixel().Y() < 0 ) ) 519*cdf0e10cSrcweir { 520*cdf0e10cSrcweir // repeat the event 521*cdf0e10cSrcweir aRepeatEvt = rEvt; 522*cdf0e10cSrcweir aMouseTimer.Start(); 523*cdf0e10cSrcweir } 524*cdf0e10cSrcweir else 525*cdf0e10cSrcweir // killing old repeat-event 526*cdf0e10cSrcweir if ( aMouseTimer.IsActive() ) 527*cdf0e10cSrcweir aMouseTimer.Stop(); 528*cdf0e10cSrcweir } 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir //------------------------------------------------------------------- 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir IMPL_LINK_INLINE_START( BrowserDataWin, RepeatedMouseMove, void *, EMPTYARG ) 533*cdf0e10cSrcweir { 534*cdf0e10cSrcweir GetParent()->MouseMove( BrowserMouseEvent( this, aRepeatEvt ) ); 535*cdf0e10cSrcweir return 0; 536*cdf0e10cSrcweir } 537*cdf0e10cSrcweir IMPL_LINK_INLINE_END( BrowserDataWin, RepeatedMouseMove, void *, EMPTYARG ) 538*cdf0e10cSrcweir 539*cdf0e10cSrcweir //------------------------------------------------------------------- 540*cdf0e10cSrcweir 541*cdf0e10cSrcweir void BrowserDataWin::MouseButtonUp( const MouseEvent& rEvt ) 542*cdf0e10cSrcweir { 543*cdf0e10cSrcweir // Pseudo MouseMoves verhindern 544*cdf0e10cSrcweir Point aNewPos = OutputToScreenPixel( rEvt.GetPosPixel() ); 545*cdf0e10cSrcweir aLastMousePos = aNewPos; 546*cdf0e10cSrcweir 547*cdf0e10cSrcweir // Move an die aktuelle Position simulieren 548*cdf0e10cSrcweir MouseMove( rEvt ); 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir // eigentliches Up-Handling 551*cdf0e10cSrcweir ReleaseMouse(); 552*cdf0e10cSrcweir if ( aMouseTimer.IsActive() ) 553*cdf0e10cSrcweir aMouseTimer.Stop(); 554*cdf0e10cSrcweir GetParent()->MouseButtonUp( BrowserMouseEvent( this, rEvt ) ); 555*cdf0e10cSrcweir } 556*cdf0e10cSrcweir 557*cdf0e10cSrcweir //------------------------------------------------------------------- 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir void BrowserDataWin::StartRowDividerDrag( const Point& _rStartPos ) 560*cdf0e10cSrcweir { 561*cdf0e10cSrcweir long nDataRowHeight = GetParent()->GetDataRowHeight(); 562*cdf0e10cSrcweir // the exact separation pos of the two rows 563*cdf0e10cSrcweir long nDragRowDividerCurrentPos = _rStartPos.Y(); 564*cdf0e10cSrcweir if ( ( nDragRowDividerCurrentPos % nDataRowHeight ) > nDataRowHeight / 2 ) 565*cdf0e10cSrcweir nDragRowDividerCurrentPos += nDataRowHeight; 566*cdf0e10cSrcweir nDragRowDividerCurrentPos /= nDataRowHeight; 567*cdf0e10cSrcweir nDragRowDividerCurrentPos *= nDataRowHeight; 568*cdf0e10cSrcweir 569*cdf0e10cSrcweir m_nDragRowDividerOffset = nDragRowDividerCurrentPos - _rStartPos.Y(); 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir m_nDragRowDividerLimit = nDragRowDividerCurrentPos - nDataRowHeight; 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir GetParent()->bRowDividerDrag = sal_True; 574*cdf0e10cSrcweir GetParent()->ImplStartTracking(); 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir Rectangle aDragSplitRect( 0, m_nDragRowDividerLimit, GetOutputSizePixel().Width(), nDragRowDividerCurrentPos ); 577*cdf0e10cSrcweir ShowTracking( aDragSplitRect, SHOWTRACK_SMALL ); 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir StartTracking(); 580*cdf0e10cSrcweir } 581*cdf0e10cSrcweir 582*cdf0e10cSrcweir //------------------------------------------------------------------- 583*cdf0e10cSrcweir 584*cdf0e10cSrcweir void BrowserDataWin::Tracking( const TrackingEvent& rTEvt ) 585*cdf0e10cSrcweir { 586*cdf0e10cSrcweir if ( !GetParent()->bRowDividerDrag ) 587*cdf0e10cSrcweir return; 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel(); 590*cdf0e10cSrcweir // stop resizing at our bottom line 591*cdf0e10cSrcweir if ( aMousePos.Y() > GetOutputSizePixel().Height() ) 592*cdf0e10cSrcweir aMousePos.Y() = GetOutputSizePixel().Height(); 593*cdf0e10cSrcweir 594*cdf0e10cSrcweir if ( rTEvt.IsTrackingEnded() ) 595*cdf0e10cSrcweir { 596*cdf0e10cSrcweir HideTracking(); 597*cdf0e10cSrcweir GetParent()->bRowDividerDrag = sal_False; 598*cdf0e10cSrcweir GetParent()->ImplEndTracking(); 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir if ( !rTEvt.IsTrackingCanceled() ) 601*cdf0e10cSrcweir { 602*cdf0e10cSrcweir long nNewRowHeight = aMousePos.Y() + m_nDragRowDividerOffset - m_nDragRowDividerLimit; 603*cdf0e10cSrcweir 604*cdf0e10cSrcweir // care for minimum row height 605*cdf0e10cSrcweir if ( nNewRowHeight < GetParent()->QueryMinimumRowHeight() ) 606*cdf0e10cSrcweir nNewRowHeight = GetParent()->QueryMinimumRowHeight(); 607*cdf0e10cSrcweir 608*cdf0e10cSrcweir GetParent()->SetDataRowHeight( nNewRowHeight ); 609*cdf0e10cSrcweir GetParent()->RowHeightChanged(); 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir } 612*cdf0e10cSrcweir else 613*cdf0e10cSrcweir { 614*cdf0e10cSrcweir GetParent()->ImplTracking(); 615*cdf0e10cSrcweir 616*cdf0e10cSrcweir long nDragRowDividerCurrentPos = aMousePos.Y() + m_nDragRowDividerOffset; 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir // care for minimum row height 619*cdf0e10cSrcweir if ( nDragRowDividerCurrentPos < m_nDragRowDividerLimit + GetParent()->QueryMinimumRowHeight() ) 620*cdf0e10cSrcweir nDragRowDividerCurrentPos = m_nDragRowDividerLimit + GetParent()->QueryMinimumRowHeight(); 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir Rectangle aDragSplitRect( 0, m_nDragRowDividerLimit, GetOutputSizePixel().Width(), nDragRowDividerCurrentPos ); 623*cdf0e10cSrcweir ShowTracking( aDragSplitRect, SHOWTRACK_SMALL ); 624*cdf0e10cSrcweir } 625*cdf0e10cSrcweir } 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir //------------------------------------------------------------------- 628*cdf0e10cSrcweir 629*cdf0e10cSrcweir void BrowserDataWin::KeyInput( const KeyEvent& rEvt ) 630*cdf0e10cSrcweir { 631*cdf0e10cSrcweir // pass to parent window 632*cdf0e10cSrcweir if ( !GetParent()->ProcessKey( rEvt ) ) 633*cdf0e10cSrcweir Control::KeyInput( rEvt ); 634*cdf0e10cSrcweir } 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir //------------------------------------------------------------------- 637*cdf0e10cSrcweir 638*cdf0e10cSrcweir void BrowserDataWin::RequestHelp( const HelpEvent& rHEvt ) 639*cdf0e10cSrcweir { 640*cdf0e10cSrcweir pEventWin = this; 641*cdf0e10cSrcweir GetParent()->RequestHelp( rHEvt ); 642*cdf0e10cSrcweir pEventWin = GetParent(); 643*cdf0e10cSrcweir } 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir //=================================================================== 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir BrowseEvent::BrowseEvent( Window* pWindow, 648*cdf0e10cSrcweir long nAbsRow, sal_uInt16 nColumn, sal_uInt16 nColumnId, 649*cdf0e10cSrcweir const Rectangle& rRect ): 650*cdf0e10cSrcweir pWin(pWindow), 651*cdf0e10cSrcweir nRow(nAbsRow), 652*cdf0e10cSrcweir aRect(rRect), 653*cdf0e10cSrcweir nCol(nColumn), 654*cdf0e10cSrcweir nColId(nColumnId) 655*cdf0e10cSrcweir { 656*cdf0e10cSrcweir } 657*cdf0e10cSrcweir 658*cdf0e10cSrcweir //=================================================================== 659*cdf0e10cSrcweir BrowserMouseEvent::BrowserMouseEvent( BrowserDataWin *pWindow, 660*cdf0e10cSrcweir const MouseEvent& rEvt ): 661*cdf0e10cSrcweir MouseEvent(rEvt), 662*cdf0e10cSrcweir BrowseEvent( pWindow->CreateBrowseEvent( rEvt.GetPosPixel() ) ) 663*cdf0e10cSrcweir { 664*cdf0e10cSrcweir } 665*cdf0e10cSrcweir 666*cdf0e10cSrcweir //------------------------------------------------------------------- 667*cdf0e10cSrcweir 668*cdf0e10cSrcweir BrowserMouseEvent::BrowserMouseEvent( Window *pWindow, const MouseEvent& rEvt, 669*cdf0e10cSrcweir long nAbsRow, sal_uInt16 nColumn, sal_uInt16 nColumnId, 670*cdf0e10cSrcweir const Rectangle& rRect ): 671*cdf0e10cSrcweir MouseEvent(rEvt), 672*cdf0e10cSrcweir BrowseEvent( pWindow, nAbsRow, nColumn, nColumnId, rRect ) 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir //=================================================================== 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir BrowserAcceptDropEvent::BrowserAcceptDropEvent( BrowserDataWin *pWindow, const AcceptDropEvent& rEvt ) 679*cdf0e10cSrcweir :AcceptDropEvent(rEvt) 680*cdf0e10cSrcweir ,BrowseEvent( pWindow->CreateBrowseEvent( rEvt.maPosPixel ) ) 681*cdf0e10cSrcweir { 682*cdf0e10cSrcweir } 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir //=================================================================== 685*cdf0e10cSrcweir 686*cdf0e10cSrcweir BrowserExecuteDropEvent::BrowserExecuteDropEvent( BrowserDataWin *pWindow, const ExecuteDropEvent& rEvt ) 687*cdf0e10cSrcweir :ExecuteDropEvent(rEvt) 688*cdf0e10cSrcweir ,BrowseEvent( pWindow->CreateBrowseEvent( rEvt.maPosPixel ) ) 689*cdf0e10cSrcweir { 690*cdf0e10cSrcweir } 691*cdf0e10cSrcweir 692*cdf0e10cSrcweir //=================================================================== 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir //------------------------------------------------------------------- 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir void BrowserDataWin::SetUpdateMode( sal_Bool bMode ) 697*cdf0e10cSrcweir { 698*cdf0e10cSrcweir DBG_ASSERT( !bUpdateMode || aInvalidRegion.Count() == 0, 699*cdf0e10cSrcweir "invalid region not empty" ); 700*cdf0e10cSrcweir if ( bMode == bUpdateMode ) 701*cdf0e10cSrcweir return; 702*cdf0e10cSrcweir 703*cdf0e10cSrcweir bUpdateMode = bMode; 704*cdf0e10cSrcweir if ( bMode ) 705*cdf0e10cSrcweir DoOutstandingInvalidations(); 706*cdf0e10cSrcweir } 707*cdf0e10cSrcweir 708*cdf0e10cSrcweir //------------------------------------------------------------------- 709*cdf0e10cSrcweir void BrowserDataWin::DoOutstandingInvalidations() 710*cdf0e10cSrcweir { 711*cdf0e10cSrcweir for ( Rectangle* pRect = aInvalidRegion.First(); 712*cdf0e10cSrcweir pRect; 713*cdf0e10cSrcweir pRect = aInvalidRegion.Next() ) 714*cdf0e10cSrcweir { 715*cdf0e10cSrcweir Control::Invalidate( *pRect ); 716*cdf0e10cSrcweir delete pRect; 717*cdf0e10cSrcweir } 718*cdf0e10cSrcweir aInvalidRegion.Clear(); 719*cdf0e10cSrcweir } 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir //------------------------------------------------------------------- 722*cdf0e10cSrcweir 723*cdf0e10cSrcweir void BrowserDataWin::Invalidate( sal_uInt16 nFlags ) 724*cdf0e10cSrcweir { 725*cdf0e10cSrcweir if ( !GetUpdateMode() ) 726*cdf0e10cSrcweir { 727*cdf0e10cSrcweir for ( Rectangle* pRect = aInvalidRegion.First(); 728*cdf0e10cSrcweir pRect; 729*cdf0e10cSrcweir pRect = aInvalidRegion.Next() ) 730*cdf0e10cSrcweir delete pRect; 731*cdf0e10cSrcweir aInvalidRegion.Clear(); 732*cdf0e10cSrcweir aInvalidRegion.Insert( new Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) ); 733*cdf0e10cSrcweir } 734*cdf0e10cSrcweir else 735*cdf0e10cSrcweir Window::Invalidate( nFlags ); 736*cdf0e10cSrcweir } 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir //------------------------------------------------------------------- 739*cdf0e10cSrcweir 740*cdf0e10cSrcweir void BrowserDataWin::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags ) 741*cdf0e10cSrcweir { 742*cdf0e10cSrcweir if ( !GetUpdateMode() ) 743*cdf0e10cSrcweir aInvalidRegion.Insert( new Rectangle( rRect ) ); 744*cdf0e10cSrcweir else 745*cdf0e10cSrcweir Window::Invalidate( rRect, nFlags ); 746*cdf0e10cSrcweir } 747*cdf0e10cSrcweir 748*cdf0e10cSrcweir //=================================================================== 749*cdf0e10cSrcweir 750*cdf0e10cSrcweir void BrowserScrollBar::Tracking( const TrackingEvent& rTEvt ) 751*cdf0e10cSrcweir { 752*cdf0e10cSrcweir sal_uLong nPos = GetThumbPos(); 753*cdf0e10cSrcweir if ( nPos != _nLastPos ) 754*cdf0e10cSrcweir { 755*cdf0e10cSrcweir String aTip( String::CreateFromInt32(nPos) ); 756*cdf0e10cSrcweir aTip += '/'; 757*cdf0e10cSrcweir if ( _pDataWin->GetRealRowCount().Len() ) 758*cdf0e10cSrcweir aTip += _pDataWin->GetRealRowCount(); 759*cdf0e10cSrcweir else 760*cdf0e10cSrcweir aTip += String::CreateFromInt32(GetRangeMax()); 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir Rectangle aRect( GetPointerPosPixel(), Size( GetTextHeight(), GetTextWidth( aTip ) ) ); 763*cdf0e10cSrcweir if ( _nTip ) 764*cdf0e10cSrcweir Help::UpdateTip( _nTip, this, aRect, aTip ); 765*cdf0e10cSrcweir else 766*cdf0e10cSrcweir _nTip = Help::ShowTip( this, aRect, aTip ); 767*cdf0e10cSrcweir _nLastPos = nPos; 768*cdf0e10cSrcweir } 769*cdf0e10cSrcweir 770*cdf0e10cSrcweir ScrollBar::Tracking( rTEvt ); 771*cdf0e10cSrcweir } 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir //------------------------------------------------------------------- 774*cdf0e10cSrcweir 775*cdf0e10cSrcweir void BrowserScrollBar::EndScroll() 776*cdf0e10cSrcweir { 777*cdf0e10cSrcweir if ( _nTip ) 778*cdf0e10cSrcweir Help::HideTip( _nTip ); 779*cdf0e10cSrcweir _nTip = 0; 780*cdf0e10cSrcweir ScrollBar::EndScroll(); 781*cdf0e10cSrcweir } 782*cdf0e10cSrcweir 783*cdf0e10cSrcweir 784