xref: /aoo42x/main/sc/inc/table.hxx (revision 86e1cf34)
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 
24 #ifndef SC_TABLE_HXX
25 #define SC_TABLE_HXX
26 
27 #include <vector>
28 #include <memory>
29 #include <utility>
30 #include <tools/gen.hxx>
31 #include <tools/color.hxx>
32 #include <com/sun/star/uno/Sequence.hxx>
33 #include "column.hxx"
34 #include "sortparam.hxx"
35 #include "compressedarray.hxx"
36 
37 #include <memory>
38 #include <set>
39 #include <boost/shared_ptr.hpp>
40 
41 namespace utl {
42 	class SearchParam;
43 	class TextSearch;
44 }
45 
46 namespace com { namespace sun { namespace star {
47     namespace sheet {
48         struct TablePageBreakData;
49     }
50 } } }
51 
52 class SfxItemSet;
53 class SfxStyleSheetBase;
54 class SvxBoxInfoItem;
55 class SvxBoxItem;
56 class SvxSearchItem;
57 
58 class ScAutoFormat;
59 class ScAutoFormatData;
60 class ScBaseCell;
61 class ScDocument;
62 class ScDrawLayer;
63 class ScFormulaCell;
64 class ScOutlineTable;
65 class ScPostIt;
66 class ScPrintSaverTab;
67 class ScProgress;
68 class ScProgress;
69 class ScRangeList;
70 class ScSheetEvents;
71 class ScSortInfoArray;
72 class ScStyleSheet;
73 class ScTableLink;
74 class ScTableProtection;
75 class ScUserListData;
76 struct RowInfo;
77 struct ScFunctionData;
78 struct ScLineFlags;
79 class CollatorWrapper;
80 class ScFlatUInt16RowSegments;
81 class ScFlatBoolRowSegments;
82 class ScFlatBoolColSegments;
83 
84 
85 struct ScShowRowsEntry
86 {
87     SCROW   mnRow1;
88     SCROW   mnRow2;
89     bool    mbShow;
90 
ScShowRowsEntryScShowRowsEntry91     ScShowRowsEntry( SCROW nR1, SCROW nR2, bool bS ) :
92         mnRow1(nR1), mnRow2(nR2), mbShow(bS) {}
93 };
94 
95 
96 class ScTable
97 {
98 private:
99     typedef ::std::vector< ScRange > ScRangeVec;
100     typedef ::std::pair< SCCOL, SCROW > ScAddress2D;
101     typedef ::std::vector< ScAddress2D > ScAddress2DVec;
102     typedef ::std::auto_ptr< ScAddress2DVec > ScAddress2DVecPtr;
103 
104 											//	Daten pro Tabelle	------------------
105 	ScColumn		aCol[MAXCOLCOUNT];
106 
107 	String			aName;
108 	String			aCodeName;
109 	String			aComment;
110 	sal_Bool			bScenario;
111 	sal_Bool			bLayoutRTL;
112     sal_Bool            bLoadingRTL;
113 
114 	String			aLinkDoc;
115 	String			aLinkFlt;
116 	String			aLinkOpt;
117 	String			aLinkTab;
118 	sal_uLong			nLinkRefreshDelay;
119 	sal_uInt8			nLinkMode;
120 
121 	// Seitenformatvorlage
122 	String			aPageStyle;
123 	sal_Bool			bPageSizeValid;
124 	Size			aPageSizeTwips;					// Groesse der Druck-Seite
125 	SCCOL			nRepeatStartX;					// Wiederholungszeilen/Spalten
126 	SCCOL			nRepeatEndX;					// REPEAT_NONE, wenn nicht benutzt
127 	SCROW			nRepeatStartY;
128 	SCROW			nRepeatEndY;
129 
130     ::std::auto_ptr<ScTableProtection> pTabProtection;
131 
132 	sal_uInt16*			pColWidth;
133     ::boost::shared_ptr<ScFlatUInt16RowSegments> mpRowHeights;
134 
135 	sal_uInt8*			pColFlags;
136 	ScBitMaskCompressedArray< SCROW, sal_uInt8>*     pRowFlags;
137     ::boost::shared_ptr<ScFlatBoolColSegments>  mpHiddenCols;
138     ::boost::shared_ptr<ScFlatBoolRowSegments>  mpHiddenRows;
139     ::boost::shared_ptr<ScFlatBoolColSegments>  mpFilteredCols;
140     ::boost::shared_ptr<ScFlatBoolRowSegments>  mpFilteredRows;
141 
142     ::std::set<SCROW>                      maRowPageBreaks;
143     ::std::set<SCROW>                      maRowManualBreaks;
144     ::std::set<SCCOL>                      maColPageBreaks;
145     ::std::set<SCCOL>                      maColManualBreaks;
146 
147 	ScOutlineTable*	pOutlineTable;
148 
149     ScSheetEvents*  pSheetEvents;
150 
151 	SCCOL			nTableAreaX;
152 	SCROW			nTableAreaY;
153 	sal_Bool			bTableAreaValid;
154 
155 											//	interne Verwaltung	------------------
156 	sal_Bool			bVisible;
157     sal_Bool            bStreamValid;
158     sal_Bool            bPendingRowHeights;
159     sal_Bool            bCalcNotification;
160 
161 	SCTAB			nTab;
162 	sal_uInt16			nRecalcLvl;				// Rekursionslevel Size-Recalc
163 	ScDocument*		pDocument;
164 	utl::SearchParam*	pSearchParam;
165 	utl::TextSearch*	pSearchText;
166 
167     mutable String  aUpperName;             // #i62977# filled only on demand, reset in SetName
168 
169     ScAddress2DVecPtr mxUninitNotes;
170 
171 	// SortierParameter um den Stackbedarf von Quicksort zu Minimieren
172 	ScSortParam		aSortParam;
173 	CollatorWrapper*	pSortCollator;
174 	sal_Bool			bGlobalKeepQuery;
175 	sal_Bool			bSharedNameInserted;
176 
177     ScRangeVec      aPrintRanges;
178     sal_Bool            bPrintEntireSheet;
179 
180 	ScRange*		pRepeatColRange;
181 	ScRange*		pRepeatRowRange;
182 
183 	sal_uInt16			nLockCount;
184 
185 	ScRangeList*	pScenarioRanges;
186 	Color			aScenarioColor;
187     Color           aTabBgColor;
188 	sal_uInt16			nScenarioFlags;
189 	sal_Bool			bActiveScenario;
190     bool            mbPageBreaksValid;
191 
192 friend class ScDocument;					// fuer FillInfo
193 friend class ScDocumentIterator;
194 friend class ScValueIterator;
195 friend class ScHorizontalValueIterator;
196 friend class ScDBQueryDataIterator;
197 friend class ScCellIterator;
198 friend class ScQueryCellIterator;
199 friend class ScHorizontalCellIterator;
200 friend class ScHorizontalAttrIterator;
201 friend class ScDocAttrIterator;
202 friend class ScAttrRectIterator;
203 
204 
205 public:
206 				ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName,
207 							sal_Bool bColInfo = sal_True, sal_Bool bRowInfo = sal_True );
208 				~ScTable();
209 
GetOutlineTable()210 	ScOutlineTable*	GetOutlineTable()				{ return pOutlineTable; }
211 
212     SCSIZE      GetCellCount(SCCOL nCol) const;
213 	sal_uLong		GetCellCount() const;
214 	sal_uLong		GetWeightedCount() const;
215 	sal_uLong		GetCodeCount() const;		// RPN-Code in Formeln
216 
217 	sal_Bool		SetOutlineTable( const ScOutlineTable* pNewOutline );
218 	void		StartOutlineTable();
219 
220 	void		DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
221 
222 	sal_Bool		TestRemoveSubTotals( const ScSubTotalParam& rParam );
223 	void		RemoveSubTotals( ScSubTotalParam& rParam );
224 	sal_Bool		DoSubTotals( ScSubTotalParam& rParam );
225 
GetSheetEvents() const226     const ScSheetEvents* GetSheetEvents() const              { return pSheetEvents; }
227     void        SetSheetEvents( const ScSheetEvents* pNew );
228 
IsVisible() const229 	sal_Bool		IsVisible() const							 { return bVisible; }
230 	void		SetVisible( sal_Bool bVis );
231 
IsStreamValid() const232     sal_Bool        IsStreamValid() const                        { return bStreamValid; }
233     void        SetStreamValid( sal_Bool bSet, sal_Bool bIgnoreLock = sal_False );
234 
IsPendingRowHeights() const235     sal_Bool        IsPendingRowHeights() const                  { return bPendingRowHeights; }
236     void        SetPendingRowHeights( sal_Bool bSet );
237 
GetCalcNotification() const238     sal_Bool        GetCalcNotification() const                  { return bCalcNotification; }
239     void        SetCalcNotification( sal_Bool bSet );
240 
IsLayoutRTL() const241     sal_Bool        IsLayoutRTL() const                          { return bLayoutRTL; }
IsLoadingRTL() const242     sal_Bool        IsLoadingRTL() const                         { return bLoadingRTL; }
243     void        SetLayoutRTL( sal_Bool bSet );
244     void        SetLoadingRTL( sal_Bool bSet );
245 
IsScenario() const246 	sal_Bool		IsScenario() const							 { return bScenario; }
247 	void		SetScenario( sal_Bool bFlag );
GetScenarioComment(String & rComment) const248 	void 		GetScenarioComment( String& rComment) const	 { rComment = aComment; }
SetScenarioComment(const String & rComment)249 	void		SetScenarioComment( const String& rComment ) { aComment = rComment; }
GetScenarioColor() const250 	const Color& GetScenarioColor() const					 { return aScenarioColor; }
SetScenarioColor(const Color & rNew)251 	void		SetScenarioColor(const Color& rNew)			 { aScenarioColor = rNew; }
252     const Color& GetTabBgColor() const;
253     void         SetTabBgColor(const Color& rColor);
GetScenarioFlags() const254 	sal_uInt16		GetScenarioFlags() const					 { return nScenarioFlags; }
SetScenarioFlags(sal_uInt16 nNew)255 	void		SetScenarioFlags(sal_uInt16 nNew)				 { nScenarioFlags = nNew; }
SetActiveScenario(sal_Bool bSet)256 	void		SetActiveScenario(sal_Bool bSet)				 { bActiveScenario = bSet; }
IsActiveScenario() const257 	sal_Bool		IsActiveScenario() const					 { return bActiveScenario; }
258 
GetLinkMode() const259 	sal_uInt8		GetLinkMode() const							{ return nLinkMode; }
IsLinked() const260 	sal_Bool		IsLinked() const							{ return nLinkMode != SC_LINK_NONE; }
GetLinkDoc() const261 	const String& GetLinkDoc() const						{ return aLinkDoc; }
GetLinkFlt() const262 	const String& GetLinkFlt() const						{ return aLinkFlt; }
GetLinkOpt() const263 	const String& GetLinkOpt() const						{ return aLinkOpt; }
GetLinkTab() const264 	const String& GetLinkTab() const						{ return aLinkTab; }
GetLinkRefreshDelay() const265 	sal_uLong		GetLinkRefreshDelay() const					{ return nLinkRefreshDelay; }
266 
267 	void		SetLink( sal_uInt8 nMode, const String& rDoc, const String& rFlt,
268 						const String& rOpt, const String& rTab, sal_uLong nRefreshDelay );
269 
270 	void		GetName( String& rName ) const;
271 	void		SetName( const String& rNewName );
272 
GetCodeName(String & rName) const273 	void		GetCodeName( String& rName ) const {  rName = aCodeName; }
SetCodeName(const String & rNewName)274 	void		SetCodeName( const String& rNewName ) { aCodeName = rNewName; }
275 
276     const String&   GetUpperName() const;
277 
GetPageStyle() const278 	const String&	GetPageStyle() const					{ return aPageStyle; }
279 	void			SetPageStyle( const String& rName );
280 	void			PageStyleModified( const String& rNewName );
281 
282     sal_Bool            IsProtected() const;
283     void            SetProtection(const ScTableProtection* pProtect);
284     ScTableProtection* GetProtection();
285 
286 	Size			GetPageSize() const;
287 	void			SetPageSize( const Size& rSize );
288 	void			SetRepeatArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
289 
290 	void		RemoveAutoSpellObj();
291 
292 	void		LockTable();
293 	void		UnlockTable();
294 
295 	sal_Bool		IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
296 						SCROW nRow2, sal_Bool* pOnlyNotBecauseOfMatrix = NULL ) const;
297 	sal_Bool		IsSelectionEditable( const ScMarkData& rMark,
298 						sal_Bool* pOnlyNotBecauseOfMatrix = NULL ) const;
299 
300 	sal_Bool		HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
301 	sal_Bool		HasSelectionMatrixFragment( const ScMarkData& rMark ) const;
302 
303 	sal_Bool		IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes = false ) const;
304 
305 	void		PutCell( const ScAddress&, ScBaseCell* pCell );
306 //UNUSED2009-05 void		PutCell( const ScAddress&, sal_uLong nFormatIndex, ScBaseCell* pCell);
307 	void		PutCell( SCCOL nCol, SCROW nRow, ScBaseCell* pCell );
308 	void		PutCell(SCCOL nCol, SCROW nRow, sal_uLong nFormatIndex, ScBaseCell* pCell);
309 				//	sal_True = Zahlformat gesetzt
310 	sal_Bool		SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
311                            SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true );
312 	void		SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
313 	void 		SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError);
314 	SCSIZE		GetPatternCount( SCCOL nCol );
315 	SCSIZE 		GetPatternCount( SCCOL nCol, SCROW nRw1, SCROW nRw2 );
316 	bool		ReservedPatternCount( SCCOL nCol, SCSIZE nReserved );
317 
318 	void		GetString( SCCOL nCol, SCROW nRow, String& rString );
319     void    FillDPCache( ScDPTableDataCache * pCache, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
320 	void		GetInputString( SCCOL nCol, SCROW nRow, String& rString );
GetValue(const ScAddress & rPos) const321 	double		GetValue( const ScAddress& rPos ) const
322 					{
323                         return ValidColRow(rPos.Col(),rPos.Row()) ?
324                             aCol[rPos.Col()].GetValue( rPos.Row() ) :
325                             0.0;
326                     }
327 	double		GetValue( SCCOL nCol, SCROW nRow );
328 	void		GetFormula( SCCOL nCol, SCROW nRow, String& rFormula,
329 							sal_Bool bAsciiExport = sal_False );
330 
GetCellType(const ScAddress & rPos) const331 	CellType	GetCellType( const ScAddress& rPos ) const
332 					{
333                         return ValidColRow(rPos.Col(),rPos.Row()) ?
334                             aCol[rPos.Col()].GetCellType( rPos.Row() ) :
335                             CELLTYPE_NONE;
336                     }
337 	CellType	GetCellType( SCCOL nCol, SCROW nRow ) const;
GetCell(const ScAddress & rPos) const338 	ScBaseCell*	GetCell( const ScAddress& rPos ) const
339 					{
340                         return ValidColRow(rPos.Col(),rPos.Row()) ?
341                             aCol[rPos.Col()].GetCell( rPos.Row() ) :
342                             NULL;
343                     }
344 	ScBaseCell*	GetCell( SCCOL nCol, SCROW nRow ) const;
345 
346     void        GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const;
347 	void		GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
348 
349     /** Returns the pointer to a cell note object at the passed cell address. */
350     ScPostIt*   GetNote( SCCOL nCol, SCROW nRow );
351     /** Sets the passed cell note object at the passed cell address. Takes ownership! */
352     void        TakeNote( SCCOL nCol, SCROW nRow, ScPostIt*& rpNote );
353     /** Returns and forgets the cell note object at the passed cell address. */
354     ScPostIt*   ReleaseNote( SCCOL nCol, SCROW nRow );
355     /** Deletes the note at the passed cell address. */
356     void        DeleteNote( SCCOL nCol, SCROW nRow );
357     /** Creates the captions of all uninitialized cell notes.
358         @param bForced  True = always create all captions, false = skip when Undo is disabled. */
359     void        InitializeNoteCaptions( bool bForced = false );
360 
361 	sal_Bool		TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize );
362 	void		InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize );
363 	void		DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize,
364 							sal_Bool* pUndoOutline = NULL );
365 
366 	sal_Bool		TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
367 	void		InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
368 	void		DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize,
369 							sal_Bool* pUndoOutline = NULL );
370 
371 	void		DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nDelFlag);
372 	void		CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable,
373                             sal_Bool bKeepScenarioFlags, sal_Bool bCloneNoteCaptions);
374     void        CopyToClip(const ScRangeList& rRanges, ScTable* pTable,
375                            bool bKeepScenarioFlags, bool bCloneNoteCaptions);
376 	void		CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy,
377 								sal_uInt16 nInsFlag, sal_Bool bAsLink, sal_Bool bSkipAttrForEmpty, ScTable* pTable);
378 	void		StartListeningInArea( SCCOL nCol1, SCROW nRow1,
379 										SCCOL nCol2, SCROW nRow2 );
380 	void		BroadcastInArea( SCCOL nCol1, SCROW nRow1,
381 									SCCOL nCol2, SCROW nRow2 );
382 
383 	void		CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
384 							sal_uInt16 nFlags, sal_Bool bMarked, ScTable* pDestTab,
385 							const ScMarkData* pMarkData = NULL,
386 							sal_Bool bAsLink = sal_False, sal_Bool bColRowFlags = sal_True);
387 	void		UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
388 							sal_uInt16 nFlags, sal_Bool bMarked, ScTable* pDestTab,
389 							const ScMarkData* pMarkData = NULL);
390 
391 	void		TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
392 								ScTable* pTransClip, sal_uInt16 nFlags, sal_Bool bAsLink );
393 
394 				//	Markierung von diesem Dokument
395 	void		MixMarked( const ScMarkData& rMark, sal_uInt16 nFunction,
396 							sal_Bool bSkipEmpty, ScTable* pSrcTab );
397 	void		MixData( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
398 							sal_uInt16 nFunction, sal_Bool bSkipEmpty, ScTable* pSrcTab );
399 
400 	void		CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
401 							SCCOL nDestCol, SCROW nDestRow, SCTAB nDestTab );
402 
403 	void		CopyScenarioFrom( const ScTable* pSrcTab );
404 	void		CopyScenarioTo( ScTable* pDestTab ) const;
405 	sal_Bool		TestCopyScenarioTo( const ScTable* pDestTab ) const;
406 	void		MarkScenarioIn( ScMarkData& rMark, sal_uInt16 nNeededBits ) const;
407 	sal_Bool		HasScenarioRange( const ScRange& rRange ) const;
408 	void		InvalidateScenarioRanges();
409 	const ScRangeList* GetScenarioRanges() const;
410 
411 	void		CopyUpdated( const ScTable* pPosTab, ScTable* pDestTab ) const;
412 
413     void        InvalidateTableArea();
414     void        InvalidatePageBreaks();
415 
416 	sal_Bool		GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const;			// sal_False = leer
417 	sal_Bool		GetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const;
418 	sal_Bool		GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, sal_Bool bNotes ) const;
419 	sal_Bool		GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
420 								SCCOL& rEndCol, sal_Bool bNotes ) const;
421 	sal_Bool		GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
422 								SCROW& rEndRow, sal_Bool bNotes ) const;
423 
424 	/*
425 	Get the last cell's position, which has visual attribute or data and has max row number among all columns.
426 	*/
427 	void		GetLastAttrCell( SCCOL& rEndCol, SCROW& rEndRow ) const;
428 	sal_Bool		GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const;
429 
430 	void		ExtendPrintArea( OutputDevice* pDev,
431 						SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow );
432 
433     void        GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
434                              sal_Bool bIncludeOld, bool bOnlyDown ) const;
435 
436     bool        ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
437                                       SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
438 
439 	SCSIZE	    GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
440 										SCCOL nEndCol, SCROW nEndRow, ScDirection eDir );
441 
442 	void		FindAreaPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY );
443 	void		GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY,
444 								sal_Bool bMarked, sal_Bool bUnprotected, const ScMarkData& rMark );
445 
446 	void		LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow );
447 
448 	sal_Bool		HasData( SCCOL nCol, SCROW nRow );
449 	sal_Bool		HasStringData( SCCOL nCol, SCROW nRow );
450 	sal_Bool		HasValueData( SCCOL nCol, SCROW nRow );
451 //UNUSED2008-05  sal_uInt16		GetErrorData(SCCOL nCol, SCROW nRow) const;
452 	sal_Bool		HasStringCells( SCCOL nStartCol, SCROW nStartRow,
453 								SCCOL nEndCol, SCROW nEndRow ) const;
454 
GetErrCode(const ScAddress & rPos) const455 	sal_uInt16		GetErrCode( const ScAddress& rPos ) const
456 					{
457                         return ValidColRow(rPos.Col(),rPos.Row()) ?
458                             aCol[rPos.Col()].GetErrCode( rPos.Row() ) :
459                             0;
460                     }
461 //UNUSED2008-05  sal_uInt16		GetErrCode( SCCOL nCol, SCROW nRow ) const;
462 
463 	void		ResetChanged( const ScRange& rRange );
464 
465 	void		SetDirty();
466 	void		SetDirty( const ScRange& );
467 	void		SetDirtyAfterLoad();
468 	void		SetDirtyVar();
469 	void		SetTableOpDirty( const ScRange& );
470 	void		CalcAll();
471 	void		CalcAfterLoad();
472 	void		CompileAll();
473 	void		CompileXML( ScProgress& rProgress );
474 
475 	void		UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
476 									SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
477 									SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
478 									ScDocument* pUndoDoc = NULL, sal_Bool bIncludeDraw = sal_True, bool bUpdateNoteCaptionPos = true );
479 
480 	void		UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
481 									SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
482 									SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bUpdateNoteCaptionPos = true );
483 
484 	void		UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
485 									ScDocument* pUndoDoc );
486 
487 	void		UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
488 
489 	void		UpdateInsertTab(SCTAB nTable);
490 //UNUSED2008-05  void        UpdateInsertTabOnlyCells(SCTAB nTable);
491 	void 		UpdateDeleteTab( SCTAB nTable, sal_Bool bIsMove, ScTable* pRefUndo = NULL );
492 	void		UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, ScProgress& );
493 	void		UpdateCompile( sal_Bool bForceIfNameInUse = sal_False );
494 	void		SetTabNo(SCTAB nNewTab);
495 	sal_Bool		IsRangeNameInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
496 								 sal_uInt16 nIndex) const;
497     void        FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
498                                  std::set<sal_uInt16>& rIndexes) const;
499 	void 		ReplaceRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
500 									  const ScRangeData::IndexMap& rMap );
501 	void		Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
502 						sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
503 						double nStepValue, double nMaxValue);
504 	String		GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
505 
506 	void		UpdateSelectionFunction( ScFunctionData& rData,
507 						SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
508 						const ScMarkData& rMark );
509 
510 	void		AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
511 									sal_uInt16 nFormatNo );
512 	void		GetAutoFormatData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData& rData);
513 	void 		ScReplaceTabsStr( String& rStr, const String& rSrch, const String& rRepl ); // aus sw
514 	sal_Bool		SearchAndReplace(const SvxSearchItem& rSearchItem,
515 								SCCOL& rCol, SCROW& rRow, ScMarkData& rMark,
516 								String& rUndoStr, ScDocument* pUndoDoc);
517 
518 	void		FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2 );
519 
520 	void		GetBorderLines( SCCOL nCol, SCROW nRow,
521 								const SvxBorderLine** ppLeft, const SvxBorderLine** ppTop,
522 								const SvxBorderLine** ppRight, const SvxBorderLine** ppBottom ) const;
523 
524 //UNUSED2009-05 sal_Bool		HasLines( const ScRange& rRange, Rectangle& rSizes ) const;
525     bool        HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nMask ) const;
526 	sal_Bool		HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
527 	sal_Bool		ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
528 								SCCOL& rEndCol, SCROW& rEndRow,
529 								sal_Bool bRefresh, sal_Bool bAttrs );
530 	const SfxPoolItem*		GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const;
531 	const ScPatternAttr*	GetPattern( SCCOL nCol, SCROW nRow ) const;
532     const ScPatternAttr*    GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
533 
GetNumberFormat(const ScAddress & rPos) const534 	sal_uLong					GetNumberFormat( const ScAddress& rPos ) const
535 								{
536                                     return ValidColRow(rPos.Col(),rPos.Row()) ?
537                                         aCol[rPos.Col()].GetNumberFormat( rPos.Row() ) :
538                                         0;
539                                 }
540 	sal_uLong					GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
541 	void					MergeSelectionPattern( ScMergePatternState& rState,
542 												const ScMarkData& rMark, sal_Bool bDeep ) const;
543 	void					MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1,
544 												SCCOL nCol2, SCROW nRow2, sal_Bool bDeep ) const;
545 	void					MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
546 											ScLineFlags& rFlags,
547 											SCCOL nStartCol, SCROW nStartRow,
548 											SCCOL nEndCol, SCROW nEndRow ) const;
549 	void					ApplyBlockFrame( const SvxBoxItem* pLineOuter,
550 											const SvxBoxInfoItem* pLineInner,
551 											SCCOL nStartCol, SCROW nStartRow,
552 											SCCOL nEndCol, SCROW nEndRow );
553 
554 	void		ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
555 	void		ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
556 	void		ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScPatternAttr& rAttr );
557 	void		ApplyPooledPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScPatternAttr& rPooledAttr, const ScPatternAttr& rAttr );
558 
SetPattern(const ScAddress & rPos,const ScPatternAttr & rAttr,sal_Bool bPutToPool=sal_False)559 	void		SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, sal_Bool bPutToPool = sal_False )
560 					{
561                         if (ValidColRow(rPos.Col(),rPos.Row()))
562                             aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool );
563                     }
564 	void		SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, sal_Bool bPutToPool = sal_False );
565 	void		ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
566 							const ScPatternAttr& rPattern, short nNewType );
567 
568 	void		ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet& rStyle );
569 	void		ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet& rStyle );
570 	void		ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
571 	void		ApplySelectionLineStyle( const ScMarkData& rMark,
572 									const SvxBorderLine* pLine, sal_Bool bColorOnly );
573 
574 	const ScStyleSheet*	GetStyle( SCCOL nCol, SCROW nRow ) const;
575 	const ScStyleSheet*	GetSelectionStyle( const ScMarkData& rMark, sal_Bool& rFound ) const;
576 	const ScStyleSheet*	GetAreaStyle( sal_Bool& rFound, SCCOL nCol1, SCROW nRow1,
577 													SCCOL nCol2, SCROW nRow2 ) const;
578 
579 	void		StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, sal_Bool bRemoved,
580 									OutputDevice* pDev,
581 									double nPPTX, double nPPTY,
582 									const Fraction& rZoomX, const Fraction& rZoomY );
583 
584 	sal_Bool		IsStyleSheetUsed( const ScStyleSheet& rStyle, sal_Bool bGatherAllStyles ) const;
585 
586 	sal_Bool		ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
587 	sal_Bool		RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
588 
589 	void		ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark );
590     void        DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
591 
592 	void		ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
593 	void		ChangeSelectionIndent( sal_Bool bIncrement, const ScMarkData& rMark );
594 
GetRepeatColRange() const595 	const ScRange*	GetRepeatColRange() const	{ return pRepeatColRange; }
GetRepeatRowRange() const596 	const ScRange*	GetRepeatRowRange() const	{ return pRepeatRowRange; }
597 	void			SetRepeatColRange( const ScRange* pNew );
598 	void			SetRepeatRowRange( const ScRange* pNew );
599 
GetPrintRangeCount() const600     sal_uInt16          GetPrintRangeCount() const          { return static_cast< sal_uInt16 >( aPrintRanges.size() ); }
601 	const ScRange*	GetPrintRange(sal_uInt16 nPos) const;
602     /** Returns true, if the sheet is always printed. */
IsPrintEntireSheet() const603     sal_Bool            IsPrintEntireSheet() const          { return bPrintEntireSheet; }
604 
605     /** Removes all print ranges. */
606     void            ClearPrintRanges();
607     /** Adds a new print ranges. */
608     void            AddPrintRange( const ScRange& rNew );
609 //UNUSED2009-05 /** Removes all old print ranges and sets the passed print ranges. */
610 //UNUSED2009-05 void            SetPrintRange( const ScRange& rNew );
611     /** Marks the specified sheet to be printed completely. Deletes old print ranges! */
612     void            SetPrintEntireSheet();
613 
614 	void			FillPrintSaver( ScPrintSaverTab& rSaveTab ) const;
615 	void			RestorePrintRanges( const ScPrintSaverTab& rSaveTab );
616 
617 	sal_uInt16		GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
618 									double nPPTX, double nPPTY,
619 									const Fraction& rZoomX, const Fraction& rZoomY,
620 									sal_Bool bFormula, const ScMarkData* pMarkData,
621 									sal_Bool bSimpleTextImport );
622 	sal_Bool		SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra,
623 									OutputDevice* pDev,
624 									double nPPTX, double nPPTY,
625 									const Fraction& rZoomX, const Fraction& rZoomY,
626                                     sal_Bool bForce,
627                                     ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 );
628 	long		GetNeededSize( SCCOL nCol, SCROW nRow,
629 									OutputDevice* pDev,
630 									double nPPTX, double nPPTY,
631 									const Fraction& rZoomX, const Fraction& rZoomY,
632 									sal_Bool bWidth, sal_Bool bTotalSize );
633 	void		SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth );
634 	void		SetColWidthOnly( SCCOL nCol, sal_uInt16 nNewWidth );
635 	void		SetRowHeight( SCROW nRow, sal_uInt16 nNewHeight );
636 	sal_Bool		SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight,
637 									double nPPTX, double nPPTY );
638 
639     /**
640      * Set specified row height to specified ranges.  Don't check for drawing
641      * objects etc.  Just set the row height.  Nothing else.
642      *
643      * Note that setting a new row height via this function will not
644      * invalidate page breaks.
645      */
646     void        SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight );
647 
648 						// nPPT fuer Test auf Veraenderung
649 	void		SetManualHeight( SCROW nStartRow, SCROW nEndRow, sal_Bool bManual );
650 
651 	sal_uInt16		GetColWidth( SCCOL nCol ) const;
652     SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true ) const;
653 	sal_uLong		GetRowHeight( SCROW nStartRow, SCROW nEndRow ) const;
654 	sal_uLong		GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const;
655 	sal_uLong		GetColOffset( SCCOL nCol ) const;
656 	sal_uLong		GetRowOffset( SCROW nRow ) const;
657 
658     /**
659      * Get the last row such that the height of row 0 to the end row is as
660      * high as possible without exceeding the specified height value.
661      *
662      * @param nHeight maximum desired height
663      *
664      * @return SCROW last row of the range within specified height.
665      */
666     SCROW       GetRowForHeight(sal_uLong nHeight) const;
667 
668 	sal_uInt16		GetOriginalWidth( SCCOL nCol ) const;
669 	sal_uInt16		GetOriginalHeight( SCROW nRow ) const;
670 
671 	sal_uInt16		GetCommonWidth( SCCOL nEndCol );
672 
673 	SCROW		GetHiddenRowCount( SCROW nRow );
674 
675 	void		ShowCol(SCCOL nCol, bool bShow);
676 	void		ShowRow(SCROW nRow, bool bShow);
677 	void		DBShowRow(SCROW nRow, bool bShow);
678 
679 	void		ShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
680     void        DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags);   // if bSetFlags=false, no SetRowHidden/SetRowFiltered
681 
682 	void		SetColFlags( SCCOL nCol, sal_uInt8 nNewFlags );
683 	void		SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags );
684 	void		SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags );
685 
686                 /// @return  the index of the last row with any set flags (auto-pagebreak is ignored).
687     SCROW      GetLastFlaggedRow() const;
688 
689                 /// @return  the index of the last changed column (flags and column width, auto pagebreak is ignored).
690     SCCOL      GetLastChangedCol() const;
691                 /// @return  the index of the last changed row (flags and row height, auto pagebreak is ignored).
692     SCROW      GetLastChangedRow() const;
693 
694 	sal_Bool		IsDataFiltered() const;
695 	sal_uInt8		GetColFlags( SCCOL nCol ) const;
696 	sal_uInt8		GetRowFlags( SCROW nRow ) const;
697 
GetRowFlagsArray() const698     const ScBitMaskCompressedArray< SCROW, sal_uInt8> * GetRowFlagsArray() const
699                     { return pRowFlags; }
700 
701 	sal_Bool		UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, sal_Bool bShow );
702 	sal_Bool		UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, sal_Bool bShow );
703 
704 	void		UpdatePageBreaks( const ScRange* pUserArea );
705 	void		RemoveManualBreaks();
706 	sal_Bool		HasManualBreaks() const;
707     void        SetRowManualBreaks( const ::std::set<SCROW>& rBreaks );
708     void        SetColManualBreaks( const ::std::set<SCCOL>& rBreaks );
709 
710     void        GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const;
711     void        GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const;
712     bool        HasRowPageBreak(SCROW nRow) const;
713     bool        HasColPageBreak(SCCOL nCol) const;
714     bool        HasRowManualBreak(SCROW nRow) const;
715     bool        HasColManualBreak(SCCOL nCol) const;
716 
717     /**
718      * Get the row position of the next manual break that occurs at or below
719      * specified row.  When no more manual breaks are present at or below
720      * the specified row, -1 is returned.
721      *
722      * @param nRow row at which the search begins.
723      *
724      * @return SCROW next row position with manual page break, or -1 if no
725      *         more manual breaks are present.
726      */
727     SCROW       GetNextManualBreak(SCROW nRow) const;
728 
729     void        RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow);
730     void        RemoveRowBreak(SCROW nRow, bool bPage, bool bManual);
731     void        RemoveColBreak(SCCOL nCol, bool bPage, bool bManual);
732     void        SetRowBreak(SCROW nRow, bool bPage, bool bManual);
733     void        SetColBreak(SCCOL nCol, bool bPage, bool bManual);
734     ::com::sun::star::uno::Sequence<
735         ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const;
736 
737     bool        RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
738     bool        RowHidden(SCROW nRow, SCROW& rLastRow) const;
739     bool        HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
740     bool        ColHidden(SCCOL nCol, SCCOL& rLastCol) const;
741     bool        ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
742     void        SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
743     void        SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden);
744     void        CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
745     void        CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
746     void        CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset);
747     SCROW       FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
748     SCROW       LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
749     SCROW       CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
750     sal_uInt32  GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow) const;
751 
752     SCCOLROW    LastHiddenColRow(SCCOLROW nPos, bool bCol) const;
753 
754     bool        RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
755     bool        ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
756     bool        HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
757     void        CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
758     void        CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
759     void        SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered);
760     void        SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered);
761     SCROW       FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
762     SCROW       LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
763     SCROW       CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
764 
765     void        SyncColRowFlags();
766 
767 	void		StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
768 	void		ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
769 
770 	void		Sort(const ScSortParam& rSortParam, sal_Bool bKeepQuery);
771     sal_Bool        ValidQuery(SCROW nRow, const ScQueryParam& rQueryParam,
772                     sal_Bool* pSpecial = NULL, ScBaseCell* pCell = NULL,
773                     sal_Bool* pbTestEqualCondition = NULL );
774 	void		TopTenQuery( ScQueryParam& );
775 	SCSIZE		Query(ScQueryParam& rQueryParam, sal_Bool bKeepSub);
776 	sal_Bool		CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
777 
778     void        GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, TypedScStrCollection& rStrings, bool& rHasDates);
779     void        GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, TypedScStrCollection& rStrings, bool& rHasDates );
780 	sal_Bool		GetDataEntries(SCCOL nCol, SCROW nRow, TypedScStrCollection& rStrings, sal_Bool bLimit);
781 
782 	sal_Bool		HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
783 	sal_Bool		HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
784 
785 	void		DoColResize( SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd );
786 
787 
788     sal_Int32	GetMaxStringLen( SCCOL nCol,
789                                     SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const;
790     xub_StrLen  GetMaxNumberStringLen( sal_uInt16& nPrecision,
791                                        SCCOL nCol,
792                                        SCROW nRowStart, SCROW nRowEnd ) const;
793 
794 	void		FindConditionalFormat( sal_uLong nKey, ScRangeList& rRanges );
795 
IncRecalcLevel()796 	void		IncRecalcLevel() { ++nRecalcLvl; }
DecRecalcLevel(bool bUpdateNoteCaptionPos=true)797 	void		DecRecalcLevel( bool bUpdateNoteCaptionPos = true ) { if (!--nRecalcLvl) SetDrawPageSize(true, bUpdateNoteCaptionPos); }
798 
799 	sal_Bool		IsSortCollatorGlobal() const;
800 	void		InitSortCollator( const ScSortParam& rPar );
801 	void		DestroySortCollator();
802 
803 private:
804 	void		FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
805 								sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd,
806 								FillDateCmd eFillDateCmd,
807 								double nStepValue, double nMaxValue, sal_uInt16 nMinDigits,
808 								sal_Bool bAttribs, ScProgress& rProgress );
809 	void		FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
810 								FillCmd& rCmd, FillDateCmd& rDateCmd,
811 								double& rInc, sal_uInt16& rMinDigits,
812 								ScUserListData*& rListData, sal_uInt16& rListIndex);
813 	void		FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
814 						sal_uLong nFillCount, FillDir eFillDir, ScProgress& rProgress );
815 
816 	sal_Bool		ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
817 								sal_Bool bMarked, sal_Bool bUnprotected );
818 
819 	void		AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
820 								const ScPatternAttr& rAttr, sal_uInt16 nFormatNo);
821 	void 		GetAutoFormatAttr(SCCOL nCol, SCROW nRow, sal_uInt16 nIndex, ScAutoFormatData& rData);
822 	void		GetAutoFormatFrame(SCCOL nCol, SCROW nRow, sal_uInt16 nFlags, sal_uInt16 nIndex, ScAutoFormatData& rData);
823 	sal_Bool 		SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRow,
824 							const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
825 	sal_Bool		Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
826 						const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
827 	sal_Bool		SearchAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
828 						String& rUndoStr, ScDocument* pUndoDoc);
829 	sal_Bool		Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
830 						const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
831 	sal_Bool		ReplaceAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
832 							String& rUndoStr, ScDocument* pUndoDoc);
833 
834 	sal_Bool		SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
835 								ScMarkData& rMark);
836 	sal_Bool		ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
837 								ScMarkData& rMark, sal_Bool bIsUndo);
838 	sal_Bool		SearchAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark);
839 	sal_Bool		ReplaceAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
840 								ScDocument* pUndoDoc);
841 
842 								// benutzen globalen SortParam:
843 	sal_Bool		IsSorted(SCCOLROW nStart, SCCOLROW nEnd);
844 	void		DecoladeRow( ScSortInfoArray*, SCROW nRow1, SCROW nRow2 );
845 	void		SwapCol(SCCOL nCol1, SCCOL nCol2);
846 	void		SwapRow(SCROW nRow1, SCROW nRow2);
847 	short 		CompareCell( sal_uInt16 nSort,
848 					ScBaseCell* pCell1, SCCOL nCell1Col, SCROW nCell1Row,
849 					ScBaseCell* pCell2, SCCOL nCell2Col, SCROW nCell2Row );
850 	short		Compare(SCCOLROW nIndex1, SCCOLROW nIndex2);
851 	short		Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2);
852 	ScSortInfoArray*	CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 );
853 	void		QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi);
854 	void		SortReorder( ScSortInfoArray*, ScProgress& );
855 
856 	sal_Bool 		CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
857 	sal_Bool 		CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
858 	void 		GetUpperCellString(SCCOL nCol, SCROW nRow, String& rStr);
859 
860 	sal_Bool		RefVisible(ScFormulaCell* pCell);
861 
862 	sal_Bool		IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol);
863 
864 	void 		IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillDateCmd eCmd);
865 	void		FillFormula(sal_uLong& nFormulaCounter, sal_Bool bFirst, ScFormulaCell* pSrcCell,
866 							SCCOL nDestCol, SCROW nDestRow, sal_Bool bLast );
867 	void		UpdateInsertTabAbs(SCTAB nNewPos);
868 	sal_Bool 		GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, sal_Bool bInSel,
869 									const ScMarkData& rMark) const;
870 	sal_Bool		GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark );
871     void        SetDrawPageSize( bool bResetStreamValid = true, bool bUpdateNoteCaptionPos = true );
872 	sal_Bool		TestTabRefAbs(SCTAB nTable);
873 	void 		CompileDBFormula();
874 	void 		CompileDBFormula( sal_Bool bCreateFormulaString );
875 	void 		CompileNameFormula( sal_Bool bCreateFormulaString );
876 	void 		CompileColRowNameFormula();
877 
878 	void		StartListening( const ScAddress& rAddress, SvtListener* pListener );
879 	void		EndListening( const ScAddress& rAddress, SvtListener* pListener );
880 	void		StartAllListeners();
881     void        StartNeededListeners(); // only for cells where NeedsListening()==TRUE
882 	void		SetRelNameDirty();
883 
884     void        SetLoadingMedium(bool bLoading);
885 
886 	SCSIZE		FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2,
887 							SCCOL nCol, SCROW nAttrRow1, SCROW nAttrRow2, SCSIZE nArrY,
888 							const ScPatternAttr* pPattern, const SfxItemSet* pCondSet );
889 
890     // idle calculation of OutputDevice text width for cell
891     // also invalidates script type, broadcasts for "calc as shown"
892     void        InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
893                                      sal_Bool bNumFormatChanged, sal_Bool bBroadcast );
894 
895     /**
896      * In case the cell text goes beyond the column width, move the max column
897      * position to the right.  This is called from ExtendPrintArea.
898      */
899     void        MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY);
900 
901     /**
902      * Use this to iterate through non-empty visible cells in a single column.
903      */
904     class VisibleDataCellIterator
905     {
906     public:
907         static SCROW ROW_NOT_FOUND;
908 
909         explicit VisibleDataCellIterator(ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn);
910         ~VisibleDataCellIterator();
911 
912         /**
913          * Set the start row position.  In case there is not visible data cell
914          * at the specified row position, it will move to the position of the
915          * first visible data cell below that point.
916          *
917          * @return First visible data cell if found, or NULL otherwise.
918          */
919         ScBaseCell* reset(SCROW nRow);
920 
921         /**
922          * Find the next visible data cell position.
923          *
924          * @return Next visible data cell if found, or NULL otherwise.
925          */
926         ScBaseCell* next();
927 
928         /**
929          * Get the current row position.
930          *
931          * @return Current row position, or ROW_NOT_FOUND if the iterator
932          *         doesn't point to a valid data cell position.
933          */
934         SCROW getRow() const;
935 
936     private:
937         ScFlatBoolRowSegments& mrRowSegs;
938         ScColumn& mrColumn;
939         ScBaseCell* mpCell;
940         SCROW mnCurRow;
941         SCROW mnUBound;
942     };
943 
944 public :
945 	ScColumn* GetColumnByIndex(sal_Int32 index);
946 };
947 
948 
949 #endif
950 
951 
952