1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tabview.hxx,v $
10 * $Revision: 1.28.32.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef SC_TABVIEW_HXX
31 #define SC_TABVIEW_HXX
33 #include <vcl/scrbar.hxx>
35 //REMOVE #ifndef SO2_DECL_SVINPLACECLIENT_DEFINED
36 //REMOVE #define SO2_DECL_SVINPLACECLIENT_DEFINED
37 //REMOVE SO2_DECL_REF(SvInPlaceClient)
40 #include <sfx2/ipclient.hxx>
42 #include "viewutil.hxx"
45 class ScEditEngineDefaulter
;
47 class ScOutlineWindow
;
61 class ScPageBreakData
;
62 class ScHighlightRanges
;
63 struct ChartSelectionInfo
;
66 namespace com
{ namespace sun
{ namespace star
{
67 namespace chart2
{ namespace data
{
68 struct HighlightedRange
;
71 #define SPLIT_HANDLE_SIZE 3
72 #define SC_FORCEMODE_NONE 0xff
74 // ---------------------------------------------------------------------------
77 class ScCornerButton
: public Window
80 ScViewData
* pViewData
;
84 virtual void Paint( const Rectangle
& rRect
);
85 virtual void Resize();
86 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
88 ScCornerButton( Window
* pParent
, ScViewData
* pData
, BOOL bAdditional
);
91 virtual void StateChanged( StateChangedType nType
);
92 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
96 // ---------------------------------------------------------------------------
101 Window
* pFrameWin
; // als erstes !!!
102 ScViewData aViewData
; // muss ganz vorne stehen !
104 ScViewSelectionEngine
* pSelEngine
;
105 ScViewFunctionSet aFunctionSet
;
107 ScHeaderSelectionEngine
* pHdrSelEng
;
108 ScHeaderFunctionSet aHdrFunc
;
110 SfxInPlaceClient
* pIPClient
;
112 ScDrawView
* pDrawView
;
114 Size aFrameSize
; // wie bei DoResize uebergeben
117 BOOL bDrawSelMode
; // nur Zeichenobjekte selektieren ?
122 ScGridWindow
* pGridWin
[4];
123 ScColBar
* pColBar
[2];
124 ScRowBar
* pRowBar
[2];
125 ScOutlineWindow
* pColOutline
[2];
126 ScOutlineWindow
* pRowOutline
[2];
127 ScTabSplitter
* pHSplitter
;
128 ScTabSplitter
* pVSplitter
;
129 ScTabControl
* pTabControl
;
130 ScrollBar aVScrollTop
;
131 ScrollBar aVScrollBottom
; // anfangs sichtbar
132 ScrollBar aHScrollLeft
; // anfangs sichtbar
133 ScrollBar aHScrollRight
;
134 ScCornerButton aCornerButton
;
135 ScCornerButton aTopButton
;
136 ScrollBarBox aScrollBarBox
;
138 ScHintWindow
* pInputHintWindow
; // Eingabemeldung bei Gueltigkeit
140 ScPageBreakData
* pPageBreakData
; // fuer Seitenumbruch-Modus
141 ScHighlightRanges
* pHighlightRanges
;
143 ScDocument
* pBrushDocument
; // cell formats for format paint brush
144 SfxItemSet
* pDrawBrushSet
; // drawing object attributes for paint brush
145 BOOL bLockPaintBrush
; // keep for more than one use?
148 ScGridWindow
* pTimerWindow
;
149 MouseEvent aTimerMEvt
;
153 BOOL bDragging
; // fuer Scrollbars
156 BOOL bIsBlockMode
; // Block markieren
157 BOOL bBlockNeg
; // wird Markierung aufgehoben?
158 BOOL bBlockCols
; // werden ganze Spalten markiert?
159 BOOL bBlockRows
; // werden ganze Zeilen markiert?
162 SCCOL nBlockStartXOrig
;
166 SCROW nBlockStartYOrig
;
175 double mfPendingTabBarWidth
; // Tab bar width relative to frame window width.
178 BOOL bInUpdateHeader
;
179 BOOL bInActivatePart
;
185 void DoAddWin( ScGridWindow
* pWin
);
187 void InitScrollBar( ScrollBar
& rScrollBar
, long nMaxVal
);
188 DECL_LINK( ScrollHdl
, ScrollBar
* );
189 DECL_LINK( EndScrollHdl
, ScrollBar
* );
191 DECL_LINK( SplitHdl
, Splitter
* );
192 void DoHSplit(long nSplitPos
);
193 void DoVSplit(long nSplitPos
);
195 DECL_LINK( TimerHdl
, Timer
* );
197 void UpdateVarZoom();
199 static void SetScrollBar( ScrollBar
& rScroll
, long nRangeMax
, long nVisible
, long nPos
, BOOL bLayoutRTL
);
200 static long GetScrollBarPos( ScrollBar
& rScroll
, BOOL bLayoutRTL
);
202 void GetPageMoveEndPosition(SCsCOL nMovX
, SCsROW nMovY
, SCsCOL
& rPageX
, SCsROW
& rPageY
);
203 void GetAreaMoveEndPosition(SCsCOL nMovX
, SCsROW nMovY
, ScFollowMode eMode
,
204 SCsCOL
& rAreaX
, SCsROW
& rAreaY
, ScFollowMode
& rMode
);
207 void UpdateHeaderWidth( const ScVSplitPos
* pWhich
= NULL
,
208 const SCROW
* pPosY
= NULL
);
215 void GetBorderSize( SvBorder
& rBorder
, const Size
& rSize
);
217 void ResetDrawDragMode();
218 BOOL
IsDrawTextEdit() const;
219 void DrawEnableAnim(BOOL bSet
);
220 //HMHvoid DrawShowMarkHdl(BOOL bShow);
222 void MakeDrawView( BYTE nForceDesignMode
= SC_FORCEMODE_NONE
);
224 void HideNoteMarker();
226 void UpdateIMap( SdrObject
* pObj
);
229 ScTabView( Window
* pParent
, ScDocShell
& rDocSh
, ScTabViewShell
* pViewShell
);
230 //UNUSED2009-05 ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell );
233 void MakeDrawLayer();
237 BOOL
HasHintWindow() const { return pInputHintWindow
!= NULL
; }
238 void RemoveHintWindow();
239 void TestHintWindow();
242 DECL_LINK( TabBarResize
, void* );
243 /** Sets an absolute tab bar width (in pixels). */
244 void SetTabBarWidth( long nNewWidth
);
245 /** Sets a relative tab bar width.
246 @param fRelTabBarWidth Tab bar width relative to frame window width (0.0 ... 1.0). */
247 void SetRelTabBarWidth( double fRelTabBarWidth
);
248 /** Sets a relative tab bar width. Tab bar is resized again in next DoResize().
249 @param fRelTabBarWidth Tab bar width relative to frame window width (0.0 ... 1.0). */
250 void SetPendingRelTabBarWidth( double fRelTabBarWidth
);
251 /** Returns the current tab bar width in pixels. */
252 long GetTabBarWidth() const;
253 /** Returns the current tab bar width relative to the frame window width (0.0 ... 1.0). */
254 double GetRelTabBarWidth() const;
255 /** Returns the pending tab bar width relative to the frame window width (0.0 ... 1.0). */
256 double GetPendingRelTabBarWidth() const;
258 void DoResize( const Point
& rOffset
, const Size
& rSize
, BOOL bInner
= FALSE
);
259 void RepeatResize( BOOL bUpdateFix
= TRUE
);
261 Point
GetGridOffset() const;
263 BOOL
IsDrawSelMode() const { return bDrawSelMode
; }
264 void SetDrawSelMode(BOOL bNew
) { bDrawSelMode
= bNew
; }
266 void SetDrawFuncPtr(FuPoor
* pFuncPtr
) { pDrawActual
= pFuncPtr
; }
267 void SetDrawFuncOldPtr(FuPoor
* pFuncPtr
) { pDrawOld
= pFuncPtr
; }
268 FuPoor
* GetDrawFuncPtr() { return pDrawActual
; }
269 FuPoor
* GetDrawFuncOldPtr() { return pDrawOld
; }
271 void DrawDeselectAll();
272 void DrawMarkListHasChanged();
273 void UpdateAnchorHandles();
274 //UNUSED2008-05 String GetSelectedChartName() const;
276 ScPageBreakData
* GetPageBreakData() { return pPageBreakData
; }
277 ScHighlightRanges
* GetHighlightRanges() { return pHighlightRanges
; }
279 void UpdatePageBreakData( BOOL bForcePaint
= FALSE
);
281 void DrawMarkRect( const Rectangle
& rRect
);
283 ScViewData
* GetViewData() { return &aViewData
; }
284 const ScViewData
* GetViewData() const { return &aViewData
; }
286 ScViewFunctionSet
* GetFunctionSet() { return &aFunctionSet
; }
287 ScViewSelectionEngine
* GetSelEngine() { return pSelEngine
; }
289 BOOL
SelMouseButtonDown( const MouseEvent
& rMEvt
);
291 ScDrawView
* GetScDrawView() { return pDrawView
; }
292 SdrView
* GetSdrView(); // gegen CLOKs
294 BOOL
IsMinimized() const { return bMinimized
; }
297 void SetZoom( const Fraction
& rNewX
, const Fraction
& rNewY
, BOOL bAll
);
298 SC_DLLPUBLIC
void RefreshZoom();
299 void SetPagebreakMode( BOOL bSet
);
301 void UpdateLayerLocks();
303 void UpdateDrawTextOutliner();
304 void DigitLanguageChanged();
306 void UpdateInputLine();
308 void InitRefMode( SCCOL nCurX
, SCROW nCurY
, SCTAB nCurZ
, ScRefType eType
,
309 BOOL bPaint
= TRUE
);
310 void DoneRefMode( BOOL bContinue
= FALSE
);
311 void UpdateRef( SCCOL nCurX
, SCROW nCurY
, SCTAB nCurZ
);
314 //UNUSED2008-05 void EndSelection();
316 void FakeButtonUp( ScSplitPos eWhich
);
318 Window
* GetActiveWin();
319 Window
* GetWindowByPos( ScSplitPos ePos
);
321 ScSplitPos
FindWindow( Window
* pWindow
) const;
323 void SetActivePointer( const Pointer
& rPointer
);
324 //UNUSED2008-05 void SetActivePointer( const ResId& rId );
326 void ActiveGrabFocus();
327 //UNUSED2008-05 void ActiveCaptureMouse();
328 //UNUSED2008-05 void ActiveReleaseMouse();
329 //UNUSED2008-05 Point ActivePixelToLogic( const Point& rDevicePoint );
331 void ClickCursor( SCCOL nPosX
, SCROW nPosY
, BOOL bControl
);
333 SC_DLLPUBLIC
void SetCursor( SCCOL nPosX
, SCROW nPosY
, BOOL bNew
= FALSE
);
335 SC_DLLPUBLIC
void CellContentChanged();
336 void SelectionChanged();
337 void CursorPosChanged();
338 void UpdateInputContext();
340 void CheckSelectionTransfer();
342 void InvertHorizontal( ScVSplitPos eWhich
, long nDragPos
);
343 void InvertVertical( ScHSplitPos eWhich
, long nDragPos
);
345 Point
GetInsertPos();
347 Point
GetChartInsertPos( const Size
& rSize
, const ScRange
& rCellRange
);
348 Point
GetChartDialogPos( const Size
& rDialogSize
, const Rectangle
& rLogicChart
);
350 void UpdateAutoFillMark();
352 void HideCursor(); // nur aktiver Teil
354 void HideAllCursors();
355 void ShowAllCursors();
357 void AlignToCursor( SCsCOL nCurX
, SCsROW nCurY
, ScFollowMode eMode
,
358 const ScSplitPos
* pWhich
= NULL
);
360 SvxZoomType
GetZoomType() const;
361 void SetZoomType( SvxZoomType eNew
, BOOL bAll
);
362 USHORT
CalcZoom( SvxZoomType eType
, USHORT nOldZoom
);
364 // void CalcZoom( SvxZoomType eType, USHORT& rZoom, SCCOL& rCol, SCROW& rRow );
366 sal_Bool
HasPageFieldDataAtCursor() const;
367 void StartDataSelect();
369 // MoveCursorAbs - absolut
370 // MoveCursorRel - einzelne Zellen
371 // MoveCursorPage - Bildschirmseite
372 // MoveCursorArea - Datenblock
373 // MoveCursorEnd - links oben / benutzter Bereich
375 SC_DLLPUBLIC
void MoveCursorAbs( SCsCOL nCurX
, SCsROW nCurY
, ScFollowMode eMode
,
376 BOOL bShift
, BOOL bControl
,
377 BOOL bKeepOld
= FALSE
, BOOL bKeepSel
= FALSE
);
378 void MoveCursorRel( SCsCOL nMovX
, SCsROW nMovY
, ScFollowMode eMode
,
379 BOOL bShift
, BOOL bKeepSel
= FALSE
);
380 void MoveCursorPage( SCsCOL nMovX
, SCsROW nMovY
, ScFollowMode eMode
,
381 BOOL bShift
, BOOL bKeepSel
= FALSE
);
382 void MoveCursorArea( SCsCOL nMovX
, SCsROW nMovY
, ScFollowMode eMode
,
383 BOOL bShift
, BOOL bKeepSel
= FALSE
);
384 void MoveCursorEnd( SCsCOL nMovX
, SCsROW nMovY
, ScFollowMode eMode
,
385 BOOL bShift
, BOOL bKeepSel
= FALSE
);
386 void MoveCursorScreen( SCsCOL nMovX
, SCsROW nMovY
, ScFollowMode eMode
, BOOL bShift
);
388 void MoveCursorEnter( BOOL bShift
); // Shift fuer Richtung (kein Markieren)
390 BOOL
MoveCursorKeyInput( const KeyEvent
& rKeyEvent
);
392 void FindNextUnprot( BOOL bShift
, BOOL bInSelection
= TRUE
);
394 void SetTabNo( SCTAB nTab
, BOOL bNew
= FALSE
, BOOL bExtendSelection
= FALSE
);
395 void SelectNextTab( short nDir
, BOOL bExtendSelection
= FALSE
);
397 void ActivateView( BOOL bActivate
, BOOL bFirst
);
398 void ActivatePart( ScSplitPos eWhich
);
399 BOOL
IsInActivatePart() const { return bInActivatePart
; }
401 void SetTimer( ScGridWindow
* pWin
, const MouseEvent
& rMEvt
);
404 void ScrollX( long nDeltaX
, ScHSplitPos eWhich
, BOOL bUpdBars
= TRUE
);
405 void ScrollY( long nDeltaY
, ScVSplitPos eWhich
, BOOL bUpdBars
= TRUE
);
406 SC_DLLPUBLIC
void ScrollLines( long nDeltaX
, long nDeltaY
); // aktives
408 BOOL
ScrollCommand( const CommandEvent
& rCEvt
, ScSplitPos ePos
);
410 void ScrollToObject( SdrObject
* pDrawObj
);
411 void MakeVisible( const Rectangle
& rHMMRect
);
415 void InvertBlockMark(SCCOL nBlockStartX
, SCROW nBlockStartY
,
416 SCCOL nBlockEndX
, SCROW nBlockEndY
);
418 //UNUSED2008-05 void DrawDragRect( SCCOL nStartX, SCROW nStartY, SCCOL nEndX, SCROW nEndY,
419 //UNUSED2008-05 ScSplitPos ePos );
420 //UNUSED2008-05 void PaintCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
421 //UNUSED2008-05 void PaintLeftRow( SCROW nRow );
422 //UNUSED2008-05 void PaintTopCol( SCCOL nCol );
424 void PaintArea( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
425 ScUpdateMode eMode
= SC_UPDATE_ALL
);
429 void PaintTopArea( SCCOL nStartCol
, SCCOL nEndCol
);
432 void PaintLeftArea( SCROW nStartRow
, SCROW nEndRow
);
439 void CreateAnchorHandles(SdrHdlList
& rHdl
, const ScAddress
& rAddress
);
441 void UpdateSelectionOverlay();
442 void UpdateShrinkOverlay();
443 void UpdateAllOverlays();
445 void UpdateFormulas();
446 void InterpretVisible();
447 void CheckNeedsRepaint();
449 void PaintRangeFinder( long nNumber
= -1 );
450 void AddHighlightRange( const ScRange
& rRange
, const Color
& rColor
);
451 void ClearHighlightRanges();
453 void DoChartSelection( const ::com::sun::star::uno::Sequence
<
454 ::com::sun::star::chart2::data::HighlightedRange
> & rHilightRanges
);
456 long GetGridWidth( ScHSplitPos eWhich
);
457 long GetGridHeight( ScVSplitPos eWhich
);
459 void UpdateScrollBars();
460 void SetNewVisArea();
462 void InvalidateAttribs();
464 void MakeEditView( ScEditEngineDefaulter
* pEngine
, SCCOL nCol
, SCROW nRow
);
465 void KillEditView( BOOL bNoPaint
);
466 void UpdateEditView();
471 void SelectAll( BOOL bContinue
= FALSE
);
472 void SelectAllTables();
473 void DeselectAllTables();
475 void MarkCursor( SCCOL nCurX
, SCROW nCurY
, SCTAB nCurZ
,
476 BOOL bCols
= FALSE
, BOOL bRows
= FALSE
, BOOL bCellSelection
= FALSE
);
477 void InitBlockMode( SCCOL nCurX
, SCROW nCurY
, SCTAB nCurZ
,
478 BOOL bTestNeg
= FALSE
,
479 BOOL bCols
= FALSE
, BOOL bRows
= FALSE
);
480 void InitOwnBlockMode();
481 void DoneBlockMode( BOOL bContinue
= FALSE
);
483 BOOL
IsBlockMode() const { return bIsBlockMode
; }
485 void ExpandBlock(SCsCOL nMovX
, SCsROW nMovY
, ScFollowMode eMode
);
486 void ExpandBlockPage(SCsCOL nMovX
, SCsROW nMovY
);
487 void ExpandBlockArea(SCsCOL nMovX
, SCsROW nMovY
);
491 void MarkDataArea( BOOL bIncludeCursor
= TRUE
);
492 void MarkMatrixFormula();
495 void MarkRange( const ScRange
& rRange
, BOOL bSetCursor
= TRUE
, BOOL bContinue
= FALSE
);
497 BOOL
IsMarking( SCCOL nCol
, SCROW nRow
, SCTAB nTab
) const;
499 void PaintMarks( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
);
500 void PaintBlock( BOOL bReset
= FALSE
);
502 void SetMarkData( const ScMarkData
& rNew
);
503 void MarkDataChanged();
505 void LockModifiers( USHORT nModifiers
);
506 USHORT
GetLockedModifiers() const;
507 void ViewOptionsHasChanged( BOOL bHScrollChanged
,
508 BOOL bGraphicsChanged
= FALSE
);
510 Point
GetMousePosPixel();
512 void SnapSplitPos( Point
& rScreenPosPixel
);
513 void FreezeSplitters( BOOL bFreeze
);
515 void SplitAtCursor();
516 void SplitAtPixel( const Point
& rPixel
, BOOL bHor
, BOOL bVer
);
517 void InvalidateSplit();
519 void ErrorMessage( USHORT nGlobStrId
);
520 Window
* GetParentOrChild( USHORT nChildId
);
522 void EnableRefInput(BOOL bFlag
=TRUE
);
524 Window
* GetFrameWin() const { return pFrameWin
; }
526 BOOL
HasPaintBrush() const { return pBrushDocument
|| pDrawBrushSet
; }
527 ScDocument
* GetBrushDocument() const { return pBrushDocument
; }
528 SfxItemSet
* GetDrawBrushSet() const { return pDrawBrushSet
; }
529 BOOL
IsPaintBrushLocked() const { return bLockPaintBrush
; }
530 void SetBrushDocument( ScDocument
* pNew
, BOOL bLock
);
531 void SetDrawBrushSet( SfxItemSet
* pNew
, BOOL bLock
);
532 void ResetBrushDocument();