xref: /aoo42x/main/sc/inc/table.hxx (revision 0deba7fb)
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 	/*
422 	Get the last cell's postion, which has visual attribute or data and has max row number among all columns.
423 	*/
424 	void		GetLastAttrCell( SCCOL& rEndCol, SCROW& rEndRow ) const;
425 	sal_Bool		GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const;
426 
427 	void		ExtendPrintArea( OutputDevice* pDev,
428 						SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow );
429 
430     void        GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
431                              sal_Bool bIncludeOld, bool bOnlyDown ) const;
432 
433     bool        ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
434                                       SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
435 
436 	SCSIZE	    GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
437 										SCCOL nEndCol, SCROW nEndRow, ScDirection eDir );
438 
439 	void		FindAreaPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY );
440 	void		GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY,
441 								sal_Bool bMarked, sal_Bool bUnprotected, const ScMarkData& rMark );
442 
443 	void		LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow );
444 
445 	sal_Bool		HasData( SCCOL nCol, SCROW nRow );
446 	sal_Bool		HasStringData( SCCOL nCol, SCROW nRow );
447 	sal_Bool		HasValueData( SCCOL nCol, SCROW nRow );
448 //UNUSED2008-05  sal_uInt16		GetErrorData(SCCOL nCol, SCROW nRow) const;
449 	sal_Bool		HasStringCells( SCCOL nStartCol, SCROW nStartRow,
450 								SCCOL nEndCol, SCROW nEndRow ) const;
451 
452 	sal_uInt16		GetErrCode( const ScAddress& rPos ) const
453 					{
454                         return ValidColRow(rPos.Col(),rPos.Row()) ?
455                             aCol[rPos.Col()].GetErrCode( rPos.Row() ) :
456                             0;
457                     }
458 //UNUSED2008-05  sal_uInt16		GetErrCode( SCCOL nCol, SCROW nRow ) const;
459 
460 	void		ResetChanged( const ScRange& rRange );
461 
462 	void		SetDirty();
463 	void		SetDirty( const ScRange& );
464 	void		SetDirtyAfterLoad();
465 	void		SetDirtyVar();
466 	void		SetTableOpDirty( const ScRange& );
467 	void		CalcAll();
468 	void		CalcAfterLoad();
469 	void		CompileAll();
470 	void		CompileXML( ScProgress& rProgress );
471 
472 	void		UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
473 									SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
474 									SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
475 									ScDocument* pUndoDoc = NULL, sal_Bool bIncludeDraw = sal_True, bool bUpdateNoteCaptionPos = true );
476 
477 	void		UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
478 									SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
479 									SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bUpdateNoteCaptionPos = true );
480 
481 	void		UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
482 									ScDocument* pUndoDoc );
483 
484 	void		UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
485 
486 	void		UpdateInsertTab(SCTAB nTable);
487 //UNUSED2008-05  void        UpdateInsertTabOnlyCells(SCTAB nTable);
488 	void 		UpdateDeleteTab( SCTAB nTable, sal_Bool bIsMove, ScTable* pRefUndo = NULL );
489 	void		UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, ScProgress& );
490 	void		UpdateCompile( sal_Bool bForceIfNameInUse = sal_False );
491 	void		SetTabNo(SCTAB nNewTab);
492 	sal_Bool		IsRangeNameInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
493 								 sal_uInt16 nIndex) const;
494     void        FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
495                                  std::set<sal_uInt16>& rIndexes) const;
496 	void 		ReplaceRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
497 									  const ScRangeData::IndexMap& rMap );
498 	void		Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
499 						sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
500 						double nStepValue, double nMaxValue);
501 	String		GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
502 
503 	void		UpdateSelectionFunction( ScFunctionData& rData,
504 						SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
505 						const ScMarkData& rMark );
506 
507 	void		AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
508 									sal_uInt16 nFormatNo );
509 	void		GetAutoFormatData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData& rData);
510 	void 		ScReplaceTabsStr( String& rStr, const String& rSrch, const String& rRepl ); // aus sw
511 	sal_Bool		SearchAndReplace(const SvxSearchItem& rSearchItem,
512 								SCCOL& rCol, SCROW& rRow, ScMarkData& rMark,
513 								String& rUndoStr, ScDocument* pUndoDoc);
514 
515 	void		FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2 );
516 
517 	void		GetBorderLines( SCCOL nCol, SCROW nRow,
518 								const SvxBorderLine** ppLeft, const SvxBorderLine** ppTop,
519 								const SvxBorderLine** ppRight, const SvxBorderLine** ppBottom ) const;
520 
521 //UNUSED2009-05 sal_Bool		HasLines( const ScRange& rRange, Rectangle& rSizes ) const;
522     bool        HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nMask ) const;
523 	sal_Bool		HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
524 	sal_Bool		ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
525 								SCCOL& rEndCol, SCROW& rEndRow,
526 								sal_Bool bRefresh, sal_Bool bAttrs );
527 	const SfxPoolItem*		GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const;
528 	const ScPatternAttr*	GetPattern( SCCOL nCol, SCROW nRow ) const;
529     const ScPatternAttr*    GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
530 
531 	sal_uLong					GetNumberFormat( const ScAddress& rPos ) const
532 								{
533                                     return ValidColRow(rPos.Col(),rPos.Row()) ?
534                                         aCol[rPos.Col()].GetNumberFormat( rPos.Row() ) :
535                                         0;
536                                 }
537 	sal_uLong					GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
538 	void					MergeSelectionPattern( ScMergePatternState& rState,
539 												const ScMarkData& rMark, sal_Bool bDeep ) const;
540 	void					MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1,
541 												SCCOL nCol2, SCROW nRow2, sal_Bool bDeep ) const;
542 	void					MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
543 											ScLineFlags& rFlags,
544 											SCCOL nStartCol, SCROW nStartRow,
545 											SCCOL nEndCol, SCROW nEndRow ) const;
546 	void					ApplyBlockFrame( const SvxBoxItem* pLineOuter,
547 											const SvxBoxInfoItem* pLineInner,
548 											SCCOL nStartCol, SCROW nStartRow,
549 											SCCOL nEndCol, SCROW nEndRow );
550 
551 	void		ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
552 	void		ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
553 	void		ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScPatternAttr& rAttr );
554 	void		ApplyPooledPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScPatternAttr& rPooledAttr, const ScPatternAttr& rAttr );
555 
556 	void		SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, sal_Bool bPutToPool = sal_False )
557 					{
558                         if (ValidColRow(rPos.Col(),rPos.Row()))
559                             aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool );
560                     }
561 	void		SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, sal_Bool bPutToPool = sal_False );
562 	void		ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
563 							const ScPatternAttr& rPattern, short nNewType );
564 
565 	void		ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet& rStyle );
566 	void		ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet& rStyle );
567 	void		ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
568 	void		ApplySelectionLineStyle( const ScMarkData& rMark,
569 									const SvxBorderLine* pLine, sal_Bool bColorOnly );
570 
571 	const ScStyleSheet*	GetStyle( SCCOL nCol, SCROW nRow ) const;
572 	const ScStyleSheet*	GetSelectionStyle( const ScMarkData& rMark, sal_Bool& rFound ) const;
573 	const ScStyleSheet*	GetAreaStyle( sal_Bool& rFound, SCCOL nCol1, SCROW nRow1,
574 													SCCOL nCol2, SCROW nRow2 ) const;
575 
576 	void		StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, sal_Bool bRemoved,
577 									OutputDevice* pDev,
578 									double nPPTX, double nPPTY,
579 									const Fraction& rZoomX, const Fraction& rZoomY );
580 
581 	sal_Bool		IsStyleSheetUsed( const ScStyleSheet& rStyle, sal_Bool bGatherAllStyles ) const;
582 
583 	sal_Bool		ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
584 	sal_Bool		RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
585 
586 	void		ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark );
587     void        DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
588 
589 	void		ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
590 	void		ChangeSelectionIndent( sal_Bool bIncrement, const ScMarkData& rMark );
591 
592 	const ScRange*	GetRepeatColRange() const	{ return pRepeatColRange; }
593 	const ScRange*	GetRepeatRowRange() const	{ return pRepeatRowRange; }
594 	void			SetRepeatColRange( const ScRange* pNew );
595 	void			SetRepeatRowRange( const ScRange* pNew );
596 
597     sal_uInt16          GetPrintRangeCount() const          { return static_cast< sal_uInt16 >( aPrintRanges.size() ); }
598 	const ScRange*	GetPrintRange(sal_uInt16 nPos) const;
599     /** Returns true, if the sheet is always printed. */
600     sal_Bool            IsPrintEntireSheet() const          { return bPrintEntireSheet; }
601 
602     /** Removes all print ranges. */
603     void            ClearPrintRanges();
604     /** Adds a new print ranges. */
605     void            AddPrintRange( const ScRange& rNew );
606 //UNUSED2009-05 /** Removes all old print ranges and sets the passed print ranges. */
607 //UNUSED2009-05 void            SetPrintRange( const ScRange& rNew );
608     /** Marks the specified sheet to be printed completely. Deletes old print ranges! */
609     void            SetPrintEntireSheet();
610 
611 	void			FillPrintSaver( ScPrintSaverTab& rSaveTab ) const;
612 	void			RestorePrintRanges( const ScPrintSaverTab& rSaveTab );
613 
614 	sal_uInt16		GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
615 									double nPPTX, double nPPTY,
616 									const Fraction& rZoomX, const Fraction& rZoomY,
617 									sal_Bool bFormula, const ScMarkData* pMarkData,
618 									sal_Bool bSimpleTextImport );
619 	sal_Bool		SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra,
620 									OutputDevice* pDev,
621 									double nPPTX, double nPPTY,
622 									const Fraction& rZoomX, const Fraction& rZoomY,
623                                     sal_Bool bForce,
624                                     ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 );
625 	long		GetNeededSize( SCCOL nCol, SCROW nRow,
626 									OutputDevice* pDev,
627 									double nPPTX, double nPPTY,
628 									const Fraction& rZoomX, const Fraction& rZoomY,
629 									sal_Bool bWidth, sal_Bool bTotalSize );
630 	void		SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth );
631 	void		SetColWidthOnly( SCCOL nCol, sal_uInt16 nNewWidth );
632 	void		SetRowHeight( SCROW nRow, sal_uInt16 nNewHeight );
633 	sal_Bool		SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight,
634 									double nPPTX, double nPPTY );
635 
636     /**
637      * Set specified row height to specified ranges.  Don't check for drawing
638      * objects etc.  Just set the row height.  Nothing else.
639      *
640      * Note that setting a new row height via this function will not
641      * invalidate page breaks.
642      */
643     void        SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight );
644 
645 						// nPPT fuer Test auf Veraenderung
646 	void		SetManualHeight( SCROW nStartRow, SCROW nEndRow, sal_Bool bManual );
647 
648 	sal_uInt16		GetColWidth( SCCOL nCol ) const;
649     SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true ) const;
650 	sal_uLong		GetRowHeight( SCROW nStartRow, SCROW nEndRow ) const;
651 	sal_uLong		GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const;
652 	sal_uLong		GetColOffset( SCCOL nCol ) const;
653 	sal_uLong		GetRowOffset( SCROW nRow ) const;
654 
655     /**
656      * Get the last row such that the height of row 0 to the end row is as
657      * high as possible without exceeding the specified height value.
658      *
659      * @param nHeight maximum desired height
660      *
661      * @return SCROW last row of the range within specified height.
662      */
663     SCROW       GetRowForHeight(sal_uLong nHeight) const;
664 
665 	sal_uInt16		GetOriginalWidth( SCCOL nCol ) const;
666 	sal_uInt16		GetOriginalHeight( SCROW nRow ) const;
667 
668 	sal_uInt16		GetCommonWidth( SCCOL nEndCol );
669 
670 	SCROW		GetHiddenRowCount( SCROW nRow );
671 
672 	void		ShowCol(SCCOL nCol, bool bShow);
673 	void		ShowRow(SCROW nRow, bool bShow);
674 	void		DBShowRow(SCROW nRow, bool bShow);
675 
676 	void		ShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
677     void        DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags);   // if bSetFlags=false, no SetRowHidden/SetRowFiltered
678 
679 	void		SetColFlags( SCCOL nCol, sal_uInt8 nNewFlags );
680 	void		SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags );
681 	void		SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags );
682 
683                 /// @return  the index of the last row with any set flags (auto-pagebreak is ignored).
684     SCROW      GetLastFlaggedRow() const;
685 
686                 /// @return  the index of the last changed column (flags and column width, auto pagebreak is ignored).
687     SCCOL      GetLastChangedCol() const;
688                 /// @return  the index of the last changed row (flags and row height, auto pagebreak is ignored).
689     SCROW      GetLastChangedRow() const;
690 
691 	sal_Bool		IsDataFiltered() const;
692 	sal_uInt8		GetColFlags( SCCOL nCol ) const;
693 	sal_uInt8		GetRowFlags( SCROW nRow ) const;
694 
695     const ScBitMaskCompressedArray< SCROW, sal_uInt8> * GetRowFlagsArray() const
696                     { return pRowFlags; }
697 
698 	sal_Bool		UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, sal_Bool bShow );
699 	sal_Bool		UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, sal_Bool bShow );
700 
701 	void		UpdatePageBreaks( const ScRange* pUserArea );
702 	void		RemoveManualBreaks();
703 	sal_Bool		HasManualBreaks() const;
704     void        SetRowManualBreaks( const ::std::set<SCROW>& rBreaks );
705     void        SetColManualBreaks( const ::std::set<SCCOL>& rBreaks );
706 
707     void        GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const;
708     void        GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const;
709     bool        HasRowPageBreak(SCROW nRow) const;
710     bool        HasColPageBreak(SCCOL nCol) const;
711     bool        HasRowManualBreak(SCROW nRow) const;
712     bool        HasColManualBreak(SCCOL nCol) const;
713 
714     /**
715      * Get the row position of the next manual break that occurs at or below
716      * specified row.  When no more manual breaks are present at or below
717      * the specified row, -1 is returned.
718      *
719      * @param nRow row at which the search begins.
720      *
721      * @return SCROW next row position with manual page break, or -1 if no
722      *         more manual breaks are present.
723      */
724     SCROW       GetNextManualBreak(SCROW nRow) const;
725 
726     void        RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow);
727     void        RemoveRowBreak(SCROW nRow, bool bPage, bool bManual);
728     void        RemoveColBreak(SCCOL nCol, bool bPage, bool bManual);
729     void        SetRowBreak(SCROW nRow, bool bPage, bool bManual);
730     void        SetColBreak(SCCOL nCol, bool bPage, bool bManual);
731     ::com::sun::star::uno::Sequence<
732         ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const;
733 
734     bool        RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
735     bool        RowHidden(SCROW nRow, SCROW& rLastRow) const;
736     bool        HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
737     bool        ColHidden(SCCOL nCol, SCCOL& rLastCol) const;
738     bool        ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
739     void        SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
740     void        SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden);
741     void        CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
742     void        CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
743     void        CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset);
744     SCROW       FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
745     SCROW       LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
746     SCROW       CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
747     sal_uInt32  GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow) const;
748 
749     SCCOLROW    LastHiddenColRow(SCCOLROW nPos, bool bCol) const;
750 
751     bool        RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
752     bool        ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
753     bool        HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
754     void        CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
755     void        CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
756     void        SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered);
757     void        SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered);
758     SCROW       FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
759     SCROW       LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
760     SCROW       CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
761 
762     void        SyncColRowFlags();
763 
764 	void		StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
765 	void		ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
766 
767 	void		Sort(const ScSortParam& rSortParam, sal_Bool bKeepQuery);
768     sal_Bool        ValidQuery(SCROW nRow, const ScQueryParam& rQueryParam,
769                     sal_Bool* pSpecial = NULL, ScBaseCell* pCell = NULL,
770                     sal_Bool* pbTestEqualCondition = NULL );
771 	void		TopTenQuery( ScQueryParam& );
772 	SCSIZE		Query(ScQueryParam& rQueryParam, sal_Bool bKeepSub);
773 	sal_Bool		CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
774 
775     void        GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, TypedScStrCollection& rStrings, bool& rHasDates);
776     void        GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, TypedScStrCollection& rStrings, bool& rHasDates );
777 	sal_Bool		GetDataEntries(SCCOL nCol, SCROW nRow, TypedScStrCollection& rStrings, sal_Bool bLimit);
778 
779 	sal_Bool		HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
780 	sal_Bool		HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
781 
782 	void		DoColResize( SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd );
783 
784 
785     sal_Int32	GetMaxStringLen( SCCOL nCol,
786                                     SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const;
787     xub_StrLen  GetMaxNumberStringLen( sal_uInt16& nPrecision,
788                                        SCCOL nCol,
789                                        SCROW nRowStart, SCROW nRowEnd ) const;
790 
791 	void		FindConditionalFormat( sal_uLong nKey, ScRangeList& rRanges );
792 
793 	void		IncRecalcLevel() { ++nRecalcLvl; }
794 	void		DecRecalcLevel( bool bUpdateNoteCaptionPos = true ) { if (!--nRecalcLvl) SetDrawPageSize(true, bUpdateNoteCaptionPos); }
795 
796 	sal_Bool		IsSortCollatorGlobal() const;
797 	void		InitSortCollator( const ScSortParam& rPar );
798 	void		DestroySortCollator();
799 
800 private:
801 	void		FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
802 								sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd,
803 								FillDateCmd eFillDateCmd,
804 								double nStepValue, double nMaxValue, sal_uInt16 nMinDigits,
805 								sal_Bool bAttribs, ScProgress& rProgress );
806 	void		FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
807 								FillCmd& rCmd, FillDateCmd& rDateCmd,
808 								double& rInc, sal_uInt16& rMinDigits,
809 								ScUserListData*& rListData, sal_uInt16& rListIndex);
810 	void		FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
811 						sal_uLong nFillCount, FillDir eFillDir, ScProgress& rProgress );
812 
813 	sal_Bool		ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
814 								sal_Bool bMarked, sal_Bool bUnprotected );
815 
816 	void		AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
817 								const ScPatternAttr& rAttr, sal_uInt16 nFormatNo);
818 	void 		GetAutoFormatAttr(SCCOL nCol, SCROW nRow, sal_uInt16 nIndex, ScAutoFormatData& rData);
819 	void		GetAutoFormatFrame(SCCOL nCol, SCROW nRow, sal_uInt16 nFlags, sal_uInt16 nIndex, ScAutoFormatData& rData);
820 	sal_Bool 		SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRow,
821 							const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
822 	sal_Bool		Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
823 						const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
824 	sal_Bool		SearchAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
825 						String& rUndoStr, ScDocument* pUndoDoc);
826 	sal_Bool		Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
827 						const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
828 	sal_Bool		ReplaceAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
829 							String& rUndoStr, ScDocument* pUndoDoc);
830 
831 	sal_Bool		SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
832 								ScMarkData& rMark);
833 	sal_Bool		ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
834 								ScMarkData& rMark, sal_Bool bIsUndo);
835 	sal_Bool		SearchAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark);
836 	sal_Bool		ReplaceAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
837 								ScDocument* pUndoDoc);
838 
839 								// benutzen globalen SortParam:
840 	sal_Bool		IsSorted(SCCOLROW nStart, SCCOLROW nEnd);
841 	void		DecoladeRow( ScSortInfoArray*, SCROW nRow1, SCROW nRow2 );
842 	void		SwapCol(SCCOL nCol1, SCCOL nCol2);
843 	void		SwapRow(SCROW nRow1, SCROW nRow2);
844 	short 		CompareCell( sal_uInt16 nSort,
845 					ScBaseCell* pCell1, SCCOL nCell1Col, SCROW nCell1Row,
846 					ScBaseCell* pCell2, SCCOL nCell2Col, SCROW nCell2Row );
847 	short		Compare(SCCOLROW nIndex1, SCCOLROW nIndex2);
848 	short		Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2);
849 	ScSortInfoArray*	CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 );
850 	void		QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi);
851 	void		SortReorder( ScSortInfoArray*, ScProgress& );
852 
853 	sal_Bool 		CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
854 	sal_Bool 		CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
855 	void 		GetUpperCellString(SCCOL nCol, SCROW nRow, String& rStr);
856 
857 	sal_Bool		RefVisible(ScFormulaCell* pCell);
858 
859 	sal_Bool		IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol);
860 
861 	void 		IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillDateCmd eCmd);
862 	void		FillFormula(sal_uLong& nFormulaCounter, sal_Bool bFirst, ScFormulaCell* pSrcCell,
863 							SCCOL nDestCol, SCROW nDestRow, sal_Bool bLast );
864 	void		UpdateInsertTabAbs(SCTAB nNewPos);
865 	sal_Bool 		GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, sal_Bool bInSel,
866 									const ScMarkData& rMark) const;
867 	sal_Bool		GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark );
868     void        SetDrawPageSize( bool bResetStreamValid = true, bool bUpdateNoteCaptionPos = true );
869 	sal_Bool		TestTabRefAbs(SCTAB nTable);
870 	void 		CompileDBFormula();
871 	void 		CompileDBFormula( sal_Bool bCreateFormulaString );
872 	void 		CompileNameFormula( sal_Bool bCreateFormulaString );
873 	void 		CompileColRowNameFormula();
874 
875 	void		StartListening( const ScAddress& rAddress, SvtListener* pListener );
876 	void		EndListening( const ScAddress& rAddress, SvtListener* pListener );
877 	void		StartAllListeners();
878     void        StartNeededListeners(); // only for cells where NeedsListening()==TRUE
879 	void		SetRelNameDirty();
880 
881     void        SetLoadingMedium(bool bLoading);
882 
883 	SCSIZE		FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2,
884 							SCCOL nCol, SCROW nAttrRow1, SCROW nAttrRow2, SCSIZE nArrY,
885 							const ScPatternAttr* pPattern, const SfxItemSet* pCondSet );
886 
887     // idle calculation of OutputDevice text width for cell
888     // also invalidates script type, broadcasts for "calc as shown"
889     void        InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
890                                      sal_Bool bNumFormatChanged, sal_Bool bBroadcast );
891 
892     /**
893      * In case the cell text goes beyond the column width, move the max column
894      * position to the right.  This is called from ExtendPrintArea.
895      */
896     void        MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY);
897 
898     /**
899      * Use this to iterate through non-empty visible cells in a single column.
900      */
901     class VisibleDataCellIterator
902     {
903     public:
904         static SCROW ROW_NOT_FOUND;
905 
906         explicit VisibleDataCellIterator(ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn);
907         ~VisibleDataCellIterator();
908 
909         /**
910          * Set the start row position.  In case there is not visible data cell
911          * at the specified row position, it will move to the position of the
912          * first visible data cell below that point.
913          *
914          * @return First visible data cell if found, or NULL otherwise.
915          */
916         ScBaseCell* reset(SCROW nRow);
917 
918         /**
919          * Find the next visible data cell position.
920          *
921          * @return Next visible data cell if found, or NULL otherwise.
922          */
923         ScBaseCell* next();
924 
925         /**
926          * Get the current row position.
927          *
928          * @return Current row position, or ROW_NOT_FOUND if the iterator
929          *         doesn't point to a valid data cell position.
930          */
931         SCROW getRow() const;
932 
933     private:
934         ScFlatBoolRowSegments& mrRowSegs;
935         ScColumn& mrColumn;
936         ScBaseCell* mpCell;
937         SCROW mnCurRow;
938         SCROW mnUBound;
939     };
940 
941 //IAccessibility2 Implementation 2009-----
942 public :
943 	ScColumn* GetColumnByIndex(sal_Int32 index);
944 //-----IAccessibility2 Implementation 2009
945 };
946 
947 
948 #endif
949 
950 
951