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