Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef SC_VIEWDATA_HXX
29 : : #define SC_VIEWDATA_HXX
30 : :
31 : : #include <sfx2/zoomitem.hxx>
32 : : #include "scdllapi.h"
33 : : #include "viewopti.hxx"
34 : :
35 : : #include <boost/scoped_ptr.hpp>
36 : :
37 : : // ---------------------------------------------------------------------------
38 : :
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 : : /** Screen behavior related to cursor movements */
61 : : enum ScFollowMode { SC_FOLLOW_NONE, SC_FOLLOW_LINE, SC_FOLLOW_FIX, SC_FOLLOW_JUMP };
62 : :
63 : : /** Mouse mode to select areas */
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 : : enum ScPasteFlags
90 : : {
91 : : SC_PASTE_NONE = 0, // No flags specified
92 : : SC_PASTE_MODE = 1, // Enable paste-mode
93 : : SC_PASTE_BORDER = 2, // Show a border around the source cells
94 : : };
95 : :
96 : : class ScDocFunc;
97 : : class ScDocShell;
98 : : class ScDocument;
99 : : class ScDBFunc;
100 : : class ScTabViewShell;
101 : : class ScDrawView;
102 : : class ScEditEngineDefaulter;
103 : : class EditView;
104 : : class EditStatus;
105 : : class Outliner;
106 : : class Window;
107 : : class SfxObjectShell;
108 : : class SfxBindings;
109 : : class SfxDispatcher;
110 : : class ScPatternAttr;
111 : : class ScRangeListRef;
112 : : class ScExtDocOptions;
113 : : class ScViewData;
114 : : class ScMarkData;
115 : :
116 : : //--------------------------------------------------------------------------
117 : :
118 : 0 : class ScViewDataTable // per-sheet data
119 : : {
120 : : friend class ScViewData;
121 : : private:
122 : : SvxZoomType eZoomType; // selected zoom type (normal view)
123 : : Fraction aZoomX; // selected zoom X
124 : : Fraction aZoomY; // selected zoom Y (displayed)
125 : : Fraction aPageZoomX; // zoom in page break preview mode
126 : : Fraction aPageZoomY;
127 : :
128 : : long nTPosX[2]; // MapMode - Offset (Twips)
129 : : long nTPosY[2];
130 : : long nMPosX[2]; // MapMode - Offset (1/100 mm)
131 : : long nMPosY[2];
132 : : long nPixPosX[2]; // Offset in Pixels
133 : : long nPixPosY[2];
134 : : long nHSplitPos;
135 : : long nVSplitPos;
136 : :
137 : : ScSplitMode eHSplitMode;
138 : : ScSplitMode eVSplitMode;
139 : : ScSplitPos eWhichActive;
140 : :
141 : : SCCOL nFixPosX; // Cell position of the splitter when freeze pane
142 : : SCROW nFixPosY;
143 : :
144 : : SCCOL nCurX;
145 : : SCROW nCurY;
146 : : SCCOL nOldCurX;
147 : : SCROW nOldCurY;
148 : : SCCOL nPosX[2];
149 : : SCROW nPosY[2];
150 : :
151 : : bool bShowGrid; // per sheet show grid lines option.
152 : : bool mbOldCursorValid; // "virtual" Cursor position when combined
153 : : ScViewDataTable();
154 : :
155 : : void WriteUserDataSequence(
156 : : com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings,
157 : : const ScViewData& rViewData, SCTAB nTab ) const;
158 : :
159 : : void ReadUserDataSequence(
160 : : const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings,
161 : : ScViewData& rViewData, SCTAB nTab, bool& rHasZoom);
162 : : public:
163 : : ~ScViewDataTable();
164 : : };
165 : :
166 : : // ---------------------------------------------------------------------------
167 : :
168 : : class SC_DLLPUBLIC ScViewData
169 : : {
170 : : private:
171 : : double nPPTX, nPPTY; // Scaling factors
172 : :
173 : : ::std::vector<ScViewDataTable*> maTabData;
174 : : boost::scoped_ptr<ScMarkData> mpMarkData;
175 : : ScViewDataTable* pThisTab; // Data of the displayed sheet
176 : : ScDocShell* pDocShell;
177 : : ScDocument* pDoc;
178 : : ScDBFunc* pView;
179 : : ScTabViewShell* pViewShell;
180 : : EditView* pEditView[4]; // Belongs to the window
181 : : ScViewOptions* pOptions;
182 : : EditView* pSpellingView;
183 : :
184 : : long nEditMargin;
185 : :
186 : : Size aScenButSize;
187 : :
188 : : Size aScrSize;
189 : : MapMode aLogicMode; // skalierter 1/100mm-MapMode
190 : :
191 : : SvxZoomType eDefZoomType; // default zoom and type for missing TabData
192 : : Fraction aDefZoomX;
193 : : Fraction aDefZoomY;
194 : : Fraction aDefPageZoomX; // zoom in page break preview mode
195 : : Fraction aDefPageZoomY;
196 : :
197 : : ScRefType eRefType;
198 : :
199 : : SCTAB nTabNo; // displayed sheet
200 : : SCTAB nRefTabNo; // sheet which contains RefInput
201 : : SCCOL nRefStartX;
202 : : SCROW nRefStartY;
203 : : SCTAB nRefStartZ;
204 : : SCCOL nRefEndX;
205 : : SCROW nRefEndY;
206 : : SCTAB nRefEndZ;
207 : : SCCOL nFillStartX; // Fill Cursor
208 : : SCROW nFillStartY;
209 : : SCCOL nFillEndX;
210 : : SCROW nFillEndY;
211 : : SCCOL nEditCol; // Related position
212 : : SCROW nEditRow;
213 : : SCCOL nEditStartCol;
214 : : SCCOL nEditEndCol; // End of Edit View
215 : : SCROW nEditEndRow;
216 : : SCCOL nTabStartCol; // for Enter after Tab
217 : : ScRange aDelRange; // for delete AutoFill
218 : :
219 : : ScPasteFlags nPasteFlags;
220 : :
221 : : ScSplitPos eEditActivePart; // the part that was active when edit mode was started
222 : : sal_uInt8 nFillMode;
223 : : bool bEditActive[4]; // Active?
224 : : bool bActive:1; // Active Window ?
225 : : bool bIsRefMode:1; // Reference input
226 : : bool bDelMarkValid:1; // Only valid at SC_REFTYPE_FILL
227 : : bool bPagebreak:1; // Page break preview mode
228 : : bool bSelCtrlMouseClick:1; // special selection handling for ctrl-mouse-click
229 : :
230 : : SC_DLLPRIVATE DECL_LINK (EmptyEditHdl, void*);
231 : : SC_DLLPRIVATE DECL_LINK (EditEngineHdl, EditStatus*);
232 : :
233 : : SC_DLLPRIVATE void CalcPPT();
234 : : SC_DLLPRIVATE void CreateTabData( SCTAB nNewTab );
235 : : SC_DLLPRIVATE void CreateTabData( std::vector< SCTAB >& rvTabs );
236 : : SC_DLLPRIVATE void CreateSelectedTabData();
237 : : SC_DLLPRIVATE void EnsureTabDataSize(size_t nSize);
238 : : SC_DLLPRIVATE void UpdateCurrentTab();
239 : :
240 : : public:
241 : : ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh );
242 : : ScViewData( const ScViewData& rViewData );
243 : : ~ScViewData();
244 : :
245 : : void InitData( ScDocument* pDocument );
246 : :
247 : 31730 : ScDocShell* GetDocShell() const { return pDocShell; }
248 : : ScDocFunc& GetDocFunc() const;
249 : 27880 : ScDBFunc* GetView() const { return pView; }
250 : 33529 : ScTabViewShell* GetViewShell() const { return pViewShell; }
251 : :
252 : : SfxObjectShell* GetSfxDocShell() const;
253 : : SfxBindings& GetBindings(); // from ViewShell's ViewFrame
254 : : SfxDispatcher& GetDispatcher(); // from ViewShell's ViewFrame
255 : :
256 : : ScMarkData& GetMarkData();
257 : : const ScMarkData& GetMarkData() const;
258 : :
259 : : Window* GetDialogParent(); // forwarded from tabvwsh
260 : : Window* GetActiveWin(); // from View
261 : : ScDrawView* GetScDrawView(); // from View
262 : : sal_Bool IsMinimized(); // from View
263 : :
264 : : void UpdateInputHandler( sal_Bool bForce = false, sal_Bool bStopEditing = sal_True );
265 : :
266 : : void WriteUserData(String& rData);
267 : : void ReadUserData(const String& rData);
268 : : void WriteExtOptions( ScExtDocOptions& rOpt ) const;
269 : : void ReadExtOptions( const ScExtDocOptions& rOpt );
270 : : void WriteUserDataSequence(com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings) const;
271 : : void ReadUserDataSequence(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings);
272 : :
273 : : ScDocument* GetDocument() const;
274 : :
275 : 8460 : bool IsActive() const { return bActive; }
276 : 454 : void Activate(bool bActivate) { bActive = bActivate; }
277 : :
278 : : void InsertTab( SCTAB nTab );
279 : : void InsertTabs( SCTAB nTab, SCTAB nNewSheets );
280 : : void DeleteTab( SCTAB nTab );
281 : : void DeleteTabs( SCTAB nTab, SCTAB nSheets );
282 : : void CopyTab( SCTAB nSrcTab, SCTAB nDestTab );
283 : : void MoveTab( SCTAB nSrcTab, SCTAB nDestTab );
284 : :
285 : 0 : SCTAB GetRefTabNo() const { return nRefTabNo; }
286 : 303 : void SetRefTabNo( SCTAB nNewTab ) { nRefTabNo = nNewTab; }
287 : :
288 : 144848 : SCTAB GetTabNo() const { return nTabNo; }
289 : 14742 : ScSplitPos GetActivePart() const { return pThisTab->eWhichActive; }
290 : 44824 : SCCOL GetPosX( ScHSplitPos eWhich ) const { return pThisTab->nPosX[eWhich]; }
291 : 49423 : SCROW GetPosY( ScVSplitPos eWhich ) const { return pThisTab->nPosY[eWhich]; }
292 : 26985 : SCCOL GetCurX() const { return pThisTab->nCurX; }
293 : 25618 : SCROW GetCurY() const { return pThisTab->nCurY; }
294 : : bool HasOldCursor() const { return pThisTab->mbOldCursorValid; }
295 : : SCCOL GetOldCurX() const;
296 : : SCROW GetOldCurY() const;
297 : 10287 : ScSplitMode GetHSplitMode() const { return pThisTab->eHSplitMode; }
298 : 13318 : ScSplitMode GetVSplitMode() const { return pThisTab->eVSplitMode; }
299 : 0 : long GetHSplitPos() const { return pThisTab->nHSplitPos; }
300 : 0 : long GetVSplitPos() const { return pThisTab->nVSplitPos; }
301 : 0 : SCCOL GetFixPosX() const { return pThisTab->nFixPosX; }
302 : 0 : SCROW GetFixPosY() const { return pThisTab->nFixPosY; }
303 : 6170 : bool IsPagebreakMode() const { return bPagebreak; }
304 : 0 : bool IsPasteMode() const { return nPasteFlags & SC_PASTE_MODE; }
305 : 1196 : bool ShowPasteSource() const { return nPasteFlags & SC_PASTE_BORDER; }
306 : :
307 : : void SetPosX( ScHSplitPos eWhich, SCCOL nNewPosX );
308 : : void SetPosY( ScVSplitPos eWhich, SCROW nNewPosY );
309 : 310 : void SetCurX( SCCOL nNewCurX ) { pThisTab->nCurX = nNewCurX; }
310 : 310 : void SetCurY( SCROW nNewCurY ) { pThisTab->nCurY = nNewCurY; }
311 : : void SetOldCursor( SCCOL nNewX, SCROW nNewY );
312 : : void ResetOldCursor();
313 : 0 : void SetHSplitMode( ScSplitMode eMode ) { pThisTab->eHSplitMode = eMode; }
314 : 0 : void SetVSplitMode( ScSplitMode eMode ) { pThisTab->eVSplitMode = eMode; }
315 : 0 : void SetHSplitPos( long nPos ) { pThisTab->nHSplitPos = nPos; }
316 : 0 : void SetVSplitPos( long nPos ) { pThisTab->nVSplitPos = nPos; }
317 : 0 : void SetFixPosX( SCCOL nPos ) { pThisTab->nFixPosX = nPos; }
318 : 0 : void SetFixPosY( SCROW nPos ) { pThisTab->nFixPosY = nPos; }
319 : : void SetPagebreakMode( bool bSet );
320 : 0 : void SetPasteMode ( ScPasteFlags nFlags ) { nPasteFlags = nFlags; }
321 : :
322 : : void SetZoomType( SvxZoomType eNew, sal_Bool bAll );
323 : : void SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs );
324 : : void SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs );
325 : : void SetZoom( const Fraction& rNewX, const Fraction& rNewY, sal_Bool bAll );
326 : : void RefreshZoom();
327 : :
328 : 0 : void SetSelCtrlMouseClick( bool bTmp ) { bSelCtrlMouseClick = bTmp; }
329 : :
330 : 985 : SvxZoomType GetZoomType() const { return pThisTab->eZoomType; }
331 [ - + ]: 10544 : const Fraction& GetZoomX() const { return bPagebreak ? pThisTab->aPageZoomX : pThisTab->aZoomX; }
332 [ - + ]: 11375 : const Fraction& GetZoomY() const { return bPagebreak ? pThisTab->aPageZoomY : pThisTab->aZoomY; }
333 : :
334 : : void SetShowGrid( bool bShow );
335 : 1515 : bool GetShowGrid() const { return pThisTab->bShowGrid; }
336 : :
337 : : const MapMode& GetLogicMode( ScSplitPos eWhich );
338 : : const MapMode& GetLogicMode(); // Offset 0
339 : :
340 : : long GetTPosX( ScHSplitPos eWhich ) const { return pThisTab->nTPosX[eWhich]; }
341 : : long GetTPosY( ScVSplitPos eWhich ) const { return pThisTab->nTPosY[eWhich]; }
342 : :
343 : 24904 : double GetPPTX() const { return nPPTX; }
344 : 52447 : double GetPPTY() const { return nPPTY; }
345 : :
346 : : ScMarkType GetSimpleArea( SCCOL& rStartCol, SCROW& rStartRow, SCTAB& rStartTab,
347 : : SCCOL& rEndCol, SCROW& rEndRow, SCTAB& rEndTab ) const;
348 : : ScMarkType GetSimpleArea( ScRange& rRange ) const;
349 : : /// May modify rNewMark using MarkToSimple().
350 : : ScMarkType GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) const;
351 : : void GetMultiArea( ScRangeListRef& rRange ) const;
352 : :
353 : : sal_Bool SimpleColMarked();
354 : : sal_Bool SimpleRowMarked();
355 : :
356 : : sal_Bool IsMultiMarked();
357 : :
358 : : void SetFillMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
359 : : void SetDragMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
360 : : sal_uInt8 nMode );
361 : : void GetFillData( SCCOL& rStartCol, SCROW& rStartRow,
362 : : SCCOL& rEndCol, SCROW& rEndRow );
363 : : void ResetFillMode();
364 : 24 : sal_Bool IsAnyFillMode() { return nFillMode != SC_FILL_NONE; }
365 : 2 : sal_Bool IsFillMode() { return nFillMode == SC_FILL_FILL; }
366 : 2 : sal_uInt8 GetFillMode() { return nFillMode; }
367 : :
368 : : // TRUE: Cell is merged
369 : : sal_Bool GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix );
370 : : sal_Bool GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
371 : : SCsCOL& rPosX, SCsROW& rPosY,
372 : : sal_Bool bTestMerge = sal_True, sal_Bool bRepair = false,
373 : : sal_Bool bNextIfLarge = sal_True );
374 : : void GetMouseQuadrant( const Point& rClickPos, ScSplitPos eWhich,
375 : : SCsCOL nPosX, SCsROW nPosY, sal_Bool& rLeft, sal_Bool& rTop );
376 : :
377 : 2478 : bool IsRefMode() const { return bIsRefMode; }
378 : 0 : ScRefType GetRefType() const { return eRefType; }
379 : 0 : SCCOL GetRefStartX() const { return nRefStartX; }
380 : 0 : SCROW GetRefStartY() const { return nRefStartY; }
381 : 0 : SCTAB GetRefStartZ() const { return nRefStartZ; }
382 : 0 : SCCOL GetRefEndX() const { return nRefEndX; }
383 : 0 : SCROW GetRefEndY() const { return nRefEndY; }
384 : 0 : SCTAB GetRefEndZ() const { return nRefEndZ; }
385 : :
386 : 0 : void SetRefMode( bool bNewMode, ScRefType eNewType )
387 : 0 : { bIsRefMode = bNewMode; eRefType = eNewType; }
388 : :
389 : 2 : void SetRefStart( SCCOL nNewX, SCROW nNewY, SCTAB nNewZ )
390 : 2 : { nRefStartX = nNewX; nRefStartY = nNewY; nRefStartZ = nNewZ; }
391 : 0 : void SetRefEnd( SCCOL nNewX, SCROW nNewY, SCTAB nNewZ )
392 : 0 : { nRefEndX = nNewX; nRefEndY = nNewY; nRefEndZ = nNewZ; }
393 : :
394 : 0 : void ResetDelMark() { bDelMarkValid = false; }
395 : 0 : void SetDelMark( const ScRange& rRange )
396 : 0 : { aDelRange = rRange; bDelMarkValid = true; }
397 : :
398 : 0 : bool GetDelMark( ScRange& rRange ) const
399 : 0 : { rRange = aDelRange; return bDelMarkValid; }
400 : :
401 : : inline void GetMoveCursor( SCCOL& rCurX, SCROW& rCurY );
402 : :
403 : 9121 : const ScViewOptions& GetOptions() const { return *pOptions; }
404 : : void SetOptions( const ScViewOptions& rOpt );
405 : :
406 : 0 : sal_Bool IsGridMode () const { return pOptions->GetOption( VOPT_GRID ); }
407 : 233 : void SetGridMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_GRID, bNewMode ); }
408 : 1278 : sal_Bool IsSyntaxMode () const { return pOptions->GetOption( VOPT_SYNTAX ); }
409 : 233 : void SetSyntaxMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_SYNTAX, bNewMode ); }
410 : 3043 : sal_Bool IsHeaderMode () const { return pOptions->GetOption( VOPT_HEADER ); }
411 : 233 : void SetHeaderMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_HEADER, bNewMode ); }
412 : 2292 : sal_Bool IsTabMode () const { return pOptions->GetOption( VOPT_TABCONTROLS ); }
413 : 233 : void SetTabMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_TABCONTROLS, bNewMode ); }
414 : 3043 : sal_Bool IsVScrollMode () const { return pOptions->GetOption( VOPT_VSCROLL ); }
415 : 233 : void SetVScrollMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_VSCROLL, bNewMode ); }
416 : 2061 : sal_Bool IsHScrollMode () const { return pOptions->GetOption( VOPT_HSCROLL ); }
417 : 233 : void SetHScrollMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_HSCROLL, bNewMode ); }
418 : 3043 : sal_Bool IsOutlineMode () const { return pOptions->GetOption( VOPT_OUTLINER ); }
419 : 233 : void SetOutlineMode ( sal_Bool bNewMode ) { pOptions->SetOption( VOPT_OUTLINER, bNewMode ); }
420 : :
421 : : void KillEditView();
422 : : void ResetEditView();
423 : : void SetEditEngine( ScSplitPos eWhich,
424 : : ScEditEngineDefaulter* pNewEngine,
425 : : Window* pWin, SCCOL nNewX, SCROW nNewY );
426 : : void GetEditView( ScSplitPos eWhich, EditView*& rViewPtr, SCCOL& rCol, SCROW& rRow );
427 : 15820 : bool HasEditView( ScSplitPos eWhich ) const
428 [ - + ][ # # ]: 15820 : { return pEditView[eWhich] && bEditActive[eWhich]; }
429 : 0 : EditView* GetEditView( ScSplitPos eWhich ) const
430 : 0 : { return pEditView[eWhich]; }
431 : :
432 : : void EditGrowX();
433 : : void EditGrowY( sal_Bool bInitial = false );
434 : :
435 : 0 : ScSplitPos GetEditActivePart() const { return eEditActivePart; }
436 : 0 : SCCOL GetEditViewCol() const { return nEditCol; }
437 : 0 : SCROW GetEditViewRow() const { return nEditRow; }
438 : 1315 : SCCOL GetEditStartCol() const { return nEditStartCol; }
439 : 1315 : SCROW GetEditStartRow() const { return nEditRow; } // never editing above the cell
440 : 1315 : SCCOL GetEditEndCol() const { return nEditEndCol; }
441 : 1315 : SCROW GetEditEndRow() const { return nEditEndRow; }
442 : :
443 : : Rectangle GetEditArea( ScSplitPos eWhich, SCCOL nPosX, SCROW nPosY, Window* pWin,
444 : : const ScPatternAttr* pPattern, sal_Bool bForceToTop );
445 : :
446 : : void SetTabNo( SCTAB nNewTab );
447 : : void SetActivePart( ScSplitPos eNewActive );
448 : :
449 : : Point GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
450 : : sal_Bool bAllowNeg = false ) const;
451 : : Point GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScHSplitPos eWhich ) const;
452 : : Point GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScVSplitPos eWhich ) const;
453 : :
454 : : SCCOL CellsAtX( SCsCOL nPosX, SCsCOL nDir, ScHSplitPos eWhichX, sal_uInt16 nScrSizeY = SC_SIZE_NONE ) const;
455 : : SCROW CellsAtY( SCsROW nPosY, SCsROW nDir, ScVSplitPos eWhichY, sal_uInt16 nScrSizeX = SC_SIZE_NONE ) const;
456 : :
457 : : SCCOL VisibleCellsX( ScHSplitPos eWhichX ) const; // Completely visible cell
458 : : SCROW VisibleCellsY( ScVSplitPos eWhichY ) const;
459 : : SCCOL PrevCellsX( ScHSplitPos eWhichX ) const; // Cells on the preceding page
460 : : SCROW PrevCellsY( ScVSplitPos eWhichY ) const;
461 : :
462 : : sal_Bool IsOle();
463 : : void SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
464 : : void SetScreen( const Rectangle& rVisArea );
465 : : void SetScreenPos( const Point& rVisAreaStart );
466 : :
467 : : void UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY );
468 : :
469 : 7 : Size GetScrSize() const { return aScrSize; }
470 : :
471 : : void RecalcPixPos();
472 : 12950 : Point GetPixPos( ScSplitPos eWhich ) const
473 : 12950 : { return Point( pThisTab->nPixPosX[WhichH(eWhich)],
474 : 25900 : pThisTab->nPixPosY[WhichV(eWhich)] ); }
475 : 0 : void SetSpellingView( EditView* pSpView) { pSpellingView = pSpView; }
476 : 0 : EditView* GetSpellingView() const { return pSpellingView; }
477 : :
478 : : void UpdateOutlinerFlags( Outliner& rOutl ) const;
479 : :
480 : : Point GetMousePosPixel();
481 : :
482 : : sal_Bool UpdateFixX(SCTAB nTab = MAXTAB+1);
483 : : sal_Bool UpdateFixY(SCTAB nTab = MAXTAB+1);
484 : :
485 : 0 : SCCOL GetTabStartCol() const { return nTabStartCol; }
486 : 306 : void SetTabStartCol(SCCOL nNew) { nTabStartCol = nNew; }
487 : :
488 : : ScAddress GetCurPos() const;
489 : :
490 : 0 : const Size& GetScenButSize() const { return aScenButSize; }
491 : 0 : void SetScenButSize(const Size& rNew) { aScenButSize = rNew; }
492 : :
493 : 2 : bool IsSelCtrlMouseClick() { return bSelCtrlMouseClick; }
494 : :
495 : : static inline long ToPixel( sal_uInt16 nTwips, double nFactor );
496 : :
497 : : /** while (rScrY <= nEndPixels && rPosY <= nEndRow) add pixels of row
498 : : heights converted with nPPTY to rScrY, optimized for row height
499 : : segments. Upon return rPosY is the last row evaluated <= nEndRow, rScrY
500 : : may be > nEndPixels!
501 : : */
502 : : static void AddPixelsWhile( long & rScrY, long nEndPixels,
503 : : SCROW & rPosY, SCROW nEndRow, double nPPTY,
504 : : const ScDocument * pDoc, SCTAB nTabNo );
505 : :
506 : : /** while (rScrY <= nEndPixels && rPosY >= nStartRow) add pixels of row
507 : : heights converted with nPPTY to rScrY, optimized for row height
508 : : segments. Upon return rPosY is the last row evaluated >= nStartRow,
509 : : rScrY may be > nEndPixels!
510 : : */
511 : : static void AddPixelsWhileBackward( long & rScrY, long nEndPixels,
512 : : SCROW & rPosY, SCROW nStartRow, double nPPTY,
513 : : const ScDocument * pDoc, SCTAB nTabNo );
514 : : };
515 : :
516 : :
517 : : // ---------------------------------------------------------------------------
518 : :
519 : 1296359 : inline long ScViewData::ToPixel( sal_uInt16 nTwips, double nFactor )
520 : : {
521 : 1296359 : long nRet = (long)( nTwips * nFactor );
522 [ + + ][ - + ]: 1296359 : if ( !nRet && nTwips )
523 : 0 : nRet = 1;
524 : 1296359 : return nRet;
525 : : }
526 : :
527 : 0 : inline void ScViewData::GetMoveCursor( SCCOL& rCurX, SCROW& rCurY )
528 : : {
529 [ # # ]: 0 : if ( bIsRefMode )
530 : : {
531 : 0 : rCurX = nRefEndX;
532 : 0 : rCurY = nRefEndY;
533 : : }
534 : : else
535 : : {
536 : 0 : rCurX = GetCurX();
537 : 0 : rCurY = GetCurY();
538 : : }
539 : 0 : }
540 : :
541 : 21034 : inline ScHSplitPos WhichH( ScSplitPos ePos )
542 : : {
543 : : return (ePos==SC_SPLIT_TOPLEFT || ePos==SC_SPLIT_BOTTOMLEFT) ?
544 [ + - ][ - + ]: 21034 : SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
545 : : }
546 : :
547 : 21038 : inline ScVSplitPos WhichV( ScSplitPos ePos )
548 : : {
549 : : return (ePos==SC_SPLIT_TOPLEFT || ePos==SC_SPLIT_TOPRIGHT) ?
550 [ + - ][ + - ]: 21038 : SC_SPLIT_TOP : SC_SPLIT_BOTTOM;
551 : : }
552 : :
553 : : inline ScSplitPos Which( ScHSplitPos eHPos )
554 : : {
555 : : return (eHPos==SC_SPLIT_LEFT) ?
556 : : SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
557 : : }
558 : :
559 : : inline ScSplitPos Which( ScVSplitPos eVPos )
560 : : {
561 : : return (eVPos==SC_SPLIT_TOP) ?
562 : : SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT;
563 : : }
564 : :
565 : :
566 : :
567 : : #endif
568 : :
569 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|