xref: /aoo42x/main/sc/inc/table.hxx (revision b4df81e3)
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 
91     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 
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 
226     const ScSheetEvents* GetSheetEvents() const              { return pSheetEvents; }
227     void        SetSheetEvents( const ScSheetEvents* pNew );
228 
229 	sal_Bool		IsVisible() const							 { return bVisible; }
230 	void		SetVisible( sal_Bool bVis );
231 
232     sal_Bool        IsStreamValid() const                        { return bStreamValid; }
233     void        SetStreamValid( sal_Bool bSet, sal_Bool bIgnoreLock = sal_False );
234 
235     sal_Bool        IsPendingRowHeights() const                  { return bPendingRowHeights; }
236     void        SetPendingRowHeights( sal_Bool bSet );
237 
238     sal_Bool        GetCalcNotification() const                  { return bCalcNotification; }
239     void        SetCalcNotification( sal_Bool bSet );
240 
241     sal_Bool        IsLayoutRTL() const                          { return bLayoutRTL; }
242     sal_Bool        IsLoadingRTL() const                         { return bLoadingRTL; }
243     void        SetLayoutRTL( sal_Bool bSet );
244     void        SetLoadingRTL( sal_Bool bSet );
245 
246 	sal_Bool		IsScenario() const							 { return bScenario; }
247 	void		SetScenario( sal_Bool bFlag );
248 	void 		GetScenarioComment( String& rComment) const	 { rComment = aComment; }
249 	void		SetScenarioComment( const String& rComment ) { aComment = rComment; }
250 	const Color& GetScenarioColor() const					 { return aScenarioColor; }
251 	void		SetScenarioColor(const Color& rNew)			 { aScenarioColor = rNew; }
252     const Color& GetTabBgColor() const;
253     void         SetTabBgColor(const Color& rColor);
254 	sal_uInt16		GetScenarioFlags() const					 { return nScenarioFlags; }
255 	void		SetScenarioFlags(sal_uInt16 nNew)				 { nScenarioFlags = nNew; }
256 	void		SetActiveScenario(sal_Bool bSet)				 { bActiveScenario = bSet; }
257 	sal_Bool		IsActiveScenario() const					 { return bActiveScenario; }
258 
259 	sal_uInt8		GetLinkMode() const							{ return nLinkMode; }
260 	sal_Bool		IsLinked() const							{ return nLinkMode != SC_LINK_NONE; }
261 	const String& GetLinkDoc() const						{ return aLinkDoc; }
262 	const String& GetLinkFlt() const						{ return aLinkFlt; }
263 	const String& GetLinkOpt() const						{ return aLinkOpt; }
264 	const String& GetLinkTab() const						{ return aLinkTab; }
265 	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 
273 	void		GetCodeName( String& rName ) const {  rName = aCodeName; }
274 	void		SetCodeName( const String& rNewName ) { aCodeName = rNewName; }
275 
276     const String&   GetUpperName() const;
277 
278 	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 
315 	void		GetString( SCCOL nCol, SCROW nRow, String& rString );
316     void    FillDPCache( ScDPTableDataCache * pCache, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
317 	void		GetInputString( SCCOL nCol, SCROW nRow, String& rString );
318 	double		GetValue( const ScAddress& rPos ) const
319 					{
320                         return ValidColRow(rPos.Col(),rPos.Row()) ?
321                             aCol[rPos.Col()].GetValue( rPos.Row() ) :
322                             0.0;
323                     }
324 	double		GetValue( SCCOL nCol, SCROW nRow );
325 	void		GetFormula( SCCOL nCol, SCROW nRow, String& rFormula,
326 							sal_Bool bAsciiExport = sal_False );
327 
328 	CellType	GetCellType( const ScAddress& rPos ) const
329 					{
330                         return ValidColRow(rPos.Col(),rPos.Row()) ?
331                             aCol[rPos.Col()].GetCellType( rPos.Row() ) :
332                             CELLTYPE_NONE;
333                     }
334 	CellType	GetCellType( SCCOL nCol, SCROW nRow ) const;
335 	ScBaseCell*	GetCell( const ScAddress& rPos ) const
336 					{
337                         return ValidColRow(rPos.Col(),rPos.Row()) ?
338                             aCol[rPos.Col()].GetCell( rPos.Row() ) :
339                             NULL;
340                     }
341 	ScBaseCell*	GetCell( SCCOL nCol, SCROW nRow ) const;
342 
343     void        GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const;
344 	void		GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
345 
346     /** Returns the pointer to a cell note object at the passed cell address. */
347     ScPostIt*   GetNote( SCCOL nCol, SCROW nRow );
348     /** Sets the passed cell note object at the passed cell address. Takes ownership! */
349     void        TakeNote( SCCOL nCol, SCROW nRow, ScPostIt*& rpNote );
350     /** Returns and forgets the cell note object at the passed cell address. */
351     ScPostIt*   ReleaseNote( SCCOL nCol, SCROW nRow );
352     /** Deletes the note at the passed cell address. */
353     void        DeleteNote( SCCOL nCol, SCROW nRow );
354     /** Creates the captions of all uninitialized cell notes.
355         @param bForced  True = always create all captions, false = skip when Undo is disabled. */
356     void        InitializeNoteCaptions( bool bForced = false );
357 
358 	sal_Bool		TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize );
359 	void		InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize );
360 	void		DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize,
361 							sal_Bool* pUndoOutline = NULL );
362 
363 	sal_Bool		TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
364 	void		InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
365 	void		DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize,
366 							sal_Bool* pUndoOutline = NULL );
367 
368 	void		DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nDelFlag);
369 	void		CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable,
370                             sal_Bool bKeepScenarioFlags, sal_Bool bCloneNoteCaptions);
371     void        CopyToClip(const ScRangeList& rRanges, ScTable* pTable,
372                            bool bKeepScenarioFlags, bool bCloneNoteCaptions);
373 	void		CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy,
374 								sal_uInt16 nInsFlag, sal_Bool bAsLink, sal_Bool bSkipAttrForEmpty, ScTable* pTable);
375 	void		StartListeningInArea( SCCOL nCol1, SCROW nRow1,
376 										SCCOL nCol2, SCROW nRow2 );
377 	void		BroadcastInArea( SCCOL nCol1, SCROW nRow1,
378 									SCCOL nCol2, SCROW nRow2 );
379 
380 	void		CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
381 							sal_uInt16 nFlags, sal_Bool bMarked, ScTable* pDestTab,
382 							const ScMarkData* pMarkData = NULL,
383 							sal_Bool bAsLink = sal_False, sal_Bool bColRowFlags = sal_True);
384 	void		UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
385 							sal_uInt16 nFlags, sal_Bool bMarked, ScTable* pDestTab,
386 							const ScMarkData* pMarkData = NULL);
387 
388 	void		TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
389 								ScTable* pTransClip, sal_uInt16 nFlags, sal_Bool bAsLink );
390 
391 				//	Markierung von diesem Dokument
392 	void		MixMarked( const ScMarkData& rMark, sal_uInt16 nFunction,
393 							sal_Bool bSkipEmpty, ScTable* pSrcTab );
394 	void		MixData( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
395 							sal_uInt16 nFunction, sal_Bool bSkipEmpty, ScTable* pSrcTab );
396 
397 	void		CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
398 							SCCOL nDestCol, SCROW nDestRow, SCTAB nDestTab );
399 
400 	void		CopyScenarioFrom( const ScTable* pSrcTab );
401 	void		CopyScenarioTo( ScTable* pDestTab ) const;
402 	sal_Bool		TestCopyScenarioTo( const ScTable* pDestTab ) const;
403 	void		MarkScenarioIn( ScMarkData& rMark, sal_uInt16 nNeededBits ) const;
404 	sal_Bool		HasScenarioRange( const ScRange& rRange ) const;
405 	void		InvalidateScenarioRanges();
406 	const ScRangeList* GetScenarioRanges() const;
407 
408 	void		CopyUpdated( const ScTable* pPosTab, ScTable* pDestTab ) const;
409 
410     void        InvalidateTableArea();
411     void        InvalidatePageBreaks();
412 
413 	sal_Bool		GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const;			// sal_False = leer
414 	sal_Bool		GetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const;
415 	sal_Bool		GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, sal_Bool bNotes ) const;
416 	sal_Bool		GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
417 								SCCOL& rEndCol, sal_Bool bNotes ) const;
418 	sal_Bool		GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
419 								SCROW& rEndRow, sal_Bool bNotes ) const;
420 
421 	sal_Bool		GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const;
422 
423 	void		ExtendPrintArea( OutputDevice* pDev,
424 						SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow );
425 
426     void        GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
427                              sal_Bool bIncludeOld, bool bOnlyDown ) const;
428 
429     bool        ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
430                                       SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
431 
432 	SCSIZE	    GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
433 										SCCOL nEndCol, SCROW nEndRow, ScDirection eDir );
434 
435 	void		FindAreaPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY );
436 	void		GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY,
437 								sal_Bool bMarked, sal_Bool bUnprotected, const ScMarkData& rMark );
438 
439 	void		LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow );
440 
441 	sal_Bool		HasData( SCCOL nCol, SCROW nRow );
442 	sal_Bool		HasStringData( SCCOL nCol, SCROW nRow );
443 	sal_Bool		HasValueData( SCCOL nCol, SCROW nRow );
444 //UNUSED2008-05  sal_uInt16		GetErrorData(SCCOL nCol, SCROW nRow) const;
445 	sal_Bool		HasStringCells( SCCOL nStartCol, SCROW nStartRow,
446 								SCCOL nEndCol, SCROW nEndRow ) const;
447 
448 	sal_uInt16		GetErrCode( const ScAddress& rPos ) const
449 					{
450                         return ValidColRow(rPos.Col(),rPos.Row()) ?
451                             aCol[rPos.Col()].GetErrCode( rPos.Row() ) :
452                             0;
453                     }
454 //UNUSED2008-05  sal_uInt16		GetErrCode( SCCOL nCol, SCROW nRow ) const;
455 
456 	void		ResetChanged( const ScRange& rRange );
457 
458 	void		SetDirty();
459 	void		SetDirty( const ScRange& );
460 	void		SetDirtyAfterLoad();
461 	void		SetDirtyVar();
462 	void		SetTableOpDirty( const ScRange& );
463 	void		CalcAll();
464 	void		CalcAfterLoad();
465 	void		CompileAll();
466 	void		CompileXML( ScProgress& rProgress );
467 
468 	void		UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
469 									SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
470 									SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
471 									ScDocument* pUndoDoc = NULL, sal_Bool bIncludeDraw = sal_True, bool bUpdateNoteCaptionPos = true );
472 
473 	void		UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
474 									SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
475 									SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bUpdateNoteCaptionPos = true );
476 
477 	void		UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
478 									ScDocument* pUndoDoc );
479 
480 	void		UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
481 
482 	void		UpdateInsertTab(SCTAB nTable);
483 //UNUSED2008-05  void        UpdateInsertTabOnlyCells(SCTAB nTable);
484 	void 		UpdateDeleteTab( SCTAB nTable, sal_Bool bIsMove, ScTable* pRefUndo = NULL );
485 	void		UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, ScProgress& );
486 	void		UpdateCompile( sal_Bool bForceIfNameInUse = sal_False );
487 	void		SetTabNo(SCTAB nNewTab);
488 	sal_Bool		IsRangeNameInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
489 								 sal_uInt16 nIndex) const;
490     void        FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
491                                  std::set<sal_uInt16>& rIndexes) const;
492 	void 		ReplaceRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
493 									  const ScRangeData::IndexMap& rMap );
494 	void		Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
495 						sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
496 						double nStepValue, double nMaxValue);
497 	String		GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
498 
499 	void		UpdateSelectionFunction( ScFunctionData& rData,
500 						SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
501 						const ScMarkData& rMark );
502 
503 	void		AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
504 									sal_uInt16 nFormatNo );
505 	void		GetAutoFormatData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData& rData);
506 	void 		ScReplaceTabsStr( String& rStr, const String& rSrch, const String& rRepl ); // aus sw
507 	sal_Bool		SearchAndReplace(const SvxSearchItem& rSearchItem,
508 								SCCOL& rCol, SCROW& rRow, ScMarkData& rMark,
509 								String& rUndoStr, ScDocument* pUndoDoc);
510 
511 	void		FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2 );
512 
513 	void		GetBorderLines( SCCOL nCol, SCROW nRow,
514 								const SvxBorderLine** ppLeft, const SvxBorderLine** ppTop,
515 								const SvxBorderLine** ppRight, const SvxBorderLine** ppBottom ) const;
516 
517 //UNUSED2009-05 sal_Bool		HasLines( const ScRange& rRange, Rectangle& rSizes ) const;
518     bool        HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nMask ) const;
519 	sal_Bool		HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
520 	sal_Bool		ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
521 								SCCOL& rEndCol, SCROW& rEndRow,
522 								sal_Bool bRefresh, sal_Bool bAttrs );
523 	const SfxPoolItem*		GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const;
524 	const ScPatternAttr*	GetPattern( SCCOL nCol, SCROW nRow ) const;
525     const ScPatternAttr*    GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
526 
527 	sal_uLong					GetNumberFormat( const ScAddress& rPos ) const
528 								{
529                                     return ValidColRow(rPos.Col(),rPos.Row()) ?
530                                         aCol[rPos.Col()].GetNumberFormat( rPos.Row() ) :
531                                         0;
532                                 }
533 	sal_uLong					GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
534 	void					MergeSelectionPattern( ScMergePatternState& rState,
535 												const ScMarkData& rMark, sal_Bool bDeep ) const;
536 	void					MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1,
537 												SCCOL nCol2, SCROW nRow2, sal_Bool bDeep ) const;
538 	void					MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
539 											ScLineFlags& rFlags,
540 											SCCOL nStartCol, SCROW nStartRow,
541 											SCCOL nEndCol, SCROW nEndRow ) const;
542 	void					ApplyBlockFrame( const SvxBoxItem* pLineOuter,
543 											const SvxBoxInfoItem* pLineInner,
544 											SCCOL nStartCol, SCROW nStartRow,
545 											SCCOL nEndCol, SCROW nEndRow );
546 
547 	void		ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
548 	void		ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
549 	void		ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScPatternAttr& rAttr );
550 	void		SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, sal_Bool bPutToPool = sal_False )
551 					{
552                         if (ValidColRow(rPos.Col(),rPos.Row()))
553                             aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool );
554                     }
555 	void		SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, sal_Bool bPutToPool = sal_False );
556 	void		ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
557 							const ScPatternAttr& rPattern, short nNewType );
558 
559 	void		ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet& rStyle );
560 	void		ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet& rStyle );
561 	void		ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
562 	void		ApplySelectionLineStyle( const ScMarkData& rMark,
563 									const SvxBorderLine* pLine, sal_Bool bColorOnly );
564 
565 	const ScStyleSheet*	GetStyle( SCCOL nCol, SCROW nRow ) const;
566 	const ScStyleSheet*	GetSelectionStyle( const ScMarkData& rMark, sal_Bool& rFound ) const;
567 	const ScStyleSheet*	GetAreaStyle( sal_Bool& rFound, SCCOL nCol1, SCROW nRow1,
568 													SCCOL nCol2, SCROW nRow2 ) const;
569 
570 	void		StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, sal_Bool bRemoved,
571 									OutputDevice* pDev,
572 									double nPPTX, double nPPTY,
573 									const Fraction& rZoomX, const Fraction& rZoomY );
574 
575 	sal_Bool		IsStyleSheetUsed( const ScStyleSheet& rStyle, sal_Bool bGatherAllStyles ) const;
576 
577 	sal_Bool		ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
578 	sal_Bool		RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
579 
580 	void		ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark );
581     void        DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
582 
583 	void		ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
584 	void		ChangeSelectionIndent( sal_Bool bIncrement, const ScMarkData& rMark );
585 
586 	const ScRange*	GetRepeatColRange() const	{ return pRepeatColRange; }
587 	const ScRange*	GetRepeatRowRange() const	{ return pRepeatRowRange; }
588 	void			SetRepeatColRange( const ScRange* pNew );
589 	void			SetRepeatRowRange( const ScRange* pNew );
590 
591     sal_uInt16          GetPrintRangeCount() const          { return static_cast< sal_uInt16 >( aPrintRanges.size() ); }
592 	const ScRange*	GetPrintRange(sal_uInt16 nPos) const;
593     /** Returns true, if the sheet is always printed. */
594     sal_Bool            IsPrintEntireSheet() const          { return bPrintEntireSheet; }
595 
596     /** Removes all print ranges. */
597     void            ClearPrintRanges();
598     /** Adds a new print ranges. */
599     void            AddPrintRange( const ScRange& rNew );
600 //UNUSED2009-05 /** Removes all old print ranges and sets the passed print ranges. */
601 //UNUSED2009-05 void            SetPrintRange( const ScRange& rNew );
602     /** Marks the specified sheet to be printed completely. Deletes old print ranges! */
603     void            SetPrintEntireSheet();
604 
605 	void			FillPrintSaver( ScPrintSaverTab& rSaveTab ) const;
606 	void			RestorePrintRanges( const ScPrintSaverTab& rSaveTab );
607 
608 	sal_uInt16		GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
609 									double nPPTX, double nPPTY,
610 									const Fraction& rZoomX, const Fraction& rZoomY,
611 									sal_Bool bFormula, const ScMarkData* pMarkData,
612 									sal_Bool bSimpleTextImport );
613 	sal_Bool		SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra,
614 									OutputDevice* pDev,
615 									double nPPTX, double nPPTY,
616 									const Fraction& rZoomX, const Fraction& rZoomY,
617                                     sal_Bool bForce,
618                                     ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 );
619 	long		GetNeededSize( SCCOL nCol, SCROW nRow,
620 									OutputDevice* pDev,
621 									double nPPTX, double nPPTY,
622 									const Fraction& rZoomX, const Fraction& rZoomY,
623 									sal_Bool bWidth, sal_Bool bTotalSize );
624 	void		SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth );
625 	void		SetRowHeight( SCROW nRow, sal_uInt16 nNewHeight );
626 	sal_Bool		SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight,
627 									double nPPTX, double nPPTY );
628 
629     /**
630      * Set specified row height to specified ranges.  Don't check for drawing
631      * objects etc.  Just set the row height.  Nothing else.
632      *
633      * Note that setting a new row height via this function will not
634      * invalidate page breaks.
635      */
636     void        SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight );
637 
638 						// nPPT fuer Test auf Veraenderung
639 	void		SetManualHeight( SCROW nStartRow, SCROW nEndRow, sal_Bool bManual );
640 
641 	sal_uInt16		GetColWidth( SCCOL nCol ) const;
642     SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true ) const;
643 	sal_uLong		GetRowHeight( SCROW nStartRow, SCROW nEndRow ) const;
644 	sal_uLong		GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const;
645 	sal_uLong		GetColOffset( SCCOL nCol ) const;
646 	sal_uLong		GetRowOffset( SCROW nRow ) const;
647 
648     /**
649      * Get the last row such that the height of row 0 to the end row is as
650      * high as possible without exceeding the specified height value.
651      *
652      * @param nHeight maximum desired height
653      *
654      * @return SCROW last row of the range within specified height.
655      */
656     SCROW       GetRowForHeight(sal_uLong nHeight) const;
657 
658 	sal_uInt16		GetOriginalWidth( SCCOL nCol ) const;
659 	sal_uInt16		GetOriginalHeight( SCROW nRow ) const;
660 
661 	sal_uInt16		GetCommonWidth( SCCOL nEndCol );
662 
663 	SCROW		GetHiddenRowCount( SCROW nRow );
664 
665 	void		ShowCol(SCCOL nCol, bool bShow);
666 	void		ShowRow(SCROW nRow, bool bShow);
667 	void		DBShowRow(SCROW nRow, bool bShow);
668 
669 	void		ShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
670     void        DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags);   // if bSetFlags=false, no SetRowHidden/SetRowFiltered
671 
672 	void		SetColFlags( SCCOL nCol, sal_uInt8 nNewFlags );
673 	void		SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags );
674 	void		SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags );
675 
676                 /// @return  the index of the last row with any set flags (auto-pagebreak is ignored).
677     SCROW      GetLastFlaggedRow() const;
678 
679                 /// @return  the index of the last changed column (flags and column width, auto pagebreak is ignored).
680     SCCOL      GetLastChangedCol() const;
681                 /// @return  the index of the last changed row (flags and row height, auto pagebreak is ignored).
682     SCROW      GetLastChangedRow() const;
683 
684 	sal_Bool		IsDataFiltered() const;
685 	sal_uInt8		GetColFlags( SCCOL nCol ) const;
686 	sal_uInt8		GetRowFlags( SCROW nRow ) const;
687 
688     const ScBitMaskCompressedArray< SCROW, sal_uInt8> * GetRowFlagsArray() const
689                     { return pRowFlags; }
690 
691 	sal_Bool		UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, sal_Bool bShow );
692 	sal_Bool		UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, sal_Bool bShow );
693 
694 	void		UpdatePageBreaks( const ScRange* pUserArea );
695 	void		RemoveManualBreaks();
696 	sal_Bool		HasManualBreaks() const;
697     void        SetRowManualBreaks( const ::std::set<SCROW>& rBreaks );
698     void        SetColManualBreaks( const ::std::set<SCCOL>& rBreaks );
699 
700     void        GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const;
701     void        GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const;
702     bool        HasRowPageBreak(SCROW nRow) const;
703     bool        HasColPageBreak(SCCOL nCol) const;
704     bool        HasRowManualBreak(SCROW nRow) const;
705     bool        HasColManualBreak(SCCOL nCol) const;
706 
707     /**
708      * Get the row position of the next manual break that occurs at or below
709      * specified row.  When no more manual breaks are present at or below
710      * the specified row, -1 is returned.
711      *
712      * @param nRow row at which the search begins.
713      *
714      * @return SCROW next row position with manual page break, or -1 if no
715      *         more manual breaks are present.
716      */
717     SCROW       GetNextManualBreak(SCROW nRow) const;
718 
719     void        RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow);
720     void        RemoveRowBreak(SCROW nRow, bool bPage, bool bManual);
721     void        RemoveColBreak(SCCOL nCol, bool bPage, bool bManual);
722     void        SetRowBreak(SCROW nRow, bool bPage, bool bManual);
723     void        SetColBreak(SCCOL nCol, bool bPage, bool bManual);
724     ::com::sun::star::uno::Sequence<
725         ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const;
726 
727     bool        RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
728     bool        RowHidden(SCROW nRow, SCROW& rLastRow) const;
729     bool        HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
730     bool        ColHidden(SCCOL nCol, SCCOL& rLastCol) const;
731     bool        ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
732     void        SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
733     void        SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden);
734     void        CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
735     void        CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
736     void        CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset);
737     SCROW       FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
738     SCROW       LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
739     SCROW       CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
740     sal_uInt32  GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow) const;
741 
742     SCCOLROW    LastHiddenColRow(SCCOLROW nPos, bool bCol) const;
743 
744     bool        RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
745     bool        ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
746     bool        HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
747     void        CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
748     void        CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
749     void        SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered);
750     void        SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered);
751     SCROW       FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
752     SCROW       LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
753     SCROW       CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
754 
755     void        SyncColRowFlags();
756 
757 	void		StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
758 	void		ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
759 
760 	void		Sort(const ScSortParam& rSortParam, sal_Bool bKeepQuery);
761     sal_Bool        ValidQuery(SCROW nRow, const ScQueryParam& rQueryParam,
762                     sal_Bool* pSpecial = NULL, ScBaseCell* pCell = NULL,
763                     sal_Bool* pbTestEqualCondition = NULL );
764 	void		TopTenQuery( ScQueryParam& );
765 	SCSIZE		Query(ScQueryParam& rQueryParam, sal_Bool bKeepSub);
766 	sal_Bool		CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
767 
768     void        GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, TypedScStrCollection& rStrings, bool& rHasDates);
769     void        GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, TypedScStrCollection& rStrings, bool& rHasDates );
770 	sal_Bool		GetDataEntries(SCCOL nCol, SCROW nRow, TypedScStrCollection& rStrings, sal_Bool bLimit);
771 
772 	sal_Bool		HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
773 	sal_Bool		HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
774 
775 	void		DoColResize( SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd );
776 
777 
778     sal_Int32	GetMaxStringLen( SCCOL nCol,
779                                     SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const;
780     xub_StrLen  GetMaxNumberStringLen( sal_uInt16& nPrecision,
781                                        SCCOL nCol,
782                                        SCROW nRowStart, SCROW nRowEnd ) const;
783 
784 	void		FindConditionalFormat( sal_uLong nKey, ScRangeList& rRanges );
785 
786 	void		IncRecalcLevel() { ++nRecalcLvl; }
787 	void		DecRecalcLevel( bool bUpdateNoteCaptionPos = true ) { if (!--nRecalcLvl) SetDrawPageSize(true, bUpdateNoteCaptionPos); }
788 
789 	sal_Bool		IsSortCollatorGlobal() const;
790 	void		InitSortCollator( const ScSortParam& rPar );
791 	void		DestroySortCollator();
792 
793 private:
794 	void		FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
795 								sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd,
796 								FillDateCmd eFillDateCmd,
797 								double nStepValue, double nMaxValue, sal_uInt16 nMinDigits,
798 								sal_Bool bAttribs, ScProgress& rProgress );
799 	void		FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
800 								FillCmd& rCmd, FillDateCmd& rDateCmd,
801 								double& rInc, sal_uInt16& rMinDigits,
802 								ScUserListData*& rListData, sal_uInt16& rListIndex);
803 	void		FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
804 						sal_uLong nFillCount, FillDir eFillDir, ScProgress& rProgress );
805 
806 	sal_Bool		ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
807 								sal_Bool bMarked, sal_Bool bUnprotected );
808 
809 	void		AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
810 								const ScPatternAttr& rAttr, sal_uInt16 nFormatNo);
811 	void 		GetAutoFormatAttr(SCCOL nCol, SCROW nRow, sal_uInt16 nIndex, ScAutoFormatData& rData);
812 	void		GetAutoFormatFrame(SCCOL nCol, SCROW nRow, sal_uInt16 nFlags, sal_uInt16 nIndex, ScAutoFormatData& rData);
813 	sal_Bool 		SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRow,
814 							const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
815 	sal_Bool		Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
816 						const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
817 	sal_Bool		SearchAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
818 						String& rUndoStr, ScDocument* pUndoDoc);
819 	sal_Bool		Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
820 						const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
821 	sal_Bool		ReplaceAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
822 							String& rUndoStr, ScDocument* pUndoDoc);
823 
824 	sal_Bool		SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
825 								ScMarkData& rMark);
826 	sal_Bool		ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
827 								ScMarkData& rMark, sal_Bool bIsUndo);
828 	sal_Bool		SearchAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark);
829 	sal_Bool		ReplaceAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
830 								ScDocument* pUndoDoc);
831 
832 								// benutzen globalen SortParam:
833 	sal_Bool		IsSorted(SCCOLROW nStart, SCCOLROW nEnd);
834 	void		DecoladeRow( ScSortInfoArray*, SCROW nRow1, SCROW nRow2 );
835 	void		SwapCol(SCCOL nCol1, SCCOL nCol2);
836 	void		SwapRow(SCROW nRow1, SCROW nRow2);
837 	short 		CompareCell( sal_uInt16 nSort,
838 					ScBaseCell* pCell1, SCCOL nCell1Col, SCROW nCell1Row,
839 					ScBaseCell* pCell2, SCCOL nCell2Col, SCROW nCell2Row );
840 	short		Compare(SCCOLROW nIndex1, SCCOLROW nIndex2);
841 	short		Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2);
842 	ScSortInfoArray*	CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 );
843 	void		QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi);
844 	void		SortReorder( ScSortInfoArray*, ScProgress& );
845 
846 	sal_Bool 		CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
847 	sal_Bool 		CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
848 	void 		GetUpperCellString(SCCOL nCol, SCROW nRow, String& rStr);
849 
850 	sal_Bool		RefVisible(ScFormulaCell* pCell);
851 
852 	sal_Bool		IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol);
853 
854 	void 		IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillDateCmd eCmd);
855 	void		FillFormula(sal_uLong& nFormulaCounter, sal_Bool bFirst, ScFormulaCell* pSrcCell,
856 							SCCOL nDestCol, SCROW nDestRow, sal_Bool bLast );
857 	void		UpdateInsertTabAbs(SCTAB nNewPos);
858 	sal_Bool 		GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, sal_Bool bInSel,
859 									const ScMarkData& rMark) const;
860 	sal_Bool		GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark );
861     void        SetDrawPageSize( bool bResetStreamValid = true, bool bUpdateNoteCaptionPos = true );
862 	sal_Bool		TestTabRefAbs(SCTAB nTable);
863 	void 		CompileDBFormula();
864 	void 		CompileDBFormula( sal_Bool bCreateFormulaString );
865 	void 		CompileNameFormula( sal_Bool bCreateFormulaString );
866 	void 		CompileColRowNameFormula();
867 
868 	void		StartListening( const ScAddress& rAddress, SvtListener* pListener );
869 	void		EndListening( const ScAddress& rAddress, SvtListener* pListener );
870 	void		StartAllListeners();
871     void        StartNeededListeners(); // only for cells where NeedsListening()==TRUE
872 	void		SetRelNameDirty();
873 
874     void        SetLoadingMedium(bool bLoading);
875 
876 	SCSIZE		FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2,
877 							SCCOL nCol, SCROW nAttrRow1, SCROW nAttrRow2, SCSIZE nArrY,
878 							const ScPatternAttr* pPattern, const SfxItemSet* pCondSet );
879 
880     // idle calculation of OutputDevice text width for cell
881     // also invalidates script type, broadcasts for "calc as shown"
882     void        InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
883                                      sal_Bool bNumFormatChanged, sal_Bool bBroadcast );
884 
885     /**
886      * In case the cell text goes beyond the column width, move the max column
887      * position to the right.  This is called from ExtendPrintArea.
888      */
889     void        MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY);
890 
891     /**
892      * Use this to iterate through non-empty visible cells in a single column.
893      */
894     class VisibleDataCellIterator
895     {
896     public:
897         static SCROW ROW_NOT_FOUND;
898 
899         explicit VisibleDataCellIterator(ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn);
900         ~VisibleDataCellIterator();
901 
902         /**
903          * Set the start row position.  In case there is not visible data cell
904          * at the specified row position, it will move to the position of the
905          * first visible data cell below that point.
906          *
907          * @return First visible data cell if found, or NULL otherwise.
908          */
909         ScBaseCell* reset(SCROW nRow);
910 
911         /**
912          * Find the next visible data cell position.
913          *
914          * @return Next visible data cell if found, or NULL otherwise.
915          */
916         ScBaseCell* next();
917 
918         /**
919          * Get the current row position.
920          *
921          * @return Current row position, or ROW_NOT_FOUND if the iterator
922          *         doesn't point to a valid data cell position.
923          */
924         SCROW getRow() const;
925 
926     private:
927         ScFlatBoolRowSegments& mrRowSegs;
928         ScColumn& mrColumn;
929         ScBaseCell* mpCell;
930         SCROW mnCurRow;
931         SCROW mnUBound;
932     };
933 };
934 
935 
936 #endif
937 
938 
939