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