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