xref: /aoo4110/main/sc/source/ui/inc/viewdata.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef SC_VIEWDATA_HXX
24 #define SC_VIEWDATA_HXX
25 
26 #include <svx/zoomitem.hxx>
27 #include "scdllapi.h"
28 #include "viewopti.hxx"
29 #include "markdata.hxx"
30 
31 
32 // ---------------------------------------------------------------------------
33 
34 #define	SC_SLIDER_SIZE		2
35 #define SC_SMALL3DSHADOW	COL_BLACK
36 #define SC_SIZE_NONE		65535
37 const SCCOL SC_TABSTART_NONE = SCCOL_MAX;
38 
39 #define SC_FILL_NONE		0
40 #define SC_FILL_FILL		1
41 #define SC_FILL_EMBED_LT	2
42 #define SC_FILL_EMBED_RB	3
43 #define SC_FILL_MATRIX		4
44 
45 enum ScSplitMode { SC_SPLIT_NONE = 0, SC_SPLIT_NORMAL, SC_SPLIT_FIX };
46 
47 enum ScSplitPos { SC_SPLIT_TOPLEFT, SC_SPLIT_TOPRIGHT, SC_SPLIT_BOTTOMLEFT, SC_SPLIT_BOTTOMRIGHT };
48 enum ScHSplitPos { SC_SPLIT_LEFT, SC_SPLIT_RIGHT };
49 enum ScVSplitPos { SC_SPLIT_TOP, SC_SPLIT_BOTTOM };
50 
51 inline ScHSplitPos WhichH( ScSplitPos ePos );
52 inline ScVSplitPos WhichV( ScSplitPos ePos );
53 inline ScSplitPos Which( ScHSplitPos eHPos );
54 inline ScSplitPos Which( ScVSplitPos eVPos );
55 
56 //	Bildschirmverhalten bei Cursorbewegungen:
57 enum ScFollowMode { SC_FOLLOW_NONE, SC_FOLLOW_LINE, SC_FOLLOW_FIX, SC_FOLLOW_JUMP };
58 
59 //	Mausmodi um Bereiche zu selektieren
60 enum ScRefType { SC_REFTYPE_NONE, SC_REFTYPE_REF, SC_REFTYPE_FILL,
61 					SC_REFTYPE_EMBED_LT, SC_REFTYPE_EMBED_RB };
62 
63 /** States GetSimpleArea() returns for the underlying selection marks, so the
64     caller can react if the result is not of type SC_MARK_SIMPLE. */
65 enum ScMarkType
66 {
67     SC_MARK_NONE            = 0,    // Not returned by GetSimpleArea(), used internally.
68                                     // Nothing marked always results in the
69                                     // current cursor position being selected and a simple mark.
70     SC_MARK_SIMPLE          = 1,    // Simple rectangular area marked, no filtered rows.
71     SC_MARK_FILTERED        = 2,    // At least one mark contains filtered rows.
72     SC_MARK_SIMPLE_FILTERED =       // Simple rectangular area marked containing filtered rows.
73         SC_MARK_SIMPLE |
74         SC_MARK_FILTERED,  // 3
75     SC_MARK_MULTI           = 4     // Multiple selection marks.
76     /* TODO: if filtered multi-selection was implemented, this would be the value to use. */
77 #if 0
78         ,
79     SC_MARK_MULTI_FILTERED  =       // Multiple selection marks containing filtered rows.
80         SC_MARK_MULTI |
81         SC_MARK_FILTERED   // 6
82 #endif
83 };
84 
85 class ScDocShell;
86 class ScDocument;
87 class ScDBFunc;
88 class ScTabViewShell;
89 class ScDrawView;
90 class ScEditEngineDefaulter;
91 class EditView;
92 class EditStatus;
93 class Outliner;
94 class Window;
95 class SfxObjectShell;
96 class SfxBindings;
97 class SfxDispatcher;
98 class ScPatternAttr;
99 class ScRangeListRef;
100 class ScExtDocOptions;
101 class ScViewData;
102 
103 //--------------------------------------------------------------------------
104 
105 class ScViewDataTable							// Daten pro Tabelle
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 Pixeln
120 	long			nPixPosY[2];
121 	long			nHSplitPos;
122 	long			nVSplitPos;
123 
124 	ScSplitMode		eHSplitMode;
125 	ScSplitMode		eVSplitMode;
126 	ScSplitPos		eWhichActive;
127 
128 	SCCOL			nFixPosX;					// Zellposition des Splitters beim Fixieren
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 	sal_Bool			bOldCurValid;				// "virtuelle" Cursorpos. bei zusammengefassten
139 
140 					ScViewDataTable();
141 					~ScViewDataTable();
142 
143     void            WriteUserDataSequence(
144                         com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings,
145                         const ScViewData& rViewData, SCTAB nTab );
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 };
151 
152 // ---------------------------------------------------------------------------
153 
154 class SC_DLLPUBLIC ScViewData
155 {
156 private:
157 	double				nPPTX, nPPTY;				// Scaling-Faktoren
158 
159 	ScViewDataTable*	pTabData[MAXTABCOUNT];
160 	ScViewDataTable*	pThisTab;					// Daten der angezeigten Tabelle
161 	ScDocShell*			pDocShell;
162 	ScDocument*			pDoc;
163 	ScDBFunc*			pView;
164 	ScTabViewShell*		pViewShell;
165 	EditView*			pEditView[4];				// gehoert dem Fenster
166 	ScViewOptions*		pOptions;
167 	EditView*			pSpellingView;
168 
169 	ScMarkData			aMarkData;
170 
171 	long				nEditMargin;
172 
173 	Size				aScenButSize;				// Groesse eines Szenario-Buttons
174 
175 	Size				aScrSize;
176 	MapMode				aLogicMode;					// skalierter 1/100mm-MapMode
177 
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;
183 
184 	ScRefType			eRefType;
185 
186 	SCTAB				nTabNo;						// angezeigte Tabelle
187 	SCTAB				nRefTabNo;					// Tabelle auf die sich RefInput bezieht
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;					// Position dazu
199 	SCROW				nEditRow;
200 	SCCOL				nEditStartCol;
201 	SCCOL				nEditEndCol;				// Ende der Edit-View
202 	SCROW				nEditEndRow;
203 	SCCOL				nTabStartCol;				// fuer Enter nach Tab
204 	ScRange				aDelRange;					// fuer AutoFill-Loeschen
205 
206     ScSplitPos          eEditActivePart;            // the part that was active when edit mode was started
207 	sal_Bool				bEditActive[4];				// aktiv?
208 	sal_Bool				bActive;					// aktives Fenster ?
209 	sal_Bool				bIsRefMode;					// Referenzeingabe
210 	sal_Bool				bDelMarkValid;				// nur gueltig bei SC_REFTYPE_FILL
211 	sal_uInt8				nFillMode;					// Modus
212 	sal_Bool				bPagebreak;					// Seitenumbruch-Vorschaumodus
213 
214 	sal_Bool				bSelCtrlMouseClick;         // special selection handling for ctrl-mouse-click
215 
216 	SC_DLLPRIVATE DECL_LINK (EmptyEditHdl, EditStatus*);
217 	SC_DLLPRIVATE DECL_LINK (EditEngineHdl, EditStatus*);
218 
219 	SC_DLLPRIVATE void			CalcPPT();
220     SC_DLLPRIVATE void          CreateTabData( SCTAB nNewTab );
221     SC_DLLPRIVATE void          CreateTabData( std::vector< SCTAB >& rvTabs );
222     SC_DLLPRIVATE void          CreateSelectedTabData();
223 
224 public:
225 					ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh );
226 					ScViewData( const ScViewData& rViewData );
227 					~ScViewData();
228 
229 	void			InitData( ScDocument* pDocument );
230 //UNUSED2008-05  void            InitFrom( const ScViewData* pRef );
231 //UNUSED2008-05  void			SetDocShell( ScDocShell* pShell );
232 
233 
GetDocShell() const234 	ScDocShell*		GetDocShell() const		{ return pDocShell; }
GetView() const235 	ScDBFunc*		GetView() const			{ return pView; }
GetViewShell() const236 	ScTabViewShell*	GetViewShell() const	{ return pViewShell; }
237 
238 	SfxObjectShell* GetSfxDocShell() const;
239 	SfxBindings&	GetBindings();			// from ViewShell's ViewFrame
240 	SfxDispatcher&	GetDispatcher();		// from ViewShell's ViewFrame
241 
GetMarkData()242 	ScMarkData&		GetMarkData()			{ return aMarkData; }
GetMarkData() const243     const ScMarkData& GetMarkData() const   { return aMarkData; }
244 
245 	Window*			GetDialogParent();			// von tabvwsh weitergeleitet
246 	Window*			GetActiveWin();				// von View
247 	ScDrawView*		GetScDrawView();			// von View
248 	sal_Bool			IsMinimized();				// von View
249 
250 	void			UpdateInputHandler( sal_Bool bForce = sal_False, sal_Bool bStopEditing = sal_True );
251 
252 	void			WriteUserData(String& rData);
253 	void			ReadUserData(const String& rData);
254     void            WriteExtOptions( ScExtDocOptions& rOpt ) const;
255     void            ReadExtOptions( const ScExtDocOptions& rOpt );
256 	void			WriteUserDataSequence(com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings);
257 	void			ReadUserDataSequence(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings);
258 
259 	ScDocument*		GetDocument() const;
260 
261 	void			SetViewShell( ScTabViewShell* pViewSh );
262 
IsActive() const263 	sal_Bool			IsActive() const			{ return bActive; }
Activate(sal_Bool bActivate)264 	void			Activate(sal_Bool bActivate)	{ bActive = bActivate; }
265 
266 	void			UpdateThis();
267 
268 	void			InsertTab( SCTAB nTab );
269 	void			DeleteTab( SCTAB nTab );
270 	void			CopyTab( SCTAB nSrcTab, SCTAB nDestTab );
271 	void			MoveTab( SCTAB nSrcTab, SCTAB nDestTab );
272 
GetRefTabNo() const273 	SCTAB			GetRefTabNo() const 					{ return nRefTabNo; }
SetRefTabNo(SCTAB nNewTab)274 	void			SetRefTabNo( SCTAB nNewTab )			{ nRefTabNo = nNewTab; }
275 
GetTabNo() const276 	SCTAB			GetTabNo() const						{ return nTabNo; }
GetActivePart() const277 	ScSplitPos		GetActivePart() const					{ return pThisTab->eWhichActive; }
GetPosX(ScHSplitPos eWhich) const278 	SCCOL			GetPosX( ScHSplitPos eWhich ) const		{ return pThisTab->nPosX[eWhich]; }
GetPosY(ScVSplitPos eWhich) const279 	SCROW			GetPosY( ScVSplitPos eWhich ) const		{ return pThisTab->nPosY[eWhich]; }
GetCurX() const280 	SCCOL			GetCurX() const							{ return pThisTab->nCurX; }
GetCurY() const281 	SCROW			GetCurY() const							{ return pThisTab->nCurY; }
HasOldCursor() const282 	sal_Bool			HasOldCursor() const					{ return pThisTab->bOldCurValid; }
283 	SCCOL			GetOldCurX() const;
284 	SCROW			GetOldCurY() const;
GetHSplitMode() const285 	ScSplitMode		GetHSplitMode() const					{ return pThisTab->eHSplitMode; }
GetVSplitMode() const286 	ScSplitMode		GetVSplitMode() const					{ return pThisTab->eVSplitMode; }
GetHSplitPos() const287 	long			GetHSplitPos() const					{ return pThisTab->nHSplitPos; }
GetVSplitPos() const288 	long			GetVSplitPos() const					{ return pThisTab->nVSplitPos; }
GetFixPosX() const289 	SCCOL			GetFixPosX() const						{ return pThisTab->nFixPosX; }
GetFixPosY() const290 	SCROW			GetFixPosY() const						{ return pThisTab->nFixPosY; }
IsPagebreakMode() const291 	sal_Bool			IsPagebreakMode() const					{ return bPagebreak; }
292 
293 	void			SetPosX( ScHSplitPos eWhich, SCCOL nNewPosX );
294 	void			SetPosY( ScVSplitPos eWhich, SCROW nNewPosY );
SetCurX(SCCOL nNewCurX)295 	void			SetCurX( SCCOL nNewCurX )						{ pThisTab->nCurX = nNewCurX; }
SetCurY(SCROW nNewCurY)296 	void			SetCurY( SCROW nNewCurY )						{ pThisTab->nCurY = nNewCurY; }
297 	void			SetOldCursor( SCCOL nNewX, SCROW nNewY );
298 	void			ResetOldCursor();
SetHSplitMode(ScSplitMode eMode)299 	void			SetHSplitMode( ScSplitMode eMode )				{ pThisTab->eHSplitMode = eMode; }
SetVSplitMode(ScSplitMode eMode)300 	void			SetVSplitMode( ScSplitMode eMode )				{ pThisTab->eVSplitMode = eMode; }
SetHSplitPos(long nPos)301 	void			SetHSplitPos( long nPos )						{ pThisTab->nHSplitPos = nPos; }
SetVSplitPos(long nPos)302 	void			SetVSplitPos( long nPos )						{ pThisTab->nVSplitPos = nPos; }
SetFixPosX(SCCOL nPos)303 	void			SetFixPosX( SCCOL nPos )						{ pThisTab->nFixPosX = nPos; }
SetFixPosY(SCROW nPos)304 	void			SetFixPosY( SCROW nPos )						{ pThisTab->nFixPosY = nPos; }
305 	void			SetPagebreakMode( sal_Bool bSet );
306 
307     void            SetZoomType( SvxZoomType eNew, sal_Bool bAll );
308     void            SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs );
309     void            SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs );
310     void            SetZoom( const Fraction& rNewX, const Fraction& rNewY, sal_Bool bAll );
311     void            RefreshZoom();
312 
SetSelCtrlMouseClick(sal_Bool bTmp)313 	void			SetSelCtrlMouseClick( sal_Bool bTmp ) { bSelCtrlMouseClick = bTmp; }
314 
GetZoomType() const315     SvxZoomType     GetZoomType() const     { return pThisTab->eZoomType; }
GetZoomX() const316     const Fraction&	GetZoomX() const        { return bPagebreak ? pThisTab->aPageZoomX : pThisTab->aZoomX; }
GetZoomY() const317     const Fraction&	GetZoomY() const        { return bPagebreak ? pThisTab->aPageZoomY : pThisTab->aZoomY; }
318 
319 	const MapMode&	GetLogicMode( ScSplitPos eWhich );
320 	const MapMode&	GetLogicMode();						// Offset 0
321 
GetTPosX(ScHSplitPos eWhich) const322 	long			GetTPosX( ScHSplitPos eWhich ) const		{ return pThisTab->nTPosX[eWhich]; }
GetTPosY(ScVSplitPos eWhich) const323 	long			GetTPosY( ScVSplitPos eWhich ) const		{ return pThisTab->nTPosY[eWhich]; }
324 
GetPPTX() const325 	double			GetPPTX() const { return nPPTX; }
GetPPTY() const326 	double			GetPPTY() const	{ return nPPTY; }
327 
328 	ScMarkType      GetSimpleArea( SCCOL& rStartCol, SCROW& rStartRow, SCTAB& rStartTab,
329 									SCCOL& rEndCol, SCROW& rEndRow, SCTAB& rEndTab ) const;
330 	ScMarkType      GetSimpleArea( ScRange& rRange ) const;
331                     /// May modify rNewMark using MarkToSimple().
332     ScMarkType      GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) const;
333 	void			GetMultiArea( ScRangeListRef& rRange ) const;
334 
335 	sal_Bool			SimpleColMarked();
336 	sal_Bool			SimpleRowMarked();
337 
338 	sal_Bool			IsMultiMarked();
339 
340 	void			SetFillMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
341 	void			SetDragMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
342 									sal_uInt8 nMode );
343 	void			GetFillData( SCCOL& rStartCol, SCROW& rStartRow,
344 								 SCCOL& rEndCol, SCROW& rEndRow );
345 	void			ResetFillMode();
IsAnyFillMode()346 	sal_Bool			IsAnyFillMode()				{ return nFillMode != SC_FILL_NONE; }
IsFillMode()347 	sal_Bool			IsFillMode()				{ return nFillMode == SC_FILL_FILL; }
GetFillMode()348 	sal_uInt8			GetFillMode()				{ return nFillMode; }
349 
350 					// TRUE: Zelle ist zusammengefasst
351 	sal_Bool			GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix );
352 	sal_Bool			GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
353 										SCsCOL& rPosX, SCsROW& rPosY,
354 										sal_Bool bTestMerge = sal_True, sal_Bool bRepair = sal_False,
355 										sal_Bool bNextIfLarge = sal_True );
356 	void			GetMouseQuadrant( const Point& rClickPos, ScSplitPos eWhich,
357 										SCsCOL nPosX, SCsROW nPosY, sal_Bool& rLeft, sal_Bool& rTop );
358 
IsRefMode() const359 	sal_Bool			IsRefMode() const						{ return bIsRefMode; }
GetRefType() const360 	ScRefType		GetRefType() const						{ return eRefType; }
GetRefStartX() const361 	SCCOL			GetRefStartX() const					{ return nRefStartX; }
GetRefStartY() const362 	SCROW			GetRefStartY() const					{ return nRefStartY; }
GetRefStartZ() const363 	SCTAB			GetRefStartZ() const					{ return nRefStartZ; }
GetRefEndX() const364 	SCCOL			GetRefEndX() const						{ return nRefEndX; }
GetRefEndY() const365 	SCROW			GetRefEndY() const						{ return nRefEndY; }
GetRefEndZ() const366 	SCTAB			GetRefEndZ() const						{ return nRefEndZ; }
367 
SetRefMode(sal_Bool bNewMode,ScRefType eNewType)368 	void			SetRefMode( sal_Bool bNewMode, ScRefType eNewType )
369 									{ bIsRefMode = bNewMode; eRefType = eNewType; }
370 
SetRefStart(SCCOL nNewX,SCROW nNewY,SCTAB nNewZ)371 	void			SetRefStart( SCCOL nNewX, SCROW nNewY, SCTAB nNewZ )
372 							{ nRefStartX = nNewX; nRefStartY = nNewY; nRefStartZ = nNewZ; }
SetRefEnd(SCCOL nNewX,SCROW nNewY,SCTAB nNewZ)373 	void			SetRefEnd( SCCOL nNewX, SCROW nNewY, SCTAB nNewZ )
374 							{ nRefEndX = nNewX; nRefEndY = nNewY; nRefEndZ = nNewZ; }
375 
ResetDelMark()376 	void			ResetDelMark()							{ bDelMarkValid = sal_False; }
SetDelMark(const ScRange & rRange)377 	void			SetDelMark( const ScRange& rRange )
378 							{ aDelRange = rRange; bDelMarkValid = sal_True; }
379 
GetDelMark(ScRange & rRange) const380 	sal_Bool			GetDelMark( ScRange& rRange ) const
381 							{ rRange = aDelRange; return bDelMarkValid; }
382 
383 	inline void		GetMoveCursor( SCCOL& rCurX, SCROW& rCurY );
384 
GetOptions() const385 	const ScViewOptions&	GetOptions() const { return *pOptions; }
386 	void					SetOptions( const ScViewOptions& rOpt );
387 
IsGridMode() const388 	sal_Bool	IsGridMode		() const			{ return pOptions->GetOption( VOPT_GRID ); }
SetGridMode(sal_Bool bNewMode)389 	void	SetGridMode		( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_GRID, bNewMode ); }
IsSyntaxMode() const390 	sal_Bool	IsSyntaxMode	() const			{ return pOptions->GetOption( VOPT_SYNTAX ); }
SetSyntaxMode(sal_Bool bNewMode)391 	void	SetSyntaxMode	( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_SYNTAX, bNewMode ); }
IsHeaderMode() const392 	sal_Bool	IsHeaderMode	() const			{ return pOptions->GetOption( VOPT_HEADER ); }
SetHeaderMode(sal_Bool bNewMode)393 	void	SetHeaderMode	( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_HEADER, bNewMode ); }
IsTabMode() const394 	sal_Bool	IsTabMode		() const			{ return pOptions->GetOption( VOPT_TABCONTROLS ); }
SetTabMode(sal_Bool bNewMode)395 	void	SetTabMode		( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_TABCONTROLS, bNewMode ); }
IsVScrollMode() const396 	sal_Bool	IsVScrollMode	() const			{ return pOptions->GetOption( VOPT_VSCROLL ); }
SetVScrollMode(sal_Bool bNewMode)397 	void	SetVScrollMode	( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_VSCROLL, bNewMode ); }
IsHScrollMode() const398 	sal_Bool	IsHScrollMode	() const			{ return pOptions->GetOption( VOPT_HSCROLL ); }
SetHScrollMode(sal_Bool bNewMode)399 	void	SetHScrollMode	( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_HSCROLL, bNewMode ); }
IsOutlineMode() const400 	sal_Bool	IsOutlineMode	() const			{ return pOptions->GetOption( VOPT_OUTLINER ); }
SetOutlineMode(sal_Bool bNewMode)401 	void	SetOutlineMode	( sal_Bool bNewMode )	{ pOptions->SetOption( VOPT_OUTLINER, bNewMode ); }
402 
403 	void 			KillEditView();
404 	void			ResetEditView();
405 	void			SetEditEngine( ScSplitPos eWhich,
406 									ScEditEngineDefaulter* pNewEngine,
407 									Window* pWin, SCCOL nNewX, SCROW nNewY );
408 	void			GetEditView( ScSplitPos eWhich, EditView*& rViewPtr, SCCOL& rCol, SCROW& rRow );
HasEditView(ScSplitPos eWhich) const409 	sal_Bool			HasEditView( ScSplitPos eWhich ) const
410 										{ return pEditView[eWhich] && bEditActive[eWhich]; }
GetEditView(ScSplitPos eWhich) const411 	EditView*		GetEditView( ScSplitPos eWhich ) const
412 										{ return pEditView[eWhich]; }
413 
414 	void			EditGrowX();
415 	void			EditGrowY( sal_Bool bInitial = sal_False );
416 
GetEditActivePart() const417     ScSplitPos      GetEditActivePart() const       { return eEditActivePart; }
GetEditViewCol() const418 	SCCOL			GetEditViewCol() const			{ return nEditCol; }
GetEditViewRow() const419 	SCROW			GetEditViewRow() const			{ return nEditRow; }
GetEditStartCol() const420 	SCCOL			GetEditStartCol() const			{ return nEditStartCol; }
GetEditStartRow() const421 	SCROW			GetEditStartRow() const			{ return nEditRow; }		// never editing above the cell
GetEditEndCol() const422 	SCCOL			GetEditEndCol() const			{ return nEditEndCol; }
GetEditEndRow() const423 	SCROW			GetEditEndRow() const			{ return nEditEndRow; }
424 
425 	Rectangle		GetEditArea( ScSplitPos eWhich, SCCOL nPosX, SCROW nPosY, Window* pWin,
426 									const ScPatternAttr* pPattern, sal_Bool bForceToTop );
427 
428 	void			SetTabNo( SCTAB nNewTab );
429 	void			SetActivePart( ScSplitPos eNewActive );
430 
431 	Point			GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
432 								sal_Bool bAllowNeg = sal_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;		// angezeigte komplette Zellen
440 	SCROW			VisibleCellsY( ScVSplitPos eWhichY ) const;
441 	SCCOL			PrevCellsX( ScHSplitPos eWhichX ) const;		// Zellen auf der vorgehenden Seite
442 	SCROW			PrevCellsY( ScVSplitPos eWhichY ) const;
443 //UNUSED2008-05  SCCOL           LastCellsX( ScHSplitPos eWhichX ) const;        // Zellen auf der letzten Seite
444 //UNUSED2008-05  SCROW           LastCellsY( ScVSplitPos eWhichY ) const;
445 
446 	sal_Bool			IsOle();
447 //UNUSED2008-05  void            UpdateOle( ScSplitPos eWhich );
448 	void			SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
449 	void			SetScreen( const Rectangle& rVisArea );
450 	void			SetScreenPos( const Point& rVisAreaStart );
451 
452 	void			UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY );
453 
GetScrSize() const454 	Size			GetScrSize() const				{ return aScrSize; }
455 
456 	void			RecalcPixPos();
GetPixPos(ScSplitPos eWhich) const457 	Point			GetPixPos( ScSplitPos eWhich ) const
458 					{ return Point( pThisTab->nPixPosX[WhichH(eWhich)],
459 									pThisTab->nPixPosY[WhichV(eWhich)] ); }
SetSpellingView(EditView * pSpView)460 	void 			SetSpellingView( EditView* pSpView) { pSpellingView = pSpView; }
GetSpellingView() const461 	EditView*		GetSpellingView() const { return pSpellingView; }
462 
463 	void			UpdateOutlinerFlags( Outliner& rOutl ) const;
464 
465 	Point			GetMousePosPixel();
466 
467 	sal_Bool			UpdateFixX(SCTAB nTab = MAXTAB+1);
468 	sal_Bool			UpdateFixY(SCTAB nTab = MAXTAB+1);
469 
GetTabStartCol() const470 	SCCOL			GetTabStartCol() const			{ return nTabStartCol; }
SetTabStartCol(SCCOL nNew)471 	void			SetTabStartCol(SCCOL nNew)		{ nTabStartCol = nNew; }
472 
473 	ScAddress		GetCurPos() const;
474 
GetScenButSize() const475 	const Size&		GetScenButSize() const				{ return aScenButSize; }
SetScenButSize(const Size & rNew)476 	void			SetScenButSize(const Size& rNew)	{ aScenButSize = rNew; }
477 
IsSelCtrlMouseClick()478 	sal_Bool			IsSelCtrlMouseClick() { return bSelCtrlMouseClick; }
479 
480 	static inline long ToPixel( sal_uInt16 nTwips, double nFactor );
481 
482     /** while (rScrY <= nEndPixels && rPosY <= nEndRow) add pixels of row
483         heights converted with nPPTY to rScrY, optimized for row height
484         segments. Upon return rPosY is the last row evaluated <= nEndRow, rScrY
485         may be > nEndPixels!
486      */
487     static void     AddPixelsWhile( long & rScrY, long nEndPixels,
488                                     SCROW & rPosY, SCROW nEndRow, double nPPTY,
489                                     const ScDocument * pDoc, SCTAB nTabNo );
490 
491     /** while (rScrY <= nEndPixels && rPosY >= nStartRow) add pixels of row
492         heights converted with nPPTY to rScrY, optimized for row height
493         segments. Upon return rPosY is the last row evaluated >= nStartRow,
494         rScrY may be > nEndPixels!
495      */
496     static void     AddPixelsWhileBackward( long & rScrY, long nEndPixels,
497                                     SCROW & rPosY, SCROW nStartRow, double nPPTY,
498                                     const ScDocument * pDoc, SCTAB nTabNo );
499 };
500 
501 
502 // ---------------------------------------------------------------------------
503 
ToPixel(sal_uInt16 nTwips,double nFactor)504 inline long ScViewData::ToPixel( sal_uInt16 nTwips, double nFactor )
505 {
506 	long nRet = (long)( nTwips * nFactor );
507 	if ( !nRet && nTwips )
508 		nRet = 1;
509 	return nRet;
510 }
511 
GetMoveCursor(SCCOL & rCurX,SCROW & rCurY)512 inline void ScViewData::GetMoveCursor( SCCOL& rCurX, SCROW& rCurY )
513 {
514 	if ( bIsRefMode )
515 	{
516 		rCurX = nRefEndX;
517 		rCurY = nRefEndY;
518 	}
519 	else
520 	{
521 		rCurX = GetCurX();
522 		rCurY = GetCurY();
523 	}
524 }
525 
WhichH(ScSplitPos ePos)526 inline ScHSplitPos WhichH( ScSplitPos ePos )
527 {
528 	return (ePos==SC_SPLIT_TOPLEFT || ePos==SC_SPLIT_BOTTOMLEFT) ?
529 				SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
530 }
531 
WhichV(ScSplitPos ePos)532 inline ScVSplitPos WhichV( ScSplitPos ePos )
533 {
534 	return (ePos==SC_SPLIT_TOPLEFT || ePos==SC_SPLIT_TOPRIGHT) ?
535 				SC_SPLIT_TOP : SC_SPLIT_BOTTOM;
536 }
537 
Which(ScHSplitPos eHPos)538 inline ScSplitPos Which( ScHSplitPos eHPos )
539 {
540 	return (eHPos==SC_SPLIT_LEFT) ?
541 				SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
542 }
543 
Which(ScVSplitPos eVPos)544 inline ScSplitPos Which( ScVSplitPos eVPos )
545 {
546 	return (eVPos==SC_SPLIT_TOP) ?
547 				SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT;
548 }
549 
550 
551 
552 #endif
553 
554