1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sc.hxx" 30 31 32 33 //------------------------------------------------------------------ 34 35 // INCLUDE --------------------------------------------------------------- 36 37 #include <vcl/help.hxx> 38 #include <vcl/svapp.hxx> 39 40 #include "tabview.hxx" 41 #include "document.hxx" 42 #include "docsh.hxx" 43 #include "scmod.hxx" 44 #include "gridwin.hxx" 45 #include "globstr.hrc" 46 #include "cell.hxx" 47 #include "dociter.hxx" 48 49 extern sal_uInt16 nScFillModeMouseModifier; // global.cxx 50 51 // STATIC DATA ----------------------------------------------------------- 52 53 //================================================================== 54 55 // 56 // --- Referenz-Eingabe / Fill-Cursor 57 // 58 59 void ScTabView::HideTip() 60 { 61 if ( nTipVisible ) 62 { 63 Help::HideTip( nTipVisible ); 64 nTipVisible = 0; 65 } 66 } 67 68 void ScTabView::ShowRefTip() 69 { 70 sal_Bool bDone = sal_False; 71 if ( aViewData.GetRefType() == SC_REFTYPE_REF && Help::IsQuickHelpEnabled() ) 72 { 73 SCCOL nStartX = aViewData.GetRefStartX(); 74 SCROW nStartY = aViewData.GetRefStartY(); 75 SCCOL nEndX = aViewData.GetRefEndX(); 76 SCROW nEndY = aViewData.GetRefEndY(); 77 if ( nEndX != nStartX || nEndY != nStartY ) // nicht fuer einzelne Zelle 78 { 79 sal_Bool bLeft = ( nEndX < nStartX ); 80 sal_Bool bTop = ( nEndY < nStartY ); 81 PutInOrder( nStartX, nEndX ); 82 PutInOrder( nStartY, nEndY ); 83 SCCOL nCols = nEndX+1-nStartX; 84 SCROW nRows = nEndY+1-nStartY; 85 86 String aHelp = ScGlobal::GetRscString( STR_QUICKHELP_REF ); 87 aHelp.SearchAndReplace( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("%1")), 88 String::CreateFromInt32(nRows) ); 89 aHelp.SearchAndReplace( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("%2")), 90 String::CreateFromInt32(nCols) ); 91 92 ScSplitPos eWhich = aViewData.GetActivePart(); 93 Window* pWin = pGridWin[eWhich]; 94 if ( pWin ) 95 { 96 Point aStart = aViewData.GetScrPos( nStartX, nStartY, eWhich ); 97 Point aEnd = aViewData.GetScrPos( nEndX+1, nEndY+1, eWhich ); 98 99 Point aPos( bLeft ? aStart.X() : ( aEnd.X() + 3 ), 100 bTop ? aStart.Y() : ( aEnd.Y() + 3 ) ); 101 sal_uInt16 nFlags = ( bLeft ? QUICKHELP_RIGHT : QUICKHELP_LEFT ) | 102 ( bTop ? QUICKHELP_BOTTOM : QUICKHELP_TOP ); 103 104 // nicht ueber die editierte Formel 105 if ( !bTop && aViewData.HasEditView( eWhich ) && 106 nEndY+1 == aViewData.GetEditViewRow() ) 107 { 108 // dann an der oberen Kante der editierten Zelle ausrichten 109 aPos.Y() -= 2; // die 3 von oben 110 nFlags = ( nFlags & ~QUICKHELP_TOP ) | QUICKHELP_BOTTOM; 111 } 112 113 Rectangle aRect( pWin->OutputToScreenPixel( aPos ), Size(1,1) ); 114 115 //! Test, ob geaendert ?? 116 117 HideTip(); 118 nTipVisible = Help::ShowTip( pWin, aRect, aHelp, nFlags ); 119 bDone = sal_True; 120 } 121 } 122 } 123 124 if (!bDone) 125 HideTip(); 126 } 127 128 void ScTabView::StopRefMode() 129 { 130 if (aViewData.IsRefMode()) 131 { 132 aViewData.SetRefMode( sal_False, SC_REFTYPE_NONE ); 133 134 HideTip(); 135 UpdateShrinkOverlay(); 136 137 if ( aViewData.GetTabNo() >= aViewData.GetRefStartZ() && 138 aViewData.GetTabNo() <= aViewData.GetRefEndZ() ) 139 { 140 ScDocument* pDoc = aViewData.GetDocument(); 141 SCCOL nStartX = aViewData.GetRefStartX(); 142 SCROW nStartY = aViewData.GetRefStartY(); 143 SCCOL nEndX = aViewData.GetRefEndX(); 144 SCROW nEndY = aViewData.GetRefEndY(); 145 if ( nStartX == nEndX && nStartY == nEndY ) 146 pDoc->ExtendMerge( nStartX, nStartY, nEndX, nEndY, aViewData.GetTabNo() ); 147 148 PaintArea( nStartX,nStartY,nEndX,nEndY, SC_UPDATE_MARKS ); 149 } 150 151 pSelEngine->Reset(); 152 pSelEngine->SetAddMode( sal_False ); //! sollte das nicht bei Reset passieren? 153 154 ScSplitPos eOld = pSelEngine->GetWhich(); 155 ScSplitPos eNew = aViewData.GetActivePart(); 156 if ( eNew != eOld ) 157 { 158 pSelEngine->SetWindow( pGridWin[ eNew ] ); 159 pSelEngine->SetWhich( eNew ); 160 pSelEngine->SetVisibleArea( Rectangle(Point(), 161 pGridWin[eNew]->GetOutputSizePixel()) ); 162 pGridWin[eOld]->MoveMouseStatus(*pGridWin[eNew]); 163 } 164 } 165 166 // AlignToCursor(SC_FOLLOW_NONE): Only switch active part. 167 // This must also be done if no RefMode was active (for RangeFinder dragging), 168 // but if RefMode was set, AlignToCursor must be after SelectionEngine reset, 169 // so the SelectionEngine SetWindow call from AlignToCursor doesn't capture 170 // the mouse again when called from Tracking/MouseButtonUp (#94562#). 171 AlignToCursor( aViewData.GetCurX(), aViewData.GetCurY(), SC_FOLLOW_NONE ); 172 } 173 174 void ScTabView::DoneRefMode( sal_Bool bContinue ) 175 { 176 ScDocument* pDoc = aViewData.GetDocument(); 177 if ( aViewData.GetRefType() == SC_REFTYPE_REF && bContinue ) 178 SC_MOD()->AddRefEntry(); 179 180 sal_Bool bWasRef = aViewData.IsRefMode(); 181 aViewData.SetRefMode( sal_False, SC_REFTYPE_NONE ); 182 183 HideTip(); 184 UpdateShrinkOverlay(); 185 186 // Paint: 187 if ( bWasRef && aViewData.GetTabNo() >= aViewData.GetRefStartZ() && 188 aViewData.GetTabNo() <= aViewData.GetRefEndZ() ) 189 { 190 SCCOL nStartX = aViewData.GetRefStartX(); 191 SCROW nStartY = aViewData.GetRefStartY(); 192 SCCOL nEndX = aViewData.GetRefEndX(); 193 SCROW nEndY = aViewData.GetRefEndY(); 194 if ( nStartX == nEndX && nStartY == nEndY ) 195 pDoc->ExtendMerge( nStartX, nStartY, nEndX, nEndY, aViewData.GetTabNo() ); 196 197 PaintArea( nStartX,nStartY,nEndX,nEndY, SC_UPDATE_MARKS ); 198 } 199 } 200 201 void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) 202 { 203 ScDocument* pDoc = aViewData.GetDocument(); 204 205 if (!aViewData.IsRefMode()) 206 { 207 // Das kommt vor, wenn bei einem Referenz-Dialog als erstes mit Control in die 208 // die Tabelle geklickt wird. Dann die neue Referenz an den alten Inhalt anhaengen: 209 210 ScModule* pScMod = SC_MOD(); 211 if (pScMod->IsFormulaMode()) 212 pScMod->AddRefEntry(); 213 214 InitRefMode( nCurX, nCurY, nCurZ, SC_REFTYPE_REF ); 215 } 216 217 if ( nCurX != aViewData.GetRefEndX() || nCurY != aViewData.GetRefEndY() || 218 nCurZ != aViewData.GetRefEndZ() ) 219 { 220 ScMarkData& rMark = aViewData.GetMarkData(); 221 SCTAB nTab = aViewData.GetTabNo(); 222 223 SCCOL nStartX = aViewData.GetRefStartX(); 224 SCROW nStartY = aViewData.GetRefStartY(); 225 SCCOL nEndX = aViewData.GetRefEndX(); 226 SCROW nEndY = aViewData.GetRefEndY(); 227 if ( nStartX == nEndX && nStartY == nEndY ) 228 pDoc->ExtendMerge( nStartX, nStartY, nEndX, nEndY, nTab ); 229 ScUpdateRect aRect( nStartX, nStartY, nEndX, nEndY ); 230 231 aViewData.SetRefEnd( nCurX, nCurY, nCurZ ); 232 233 nStartX = aViewData.GetRefStartX(); 234 nStartY = aViewData.GetRefStartY(); 235 nEndX = aViewData.GetRefEndX(); 236 nEndY = aViewData.GetRefEndY(); 237 if ( nStartX == nEndX && nStartY == nEndY ) 238 pDoc->ExtendMerge( nStartX, nStartY, nEndX, nEndY, nTab ); 239 aRect.SetNew( nStartX, nStartY, nEndX, nEndY ); 240 241 ScRefType eType = aViewData.GetRefType(); 242 if ( eType == SC_REFTYPE_REF ) 243 { 244 ScRange aRef( 245 aViewData.GetRefStartX(), aViewData.GetRefStartY(), aViewData.GetRefStartZ(), 246 aViewData.GetRefEndX(), aViewData.GetRefEndY(), aViewData.GetRefEndZ() ); 247 SC_MOD()->SetReference( aRef, pDoc, &rMark ); 248 ShowRefTip(); 249 } 250 else if ( eType == SC_REFTYPE_EMBED_LT || eType == SC_REFTYPE_EMBED_RB ) 251 { 252 PutInOrder(nStartX,nEndX); 253 PutInOrder(nStartY,nEndY); 254 pDoc->SetEmbedded( ScRange(nStartX,nStartY,nTab, nEndX,nEndY,nTab) ); 255 ScDocShell* pDocSh = aViewData.GetDocShell(); 256 pDocSh->UpdateOle( &aViewData, sal_True ); 257 pDocSh->SetDocumentModified(); 258 } 259 260 SCCOL nPaintStartX; 261 SCROW nPaintStartY; 262 SCCOL nPaintEndX; 263 SCROW nPaintEndY; 264 if (aRect.GetDiff( nPaintStartX, nPaintStartY, nPaintEndX, nPaintEndY )) 265 PaintArea( nPaintStartX, nPaintStartY, nPaintEndX, nPaintEndY, SC_UPDATE_MARKS ); 266 } 267 268 // Tip-Hilfe fuer Auto-Fill 269 270 if ( aViewData.GetRefType() == SC_REFTYPE_FILL && Help::IsQuickHelpEnabled() ) 271 { 272 String aHelpStr; 273 ScRange aMarkRange; 274 aViewData.GetSimpleArea( aMarkRange ); 275 SCCOL nEndX = aViewData.GetRefEndX(); 276 SCROW nEndY = aViewData.GetRefEndY(); 277 ScRange aDelRange; 278 if ( aViewData.GetFillMode() == SC_FILL_MATRIX && !(nScFillModeMouseModifier & KEY_MOD1) ) 279 { 280 aHelpStr = ScGlobal::GetRscString( STR_TIP_RESIZEMATRIX ); 281 SCCOL nCols = nEndX + 1 - aViewData.GetRefStartX(); // Reihenfolge ist richtig 282 SCROW nRows = nEndY + 1 - aViewData.GetRefStartY(); 283 aHelpStr.SearchAndReplace( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("%1")), 284 String::CreateFromInt32(nRows) ); 285 aHelpStr.SearchAndReplace( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("%2")), 286 String::CreateFromInt32(nCols) ); 287 } 288 else if ( aViewData.GetDelMark( aDelRange ) ) 289 aHelpStr = ScGlobal::GetRscString( STR_QUICKHELP_DELETE ); 290 else if ( nEndX != aMarkRange.aEnd.Col() || nEndY != aMarkRange.aEnd.Row() ) 291 aHelpStr = pDoc->GetAutoFillPreview( aMarkRange, nEndX, nEndY ); 292 293 // je nach Richtung die obere oder untere Ecke: 294 SCCOL nAddX = ( nEndX >= aMarkRange.aEnd.Col() ) ? 1 : 0; 295 SCROW nAddY = ( nEndY >= aMarkRange.aEnd.Row() ) ? 1 : 0; 296 Point aPos = aViewData.GetScrPos( nEndX+nAddX, nEndY+nAddY, aViewData.GetActivePart() ); 297 aPos.X() += 8; 298 aPos.Y() += 4; 299 Window* pWin = GetActiveWin(); 300 if ( pWin ) 301 aPos = pWin->OutputToScreenPixel( aPos ); 302 Rectangle aRect( aPos, aPos ); 303 sal_uInt16 nAlign = QUICKHELP_LEFT|QUICKHELP_TOP; 304 Help::ShowQuickHelp(pWin, aRect, aHelpStr, nAlign); 305 } 306 } 307 308 void ScTabView::InitRefMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScRefType eType, sal_Bool bPaint ) 309 { 310 ScDocument* pDoc = aViewData.GetDocument(); 311 ScMarkData& rMark = aViewData.GetMarkData(); 312 if (!aViewData.IsRefMode()) 313 { 314 aViewData.SetRefMode( sal_True, eType ); 315 aViewData.SetRefStart( nCurX, nCurY, nCurZ ); 316 aViewData.SetRefEnd( nCurX, nCurY, nCurZ ); 317 318 if (nCurZ == aViewData.GetTabNo() && bPaint) 319 { 320 SCCOL nStartX = nCurX; 321 SCROW nStartY = nCurY; 322 SCCOL nEndX = nCurX; 323 SCROW nEndY = nCurY; 324 pDoc->ExtendMerge( nStartX, nStartY, nEndX, nEndY, aViewData.GetTabNo() ); 325 326 //! nur Markierung ueber Inhalte zeichnen! 327 PaintArea( nStartX,nStartY,nEndX,nEndY, SC_UPDATE_MARKS ); 328 329 // SetReference ohne Merge-Anpassung 330 ScRange aRef( nCurX,nCurY,nCurZ, nCurX,nCurY,nCurZ ); 331 SC_MOD()->SetReference( aRef, pDoc, &rMark ); 332 } 333 } 334 } 335 336 //UNUSED2008-05 void ScTabView::EndSelection() 337 //UNUSED2008-05 { 338 //UNUSED2008-05 ScModule* pScMod = SC_MOD(); 339 //UNUSED2008-05 sal_Bool bRefMode = pScMod->IsFormulaMode(); 340 //UNUSED2008-05 if ( bRefMode ) 341 //UNUSED2008-05 pScMod->EndReference(); 342 //UNUSED2008-05 } 343 344 // static 345 void ScTabView::SetScrollBar( ScrollBar& rScroll, long nRangeMax, long nVisible, long nPos, sal_Bool bLayoutRTL ) 346 { 347 if ( nVisible == 0 ) 348 nVisible = 1; // #i59893# don't use visible size 0 349 350 // RTL layout uses a negative range to simulate a mirrored scroll bar. 351 // SetScrollBar/GetScrollBarPos hide this so outside of these functions normal cell 352 // addresses can be used. 353 354 if ( bLayoutRTL ) 355 { 356 rScroll.SetRange( Range( -nRangeMax, 0 ) ); 357 rScroll.SetVisibleSize( nVisible ); 358 rScroll.SetThumbPos( -nPos - nVisible ); 359 } 360 else 361 { 362 rScroll.SetRange( Range( 0, nRangeMax ) ); 363 rScroll.SetVisibleSize( nVisible ); 364 rScroll.SetThumbPos( nPos ); 365 } 366 } 367 368 // static 369 long ScTabView::GetScrollBarPos( ScrollBar& rScroll, sal_Bool bLayoutRTL ) 370 { 371 if ( bLayoutRTL ) 372 return -rScroll.GetThumbPos() - rScroll.GetVisibleSize(); 373 else 374 return rScroll.GetThumbPos(); 375 } 376 377 // UpdateScrollBars - sichtbaren Bereich und Scrollweite der Scrollbars einstellen 378 379 long lcl_UpdateBar( ScrollBar& rScroll, SCCOLROW nSize ) // Size = (komplette) Zellen 380 { 381 long nOldPos; 382 long nNewPos; 383 384 nOldPos = rScroll.GetThumbPos(); 385 rScroll.SetPageSize( static_cast<long>(nSize) ); 386 nNewPos = rScroll.GetThumbPos(); 387 #ifndef UNX 388 rScroll.SetPageSize( 1 ); // immer moeglich ! 389 #endif 390 391 return nNewPos - nOldPos; 392 } 393 394 long lcl_GetScrollRange( SCCOLROW nDocEnd, SCCOLROW nPos, SCCOLROW nVis, SCCOLROW nMax, SCCOLROW nStart ) 395 { 396 // get the end (positive) of a scroll bar range that always starts at 0 397 398 ++nVis; 399 ++nMax; // for partially visible cells 400 SCCOLROW nEnd = Max(nDocEnd, (SCCOLROW)(nPos+nVis)) + nVis; 401 if (nEnd > nMax) 402 nEnd = nMax; 403 404 return ( nEnd - nStart ); // for range starting at 0 405 } 406 407 void ScTabView::UpdateScrollBars() 408 { 409 long nDiff; 410 sal_Bool bTop = ( aViewData.GetVSplitMode() != SC_SPLIT_NONE ); 411 sal_Bool bRight = ( aViewData.GetHSplitMode() != SC_SPLIT_NONE ); 412 ScDocument* pDoc = aViewData.GetDocument(); 413 SCTAB nTab = aViewData.GetTabNo(); 414 sal_Bool bMirror = pDoc->IsLayoutRTL( nTab ) != Application::GetSettings().GetLayoutRTL(); 415 SCCOL nUsedX; 416 SCROW nUsedY; 417 pDoc->GetTableArea( nTab, nUsedX, nUsedY ); //! cachen !!!!!!!!!!!!!!! 418 419 SCCOL nVisXL = 0; 420 SCCOL nVisXR = 0; 421 SCROW nVisYB = 0; 422 SCROW nVisYT = 0; 423 424 SCCOL nStartX = 0; 425 SCROW nStartY = 0; 426 if (aViewData.GetHSplitMode()==SC_SPLIT_FIX) 427 nStartX = aViewData.GetFixPosX(); 428 if (aViewData.GetVSplitMode()==SC_SPLIT_FIX) 429 nStartY = aViewData.GetFixPosY(); 430 431 nVisXL = aViewData.VisibleCellsX( SC_SPLIT_LEFT ); 432 long nMaxXL = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_LEFT), nVisXL, MAXCOL, 0 ); 433 SetScrollBar( aHScrollLeft, nMaxXL, nVisXL, aViewData.GetPosX( SC_SPLIT_LEFT ), bMirror ); 434 435 nVisYB = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM ); 436 long nMaxYB = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_BOTTOM), nVisYB, MAXROW, nStartY ); 437 SetScrollBar( aVScrollBottom, nMaxYB, nVisYB, aViewData.GetPosY( SC_SPLIT_BOTTOM ) - nStartY, sal_False ); 438 439 if (bRight) 440 { 441 nVisXR = aViewData.VisibleCellsX( SC_SPLIT_RIGHT ); 442 long nMaxXR = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_RIGHT), nVisXR, MAXCOL, nStartX ); 443 SetScrollBar( aHScrollRight, nMaxXR, nVisXR, aViewData.GetPosX( SC_SPLIT_RIGHT ) - nStartX, bMirror ); 444 } 445 446 if (bTop) 447 { 448 nVisYT = aViewData.VisibleCellsY( SC_SPLIT_TOP ); 449 long nMaxYT = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_TOP), nVisYT, MAXROW, 0 ); 450 SetScrollBar( aVScrollTop, nMaxYT, nVisYT, aViewData.GetPosY( SC_SPLIT_TOP ), sal_False ); 451 } 452 453 // Bereich testen 454 455 nDiff = lcl_UpdateBar( aHScrollLeft, nVisXL ); 456 if (nDiff) ScrollX( nDiff, SC_SPLIT_LEFT ); 457 if (bRight) 458 { 459 nDiff = lcl_UpdateBar( aHScrollRight, nVisXR ); 460 if (nDiff) ScrollX( nDiff, SC_SPLIT_RIGHT ); 461 } 462 463 nDiff = lcl_UpdateBar( aVScrollBottom, nVisYB ); 464 if (nDiff) ScrollY( nDiff, SC_SPLIT_BOTTOM ); 465 if (bTop) 466 { 467 nDiff = lcl_UpdateBar( aVScrollTop, nVisYT ); 468 if (nDiff) ScrollY( nDiff, SC_SPLIT_TOP ); 469 } 470 471 // set visible area for online spelling 472 473 if ( aViewData.IsActive() ) 474 { 475 ScSplitPos eActive = aViewData.GetActivePart(); 476 ScHSplitPos eHWhich = WhichH( eActive ); 477 ScVSplitPos eVWhich = WhichV( eActive ); 478 SCCOL nPosX = aViewData.GetPosX(eHWhich); 479 SCROW nPosY = aViewData.GetPosY(eVWhich); 480 SCCOL nEndX = nPosX + ( ( eHWhich == SC_SPLIT_LEFT ) ? nVisXL : nVisXR ); 481 SCROW nEndY = nPosY + ( ( eVWhich == SC_SPLIT_TOP ) ? nVisYT : nVisYB ); 482 if ( nEndX > MAXCOL ) nEndX = MAXCOL; 483 if ( nEndY > MAXROW ) nEndY = MAXROW; 484 ScRange aVisible( nPosX, nPosY, nTab, nEndX, nEndY, nTab ); 485 if ( pDoc->SetVisibleSpellRange( aVisible ) ) 486 SC_MOD()->AnythingChanged(); // if visible area has changed 487 } 488 } 489 490 #ifndef HDR_SLIDERSIZE 491 #define HDR_SLIDERSIZE 2 492 #endif 493 494 void ScTabView::InvertHorizontal( ScVSplitPos eWhich, long nDragPos ) 495 { 496 for (sal_uInt16 i=0; i<4; i++) 497 if (WhichV((ScSplitPos)i)==eWhich) 498 { 499 ScGridWindow* pWin = pGridWin[i]; 500 if (pWin) 501 { 502 Rectangle aRect( 0,nDragPos, pWin->GetOutputSizePixel().Width()-1,nDragPos+HDR_SLIDERSIZE-1 ); 503 pWin->Update(); 504 pWin->DoInvertRect( aRect ); // Pixel 505 } 506 } 507 } 508 509 void ScTabView::InvertVertical( ScHSplitPos eWhich, long nDragPos ) 510 { 511 for (sal_uInt16 i=0; i<4; i++) 512 if (WhichH((ScSplitPos)i)==eWhich) 513 { 514 ScGridWindow* pWin = pGridWin[i]; 515 if (pWin) 516 { 517 Rectangle aRect( nDragPos,0, nDragPos+HDR_SLIDERSIZE-1,pWin->GetOutputSizePixel().Height()-1 ); 518 pWin->Update(); 519 pWin->DoInvertRect( aRect ); // Pixel 520 } 521 } 522 } 523 524 //================================================================== 525 526 void ScTabView::InterpretVisible() 527 { 528 // make sure all visible cells are interpreted, 529 // so the next paint will not execute a macro function 530 531 ScDocument* pDoc = aViewData.GetDocument(); 532 if ( !pDoc->GetAutoCalc() ) 533 return; 534 535 SCTAB nTab = aViewData.GetTabNo(); 536 for (sal_uInt16 i=0; i<4; i++) 537 { 538 // rely on gridwin pointers to find used panes 539 // no IsVisible test in case the whole view is not yet shown 540 541 if (pGridWin[i]) 542 { 543 ScHSplitPos eHWhich = WhichH( ScSplitPos(i) ); 544 ScVSplitPos eVWhich = WhichV( ScSplitPos(i) ); 545 546 SCCOL nX1 = aViewData.GetPosX( eHWhich ); 547 SCROW nY1 = aViewData.GetPosY( eVWhich ); 548 SCCOL nX2 = nX1 + aViewData.VisibleCellsX( eHWhich ); 549 SCROW nY2 = nY1 + aViewData.VisibleCellsY( eVWhich ); 550 551 if (nX2 > MAXCOL) nX2 = MAXCOL; 552 if (nY2 > MAXROW) nY2 = MAXROW; 553 554 ScCellIterator aIter( pDoc, nX1, nY1, nTab, nX2, nY2, nTab ); 555 ScBaseCell* pCell = aIter.GetFirst(); 556 while ( pCell ) 557 { 558 if ( pCell->GetCellType() == CELLTYPE_FORMULA && ((ScFormulaCell*)pCell)->GetDirty() ) 559 ((ScFormulaCell*)pCell)->Interpret(); 560 561 pCell = aIter.GetNext(); 562 } 563 } 564 } 565 566 // #i65047# repaint during the above loop may have set the bNeedsRepaint flag 567 CheckNeedsRepaint(); 568 } 569 570 571 572 573 574