fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / inc / tabview.hxx
blobd7e2a2dbf12ee65181ff1999a9426a1618e563ef
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_SC_SOURCE_UI_INC_TABVIEW_HXX
20 #define INCLUDED_SC_SOURCE_UI_INC_TABVIEW_HXX
22 #include <vcl/scrbar.hxx>
24 #include <sfx2/ipclient.hxx>
26 #include "hiranges.hxx"
27 #include "viewutil.hxx"
28 #include "select.hxx"
29 #include "gridwin.hxx"
30 #include "drawview.hxx"
32 #include <boost/noncopyable.hpp>
33 #include <boost/scoped_ptr.hpp>
35 namespace editeng {
36 struct MisspellRanges;
39 class ScEditEngineDefaulter;
40 class ScGridWindow;
41 class ScOutlineWindow;
42 class ScRowBar;
43 class ScColBar;
44 class ScTabControl;
45 class ScTabViewShell;
46 struct ScRangeFindData;
47 class ScDrawView;
48 class SvBorder;
49 class FuPoor;
50 class Splitter;
51 class ScTabSplitter;
52 class SdrView;
53 class SdrObject;
54 class ScHintWindow;
55 class ScPageBreakData;
56 class SdrHdlList;
58 namespace com { namespace sun { namespace star {
59 namespace chart2 { namespace data {
60 struct HighlightedRange;
61 }}}}}
63 // Help - Window
65 class ScCornerButton : public vcl::Window
67 private:
68 ScViewData* pViewData;
69 bool bAdd;
71 protected:
72 virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
73 virtual void Resize() SAL_OVERRIDE;
74 virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
75 public:
76 ScCornerButton( vcl::Window* pParent, ScViewData* pData, bool bAdditional );
77 virtual ~ScCornerButton();
79 virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
80 virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
83 class ScTabView : boost::noncopyable
85 private:
86 enum BlockMode { None = 0, Normal = 1, Own = 2 };
88 VclPtr<vcl::Window> pFrameWin; // First !!!
89 ScViewData aViewData; // must be at the front !
91 ScViewSelectionEngine* pSelEngine;
92 ScViewFunctionSet aFunctionSet;
94 ScHeaderSelectionEngine* pHdrSelEng;
95 ScHeaderFunctionSet aHdrFunc;
97 ScDrawView* pDrawView;
99 Size aFrameSize; // passed on as for DoResize
100 Point aBorderPos;
102 FuPoor* pDrawActual;
103 FuPoor* pDrawOld;
105 VclPtr<ScGridWindow> pGridWin[4];
106 VclPtr<ScColBar> pColBar[2];
107 VclPtr<ScRowBar> pRowBar[2];
108 VclPtr<ScOutlineWindow> pColOutline[2];
109 VclPtr<ScOutlineWindow> pRowOutline[2];
110 VclPtr<ScTabSplitter> pHSplitter;
111 VclPtr<ScTabSplitter> pVSplitter;
112 VclPtr<ScTabControl> pTabControl;
113 VclPtr<ScrollBar> aVScrollTop;
114 VclPtr<ScrollBar> aVScrollBottom; // initially visible
115 VclPtr<ScrollBar> aHScrollLeft; // initially visible
116 VclPtr<ScrollBar> aHScrollRight;
117 VclPtr<ScCornerButton> aCornerButton;
118 VclPtr<ScCornerButton> aTopButton;
119 VclPtr<ScrollBarBox> aScrollBarBox;
121 VclPtr<ScHintWindow> mpInputHintWindow; // popup window for data validation
123 ScPageBreakData* pPageBreakData;
124 std::vector<ScHighlightEntry> maHighlightRanges;
126 ScDocument* pBrushDocument; // cell formats for format paint brush
127 SfxItemSet* pDrawBrushSet; // drawing object attributes for paint brush
129 Timer aScrollTimer;
130 VclPtr<ScGridWindow> pTimerWindow;
131 MouseEvent aTimerMEvt;
133 sal_uLong nTipVisible;
135 long nPrevDragPos;
137 BlockMode meBlockMode; // Marks block
139 SCCOL nBlockStartX;
140 SCCOL nBlockStartXOrig;
141 SCCOL nBlockEndX;
143 SCROW nBlockStartY;
144 SCROW nBlockStartYOrig;
145 SCROW nBlockEndY;
147 SCTAB nBlockStartZ;
148 SCTAB nBlockEndZ;
150 SCCOL nOldCurX;
151 SCROW nOldCurY;
153 double mfPendingTabBarWidth; // Tab bar width relative to frame window width.
155 bool bMinimized:1;
156 bool bInUpdateHeader:1;
157 bool bInActivatePart:1;
158 bool bInZoomUpdate:1;
159 bool bMoveIsShift:1;
160 bool bDrawSelMode:1; // Only select draw objects ?
161 bool bLockPaintBrush:1; // keep for more than one use?
162 bool bDragging:1; // for scroll bars
163 bool bBlockNeg:1; // is no longer highlighted?
164 bool bBlockCols:1; // are whole columns selected?
165 bool bBlockRows:1; // are whole rows selected?
166 bool mbInlineWithScrollbar:1; // should inline with scrollbar?
168 void Init();
170 void DoAddWin( ScGridWindow* pWin );
172 void InitScrollBar( ScrollBar& rScrollBar, long nMaxVal );
173 DECL_LINK( ScrollHdl, ScrollBar* );
174 DECL_LINK( EndScrollHdl, void* );
176 DECL_LINK( SplitHdl, Splitter* );
177 void DoHSplit(long nSplitPos);
178 void DoVSplit(long nSplitPos);
180 DECL_LINK_TYPED( TimerHdl, Timer*, void );
182 void UpdateVarZoom();
184 static void SetScrollBar( ScrollBar& rScroll, long nRangeMax, long nVisible, long nPos, bool bLayoutRTL );
185 static long GetScrollBarPos( ScrollBar& rScroll );
187 void GetPageMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, SCsCOL& rPageX, SCsROW& rPageY);
188 void GetAreaMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
189 SCsCOL& rAreaX, SCsROW& rAreaY, ScFollowMode& rMode);
191 void SkipCursorHorizontal(SCsCOL& rCurX, SCsROW& rCurY, SCsCOL nOldX, SCsROW nMovX);
192 void SkipCursorVertical(SCsCOL& rCurX, SCsROW& rCurY, SCsROW nOldY, SCsROW nMovY);
196 * @brief Update marks for a selected Range. This is a helper function
197 * for PaintRangeFinder.
199 * @param pData: Range to update for painting.
200 * @param nTab: Current tab.
204 void PaintRangeFinderEntry (ScRangeFindData* pData, SCTAB nTab);
206 protected:
207 void UpdateHeaderWidth( const ScVSplitPos* pWhich = NULL,
208 const SCROW* pPosY = NULL );
210 void HideTip();
211 void ShowRefTip();
213 void ZoomChanged();
214 void UpdateShow();
215 bool UpdateVisibleRange();
216 void GetBorderSize( SvBorder& rBorder, const Size& rSize );
218 void ResetDrawDragMode();
219 bool IsDrawTextEdit() const;
220 void DrawEnableAnim(bool bSet);
222 void MakeDrawView( TriState nForceDesignMode = TRISTATE_INDET );
224 void HideNoteMarker();
226 void UpdateIMap( SdrObject* pObj );
228 public:
229 ScTabView( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell );
230 ~ScTabView();
232 void MakeDrawLayer();
234 void HideListBox();
236 bool HasHintWindow() const;
237 void RemoveHintWindow();
238 void TestHintWindow();
240 DECL_LINK( TabBarResize, void* );
241 /** Sets an absolute tab bar width (in pixels). */
242 void SetTabBarWidth( long nNewWidth );
243 /** Sets a relative tab bar width.
244 @param fRelTabBarWidth Tab bar width relative to frame window width (0.0 ... 1.0). */
245 SC_DLLPUBLIC void SetRelTabBarWidth( double fRelTabBarWidth );
246 /** Sets a relative tab bar width. Tab bar is resized again in next DoResize().
247 @param fRelTabBarWidth Tab bar width relative to frame window width (0.0 ... 1.0). */
248 void SetPendingRelTabBarWidth( double fRelTabBarWidth );
249 /** Returns the current tab bar width in pixels. */
250 long GetTabBarWidth() const;
251 /** Returns the current tab bar width relative to the frame window width (0.0 ... 1.0). */
252 SC_DLLPUBLIC double GetRelTabBarWidth() const;
253 /** Returns the pending tab bar width relative to the frame window width (0.0 ... 1.0). */
254 double GetPendingRelTabBarWidth() const { return mfPendingTabBarWidth;}
256 void DoResize( const Point& rOffset, const Size& rSize, bool bInner = false );
257 void RepeatResize( bool bUpdateFix = true );
258 void UpdateFixPos();
259 Point GetGridOffset() const;
261 bool IsDrawSelMode() const { return bDrawSelMode; }
262 void SetDrawSelMode(bool bNew) { bDrawSelMode = bNew; }
264 void SetDrawFuncPtr(FuPoor* pFuncPtr) { pDrawActual = pFuncPtr; }
265 void SetDrawFuncOldPtr(FuPoor* pFuncPtr) { pDrawOld = pFuncPtr; }
266 FuPoor* GetDrawFuncPtr() { return pDrawActual; }
267 FuPoor* GetDrawFuncOldPtr() { return pDrawOld; }
269 void DrawDeselectAll();
270 void DrawMarkListHasChanged();
271 void UpdateAnchorHandles();
273 ScPageBreakData* GetPageBreakData() { return pPageBreakData; }
274 const std::vector<ScHighlightEntry>& GetHighlightRanges() { return maHighlightRanges; }
276 void UpdatePageBreakData( bool bForcePaint = false );
278 ScViewData& GetViewData() { return aViewData; }
279 const ScViewData& GetViewData() const { return aViewData; }
281 ScViewFunctionSet& GetFunctionSet() { return aFunctionSet; }
282 ScViewSelectionEngine* GetSelEngine() { return pSelEngine; }
284 bool SelMouseButtonDown( const MouseEvent& rMEvt );
286 ScDrawView* GetScDrawView() { return pDrawView; }
287 // gegen CLOKs
288 SdrView* GetSdrView() { return pDrawView; }
290 bool IsMinimized() const { return bMinimized; }
293 * Called after moving, copying, inserting or deleting a sheet.
295 * @param bSameTabButMoved true if the same sheet as before is activated.
297 void TabChanged( bool bSameTabButMoved = false );
298 void SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll );
299 SC_DLLPUBLIC void RefreshZoom();
300 void SetPagebreakMode( bool bSet );
302 void UpdateLayerLocks();
304 void UpdateDrawTextOutliner();
305 void DigitLanguageChanged();
307 static void UpdateInputLine();
309 void InitRefMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScRefType eType,
310 bool bPaint = true );
311 void DoneRefMode( bool bContinue = false );
312 void UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ );
313 void StopRefMode();
315 void StopMarking();
316 void FakeButtonUp( ScSplitPos eWhich );
318 ScGridWindow* GetActiveWin();
319 vcl::Window* GetWindowByPos( ScSplitPos ePos ) { return pGridWin[ePos]; }
321 ScSplitPos FindWindow( vcl::Window* pWindow ) const;
323 void SetActivePointer( const Pointer& rPointer );
325 void ActiveGrabFocus();
327 void ClickCursor( SCCOL nPosX, SCROW nPosY, bool bControl );
329 SC_DLLPUBLIC void SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew = false );
331 SC_DLLPUBLIC void CellContentChanged();
332 void SelectionChanged();
333 void CursorPosChanged();
334 void UpdateInputContext();
336 void CheckSelectionTransfer();
338 void InvertHorizontal( ScVSplitPos eWhich, long nDragPos );
339 void InvertVertical( ScHSplitPos eWhich, long nDragPos );
341 Point GetInsertPos();
343 Point GetChartInsertPos( const Size& rSize, const ScRange& rCellRange );
344 Point GetChartDialogPos( const Size& rDialogSize, const Rectangle& rLogicChart );
346 void UpdateAutoFillMark();
348 void ShowCursor();
349 void HideAllCursors();
350 void ShowAllCursors();
352 void AlignToCursor( SCsCOL nCurX, SCsROW nCurY, ScFollowMode eMode,
353 const ScSplitPos* pWhich = NULL );
355 SvxZoomType GetZoomType() const;
356 void SetZoomType( SvxZoomType eNew, bool bAll );
357 sal_uInt16 CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom );
359 bool HasPageFieldDataAtCursor() const;
360 void StartDataSelect();
362 // MoveCursorAbs - absolute
363 // MoveCursorRel - single cells
364 // MoveCursorPage - screen
365 // MoveCursorArea - Data block
366 // MoveCursorEnd - top left / user range
368 SC_DLLPUBLIC void MoveCursorAbs( SCsCOL nCurX, SCsROW nCurY, ScFollowMode eMode,
369 bool bShift, bool bControl,
370 bool bKeepOld = false, bool bKeepSel = false );
371 void MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
372 bool bShift, bool bKeepSel = false );
373 void MoveCursorPage( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
374 bool bShift, bool bKeepSel = false );
375 void MoveCursorArea( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
376 bool bShift, bool bKeepSel = false );
377 void MoveCursorEnd( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
378 bool bShift, bool bKeepSel = false );
379 void MoveCursorScreen( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode, bool bShift );
381 void MoveCursorEnter( bool bShift ); // Shift for direction (select nothing)
383 bool MoveCursorKeyInput( const KeyEvent& rKeyEvent );
385 void FindNextUnprot( bool bShift, bool bInSelection = true );
387 SC_DLLPUBLIC void SetTabNo( SCTAB nTab, bool bNew = false, bool bExtendSelection = false, bool bSameTabButMoved = false );
388 void SelectNextTab( short nDir, bool bExtendSelection = false );
390 void ActivateView( bool bActivate, bool bFirst );
391 void ActivatePart( ScSplitPos eWhich );
392 bool IsInActivatePart() const { return bInActivatePart; }
394 void SetTimer( ScGridWindow* pWin, const MouseEvent& rMEvt );
395 void ResetTimer();
397 void ScrollX( long nDeltaX, ScHSplitPos eWhich, bool bUpdBars = true );
398 void ScrollY( long nDeltaY, ScVSplitPos eWhich, bool bUpdBars = true );
399 SC_DLLPUBLIC void ScrollLines( long nDeltaX, long nDeltaY ); // active
401 bool ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos );
403 void ScrollToObject( SdrObject* pDrawObj );
404 void MakeVisible( const Rectangle& rHMMRect );
406 // Zeichnen
408 void PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
409 ScUpdateMode eMode = SC_UPDATE_ALL );
411 void PaintGrid();
413 void PaintTopArea( SCCOL nStartCol, SCCOL nEndCol );
414 void PaintTop();
416 void PaintLeftArea( SCROW nStartRow, SCROW nEndRow );
417 void PaintLeft();
419 bool PaintExtras();
421 void RecalcPPT();
423 void CreateAnchorHandles(SdrHdlList& rHdl, const ScAddress& rAddress);
425 void UpdateCopySourceOverlay();
426 void UpdateSelectionOverlay();
427 void UpdateShrinkOverlay();
428 void UpdateAllOverlays();
430 void UpdateFormulas();
431 void InterpretVisible();
432 void CheckNeedsRepaint();
433 bool NeedsRepaint();
435 void PaintRangeFinder( long nNumber = -1 );
436 void AddHighlightRange( const ScRange& rRange, const Color& rColor );
437 void ClearHighlightRanges();
439 void DoChartSelection( const ::com::sun::star::uno::Sequence<
440 ::com::sun::star::chart2::data::HighlightedRange > & rHilightRanges );
442 long GetGridWidth( ScHSplitPos eWhich );
443 long GetGridHeight( ScVSplitPos eWhich );
445 void UpdateScrollBars();
446 void SetNewVisArea();
448 void InvalidateAttribs();
450 void MakeEditView( ScEditEngineDefaulter* pEngine, SCCOL nCol, SCROW nRow );
451 void KillEditView( bool bNoPaint );
452 void UpdateEditView();
454 // Blocks
456 void SelectAll( bool bContinue = false );
457 void SelectAllTables();
458 void DeselectAllTables();
460 void MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
461 bool bCols = false, bool bRows = false, bool bCellSelection = false );
462 void InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
463 bool bTestNeg = false,
464 bool bCols = false, bool bRows = false, bool bForceNeg = false );
465 void InitOwnBlockMode();
466 void DoneBlockMode( bool bContinue = false );
468 bool IsBlockMode() const;
470 void ExpandBlock(SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode);
471 void ExpandBlockPage(SCsCOL nMovX, SCsROW nMovY);
472 void ExpandBlockArea(SCsCOL nMovX, SCsROW nMovY);
474 void MarkColumns();
475 void MarkRows();
476 void MarkDataArea( bool bIncludeCursor = true );
477 void MarkMatrixFormula();
478 void Unmark();
480 void MarkRange( const ScRange& rRange, bool bSetCursor = true, bool bContinue = false );
482 bool IsMarking( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
484 void PaintMarks( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
485 void PaintBlock( bool bReset = false );
487 void SetMarkData( const ScMarkData& rNew );
488 void MarkDataChanged();
490 void LockModifiers( sal_uInt16 nModifiers );
491 sal_uInt16 GetLockedModifiers() const;
492 void ViewOptionsHasChanged( bool bHScrollChanged,
493 bool bGraphicsChanged = false);
495 Point GetMousePosPixel();
497 void FreezeSplitters( bool bFreeze );
498 void RemoveSplit();
499 void SplitAtCursor();
500 void SplitAtPixel( const Point& rPixel, bool bHor, bool bVer );
501 void InvalidateSplit();
503 void ErrorMessage( sal_uInt16 nGlobStrId );
505 void EnableRefInput(bool bFlag = true);
507 vcl::Window* GetFrameWin() const { return pFrameWin; }
509 bool HasPaintBrush() const { return pBrushDocument || pDrawBrushSet; }
510 ScDocument* GetBrushDocument() const { return pBrushDocument; }
511 SfxItemSet* GetDrawBrushSet() const { return pDrawBrushSet; }
512 bool IsPaintBrushLocked() const { return bLockPaintBrush; }
513 void SetBrushDocument( ScDocument* pNew, bool bLock );
514 void SetDrawBrushSet( SfxItemSet* pNew, bool bLock );
515 void ResetBrushDocument();
517 void SetInRefMode( bool bRefMode );
519 bool ContinueOnlineSpelling();
520 void EnableAutoSpell( bool bEnable );
521 void ResetAutoSpell();
522 void SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges );
525 #endif
527 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */