Update ooo320-m1
[ooovba.git] / sc / source / ui / inc / tabview.hxx
blob5b218a9e6cea7057aa4628cb98f9948c3b0fd9a6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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)
38 //REMOVE #endif
40 #include <sfx2/ipclient.hxx>
42 #include "viewutil.hxx"
43 #include "select.hxx"
45 class ScEditEngineDefaulter;
46 class ScGridWindow;
47 class ScOutlineWindow;
48 class ScRowBar;
49 class ScColBar;
50 class ScTabControl;
51 class ScTabViewShell;
52 class SfxPrinter;
53 class ScDrawView;
54 class SvBorder;
55 class FuPoor;
56 class Splitter;
57 class ScTabSplitter;
58 class SdrView;
59 class SdrObject;
60 class ScHintWindow;
61 class ScPageBreakData;
62 class ScHighlightRanges;
63 struct ChartSelectionInfo;
64 class SdrHdlList;
66 namespace com { namespace sun { namespace star {
67 namespace chart2 { namespace data {
68 struct HighlightedRange;
69 }}}}}
71 #define SPLIT_HANDLE_SIZE 3
72 #define SC_FORCEMODE_NONE 0xff
74 // ---------------------------------------------------------------------------
75 // Hilfs - Fenster
77 class ScCornerButton : public Window
79 private:
80 ScViewData* pViewData;
81 BOOL bAdd;
83 protected:
84 virtual void Paint( const Rectangle& rRect );
85 virtual void Resize();
86 virtual void MouseButtonDown( const MouseEvent& rMEvt );
87 public:
88 ScCornerButton( Window* pParent, ScViewData* pData, BOOL bAdditional );
89 ~ScCornerButton();
91 virtual void StateChanged( StateChangedType nType );
92 virtual void DataChanged( const DataChangedEvent& rDCEvt );
96 // ---------------------------------------------------------------------------
98 class ScTabView
100 private:
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
115 Point aBorderPos;
117 BOOL bDrawSelMode; // nur Zeichenobjekte selektieren ?
119 FuPoor* pDrawActual;
120 FuPoor* pDrawOld;
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?
147 Timer aScrollTimer;
148 ScGridWindow* pTimerWindow;
149 MouseEvent aTimerMEvt;
151 ULONG nTipVisible;
153 BOOL bDragging; // fuer Scrollbars
154 long nPrevDragPos;
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?
161 SCCOL nBlockStartX;
162 SCCOL nBlockStartXOrig;
163 SCCOL nBlockEndX;
165 SCROW nBlockStartY;
166 SCROW nBlockStartYOrig;
167 SCROW nBlockEndY;
169 SCTAB nBlockStartZ;
170 SCTAB nBlockEndZ;
172 SCCOL nOldCurX;
173 SCROW nOldCurY;
175 double mfPendingTabBarWidth; // Tab bar width relative to frame window width.
177 BOOL bMinimized;
178 BOOL bInUpdateHeader;
179 BOOL bInActivatePart;
180 BOOL bInZoomUpdate;
181 BOOL bMoveIsShift;
183 void Init();
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);
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 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 );
228 public:
229 ScTabView( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell );
230 //UNUSED2009-05 ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell );
231 ~ScTabView();
233 void MakeDrawLayer();
235 void HideListBox();
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 );
260 void UpdateFixPos();
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; }
296 void TabChanged();
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 );
312 void StopRefMode();
314 //UNUSED2008-05 void EndSelection();
315 void StopMarking();
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
353 void ShowCursor();
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 );
402 void ResetTimer();
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 );
413 // Zeichnen
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 );
427 void PaintGrid();
429 void PaintTopArea( SCCOL nStartCol, SCCOL nEndCol );
430 void PaintTop();
432 void PaintLeftArea( SCROW nStartRow, SCROW nEndRow );
433 void PaintLeft();
435 BOOL PaintExtras();
437 void RecalcPPT();
439 void CreateAnchorHandles(SdrHdlList& rHdl, const ScAddress& rAddress);
441 void UpdateCopySourceOverlay();
442 void UpdateSelectionOverlay();
443 void UpdateShrinkOverlay();
444 void UpdateAllOverlays();
446 void UpdateFormulas();
447 void InterpretVisible();
448 void CheckNeedsRepaint();
450 void PaintRangeFinder( long nNumber = -1 );
451 void AddHighlightRange( const ScRange& rRange, const Color& rColor );
452 void ClearHighlightRanges();
454 void DoChartSelection( const ::com::sun::star::uno::Sequence<
455 ::com::sun::star::chart2::data::HighlightedRange > & rHilightRanges );
457 long GetGridWidth( ScHSplitPos eWhich );
458 long GetGridHeight( ScVSplitPos eWhich );
460 void UpdateScrollBars();
461 void SetNewVisArea();
463 void InvalidateAttribs();
465 void MakeEditView( ScEditEngineDefaulter* pEngine, SCCOL nCol, SCROW nRow );
466 void KillEditView( BOOL bNoPaint );
467 void UpdateEditView();
470 // Bloecke
472 void SelectAll( BOOL bContinue = FALSE );
473 void SelectAllTables();
474 void DeselectAllTables();
476 void MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
477 BOOL bCols = FALSE, BOOL bRows = FALSE, BOOL bCellSelection = FALSE );
478 void InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
479 BOOL bTestNeg = FALSE,
480 BOOL bCols = FALSE, BOOL bRows = FALSE );
481 void InitOwnBlockMode();
482 void DoneBlockMode( BOOL bContinue = FALSE );
484 BOOL IsBlockMode() const { return bIsBlockMode; }
486 void ExpandBlock(SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode);
487 void ExpandBlockPage(SCsCOL nMovX, SCsROW nMovY);
488 void ExpandBlockArea(SCsCOL nMovX, SCsROW nMovY);
490 void MarkColumns();
491 void MarkRows();
492 void MarkDataArea( BOOL bIncludeCursor = TRUE );
493 void MarkMatrixFormula();
494 void Unmark();
496 void MarkRange( const ScRange& rRange, BOOL bSetCursor = TRUE, BOOL bContinue = FALSE );
498 BOOL IsMarking( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
500 void PaintMarks( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
501 void PaintBlock( BOOL bReset = FALSE );
503 void SetMarkData( const ScMarkData& rNew );
504 void MarkDataChanged();
506 void LockModifiers( USHORT nModifiers );
507 USHORT GetLockedModifiers() const;
508 void ViewOptionsHasChanged( BOOL bHScrollChanged,
509 BOOL bGraphicsChanged = FALSE);
511 Point GetMousePosPixel();
513 void SnapSplitPos( Point& rScreenPosPixel );
514 void FreezeSplitters( BOOL bFreeze );
515 void RemoveSplit();
516 void SplitAtCursor();
517 void SplitAtPixel( const Point& rPixel, BOOL bHor, BOOL bVer );
518 void InvalidateSplit();
520 void ErrorMessage( USHORT nGlobStrId );
521 Window* GetParentOrChild( USHORT nChildId );
523 void EnableRefInput(BOOL bFlag=TRUE);
525 Window* GetFrameWin() const { return pFrameWin; }
527 BOOL HasPaintBrush() const { return pBrushDocument || pDrawBrushSet; }
528 ScDocument* GetBrushDocument() const { return pBrushDocument; }
529 SfxItemSet* GetDrawBrushSet() const { return pDrawBrushSet; }
530 BOOL IsPaintBrushLocked() const { return bLockPaintBrush; }
531 void SetBrushDocument( ScDocument* pNew, BOOL bLock );
532 void SetDrawBrushSet( SfxItemSet* pNew, BOOL bLock );
533 void ResetBrushDocument();
538 #endif