xref: /aoo42x/main/sc/inc/column.hxx (revision 86e1cf34)
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_COLUMN_HXX
25cdf0e10cSrcweir #define SC_COLUMN_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "markarr.hxx"
28cdf0e10cSrcweir #include "global.hxx"
29cdf0e10cSrcweir #include "address.hxx"
30cdf0e10cSrcweir #include "rangenam.hxx"
31cdf0e10cSrcweir #include <tools/solar.h>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <set>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir class Fraction;
36cdf0e10cSrcweir class OutputDevice;
37cdf0e10cSrcweir class Rectangle;
38cdf0e10cSrcweir class SfxBroadcaster;
39cdf0e10cSrcweir class SfxItemPoolCache;
40cdf0e10cSrcweir class SfxItemSet;
41cdf0e10cSrcweir class SvtListener;
42cdf0e10cSrcweir class SfxPoolItem;
43cdf0e10cSrcweir class SfxStyleSheetBase;
44cdf0e10cSrcweir class SvxBorderLine;
45cdf0e10cSrcweir class SvxBoxInfoItem;
46cdf0e10cSrcweir class SvxBoxItem;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir class ScAttrIterator;
49cdf0e10cSrcweir class ScAttrArray;
50cdf0e10cSrcweir class ScBaseCell;
51cdf0e10cSrcweir class ScDocument;
52cdf0e10cSrcweir class ScFormulaCell;
53cdf0e10cSrcweir class ScMarkData;
54cdf0e10cSrcweir class ScPatternAttr;
55cdf0e10cSrcweir class ScStyleSheet;
56cdf0e10cSrcweir class SvtBroadcaster;
57cdf0e10cSrcweir class TypedScStrCollection;
58cdf0e10cSrcweir class ScProgress;
59cdf0e10cSrcweir class ScPostIt;
60cdf0e10cSrcweir struct ScFunctionData;
61cdf0e10cSrcweir struct ScLineFlags;
62cdf0e10cSrcweir struct ScMergePatternState;
63b4df81e3SWang Lei class ScDPTableDataCache;
64cdf0e10cSrcweir class ScFlatBoolRowSegments;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir #define COLUMN_DELTA	4
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 
69cdf0e10cSrcweir struct ScNeededSizeOptions
70cdf0e10cSrcweir {
71cdf0e10cSrcweir 	const ScPatternAttr*	pPattern;
72cdf0e10cSrcweir 	sal_Bool					bFormula;
73cdf0e10cSrcweir 	sal_Bool					bSkipMerged;
74cdf0e10cSrcweir 	sal_Bool					bGetFont;
75cdf0e10cSrcweir 	sal_Bool					bTotalSize;
76cdf0e10cSrcweir 
ScNeededSizeOptionsScNeededSizeOptions77cdf0e10cSrcweir 	ScNeededSizeOptions()
78cdf0e10cSrcweir 	{
79cdf0e10cSrcweir 		pPattern = NULL;
80cdf0e10cSrcweir 		bFormula = sal_False;
81cdf0e10cSrcweir 		bSkipMerged = sal_True;
82cdf0e10cSrcweir 		bGetFont = sal_True;
83cdf0e10cSrcweir 		bTotalSize = sal_False;
84cdf0e10cSrcweir 	}
85cdf0e10cSrcweir };
86cdf0e10cSrcweir 
87cdf0e10cSrcweir struct ColEntry
88cdf0e10cSrcweir {
89cdf0e10cSrcweir 	SCROW		nRow;
90cdf0e10cSrcweir 	ScBaseCell*	pCell;
91cdf0e10cSrcweir };
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 
94cdf0e10cSrcweir class ScColumn
95cdf0e10cSrcweir {
96cdf0e10cSrcweir private:
97cdf0e10cSrcweir 	SCCOL			nCol;
98cdf0e10cSrcweir 	SCTAB			nTab;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	SCSIZE			nCount;
101cdf0e10cSrcweir 	SCSIZE			nLimit;
102cdf0e10cSrcweir 	ColEntry*		pItems;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	ScAttrArray*	pAttrArray;
105cdf0e10cSrcweir 	ScDocument*		pDocument;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir friend class ScDocument;					// fuer FillInfo
108cdf0e10cSrcweir friend class ScDocumentIterator;
109cdf0e10cSrcweir friend class ScValueIterator;
110cdf0e10cSrcweir friend class ScHorizontalValueIterator;
111cdf0e10cSrcweir friend class ScDBQueryDataIterator;
112cdf0e10cSrcweir friend class ScColumnIterator;
113cdf0e10cSrcweir friend class ScQueryCellIterator;
114cdf0e10cSrcweir friend class ScMarkedDataIter;
115cdf0e10cSrcweir friend class ScCellIterator;
116cdf0e10cSrcweir friend class ScHorizontalCellIterator;
117cdf0e10cSrcweir friend class ScHorizontalAttrIterator;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir public:
120cdf0e10cSrcweir static sal_Bool bDoubleAlloc;			// fuer Import: Groesse beim Allozieren verdoppeln
121cdf0e10cSrcweir 
122cdf0e10cSrcweir public:
123cdf0e10cSrcweir 				ScColumn();
124cdf0e10cSrcweir 				~ScColumn();
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	void		Init(SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc);
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	sal_Bool 		Search( SCROW nRow, SCSIZE& nIndex ) const;
129cdf0e10cSrcweir 	ScBaseCell*	GetCell( SCROW nRow ) const;
130cdf0e10cSrcweir 	void		Insert( SCROW nRow, ScBaseCell* pCell );
131cdf0e10cSrcweir 	void		Insert( SCROW nRow, sal_uLong nFormatIndex, ScBaseCell* pCell );
132cdf0e10cSrcweir 	void		Append( SCROW nRow, ScBaseCell* pCell );
133cdf0e10cSrcweir 	void 		Delete( SCROW nRow );
134cdf0e10cSrcweir 	void		DeleteAtIndex( SCSIZE nIndex );
135cdf0e10cSrcweir 	void 	    FreeAll();
136cdf0e10cSrcweir 	void		Resize( SCSIZE nSize );
137cdf0e10cSrcweir 	void		SwapRow( SCROW nRow1, SCROW nRow2 );
138cdf0e10cSrcweir 	void		SwapCell( SCROW nRow, ScColumn& rCol);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir //UNUSED2009-05 sal_Bool		HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes,
141cdf0e10cSrcweir //UNUSED2009-05 			sal_Bool bLeft, sal_Bool bRight ) const;
142cdf0e10cSrcweir     bool        HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const;
143cdf0e10cSrcweir 	sal_Bool		HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
144cdf0e10cSrcweir 	sal_Bool		ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
145cdf0e10cSrcweir 								SCCOL& rPaintCol, SCROW& rPaintRow,
146cdf0e10cSrcweir 								sal_Bool bRefresh, sal_Bool bAttrs );
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 	sal_Bool		IsEmptyVisData(sal_Bool bNotes) const;		// ohne Broadcaster
149cdf0e10cSrcweir 	sal_Bool		IsEmptyData() const;
150cdf0e10cSrcweir 	sal_Bool		IsEmptyAttr() const;
151cdf0e10cSrcweir 	sal_Bool		IsEmpty() const;
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 				// nur Daten:
154cdf0e10cSrcweir 	sal_Bool		IsEmptyBlock(SCROW nStartRow, SCROW nEndRow, bool bIgnoreNotes = false) const;
155cdf0e10cSrcweir 	SCSIZE	    GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const;
156cdf0e10cSrcweir 	sal_Bool		HasDataAt(SCROW nRow) const;
157cdf0e10cSrcweir 	sal_Bool		HasVisibleDataAt(SCROW nRow) const;
158cdf0e10cSrcweir     SCROW		GetFirstDataPos() const;
159cdf0e10cSrcweir 	SCROW		GetLastDataPos() const;
160cdf0e10cSrcweir 	SCROW		GetLastVisDataPos(sal_Bool bNotes) const;				// ohne Broadcaster
161cdf0e10cSrcweir 	SCROW		GetFirstVisDataPos(sal_Bool bNotes) const;
162cdf0e10cSrcweir 	sal_Bool 		GetPrevDataPos(SCROW& rRow) const;
163cdf0e10cSrcweir 	sal_Bool 		GetNextDataPos(SCROW& rRow) const;
164cdf0e10cSrcweir 	void		FindDataAreaPos(SCROW& rRow, long nMovY) const;	// (ohne Broadcaster)
165cdf0e10cSrcweir 	void		FindUsed( SCROW nStartRow, SCROW nEndRow, sal_Bool* pUsed ) const;
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 	SCSIZE		VisibleCount( SCROW nStartRow, SCROW nEndRow ) const;
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 	sal_uInt16		GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const;
170cdf0e10cSrcweir 	sal_Bool		HasSelectionMatrixFragment(const ScMarkData& rMark) const;
171cdf0e10cSrcweir 
172cdf0e10cSrcweir     sal_Bool        GetFirstVisibleAttr( SCROW& rFirstRow ) const;
173cdf0e10cSrcweir     sal_Bool        GetLastVisibleAttr( SCROW& rLastRow ) const;
174557cb412SWang Lei 	/*
175*86e1cf34SPedro Giffuni 	Get the last cell's row number , which have visual attribute or visual data in a column
176557cb412SWang Lei 	*/
177557cb412SWang Lei 	sal_Bool		GetLastAttr( SCROW& rLastRow ) const;
178cdf0e10cSrcweir 	sal_Bool		HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
179cdf0e10cSrcweir 	sal_Bool		IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow = 0,
180cdf0e10cSrcweir 									SCROW nEndRow = MAXROW ) const;
181cdf0e10cSrcweir 	sal_Bool		IsAllAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const;
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 	sal_Bool		TestInsertCol( SCROW nStartRow, SCROW nEndRow) const;
184cdf0e10cSrcweir 	sal_Bool		TestInsertRow( SCSIZE nSize ) const;
185cdf0e10cSrcweir 	void		InsertRow( SCROW nStartRow, SCSIZE nSize );
186cdf0e10cSrcweir 	void		DeleteRow( SCROW nStartRow, SCSIZE nSize );
187cdf0e10cSrcweir     void        DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDelFlag );
188cdf0e10cSrcweir     void        DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag );
189cdf0e10cSrcweir     void        CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, sal_Bool bKeepScenarioFlags, sal_Bool bCloneNoteCaptions);
190cdf0e10cSrcweir 	void		CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
191cdf0e10cSrcweir 								sal_uInt16 nInsFlag, sal_Bool bAsLink, sal_Bool bSkipAttrForEmpty, ScColumn& rColumn);
192cdf0e10cSrcweir 	void		StartListeningInArea( SCROW nRow1, SCROW nRow2 );
193cdf0e10cSrcweir 	void		BroadcastInArea( SCROW nRow1, SCROW nRow2 );
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 	void		RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow );
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 				//	Markierung von diesem Dokument
198cdf0e10cSrcweir 	void		MixMarked( const ScMarkData& rMark, sal_uInt16 nFunction,
199cdf0e10cSrcweir 							sal_Bool bSkipEmpty, ScColumn& rSrcCol );
200cdf0e10cSrcweir 	void		MixData( SCROW nRow1, SCROW nRow2, sal_uInt16 nFunction, sal_Bool bSkipEmpty,
201cdf0e10cSrcweir 							ScColumn& rSrcCol );
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 	ScFormulaCell*	CreateRefCell( ScDocument* pDestDoc, const ScAddress& rDestPos,
204cdf0e10cSrcweir 									SCSIZE nIndex, sal_uInt16 nFlags ) const;
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 	ScAttrIterator* CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) const;
207cdf0e10cSrcweir 
GetCol() const208cdf0e10cSrcweir 	SCCOL		GetCol() const { return nCol; }
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 				//	UpdateSelectionFunction: Mehrfachselektion
211cdf0e10cSrcweir 	void		UpdateSelectionFunction( const ScMarkData& rMark,
212cdf0e10cSrcweir 									ScFunctionData& rData,
213cdf0e10cSrcweir                                     ScFlatBoolRowSegments& rHiddenRows,
214cdf0e10cSrcweir 									sal_Bool bDoExclude, SCROW nExStartRow, SCROW nExEndRow );
215cdf0e10cSrcweir 	void		UpdateAreaFunction( ScFunctionData& rData,
216cdf0e10cSrcweir                                     ScFlatBoolRowSegments& rHiddenRows,
217cdf0e10cSrcweir 									SCROW nStartRow, SCROW nEndRow );
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 	void		CopyToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, sal_Bool bMarked,
220cdf0e10cSrcweir 								ScColumn& rColumn, const ScMarkData* pMarkData = NULL,
221cdf0e10cSrcweir 								sal_Bool bAsLink = sal_False );
222cdf0e10cSrcweir 	void		UndoToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, sal_Bool bMarked,
223cdf0e10cSrcweir 								ScColumn& rColumn, const ScMarkData* pMarkData = NULL );
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 	void		CopyScenarioFrom( const ScColumn& rSrcCol );
226cdf0e10cSrcweir 	void		CopyScenarioTo( ScColumn& rDestCol ) const;
227cdf0e10cSrcweir 	sal_Bool		TestCopyScenarioTo( const ScColumn& rDestCol ) const;
228cdf0e10cSrcweir 	void		MarkScenarioIn( ScMarkData& rDestMark ) const;
229cdf0e10cSrcweir 
230cdf0e10cSrcweir 	void		CopyUpdated( const ScColumn& rPosCol, ScColumn& rDestCol ) const;
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 	void		SwapCol(ScColumn& rCol);
233cdf0e10cSrcweir 	void		MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol);
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 	sal_Bool		HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst) const;
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 				//	sal_True = Zahlformat gesetzt
238cdf0e10cSrcweir 	sal_Bool		SetString( SCROW nRow, SCTAB nTab, const String& rString,
239cdf0e10cSrcweir 						   formula::FormulaGrammar::AddressConvention conv = formula::FormulaGrammar::CONV_OOO,
240cdf0e10cSrcweir                            SvNumberFormatter* pFormatter = NULL,
241cdf0e10cSrcweir                            bool bDetectNumberFormat = true );
242cdf0e10cSrcweir 	void		SetValue( SCROW nRow, const double& rVal);
243cdf0e10cSrcweir 	void		SetError( SCROW nRow, const sal_uInt16 nError);
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 	void		GetString( SCROW nRow, String& rString ) const;
246cdf0e10cSrcweir 	void		GetInputString( SCROW nRow, String& rString ) const;
247cdf0e10cSrcweir 	double		GetValue( SCROW nRow ) const;
248cdf0e10cSrcweir 	void		GetFormula( SCROW nRow, String& rFormula,
249cdf0e10cSrcweir 							sal_Bool bAsciiExport = sal_False ) const;
250cdf0e10cSrcweir 	CellType	GetCellType( SCROW nRow ) const;
GetCellCount() const251cdf0e10cSrcweir 	SCSIZE		GetCellCount() const { return nCount; }
252cdf0e10cSrcweir 	sal_uLong		GetWeightedCount() const;
253cdf0e10cSrcweir 	sal_uLong		GetCodeCount() const;		// RPN-Code in Formeln
254cdf0e10cSrcweir 	sal_uInt16		GetErrCode( SCROW nRow ) const;
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 	sal_Bool		HasStringData( SCROW nRow ) const;
257cdf0e10cSrcweir 	sal_Bool		HasValueData( SCROW nRow ) const;
258cdf0e10cSrcweir //UNUSED2009-05 sal_uInt16		GetErrorData( SCROW nRow) const;
259cdf0e10cSrcweir 	sal_Bool		HasStringCells( SCROW nStartRow, SCROW nEndRow ) const;
260cdf0e10cSrcweir 
261cdf0e10cSrcweir     /** Returns the pointer to a cell note object at the passed row. */
262cdf0e10cSrcweir     ScPostIt*   GetNote( SCROW nRow );
263cdf0e10cSrcweir     /** Sets the passed cell note object at the passed row. Takes ownership! */
264cdf0e10cSrcweir     void        TakeNote( SCROW nRow, ScPostIt* pNote );
265cdf0e10cSrcweir     /** Returns and forgets a cell note object at the passed row. */
266cdf0e10cSrcweir     ScPostIt*   ReleaseNote( SCROW nRow );
267cdf0e10cSrcweir     /** Deletes the note at the passed row. */
268cdf0e10cSrcweir     void        DeleteNote( SCROW nRow );
269cdf0e10cSrcweir 
270cdf0e10cSrcweir 	void		SetDirty();
271cdf0e10cSrcweir 	void		SetDirty( const ScRange& );
272cdf0e10cSrcweir 	void		SetDirtyVar();
273cdf0e10cSrcweir 	void		SetDirtyAfterLoad();
274cdf0e10cSrcweir 	void		SetTableOpDirty( const ScRange& );
275cdf0e10cSrcweir 	void		CalcAll();
276cdf0e10cSrcweir 	void		CalcAfterLoad();
277cdf0e10cSrcweir 	void		CompileAll();
278cdf0e10cSrcweir 	void		CompileXML( ScProgress& rProgress );
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 	void		ResetChanged( SCROW nStartRow, SCROW nEndRow );
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 	void		UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
283cdf0e10cSrcweir 									 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
284cdf0e10cSrcweir 									 SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
285cdf0e10cSrcweir 									 ScDocument* pUndoDoc = NULL );
286cdf0e10cSrcweir 	void		UpdateInsertTab( SCTAB nTable);
287cdf0e10cSrcweir 	void		UpdateInsertTabOnlyCells( SCTAB nTable);
288cdf0e10cSrcweir 	void		UpdateDeleteTab( SCTAB nTable, sal_Bool bIsMove, ScColumn* pRefUndo = NULL );
289cdf0e10cSrcweir 	void		UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo);
290cdf0e10cSrcweir 	void		UpdateCompile( sal_Bool bForceIfNameInUse = sal_False );
291cdf0e10cSrcweir 	void		UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
292cdf0e10cSrcweir 									ScDocument* pUndoDoc );
293cdf0e10cSrcweir 	void		UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 	void		SetTabNo(SCTAB nNewTab);
296cdf0e10cSrcweir 	sal_Bool		IsRangeNameInUse(SCROW nRow1, SCROW nRow2, sal_uInt16 nIndex) const;
297cdf0e10cSrcweir     void        FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, std::set<sal_uInt16>& rIndexes) const;
298cdf0e10cSrcweir 	void 		ReplaceRangeNamesInUse( SCROW nRow1, SCROW nRow2, const ScRangeData::IndexMap& rMap );
299cdf0e10cSrcweir 
300cdf0e10cSrcweir 	const SfxPoolItem*		GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
301cdf0e10cSrcweir 	const ScPatternAttr*	GetPattern( SCROW nRow ) const;
3023a02adb1SWang Lei 	const ScPatternAttr* GetPatternRange( SCROW& rStartRow, SCROW& rEndRow, SCROW nRow ) const;
303cdf0e10cSrcweir     const ScPatternAttr*    GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const;
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 	sal_uLong		GetNumberFormat( SCROW nRow ) const;
306cdf0e10cSrcweir 
307cdf0e10cSrcweir 	void		MergeSelectionPattern( ScMergePatternState& rState, const ScMarkData& rMark, sal_Bool bDeep ) const;
308cdf0e10cSrcweir 	void		MergePatternArea( ScMergePatternState& rState, SCROW nRow1, SCROW nRow2, sal_Bool bDeep ) const;
309cdf0e10cSrcweir 	void		MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
310cdf0e10cSrcweir 							ScLineFlags& rFlags,
311cdf0e10cSrcweir 							SCROW nStartRow, SCROW nEndRow, sal_Bool bLeft, SCCOL nDistRight ) const;
312cdf0e10cSrcweir 	void		ApplyBlockFrame( const SvxBoxItem* pLineOuter, const SvxBoxInfoItem* pLineInner,
313cdf0e10cSrcweir 							SCROW nStartRow, SCROW nEndRow, sal_Bool bLeft, SCCOL nDistRight );
314cdf0e10cSrcweir 
315cdf0e10cSrcweir 	void		ApplyAttr( SCROW nRow, const SfxPoolItem& rAttr );
316cdf0e10cSrcweir 	void		ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
317cdf0e10cSrcweir 	void		ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr );
318cdf0e10cSrcweir 	void		SetPattern( SCROW nRow, const ScPatternAttr& rPatAttr, sal_Bool bPutToPool = sal_False );
319cdf0e10cSrcweir 	void		SetPatternArea( SCROW nStartRow, SCROW nEndRow,
320cdf0e10cSrcweir 								const ScPatternAttr& rPatAttr, sal_Bool bPutToPool = sal_False );
321cdf0e10cSrcweir 	void		ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
322cdf0e10cSrcweir 							const ScPatternAttr& rPattern, short nNewType );
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 	void		ApplyStyle( SCROW nRow, const ScStyleSheet& rStyle );
325cdf0e10cSrcweir 	void		ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle );
326cdf0e10cSrcweir 	void 		ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
327cdf0e10cSrcweir 	void		ApplySelectionLineStyle( const ScMarkData& rMark,
328cdf0e10cSrcweir 									const SvxBorderLine* pLine, sal_Bool bColorOnly );
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 	const ScStyleSheet*	GetStyle( SCROW nRow ) const;
331cdf0e10cSrcweir 	const ScStyleSheet*	GetSelectionStyle( const ScMarkData& rMark, sal_Bool& rFound ) const;
332cdf0e10cSrcweir 	const ScStyleSheet*	GetAreaStyle( sal_Bool& rFound, SCROW nRow1, SCROW nRow2 ) const;
333cdf0e10cSrcweir 
334cdf0e10cSrcweir 	void		FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBoolRowSegments& rUsedRows, bool bReset );
335cdf0e10cSrcweir 	sal_Bool		IsStyleSheetUsed( const ScStyleSheet& rStyle, sal_Bool bGatherAllStyles ) const;
336cdf0e10cSrcweir 
337cdf0e10cSrcweir                 /// May return -1 if not found
338cdf0e10cSrcweir 	SCsROW		SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle,
339cdf0e10cSrcweir 								sal_Bool bUp, sal_Bool bInSelection, const ScMarkData& rMark );
340cdf0e10cSrcweir 	sal_Bool		SearchStyleRange( SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle,
341cdf0e10cSrcweir 									sal_Bool bUp, sal_Bool bInSelection, const ScMarkData& rMark );
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 	sal_Bool		ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags );
344cdf0e10cSrcweir 	sal_Bool		RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags );
345cdf0e10cSrcweir 	void		ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich );
346cdf0e10cSrcweir 
347cdf0e10cSrcweir 	void		RemoveProtected( SCROW nStartRow, SCROW nEndRow );
348cdf0e10cSrcweir 
349cdf0e10cSrcweir 	SCsROW		ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark );
350cdf0e10cSrcweir     void        DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
351cdf0e10cSrcweir 
352cdf0e10cSrcweir 	void		ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
353cdf0e10cSrcweir 	void		ChangeSelectionIndent( sal_Bool bIncrement, const ScMarkData& rMark );
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 	long		GetNeededSize( SCROW nRow, OutputDevice* pDev,
356cdf0e10cSrcweir 									double nPPTX, double nPPTY,
357cdf0e10cSrcweir 									const Fraction& rZoomX, const Fraction& rZoomY,
358cdf0e10cSrcweir 									sal_Bool bWidth, const ScNeededSizeOptions& rOptions );
359cdf0e10cSrcweir 	sal_uInt16		GetOptimalColWidth( OutputDevice* pDev, double nPPTX, double nPPTY,
360cdf0e10cSrcweir 									const Fraction& rZoomX, const Fraction& rZoomY,
361cdf0e10cSrcweir 									sal_Bool bFormula, sal_uInt16 nOldWidth,
362cdf0e10cSrcweir 									const ScMarkData* pMarkData,
363cdf0e10cSrcweir 									sal_Bool bSimpleTextImport );
364cdf0e10cSrcweir 	void		GetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHeight,
365cdf0e10cSrcweir 									OutputDevice* pDev,
366cdf0e10cSrcweir 									double nPPTX, double nPPTY,
367cdf0e10cSrcweir 									const Fraction& rZoomX, const Fraction& rZoomY,
368cdf0e10cSrcweir 									sal_Bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart );
369b4df81e3SWang Lei     template< typename TAddLebal, typename TAddData >
370b4df81e3SWang Lei     void        FillDPCacheT( long nDim, SCROW nStartRow, SCROW nEndRow, const TAddLebal & , const TAddData & );
371b4df81e3SWang Lei     void        FillDPCache( ScDPTableDataCache * pCache, long nDim, SCROW nStartRow, SCROW nEndRow );
372cdf0e10cSrcweir private:
373cdf0e10cSrcweir 	long		GetSimpleTextNeededSize( SCSIZE nIndex, OutputDevice* pDev,
374cdf0e10cSrcweir 									sal_Bool bWidth );
375cdf0e10cSrcweir public:
376cdf0e10cSrcweir 
377cdf0e10cSrcweir                 /// Including current, may return -1
378cdf0e10cSrcweir 	SCsROW		GetNextUnprotected( SCROW nRow, sal_Bool bUp ) const;
379cdf0e10cSrcweir 
380cdf0e10cSrcweir     void		GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollection& rStrings, bool& rHasDates);
381cdf0e10cSrcweir 	sal_Bool		GetDataEntries(SCROW nRow, TypedScStrCollection& rStrings, sal_Bool bLimit);
382cdf0e10cSrcweir 
383cdf0e10cSrcweir //UNUSED2008-05  SCROW		NoteCount( SCROW nMaxRow = MAXROW ) const;
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 	void		UpdateInsertTabAbs(SCTAB nNewPos);
386cdf0e10cSrcweir 	sal_Bool		TestTabRefAbs(SCTAB nTable);
387cdf0e10cSrcweir 	sal_Bool 		GetNextSpellingCell(SCROW& nRow, sal_Bool bInSel, const ScMarkData& rData) const;
388cdf0e10cSrcweir 
389cdf0e10cSrcweir 	void		RemoveAutoSpellObj();
390cdf0e10cSrcweir 
391cdf0e10cSrcweir 	void		StartListening( SvtListener& rLst, SCROW nRow );
392cdf0e10cSrcweir 	void		EndListening( SvtListener& rLst, SCROW nRow );
393cdf0e10cSrcweir 	void		MoveListeners( SvtBroadcaster& rSource, SCROW nDestRow );
394cdf0e10cSrcweir 	void		StartAllListeners();
395cdf0e10cSrcweir     void        StartNeededListeners(); // only for cells where NeedsListening()==TRUE
396cdf0e10cSrcweir 	void		SetRelNameDirty();
397cdf0e10cSrcweir 
398cdf0e10cSrcweir 	void 		CompileDBFormula();
399cdf0e10cSrcweir 	void 		CompileDBFormula( sal_Bool bCreateFormulaString );
400cdf0e10cSrcweir 	void 		CompileNameFormula( sal_Bool bCreateFormulaString );
401cdf0e10cSrcweir     void 		CompileColRowNameFormula();
402cdf0e10cSrcweir 
403cdf0e10cSrcweir     sal_Int32	GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const;
404cdf0e10cSrcweir     xub_StrLen  GetMaxNumberStringLen( sal_uInt16& nPrecision,
405cdf0e10cSrcweir                                        SCROW nRowStart, SCROW nRowEnd ) const;
406cdf0e10cSrcweir 
4078f4c7c28SSteve Yin     SCSIZE      GetPatternCount( );
4088f4c7c28SSteve Yin     SCSIZE      GetPatternCount( SCROW nRw1, SCROW nRw2 );
4098f4c7c28SSteve Yin     bool        ReservedPatternCount( SCSIZE nReserved );
410cdf0e10cSrcweir private:
411cdf0e10cSrcweir 	ScBaseCell* CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos);
412cdf0e10cSrcweir //UNUSED2008-05  void		CorrectSymbolCells( CharSet eStreamCharSet );
413cdf0e10cSrcweir };
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 
416cdf0e10cSrcweir class ScColumnIterator					// alle Daten eines Bereichs durchgehen
417cdf0e10cSrcweir {
418cdf0e10cSrcweir 	const ScColumn*		pColumn;
419cdf0e10cSrcweir 	SCSIZE				nPos;
420cdf0e10cSrcweir 	SCROW				nTop;
421cdf0e10cSrcweir 	SCROW				nBottom;
422cdf0e10cSrcweir public:
423cdf0e10cSrcweir 				ScColumnIterator( const ScColumn* pCol, SCROW nStart=0, SCROW nEnd=MAXROW );
424cdf0e10cSrcweir 				~ScColumnIterator();
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 	sal_Bool		Next( SCROW& rRow, ScBaseCell*& rpCell );
427cdf0e10cSrcweir 	SCSIZE		GetIndex() const;
428cdf0e10cSrcweir };
429cdf0e10cSrcweir 
430cdf0e10cSrcweir 
431cdf0e10cSrcweir class ScMarkedDataIter					// Daten in selektierten Bereichen durchgehen
432cdf0e10cSrcweir {
433cdf0e10cSrcweir 	const ScColumn*		pColumn;
434cdf0e10cSrcweir 	SCSIZE				nPos;
435cdf0e10cSrcweir 	ScMarkArrayIter*	pMarkIter;
436cdf0e10cSrcweir 	SCROW				nTop;
437cdf0e10cSrcweir 	SCROW				nBottom;
438cdf0e10cSrcweir 	sal_Bool				bNext;
439cdf0e10cSrcweir 	sal_Bool				bAll;
440cdf0e10cSrcweir 
441cdf0e10cSrcweir public:
442cdf0e10cSrcweir 				ScMarkedDataIter( const ScColumn* pCol, const ScMarkData* pMarkData,
443cdf0e10cSrcweir 									sal_Bool bAllIfNone = sal_False );
444cdf0e10cSrcweir 				~ScMarkedDataIter();
445cdf0e10cSrcweir 
446cdf0e10cSrcweir 	sal_Bool		Next( SCSIZE& rIndex );
447cdf0e10cSrcweir };
448cdf0e10cSrcweir 
449cdf0e10cSrcweir 
450cdf0e10cSrcweir #endif
451cdf0e10cSrcweir 
452cdf0e10cSrcweir 
453