Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / source / ui / inc / viewdata.hxx
blob75bcb41cece992295de3ad207d097b927b7869d0
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_VIEWDATA_HXX
20 #define INCLUDED_SC_SOURCE_UI_INC_VIEWDATA_HXX
22 #include <sfx2/zoomitem.hxx>
23 #include "rangelst.hxx"
24 #include "scdllapi.h"
25 #include "viewopti.hxx"
26 #include "docsh.hxx"
28 #include <memory>
30 #define SC_SIZE_NONE 65535
31 const SCCOL SC_TABSTART_NONE = SCCOL_MAX;
33 enum class ScFillMode
35 NONE = 0,
36 FILL = 1,
37 EMBED_LT = 2,
38 EMBED_RB = 3,
39 MATRIX = 4,
42 enum ScSplitMode { SC_SPLIT_NONE = 0, SC_SPLIT_NORMAL, SC_SPLIT_FIX };
44 enum ScSplitPos { SC_SPLIT_TOPLEFT, SC_SPLIT_TOPRIGHT, SC_SPLIT_BOTTOMLEFT, SC_SPLIT_BOTTOMRIGHT };
45 enum ScHSplitPos { SC_SPLIT_LEFT, SC_SPLIT_RIGHT };
46 enum ScVSplitPos { SC_SPLIT_TOP, SC_SPLIT_BOTTOM };
48 inline ScHSplitPos WhichH( ScSplitPos ePos );
49 inline ScVSplitPos WhichV( ScSplitPos ePos );
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 namespace vcl { class Window; }
98 class SfxObjectShell;
99 class SfxBindings;
100 class SfxDispatcher;
101 class ScPatternAttr;
102 class ScExtDocOptions;
103 class ScViewData;
104 class ScMarkData;
105 class ScGridWindow;
107 class ScViewDataTable // per-sheet data
109 friend class ScViewData;
110 private:
111 SvxZoomType eZoomType; // selected zoom type (normal view)
112 Fraction aZoomX; // selected zoom X
113 Fraction aZoomY; // selected zoom Y (displayed)
114 Fraction aPageZoomX; // zoom in page break preview mode
115 Fraction aPageZoomY;
117 long nTPosX[2]; // MapMode - Offset (Twips)
118 long nTPosY[2];
119 long nMPosX[2]; // MapMode - Offset (1/100 mm)
120 long nMPosY[2];
121 long nPixPosX[2]; // Offset in Pixels
122 long nPixPosY[2];
123 long nHSplitPos;
124 long nVSplitPos;
126 ScSplitMode eHSplitMode;
127 ScSplitMode eVSplitMode;
128 ScSplitPos eWhichActive;
130 SCCOL nFixPosX; // Cell position of the splitter when freeze pane
131 SCROW nFixPosY;
133 SCCOL nCurX;
134 SCROW nCurY;
135 SCCOL nOldCurX;
136 SCROW nOldCurY;
137 SCCOL nPosX[2]; ///< X position of the top left cell of the visible area.
138 SCROW nPosY[2]; ///< Y position of the top left cell of the visible area.
139 SCCOL nMaxTiledCol;
140 SCROW nMaxTiledRow;
142 bool bShowGrid; // per sheet show grid lines option.
143 bool mbOldCursorValid; // "virtual" Cursor position when combined
144 ScViewDataTable();
146 void WriteUserDataSequence(
147 css::uno::Sequence <css::beans::PropertyValue>& rSettings,
148 const ScViewData& rViewData, SCTAB nTab ) const;
150 void ReadUserDataSequence(
151 const css::uno::Sequence <css::beans::PropertyValue>& rSettings,
152 ScViewData& rViewData, SCTAB nTab, bool& rHasZoom);
153 public:
154 ~ScViewDataTable();
157 class SC_DLLPUBLIC ScViewData
159 private:
160 double nPPTX, nPPTY; // Scaling factors
162 ::std::vector<ScViewDataTable*> maTabData;
163 std::unique_ptr<ScMarkData> mpMarkData;
164 ScViewDataTable* pThisTab; // Data of the displayed sheet
165 ScDocShell* pDocShell;
166 ScDocument* pDoc;
167 ScDBFunc* pView;
168 ScTabViewShell* pViewShell;
169 EditView* pEditView[4]; // Belongs to the window
170 ScViewOptions* pOptions;
171 EditView* pSpellingView;
173 Size aScenButSize;
175 Size aScrSize;
176 MapMode aLogicMode; // skalierter 1/100mm-MapMode
178 SvxZoomType eDefZoomType; // default zoom and type for missing TabData
179 Fraction aDefZoomX;
180 Fraction aDefZoomY;
181 Fraction aDefPageZoomX; // zoom in page break preview mode
182 Fraction aDefPageZoomY;
184 ScRefType eRefType;
186 SCTAB nTabNo; // displayed sheet
187 SCTAB nRefTabNo; // sheet which contains RefInput
188 SCCOL nRefStartX;
189 SCROW nRefStartY;
190 SCTAB nRefStartZ;
191 SCCOL nRefEndX;
192 SCROW nRefEndY;
193 SCTAB nRefEndZ;
194 SCCOL nFillStartX; // Fill Cursor
195 SCROW nFillStartY;
196 SCCOL nFillEndX;
197 SCROW nFillEndY;
198 SCCOL nEditCol; // Related position
199 SCROW nEditRow;
200 SCCOL nEditStartCol;
201 SCCOL nEditEndCol; // End of Edit View
202 SCROW nEditEndRow;
203 SCCOL nTabStartCol; // for Enter after Tab
204 ScRange aDelRange; // for delete AutoFill
206 ScPasteFlags nPasteFlags;
208 ScSplitPos eEditActivePart; // the part that was active when edit mode was started
209 ScFillMode nFillMode;
210 bool bEditActive[4]; // Active?
211 bool bActive:1; // Active Window ?
212 bool bIsRefMode:1; // Reference input
213 bool bDelMarkValid:1; // Only valid at SC_REFTYPE_FILL
214 bool bPagebreak:1; // Page break preview mode
215 bool bSelCtrlMouseClick:1; // special selection handling for ctrl-mouse-click
217 DECL_DLLPRIVATE_LINK_TYPED( EditEngineHdl, EditStatus&, void );
219 SAL_DLLPRIVATE void CalcPPT();
220 SAL_DLLPRIVATE void CreateTabData( SCTAB nNewTab );
221 SAL_DLLPRIVATE void CreateTabData( std::vector< SCTAB >& rvTabs );
222 SAL_DLLPRIVATE void CreateSelectedTabData();
223 SAL_DLLPRIVATE void EnsureTabDataSize(size_t nSize);
224 SAL_DLLPRIVATE void UpdateCurrentTab();
226 public:
227 ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh );
228 ScViewData( const ScViewData& rViewData );
229 ~ScViewData();
231 void InitData( ScDocument* pDocument );
233 ScDocShell* GetDocShell() const { return pDocShell; }
234 ScDocFunc& GetDocFunc() const;
235 ScDBFunc* GetView() const { return pView; }
236 ScTabViewShell* GetViewShell() const { return pViewShell; }
237 SfxObjectShell* GetSfxDocShell() const { return pDocShell; }
238 SfxBindings& GetBindings(); // from ViewShell's ViewFrame
239 SfxDispatcher& GetDispatcher(); // from ViewShell's ViewFrame
241 ScMarkData& GetMarkData();
242 const ScMarkData& GetMarkData() const;
244 vcl::Window* GetDialogParent(); // forwarded from tabvwsh
245 ScGridWindow* GetActiveWin(); // from View
246 const ScGridWindow* GetActiveWin() const;
247 ScDrawView* GetScDrawView(); // from View
248 bool IsMinimized(); // from View
250 void UpdateInputHandler( bool bForce = false );
252 void WriteUserData(OUString& rData);
253 void ReadUserData(const OUString& rData);
254 void WriteExtOptions( ScExtDocOptions& rOpt ) const;
255 void ReadExtOptions( const ScExtDocOptions& rOpt );
256 void WriteUserDataSequence(css::uno::Sequence <css::beans::PropertyValue>& rSettings) const;
257 void ReadUserDataSequence(const css::uno::Sequence <css::beans::PropertyValue>& rSettings);
259 ScDocument* GetDocument() const;
261 bool IsActive() const { return bActive; }
262 void Activate(bool bActivate) { bActive = bActivate; }
264 void InsertTab( SCTAB nTab );
265 void InsertTabs( SCTAB nTab, SCTAB nNewSheets );
266 void DeleteTab( SCTAB nTab );
267 void DeleteTabs( SCTAB nTab, SCTAB nSheets );
268 void CopyTab( SCTAB nSrcTab, SCTAB nDestTab );
269 void MoveTab( SCTAB nSrcTab, SCTAB nDestTab );
271 SCTAB GetRefTabNo() const { return nRefTabNo; }
272 void SetRefTabNo( SCTAB nNewTab ) { nRefTabNo = nNewTab; }
274 SCTAB GetTabNo() const { return nTabNo; }
275 ScSplitPos GetActivePart() const { return pThisTab->eWhichActive; }
276 SCCOL GetPosX( ScHSplitPos eWhich ) const { return pThisTab->nPosX[eWhich]; }
277 SCROW GetPosY( ScVSplitPos eWhich ) const { return pThisTab->nPosY[eWhich]; }
278 SCCOL GetCurX() const { return pThisTab->nCurX; }
279 SCROW GetCurY() const { return pThisTab->nCurY; }
280 SCCOL GetOldCurX() const;
281 SCROW GetOldCurY() const;
282 ScSplitMode GetHSplitMode() const { return pThisTab->eHSplitMode; }
283 ScSplitMode GetVSplitMode() const { return pThisTab->eVSplitMode; }
284 long GetHSplitPos() const { return pThisTab->nHSplitPos; }
285 long GetVSplitPos() const { return pThisTab->nVSplitPos; }
286 SCCOL GetFixPosX() const { return pThisTab->nFixPosX; }
287 SCROW GetFixPosY() const { return pThisTab->nFixPosY; }
288 SCCOL GetMaxTiledCol() const { return pThisTab->nMaxTiledCol; }
289 SCROW GetMaxTiledRow() const { return pThisTab->nMaxTiledRow; }
291 bool IsPagebreakMode() const { return bPagebreak; }
292 bool IsPasteMode() const { return (nPasteFlags & SC_PASTE_MODE) != 0; }
293 bool ShowPasteSource() const { return (nPasteFlags & SC_PASTE_BORDER) != 0; }
295 void SetPosX( ScHSplitPos eWhich, SCCOL nNewPosX );
296 void SetPosY( ScVSplitPos eWhich, SCROW nNewPosY );
297 void SetCurX( SCCOL nNewCurX ) { pThisTab->nCurX = nNewCurX; }
298 void SetCurY( SCROW nNewCurY ) { pThisTab->nCurY = nNewCurY; }
299 void SetOldCursor( SCCOL nNewX, SCROW nNewY );
300 void ResetOldCursor();
301 void SetHSplitMode( ScSplitMode eMode ) { pThisTab->eHSplitMode = eMode; }
302 void SetVSplitMode( ScSplitMode eMode ) { pThisTab->eVSplitMode = eMode; }
303 void SetHSplitPos( long nPos ) { pThisTab->nHSplitPos = nPos; }
304 void SetVSplitPos( long nPos ) { pThisTab->nVSplitPos = nPos; }
305 void SetFixPosX( SCCOL nPos ) { pThisTab->nFixPosX = nPos; }
306 void SetFixPosY( SCROW nPos ) { pThisTab->nFixPosY = nPos; }
307 void SetMaxTiledCol( SCCOL nCol ) { pThisTab->nMaxTiledCol = nCol; }
308 void SetMaxTiledRow( SCROW nRow ) { pThisTab->nMaxTiledRow = nRow; }
310 void SetPagebreakMode( bool bSet );
311 void SetPasteMode ( ScPasteFlags nFlags ) { nPasteFlags = nFlags; }
313 void SetZoomType( SvxZoomType eNew, bool bAll );
314 void SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs );
315 void SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs );
316 void SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll );
317 void RefreshZoom();
319 void SetSelCtrlMouseClick( bool bTmp ) { bSelCtrlMouseClick = bTmp; }
321 SvxZoomType GetZoomType() const { return pThisTab->eZoomType; }
322 const Fraction& GetZoomX() const { return bPagebreak ? pThisTab->aPageZoomX : pThisTab->aZoomX; }
323 const Fraction& GetZoomY() const { return bPagebreak ? pThisTab->aPageZoomY : pThisTab->aZoomY; }
325 void SetShowGrid( bool bShow );
326 bool GetShowGrid() const { return pThisTab->bShowGrid; }
328 const MapMode& GetLogicMode( ScSplitPos eWhich );
329 const MapMode& GetLogicMode(); // Offset 0
331 double GetPPTX() const { return nPPTX; }
332 double GetPPTY() const { return nPPTY; }
334 ScMarkType GetSimpleArea( SCCOL& rStartCol, SCROW& rStartRow, SCTAB& rStartTab,
335 SCCOL& rEndCol, SCROW& rEndRow, SCTAB& rEndTab ) const;
336 ScMarkType GetSimpleArea( ScRange& rRange ) const;
337 /// May modify rNewMark using MarkToSimple().
338 ScMarkType GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) const;
339 void GetMultiArea( ScRangeListRef& rRange ) const;
341 bool SimpleColMarked();
342 bool SimpleRowMarked();
344 bool IsMultiMarked();
346 /// Disallow paste on Ctrl+A all selected. We'd go DOOM.
347 bool SelectionForbidsPaste();
348 /// Determine DOOM condition, i.e. from selected range.
349 static bool SelectionFillDOOM( const ScRange& rRange );
351 void SetFillMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
352 void SetDragMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
353 ScFillMode nMode );
354 void GetFillData( SCCOL& rStartCol, SCROW& rStartRow,
355 SCCOL& rEndCol, SCROW& rEndRow );
356 void ResetFillMode();
357 bool IsAnyFillMode() { return nFillMode != ScFillMode::NONE; }
358 bool IsFillMode() { return nFillMode == ScFillMode::FILL; }
359 ScFillMode GetFillMode() { return nFillMode; }
361 // TRUE: Cell is merged
362 bool GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix ) const;
363 void GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
364 SCsCOL& rPosX, SCsROW& rPosY,
365 bool bTestMerge = true, bool bRepair = false );
366 void GetMouseQuadrant( const Point& rClickPos, ScSplitPos eWhich,
367 SCsCOL nPosX, SCsROW nPosY, bool& rLeft, bool& rTop );
369 bool IsRefMode() const { return bIsRefMode; }
370 ScRefType GetRefType() const { return eRefType; }
371 SCCOL GetRefStartX() const { return nRefStartX; }
372 SCROW GetRefStartY() const { return nRefStartY; }
373 SCTAB GetRefStartZ() const { return nRefStartZ; }
374 SCCOL GetRefEndX() const { return nRefEndX; }
375 SCROW GetRefEndY() const { return nRefEndY; }
376 SCTAB GetRefEndZ() const { return nRefEndZ; }
378 void SetRefMode( bool bNewMode, ScRefType eNewType )
379 { bIsRefMode = bNewMode; eRefType = eNewType; }
381 void SetRefStart( SCCOL nNewX, SCROW nNewY, SCTAB nNewZ );
382 void SetRefEnd( SCCOL nNewX, SCROW nNewY, SCTAB nNewZ );
384 void ResetDelMark() { bDelMarkValid = false; }
385 void SetDelMark( const ScRange& rRange )
386 { aDelRange = rRange; bDelMarkValid = true; }
388 bool GetDelMark( ScRange& rRange ) const
389 { rRange = aDelRange; return bDelMarkValid; }
391 inline void GetMoveCursor( SCCOL& rCurX, SCROW& rCurY );
393 const ScViewOptions& GetOptions() const { return *pOptions; }
394 void SetOptions( const ScViewOptions& rOpt );
396 bool IsGridMode () const { return pOptions->GetOption( VOPT_GRID ); }
397 void SetGridMode ( bool bNewMode ) { pOptions->SetOption( VOPT_GRID, bNewMode ); }
398 bool IsSyntaxMode () const { return pOptions->GetOption( VOPT_SYNTAX ); }
399 void SetSyntaxMode ( bool bNewMode ) { pOptions->SetOption( VOPT_SYNTAX, bNewMode ); }
400 bool IsHeaderMode () const { return pOptions->GetOption( VOPT_HEADER ); }
401 void SetHeaderMode ( bool bNewMode ) { pOptions->SetOption( VOPT_HEADER, bNewMode ); }
402 bool IsTabMode () const { return pOptions->GetOption( VOPT_TABCONTROLS ); }
403 void SetTabMode ( bool bNewMode ) { pOptions->SetOption( VOPT_TABCONTROLS, bNewMode ); }
404 bool IsVScrollMode () const { return pOptions->GetOption( VOPT_VSCROLL ); }
405 void SetVScrollMode ( bool bNewMode ) { pOptions->SetOption( VOPT_VSCROLL, bNewMode ); }
406 bool IsHScrollMode () const { return pOptions->GetOption( VOPT_HSCROLL ); }
407 void SetHScrollMode ( bool bNewMode ) { pOptions->SetOption( VOPT_HSCROLL, bNewMode ); }
408 bool IsOutlineMode () const { return pOptions->GetOption( VOPT_OUTLINER ); }
409 void SetOutlineMode ( bool bNewMode ) { pOptions->SetOption( VOPT_OUTLINER, bNewMode ); }
411 void KillEditView();
412 void ResetEditView();
413 void SetEditEngine( ScSplitPos eWhich,
414 ScEditEngineDefaulter* pNewEngine,
415 vcl::Window* pWin, SCCOL nNewX, SCROW nNewY );
416 void GetEditView( ScSplitPos eWhich, EditView*& rViewPtr, SCCOL& rCol, SCROW& rRow );
417 bool HasEditView( ScSplitPos eWhich ) const
418 { return pEditView[eWhich] && bEditActive[eWhich]; }
419 EditView* GetEditView( ScSplitPos eWhich ) const
420 { return pEditView[eWhich]; }
422 void EditGrowX();
423 void EditGrowY( bool bInitial = false );
425 ScSplitPos GetEditActivePart() const { return eEditActivePart; }
426 SCCOL GetEditViewCol() const { return nEditCol; }
427 SCROW GetEditViewRow() const { return nEditRow; }
428 SCCOL GetEditStartCol() const { return nEditStartCol; }
429 SCROW GetEditStartRow() const { return nEditRow; } // never editing above the cell
430 SCCOL GetEditEndCol() const { return nEditEndCol; }
431 SCROW GetEditEndRow() const { return nEditEndRow; }
433 Rectangle GetEditArea( ScSplitPos eWhich, SCCOL nPosX, SCROW nPosY, vcl::Window* pWin,
434 const ScPatternAttr* pPattern, bool bForceToTop );
436 void SetTabNo( SCTAB nNewTab );
437 void SetActivePart( ScSplitPos eNewActive );
439 Point GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
440 bool bAllowNeg = false ) const;
441 Point GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScHSplitPos eWhich ) const;
442 Point GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScVSplitPos eWhich ) const;
444 SCCOL CellsAtX( SCsCOL nPosX, SCsCOL nDir, ScHSplitPos eWhichX, sal_uInt16 nScrSizeY = SC_SIZE_NONE ) const;
445 SCROW CellsAtY( SCsROW nPosY, SCsROW nDir, ScVSplitPos eWhichY, sal_uInt16 nScrSizeX = SC_SIZE_NONE ) const;
447 SCCOL VisibleCellsX( ScHSplitPos eWhichX ) const; // Completely visible cell
448 SCROW VisibleCellsY( ScVSplitPos eWhichY ) const;
449 SCCOL PrevCellsX( ScHSplitPos eWhichX ) const; // Cells on the preceding page
450 SCROW PrevCellsY( ScVSplitPos eWhichY ) const;
452 bool IsOle();
453 void SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
454 void SetScreen( const Rectangle& rVisArea );
455 void SetScreenPos( const Point& rVisAreaStart );
457 void UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY );
459 const Size& GetScrSize() const { return aScrSize; }
461 void RecalcPixPos();
462 Point GetPixPos( ScSplitPos eWhich ) const
463 { return Point( pThisTab->nPixPosX[WhichH(eWhich)],
464 pThisTab->nPixPosY[WhichV(eWhich)] ); }
465 void SetSpellingView( EditView* pSpView) { pSpellingView = pSpView; }
466 EditView* GetSpellingView() const { return pSpellingView; }
468 void UpdateOutlinerFlags( Outliner& rOutl ) const;
470 Point GetMousePosPixel();
472 bool UpdateFixX(SCTAB nTab = MAXTAB+1);
473 bool UpdateFixY(SCTAB nTab = MAXTAB+1);
475 SCCOL GetTabStartCol() const { return nTabStartCol; }
476 void SetTabStartCol(SCCOL nNew) { nTabStartCol = nNew; }
478 ScAddress GetCurPos() const;
480 const Size& GetScenButSize() const { return aScenButSize; }
481 void SetScenButSize(const Size& rNew) { aScenButSize = rNew; }
483 bool IsSelCtrlMouseClick() { return bSelCtrlMouseClick; }
485 static inline long ToPixel( sal_uInt16 nTwips, double nFactor );
487 /** while (rScrY <= nEndPixels && rPosY <= nEndRow) add pixels of row
488 heights converted with nPPTY to rScrY, optimized for row height
489 segments. Upon return rPosY is the last row evaluated <= nEndRow, rScrY
490 may be > nEndPixels!
492 static void AddPixelsWhile( long & rScrY, long nEndPixels,
493 SCROW & rPosY, SCROW nEndRow, double nPPTY,
494 const ScDocument * pDoc, SCTAB nTabNo );
496 /** while (rScrY <= nEndPixels && rPosY >= nStartRow) add pixels of row
497 heights converted with nPPTY to rScrY, optimized for row height
498 segments. Upon return rPosY is the last row evaluated >= nStartRow,
499 rScrY may be > nEndPixels!
501 static void AddPixelsWhileBackward( long & rScrY, long nEndPixels,
502 SCROW & rPosY, SCROW nStartRow, double nPPTY,
503 const ScDocument * pDoc, SCTAB nTabNo );
506 inline long ScViewData::ToPixel( sal_uInt16 nTwips, double nFactor )
508 long nRet = (long)( nTwips * nFactor );
509 if ( !nRet && nTwips )
510 nRet = 1;
511 return nRet;
514 inline void ScViewData::GetMoveCursor( SCCOL& rCurX, SCROW& rCurY )
516 if ( bIsRefMode )
518 rCurX = nRefEndX;
519 rCurY = nRefEndY;
521 else
523 rCurX = GetCurX();
524 rCurY = GetCurY();
528 inline ScHSplitPos WhichH( ScSplitPos ePos )
530 return (ePos==SC_SPLIT_TOPLEFT || ePos==SC_SPLIT_BOTTOMLEFT) ?
531 SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
534 inline ScVSplitPos WhichV( ScSplitPos ePos )
536 return (ePos==SC_SPLIT_TOPLEFT || ePos==SC_SPLIT_TOPRIGHT) ?
537 SC_SPLIT_TOP : SC_SPLIT_BOTTOM;
540 #endif
542 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */