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