xref: /AOO41X/main/sc/inc/column.hxx (revision 3a02adb192a454612d9255c0c219a65a4fe24f93)
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
10cdf0e10cSrcweir  *
1138d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
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 
77cdf0e10cSrcweir 	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;
174cdf0e10cSrcweir 	sal_Bool		HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
175cdf0e10cSrcweir 	sal_Bool		IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow = 0,
176cdf0e10cSrcweir 									SCROW nEndRow = MAXROW ) const;
177cdf0e10cSrcweir 	sal_Bool		IsAllAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const;
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 	sal_Bool		TestInsertCol( SCROW nStartRow, SCROW nEndRow) const;
180cdf0e10cSrcweir 	sal_Bool		TestInsertRow( SCSIZE nSize ) const;
181cdf0e10cSrcweir 	void		InsertRow( SCROW nStartRow, SCSIZE nSize );
182cdf0e10cSrcweir 	void		DeleteRow( SCROW nStartRow, SCSIZE nSize );
183cdf0e10cSrcweir     void        DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDelFlag );
184cdf0e10cSrcweir     void        DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag );
185cdf0e10cSrcweir     void        CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, sal_Bool bKeepScenarioFlags, sal_Bool bCloneNoteCaptions);
186cdf0e10cSrcweir 	void		CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
187cdf0e10cSrcweir 								sal_uInt16 nInsFlag, sal_Bool bAsLink, sal_Bool bSkipAttrForEmpty, ScColumn& rColumn);
188cdf0e10cSrcweir 	void		StartListeningInArea( SCROW nRow1, SCROW nRow2 );
189cdf0e10cSrcweir 	void		BroadcastInArea( SCROW nRow1, SCROW nRow2 );
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 	void		RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow );
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 				//	Markierung von diesem Dokument
194cdf0e10cSrcweir 	void		MixMarked( const ScMarkData& rMark, sal_uInt16 nFunction,
195cdf0e10cSrcweir 							sal_Bool bSkipEmpty, ScColumn& rSrcCol );
196cdf0e10cSrcweir 	void		MixData( SCROW nRow1, SCROW nRow2, sal_uInt16 nFunction, sal_Bool bSkipEmpty,
197cdf0e10cSrcweir 							ScColumn& rSrcCol );
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 	ScFormulaCell*	CreateRefCell( ScDocument* pDestDoc, const ScAddress& rDestPos,
200cdf0e10cSrcweir 									SCSIZE nIndex, sal_uInt16 nFlags ) const;
201cdf0e10cSrcweir 
202cdf0e10cSrcweir 	ScAttrIterator* CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) const;
203cdf0e10cSrcweir 
204cdf0e10cSrcweir 	SCCOL		GetCol() const { return nCol; }
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 				//	UpdateSelectionFunction: Mehrfachselektion
207cdf0e10cSrcweir 	void		UpdateSelectionFunction( const ScMarkData& rMark,
208cdf0e10cSrcweir 									ScFunctionData& rData,
209cdf0e10cSrcweir                                     ScFlatBoolRowSegments& rHiddenRows,
210cdf0e10cSrcweir 									sal_Bool bDoExclude, SCROW nExStartRow, SCROW nExEndRow );
211cdf0e10cSrcweir 	void		UpdateAreaFunction( ScFunctionData& rData,
212cdf0e10cSrcweir                                     ScFlatBoolRowSegments& rHiddenRows,
213cdf0e10cSrcweir 									SCROW nStartRow, SCROW nEndRow );
214cdf0e10cSrcweir 
215cdf0e10cSrcweir 	void		CopyToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, sal_Bool bMarked,
216cdf0e10cSrcweir 								ScColumn& rColumn, const ScMarkData* pMarkData = NULL,
217cdf0e10cSrcweir 								sal_Bool bAsLink = sal_False );
218cdf0e10cSrcweir 	void		UndoToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, sal_Bool bMarked,
219cdf0e10cSrcweir 								ScColumn& rColumn, const ScMarkData* pMarkData = NULL );
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 	void		CopyScenarioFrom( const ScColumn& rSrcCol );
222cdf0e10cSrcweir 	void		CopyScenarioTo( ScColumn& rDestCol ) const;
223cdf0e10cSrcweir 	sal_Bool		TestCopyScenarioTo( const ScColumn& rDestCol ) const;
224cdf0e10cSrcweir 	void		MarkScenarioIn( ScMarkData& rDestMark ) const;
225cdf0e10cSrcweir 
226cdf0e10cSrcweir 	void		CopyUpdated( const ScColumn& rPosCol, ScColumn& rDestCol ) const;
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 	void		SwapCol(ScColumn& rCol);
229cdf0e10cSrcweir 	void		MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol);
230cdf0e10cSrcweir 
231cdf0e10cSrcweir 	sal_Bool		HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst) const;
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 				//	sal_True = Zahlformat gesetzt
234cdf0e10cSrcweir 	sal_Bool		SetString( SCROW nRow, SCTAB nTab, const String& rString,
235cdf0e10cSrcweir 						   formula::FormulaGrammar::AddressConvention conv = formula::FormulaGrammar::CONV_OOO,
236cdf0e10cSrcweir                            SvNumberFormatter* pFormatter = NULL,
237cdf0e10cSrcweir                            bool bDetectNumberFormat = true );
238cdf0e10cSrcweir 	void		SetValue( SCROW nRow, const double& rVal);
239cdf0e10cSrcweir 	void		SetError( SCROW nRow, const sal_uInt16 nError);
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 	void		GetString( SCROW nRow, String& rString ) const;
242cdf0e10cSrcweir 	void		GetInputString( SCROW nRow, String& rString ) const;
243cdf0e10cSrcweir 	double		GetValue( SCROW nRow ) const;
244cdf0e10cSrcweir 	void		GetFormula( SCROW nRow, String& rFormula,
245cdf0e10cSrcweir 							sal_Bool bAsciiExport = sal_False ) const;
246cdf0e10cSrcweir 	CellType	GetCellType( SCROW nRow ) const;
247cdf0e10cSrcweir 	SCSIZE		GetCellCount() const { return nCount; }
248cdf0e10cSrcweir 	sal_uLong		GetWeightedCount() const;
249cdf0e10cSrcweir 	sal_uLong		GetCodeCount() const;		// RPN-Code in Formeln
250cdf0e10cSrcweir 	sal_uInt16		GetErrCode( SCROW nRow ) const;
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 	sal_Bool		HasStringData( SCROW nRow ) const;
253cdf0e10cSrcweir 	sal_Bool		HasValueData( SCROW nRow ) const;
254cdf0e10cSrcweir //UNUSED2009-05 sal_uInt16		GetErrorData( SCROW nRow) const;
255cdf0e10cSrcweir 	sal_Bool		HasStringCells( SCROW nStartRow, SCROW nEndRow ) const;
256cdf0e10cSrcweir 
257cdf0e10cSrcweir     /** Returns the pointer to a cell note object at the passed row. */
258cdf0e10cSrcweir     ScPostIt*   GetNote( SCROW nRow );
259cdf0e10cSrcweir     /** Sets the passed cell note object at the passed row. Takes ownership! */
260cdf0e10cSrcweir     void        TakeNote( SCROW nRow, ScPostIt* pNote );
261cdf0e10cSrcweir     /** Returns and forgets a cell note object at the passed row. */
262cdf0e10cSrcweir     ScPostIt*   ReleaseNote( SCROW nRow );
263cdf0e10cSrcweir     /** Deletes the note at the passed row. */
264cdf0e10cSrcweir     void        DeleteNote( SCROW nRow );
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 	void		SetDirty();
267cdf0e10cSrcweir 	void		SetDirty( const ScRange& );
268cdf0e10cSrcweir 	void		SetDirtyVar();
269cdf0e10cSrcweir 	void		SetDirtyAfterLoad();
270cdf0e10cSrcweir 	void		SetTableOpDirty( const ScRange& );
271cdf0e10cSrcweir 	void		CalcAll();
272cdf0e10cSrcweir 	void		CalcAfterLoad();
273cdf0e10cSrcweir 	void		CompileAll();
274cdf0e10cSrcweir 	void		CompileXML( ScProgress& rProgress );
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 	void		ResetChanged( SCROW nStartRow, SCROW nEndRow );
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 	void		UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
279cdf0e10cSrcweir 									 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
280cdf0e10cSrcweir 									 SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
281cdf0e10cSrcweir 									 ScDocument* pUndoDoc = NULL );
282cdf0e10cSrcweir 	void		UpdateInsertTab( SCTAB nTable);
283cdf0e10cSrcweir 	void		UpdateInsertTabOnlyCells( SCTAB nTable);
284cdf0e10cSrcweir 	void		UpdateDeleteTab( SCTAB nTable, sal_Bool bIsMove, ScColumn* pRefUndo = NULL );
285cdf0e10cSrcweir 	void		UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo);
286cdf0e10cSrcweir 	void		UpdateCompile( sal_Bool bForceIfNameInUse = sal_False );
287cdf0e10cSrcweir 	void		UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
288cdf0e10cSrcweir 									ScDocument* pUndoDoc );
289cdf0e10cSrcweir 	void		UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
290cdf0e10cSrcweir 
291cdf0e10cSrcweir 	void		SetTabNo(SCTAB nNewTab);
292cdf0e10cSrcweir 	sal_Bool		IsRangeNameInUse(SCROW nRow1, SCROW nRow2, sal_uInt16 nIndex) const;
293cdf0e10cSrcweir     void        FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, std::set<sal_uInt16>& rIndexes) const;
294cdf0e10cSrcweir 	void 		ReplaceRangeNamesInUse( SCROW nRow1, SCROW nRow2, const ScRangeData::IndexMap& rMap );
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	const SfxPoolItem*		GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
297cdf0e10cSrcweir 	const ScPatternAttr*	GetPattern( SCROW nRow ) const;
298*3a02adb1SWang Lei 	const ScPatternAttr* GetPatternRange( SCROW& rStartRow, SCROW& rEndRow, SCROW nRow ) const;
299cdf0e10cSrcweir     const ScPatternAttr*    GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const;
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 	sal_uLong		GetNumberFormat( SCROW nRow ) const;
302cdf0e10cSrcweir 
303cdf0e10cSrcweir 	void		MergeSelectionPattern( ScMergePatternState& rState, const ScMarkData& rMark, sal_Bool bDeep ) const;
304cdf0e10cSrcweir 	void		MergePatternArea( ScMergePatternState& rState, SCROW nRow1, SCROW nRow2, sal_Bool bDeep ) const;
305cdf0e10cSrcweir 	void		MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
306cdf0e10cSrcweir 							ScLineFlags& rFlags,
307cdf0e10cSrcweir 							SCROW nStartRow, SCROW nEndRow, sal_Bool bLeft, SCCOL nDistRight ) const;
308cdf0e10cSrcweir 	void		ApplyBlockFrame( const SvxBoxItem* pLineOuter, const SvxBoxInfoItem* pLineInner,
309cdf0e10cSrcweir 							SCROW nStartRow, SCROW nEndRow, sal_Bool bLeft, SCCOL nDistRight );
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 	void		ApplyAttr( SCROW nRow, const SfxPoolItem& rAttr );
312cdf0e10cSrcweir 	void		ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
313cdf0e10cSrcweir 	void		ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr );
314cdf0e10cSrcweir 	void		SetPattern( SCROW nRow, const ScPatternAttr& rPatAttr, sal_Bool bPutToPool = sal_False );
315cdf0e10cSrcweir 	void		SetPatternArea( SCROW nStartRow, SCROW nEndRow,
316cdf0e10cSrcweir 								const ScPatternAttr& rPatAttr, sal_Bool bPutToPool = sal_False );
317cdf0e10cSrcweir 	void		ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
318cdf0e10cSrcweir 							const ScPatternAttr& rPattern, short nNewType );
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 	void		ApplyStyle( SCROW nRow, const ScStyleSheet& rStyle );
321cdf0e10cSrcweir 	void		ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle );
322cdf0e10cSrcweir 	void 		ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
323cdf0e10cSrcweir 	void		ApplySelectionLineStyle( const ScMarkData& rMark,
324cdf0e10cSrcweir 									const SvxBorderLine* pLine, sal_Bool bColorOnly );
325cdf0e10cSrcweir 
326cdf0e10cSrcweir 	const ScStyleSheet*	GetStyle( SCROW nRow ) const;
327cdf0e10cSrcweir 	const ScStyleSheet*	GetSelectionStyle( const ScMarkData& rMark, sal_Bool& rFound ) const;
328cdf0e10cSrcweir 	const ScStyleSheet*	GetAreaStyle( sal_Bool& rFound, SCROW nRow1, SCROW nRow2 ) const;
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 	void		FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBoolRowSegments& rUsedRows, bool bReset );
331cdf0e10cSrcweir 	sal_Bool		IsStyleSheetUsed( const ScStyleSheet& rStyle, sal_Bool bGatherAllStyles ) const;
332cdf0e10cSrcweir 
333cdf0e10cSrcweir                 /// May return -1 if not found
334cdf0e10cSrcweir 	SCsROW		SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle,
335cdf0e10cSrcweir 								sal_Bool bUp, sal_Bool bInSelection, const ScMarkData& rMark );
336cdf0e10cSrcweir 	sal_Bool		SearchStyleRange( SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle,
337cdf0e10cSrcweir 									sal_Bool bUp, sal_Bool bInSelection, const ScMarkData& rMark );
338cdf0e10cSrcweir 
339cdf0e10cSrcweir 	sal_Bool		ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags );
340cdf0e10cSrcweir 	sal_Bool		RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags );
341cdf0e10cSrcweir 	void		ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich );
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 	void		RemoveProtected( SCROW nStartRow, SCROW nEndRow );
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 	SCsROW		ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark );
346cdf0e10cSrcweir     void        DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 	void		ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
349cdf0e10cSrcweir 	void		ChangeSelectionIndent( sal_Bool bIncrement, const ScMarkData& rMark );
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 	long		GetNeededSize( SCROW nRow, OutputDevice* pDev,
352cdf0e10cSrcweir 									double nPPTX, double nPPTY,
353cdf0e10cSrcweir 									const Fraction& rZoomX, const Fraction& rZoomY,
354cdf0e10cSrcweir 									sal_Bool bWidth, const ScNeededSizeOptions& rOptions );
355cdf0e10cSrcweir 	sal_uInt16		GetOptimalColWidth( OutputDevice* pDev, double nPPTX, double nPPTY,
356cdf0e10cSrcweir 									const Fraction& rZoomX, const Fraction& rZoomY,
357cdf0e10cSrcweir 									sal_Bool bFormula, sal_uInt16 nOldWidth,
358cdf0e10cSrcweir 									const ScMarkData* pMarkData,
359cdf0e10cSrcweir 									sal_Bool bSimpleTextImport );
360cdf0e10cSrcweir 	void		GetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHeight,
361cdf0e10cSrcweir 									OutputDevice* pDev,
362cdf0e10cSrcweir 									double nPPTX, double nPPTY,
363cdf0e10cSrcweir 									const Fraction& rZoomX, const Fraction& rZoomY,
364cdf0e10cSrcweir 									sal_Bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart );
365b4df81e3SWang Lei     template< typename TAddLebal, typename TAddData >
366b4df81e3SWang Lei     void        FillDPCacheT( long nDim, SCROW nStartRow, SCROW nEndRow, const TAddLebal & , const TAddData & );
367b4df81e3SWang Lei     void        FillDPCache( ScDPTableDataCache * pCache, long nDim, SCROW nStartRow, SCROW nEndRow );
368cdf0e10cSrcweir private:
369cdf0e10cSrcweir 	long		GetSimpleTextNeededSize( SCSIZE nIndex, OutputDevice* pDev,
370cdf0e10cSrcweir 									sal_Bool bWidth );
371cdf0e10cSrcweir public:
372cdf0e10cSrcweir 
373cdf0e10cSrcweir                 /// Including current, may return -1
374cdf0e10cSrcweir 	SCsROW		GetNextUnprotected( SCROW nRow, sal_Bool bUp ) const;
375cdf0e10cSrcweir 
376cdf0e10cSrcweir     void		GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollection& rStrings, bool& rHasDates);
377cdf0e10cSrcweir 	sal_Bool		GetDataEntries(SCROW nRow, TypedScStrCollection& rStrings, sal_Bool bLimit);
378cdf0e10cSrcweir 
379cdf0e10cSrcweir //UNUSED2008-05  SCROW		NoteCount( SCROW nMaxRow = MAXROW ) const;
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 	void		UpdateInsertTabAbs(SCTAB nNewPos);
382cdf0e10cSrcweir 	sal_Bool		TestTabRefAbs(SCTAB nTable);
383cdf0e10cSrcweir 	sal_Bool 		GetNextSpellingCell(SCROW& nRow, sal_Bool bInSel, const ScMarkData& rData) const;
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 	void		RemoveAutoSpellObj();
386cdf0e10cSrcweir 
387cdf0e10cSrcweir 	void		StartListening( SvtListener& rLst, SCROW nRow );
388cdf0e10cSrcweir 	void		EndListening( SvtListener& rLst, SCROW nRow );
389cdf0e10cSrcweir 	void		MoveListeners( SvtBroadcaster& rSource, SCROW nDestRow );
390cdf0e10cSrcweir 	void		StartAllListeners();
391cdf0e10cSrcweir     void        StartNeededListeners(); // only for cells where NeedsListening()==TRUE
392cdf0e10cSrcweir 	void		SetRelNameDirty();
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 	void 		CompileDBFormula();
395cdf0e10cSrcweir 	void 		CompileDBFormula( sal_Bool bCreateFormulaString );
396cdf0e10cSrcweir 	void 		CompileNameFormula( sal_Bool bCreateFormulaString );
397cdf0e10cSrcweir     void 		CompileColRowNameFormula();
398cdf0e10cSrcweir 
399cdf0e10cSrcweir     sal_Int32	GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const;
400cdf0e10cSrcweir     xub_StrLen  GetMaxNumberStringLen( sal_uInt16& nPrecision,
401cdf0e10cSrcweir                                        SCROW nRowStart, SCROW nRowEnd ) const;
402cdf0e10cSrcweir 
403cdf0e10cSrcweir private:
404cdf0e10cSrcweir 	ScBaseCell* CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos);
405cdf0e10cSrcweir //UNUSED2008-05  void		CorrectSymbolCells( CharSet eStreamCharSet );
406cdf0e10cSrcweir };
407cdf0e10cSrcweir 
408cdf0e10cSrcweir 
409cdf0e10cSrcweir class ScColumnIterator					// alle Daten eines Bereichs durchgehen
410cdf0e10cSrcweir {
411cdf0e10cSrcweir 	const ScColumn*		pColumn;
412cdf0e10cSrcweir 	SCSIZE				nPos;
413cdf0e10cSrcweir 	SCROW				nTop;
414cdf0e10cSrcweir 	SCROW				nBottom;
415cdf0e10cSrcweir public:
416cdf0e10cSrcweir 				ScColumnIterator( const ScColumn* pCol, SCROW nStart=0, SCROW nEnd=MAXROW );
417cdf0e10cSrcweir 				~ScColumnIterator();
418cdf0e10cSrcweir 
419cdf0e10cSrcweir 	sal_Bool		Next( SCROW& rRow, ScBaseCell*& rpCell );
420cdf0e10cSrcweir 	SCSIZE		GetIndex() const;
421cdf0e10cSrcweir };
422cdf0e10cSrcweir 
423cdf0e10cSrcweir 
424cdf0e10cSrcweir class ScMarkedDataIter					// Daten in selektierten Bereichen durchgehen
425cdf0e10cSrcweir {
426cdf0e10cSrcweir 	const ScColumn*		pColumn;
427cdf0e10cSrcweir 	SCSIZE				nPos;
428cdf0e10cSrcweir 	ScMarkArrayIter*	pMarkIter;
429cdf0e10cSrcweir 	SCROW				nTop;
430cdf0e10cSrcweir 	SCROW				nBottom;
431cdf0e10cSrcweir 	sal_Bool				bNext;
432cdf0e10cSrcweir 	sal_Bool				bAll;
433cdf0e10cSrcweir 
434cdf0e10cSrcweir public:
435cdf0e10cSrcweir 				ScMarkedDataIter( const ScColumn* pCol, const ScMarkData* pMarkData,
436cdf0e10cSrcweir 									sal_Bool bAllIfNone = sal_False );
437cdf0e10cSrcweir 				~ScMarkedDataIter();
438cdf0e10cSrcweir 
439cdf0e10cSrcweir 	sal_Bool		Next( SCSIZE& rIndex );
440cdf0e10cSrcweir };
441cdf0e10cSrcweir 
442cdf0e10cSrcweir 
443cdf0e10cSrcweir #endif
444cdf0e10cSrcweir 
445cdf0e10cSrcweir 
446