Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / viewdata.hxx
blobca90f3e8265031c66d0d2c898beb7c8449564a4a
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 SC_VIEWDATA_HXX
20 #define SC_VIEWDATA_HXX
22 #include <sfx2/zoomitem.hxx>
23 #include "scdllapi.h"
24 #include "viewopti.hxx"
26 #include <boost/scoped_ptr.hpp>
28 // ---------------------------------------------------------------------------
30 #define SC_SMALL3DSHADOW COL_BLACK
31 #define SC_SIZE_NONE 65535
32 const SCCOL SC_TABSTART_NONE = SCCOL_MAX;
34 #define SC_FILL_NONE 0
35 #define SC_FILL_FILL 1
36 #define SC_FILL_EMBED_LT 2
37 #define SC_FILL_EMBED_RB 3
38 #define SC_FILL_MATRIX 4
40 enum ScSplitMode { SC_SPLIT_NONE = 0, SC_SPLIT_NORMAL, SC_SPLIT_FIX };
42 enum ScSplitPos { SC_SPLIT_TOPLEFT, SC_SPLIT_TOPRIGHT, SC_SPLIT_BOTTOMLEFT, SC_SPLIT_BOTTOMRIGHT };
43 enum ScHSplitPos { SC_SPLIT_LEFT, SC_SPLIT_RIGHT };
44 enum ScVSplitPos { SC_SPLIT_TOP, SC_SPLIT_BOTTOM };
46 inline ScHSplitPos WhichH( ScSplitPos ePos );
47 inline ScVSplitPos WhichV( ScSplitPos ePos );
48 inline ScSplitPos Which( ScHSplitPos eHPos );
49 inline ScSplitPos Which( ScVSplitPos eVPos );
51 /** Screen behavior related to cursor movements */
52 enum ScFollowMode { SC_FOLLOW_NONE, SC_FOLLOW_LINE, SC_FOLLOW_FIX, SC_FOLLOW_JUMP };
54 /** Mouse mode to select areas */
55 enum ScRefType { SC_REFTYPE_NONE, SC_REFTYPE_REF, SC_REFTYPE_FILL,
56 SC_REFTYPE_EMBED_LT, SC_REFTYPE_EMBED_RB };
58 /** States GetSimpleArea() returns for the underlying selection marks, so the
59 caller can react if the result is not of type SC_MARK_SIMPLE. */
60 enum ScMarkType
62 SC_MARK_NONE = 0, // Not returned by GetSimpleArea(), used internally.
63 // Nothing marked always results in the
64 // current cursor position being selected and a simple mark.
65 SC_MARK_SIMPLE = 1, // Simple rectangular area marked, no filtered rows.
66 SC_MARK_FILTERED = 2, // At least one mark contains filtered rows.
67 SC_MARK_SIMPLE_FILTERED = // Simple rectangular area marked containing filtered rows.
68 SC_MARK_SIMPLE |
69 SC_MARK_FILTERED, // 3
70 SC_MARK_MULTI = 4 // Multiple selection marks.
71 /* TODO: if filtered multi-selection was implemented, this would be the value to use. */
72 #if 0
74 SC_MARK_MULTI_FILTERED = // Multiple selection marks containing filtered rows.
75 SC_MARK_MULTI |
76 SC_MARK_FILTERED // 6
77 #endif
80 enum ScPasteFlags
82 SC_PASTE_NONE = 0, // No flags specified
83 SC_PASTE_MODE = 1, // Enable paste-mode
84 SC_PASTE_BORDER = 2, // Show a border around the source cells
87 class ScDocFunc;
88 class ScDocShell;
89 class ScDocument;
90 class ScDBFunc;
91 class ScTabViewShell;
92 class ScDrawView;
93 class ScEditEngineDefaulter;
94 class EditView;
95 class EditStatus;
96 class Outliner;
97 class Window;
98 class SfxObjectShell;
99 class SfxBindings;
100 class SfxDispatcher;
101 class ScPatternAttr;
102 class ScRangeListRef;
103 class ScExtDocOptions;
104 class ScViewData;
105 class ScMarkData;
107 //--------------------------------------------------------------------------
109 class ScViewDataTable // per-sheet data
111 friend class ScViewData;
112 private:
113 SvxZoomType eZoomType; // selected zoom type (normal view)
114 Fraction aZoomX; // selected zoom X
115 Fraction aZoomY; // selected zoom Y (displayed)
116 Fraction aPageZoomX; // zoom in page break preview mode
117 Fraction aPageZoomY;
119 long nTPosX[2]; // MapMode - Offset (Twips)
120 long nTPosY[2];
121 long nMPosX[2]; // MapMode - Offset (1/100 mm)
122 long nMPosY[2];
123 long nPixPosX[2]; // Offset in Pixels
124 long nPixPosY[2];
125 long nHSplitPos;
126 long nVSplitPos;
128 ScSplitMode eHSplitMode;
129 ScSplitMode eVSplitMode;
130 ScSplitPos eWhichActive;
132 SCCOL nFixPosX; // Cell position of the splitter when freeze pane
133 SCROW nFixPosY;
135 SCCOL nCurX;
136 SCROW nCurY;
137 SCCOL nOldCurX;
138 SCROW nOldCurY;
139 SCCOL nPosX[2];
140 SCROW nPosY[2];
142 bool bShowGrid; // per sheet show grid lines option.
143 bool mbOldCursorValid; // "virtual" Cursor position when combined
144 ScViewDataTable();
146 void WriteUserDataSequence(
147 com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings,
148 const ScViewData& rViewData, SCTAB nTab ) const;
150 void ReadUserDataSequence(
151 const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings,
152 ScViewData& rViewData, SCTAB nTab, bool& rHasZoom);
153 public:
154 ~ScViewDataTable();
157 // ---------------------------------------------------------------------------
159 class SC_DLLPUBLIC ScViewData
161 private:
162 double nPPTX, nPPTY; // Scaling factors
164 ::std::vector<ScViewDataTable*> maTabData;
165 boost::scoped_ptr<ScMarkData> mpMarkData;
166 ScViewDataTable* pThisTab; // Data of the displayed sheet
167 ScDocShell* pDocShell;
168 ScDocument* pDoc;
169 ScDBFunc* pView;
170 ScTabViewShell* pViewShell;
171 EditView* pEditView[4]; // Belongs to the window
172 ScViewOptions* pOptions;
173 EditView* pSpellingView;
175 Size aScenButSize;
177 Size aScrSize;
178 MapMode aLogicMode; // skalierter 1/100mm-MapMode
180 SvxZoomType eDefZoomType; // default zoom and type for missing TabData
181 Fraction aDefZoomX;
182 Fraction aDefZoomY;
183 Fraction aDefPageZoomX; // zoom in page break preview mode
184 Fraction aDefPageZoomY;
186 ScRefType eRefType;
188 SCTAB nTabNo; // displayed sheet
189 SCTAB nRefTabNo; // sheet which contains RefInput
190 SCCOL nRefStartX;
191 SCROW nRefStartY;
192 SCTAB nRefStartZ;
193 SCCOL nRefEndX;
194 SCROW nRefEndY;
195 SCTAB nRefEndZ;
196 SCCOL nFillStartX; // Fill Cursor
197 SCROW nFillStartY;
198 SCCOL nFillEndX;
199 SCROW nFillEndY;
200 SCCOL nEditCol; // Related position
201 SCROW nEditRow;
202 SCCOL nEditStartCol;
203 SCCOL nEditEndCol; // End of Edit View
204 SCROW nEditEndRow;
205 SCCOL nTabStartCol; // for Enter after Tab
206 ScRange aDelRange; // for delete AutoFill
208 ScPasteFlags nPasteFlags;
210 ScSplitPos eEditActivePart; // the part that was active when edit mode was started
211 sal_uInt8 nFillMode;
212 bool bEditActive[4]; // Active?
213 bool bActive:1; // Active Window ?
214 bool bIsRefMode:1; // Reference input
215 bool bDelMarkValid:1; // Only valid at SC_REFTYPE_FILL
216 bool bPagebreak:1; // Page break preview mode
217 bool bSelCtrlMouseClick:1; // special selection handling for ctrl-mouse-click
219 SC_DLLPRIVATE DECL_LINK (EmptyEditHdl, void*);
220 SC_DLLPRIVATE DECL_LINK (EditEngineHdl, EditStatus*);
222 SC_DLLPRIVATE void CalcPPT();
223 SC_DLLPRIVATE void CreateTabData( SCTAB nNewTab );
224 SC_DLLPRIVATE void CreateTabData( std::vector< SCTAB >& rvTabs );
225 SC_DLLPRIVATE void CreateSelectedTabData();
226 SC_DLLPRIVATE void EnsureTabDataSize(size_t nSize);
227 SC_DLLPRIVATE void UpdateCurrentTab();
229 public:
230 ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh );
231 ScViewData( const ScViewData& rViewData );
232 ~ScViewData();
234 void InitData( ScDocument* pDocument );
236 ScDocShell* GetDocShell() const { return pDocShell; }
237 ScDocFunc& GetDocFunc() const;
238 ScDBFunc* GetView() const { return pView; }
239 ScTabViewShell* GetViewShell() const { return pViewShell; }
241 SfxObjectShell* GetSfxDocShell() const;
242 SfxBindings& GetBindings(); // from ViewShell's ViewFrame
243 SfxDispatcher& GetDispatcher(); // from ViewShell's ViewFrame
245 ScMarkData& GetMarkData();
246 const ScMarkData& GetMarkData() const;
248 Window* GetDialogParent(); // forwarded from tabvwsh
249 Window* GetActiveWin(); // from View
250 ScDrawView* GetScDrawView(); // from View
251 sal_Bool IsMinimized(); // from View
253 void UpdateInputHandler( sal_Bool bForce = false, sal_Bool bStopEditing = sal_True );
255 void WriteUserData(OUString& rData);
256 void ReadUserData(const OUString& rData);
257 void WriteExtOptions( ScExtDocOptions& rOpt ) const;
258 void ReadExtOptions( const ScExtDocOptions& rOpt );
259 void WriteUserDataSequence(com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings) const;
260 void ReadUserDataSequence(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings);
262 ScDocument* GetDocument() const;
264 bool IsActive() const { return bActive; }
265 void Activate(bool bActivate) { bActive = bActivate; }
267 void InsertTab( SCTAB nTab );
268 void InsertTabs( SCTAB nTab, SCTAB nNewSheets );
269 void DeleteTab( SCTAB nTab );
270 void DeleteTabs( SCTAB nTab, SCTAB nSheets );
271 void CopyTab( SCTAB nSrcTab, SCTAB nDestTab );
272 void MoveTab( SCTAB nSrcTab, SCTAB nDestTab );
274 SCTAB GetRefTabNo() const { return nRefTabNo; }
275 void SetRefTabNo( SCTAB nNewTab ) { nRefTabNo = nNewTab; }
277 SCTAB GetTabNo() const { return nTabNo; }
278 ScSplitPos GetActivePart() const { return pThisTab->eWhichActive; }
279 SCCOL GetPosX( ScHSplitPos eWhich ) const { return pThisTab->nPosX[eWhich]; }
280 SCROW GetPosY( ScVSplitPos eWhich ) const { return pThisTab->nPosY[eWhich]; }
281 SCCOL GetCurX() const { return pThisTab->nCurX; }
282 SCROW GetCurY() const { return pThisTab->nCurY; }
283 bool HasOldCursor() const { return pThisTab->mbOldCursorValid; }
284 SCCOL GetOldCurX() const;
285 SCROW GetOldCurY() const;
286 ScSplitMode GetHSplitMode() const { return pThisTab->eHSplitMode; }
287 ScSplitMode GetVSplitMode() const { return pThisTab->eVSplitMode; }
288 long GetHSplitPos() const { return pThisTab->nHSplitPos; }
289 long GetVSplitPos() const { return pThisTab->nVSplitPos; }
290 SCCOL GetFixPosX() const { return pThisTab->nFixPosX; }
291 SCROW GetFixPosY() const { return pThisTab->nFixPosY; }
292 bool IsPagebreakMode() const { return bPagebreak; }
293 bool IsPasteMode() const { return nPasteFlags & SC_PASTE_MODE; }
294 bool ShowPasteSource() const { return nPasteFlags & SC_PASTE_BORDER; }
296 void SetPosX( ScHSplitPos eWhich, SCCOL nNewPosX );
297 void SetPosY( ScVSplitPos eWhich, SCROW nNewPosY );
298 void SetCurX( SCCOL nNewCurX ) { pThisTab->nCurX = nNewCurX; }
299 void SetCurY( SCROW nNewCurY ) { pThisTab->nCurY = nNewCurY; }
300 void SetOldCursor( SCCOL nNewX, SCROW nNewY );
301 void ResetOldCursor();
302 void SetHSplitMode( ScSplitMode eMode ) { pThisTab->eHSplitMode = eMode; }
303 void SetVSplitMode( ScSplitMode eMode ) { pThisTab->eVSplitMode = eMode; }
304 void SetHSplitPos( long nPos ) { pThisTab->nHSplitPos = nPos; }
305 void SetVSplitPos( long nPos ) { pThisTab->nVSplitPos = nPos; }
306 void SetFixPosX( SCCOL nPos ) { pThisTab->nFixPosX = nPos; }
307 void SetFixPosY( SCROW nPos ) { pThisTab->nFixPosY = nPos; }
308 void SetPagebreakMode( bool bSet );
309 void SetPasteMode ( ScPasteFlags nFlags ) { nPasteFlags = nFlags; }
311 void SetZoomType( SvxZoomType eNew, sal_Bool bAll );
312 void SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs );
313 void SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs );
314 void SetZoom( const Fraction& rNewX, const Fraction& rNewY, sal_Bool bAll );
315 void RefreshZoom();
317 void SetSelCtrlMouseClick( bool bTmp ) { bSelCtrlMouseClick = bTmp; }
319 SvxZoomType GetZoomType() const { return pThisTab->eZoomType; }
320 const Fraction& GetZoomX() const { return bPagebreak ? pThisTab->aPageZoomX : pThisTab->aZoomX; }
321 const Fraction& GetZoomY() const { return bPagebreak ? pThisTab->aPageZoomY : pThisTab->aZoomY; }
323 void SetShowGrid( bool bShow );
324 bool GetShowGrid() const { return pThisTab->bShowGrid; }
326 const MapMode& GetLogicMode( ScSplitPos eWhich );
327 const MapMode& GetLogicMode(); // Offset 0
329 long GetTPosX( ScHSplitPos eWhich ) const { return pThisTab->nTPosX[eWhich]; }
330 long GetTPosY( ScVSplitPos eWhich ) const { return pThisTab->nTPosY[eWhich]; }
332 double GetPPTX() const { return nPPTX; }
333 double GetPPTY() const { return nPPTY; }
335 ScMarkType GetSimpleArea( SCCOL& rStartCol, SCROW& rStartRow, SCTAB& rStartTab,
336 SCCOL& rEndCol, SCROW& rEndRow, SCTAB& rEndTab ) const;
337 ScMarkType GetSimpleArea( ScRange& rRange ) const;
338 /// May modify rNewMark using MarkToSimple().
339 ScMarkType GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) const;
340 void GetMultiArea( ScRangeListRef& rRange ) const;
342 sal_Bool SimpleColMarked();
343 sal_Bool SimpleRowMarked();
345 sal_Bool IsMultiMarked();
347 void SetFillMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
348 void SetDragMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
349 sal_uInt8 nMode );
350 void GetFillData( SCCOL& rStartCol, SCROW& rStartRow,
351 SCCOL& rEndCol, SCROW& rEndRow );
352 void ResetFillMode();
353 sal_Bool IsAnyFillMode() { return nFillMode != SC_FILL_NONE; }
354 sal_Bool IsFillMode() { return nFillMode == SC_FILL_FILL; }
355 sal_uInt8 GetFillMode() { return nFillMode; }
357 // TRUE: Cell is merged
358 bool GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix ) const;
359 sal_Bool GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
360 SCsCOL& rPosX, SCsROW& rPosY,
361 sal_Bool bTestMerge = sal_True, sal_Bool bRepair = false,
362 sal_Bool bNextIfLarge = sal_True );
363 void GetMouseQuadrant( const Point& rClickPos, ScSplitPos eWhich,
364 SCsCOL nPosX, SCsROW nPosY, sal_Bool& rLeft, sal_Bool& rTop );
366 bool IsRefMode() const { return bIsRefMode; }
367 ScRefType GetRefType() const { return eRefType; }
368 SCCOL GetRefStartX() const { return nRefStartX; }
369 SCROW GetRefStartY() const { return nRefStartY; }
370 SCTAB GetRefStartZ() const { return nRefStartZ; }
371 SCCOL GetRefEndX() const { return nRefEndX; }
372 SCROW GetRefEndY() const { return nRefEndY; }
373 SCTAB GetRefEndZ() const { return nRefEndZ; }
375 void SetRefMode( bool bNewMode, ScRefType eNewType )
376 { bIsRefMode = bNewMode; eRefType = eNewType; }
378 void SetRefStart( SCCOL nNewX, SCROW nNewY, SCTAB nNewZ )
379 { nRefStartX = nNewX; nRefStartY = nNewY; nRefStartZ = nNewZ; }
380 void SetRefEnd( SCCOL nNewX, SCROW nNewY, SCTAB nNewZ )
381 { nRefEndX = nNewX; nRefEndY = nNewY; nRefEndZ = nNewZ; }
383 void ResetDelMark() { bDelMarkValid = false; }
384 void SetDelMark( const ScRange& rRange )
385 { aDelRange = rRange; bDelMarkValid = true; }
387 bool GetDelMark( ScRange& rRange ) const
388 { rRange = aDelRange; return bDelMarkValid; }
390 inline void GetMoveCursor( SCCOL& rCurX, SCROW& rCurY );
392 const ScViewOptions& GetOptions() const { return *pOptions; }
393 void SetOptions( const ScViewOptions& rOpt );
395 sal_Bool IsGridMode () const { return pOptions->GetOption( VOPT_GRID ); }
396 void SetGridMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_GRID, bNewMode ); }
397 sal_Bool IsSyntaxMode () const { return pOptions->GetOption( VOPT_SYNTAX ); }
398 void SetSyntaxMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_SYNTAX, bNewMode ); }
399 sal_Bool IsHeaderMode () const { return pOptions->GetOption( VOPT_HEADER ); }
400 void SetHeaderMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_HEADER, bNewMode ); }
401 sal_Bool IsTabMode () const { return pOptions->GetOption( VOPT_TABCONTROLS ); }
402 void SetTabMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_TABCONTROLS, bNewMode ); }
403 sal_Bool IsVScrollMode () const { return pOptions->GetOption( VOPT_VSCROLL ); }
404 void SetVScrollMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_VSCROLL, bNewMode ); }
405 sal_Bool IsHScrollMode () const { return pOptions->GetOption( VOPT_HSCROLL ); }
406 void SetHScrollMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_HSCROLL, bNewMode ); }
407 sal_Bool IsOutlineMode () const { return pOptions->GetOption( VOPT_OUTLINER ); }
408 void SetOutlineMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_OUTLINER, bNewMode ); }
410 void KillEditView();
411 void ResetEditView();
412 void SetEditEngine( ScSplitPos eWhich,
413 ScEditEngineDefaulter* pNewEngine,
414 Window* pWin, SCCOL nNewX, SCROW nNewY );
415 void GetEditView( ScSplitPos eWhich, EditView*& rViewPtr, SCCOL& rCol, SCROW& rRow );
416 bool HasEditView( ScSplitPos eWhich ) const
417 { return pEditView[eWhich] && bEditActive[eWhich]; }
418 EditView* GetEditView( ScSplitPos eWhich ) const
419 { return pEditView[eWhich]; }
421 void EditGrowX();
422 void EditGrowY( sal_Bool bInitial = false );
424 ScSplitPos GetEditActivePart() const { return eEditActivePart; }
425 SCCOL GetEditViewCol() const { return nEditCol; }
426 SCROW GetEditViewRow() const { return nEditRow; }
427 SCCOL GetEditStartCol() const { return nEditStartCol; }
428 SCROW GetEditStartRow() const { return nEditRow; } // never editing above the cell
429 SCCOL GetEditEndCol() const { return nEditEndCol; }
430 SCROW GetEditEndRow() const { return nEditEndRow; }
432 Rectangle GetEditArea( ScSplitPos eWhich, SCCOL nPosX, SCROW nPosY, Window* pWin,
433 const ScPatternAttr* pPattern, sal_Bool bForceToTop );
435 void SetTabNo( SCTAB nNewTab );
436 void SetActivePart( ScSplitPos eNewActive );
438 Point GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
439 sal_Bool bAllowNeg = false ) const;
440 Point GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScHSplitPos eWhich ) const;
441 Point GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScVSplitPos eWhich ) const;
443 SCCOL CellsAtX( SCsCOL nPosX, SCsCOL nDir, ScHSplitPos eWhichX, sal_uInt16 nScrSizeY = SC_SIZE_NONE ) const;
444 SCROW CellsAtY( SCsROW nPosY, SCsROW nDir, ScVSplitPos eWhichY, sal_uInt16 nScrSizeX = SC_SIZE_NONE ) const;
446 SCCOL VisibleCellsX( ScHSplitPos eWhichX ) const; // Completely visible cell
447 SCROW VisibleCellsY( ScVSplitPos eWhichY ) const;
448 SCCOL PrevCellsX( ScHSplitPos eWhichX ) const; // Cells on the preceding page
449 SCROW PrevCellsY( ScVSplitPos eWhichY ) const;
451 sal_Bool IsOle();
452 void SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
453 void SetScreen( const Rectangle& rVisArea );
454 void SetScreenPos( const Point& rVisAreaStart );
456 void UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY );
458 Size GetScrSize() const { return aScrSize; }
460 void RecalcPixPos();
461 Point GetPixPos( ScSplitPos eWhich ) const
462 { return Point( pThisTab->nPixPosX[WhichH(eWhich)],
463 pThisTab->nPixPosY[WhichV(eWhich)] ); }
464 void SetSpellingView( EditView* pSpView) { pSpellingView = pSpView; }
465 EditView* GetSpellingView() const { return pSpellingView; }
467 void UpdateOutlinerFlags( Outliner& rOutl ) const;
469 Point GetMousePosPixel();
471 sal_Bool UpdateFixX(SCTAB nTab = MAXTAB+1);
472 sal_Bool UpdateFixY(SCTAB nTab = MAXTAB+1);
474 SCCOL GetTabStartCol() const { return nTabStartCol; }
475 void SetTabStartCol(SCCOL nNew) { nTabStartCol = nNew; }
477 ScAddress GetCurPos() const;
479 const Size& GetScenButSize() const { return aScenButSize; }
480 void SetScenButSize(const Size& rNew) { aScenButSize = rNew; }
482 bool IsSelCtrlMouseClick() { return bSelCtrlMouseClick; }
484 static inline long ToPixel( sal_uInt16 nTwips, double nFactor );
486 /** while (rScrY <= nEndPixels && rPosY <= nEndRow) add pixels of row
487 heights converted with nPPTY to rScrY, optimized for row height
488 segments. Upon return rPosY is the last row evaluated <= nEndRow, rScrY
489 may be > nEndPixels!
491 static void AddPixelsWhile( long & rScrY, long nEndPixels,
492 SCROW & rPosY, SCROW nEndRow, double nPPTY,
493 const ScDocument * pDoc, SCTAB nTabNo );
495 /** while (rScrY <= nEndPixels && rPosY >= nStartRow) add pixels of row
496 heights converted with nPPTY to rScrY, optimized for row height
497 segments. Upon return rPosY is the last row evaluated >= nStartRow,
498 rScrY may be > nEndPixels!
500 static void AddPixelsWhileBackward( long & rScrY, long nEndPixels,
501 SCROW & rPosY, SCROW nStartRow, double nPPTY,
502 const ScDocument * pDoc, SCTAB nTabNo );
506 // ---------------------------------------------------------------------------
508 inline long ScViewData::ToPixel( sal_uInt16 nTwips, double nFactor )
510 long nRet = (long)( nTwips * nFactor );
511 if ( !nRet && nTwips )
512 nRet = 1;
513 return nRet;
516 inline void ScViewData::GetMoveCursor( SCCOL& rCurX, SCROW& rCurY )
518 if ( bIsRefMode )
520 rCurX = nRefEndX;
521 rCurY = nRefEndY;
523 else
525 rCurX = GetCurX();
526 rCurY = GetCurY();
530 inline ScHSplitPos WhichH( ScSplitPos ePos )
532 return (ePos==SC_SPLIT_TOPLEFT || ePos==SC_SPLIT_BOTTOMLEFT) ?
533 SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
536 inline ScVSplitPos WhichV( ScSplitPos ePos )
538 return (ePos==SC_SPLIT_TOPLEFT || ePos==SC_SPLIT_TOPRIGHT) ?
539 SC_SPLIT_TOP : SC_SPLIT_BOTTOM;
542 inline ScSplitPos Which( ScHSplitPos eHPos )
544 return (eHPos==SC_SPLIT_LEFT) ?
545 SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
548 inline ScSplitPos Which( ScVSplitPos eVPos )
550 return (eVPos==SC_SPLIT_TOP) ?
551 SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT;
556 #endif
558 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */