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