1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <rangelst.hxx>
21 #include "scitems.hxx"
22 #include <editeng/eeitem.hxx>
25 #include <editeng/brushitem.hxx>
26 #include <editeng/editview.hxx>
27 #include <svx/fmshell.hxx>
28 #include <svx/svdoole2.hxx>
29 #include <sfx2/bindings.hxx>
30 #include <sfx2/viewfrm.hxx>
31 #include <vcl/cursor.hxx>
33 #include "tabview.hxx"
34 #include "tabvwsh.hxx"
36 #include "gridwin.hxx"
37 #include "olinewin.hxx"
38 #include "colrowba.hxx"
39 #include "tabcont.hxx"
41 #include "uiitems.hxx"
43 #include "viewutil.hxx"
44 #include "editutil.hxx"
45 #include "inputhdl.hxx"
46 #include "inputwin.hxx"
47 #include "validat.hxx"
48 #include "hintwin.hxx"
49 #include "inputopt.hxx"
50 #include "rfindlst.hxx"
51 #include "hiranges.hxx"
52 #include "viewuno.hxx"
53 #include "chartarr.hxx"
54 #include "anyrefdg.hxx"
55 #include "dpobject.hxx"
56 #include "patattr.hxx"
57 #include "dociter.hxx"
58 #include "seltrans.hxx"
59 #include "fillinfo.hxx"
60 #include "AccessibilityHints.hxx"
61 #include "rangeutl.hxx"
63 #include "tabprotection.hxx"
64 #include "markdata.hxx"
65 #include "formula/FormulaCompiler.hxx"
67 #include <com/sun/star/chart2/data/HighlightedRange.hpp>
72 ScRange
lcl_getSubRangeByIndex( const ScRange
& rRange
, sal_Int32 nIndex
)
74 ScAddress
aResult( rRange
.aStart
);
76 SCCOL nWidth
= rRange
.aEnd
.Col() - rRange
.aStart
.Col() + 1;
77 SCROW nHeight
= rRange
.aEnd
.Row() - rRange
.aStart
.Row() + 1;
78 SCTAB nDepth
= rRange
.aEnd
.Tab() - rRange
.aStart
.Tab() + 1;
79 if( (nWidth
> 0) && (nHeight
> 0) && (nDepth
> 0) )
81 // row by row from first to last sheet
82 sal_Int32 nArea
= nWidth
* nHeight
;
83 aResult
.IncCol( static_cast< SCsCOL
>( nIndex
% nWidth
) );
84 aResult
.IncRow( static_cast< SCsROW
>( (nIndex
% nArea
) / nWidth
) );
85 aResult
.IncTab( static_cast< SCsTAB
>( nIndex
/ nArea
) );
86 if( !rRange
.In( aResult
) )
87 aResult
= rRange
.aStart
;
90 return ScRange( aResult
);
93 } // anonymous namespace
95 using namespace com::sun::star
;
97 // -----------------------------------------------------------------------
100 // --- Public-Funktionen
103 void ScTabView::ClickCursor( SCCOL nPosX
, SCROW nPosY
, bool bControl
)
105 ScDocument
* pDoc
= aViewData
.GetDocument();
106 SCTAB nTab
= aViewData
.GetTabNo();
107 pDoc
->SkipOverlapped(nPosX
, nPosY
, nTab
);
109 bool bRefMode
= SC_MOD()->IsFormulaMode();
113 DoneRefMode( false );
116 SC_MOD()->AddRefEntry();
118 InitRefMode( nPosX
, nPosY
, nTab
, SC_REFTYPE_REF
);
122 DoneBlockMode( bControl
);
123 aViewData
.ResetOldCursor();
124 SetCursor( (SCCOL
) nPosX
, (SCROW
) nPosY
);
128 void ScTabView::UpdateAutoFillMark()
130 // single selection or cursor
132 bool bMarked
= (aViewData
.GetSimpleArea( aMarkRange
) == SC_MARK_SIMPLE
);
136 if (pGridWin
[i
] && pGridWin
[i
]->IsVisible())
137 pGridWin
[i
]->UpdateAutoFillMark( bMarked
, aMarkRange
);
141 if (pColBar
[i
] && pColBar
[i
]->IsVisible())
142 pColBar
[i
]->SetMark( bMarked
, aMarkRange
.aStart
.Col(), aMarkRange
.aEnd
.Col() );
143 if (pRowBar
[i
] && pRowBar
[i
]->IsVisible())
144 pRowBar
[i
]->SetMark( bMarked
, aMarkRange
.aStart
.Row(), aMarkRange
.aEnd
.Row() );
147 // selection transfer object is checked together with AutoFill marks,
148 // because it has the same requirement of a single continuous block.
149 CheckSelectionTransfer(); // update selection transfer object
152 void ScTabView::FakeButtonUp( ScSplitPos eWhich
)
154 if (pGridWin
[eWhich
])
155 pGridWin
[eWhich
]->FakeButtonUp();
158 void ScTabView::HideAllCursors()
160 for (sal_uInt16 i
=0; i
<4; i
++)
162 if (pGridWin
[i
]->IsVisible())
164 Cursor
* pCur
= pGridWin
[i
]->GetCursor();
166 if (pCur
->IsVisible())
168 pGridWin
[i
]->HideCursor();
172 void ScTabView::ShowAllCursors()
174 for (sal_uInt16 i
=0; i
<4; i
++)
176 if (pGridWin
[i
]->IsVisible())
178 pGridWin
[i
]->ShowCursor();
181 pGridWin
[i
]->CursorChanged();
185 void ScTabView::ShowCursor()
187 pGridWin
[aViewData
.GetActivePart()]->ShowCursor();
190 pGridWin
[aViewData
.GetActivePart()]->CursorChanged();
193 void ScTabView::InvalidateAttribs()
195 SfxBindings
& rBindings
= aViewData
.GetBindings();
197 rBindings
.Invalidate( SID_STYLE_APPLY
);
198 rBindings
.Invalidate( SID_STYLE_FAMILY2
);
199 // StarCalc kennt nur Absatz- bzw. Zellformat-Vorlagen
201 rBindings
.Invalidate( SID_ATTR_CHAR_FONT
);
202 rBindings
.Invalidate( SID_ATTR_CHAR_FONTHEIGHT
);
203 rBindings
.Invalidate( SID_ATTR_CHAR_COLOR
);
205 rBindings
.Invalidate( SID_ATTR_CHAR_WEIGHT
);
206 rBindings
.Invalidate( SID_ATTR_CHAR_POSTURE
);
207 rBindings
.Invalidate( SID_ATTR_CHAR_UNDERLINE
);
208 rBindings
.Invalidate( SID_ULINE_VAL_NONE
);
209 rBindings
.Invalidate( SID_ULINE_VAL_SINGLE
);
210 rBindings
.Invalidate( SID_ULINE_VAL_DOUBLE
);
211 rBindings
.Invalidate( SID_ULINE_VAL_DOTTED
);
213 rBindings
.Invalidate( SID_ATTR_CHAR_OVERLINE
);
215 rBindings
.Invalidate( SID_ATTR_CHAR_KERNING
);
216 rBindings
.Invalidate( SID_SET_SUPER_SCRIPT
);
217 rBindings
.Invalidate( SID_SET_SUB_SCRIPT
);
218 rBindings
.Invalidate( SID_ATTR_CHAR_STRIKEOUT
);
219 rBindings
.Invalidate( SID_ATTR_CHAR_SHADOWED
);
221 rBindings
.Invalidate( SID_ATTR_PARA_ADJUST_LEFT
);
222 rBindings
.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT
);
223 rBindings
.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK
);
224 rBindings
.Invalidate( SID_ATTR_PARA_ADJUST_CENTER
);
225 rBindings
.Invalidate( SID_NUMBER_TYPE_FORMAT
);
227 rBindings
.Invalidate( SID_ALIGNLEFT
);
228 rBindings
.Invalidate( SID_ALIGNRIGHT
);
229 rBindings
.Invalidate( SID_ALIGNBLOCK
);
230 rBindings
.Invalidate( SID_ALIGNCENTERHOR
);
232 rBindings
.Invalidate( SID_ALIGNTOP
);
233 rBindings
.Invalidate( SID_ALIGNBOTTOM
);
234 rBindings
.Invalidate( SID_ALIGNCENTERVER
);
236 // stuff for sidebar panels
238 rBindings
.Invalidate( SID_H_ALIGNCELL
);
239 rBindings
.Invalidate( SID_V_ALIGNCELL
);
240 rBindings
.Invalidate( SID_ATTR_ALIGN_INDENT
);
241 rBindings
.Invalidate( SID_FRAME_LINECOLOR
);
242 rBindings
.Invalidate( SID_FRAME_LINESTYLE
);
243 rBindings
.Invalidate( SID_ATTR_BORDER_OUTER
);
244 rBindings
.Invalidate( SID_ATTR_BORDER_INNER
);
245 rBindings
.Invalidate( SID_SCGRIDSHOW
);
246 rBindings
.Invalidate( SID_ATTR_BORDER_DIAG_TLBR
);
247 rBindings
.Invalidate( SID_ATTR_BORDER_DIAG_BLTR
);
248 rBindings
.Invalidate( SID_NUMBER_TYPE_FORMAT
);
251 rBindings
.Invalidate( SID_BACKGROUND_COLOR
);
253 rBindings
.Invalidate( SID_ATTR_ALIGN_LINEBREAK
);
254 rBindings
.Invalidate( SID_NUMBER_FORMAT
);
256 rBindings
.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT
);
257 rBindings
.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM
);
258 rBindings
.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT
);
259 rBindings
.Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT
);
261 // pseudo slots for Format menu
262 rBindings
.Invalidate( SID_ALIGN_ANY_HDEFAULT
);
263 rBindings
.Invalidate( SID_ALIGN_ANY_LEFT
);
264 rBindings
.Invalidate( SID_ALIGN_ANY_HCENTER
);
265 rBindings
.Invalidate( SID_ALIGN_ANY_RIGHT
);
266 rBindings
.Invalidate( SID_ALIGN_ANY_JUSTIFIED
);
267 rBindings
.Invalidate( SID_ALIGN_ANY_VDEFAULT
);
268 rBindings
.Invalidate( SID_ALIGN_ANY_TOP
);
269 rBindings
.Invalidate( SID_ALIGN_ANY_VCENTER
);
270 rBindings
.Invalidate( SID_ALIGN_ANY_BOTTOM
);
272 rBindings
.Invalidate( SID_NUMBER_CURRENCY
);
273 rBindings
.Invalidate( SID_NUMBER_SCIENTIFIC
);
274 rBindings
.Invalidate( SID_NUMBER_DATE
);
275 rBindings
.Invalidate( SID_NUMBER_CURRENCY
);
276 rBindings
.Invalidate( SID_NUMBER_PERCENT
);
277 rBindings
.Invalidate( SID_NUMBER_TIME
);
280 // SetCursor - Cursor setzen, zeichnen, InputWin updaten
281 // oder Referenz verschicken
282 // ohne Optimierung wegen BugId 29307
284 void ScTabView::SetCursor( SCCOL nPosX
, SCROW nPosY
, bool bNew
)
286 SCCOL nOldX
= aViewData
.GetCurX();
287 SCROW nOldY
= aViewData
.GetCurY();
289 // DeactivateIP nur noch bei MarkListHasChanged
291 if ( nPosX
!= nOldX
|| nPosY
!= nOldY
|| bNew
)
293 ScTabViewShell
* pViewShell
= aViewData
.GetViewShell();
294 bool bRefMode
= ( pViewShell
? pViewShell
->IsRefInputMode() : false );
295 if ( aViewData
.HasEditView( aViewData
.GetActivePart() ) && !bRefMode
) // 23259 oder so
302 aViewData
.SetCurX( nPosX
);
303 aViewData
.SetCurY( nPosY
);
311 void ScTabView::CheckSelectionTransfer()
313 if ( aViewData
.IsActive() ) // only for active view
315 ScModule
* pScMod
= SC_MOD();
316 ScSelectionTransferObj
* pOld
= pScMod
->GetSelectionTransfer();
317 if ( pOld
&& pOld
->GetView() == this && pOld
->StillValid() )
319 // selection not changed - nothing to do
323 ScSelectionTransferObj
* pNew
= ScSelectionTransferObj::CreateFromView( this );
326 // create new selection
331 uno::Reference
<datatransfer::XTransferable
> xRef( pNew
);
332 pScMod
->SetSelectionTransfer( pNew
);
333 pNew
->CopyToSelection( GetActiveWin() ); // may delete pOld
335 else if ( pOld
&& pOld
->GetView() == this )
337 // remove own selection
340 pScMod
->SetSelectionTransfer( NULL
);
341 TransferableHelper::ClearSelection( GetActiveWin() ); // may delete pOld
343 // else: selection from outside: leave unchanged
348 // Eingabezeile / Menues updaten
349 // CursorPosChanged ruft SelectionChanged
350 // SelectionChanged ruft CellContentChanged
352 void ScTabView::CellContentChanged()
354 SfxBindings
& rBindings
= aViewData
.GetBindings();
356 rBindings
.Invalidate( SID_ATTR_SIZE
); // -> Fehlermeldungen anzeigen
357 rBindings
.Invalidate( SID_THESAURUS
);
358 rBindings
.Invalidate( SID_HYPERLINK_GETLINK
);
360 InvalidateAttribs(); // Attribut-Updates
362 aViewData
.GetViewShell()->UpdateInputHandler();
365 void ScTabView::SelectionChanged()
367 SfxViewFrame
* pViewFrame
= aViewData
.GetViewShell()->GetViewFrame();
370 uno::Reference
<frame::XController
> xController
= pViewFrame
->GetFrame().GetController();
371 if (xController
.is())
373 ScTabViewObj
* pImp
= ScTabViewObj::getImplementation( xController
);
375 pImp
->SelectionChanged();
379 UpdateAutoFillMark(); // also calls CheckSelectionTransfer
381 SfxBindings
& rBindings
= aViewData
.GetBindings();
383 rBindings
.Invalidate( SID_CURRENTCELL
); // -> Navigator
384 rBindings
.Invalidate( SID_AUTO_FILTER
); // -> Menue
385 rBindings
.Invalidate( FID_NOTE_VISIBLE
);
386 rBindings
.Invalidate( FID_SHOW_NOTE
);
387 rBindings
.Invalidate( FID_HIDE_NOTE
);
388 rBindings
.Invalidate( SID_DELETE_NOTE
);
390 // Funktionen, die evtl disabled werden muessen
392 rBindings
.Invalidate( FID_INS_ROWBRK
);
393 rBindings
.Invalidate( FID_INS_COLBRK
);
394 rBindings
.Invalidate( FID_DEL_ROWBRK
);
395 rBindings
.Invalidate( FID_DEL_COLBRK
);
396 rBindings
.Invalidate( FID_MERGE_ON
);
397 rBindings
.Invalidate( FID_MERGE_OFF
);
398 rBindings
.Invalidate( FID_MERGE_TOGGLE
);
399 rBindings
.Invalidate( SID_AUTOFILTER_HIDE
);
400 rBindings
.Invalidate( SID_UNFILTER
);
401 rBindings
.Invalidate( SID_REIMPORT_DATA
);
402 rBindings
.Invalidate( SID_REFRESH_DBAREA
);
403 rBindings
.Invalidate( SID_OUTLINE_SHOW
);
404 rBindings
.Invalidate( SID_OUTLINE_HIDE
);
405 rBindings
.Invalidate( SID_OUTLINE_REMOVE
);
406 rBindings
.Invalidate( FID_FILL_TO_BOTTOM
);
407 rBindings
.Invalidate( FID_FILL_TO_RIGHT
);
408 rBindings
.Invalidate( FID_FILL_TO_TOP
);
409 rBindings
.Invalidate( FID_FILL_TO_LEFT
);
410 rBindings
.Invalidate( FID_FILL_SERIES
);
411 rBindings
.Invalidate( SID_SCENARIOS
);
412 rBindings
.Invalidate( SID_AUTOFORMAT
);
413 rBindings
.Invalidate( SID_OPENDLG_TABOP
);
414 rBindings
.Invalidate( SID_DATA_SELECT
);
416 rBindings
.Invalidate( SID_CUT
);
417 rBindings
.Invalidate( SID_COPY
);
418 rBindings
.Invalidate( SID_PASTE
);
419 rBindings
.Invalidate( SID_PASTE_SPECIAL
);
421 rBindings
.Invalidate( FID_INS_ROW
);
422 rBindings
.Invalidate( FID_INS_COLUMN
);
423 rBindings
.Invalidate( FID_INS_CELL
);
424 rBindings
.Invalidate( FID_INS_CELLSDOWN
);
425 rBindings
.Invalidate( FID_INS_CELLSRIGHT
);
427 rBindings
.Invalidate( FID_CHG_COMMENT
);
429 // nur wegen Zellschutz:
431 rBindings
.Invalidate( SID_CELL_FORMAT_RESET
);
432 rBindings
.Invalidate( SID_DELETE
);
433 rBindings
.Invalidate( SID_DELETE_CONTENTS
);
434 rBindings
.Invalidate( FID_DELETE_CELL
);
435 rBindings
.Invalidate( FID_CELL_FORMAT
);
436 rBindings
.Invalidate( SID_ENABLE_HYPHENATION
);
437 rBindings
.Invalidate( SID_INSERT_POSTIT
);
438 rBindings
.Invalidate( SID_CHARMAP
);
439 rBindings
.Invalidate( SID_OPENDLG_FUNCTION
);
440 rBindings
.Invalidate( FID_VALIDATION
);
441 rBindings
.Invalidate( SID_EXTERNAL_SOURCE
);
442 rBindings
.Invalidate( SID_TEXT_TO_COLUMNS
);
443 rBindings
.Invalidate( SID_SORT_ASCENDING
);
444 rBindings
.Invalidate( SID_SORT_DESCENDING
);
446 if (aViewData
.GetViewShell()->HasAccessibilityObjects())
447 aViewData
.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_CURSORCHANGED
));
449 CellContentChanged();
452 void ScTabView::CursorPosChanged()
454 bool bRefMode
= SC_MOD()->IsFormulaMode();
455 if ( !bRefMode
) // Abfrage, damit RefMode bei Tabellenwechsel funktioniert
456 aViewData
.GetDocShell()->Broadcast( SfxSimpleHint( FID_KILLEDITVIEW
) );
458 // Broadcast, damit andere Views des Dokuments auch umschalten
460 ScDocument
* pDoc
= aViewData
.GetDocument();
461 bool bDP
= NULL
!= pDoc
->GetDPAtCursor(
462 aViewData
.GetCurX(), aViewData
.GetCurY(), aViewData
.GetTabNo() );
463 aViewData
.GetViewShell()->SetPivotShell(bDP
);
465 // UpdateInputHandler jetzt in CellContentChanged
469 aViewData
.SetTabStartCol( SC_TABSTART_NONE
);
474 Point
calcHintWindowPosition(
475 const Point
& rCellPos
, const Size
& rCellSize
, const Size
& rFrameWndSize
, const Size
& rHintWndSize
)
477 const long nMargin
= 20;
479 long nMLeft
= rCellPos
.X();
480 long nMRight
= rFrameWndSize
.Width() - rCellPos
.X() - rCellSize
.Width();
481 long nMTop
= rCellPos
.Y();
482 long nMBottom
= rFrameWndSize
.Height() - rCellPos
.Y() - rCellSize
.Height();
484 // First, see if we can fit the entire hint window in the visible region.
486 if (nMRight
- nMargin
>= rHintWndSize
.Width())
488 // Right margin is wide enough.
489 if (rFrameWndSize
.Height() >= rHintWndSize
.Height())
491 // The frame has enough height. Take it.
492 Point aPos
= rCellPos
;
493 aPos
.X() += rCellSize
.Width() + nMargin
;
494 if (aPos
.Y() + rHintWndSize
.Height() > rFrameWndSize
.Height())
496 // Push the hint window up a bit to make it fit.
497 aPos
.Y() = rFrameWndSize
.Height() - rHintWndSize
.Height();
503 if (nMBottom
- nMargin
>= rHintWndSize
.Height())
505 // Bottom margin is high enough.
506 if (rFrameWndSize
.Width() >= rHintWndSize
.Width())
508 // The frame has enough width. Take it.
509 Point aPos
= rCellPos
;
510 aPos
.Y() += rCellSize
.Height() + nMargin
;
511 if (aPos
.X() + rHintWndSize
.Width() > rFrameWndSize
.Width())
513 // Move the hint window to the left to make it fit.
514 aPos
.X() = rFrameWndSize
.Width() - rHintWndSize
.Width();
520 if (nMLeft
- nMargin
>= rHintWndSize
.Width())
522 // Left margin is wide enough.
523 if (rFrameWndSize
.Height() >= rHintWndSize
.Height())
525 // The frame is high enough. Take it.
526 Point aPos
= rCellPos
;
527 aPos
.X() -= rHintWndSize
.Width() + nMargin
;
528 if (aPos
.Y() + rHintWndSize
.Height() > rFrameWndSize
.Height())
530 // Push the hint window up a bit to make it fit.
531 aPos
.Y() = rFrameWndSize
.Height() - rHintWndSize
.Height();
537 if (nMTop
- nMargin
>= rHintWndSize
.Height())
539 // Top margin is high enough.
540 if (rFrameWndSize
.Width() >= rHintWndSize
.Width())
542 // The frame is wide enough. Take it.
543 Point aPos
= rCellPos
;
544 aPos
.Y() -= rHintWndSize
.Height() + nMargin
;
545 if (aPos
.X() + rHintWndSize
.Width() > rFrameWndSize
.Width())
547 // Move the hint window to the left to make it fit.
548 aPos
.X() = rFrameWndSize
.Width() - rHintWndSize
.Width();
554 // The popup doesn't fit in any direction in its entirety. Do our best.
556 if (nMRight
- nMargin
>= rHintWndSize
.Width())
558 // Right margin is good enough.
559 Point aPos
= rCellPos
;
560 aPos
.X() += nMargin
+ rCellSize
.Width();
565 if (nMBottom
- nMargin
>= rHintWndSize
.Height())
567 // Bottom margin is good enough.
568 Point aPos
= rCellPos
;
569 aPos
.Y() += nMargin
+ rCellSize
.Height();
574 if (nMLeft
- nMargin
>= rHintWndSize
.Width())
576 // Left margin is good enough.
577 Point aPos
= rCellPos
;
578 aPos
.X() -= rHintWndSize
.Width() + nMargin
;
583 if (nMTop
- nMargin
>= rHintWndSize
.Height())
585 // Top margin is good enough.
586 Point aPos
= rCellPos
;
587 aPos
.Y() -= rHintWndSize
.Height() + nMargin
;
592 // None of the above. Hopeless. At least try not to cover the current
594 Point aPos
= rCellPos
;
595 aPos
.X() += rCellSize
.Width();
601 void ScTabView::TestHintWindow()
603 // show input help window and list drop-down button for validity
605 bool bListValButton
= false;
606 ScAddress aListValPos
;
608 ScDocument
* pDoc
= aViewData
.GetDocument();
609 const SfxUInt32Item
* pItem
= (const SfxUInt32Item
*)
610 pDoc
->GetAttr( aViewData
.GetCurX(),
612 aViewData
.GetTabNo(),
614 if ( pItem
->GetValue() )
616 const ScValidationData
* pData
= pDoc
->GetValidationEntry( pItem
->GetValue() );
617 OSL_ENSURE(pData
,"ValidationData nicht gefunden");
618 String aTitle
, aMessage
;
619 if ( pData
&& pData
->GetInput( aTitle
, aMessage
) && aMessage
.Len() > 0 )
621 //! Abfrage, ob an gleicher Stelle !!!!
623 mpInputHintWindow
.reset();
625 ScSplitPos eWhich
= aViewData
.GetActivePart();
626 ScGridWindow
* pWin
= pGridWin
[eWhich
];
627 SCCOL nCol
= aViewData
.GetCurX();
628 SCROW nRow
= aViewData
.GetCurY();
629 Point aPos
= aViewData
.GetScrPos( nCol
, nRow
, eWhich
);
630 Size aWinSize
= pWin
->GetOutputSizePixel();
632 if ( nCol
>= aViewData
.GetPosX(WhichH(eWhich
)) &&
633 nRow
>= aViewData
.GetPosY(WhichV(eWhich
)) &&
634 aPos
.X() < aWinSize
.Width() && aPos
.Y() < aWinSize
.Height() )
636 // HintWindow anlegen, bestimmt seine Groesse selbst
637 mpInputHintWindow
.reset(new ScHintWindow(pWin
, aTitle
, aMessage
));
638 Size aHintWndSize
= mpInputHintWindow
->GetSizePixel();
641 aViewData
.GetMergeSizePixel(nCol
, nRow
, nCellSizeX
, nCellSizeY
);
643 Point aHintPos
= calcHintWindowPosition(
644 aPos
, Size(nCellSizeX
,nCellSizeY
), aWinSize
, aHintWndSize
);
646 mpInputHintWindow
->SetPosPixel( aHintPos
);
647 mpInputHintWindow
->ToTop();
648 mpInputHintWindow
->Show();
652 mpInputHintWindow
.reset();
654 // list drop-down button
655 if ( pData
&& pData
->HasSelectionList() )
657 aListValPos
.Set( aViewData
.GetCurX(), aViewData
.GetCurY(), aViewData
.GetTabNo() );
658 bListValButton
= true;
662 mpInputHintWindow
.reset();
664 for ( sal_uInt16 i
=0; i
<4; i
++ )
665 if ( pGridWin
[i
] && pGridWin
[i
]->IsVisible() )
666 pGridWin
[i
]->UpdateListValPos( bListValButton
, aListValPos
);
669 bool ScTabView::HasHintWindow() const
671 return mpInputHintWindow
.get() != NULL
;
674 void ScTabView::RemoveHintWindow()
676 mpInputHintWindow
.reset();
680 // find window that should not be over the cursor
681 static Window
* lcl_GetCareWin(SfxViewFrame
* pViewFrm
)
683 //! auch Spelling ??? (dann beim Aufruf Membervariable setzen)
686 if ( pViewFrm
->HasChildWindow(SID_SEARCH_DLG
) )
688 SfxChildWindow
* pChild
= pViewFrm
->GetChildWindow(SID_SEARCH_DLG
);
691 Window
* pWin
= pChild
->GetWindow();
692 if (pWin
&& pWin
->IsVisible())
697 // Aenderungen uebernehmen
698 if ( pViewFrm
->HasChildWindow(FID_CHG_ACCEPT
) )
700 SfxChildWindow
* pChild
= pViewFrm
->GetChildWindow(FID_CHG_ACCEPT
);
703 Window
* pWin
= pChild
->GetWindow();
704 if (pWin
&& pWin
->IsVisible())
713 // Bildschirm an Cursorposition anpassen
716 void ScTabView::AlignToCursor( SCsCOL nCurX
, SCsROW nCurY
, ScFollowMode eMode
,
717 const ScSplitPos
* pWhich
)
720 // aktiven Teil umschalten jetzt hier
723 ScSplitPos eActive
= aViewData
.GetActivePart();
724 ScHSplitPos eActiveX
= WhichH(eActive
);
725 ScVSplitPos eActiveY
= WhichV(eActive
);
726 bool bHFix
= (aViewData
.GetHSplitMode() == SC_SPLIT_FIX
);
727 bool bVFix
= (aViewData
.GetVSplitMode() == SC_SPLIT_FIX
);
729 if (eActiveX
== SC_SPLIT_LEFT
&& nCurX
>= (SCsCOL
)aViewData
.GetFixPosX())
731 ActivatePart( (eActiveY
==SC_SPLIT_TOP
) ? SC_SPLIT_TOPRIGHT
: SC_SPLIT_BOTTOMRIGHT
);
732 eActiveX
= SC_SPLIT_RIGHT
;
735 if (eActiveY
== SC_SPLIT_TOP
&& nCurY
>= (SCsROW
)aViewData
.GetFixPosY())
737 ActivatePart( (eActiveX
==SC_SPLIT_LEFT
) ? SC_SPLIT_BOTTOMLEFT
: SC_SPLIT_BOTTOMRIGHT
);
738 eActiveY
= SC_SPLIT_BOTTOM
;
742 // eigentliches Align
745 if ( eMode
!= SC_FOLLOW_NONE
)
751 eAlign
= aViewData
.GetActivePart();
752 ScHSplitPos eAlignX
= WhichH(eAlign
);
753 ScVSplitPos eAlignY
= WhichV(eAlign
);
755 SCsCOL nDeltaX
= (SCsCOL
) aViewData
.GetPosX(eAlignX
);
756 SCsROW nDeltaY
= (SCsROW
) aViewData
.GetPosY(eAlignY
);
757 SCsCOL nSizeX
= (SCsCOL
) aViewData
.VisibleCellsX(eAlignX
);
758 SCsROW nSizeY
= (SCsROW
) aViewData
.VisibleCellsY(eAlignY
);
762 if ( nCurX
>= 0 && nCurY
>= 0 )
763 aViewData
.GetMergeSizePixel( (SCCOL
)nCurX
, (SCROW
)nCurY
, nCellSizeX
, nCellSizeY
);
765 nCellSizeX
= nCellSizeY
= 0;
766 Size aScrSize
= aViewData
.GetScrSize();
767 long nSpaceX
= ( aScrSize
.Width() - nCellSizeX
) / 2;
768 long nSpaceY
= ( aScrSize
.Height() - nCellSizeY
) / 2;
769 // nSpaceY: desired start position of cell for FOLLOW_JUMP, modified if dialog interferes
771 bool bForceNew
= false; // force new calculation of JUMP position (vertical only)
773 // VisibleCellsY == CellsAtY( GetPosY( eWhichY ), 1, eWhichY )
775 //-------------------------------------------------------------------------------
776 // falls z.B. Suchen-Dialog offen ist, Cursor nicht hinter den Dialog stellen
777 // wenn moeglich, die Zeile mit dem Cursor oberhalb oder unterhalb des Dialogs
779 //! nicht, wenn schon komplett sichtbar
781 if ( eMode
== SC_FOLLOW_JUMP
)
783 Window
* pCare
= lcl_GetCareWin( aViewData
.GetViewShell()->GetViewFrame() );
789 Window
* pWin
= GetActiveWin();
792 aDlgPixel
= pCare
->GetWindowExtentsRelative( pWin
);
793 aWinSize
= pWin
->GetOutputSizePixel();
794 // ueberdeckt der Dialog das GridWin?
795 if ( aDlgPixel
.Right() >= 0 && aDlgPixel
.Left() < aWinSize
.Width() )
797 if ( nCurX
< nDeltaX
|| nCurX
>= nDeltaX
+nSizeX
||
798 nCurY
< nDeltaY
|| nCurY
>= nDeltaY
+nSizeY
)
799 bLimit
= true; // es wird sowieso gescrollt
802 // Cursor ist auf dem Bildschirm
803 Point aStart
= aViewData
.GetScrPos( nCurX
, nCurY
, eAlign
);
805 aViewData
.GetMergeSizePixel( nCurX
, nCurY
, nCSX
, nCSY
);
806 Rectangle
aCursor( aStart
, Size( nCSX
, nCSY
) );
807 if ( aCursor
.IsOver( aDlgPixel
) )
808 bLimit
= true; // Zelle vom Dialog ueberdeckt
815 bool bBottom
= false;
816 long nTopSpace
= aDlgPixel
.Top();
817 long nBotSpace
= aWinSize
.Height() - aDlgPixel
.Bottom();
818 if ( nBotSpace
> 0 && nBotSpace
> nTopSpace
)
820 long nDlgBot
= aDlgPixel
.Bottom();
823 aViewData
.GetPosFromPixel( 0,nDlgBot
, eAlign
, nWPosX
, nWPosY
);
824 ++nWPosY
; // unter der letzten betroffenen Zelle
826 SCsROW nDiff
= nWPosY
- nDeltaY
;
827 if ( nCurY
>= nDiff
) // Pos. kann nicht negativ werden
829 nSpaceY
= nDlgBot
+ ( nBotSpace
- nCellSizeY
) / 2;
834 if ( !bBottom
&& nTopSpace
> 0 )
836 nSpaceY
= ( nTopSpace
- nCellSizeY
) / 2;
842 //-------------------------------------------------------------------------------
844 SCsCOL nNewDeltaX
= nDeltaX
;
845 SCsROW nNewDeltaY
= nDeltaY
;
846 bool bDoLine
= false;
851 if ( nCurX
< nDeltaX
|| nCurX
>= nDeltaX
+nSizeX
)
853 nNewDeltaX
= nCurX
- static_cast<SCsCOL
>(aViewData
.CellsAtX( nCurX
, -1, eAlignX
, static_cast<sal_uInt16
>(nSpaceX
) ));
854 if (nNewDeltaX
< 0) nNewDeltaX
= 0;
855 nSizeX
= (SCsCOL
) aViewData
.CellsAtX( nNewDeltaX
, 1, eAlignX
);
857 if ( nCurY
< nDeltaY
|| nCurY
>= nDeltaY
+nSizeY
|| bForceNew
)
859 nNewDeltaY
= nCurY
- static_cast<SCsROW
>(aViewData
.CellsAtY( nCurY
, -1, eAlignY
, static_cast<sal_uInt16
>(nSpaceY
) ));
860 if (nNewDeltaY
< 0) nNewDeltaY
= 0;
861 nSizeY
= (SCsROW
) aViewData
.CellsAtY( nNewDeltaY
, 1, eAlignY
);
871 if ( nCurX
< nDeltaX
|| nCurX
>= nDeltaX
+nSizeX
)
873 nNewDeltaX
= nDeltaX
+ nCurX
- aViewData
.GetCurX();
874 if (nNewDeltaX
< 0) nNewDeltaX
= 0;
875 nSizeX
= (SCsCOL
) aViewData
.CellsAtX( nNewDeltaX
, 1, eAlignX
);
877 if ( nCurY
< nDeltaY
|| nCurY
>= nDeltaY
+nSizeY
)
879 nNewDeltaY
= nDeltaY
+ nCurY
- aViewData
.GetCurY();
880 if (nNewDeltaY
< 0) nNewDeltaY
= 0;
881 nSizeY
= (SCsROW
) aViewData
.CellsAtY( nNewDeltaY
, 1, eAlignY
);
884 // like old version of SC_FOLLOW_JUMP:
886 if ( nCurX
< nNewDeltaX
|| nCurX
>= nNewDeltaX
+nSizeX
)
888 nNewDeltaX
= nCurX
- (nSizeX
/ 2);
889 if (nNewDeltaX
< 0) nNewDeltaX
= 0;
890 nSizeX
= (SCsCOL
) aViewData
.CellsAtX( nNewDeltaX
, 1, eAlignX
);
892 if ( nCurY
< nNewDeltaY
|| nCurY
>= nNewDeltaY
+nSizeY
)
894 nNewDeltaY
= nCurY
- (nSizeY
/ 2);
895 if (nNewDeltaY
< 0) nNewDeltaY
= 0;
896 nSizeY
= (SCsROW
) aViewData
.CellsAtY( nNewDeltaY
, 1, eAlignY
);
905 OSL_FAIL("Falscher Cursormodus");
911 while ( nCurX
>= nNewDeltaX
+nSizeX
)
913 nNewDeltaX
= nCurX
-nSizeX
+1;
914 ScDocument
* pDoc
= aViewData
.GetDocument();
915 SCTAB nTab
= aViewData
.GetTabNo();
916 while ( nNewDeltaX
< MAXCOL
&& !pDoc
->GetColWidth( nNewDeltaX
, nTab
) )
918 nSizeX
= (SCsCOL
) aViewData
.CellsAtX( nNewDeltaX
, 1, eAlignX
);
920 while ( nCurY
>= nNewDeltaY
+nSizeY
)
922 nNewDeltaY
= nCurY
-nSizeY
+1;
923 ScDocument
* pDoc
= aViewData
.GetDocument();
924 SCTAB nTab
= aViewData
.GetTabNo();
925 while ( nNewDeltaY
< MAXROW
&& !pDoc
->GetRowHeight( nNewDeltaY
, nTab
) )
927 nSizeY
= (SCsROW
) aViewData
.CellsAtY( nNewDeltaY
, 1, eAlignY
);
929 if ( nCurX
< nNewDeltaX
) nNewDeltaX
= nCurX
;
930 if ( nCurY
< nNewDeltaY
) nNewDeltaY
= nCurY
;
933 if ( nNewDeltaX
!= nDeltaX
)
934 nSizeX
= (SCsCOL
) aViewData
.CellsAtX( nNewDeltaX
, 1, eAlignX
);
935 if (nNewDeltaX
+nSizeX
-1 > MAXCOL
) nNewDeltaX
= MAXCOL
-nSizeX
+1;
936 if (nNewDeltaX
< 0) nNewDeltaX
= 0;
938 if ( nNewDeltaY
!= nDeltaY
)
939 nSizeY
= (SCsROW
) aViewData
.CellsAtY( nNewDeltaY
, 1, eAlignY
);
940 if (nNewDeltaY
+nSizeY
-1 > MAXROW
) nNewDeltaY
= MAXROW
-nSizeY
+1;
941 if (nNewDeltaY
< 0) nNewDeltaY
= 0;
943 if ( nNewDeltaX
!= nDeltaX
) ScrollX( nNewDeltaX
- nDeltaX
, eAlignX
);
944 if ( nNewDeltaY
!= nDeltaY
) ScrollY( nNewDeltaY
- nDeltaY
, eAlignY
);
948 // nochmal aktiven Teil umschalten
952 if (eActiveX
== SC_SPLIT_RIGHT
&& nCurX
< (SCsCOL
)aViewData
.GetFixPosX())
954 ActivatePart( (eActiveY
==SC_SPLIT_TOP
) ? SC_SPLIT_TOPLEFT
: SC_SPLIT_BOTTOMLEFT
);
955 eActiveX
= SC_SPLIT_LEFT
;
958 if (eActiveY
== SC_SPLIT_BOTTOM
&& nCurY
< (SCsROW
)aViewData
.GetFixPosY())
960 ActivatePart( (eActiveX
==SC_SPLIT_LEFT
) ? SC_SPLIT_TOPLEFT
: SC_SPLIT_TOPRIGHT
);
961 eActiveY
= SC_SPLIT_TOP
;
965 bool ScTabView::SelMouseButtonDown( const MouseEvent
& rMEvt
)
970 bool bMod1Locked
= aViewData
.GetViewShell()->GetLockedModifiers() & KEY_MOD1
? true : false;
971 aViewData
.SetSelCtrlMouseClick( rMEvt
.IsMod1() || bMod1Locked
);
975 bMoveIsShift
= rMEvt
.IsShift();
976 bRet
= pSelEngine
->SelMouseButtonDown( rMEvt
);
977 bMoveIsShift
= false;
980 aViewData
.SetSelCtrlMouseClick( false ); // #i3875# *Hack*
986 // MoveCursor - mit Anpassung des Bildausschnitts
989 void ScTabView::MoveCursorAbs( SCsCOL nCurX
, SCsROW nCurY
, ScFollowMode eMode
,
990 bool bShift
, bool bControl
, bool bKeepOld
, bool bKeepSel
)
993 aViewData
.ResetOldCursor();
995 if (nCurX
< 0) nCurX
= 0;
996 if (nCurY
< 0) nCurY
= 0;
997 if (nCurX
> MAXCOL
) nCurX
= MAXCOL
;
998 if (nCurY
> MAXROW
) nCurY
= MAXROW
;
1002 // aktiven Teil umschalten jetzt in AlignToCursor
1004 AlignToCursor( nCurX
, nCurY
, eMode
);
1005 //! auf OS/2: SC_FOLLOW_JUMP statt SC_FOLLOW_LINE, um Nachlaufen zu verhindern ???
1009 SetCursor( nCurX
, nCurY
); // Markierung stehenlassen
1011 // If the cursor is in existing selection, it's a cursor movement by
1012 // ENTER or TAB. If not, then it's a new selection during ADD
1015 const ScMarkData
& rMark
= aViewData
.GetMarkData();
1016 ScRangeList aSelList
;
1017 rMark
.FillRangeListWithMarks(&aSelList
, false);
1018 if (!aSelList
.In(ScRange(nCurX
, nCurY
, aViewData
.GetTabNo())))
1019 // Cursor not in existing selection. Start a new selection.
1020 DoneBlockMode(true);
1026 // Remove all marked data on cursor movement unless the Shift is locked.
1027 ScMarkData
aData(aViewData
.GetMarkData());
1032 bool bSame
= ( nCurX
== aViewData
.GetCurX() && nCurY
== aViewData
.GetCurY() );
1033 bMoveIsShift
= bShift
;
1034 pSelEngine
->CursorPosChanging( bShift
, bControl
);
1035 bMoveIsShift
= false;
1036 aFunctionSet
.SetCursorAtCell( nCurX
, nCurY
, false );
1038 // Wenn der Cursor nicht bewegt wurde, muss das SelectionChanged fuer das
1039 // Aufheben der Selektion hier einzeln passieren:
1048 void ScTabView::MoveCursorRel( SCsCOL nMovX
, SCsROW nMovY
, ScFollowMode eMode
,
1049 bool bShift
, bool bKeepSel
)
1051 ScDocument
* pDoc
= aViewData
.GetDocument();
1052 SCTAB nTab
= aViewData
.GetTabNo();
1054 bool bSkipProtected
= false, bSkipUnprotected
= false;
1055 ScTableProtection
* pProtect
= pDoc
->GetTabProtection(nTab
);
1056 if ( pProtect
&& pProtect
->isProtected() )
1058 bSkipProtected
= !pProtect
->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS
);
1059 bSkipUnprotected
= !pProtect
->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS
);
1062 if ( bSkipProtected
&& bSkipUnprotected
)
1069 if ( aViewData
.IsRefMode() )
1071 nOldX
= (SCsCOL
) aViewData
.GetRefEndX();
1072 nOldY
= (SCsROW
) aViewData
.GetRefEndY();
1073 nCurX
= nOldX
+ nMovX
;
1074 nCurY
= nOldY
+ nMovY
;
1078 nOldX
= (SCsCOL
) aViewData
.GetCurX();
1079 nOldY
= (SCsROW
) aViewData
.GetCurY();
1080 nCurX
= (nMovX
!= 0) ? nOldX
+nMovX
: (SCsCOL
) aViewData
.GetOldCurX();
1081 nCurY
= (nMovY
!= 0) ? nOldY
+nMovY
: (SCsROW
) aViewData
.GetOldCurY();
1084 aViewData
.ResetOldCursor();
1086 if (nMovX
!= 0 && ValidColRow(nCurX
,nCurY
))
1087 SkipCursorHorizontal(nCurX
, nCurY
, nOldX
, nMovX
);
1089 if (nMovY
!= 0 && ValidColRow(nCurX
,nCurY
))
1090 SkipCursorVertical(nCurX
, nCurY
, nOldY
, nMovY
);
1092 MoveCursorAbs( nCurX
, nCurY
, eMode
, bShift
, false, true, bKeepSel
);
1095 void ScTabView::MoveCursorPage( SCsCOL nMovX
, SCsROW nMovY
, ScFollowMode eMode
, bool bShift
, bool bKeepSel
)
1099 GetPageMoveEndPosition(nMovX
, nMovY
, nPageX
, nPageY
);
1100 MoveCursorRel( nPageX
, nPageY
, eMode
, bShift
, bKeepSel
);
1103 void ScTabView::MoveCursorArea( SCsCOL nMovX
, SCsROW nMovY
, ScFollowMode eMode
, bool bShift
, bool bKeepSel
)
1107 GetAreaMoveEndPosition(nMovX
, nMovY
, eMode
, nNewX
, nNewY
, eMode
);
1108 MoveCursorRel(nNewX
, nNewY
, eMode
, bShift
, bKeepSel
);
1111 void ScTabView::MoveCursorEnd( SCsCOL nMovX
, SCsROW nMovY
, ScFollowMode eMode
, bool bShift
, bool bKeepSel
)
1113 ScDocument
* pDoc
= aViewData
.GetDocument();
1114 SCTAB nTab
= aViewData
.GetTabNo();
1118 aViewData
.GetMoveCursor( nCurX
,nCurY
);
1119 SCCOL nNewX
= nCurX
;
1120 SCROW nNewY
= nCurY
;
1124 if ( nMovX
> 0 || nMovY
> 0 )
1125 pDoc
->GetPrintArea( nTab
, nUsedX
, nUsedY
); // Ende holen
1130 nNewX
=nUsedX
; // letzter benutzter Bereich
1137 aViewData
.ResetOldCursor();
1138 MoveCursorRel( ((SCsCOL
)nNewX
)-(SCsCOL
)nCurX
, ((SCsROW
)nNewY
)-(SCsROW
)nCurY
, eMode
, bShift
, bKeepSel
);
1141 void ScTabView::MoveCursorScreen( SCsCOL nMovX
, SCsROW nMovY
, ScFollowMode eMode
, bool bShift
)
1143 ScDocument
* pDoc
= aViewData
.GetDocument();
1144 SCTAB nTab
= aViewData
.GetTabNo();
1148 aViewData
.GetMoveCursor( nCurX
,nCurY
);
1149 SCCOL nNewX
= nCurX
;
1150 SCROW nNewY
= nCurY
;
1152 ScSplitPos eWhich
= aViewData
.GetActivePart();
1153 SCCOL nPosX
= aViewData
.GetPosX( WhichH(eWhich
) );
1154 SCROW nPosY
= aViewData
.GetPosY( WhichV(eWhich
) );
1156 SCCOL nAddX
= aViewData
.VisibleCellsX( WhichH(eWhich
) );
1159 SCROW nAddY
= aViewData
.VisibleCellsY( WhichV(eWhich
) );
1173 aViewData
.SetOldCursor( nNewX
,nNewY
);
1174 pDoc
->SkipOverlapped(nNewX
, nNewY
, nTab
);
1175 MoveCursorAbs( nNewX
, nNewY
, eMode
, bShift
, false, true );
1178 void ScTabView::MoveCursorEnter( bool bShift
) // bShift -> hoch/runter
1180 const ScInputOptions
& rOpt
= SC_MOD()->GetInputOptions();
1181 if (!rOpt
.GetMoveSelection())
1183 aViewData
.UpdateInputHandler(true);
1189 switch ((ScDirection
)rOpt
.GetMoveDir())
1192 nMoveY
= bShift
? -1 : 1;
1195 nMoveX
= bShift
? -1 : 1;
1198 nMoveY
= bShift
? 1 : -1;
1201 nMoveX
= bShift
? 1 : -1;
1205 ScMarkData
& rMark
= aViewData
.GetMarkData();
1206 if (rMark
.IsMarked() || rMark
.IsMultiMarked())
1210 aViewData
.GetMoveCursor( nCurX
,nCurY
);
1211 SCCOL nNewX
= nCurX
;
1212 SCROW nNewY
= nCurY
;
1213 SCTAB nTab
= aViewData
.GetTabNo();
1215 ScDocument
* pDoc
= aViewData
.GetDocument();
1216 pDoc
->GetNextPos( nNewX
,nNewY
, nTab
, nMoveX
,nMoveY
, true, false, rMark
);
1218 MoveCursorRel( ((SCsCOL
)nNewX
)-(SCsCOL
)nCurX
, ((SCsROW
)nNewY
)-(SCsROW
)nCurY
,
1219 SC_FOLLOW_LINE
, false, true );
1221 // update input line even if cursor was not moved
1222 if ( nNewX
== nCurX
&& nNewY
== nCurY
)
1223 aViewData
.UpdateInputHandler(true);
1227 if ( nMoveY
!= 0 && !nMoveX
)
1229 // nach Tab und Enter wieder zur Ausgangsspalte
1230 SCCOL nTabCol
= aViewData
.GetTabStartCol();
1231 if (nTabCol
!= SC_TABSTART_NONE
)
1235 aViewData
.GetMoveCursor( nCurX
,nCurY
);
1236 nMoveX
= ((SCsCOL
)nTabCol
)-(SCsCOL
)nCurX
;
1240 MoveCursorRel( nMoveX
,nMoveY
, SC_FOLLOW_LINE
, false );
1245 bool ScTabView::MoveCursorKeyInput( const KeyEvent
& rKeyEvent
)
1247 const KeyCode
& rKCode
= rKeyEvent
.GetKeyCode();
1249 enum { MOD_NONE
, MOD_CTRL
, MOD_ALT
, MOD_BOTH
} eModifier
=
1251 (rKCode
.IsMod2() ? MOD_BOTH
: MOD_CTRL
) :
1252 (rKCode
.IsMod2() ? MOD_ALT
: MOD_NONE
);
1254 bool bSel
= rKCode
.IsShift();
1255 sal_uInt16 nCode
= rKCode
.GetCode();
1262 case KEY_LEFT
: nDX
= -1; break;
1263 case KEY_RIGHT
: nDX
= 1; break;
1264 case KEY_UP
: nDY
= -1; break;
1265 case KEY_DOWN
: nDY
= 1; break;
1267 if( nDX
!= 0 || nDY
!= 0 )
1271 case MOD_NONE
: MoveCursorRel( nDX
, nDY
, SC_FOLLOW_LINE
, bSel
); break;
1272 case MOD_CTRL
: MoveCursorArea( nDX
, nDY
, SC_FOLLOW_JUMP
, bSel
); break;
1275 // added to avoid warnings
1278 // always true to suppress changes of col/row size (ALT+CURSOR)
1283 if( (nCode
== KEY_PAGEUP
) || (nCode
== KEY_PAGEDOWN
) )
1285 nDX
= (nCode
== KEY_PAGEUP
) ? -1 : 1;
1288 case MOD_NONE
: MoveCursorPage( 0, static_cast<SCsCOLROW
>(nDX
), SC_FOLLOW_FIX
, bSel
); break;
1289 case MOD_ALT
: MoveCursorPage( nDX
, 0, SC_FOLLOW_FIX
, bSel
); break;
1290 case MOD_CTRL
: SelectNextTab( nDX
); break;
1293 // added to avoid warnings
1300 if( (nCode
== KEY_HOME
) || (nCode
== KEY_END
) )
1302 nDX
= (nCode
== KEY_HOME
) ? -1 : 1;
1303 ScFollowMode eMode
= (nCode
== KEY_HOME
) ? SC_FOLLOW_LINE
: SC_FOLLOW_JUMP
;
1306 case MOD_NONE
: MoveCursorEnd( nDX
, 0, eMode
, bSel
); break;
1307 case MOD_CTRL
: MoveCursorEnd( nDX
, static_cast<SCsCOLROW
>(nDX
), eMode
, bSel
); break;
1310 // added to avoid warnings
1320 // naechste/vorherige nicht geschuetzte Zelle
1321 void ScTabView::FindNextUnprot( bool bShift
, bool bInSelection
)
1323 short nMove
= bShift
? -1 : 1;
1325 ScMarkData
& rMark
= aViewData
.GetMarkData();
1326 bool bMarked
= bInSelection
&& (rMark
.IsMarked() || rMark
.IsMultiMarked());
1330 aViewData
.GetMoveCursor( nCurX
,nCurY
);
1331 SCCOL nNewX
= nCurX
;
1332 SCROW nNewY
= nCurY
;
1333 SCTAB nTab
= aViewData
.GetTabNo();
1335 ScDocument
* pDoc
= aViewData
.GetDocument();
1336 pDoc
->GetNextPos( nNewX
,nNewY
, nTab
, nMove
,0, bMarked
, true, rMark
);
1338 SCCOL nTabCol
= aViewData
.GetTabStartCol();
1339 if ( nTabCol
== SC_TABSTART_NONE
)
1340 nTabCol
= nCurX
; // auf diese Spalte zurueck bei Enter
1342 MoveCursorRel( ((SCsCOL
)nNewX
)-(SCsCOL
)nCurX
, ((SCsROW
)nNewY
)-(SCsROW
)nCurY
,
1343 SC_FOLLOW_LINE
, false, true );
1345 // in MoveCursorRel wird die TabCol zurueckgesetzt...
1346 aViewData
.SetTabStartCol( nTabCol
);
1349 void ScTabView::MarkColumns()
1354 ScMarkData
& rMark
= aViewData
.GetMarkData();
1355 if (rMark
.IsMarked())
1358 rMark
.GetMarkArea( aMarkRange
);
1359 nStartCol
= aMarkRange
.aStart
.Col();
1360 nEndCol
= aMarkRange
.aEnd
.Col();
1365 aViewData
.GetMoveCursor( nStartCol
, nDummy
);
1369 SCTAB nTab
= aViewData
.GetTabNo();
1371 InitBlockMode( nStartCol
,0, nTab
);
1372 MarkCursor( nEndCol
,MAXROW
, nTab
);
1376 void ScTabView::MarkRows()
1381 ScMarkData
& rMark
= aViewData
.GetMarkData();
1382 if (rMark
.IsMarked())
1385 rMark
.GetMarkArea( aMarkRange
);
1386 nStartRow
= aMarkRange
.aStart
.Row();
1387 nEndRow
= aMarkRange
.aEnd
.Row();
1392 aViewData
.GetMoveCursor( nDummy
, nStartRow
);
1396 SCTAB nTab
= aViewData
.GetTabNo();
1398 InitBlockMode( 0,nStartRow
, nTab
);
1399 MarkCursor( MAXCOL
,nEndRow
, nTab
);
1403 void ScTabView::MarkDataArea( bool bIncludeCursor
)
1405 ScDocument
* pDoc
= aViewData
.GetDocument();
1406 SCTAB nTab
= aViewData
.GetTabNo();
1407 SCCOL nStartCol
= aViewData
.GetCurX();
1408 SCROW nStartRow
= aViewData
.GetCurY();
1409 SCCOL nEndCol
= nStartCol
;
1410 SCROW nEndRow
= nStartRow
;
1412 pDoc
->GetDataArea( nTab
, nStartCol
, nStartRow
, nEndCol
, nEndRow
, bIncludeCursor
, false );
1416 InitBlockMode( nStartCol
, nStartRow
, nTab
);
1417 MarkCursor( nEndCol
, nEndRow
, nTab
);
1423 void ScTabView::MarkMatrixFormula()
1425 ScDocument
* pDoc
= aViewData
.GetDocument();
1426 ScAddress
aCursor( aViewData
.GetCurX(), aViewData
.GetCurY(), aViewData
.GetTabNo() );
1428 if ( pDoc
->GetMatrixFormulaRange( aCursor
, aMatrix
) )
1430 MarkRange( aMatrix
, false ); // cursor is already within the range
1434 void ScTabView::MarkRange( const ScRange
& rRange
, bool bSetCursor
, bool bContinue
)
1436 SCTAB nTab
= rRange
.aStart
.Tab();
1440 DoneBlockMode( bContinue
); // bContinue==true -> clear old mark
1441 if (bSetCursor
) // Wenn Cursor gesetzt wird, immer auch alignen
1443 SCCOL nAlignX
= rRange
.aStart
.Col();
1444 SCROW nAlignY
= rRange
.aStart
.Row();
1445 bool bCol
= ( rRange
.aStart
.Col() == 0 && rRange
.aEnd
.Col() == MAXCOL
) && !aViewData
.GetDocument()->IsInVBAMode();
1446 bool bRow
= ( rRange
.aStart
.Row() == 0 && rRange
.aEnd
.Row() == MAXROW
);
1448 nAlignX
= aViewData
.GetPosX(WhichH(aViewData
.GetActivePart()));
1450 nAlignY
= aViewData
.GetPosY(WhichV(aViewData
.GetActivePart()));
1451 AlignToCursor( nAlignX
, nAlignY
, SC_FOLLOW_JUMP
);
1453 InitBlockMode( rRange
.aStart
.Col(), rRange
.aStart
.Row(), nTab
);
1454 MarkCursor( rRange
.aEnd
.Col(), rRange
.aEnd
.Row(), nTab
);
1457 SCCOL nPosX
= rRange
.aStart
.Col();
1458 SCROW nPosY
= rRange
.aStart
.Row();
1459 ScDocument
* pDoc
= aViewData
.GetDocument();
1460 pDoc
->SkipOverlapped(nPosX
, nPosY
, nTab
);
1462 aViewData
.ResetOldCursor();
1463 SetCursor( nPosX
, nPosY
);
1470 void ScTabView::Unmark()
1472 ScMarkData
& rMark
= aViewData
.GetMarkData();
1473 if ( rMark
.IsMarked() || rMark
.IsMultiMarked() )
1477 aViewData
.GetMoveCursor( nCurX
,nCurY
);
1478 MoveCursorAbs( nCurX
, nCurY
, SC_FOLLOW_NONE
, false, false );
1484 void ScTabView::SetMarkData( const ScMarkData
& rNew
)
1488 aViewData
.GetMarkData() = rNew
;
1493 void ScTabView::MarkDataChanged()
1495 // has to be called after making direct changes to mark data (not via MarkCursor etc)
1497 UpdateSelectionOverlay();
1500 void ScTabView::SelectNextTab( short nDir
, bool bExtendSelection
)
1503 OSL_ENSURE( nDir
==-1 || nDir
==1, "SelectNextTab: falscher Wert");
1505 ScDocument
* pDoc
= aViewData
.GetDocument();
1506 SCTAB nTab
= aViewData
.GetTabNo();
1511 while (!pDoc
->IsVisible(nTab
))
1519 SCTAB nCount
= pDoc
->GetTableCount();
1521 if (nTab
>= nCount
) return;
1522 while (!pDoc
->IsVisible(nTab
))
1525 if (nTab
>= nCount
) return;
1529 SetTabNo( nTab
, false, bExtendSelection
);
1534 // SetTabNo - angezeigte Tabelle
1536 void ScTabView::SetTabNo( SCTAB nTab
, bool bNew
, bool bExtendSelection
, bool bSameTabButMoved
)
1538 if ( !ValidTab(nTab
) )
1540 OSL_FAIL("SetTabNo: falsche Tabelle");
1544 if ( nTab
!= aViewData
.GetTabNo() || bNew
)
1546 // Die FormShell moechte vor dem Umschalten benachrichtigt werden
1547 FmFormShell
* pFormSh
= aViewData
.GetViewShell()->GetFormShell();
1550 bool bAllowed
= static_cast<bool>(pFormSh
->PrepareClose(true));
1553 //! Fehlermeldung? oder macht das die FormShell selber?
1554 //! Fehler-Flag zurueckgeben und Aktionen abbrechen
1556 return; // Die FormShell sagt, es kann nicht umgeschaltet werden
1560 // nicht InputEnterHandler wegen Referenzeingabe !
1562 ScDocument
* pDoc
= aViewData
.GetDocument();
1564 pDoc
->MakeTable( nTab
);
1566 // Update pending row heights before switching the sheet, so Reschedule from the progress bar
1567 // doesn't paint the new sheet with old heights
1568 aViewData
.GetDocShell()->UpdatePendingRowHeights( nTab
);
1570 SCTAB nTabCount
= pDoc
->GetTableCount();
1571 SCTAB nOldPos
= nTab
;
1572 while (!pDoc
->IsVisible(nTab
)) // naechste sichtbare suchen
1574 bool bUp
= (nTab
>=nOldPos
);
1578 if (nTab
>=nTabCount
)
1591 OSL_FAIL("keine sichtbare Tabelle");
1592 pDoc
->SetVisible( 0, true );
1597 // #i71490# Deselect drawing objects before changing the sheet number in view data,
1598 // so the handling of notes still has the sheet selected on which the notes are.
1601 ScModule
* pScMod
= SC_MOD();
1602 bool bRefMode
= pScMod
->IsFormulaMode();
1603 if ( !bRefMode
) // Abfrage, damit RefMode bei Tabellenwechsel funktioniert
1606 pSelEngine
->Reset(); // reset all flags, including locked modifiers
1607 aViewData
.SetRefTabNo( nTab
);
1610 ScSplitPos eOldActive
= aViewData
.GetActivePart(); // before switching
1611 bool bFocus
= pGridWin
[eOldActive
]->HasFocus();
1613 aViewData
.SetTabNo( nTab
);
1614 // UpdateShow noch vor SetCursor, damit UpdateAutoFillMark die richtigen
1615 // Fenster findet (wird aus SetCursor gerufen)
1617 aViewData
.ResetOldCursor();
1619 SfxBindings
& rBindings
= aViewData
.GetBindings();
1620 ScMarkData
& rMark
= aViewData
.GetMarkData();
1622 bool bAllSelected
= true;
1623 for (SCTAB nSelTab
= 0; nSelTab
< nTabCount
; ++nSelTab
)
1625 if (!pDoc
->IsVisible(nSelTab
) || rMark
.GetTableSelect(nSelTab
))
1627 if (nTab
== nSelTab
)
1628 // This tab is already in selection. Keep the current
1630 bExtendSelection
= true;
1634 bAllSelected
= false;
1635 if (bExtendSelection
)
1636 // We got what we need. No need to stay in the loop.
1640 if (bAllSelected
&& !bNew
)
1641 // #i6327# if all tables are selected, a selection event (#i6330#) will deselect all
1642 // (not if called with bNew to update settings)
1643 bExtendSelection
= false;
1645 if (bExtendSelection
)
1646 rMark
.SelectTable( nTab
, true );
1649 rMark
.SelectOneTable( nTab
);
1650 rBindings
.Invalidate( FID_FILL_TAB
);
1651 rBindings
.Invalidate( FID_TAB_DESELECTALL
);
1654 SetCursor( aViewData
.GetCurX(), aViewData
.GetCurY(), true );
1655 bool bUnoRefDialog
= pScMod
->IsRefDialogOpen() && pScMod
->GetCurRefDlgId() == WID_SIMPLE_REF
;
1657 // recalc zoom-dependent values (before TabChanged, before UpdateEditViewPos)
1661 if ( bRefMode
) // hide EditView if necessary (after aViewData.SetTabNo !)
1663 for (sal_uInt16 i
= 0; i
< 4; ++i
)
1664 if (pGridWin
[i
] && pGridWin
[i
]->IsVisible())
1665 pGridWin
[i
]->UpdateEditViewPos();
1668 TabChanged(bSameTabButMoved
); // DrawView
1669 UpdateVisibleRange();
1671 aViewData
.GetViewShell()->WindowChanged(); // falls das aktive Fenster anders ist
1672 if ( !bUnoRefDialog
)
1673 aViewData
.GetViewShell()->DisconnectAllClients(); // important for floating frames
1676 // hide / show inplace client
1678 ScClient
* pClient
= static_cast<ScClient
*>(aViewData
.GetViewShell()->GetIPClient());
1679 if ( pClient
&& pClient
->IsObjectInPlaceActive() )
1681 Rectangle aObjArea
= pClient
->GetObjArea();
1682 if ( nTab
== aViewData
.GetRefTabNo() )
1684 // move to its original position
1686 SdrOle2Obj
* pDrawObj
= pClient
->GetDrawObj();
1689 Rectangle aRect
= pDrawObj
->GetLogicRect();
1690 MapMode
aMapMode( MAP_100TH_MM
);
1691 Size aOleSize
= pDrawObj
->GetOrigObjSize( &aMapMode
);
1692 aRect
.SetSize( aOleSize
);
1698 // move to an invisible position
1700 aObjArea
.SetPos( Point( 0, -2*aObjArea
.GetHeight() ) );
1702 pClient
->SetObjArea( aObjArea
);
1706 if ( bFocus
&& aViewData
.GetActivePart() != eOldActive
&& !bRefMode
)
1707 ActiveGrabFocus(); // grab focus to the pane that's active now
1711 bool bResize
= false;
1712 if ( aViewData
.GetHSplitMode() == SC_SPLIT_FIX
)
1713 if (aViewData
.UpdateFixX())
1715 if ( aViewData
.GetVSplitMode() == SC_SPLIT_FIX
)
1716 if (aViewData
.UpdateFixY())
1722 if ( aViewData
.IsPagebreakMode() )
1723 UpdatePageBreakData(); //! asynchron ??
1725 // Form-Layer muss den sichtbaren Ausschnitt der neuen Tabelle kennen
1726 // dafuer muss hier schon der MapMode stimmen
1727 for (sal_uInt16 i
=0; i
<4; i
++)
1729 pGridWin
[i
]->SetMapMode( pGridWin
[i
]->GetDrawMapMode() );
1737 DoResize( aBorderPos
, aFrameSize
);
1738 rBindings
.Invalidate( SID_DELETE_PRINTAREA
); // Menue
1739 rBindings
.Invalidate( FID_DEL_MANUALBREAKS
);
1740 rBindings
.Invalidate( FID_RESET_PRINTZOOM
);
1741 rBindings
.Invalidate( SID_STATUS_DOCPOS
); // Statusbar
1742 rBindings
.Invalidate( SID_STATUS_PAGESTYLE
); // Statusbar
1743 rBindings
.Invalidate( SID_CURRENTTAB
); // Navigator
1744 rBindings
.Invalidate( SID_STYLE_FAMILY2
); // Gestalter
1745 rBindings
.Invalidate( SID_STYLE_FAMILY4
); // Gestalter
1746 rBindings
.Invalidate( SID_TABLES_COUNT
);
1748 if(pScMod
->IsRefDialogOpen())
1750 sal_uInt16 nCurRefDlgId
=pScMod
->GetCurRefDlgId();
1751 SfxViewFrame
* pViewFrm
= aViewData
.GetViewShell()->GetViewFrame();
1752 SfxChildWindow
* pChildWnd
= pViewFrm
->GetChildWindow( nCurRefDlgId
);
1755 IAnyRefDialog
* pRefDlg
= dynamic_cast<IAnyRefDialog
*>(pChildWnd
->GetWindow());
1756 pRefDlg
->ViewShellChanged();
1763 // Paint-Funktionen - nur fuer diese View
1766 void ScTabView::MakeEditView( ScEditEngineDefaulter
* pEngine
, SCCOL nCol
, SCROW nRow
)
1771 DrawEnableAnim( false );
1773 EditView
* pSpellingView
= aViewData
.GetSpellingView();
1775 for (sal_uInt16 i
=0; i
<4; i
++)
1777 if ( pGridWin
[i
]->IsVisible() && !aViewData
.HasEditView((ScSplitPos
)i
) )
1779 ScHSplitPos eHWhich
= WhichH( (ScSplitPos
) i
);
1780 ScVSplitPos eVWhich
= WhichV( (ScSplitPos
) i
);
1781 SCCOL nScrX
= aViewData
.GetPosX( eHWhich
);
1782 SCROW nScrY
= aViewData
.GetPosY( eVWhich
);
1785 ( nCol
>= nScrX
&& nCol
<= nScrX
+ aViewData
.VisibleCellsX(eHWhich
) + 1 &&
1786 nRow
>= nScrY
&& nRow
<= nScrY
+ aViewData
.VisibleCellsY(eVWhich
) + 1 );
1788 // for the active part, create edit view even if outside the visible area,
1789 // so input isn't lost (and the edit view may be scrolled into the visible area)
1791 // #i26433# during spelling, the spelling view must be active
1792 if ( bPosVisible
|| aViewData
.GetActivePart() == (ScSplitPos
) i
||
1793 ( pSpellingView
&& aViewData
.GetEditView((ScSplitPos
) i
) == pSpellingView
) )
1795 pGridWin
[i
]->HideCursor();
1797 pGridWin
[i
]->DeleteCursorOverlay();
1798 pGridWin
[i
]->DeleteAutoFillOverlay();
1799 pGridWin
[i
]->DeleteCopySourceOverlay();
1801 // flush OverlayManager before changing MapMode to text edit
1802 pGridWin
[i
]->flushOverlayManager();
1804 // MapMode must be set after HideCursor
1805 pGridWin
[i
]->SetMapMode(aViewData
.GetLogicMode());
1807 aViewData
.SetEditEngine( (ScSplitPos
) i
, pEngine
, pGridWin
[i
], nCol
, nRow
);
1811 // move the edit view area to the real (possibly negative) position,
1812 // or hide if completely above or left of the window
1813 pGridWin
[i
]->UpdateEditViewPos();
1818 if (aViewData
.GetViewShell()->HasAccessibilityObjects())
1819 aViewData
.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_ENTEREDITMODE
));
1822 void ScTabView::UpdateEditView()
1824 ScSplitPos eActive
= aViewData
.GetActivePart();
1825 for (sal_uInt16 i
=0; i
<4; i
++)
1826 if (aViewData
.HasEditView( (ScSplitPos
) i
))
1828 EditView
* pEditView
= aViewData
.GetEditView( (ScSplitPos
) i
);
1829 aViewData
.SetEditEngine( (ScSplitPos
) i
,
1830 static_cast<ScEditEngineDefaulter
*>(pEditView
->GetEditEngine()),
1831 pGridWin
[i
], GetViewData()->GetCurX(), GetViewData()->GetCurY() );
1832 if ( (ScSplitPos
)i
== eActive
)
1833 pEditView
->ShowCursor( false );
1837 void ScTabView::KillEditView( bool bNoPaint
)
1840 SCCOL nCol1
= aViewData
.GetEditStartCol();
1841 SCROW nRow1
= aViewData
.GetEditStartRow();
1842 SCCOL nCol2
= aViewData
.GetEditEndCol();
1843 SCROW nRow2
= aViewData
.GetEditEndRow();
1845 bool bNotifyAcc
= false;
1847 bool bExtended
= nRow1
!= nRow2
; // Col wird sowieso bis zum Ende gezeichnet
1848 bool bAtCursor
= nCol1
<= aViewData
.GetCurX() &&
1849 nCol2
>= aViewData
.GetCurX() &&
1850 nRow1
== aViewData
.GetCurY();
1853 bPaint
[i
] = aViewData
.HasEditView( (ScSplitPos
) i
);
1858 // #108931#; notify accessibility before all things happen
1859 if ((bNotifyAcc
) && (aViewData
.GetViewShell()->HasAccessibilityObjects()))
1860 aViewData
.GetViewShell()->BroadcastAccessibility(SfxSimpleHint(SC_HINT_ACC_LEAVEEDITMODE
));
1862 aViewData
.ResetEditView();
1864 if (pGridWin
[i
] && bPaint
[i
])
1865 if (pGridWin
[i
]->IsVisible())
1867 pGridWin
[i
]->ShowCursor();
1869 pGridWin
[i
]->SetMapMode(pGridWin
[i
]->GetDrawMapMode());
1871 // #i73567# the cell still has to be repainted
1872 if (bExtended
|| ( bAtCursor
&& !bNoPaint
))
1874 pGridWin
[i
]->Draw( nCol1
, nRow1
, nCol2
, nRow2
);
1875 pGridWin
[i
]->UpdateSelectionOverlay();
1880 DrawEnableAnim( true );
1882 // GrabFocus immer dann, wenn diese View aktiv ist und
1883 // die Eingabezeile den Focus hat
1885 bool bGrabFocus
= false;
1886 if (aViewData
.IsActive())
1888 ScInputHandler
* pInputHdl
= SC_MOD()->GetInputHdl();
1891 ScInputWindow
* pInputWin
= pInputHdl
->GetInputWindow();
1892 if (pInputWin
&& pInputWin
->IsInputActive())
1899 // So soll es gemacht werden, damit der Sfx es mitbekommt, klappt aber nicht:
1900 //! aViewData.GetViewShell()->GetViewFrame()->GetWindow().GrabFocus();
1901 // deshalb erstmal so:
1902 GetActiveWin()->GrabFocus();
1905 // Cursor-Abfrage erst nach GrabFocus
1908 if (pGridWin
[i
] && pGridWin
[i
]->IsVisible())
1910 Cursor
* pCur
= pGridWin
[i
]->GetCursor();
1911 if (pCur
&& pCur
->IsVisible())
1916 pGridWin
[i
]->UpdateCursorOverlay();
1917 pGridWin
[i
]->UpdateAutoFillOverlay();
1922 void ScTabView::UpdateFormulas()
1924 if ( aViewData
.GetDocument()->IsAutoCalcShellDisabled() )
1930 if (pGridWin
[i
]->IsVisible())
1931 pGridWin
[i
]->UpdateFormulas();
1933 if ( aViewData
.IsPagebreakMode() )
1934 UpdatePageBreakData(); //! asynchron
1936 UpdateHeaderWidth();
1938 // if in edit mode, adjust edit view area because widths/heights may have changed
1939 if ( aViewData
.HasEditView( aViewData
.GetActivePart() ) )
1943 // PaintArea -Block neu zeichnen
1945 void ScTabView::PaintArea( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
1946 ScUpdateMode eMode
)
1953 PutInOrder( nStartCol
, nEndCol
);
1954 PutInOrder( nStartRow
, nEndRow
);
1956 for (size_t i
= 0; i
< 4; ++i
)
1958 if (!pGridWin
[i
] || !pGridWin
[i
]->IsVisible())
1961 ScHSplitPos eHWhich
= WhichH( (ScSplitPos
) i
);
1962 ScVSplitPos eVWhich
= WhichV( (ScSplitPos
) i
);
1970 SCCOL nScrX
= aViewData
.GetPosX( eHWhich
);
1971 SCROW nScrY
= aViewData
.GetPosY( eVWhich
);
1972 if (nCol1
< nScrX
) nCol1
= nScrX
;
1975 if ( eMode
== SC_UPDATE_ALL
) // for UPDATE_ALL, paint anyway
1976 nCol2
= nScrX
; // (because of extending strings to the right)
1978 bOut
= true; // completely outside the window
1980 if (nRow1
< nScrY
) nRow1
= nScrY
;
1981 if (nRow2
< nScrY
) bOut
= true;
1983 SCCOL nLastX
= nScrX
+ aViewData
.VisibleCellsX( eHWhich
) + 1;
1984 SCROW nLastY
= nScrY
+ aViewData
.VisibleCellsY( eVWhich
) + 1;
1985 if (nCol1
> nLastX
) bOut
= true;
1986 if (nCol2
> nLastX
) nCol2
= nLastX
;
1987 if (nRow1
> nLastY
) bOut
= true;
1988 if (nRow2
> nLastY
) nRow2
= nLastY
;
1993 if ( eMode
== SC_UPDATE_CHANGED
)
1994 pGridWin
[i
]->Draw( nCol1
, nRow1
, nCol2
, nRow2
, eMode
);
1995 else // ALL oder MARKS
1997 bool bLayoutRTL
= aViewData
.GetDocument()->IsLayoutRTL( aViewData
.GetTabNo() );
1998 long nLayoutSign
= bLayoutRTL
? -1 : 1;
2000 Point aStart
= aViewData
.GetScrPos( nCol1
, nRow1
, (ScSplitPos
) i
);
2001 Point aEnd
= aViewData
.GetScrPos( nCol2
+1, nRow2
+1, (ScSplitPos
) i
);
2002 if ( eMode
== SC_UPDATE_ALL
)
2003 aEnd
.X() = bLayoutRTL
? 0 : (pGridWin
[i
]->GetOutputSizePixel().Width());
2004 aEnd
.X() -= nLayoutSign
;
2007 // #i85232# include area below cells (could be done in GetScrPos?)
2008 if ( eMode
== SC_UPDATE_ALL
&& nRow2
>= MAXROW
)
2009 aEnd
.Y() = pGridWin
[i
]->GetOutputSizePixel().Height();
2011 bool bShowChanges
= true; //! ...
2014 aStart
.X() -= nLayoutSign
; // include change marks
2018 bool bMarkClipped
= aViewData
.GetOptions().GetOption( VOPT_CLIPMARKS
);
2021 // dazu muesste ScColumn::IsEmptyBlock optimiert werden
2022 // (auf Search() umstellen)
2023 //!if ( nCol1 > 0 && !aViewData.GetDocument()->IsBlockEmpty(
2024 //! aViewData.GetTabNo(),
2025 //! 0, nRow1, nCol1-1, nRow2 ) )
2027 long nMarkPixel
= (long)( SC_CLIPMARK_SIZE
* aViewData
.GetPPTX() );
2028 aStart
.X() -= nMarkPixel
* nLayoutSign
;
2030 aStart
.X() -= nLayoutSign
; // cell grid
2034 pGridWin
[i
]->Invalidate( pGridWin
[i
]->PixelToLogic( Rectangle( aStart
,aEnd
) ) );
2038 // #i79909# Calling UpdateAllOverlays here isn't necessary and would lead to overlay calls from a timer,
2039 // with a wrong MapMode if editing in a cell (reference input).
2040 // #i80499# Overlays need updates in a lot of cases, e.g. changing row/column size,
2041 // or showing/hiding outlines. TODO: selections in inactive windows are vanishing.
2042 // #i84689# With relative conditional formats, PaintArea may be called often (for each changed cell),
2043 // so UpdateAllOverlays was moved to ScTabViewShell::Notify and is called only if PAINT_LEFT/PAINT_TOP
2044 // is set (width or height changed).
2047 void ScTabView::PaintRangeFinderEntry (ScRangeFindData
* pData
, const SCTAB nTab
)
2049 ScRange aRef
= pData
->aRef
;
2050 aRef
.Justify(); // Justify fuer die Abfragen unten
2052 if ( aRef
.aStart
== aRef
.aEnd
) //! Tab ignorieren?
2053 aViewData
.GetDocument()->ExtendMerge(aRef
);
2055 if ( aRef
.aStart
.Tab() >= nTab
&& aRef
.aEnd
.Tab() <= nTab
)
2057 SCCOL nCol1
= aRef
.aStart
.Col();
2058 SCROW nRow1
= aRef
.aStart
.Row();
2059 SCCOL nCol2
= aRef
.aEnd
.Col();
2060 SCROW nRow2
= aRef
.aEnd
.Row();
2062 // wegnehmen -> Repaint
2063 // SC_UPDATE_MARKS: Invalidate, nicht bis zum Zeilenende
2065 bool bHiddenEdge
= false;
2067 ScDocument
* pDoc
= aViewData
.GetDocument();
2068 while ( nCol1
> 0 && pDoc
->ColHidden(nCol1
, nTab
) )
2073 while ( nCol2
< MAXCOL
&& pDoc
->ColHidden(nCol2
, nTab
) )
2078 nTmp
= pDoc
->LastVisibleRow(0, nRow1
, nTab
);
2079 if (!ValidRow(nTmp
))
2086 nTmp
= pDoc
->FirstVisibleRow(nRow2
, MAXROW
, nTab
);
2087 if (!ValidRow(nTmp
))
2095 if ( nCol2
- nCol1
> 1 && nRow2
- nRow1
> 1 && !bHiddenEdge
)
2097 // nur an den Raendern entlang
2098 PaintArea( nCol1
, nRow1
, nCol2
, nRow1
, SC_UPDATE_MARKS
);
2099 PaintArea( nCol1
, nRow1
+1, nCol1
, nRow2
-1, SC_UPDATE_MARKS
);
2100 PaintArea( nCol2
, nRow1
+1, nCol2
, nRow2
-1, SC_UPDATE_MARKS
);
2101 PaintArea( nCol1
, nRow2
, nCol2
, nRow2
, SC_UPDATE_MARKS
);
2103 else // alles am Stueck
2104 PaintArea( nCol1
, nRow1
, nCol2
, nRow2
, SC_UPDATE_MARKS
);
2108 void ScTabView::PaintRangeFinder( long nNumber
)
2110 ScInputHandler
* pHdl
= SC_MOD()->GetInputHdl( aViewData
.GetViewShell() );
2113 ScRangeFindList
* pRangeFinder
= pHdl
->GetRangeFindList();
2114 if ( pRangeFinder
&& pRangeFinder
->GetDocName() == aViewData
.GetDocShell()->GetTitle() )
2116 SCTAB nTab
= aViewData
.GetTabNo();
2117 sal_uInt16 nCount
= (sal_uInt16
)pRangeFinder
->Count();
2121 for (sal_uInt16 i
=0; i
<nCount
; i
++)
2122 PaintRangeFinderEntry(pRangeFinder
->GetObject(i
),nTab
);
2126 sal_uInt16 idx
= nNumber
;
2128 PaintRangeFinderEntry(pRangeFinder
->GetObject(idx
),nTab
);
2134 // fuer Chart-Daten-Markierung
2136 void ScTabView::AddHighlightRange( const ScRange
& rRange
, const Color
& rColor
)
2138 maHighlightRanges
.push_back( ScHighlightEntry( rRange
, rColor
) );
2140 SCTAB nTab
= aViewData
.GetTabNo();
2141 if ( nTab
>= rRange
.aStart
.Tab() && nTab
<= rRange
.aEnd
.Tab() )
2142 PaintArea( rRange
.aStart
.Col(), rRange
.aStart
.Row(),
2143 rRange
.aEnd
.Col(), rRange
.aEnd
.Row(), SC_UPDATE_MARKS
);
2146 void ScTabView::ClearHighlightRanges()
2148 SCTAB nTab
= aViewData
.GetTabNo();
2149 std::vector
<ScHighlightEntry
>::const_iterator pIter
;
2150 for ( pIter
= maHighlightRanges
.begin(); pIter
!= maHighlightRanges
.end(); ++pIter
)
2152 ScRange aRange
= pIter
->aRef
;
2153 if ( nTab
>= aRange
.aStart
.Tab() && nTab
<= aRange
.aEnd
.Tab() )
2154 PaintArea( aRange
.aStart
.Col(), aRange
.aStart
.Row(),
2155 aRange
.aEnd
.Col(), aRange
.aEnd
.Row(), SC_UPDATE_MARKS
);
2158 maHighlightRanges
.clear();
2161 void ScTabView::DoChartSelection(
2162 const uno::Sequence
< chart2::data::HighlightedRange
> & rHilightRanges
)
2164 ClearHighlightRanges();
2165 const sal_Unicode sep
= ::formula::FormulaCompiler::GetNativeSymbol(ocSep
).GetChar(0);
2167 for( sal_Int32 i
=0; i
<rHilightRanges
.getLength(); ++i
)
2169 Color
aSelColor( rHilightRanges
[i
].PreferredColor
);
2170 ScRangeList aRangeList
;
2171 ScDocument
* pDoc
= aViewData
.GetDocShell()->GetDocument();
2172 if( ScRangeStringConverter::GetRangeListFromString(
2173 aRangeList
, rHilightRanges
[i
].RangeRepresentation
, pDoc
, pDoc
->GetAddressConvention(), sep
))
2175 size_t nListSize
= aRangeList
.size();
2176 for ( size_t j
= 0; j
< nListSize
; ++j
)
2178 ScRange
* p
= aRangeList
[j
];
2179 if( rHilightRanges
[i
].Index
== - 1 )
2180 AddHighlightRange( *p
, aSelColor
);
2182 AddHighlightRange( lcl_getSubRangeByIndex( *p
, rHilightRanges
[i
].Index
), aSelColor
);
2188 // PaintGrid - Datenbereiche neu zeichnen
2190 void ScTabView::PaintGrid()
2195 if (pGridWin
[i
]->IsVisible())
2196 pGridWin
[i
]->Invalidate();
2199 // PaintTop - obere Kontrollelemente neu zeichnen
2201 void ScTabView::PaintTop()
2207 pColBar
[i
]->Invalidate();
2209 pColOutline
[i
]->Invalidate();
2213 void ScTabView::CreateAnchorHandles(SdrHdlList
& rHdl
, const ScAddress
& rAddress
)
2221 if(pGridWin
[i
]->IsVisible())
2223 pGridWin
[i
]->CreateAnchorHandle(rHdl
, rAddress
);
2229 void ScTabView::PaintTopArea( SCCOL nStartCol
, SCCOL nEndCol
)
2231 // Pixel-Position der linken Kante
2233 if ( nStartCol
< aViewData
.GetPosX(SC_SPLIT_LEFT
) ||
2234 nStartCol
< aViewData
.GetPosX(SC_SPLIT_RIGHT
) )
2235 aViewData
.RecalcPixPos();
2237 // Fixierung anpassen (UpdateFixX setzt HSplitPos neu)
2239 if ( aViewData
.GetHSplitMode() == SC_SPLIT_FIX
&& nStartCol
< aViewData
.GetFixPosX() )
2240 if (aViewData
.UpdateFixX())
2246 --nStartCol
; //! allgemeiner ?
2248 bool bLayoutRTL
= aViewData
.GetDocument()->IsLayoutRTL( aViewData
.GetTabNo() );
2249 long nLayoutSign
= bLayoutRTL
? -1 : 1;
2251 for (sal_uInt16 i
=0; i
<2; i
++)
2253 ScHSplitPos eWhich
= (ScHSplitPos
) i
;
2254 if (pColBar
[eWhich
])
2256 Size aWinSize
= pColBar
[eWhich
]->GetSizePixel();
2257 long nStartX
= aViewData
.GetScrPos( nStartCol
, 0, eWhich
).X();
2259 if (nEndCol
>= MAXCOL
)
2260 nEndX
= bLayoutRTL
? 0 : ( aWinSize
.Width()-1 );
2262 nEndX
= aViewData
.GetScrPos( nEndCol
+1, 0, eWhich
).X() - nLayoutSign
;
2263 pColBar
[eWhich
]->Invalidate(
2264 Rectangle( nStartX
, 0, nEndX
, aWinSize
.Height()-1 ) );
2266 if (pColOutline
[eWhich
])
2267 pColOutline
[eWhich
]->Invalidate();
2272 // PaintLeft - linke Kontrollelemente neu zeichnen
2274 void ScTabView::PaintLeft()
2280 pRowBar
[i
]->Invalidate();
2282 pRowOutline
[i
]->Invalidate();
2286 void ScTabView::PaintLeftArea( SCROW nStartRow
, SCROW nEndRow
)
2288 // Pixel-Position der oberen Kante
2290 if ( nStartRow
< aViewData
.GetPosY(SC_SPLIT_TOP
) ||
2291 nStartRow
< aViewData
.GetPosY(SC_SPLIT_BOTTOM
) )
2292 aViewData
.RecalcPixPos();
2294 // Fixierung anpassen (UpdateFixY setzt VSplitPos neu)
2296 if ( aViewData
.GetVSplitMode() == SC_SPLIT_FIX
&& nStartRow
< aViewData
.GetFixPosY() )
2297 if (aViewData
.UpdateFixY())
2305 for (sal_uInt16 i
=0; i
<2; i
++)
2307 ScVSplitPos eWhich
= (ScVSplitPos
) i
;
2308 if (pRowBar
[eWhich
])
2310 Size aWinSize
= pRowBar
[eWhich
]->GetSizePixel();
2311 long nStartY
= aViewData
.GetScrPos( 0, nStartRow
, eWhich
).Y();
2313 if (nEndRow
>= MAXROW
)
2314 nEndY
= aWinSize
.Height()-1;
2316 nEndY
= aViewData
.GetScrPos( 0, nEndRow
+1, eWhich
).Y() - 1;
2317 pRowBar
[eWhich
]->Invalidate(
2318 Rectangle( 0, nStartY
, aWinSize
.Width()-1, nEndY
) );
2320 if (pRowOutline
[eWhich
])
2321 pRowOutline
[eWhich
]->Invalidate();
2325 bool ScTabView::PaintExtras()
2328 ScDocument
* pDoc
= aViewData
.GetDocument();
2329 SCTAB nTab
= aViewData
.GetTabNo();
2330 if (!pDoc
->HasTable(nTab
)) // Tabelle geloescht ?
2332 SCTAB nCount
= pDoc
->GetTableCount();
2333 aViewData
.SetTabNo(nCount
-1);
2336 pTabControl
->UpdateStatus(); // true = active
2340 void ScTabView::RecalcPPT()
2342 // called after changes that require the PPT values to be recalculated
2343 // (currently from detective operations)
2345 double nOldX
= aViewData
.GetPPTX();
2346 double nOldY
= aViewData
.GetPPTY();
2348 aViewData
.RefreshZoom(); // pre-calculate new PPT values
2350 bool bChangedX
= ( aViewData
.GetPPTX() != nOldX
);
2351 bool bChangedY
= ( aViewData
.GetPPTY() != nOldY
);
2352 if ( bChangedX
|| bChangedY
)
2354 // call view SetZoom (including draw scale, split update etc)
2355 // and paint only if values changed
2357 Fraction aZoomX
= aViewData
.GetZoomX();
2358 Fraction aZoomY
= aViewData
.GetZoomY();
2359 SetZoom( aZoomX
, aZoomY
, false );
2369 void ScTabView::ActivateView( bool bActivate
, bool bFirst
)
2371 if ( bActivate
== aViewData
.IsActive() && !bFirst
)
2373 // keine Assertion mehr - kommt vor, wenn vorher im Drag&Drop
2374 // auf ein anderes Dokument umgeschaltet wurde
2378 // wird nur bei MDI-(De)Activate gerufen
2379 // aViewData.Activate hinten wegen Cursor-Show bei KillEditView
2380 // Markierung nicht mehr loeschen - wenn an der ViewData Activate(false) gesetzt ist,
2381 // wird die Markierung nicht ausgegeben
2385 ScModule
* pScMod
= SC_MOD();
2386 bool bRefMode
= pScMod
->IsFormulaMode();
2388 // Referenzeingabe nicht abbrechen, um Referenzen auf
2389 // andere Dokumente zuzulassen
2393 // pass view to GetInputHdl, this view may not be current anymore
2394 ScInputHandler
* pHdl
= SC_MOD()->GetInputHdl(aViewData
.GetViewShell());
2396 pHdl
->EnterHandler();
2402 aViewData
.Activate(bActivate
);
2404 PaintBlock(false); // Repaint, Markierung je nach Active-Status
2407 HideAllCursors(); // Cursor
2415 ScSplitPos eWin
= aViewData
.GetActivePart();
2416 OSL_ENSURE( pGridWin
[eWin
], "rottes Dokument, nicht alle SplitPos in GridWin" );
2417 if ( !pGridWin
[eWin
] )
2419 eWin
= SC_SPLIT_BOTTOMLEFT
;
2420 if ( !pGridWin
[eWin
] )
2423 for ( i
=0; i
<4; i
++ )
2427 eWin
= (ScSplitPos
) i
;
2431 OSL_ENSURE( i
<4, "und BUMM" );
2433 aViewData
.SetActivePart( eWin
);
2436 // hier nicht mehr selber GrabFocus rufen!
2437 // Wenn das Doc bearbeitet wird, ruft der Sfx selber GrabFocus am Fenster der Shell.
2438 // Wenn es z.B. ein Mailbody ist, darf es den Focus nicht bekommen (Bug #43638#)
2440 UpdateInputContext();
2443 pGridWin
[aViewData
.GetActivePart()]->ClickExtern();
2446 void ScTabView::ActivatePart( ScSplitPos eWhich
)
2448 ScSplitPos eOld
= aViewData
.GetActivePart();
2449 if ( eOld
!= eWhich
)
2451 bInActivatePart
= true;
2453 bool bRefMode
= SC_MOD()->IsFormulaMode();
2455 // the HasEditView call during SetCursor would fail otherwise
2456 if ( aViewData
.HasEditView(eOld
) && !bRefMode
)
2459 ScHSplitPos eOldH
= WhichH(eOld
);
2460 ScVSplitPos eOldV
= WhichV(eOld
);
2461 ScHSplitPos eNewH
= WhichH(eWhich
);
2462 ScVSplitPos eNewV
= WhichV(eWhich
);
2463 bool bTopCap
= pColBar
[eOldH
] && pColBar
[eOldH
]->IsMouseCaptured();
2464 bool bLeftCap
= pRowBar
[eOldV
] && pRowBar
[eOldV
]->IsMouseCaptured();
2466 bool bFocus
= pGridWin
[eOld
]->HasFocus();
2467 bool bCapture
= pGridWin
[eOld
]->IsMouseCaptured();
2469 pGridWin
[eOld
]->ReleaseMouse();
2470 pGridWin
[eOld
]->ClickExtern();
2471 pGridWin
[eOld
]->HideCursor();
2472 pGridWin
[eWhich
]->HideCursor();
2473 aViewData
.SetActivePart( eWhich
);
2475 ScTabViewShell
* pShell
= aViewData
.GetViewShell();
2476 pShell
->WindowChanged();
2478 pSelEngine
->SetWindow(pGridWin
[eWhich
]);
2479 pSelEngine
->SetWhich(eWhich
);
2480 pSelEngine
->SetVisibleArea( Rectangle(Point(), pGridWin
[eWhich
]->GetOutputSizePixel()) );
2482 pGridWin
[eOld
]->MoveMouseStatus(*pGridWin
[eWhich
]);
2484 if ( bCapture
|| pGridWin
[eWhich
]->IsMouseCaptured() )
2486 // Tracking statt CaptureMouse, damit sauber abgebrochen werden kann
2487 // (SelectionEngine ruft CaptureMouse beim SetWindow)
2488 //! Irgendwann sollte die SelectionEngine selber StartTracking rufen!?!
2489 pGridWin
[eWhich
]->ReleaseMouse();
2490 pGridWin
[eWhich
]->StartTracking();
2493 if ( bTopCap
&& pColBar
[eNewH
] )
2495 pColBar
[eOldH
]->SetIgnoreMove(true);
2496 pColBar
[eNewH
]->SetIgnoreMove(false);
2497 pHdrSelEng
->SetWindow( pColBar
[eNewH
] );
2498 long nWidth
= pColBar
[eNewH
]->GetOutputSizePixel().Width();
2499 pHdrSelEng
->SetVisibleArea( Rectangle( 0, LONG_MIN
, nWidth
-1, LONG_MAX
) );
2500 pColBar
[eNewH
]->CaptureMouse();
2502 if ( bLeftCap
&& pRowBar
[eNewV
] )
2504 pRowBar
[eOldV
]->SetIgnoreMove(true);
2505 pRowBar
[eNewV
]->SetIgnoreMove(false);
2506 pHdrSelEng
->SetWindow( pRowBar
[eNewV
] );
2507 long nHeight
= pRowBar
[eNewV
]->GetOutputSizePixel().Height();
2508 pHdrSelEng
->SetVisibleArea( Rectangle( LONG_MIN
, 0, LONG_MAX
, nHeight
-1 ) );
2509 pRowBar
[eNewV
]->CaptureMouse();
2511 aHdrFunc
.SetWhich(eWhich
);
2513 pGridWin
[eOld
]->ShowCursor();
2514 pGridWin
[eWhich
]->ShowCursor();
2516 SfxInPlaceClient
* pClient
= aViewData
.GetViewShell()->GetIPClient();
2517 bool bOleActive
= ( pClient
&& pClient
->IsObjectInPlaceActive() );
2519 // don't switch ViewShell's active window during RefInput, because the focus
2520 // might change, and subsequent SetReference calls wouldn't find the right EditView
2521 if ( !bRefMode
&& !bOleActive
)
2522 aViewData
.GetViewShell()->SetWindow( pGridWin
[eWhich
] );
2524 if ( bFocus
&& !aViewData
.IsAnyFillMode() && !bRefMode
)
2526 // GrabFocus nur, wenn vorher das andere GridWindow den Focus hatte
2527 // (z.B. wegen Suchen & Ersetzen)
2528 pGridWin
[eWhich
]->GrabFocus();
2531 bInActivatePart
= false;
2535 void ScTabView::HideListBox()
2537 for (sal_uInt16 i
=0; i
<4; i
++)
2539 pGridWin
[i
]->ClickExtern();
2542 void ScTabView::UpdateInputContext()
2544 ScGridWindow
* pWin
= pGridWin
[aViewData
.GetActivePart()];
2546 pWin
->UpdateInputContext();
2549 pTabControl
->UpdateInputContext();
2552 // GetGridWidth - Breite eines Ausgabebereichs (fuer ViewData)
2554 long ScTabView::GetGridWidth( ScHSplitPos eWhich
)
2556 ScSplitPos eGridWhich
= ( eWhich
== SC_SPLIT_LEFT
) ? SC_SPLIT_BOTTOMLEFT
: SC_SPLIT_BOTTOMRIGHT
;
2557 if (pGridWin
[eGridWhich
])
2558 return pGridWin
[eGridWhich
]->GetSizePixel().Width();
2563 // GetGridHeight - Hoehe eines Ausgabebereichs (fuer ViewData)
2565 long ScTabView::GetGridHeight( ScVSplitPos eWhich
)
2567 ScSplitPos eGridWhich
= ( eWhich
== SC_SPLIT_TOP
) ? SC_SPLIT_TOPLEFT
: SC_SPLIT_BOTTOMLEFT
;
2568 if (pGridWin
[eGridWhich
])
2569 return pGridWin
[eGridWhich
]->GetSizePixel().Height();
2574 void ScTabView::UpdateInputLine()
2576 SC_MOD()->InputEnterHandler();
2579 void ScTabView::ZoomChanged()
2581 ScInputHandler
* pHdl
= SC_MOD()->GetInputHdl(aViewData
.GetViewShell());
2583 pHdl
->SetRefScale( aViewData
.GetZoomX(), aViewData
.GetZoomY() );
2590 // AW: Discussed with NN if there is a reason that new map mode was only set for one window,
2591 // but is not. Setting only on one window causes the first repaint to have the old mapMode
2592 // in three of four views, so the overlay will save the wrong content e.g. when zooming out.
2593 // Changing to setting map mode at all windows.
2596 for(a
= 0L; a
< 4L; a
++)
2600 pGridWin
[a
]->SetMapMode(pGridWin
[a
]->GetDrawMapMode());
2606 InterpretVisible(); // have everything calculated before painting
2608 SfxBindings
& rBindings
= aViewData
.GetBindings();
2609 rBindings
.Invalidate( SID_ATTR_ZOOM
);
2610 rBindings
.Invalidate( SID_ATTR_ZOOMSLIDER
);
2614 // AW: To not change too much, use pWin here
2615 ScGridWindow
* pWin
= pGridWin
[aViewData
.GetActivePart()];
2617 if ( pWin
&& aViewData
.HasEditView( aViewData
.GetActivePart() ) )
2619 // flush OverlayManager before changing the MapMode
2620 pWin
->flushOverlayManager();
2622 // make sure the EditView's position and size are updated
2623 // with the right (logic, not drawing) MapMode
2624 pWin
->SetMapMode( aViewData
.GetLogicMode() );
2629 void ScTabView::CheckNeedsRepaint()
2633 if ( pGridWin
[i
] && pGridWin
[i
]->IsVisible() )
2634 pGridWin
[i
]->CheckNeedsRepaint();
2641 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */