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