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