xref: /aoo42x/main/sc/source/ui/inc/viewdata.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef SC_VIEWDATA_HXX
28 #define SC_VIEWDATA_HXX
29 
30 #include <svx/zoomitem.hxx>
31 #include "scdllapi.h"
32 #include "viewopti.hxx"
33 #include "markdata.hxx"
34 
35 
36 // ---------------------------------------------------------------------------
37 
38 #define	SC_SLIDER_SIZE		2
39 #define SC_SMALL3DSHADOW	COL_BLACK
40 #define SC_SIZE_NONE		65535
41 const SCCOL SC_TABSTART_NONE = SCCOL_MAX;
42 
43 #define SC_FILL_NONE		0
44 #define SC_FILL_FILL		1
45 #define SC_FILL_EMBED_LT	2
46 #define SC_FILL_EMBED_RB	3
47 #define SC_FILL_MATRIX		4
48 
49 enum ScSplitMode { SC_SPLIT_NONE = 0, SC_SPLIT_NORMAL, SC_SPLIT_FIX };
50 
51 enum ScSplitPos { SC_SPLIT_TOPLEFT, SC_SPLIT_TOPRIGHT, SC_SPLIT_BOTTOMLEFT, SC_SPLIT_BOTTOMRIGHT };
52 enum ScHSplitPos { SC_SPLIT_LEFT, SC_SPLIT_RIGHT };
53 enum ScVSplitPos { SC_SPLIT_TOP, SC_SPLIT_BOTTOM };
54 
55 inline ScHSplitPos WhichH( ScSplitPos ePos );
56 inline ScVSplitPos WhichV( ScSplitPos ePos );
57 inline ScSplitPos Which( ScHSplitPos eHPos );
58 inline ScSplitPos Which( ScVSplitPos eVPos );
59 
60 //	Bildschirmverhalten bei Cursorbewegungen:
61 enum ScFollowMode { SC_FOLLOW_NONE, SC_FOLLOW_LINE, SC_FOLLOW_FIX, SC_FOLLOW_JUMP };
62 
63 //	Mausmodi um Bereiche zu selektieren
64 enum ScRefType { SC_REFTYPE_NONE, SC_REFTYPE_REF, SC_REFTYPE_FILL,
65 					SC_REFTYPE_EMBED_LT, SC_REFTYPE_EMBED_RB };
66 
67 /** States GetSimpleArea() returns for the underlying selection marks, so the
68     caller can react if the result is not of type SC_MARK_SIMPLE. */
69 enum ScMarkType
70 {
71     SC_MARK_NONE            = 0,    // Not returned by GetSimpleArea(), used internally.
72                                     // Nothing marked always results in the
73                                     // current cursor position being selected and a simple mark.
74     SC_MARK_SIMPLE          = 1,    // Simple rectangular area marked, no filtered rows.
75     SC_MARK_FILTERED        = 2,    // At least one mark contains filtered rows.
76     SC_MARK_SIMPLE_FILTERED =       // Simple rectangular area marked containing filtered rows.
77         SC_MARK_SIMPLE |
78         SC_MARK_FILTERED,  // 3
79     SC_MARK_MULTI           = 4     // Multiple selection marks.
80     /* TODO: if filtered multi-selection was implemented, this would be the value to use. */
81 #if 0
82         ,
83     SC_MARK_MULTI_FILTERED  =       // Multiple selection marks containing filtered rows.
84         SC_MARK_MULTI |
85         SC_MARK_FILTERED   // 6
86 #endif
87 };
88 
89 class ScDocShell;
90 class ScDocument;
91 class ScDBFunc;
92 class ScTabViewShell;
93 class ScDrawView;
94 class ScEditEngineDefaulter;
95 class EditView;
96 class EditStatus;
97 class Outliner;
98 class Window;
99 class SfxObjectShell;
100 class SfxBindings;
101 class SfxDispatcher;
102 class ScPatternAttr;
103 class ScRangeListRef;
104 class ScExtDocOptions;
105 class ScViewData;
106 
107 //--------------------------------------------------------------------------
108 
109 class ScViewDataTable							// Daten pro Tabelle
110 {
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;
118 
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 Pixeln
124 	long			nPixPosY[2];
125 	long			nHSplitPos;
126 	long			nVSplitPos;
127 
128 	ScSplitMode		eHSplitMode;
129 	ScSplitMode		eVSplitMode;
130 	ScSplitPos		eWhichActive;
131 
132 	SCCOL			nFixPosX;					// Zellposition des Splitters beim Fixieren
133 	SCROW			nFixPosY;
134 
135 	SCCOL			nCurX;
136 	SCROW			nCurY;
137 	SCCOL			nOldCurX;
138 	SCROW			nOldCurY;
139 	SCCOL			nPosX[2];
140 	SCROW			nPosY[2];
141 
142 	sal_Bool			bOldCurValid;				// "virtuelle" Cursorpos. bei zusammengefassten
143 
144 					ScViewDataTable();
145 					~ScViewDataTable();
146 
147     void            WriteUserDataSequence(
148                         com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings,
149                         const ScViewData& rViewData, SCTAB nTab );
150 
151     void            ReadUserDataSequence(
152                         const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings,
153                         ScViewData& rViewData, SCTAB nTab, bool& rHasZoom);
154 };
155 
156 // ---------------------------------------------------------------------------
157 
158 class SC_DLLPUBLIC ScViewData
159 {
160 private:
161 	double				nPPTX, nPPTY;				// Scaling-Faktoren
162 
163 	ScViewDataTable*	pTabData[MAXTABCOUNT];
164 	ScViewDataTable*	pThisTab;					// Daten der angezeigten Tabelle
165 	ScDocShell*			pDocShell;
166 	ScDocument*			pDoc;
167 	ScDBFunc*			pView;
168 	ScTabViewShell*		pViewShell;
169 	EditView*			pEditView[4];				// gehoert dem Fenster
170 	ScViewOptions*		pOptions;
171 	EditView*			pSpellingView;
172 
173 	ScMarkData			aMarkData;
174 
175 	long				nEditMargin;
176 
177 	Size				aScenButSize;				// Groesse eines Szenario-Buttons
178 
179 	Size				aScrSize;
180 	MapMode				aLogicMode;					// skalierter 1/100mm-MapMode
181 
182     SvxZoomType         eDefZoomType;               // default zoom and type for missing TabData
183     Fraction            aDefZoomX;
184     Fraction            aDefZoomY;
185     Fraction            aDefPageZoomX;              // zoom in page break preview mode
186     Fraction            aDefPageZoomY;
187 
188 	ScRefType			eRefType;
189 
190 	SCTAB				nTabNo;						// angezeigte Tabelle
191 	SCTAB				nRefTabNo;					// Tabelle auf die sich RefInput bezieht
192 	SCCOL				nRefStartX;
193 	SCROW				nRefStartY;
194 	SCTAB				nRefStartZ;
195 	SCCOL				nRefEndX;
196 	SCROW				nRefEndY;
197 	SCTAB				nRefEndZ;
198 	SCCOL				nFillStartX;				// Fill-Cursor
199 	SCROW				nFillStartY;
200 	SCCOL				nFillEndX;
201 	SCROW				nFillEndY;
202 	SCCOL				nEditCol;					// Position dazu
203 	SCROW				nEditRow;
204 	SCCOL				nEditStartCol;
205 	SCCOL				nEditEndCol;				// Ende der Edit-View
206 	SCROW				nEditEndRow;
207 	SCCOL				nTabStartCol;				// fuer Enter nach Tab
208 	ScRange				aDelRange;					// fuer AutoFill-Loeschen
209 
210     ScSplitPos          eEditActivePart;            // the part that was active when edit mode was started
211 	sal_Bool				bEditActive[4];				// aktiv?
212 	sal_Bool				bActive;					// aktives Fenster ?
213 	sal_Bool				bIsRefMode;					// Referenzeingabe
214 	sal_Bool				bDelMarkValid;				// nur gueltig bei SC_REFTYPE_FILL
215 	sal_uInt8				nFillMode;					// Modus
216 	sal_Bool				bPagebreak;					// Seitenumbruch-Vorschaumodus
217 
218 	sal_Bool				bSelCtrlMouseClick;         // special selection handling for ctrl-mouse-click
219 
220 	SC_DLLPRIVATE DECL_LINK (EmptyEditHdl, EditStatus*);
221 	SC_DLLPRIVATE DECL_LINK (EditEngineHdl, EditStatus*);
222 
223 	SC_DLLPRIVATE void			CalcPPT();
224     SC_DLLPRIVATE void          CreateTabData( SCTAB nNewTab );
225     SC_DLLPRIVATE void          CreateTabData( std::vector< SCTAB >& rvTabs );
226     SC_DLLPRIVATE void          CreateSelectedTabData();
227 
228 public:
229 					ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh );
230 					ScViewData( const ScViewData& rViewData );
231 					~ScViewData();
232 
233 	void			InitData( ScDocument* pDocument );
234 //UNUSED2008-05  void            InitFrom( const ScViewData* pRef );
235 //UNUSED2008-05  void			SetDocShell( ScDocShell* pShell );
236 
237 
238 	ScDocShell*		GetDocShell() const		{ return pDocShell; }
239 	ScDBFunc*		GetView() const			{ return pView; }
240 	ScTabViewShell*	GetViewShell() const	{ return pViewShell; }
241 
242 	SfxObjectShell* GetSfxDocShell() const;
243 	SfxBindings&	GetBindings();			// from ViewShell's ViewFrame
244 	SfxDispatcher&	GetDispatcher();		// from ViewShell's ViewFrame
245 
246 	ScMarkData&		GetMarkData()			{ return aMarkData; }
247     const ScMarkData& GetMarkData() const   { return aMarkData; }
248 
249 	Window*			GetDialogParent();			// von tabvwsh weitergeleitet
250 	Window*			GetActiveWin();				// von View
251 	ScDrawView*		GetScDrawView();			// von View
252 	sal_Bool			IsMinimized();				// von View
253 
254 	void			UpdateInputHandler( sal_Bool bForce = sal_False, sal_Bool bStopEditing = sal_True );
255 
256 	void			WriteUserData(String& rData);
257 	void			ReadUserData(const String& rData);
258     void            WriteExtOptions( ScExtDocOptions& rOpt ) const;
259     void            ReadExtOptions( const ScExtDocOptions& rOpt );
260 	void			WriteUserDataSequence(com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings);
261 	void			ReadUserDataSequence(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings);
262 
263 	ScDocument*		GetDocument() const;
264 
265 	void			SetViewShell( ScTabViewShell* pViewSh );
266 
267 	sal_Bool			IsActive() const			{ return bActive; }
268 	void			Activate(sal_Bool bActivate)	{ bActive = bActivate; }
269 
270 	void			UpdateThis();
271 
272 	void			InsertTab( SCTAB nTab );
273 	void			DeleteTab( SCTAB nTab );
274 	void			CopyTab( SCTAB nSrcTab, SCTAB nDestTab );
275 	void			MoveTab( SCTAB nSrcTab, SCTAB nDestTab );
276 
277 	SCTAB			GetRefTabNo() const 					{ return nRefTabNo; }
278 	void			SetRefTabNo( SCTAB nNewTab )			{ nRefTabNo = nNewTab; }
279 
280 	SCTAB			GetTabNo() const						{ return nTabNo; }
281 	ScSplitPos		GetActivePart() const					{ return pThisTab->eWhichActive; }
282 	SCCOL			GetPosX( ScHSplitPos eWhich ) const		{ return pThisTab->nPosX[eWhich]; }
283 	SCROW			GetPosY( ScVSplitPos eWhich ) const		{ return pThisTab->nPosY[eWhich]; }
284 	SCCOL			GetCurX() const							{ return pThisTab->nCurX; }
285 	SCROW			GetCurY() const							{ return pThisTab->nCurY; }
286 	sal_Bool			HasOldCursor() const					{ return pThisTab->bOldCurValid; }
287 	SCCOL			GetOldCurX() const;
288 	SCROW			GetOldCurY() const;
289 	ScSplitMode		GetHSplitMode() const					{ return pThisTab->eHSplitMode; }
290 	ScSplitMode		GetVSplitMode() const					{ return pThisTab->eVSplitMode; }
291 	long			GetHSplitPos() const					{ return pThisTab->nHSplitPos; }
292 	long			GetVSplitPos() const					{ return pThisTab->nVSplitPos; }
293 	SCCOL			GetFixPosX() const						{ return pThisTab->nFixPosX; }
294 	SCROW			GetFixPosY() const						{ return pThisTab->nFixPosY; }
295 	sal_Bool			IsPagebreakMode() const					{ return bPagebreak; }
296 
297 	void			SetPosX( ScHSplitPos eWhich, SCCOL nNewPosX );
298 	void			SetPosY( ScVSplitPos eWhich, SCROW nNewPosY );
299 	void			SetCurX( SCCOL nNewCurX )						{ pThisTab->nCurX = nNewCurX; }
300 	void			SetCurY( SCROW nNewCurY )						{ pThisTab->nCurY = nNewCurY; }
301 	void			SetOldCursor( SCCOL nNewX, SCROW nNewY );
302 	void			ResetOldCursor();
303 	void			SetHSplitMode( ScSplitMode eMode )				{ pThisTab->eHSplitMode = eMode; }
304 	void			SetVSplitMode( ScSplitMode eMode )				{ pThisTab->eVSplitMode = eMode; }
305 	void			SetHSplitPos( long nPos )						{ pThisTab->nHSplitPos = nPos; }
306 	void			SetVSplitPos( long nPos )						{ pThisTab->nVSplitPos = nPos; }
307 	void			SetFixPosX( SCCOL nPos )						{ pThisTab->nFixPosX = nPos; }
308 	void			SetFixPosY( SCROW nPos )						{ pThisTab->nFixPosY = nPos; }
309 	void			SetPagebreakMode( sal_Bool bSet );
310 
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();
316 
317 	void			SetSelCtrlMouseClick( sal_Bool bTmp ) { bSelCtrlMouseClick = bTmp; }
318 
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; }
322 
323 	const MapMode&	GetLogicMode( ScSplitPos eWhich );
324 	const MapMode&	GetLogicMode();						// Offset 0
325 
326 	long			GetTPosX( ScHSplitPos eWhich ) const		{ return pThisTab->nTPosX[eWhich]; }
327 	long			GetTPosY( ScVSplitPos eWhich ) const		{ return pThisTab->nTPosY[eWhich]; }
328 
329 	double			GetPPTX() const { return nPPTX; }
330 	double			GetPPTY() const	{ return nPPTY; }
331 
332 	ScMarkType      GetSimpleArea( SCCOL& rStartCol, SCROW& rStartRow, SCTAB& rStartTab,
333 									SCCOL& rEndCol, SCROW& rEndRow, SCTAB& rEndTab ) const;
334 	ScMarkType      GetSimpleArea( ScRange& rRange ) const;
335                     /// May modify rNewMark using MarkToSimple().
336     ScMarkType      GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) const;
337 	void			GetMultiArea( ScRangeListRef& rRange ) const;
338 
339 	sal_Bool			SimpleColMarked();
340 	sal_Bool			SimpleRowMarked();
341 
342 	sal_Bool			IsMultiMarked();
343 
344 	void			SetFillMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
345 	void			SetDragMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
346 									sal_uInt8 nMode );
347 	void			GetFillData( SCCOL& rStartCol, SCROW& rStartRow,
348 								 SCCOL& rEndCol, SCROW& rEndRow );
349 	void			ResetFillMode();
350 	sal_Bool			IsAnyFillMode()				{ return nFillMode != SC_FILL_NONE; }
351 	sal_Bool			IsFillMode()				{ return nFillMode == SC_FILL_FILL; }
352 	sal_uInt8			GetFillMode()				{ return nFillMode; }
353 
354 					// TRUE: Zelle ist zusammengefasst
355 	sal_Bool			GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix );
356 	sal_Bool			GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
357 										SCsCOL& rPosX, SCsROW& rPosY,
358 										sal_Bool bTestMerge = sal_True, sal_Bool bRepair = sal_False,
359 										sal_Bool bNextIfLarge = sal_True );
360 	void			GetMouseQuadrant( const Point& rClickPos, ScSplitPos eWhich,
361 										SCsCOL nPosX, SCsROW nPosY, sal_Bool& rLeft, sal_Bool& rTop );
362 
363 	sal_Bool			IsRefMode() const						{ return bIsRefMode; }
364 	ScRefType		GetRefType() const						{ return eRefType; }
365 	SCCOL			GetRefStartX() const					{ return nRefStartX; }
366 	SCROW			GetRefStartY() const					{ return nRefStartY; }
367 	SCTAB			GetRefStartZ() const					{ return nRefStartZ; }
368 	SCCOL			GetRefEndX() const						{ return nRefEndX; }
369 	SCROW			GetRefEndY() const						{ return nRefEndY; }
370 	SCTAB			GetRefEndZ() const						{ return nRefEndZ; }
371 
372 	void			SetRefMode( sal_Bool bNewMode, ScRefType eNewType )
373 									{ bIsRefMode = bNewMode; eRefType = eNewType; }
374 
375 	void			SetRefStart( SCCOL nNewX, SCROW nNewY, SCTAB nNewZ )
376 							{ nRefStartX = nNewX; nRefStartY = nNewY; nRefStartZ = nNewZ; }
377 	void			SetRefEnd( SCCOL nNewX, SCROW nNewY, SCTAB nNewZ )
378 							{ nRefEndX = nNewX; nRefEndY = nNewY; nRefEndZ = nNewZ; }
379 
380 	void			ResetDelMark()							{ bDelMarkValid = sal_False; }
381 	void			SetDelMark( const ScRange& rRange )
382 							{ aDelRange = rRange; bDelMarkValid = sal_True; }
383 
384 	sal_Bool			GetDelMark( ScRange& rRange ) const
385 							{ rRange = aDelRange; return bDelMarkValid; }
386 
387 	inline void		GetMoveCursor( SCCOL& rCurX, SCROW& rCurY );
388 
389 	const ScViewOptions&	GetOptions() const { return *pOptions; }
390 	void					SetOptions( const ScViewOptions& rOpt );
391 
392 	sal_Bool	IsGridMode		() const			{ return pOptions->GetOption( VOPT_GRID ); }
393 	void	SetGridMode		( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_GRID, bNewMode ); }
394 	sal_Bool	IsSyntaxMode	() const			{ return pOptions->GetOption( VOPT_SYNTAX ); }
395 	void	SetSyntaxMode	( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_SYNTAX, bNewMode ); }
396 	sal_Bool	IsHeaderMode	() const			{ return pOptions->GetOption( VOPT_HEADER ); }
397 	void	SetHeaderMode	( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_HEADER, bNewMode ); }
398 	sal_Bool	IsTabMode		() const			{ return pOptions->GetOption( VOPT_TABCONTROLS ); }
399 	void	SetTabMode		( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_TABCONTROLS, bNewMode ); }
400 	sal_Bool	IsVScrollMode	() const			{ return pOptions->GetOption( VOPT_VSCROLL ); }
401 	void	SetVScrollMode	( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_VSCROLL, bNewMode ); }
402 	sal_Bool	IsHScrollMode	() const			{ return pOptions->GetOption( VOPT_HSCROLL ); }
403 	void	SetHScrollMode	( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_HSCROLL, bNewMode ); }
404 	sal_Bool	IsOutlineMode	() const			{ return pOptions->GetOption( VOPT_OUTLINER ); }
405 	void	SetOutlineMode	( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_OUTLINER, bNewMode ); }
406 
407 	void 			KillEditView();
408 	void			ResetEditView();
409 	void			SetEditEngine( ScSplitPos eWhich,
410 									ScEditEngineDefaulter* pNewEngine,
411 									Window* pWin, SCCOL nNewX, SCROW nNewY );
412 	void			GetEditView( ScSplitPos eWhich, EditView*& rViewPtr, SCCOL& rCol, SCROW& rRow );
413 	sal_Bool			HasEditView( ScSplitPos eWhich ) const
414 										{ return pEditView[eWhich] && bEditActive[eWhich]; }
415 	EditView*		GetEditView( ScSplitPos eWhich ) const
416 										{ return pEditView[eWhich]; }
417 
418 	void			EditGrowX();
419 	void			EditGrowY( sal_Bool bInitial = sal_False );
420 
421     ScSplitPos      GetEditActivePart() const       { return eEditActivePart; }
422 	SCCOL			GetEditViewCol() const			{ return nEditCol; }
423 	SCROW			GetEditViewRow() const			{ return nEditRow; }
424 	SCCOL			GetEditStartCol() const			{ return nEditStartCol; }
425 	SCROW			GetEditStartRow() const			{ return nEditRow; }		// never editing above the cell
426 	SCCOL			GetEditEndCol() const			{ return nEditEndCol; }
427 	SCROW			GetEditEndRow() const			{ return nEditEndRow; }
428 
429 	Rectangle		GetEditArea( ScSplitPos eWhich, SCCOL nPosX, SCROW nPosY, Window* pWin,
430 									const ScPatternAttr* pPattern, sal_Bool bForceToTop );
431 
432 	void			SetTabNo( SCTAB nNewTab );
433 	void			SetActivePart( ScSplitPos eNewActive );
434 
435 	Point			GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
436 								sal_Bool bAllowNeg = sal_False ) const;
437 	Point			GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScHSplitPos eWhich ) const;
438 	Point			GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScVSplitPos eWhich ) const;
439 
440 	SCCOL			CellsAtX( SCsCOL nPosX, SCsCOL nDir, ScHSplitPos eWhichX, sal_uInt16 nScrSizeY = SC_SIZE_NONE ) const;
441 	SCROW			CellsAtY( SCsROW nPosY, SCsROW nDir, ScVSplitPos eWhichY, sal_uInt16 nScrSizeX = SC_SIZE_NONE ) const;
442 
443 	SCCOL			VisibleCellsX( ScHSplitPos eWhichX ) const;		// angezeigte komplette Zellen
444 	SCROW			VisibleCellsY( ScVSplitPos eWhichY ) const;
445 	SCCOL			PrevCellsX( ScHSplitPos eWhichX ) const;		// Zellen auf der vorgehenden Seite
446 	SCROW			PrevCellsY( ScVSplitPos eWhichY ) const;
447 //UNUSED2008-05  SCCOL           LastCellsX( ScHSplitPos eWhichX ) const;        // Zellen auf der letzten Seite
448 //UNUSED2008-05  SCROW           LastCellsY( ScVSplitPos eWhichY ) const;
449 
450 	sal_Bool			IsOle();
451 //UNUSED2008-05  void            UpdateOle( ScSplitPos eWhich );
452 	void			SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
453 	void			SetScreen( const Rectangle& rVisArea );
454 	void			SetScreenPos( const Point& rVisAreaStart );
455 
456 	void			UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY );
457 
458 	Size			GetScrSize() const				{ return aScrSize; }
459 
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; }
466 
467 	void			UpdateOutlinerFlags( Outliner& rOutl ) const;
468 
469 	Point			GetMousePosPixel();
470 
471 	sal_Bool			UpdateFixX(SCTAB nTab = MAXTAB+1);
472 	sal_Bool			UpdateFixY(SCTAB nTab = MAXTAB+1);
473 
474 	SCCOL			GetTabStartCol() const			{ return nTabStartCol; }
475 	void			SetTabStartCol(SCCOL nNew)		{ nTabStartCol = nNew; }
476 
477 	ScAddress		GetCurPos() const;
478 
479 	const Size&		GetScenButSize() const				{ return aScenButSize; }
480 	void			SetScenButSize(const Size& rNew)	{ aScenButSize = rNew; }
481 
482 	sal_Bool			IsSelCtrlMouseClick() { return bSelCtrlMouseClick; }
483 
484 	static inline long ToPixel( sal_uInt16 nTwips, double nFactor );
485 
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!
490      */
491     static void     AddPixelsWhile( long & rScrY, long nEndPixels,
492                                     SCROW & rPosY, SCROW nEndRow, double nPPTY,
493                                     const ScDocument * pDoc, SCTAB nTabNo );
494 
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!
499      */
500     static void     AddPixelsWhileBackward( long & rScrY, long nEndPixels,
501                                     SCROW & rPosY, SCROW nStartRow, double nPPTY,
502                                     const ScDocument * pDoc, SCTAB nTabNo );
503 };
504 
505 
506 // ---------------------------------------------------------------------------
507 
508 inline long ScViewData::ToPixel( sal_uInt16 nTwips, double nFactor )
509 {
510 	long nRet = (long)( nTwips * nFactor );
511 	if ( !nRet && nTwips )
512 		nRet = 1;
513 	return nRet;
514 }
515 
516 inline void ScViewData::GetMoveCursor( SCCOL& rCurX, SCROW& rCurY )
517 {
518 	if ( bIsRefMode )
519 	{
520 		rCurX = nRefEndX;
521 		rCurY = nRefEndY;
522 	}
523 	else
524 	{
525 		rCurX = GetCurX();
526 		rCurY = GetCurY();
527 	}
528 }
529 
530 inline ScHSplitPos WhichH( ScSplitPos ePos )
531 {
532 	return (ePos==SC_SPLIT_TOPLEFT || ePos==SC_SPLIT_BOTTOMLEFT) ?
533 				SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
534 }
535 
536 inline ScVSplitPos WhichV( ScSplitPos ePos )
537 {
538 	return (ePos==SC_SPLIT_TOPLEFT || ePos==SC_SPLIT_TOPRIGHT) ?
539 				SC_SPLIT_TOP : SC_SPLIT_BOTTOM;
540 }
541 
542 inline ScSplitPos Which( ScHSplitPos eHPos )
543 {
544 	return (eHPos==SC_SPLIT_LEFT) ?
545 				SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
546 }
547 
548 inline ScSplitPos Which( ScVSplitPos eVPos )
549 {
550 	return (eVPos==SC_SPLIT_TOP) ?
551 				SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT;
552 }
553 
554 
555 
556 #endif
557 
558