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