update ooo310-m15
[ooovba.git] / sc / inc / table.hxx
blob66eedc133086a282d42dca395f4ead8a16cd68df
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: table.hxx,v $
10 * $Revision: 1.35.126.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_TABLE_HXX
32 #define SC_TABLE_HXX
34 #include <vector>
35 #include <tools/gen.hxx>
36 #include <tools/color.hxx>
37 #include <com/sun/star/uno/Sequence.hxx>
38 #include "column.hxx"
39 #include "sortparam.hxx"
40 #include "compressedarray.hxx"
42 #include <memory>
43 #include <set>
44 #include <boost/shared_ptr.hpp>
46 namespace utl {
47 class SearchParam;
48 class TextSearch;
51 namespace com { namespace sun { namespace star {
52 namespace sheet {
53 struct TablePageBreakData;
55 } } }
57 class SfxItemSet;
58 class SfxStyleSheetBase;
59 class SvxBoxInfoItem;
60 class SvxBoxItem;
61 class SvxSearchItem;
63 class ScAutoFormat;
64 class ScAutoFormatData;
65 class ScBaseCell;
66 class ScDocument;
67 class ScDrawLayer;
68 class ScEditDataArray;
69 class ScFormulaCell;
70 class ScOutlineTable;
71 class ScPostIt;
72 class ScPrintSaverTab;
73 class ScProgress;
74 class ScProgress;
75 class ScRangeList;
76 class ScSortInfoArray;
77 class ScStyleSheet;
78 class ScTableLink;
79 class ScTableProtection;
80 class ScUserListData;
81 class ScIndexMap;
82 struct RowInfo;
83 struct ScFunctionData;
84 struct ScLineFlags;
85 class CollatorWrapper;
86 class ScFlatBoolRowSegments;
87 class ScFlatBoolColSegments;
90 class ScTable
92 private:
93 typedef ::std::vector< ScRange > ScRangeVec;
94 // Daten pro Tabelle ------------------
95 ScColumn aCol[MAXCOLCOUNT];
97 String aName;
98 String aCodeName;
99 String aComment;
100 BOOL bScenario;
101 BOOL bLayoutRTL;
102 BOOL bLoadingRTL;
104 String aLinkDoc;
105 String aLinkFlt;
106 String aLinkOpt;
107 String aLinkTab;
108 ULONG nLinkRefreshDelay;
109 BYTE nLinkMode;
111 // Seitenformatvorlage
112 String aPageStyle;
113 BOOL bPageSizeValid;
114 Size aPageSizeTwips; // Groesse der Druck-Seite
115 SCCOL nRepeatStartX; // Wiederholungszeilen/Spalten
116 SCCOL nRepeatEndX; // REPEAT_NONE, wenn nicht benutzt
117 SCROW nRepeatStartY;
118 SCROW nRepeatEndY;
120 ::std::auto_ptr<ScTableProtection> pTabProtection;
122 USHORT* pColWidth;
123 ScSummableCompressedArray< SCROW, USHORT>* pRowHeight;
125 BYTE* pColFlags;
126 ScBitMaskCompressedArray< SCROW, BYTE>* pRowFlags;
127 ::boost::shared_ptr<ScFlatBoolColSegments> mpHiddenCols;
128 ::boost::shared_ptr<ScFlatBoolRowSegments> mpHiddenRows;
129 ::boost::shared_ptr<ScFlatBoolColSegments> mpFilteredCols;
130 ::boost::shared_ptr<ScFlatBoolRowSegments> mpFilteredRows;
132 ::std::set<SCROW> maRowPageBreaks;
133 ::std::set<SCROW> maRowManualBreaks;
134 ::std::set<SCCOL> maColPageBreaks;
135 ::std::set<SCCOL> maColManualBreaks;
137 ScOutlineTable* pOutlineTable;
139 SCCOL nTableAreaX;
140 SCROW nTableAreaY;
141 BOOL bTableAreaValid;
143 // interne Verwaltung ------------------
144 BOOL bVisible;
146 SCTAB nTab;
147 USHORT nRecalcLvl; // Rekursionslevel Size-Recalc
148 ScDocument* pDocument;
149 utl::SearchParam* pSearchParam;
150 utl::TextSearch* pSearchText;
152 mutable String aUpperName; // #i62977# filled only on demand, reset in SetName
154 // SortierParameter um den Stackbedarf von Quicksort zu Minimieren
155 ScSortParam aSortParam;
156 CollatorWrapper* pSortCollator;
157 BOOL bGlobalKeepQuery;
158 BOOL bSharedNameInserted;
160 ScRangeVec aPrintRanges;
161 BOOL bPrintEntireSheet;
163 ScRange* pRepeatColRange;
164 ScRange* pRepeatRowRange;
166 USHORT nLockCount;
168 ScRangeList* pScenarioRanges;
169 Color aScenarioColor;
170 USHORT nScenarioFlags;
171 BOOL bActiveScenario;
172 bool mbPageBreaksValid;
174 friend class ScDocument; // fuer FillInfo
175 friend class ScDocumentIterator;
176 friend class ScValueIterator;
177 friend class ScQueryValueIterator;
178 friend class ScCellIterator;
179 friend class ScQueryCellIterator;
180 friend class ScHorizontalCellIterator;
181 friend class ScHorizontalAttrIterator;
182 friend class ScDocAttrIterator;
183 friend class ScAttrRectIterator;
186 public:
187 ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName,
188 BOOL bColInfo = TRUE, BOOL bRowInfo = TRUE );
189 ~ScTable();
191 ScOutlineTable* GetOutlineTable() { return pOutlineTable; }
193 ULONG GetCellCount() const;
194 ULONG GetWeightedCount() const;
195 ULONG GetCodeCount() const; // RPN-Code in Formeln
197 BOOL SetOutlineTable( const ScOutlineTable* pNewOutline );
198 void StartOutlineTable();
200 void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
202 BOOL TestRemoveSubTotals( const ScSubTotalParam& rParam );
203 void RemoveSubTotals( ScSubTotalParam& rParam );
204 BOOL DoSubTotals( ScSubTotalParam& rParam );
206 BOOL IsVisible() const { return bVisible; }
207 void SetVisible( BOOL bVis );
209 BOOL IsLayoutRTL() const { return bLayoutRTL; }
210 BOOL IsLoadingRTL() const { return bLoadingRTL; }
211 void SetLayoutRTL( BOOL bSet );
212 void SetLoadingRTL( BOOL bSet );
214 BOOL IsScenario() const { return bScenario; }
215 void SetScenario( BOOL bFlag );
216 void GetScenarioComment( String& rComment) const { rComment = aComment; }
217 void SetScenarioComment( const String& rComment ) { aComment = rComment; }
218 const Color& GetScenarioColor() const { return aScenarioColor; }
219 void SetScenarioColor(const Color& rNew) { aScenarioColor = rNew; }
220 USHORT GetScenarioFlags() const { return nScenarioFlags; }
221 void SetScenarioFlags(USHORT nNew) { nScenarioFlags = nNew; }
222 void SetActiveScenario(BOOL bSet) { bActiveScenario = bSet; }
223 BOOL IsActiveScenario() const { return bActiveScenario; }
225 BYTE GetLinkMode() const { return nLinkMode; }
226 BOOL IsLinked() const { return nLinkMode != SC_LINK_NONE; }
227 const String& GetLinkDoc() const { return aLinkDoc; }
228 const String& GetLinkFlt() const { return aLinkFlt; }
229 const String& GetLinkOpt() const { return aLinkOpt; }
230 const String& GetLinkTab() const { return aLinkTab; }
231 ULONG GetLinkRefreshDelay() const { return nLinkRefreshDelay; }
233 void SetLink( BYTE nMode, const String& rDoc, const String& rFlt,
234 const String& rOpt, const String& rTab, ULONG nRefreshDelay );
236 void GetName( String& rName ) const;
237 void SetName( const String& rNewName );
239 void GetCodeName( String& rName ) const { rName = aCodeName; }
240 void SetCodeName( const String& rNewName ) { aCodeName = rNewName; }
242 const String& GetUpperName() const;
244 const String& GetPageStyle() const { return aPageStyle; }
245 void SetPageStyle( const String& rName );
246 void PageStyleModified( const String& rNewName );
248 BOOL IsProtected() const;
249 void SetProtection(const ScTableProtection* pProtect);
250 ScTableProtection* GetProtection();
252 Size GetPageSize() const;
253 void SetPageSize( const Size& rSize );
254 void SetRepeatArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
256 void RemoveAutoSpellObj();
258 void LockTable();
259 void UnlockTable();
261 BOOL IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
262 SCROW nRow2, BOOL* pOnlyNotBecauseOfMatrix = NULL ) const;
263 BOOL IsSelectionEditable( const ScMarkData& rMark,
264 BOOL* pOnlyNotBecauseOfMatrix = NULL ) const;
266 BOOL HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
267 BOOL HasSelectionMatrixFragment( const ScMarkData& rMark ) const;
269 BOOL IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes = false ) const;
271 void PutCell( const ScAddress&, ScBaseCell* pCell );
272 void PutCell( const ScAddress&, ULONG nFormatIndex, ScBaseCell* pCell);
273 void PutCell( SCCOL nCol, SCROW nRow, ScBaseCell* pCell );
274 void PutCell(SCCOL nCol, SCROW nRow, ULONG nFormatIndex, ScBaseCell* pCell);
275 // TRUE = Zahlformat gesetzt
276 BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
277 SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true );
278 void SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
279 void SetError( SCCOL nCol, SCROW nRow, USHORT nError);
281 void GetString( SCCOL nCol, SCROW nRow, String& rString );
282 void GetInputString( SCCOL nCol, SCROW nRow, String& rString );
283 double GetValue( const ScAddress& rPos ) const
284 { return aCol[rPos.Col()].GetValue( rPos.Row() ); }
285 double GetValue( SCCOL nCol, SCROW nRow );
286 void GetFormula( SCCOL nCol, SCROW nRow, String& rFormula,
287 BOOL bAsciiExport = FALSE );
289 CellType GetCellType( const ScAddress& rPos ) const
290 { return aCol[rPos.Col()].GetCellType( rPos.Row() ); }
291 CellType GetCellType( SCCOL nCol, SCROW nRow ) const;
292 ScBaseCell* GetCell( const ScAddress& rPos ) const
293 { return aCol[rPos.Col()].GetCell( rPos.Row() ); }
294 ScBaseCell* GetCell( SCCOL nCol, SCROW nRow ) const;
296 void GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const;
297 void GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
299 /** Returns the pointer to a cell note object at the passed cell address. */
300 ScPostIt* GetNote( SCCOL nCol, SCROW nRow );
301 /** Sets the passed cell note object at the passed cell address. Takes ownership! */
302 void TakeNote( SCCOL nCol, SCROW nRow, ScPostIt*& rpNote );
303 /** Returns and forgets the cell note object at the passed cell address. */
304 ScPostIt* ReleaseNote( SCCOL nCol, SCROW nRow );
305 /** Deletes the note at the passed cell address. */
306 void DeleteNote( SCCOL nCol, SCROW nRow );
308 BOOL TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize );
309 void InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize );
310 void DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize,
311 BOOL* pUndoOutline = NULL );
313 BOOL TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
314 void InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
315 void DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize,
316 BOOL* pUndoOutline = NULL );
318 void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nDelFlag);
319 void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable,
320 BOOL bKeepScenarioFlags, BOOL bCloneNoteCaptions);
321 void CopyToClip(const ScRangeList& rRanges, ScTable* pTable,
322 bool bKeepScenarioFlags, bool bCloneNoteCaptions);
323 void CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy,
324 USHORT nInsFlag, BOOL bAsLink, BOOL bSkipAttrForEmpty, ScTable* pTable);
325 void StartListeningInArea( SCCOL nCol1, SCROW nRow1,
326 SCCOL nCol2, SCROW nRow2 );
327 void BroadcastInArea( SCCOL nCol1, SCROW nRow1,
328 SCCOL nCol2, SCROW nRow2 );
330 void CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
331 USHORT nFlags, BOOL bMarked, ScTable* pDestTab,
332 const ScMarkData* pMarkData = NULL,
333 BOOL bAsLink = FALSE, BOOL bColRowFlags = TRUE);
334 void UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
335 USHORT nFlags, BOOL bMarked, ScTable* pDestTab,
336 const ScMarkData* pMarkData = NULL);
338 void TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
339 ScTable* pTransClip, USHORT nFlags, BOOL bAsLink );
341 // Markierung von diesem Dokument
342 void MixMarked( const ScMarkData& rMark, USHORT nFunction,
343 BOOL bSkipEmpty, ScTable* pSrcTab );
344 void MixData( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
345 USHORT nFunction, BOOL bSkipEmpty, ScTable* pSrcTab );
347 void CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
348 SCCOL nDestCol, SCROW nDestRow, SCTAB nDestTab );
350 void CopyScenarioFrom( const ScTable* pSrcTab );
351 void CopyScenarioTo( ScTable* pDestTab ) const;
352 BOOL TestCopyScenarioTo( const ScTable* pDestTab ) const;
353 void MarkScenarioIn( ScMarkData& rMark, USHORT nNeededBits ) const;
354 BOOL HasScenarioRange( const ScRange& rRange ) const;
355 void InvalidateScenarioRanges();
356 const ScRangeList* GetScenarioRanges() const;
358 void CopyUpdated( const ScTable* pPosTab, ScTable* pDestTab ) const;
360 void InvalidateTableArea();
361 void InvalidatePageBreaks();
363 BOOL GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const; // FALSE = leer
364 BOOL GetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const;
365 BOOL GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, BOOL bNotes ) const;
366 BOOL GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
367 SCCOL& rEndCol, BOOL bNotes ) const;
368 BOOL GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
369 SCROW& rEndRow, BOOL bNotes ) const;
371 BOOL GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const;
373 void ExtendPrintArea( OutputDevice* pDev,
374 SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow );
376 void GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
377 BOOL bIncludeOld ) const;
379 SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
380 SCCOL nEndCol, SCROW nEndRow, ScDirection eDir );
381 void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY );
382 void GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY,
383 BOOL bMarked, BOOL bUnprotected, const ScMarkData& rMark );
385 void LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow );
387 BOOL HasData( SCCOL nCol, SCROW nRow );
388 BOOL HasStringData( SCCOL nCol, SCROW nRow );
389 BOOL HasValueData( SCCOL nCol, SCROW nRow );
390 //UNUSED2008-05 USHORT GetErrorData(SCCOL nCol, SCROW nRow) const;
391 BOOL HasStringCells( SCCOL nStartCol, SCROW nStartRow,
392 SCCOL nEndCol, SCROW nEndRow ) const;
394 USHORT GetErrCode( const ScAddress& rPos ) const
395 { return aCol[rPos.Col()].GetErrCode( rPos.Row() ); }
396 //UNUSED2008-05 USHORT GetErrCode( SCCOL nCol, SCROW nRow ) const;
398 void ResetChanged( const ScRange& rRange );
400 void SetDirty();
401 void SetDirty( const ScRange& );
402 void SetDirtyAfterLoad();
403 void SetDirtyVar();
404 void SetTableOpDirty( const ScRange& );
405 void CalcAll();
406 void CalcAfterLoad();
407 void CompileAll();
408 void CompileXML( ScProgress& rProgress );
409 bool MarkUsedExternalReferences();
411 void UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
412 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
413 SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
414 ScDocument* pUndoDoc = NULL, BOOL bIncludeDraw = TRUE );
416 void UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
417 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
418 SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
420 void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
421 ScDocument* pUndoDoc );
423 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
425 void UpdateInsertTab(SCTAB nTable);
426 //UNUSED2008-05 void UpdateInsertTabOnlyCells(SCTAB nTable);
427 void UpdateDeleteTab( SCTAB nTable, BOOL bIsMove, ScTable* pRefUndo = NULL );
428 void UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, ScProgress& );
429 void UpdateCompile( BOOL bForceIfNameInUse = FALSE );
430 void SetTabNo(SCTAB nNewTab);
431 BOOL IsRangeNameInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
432 USHORT nIndex) const;
433 void FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
434 std::set<USHORT>& rIndexes) const;
435 void ReplaceRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
436 const ScIndexMap& rMap );
437 void ReplaceRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
438 const ScRangeData::IndexMap& rMap );
439 void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
440 ULONG nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
441 double nStepValue, double nMaxValue);
442 String GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
444 void UpdateSelectionFunction( ScFunctionData& rData,
445 SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
446 const ScMarkData& rMark );
448 void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
449 USHORT nFormatNo );
450 void GetAutoFormatData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData& rData);
451 void ScReplaceTabsStr( String& rStr, const String& rSrch, const String& rRepl ); // aus sw
452 BOOL SearchAndReplace(const SvxSearchItem& rSearchItem,
453 SCCOL& rCol, SCROW& rRow, ScMarkData& rMark,
454 String& rUndoStr, ScDocument* pUndoDoc);
456 void FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2 );
458 void GetBorderLines( SCCOL nCol, SCROW nRow,
459 const SvxBorderLine** ppLeft, const SvxBorderLine** ppTop,
460 const SvxBorderLine** ppRight, const SvxBorderLine** ppBottom ) const;
462 BOOL HasLines( const ScRange& rRange, Rectangle& rSizes ) const;
463 BOOL HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nMask ) const;
464 BOOL HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const;
465 BOOL ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
466 SCCOL& rEndCol, SCROW& rEndRow,
467 BOOL bRefresh, BOOL bAttrs );
468 const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, USHORT nWhich ) const;
469 const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow ) const;
470 const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
472 ULONG GetNumberFormat( const ScAddress& rPos ) const
473 { return aCol[rPos.Col()].GetNumberFormat( rPos.Row() ); }
474 ULONG GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
475 sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
476 void MergeSelectionPattern( ScMergePatternState& rState,
477 const ScMarkData& rMark, BOOL bDeep ) const;
478 void MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1,
479 SCCOL nCol2, SCROW nRow2, BOOL bDeep ) const;
480 void MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
481 ScLineFlags& rFlags,
482 SCCOL nStartCol, SCROW nStartRow,
483 SCCOL nEndCol, SCROW nEndRow ) const;
484 void ApplyBlockFrame( const SvxBoxItem* pLineOuter,
485 const SvxBoxInfoItem* pLineInner,
486 SCCOL nStartCol, SCROW nStartRow,
487 SCCOL nEndCol, SCROW nEndRow );
489 void ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
490 void ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
491 void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
492 const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = NULL );
493 void SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, BOOL bPutToPool = FALSE )
494 { aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool ); }
495 void SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, BOOL bPutToPool = FALSE );
496 void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
497 const ScPatternAttr& rPattern, short nNewType );
499 void ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet& rStyle );
500 void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet& rStyle );
501 void ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
502 void ApplySelectionLineStyle( const ScMarkData& rMark,
503 const SvxBorderLine* pLine, BOOL bColorOnly );
505 const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow ) const;
506 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, BOOL& rFound ) const;
507 const ScStyleSheet* GetAreaStyle( BOOL& rFound, SCCOL nCol1, SCROW nRow1,
508 SCCOL nCol2, SCROW nRow2 ) const;
510 void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, BOOL bRemoved,
511 OutputDevice* pDev,
512 double nPPTX, double nPPTY,
513 const Fraction& rZoomX, const Fraction& rZoomY );
515 BOOL IsStyleSheetUsed( const ScStyleSheet& rStyle, BOOL bGatherAllStyles ) const;
517 BOOL ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, INT16 nFlags );
518 BOOL RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, INT16 nFlags );
520 void ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
521 void DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark );
523 void ClearSelectionItems( const USHORT* pWhich, const ScMarkData& rMark );
524 void ChangeSelectionIndent( BOOL bIncrement, const ScMarkData& rMark );
526 const ScRange* GetRepeatColRange() const { return pRepeatColRange; }
527 const ScRange* GetRepeatRowRange() const { return pRepeatRowRange; }
528 void SetRepeatColRange( const ScRange* pNew );
529 void SetRepeatRowRange( const ScRange* pNew );
531 USHORT GetPrintRangeCount() const { return static_cast< USHORT >( aPrintRanges.size() ); }
532 const ScRange* GetPrintRange(USHORT nPos) const;
533 /** Returns true, if the sheet is always printed. */
534 BOOL IsPrintEntireSheet() const { return bPrintEntireSheet; }
536 /** Removes all print ranges. */
537 void ClearPrintRanges();
538 /** Adds a new print ranges. */
539 void AddPrintRange( const ScRange& rNew );
540 /** Removes all old print ranges and sets the passed print ranges. */
541 void SetPrintRange( const ScRange& rNew );
542 /** Marks the specified sheet to be printed completely. Deletes old print ranges! */
543 void SetPrintEntireSheet();
545 void FillPrintSaver( ScPrintSaverTab& rSaveTab ) const;
546 void RestorePrintRanges( const ScPrintSaverTab& rSaveTab );
548 USHORT GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
549 double nPPTX, double nPPTY,
550 const Fraction& rZoomX, const Fraction& rZoomY,
551 BOOL bFormula, const ScMarkData* pMarkData,
552 BOOL bSimpleTextImport );
553 BOOL SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, USHORT nExtra,
554 OutputDevice* pDev,
555 double nPPTX, double nPPTY,
556 const Fraction& rZoomX, const Fraction& rZoomY,
557 BOOL bForce,
558 ScProgress* pOuterProgress = NULL, ULONG nProgressStart = 0 );
559 long GetNeededSize( SCCOL nCol, SCROW nRow,
560 OutputDevice* pDev,
561 double nPPTX, double nPPTY,
562 const Fraction& rZoomX, const Fraction& rZoomY,
563 BOOL bWidth, BOOL bTotalSize );
564 void SetColWidth( SCCOL nCol, USHORT nNewWidth );
565 void SetRowHeight( SCROW nRow, USHORT nNewHeight );
566 BOOL SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, USHORT nNewHeight,
567 double nPPTX, double nPPTY );
568 // nPPT fuer Test auf Veraenderung
569 void SetManualHeight( SCROW nStartRow, SCROW nEndRow, BOOL bManual );
571 USHORT GetColWidth( SCCOL nCol );
572 SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow );
573 ULONG GetRowHeight( SCROW nStartRow, SCROW nEndRow );
574 ULONG GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale );
575 ULONG GetColOffset( SCCOL nCol );
576 ULONG GetRowOffset( SCROW nRow );
578 /**
579 * Get the last row such that the height of row 0 to the end row is as
580 * high as possible without exceeding the specified height value.
582 * @param nHeight maximum desired height
584 * @return SCROW last row of the range within specified height.
586 SCROW GetRowForHeight(ULONG nHeight);
588 USHORT GetOriginalWidth( SCCOL nCol ) const;
589 USHORT GetOriginalHeight( SCROW nRow ) const;
591 USHORT GetCommonWidth( SCCOL nEndCol );
593 SCROW GetHiddenRowCount( SCROW nRow );
595 void ShowCol(SCCOL nCol, BOOL bShow);
596 void ShowRow(SCROW nRow, BOOL bShow);
597 void DBShowRow(SCROW nRow, BOOL bShow);
599 void ShowRows(SCROW nRow1, SCROW nRow2, BOOL bShow);
600 void DBShowRows(SCROW nRow1, SCROW nRow2, BOOL bShow);
602 void SetColFlags( SCCOL nCol, BYTE nNewFlags );
603 void SetRowFlags( SCROW nRow, BYTE nNewFlags );
604 void SetRowFlags( SCROW nStartRow, SCROW nEndRow, BYTE nNewFlags );
606 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
607 SCROW GetLastFlaggedRow() const;
609 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
610 SCCOL GetLastChangedCol() const;
611 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
612 SCROW GetLastChangedRow() const;
614 BYTE GetColFlags( SCCOL nCol ) const;
615 BYTE GetRowFlags( SCROW nRow ) const;
617 const ScBitMaskCompressedArray< SCROW, BYTE> * GetRowFlagsArray() const
618 { return pRowFlags; }
619 const ScSummableCompressedArray< SCROW, USHORT> * GetRowHeightArray() const
620 { return pRowHeight; }
622 BOOL UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, BOOL bShow );
623 BOOL UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, BOOL bShow );
625 void UpdatePageBreaks( const ScRange* pUserArea );
626 void RemoveManualBreaks();
627 BOOL HasManualBreaks() const;
629 void GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const;
630 void GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const;
631 bool HasRowPageBreak(SCROW nRow) const;
632 bool HasColPageBreak(SCCOL nCol) const;
633 bool HasRowManualBreak(SCROW nRow) const;
634 bool HasColManualBreak(SCCOL nCol) const;
635 void RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow);
636 void RemoveRowBreak(SCROW nRow, bool bPage, bool bManual);
637 void RemoveColBreak(SCCOL nCol, bool bPage, bool bManual);
638 void SetRowBreak(SCROW nRow, bool bPage, bool bManual);
639 void SetColBreak(SCCOL nCol, bool bPage, bool bManual);
640 ::com::sun::star::uno::Sequence<
641 ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const;
643 bool RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL);
644 bool RowHidden(SCROW nRow, SCROW& rLastRow);
645 bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow);
646 bool ColHidden(SCCOL nCol, SCCOL& rLastCol);
647 bool ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL);
648 void SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
649 void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden);
650 void CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
651 void CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
652 SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow);
653 SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow);
654 SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow);
655 sal_uInt32 GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow);
657 SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol);
659 bool RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL);
660 bool ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL);
661 bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow);
662 void CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
663 void CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
664 void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered);
665 void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered);
666 SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow);
667 SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow);
668 SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow);
670 void SyncColRowFlags();
672 void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
673 void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
675 void Sort(const ScSortParam& rSortParam, BOOL bKeepQuery);
676 BOOL ValidQuery(SCROW nRow, const ScQueryParam& rQueryParam,
677 BOOL* pSpecial = NULL, ScBaseCell* pCell = NULL,
678 BOOL* pbTestEqualCondition = NULL );
679 void TopTenQuery( ScQueryParam& );
680 SCSIZE Query(ScQueryParam& rQueryParam, BOOL bKeepSub);
681 BOOL CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
683 void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, TypedScStrCollection& rStrings, bool& rHasDates);
684 void GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, TypedScStrCollection& rStrings, bool& rHasDates );
685 BOOL GetDataEntries(SCCOL nCol, SCROW nRow, TypedScStrCollection& rStrings, BOOL bLimit);
687 BOOL HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
688 BOOL HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
690 void DoColResize( SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd );
692 sal_Int32 GetMaxStringLen( SCCOL nCol,
693 SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const;
694 xub_StrLen GetMaxNumberStringLen( USHORT& nPrecision,
695 SCCOL nCol,
696 SCROW nRowStart, SCROW nRowEnd ) const;
698 void FindConditionalFormat( ULONG nKey, ScRangeList& rRanges );
700 void IncRecalcLevel() { ++nRecalcLvl; }
701 void DecRecalcLevel() { if (!--nRecalcLvl) SetDrawPageSize(); }
703 BOOL IsSortCollatorGlobal() const;
704 void InitSortCollator( const ScSortParam& rPar );
705 void DestroySortCollator();
707 private:
708 void FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
709 ULONG nFillCount, FillDir eFillDir, FillCmd eFillCmd,
710 FillDateCmd eFillDateCmd,
711 double nStepValue, double nMaxValue, USHORT nMinDigits,
712 BOOL bAttribs, ScProgress& rProgress );
713 void FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
714 FillCmd& rCmd, FillDateCmd& rDateCmd,
715 double& rInc, USHORT& rMinDigits,
716 ScUserListData*& rListData, USHORT& rListIndex);
717 void FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
718 ULONG nFillCount, FillDir eFillDir, ScProgress& rProgress );
720 BOOL ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
721 BOOL bMarked, BOOL bUnprotected );
723 void AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
724 const ScPatternAttr& rAttr, USHORT nFormatNo);
725 void GetAutoFormatAttr(SCCOL nCol, SCROW nRow, USHORT nIndex, ScAutoFormatData& rData);
726 void GetAutoFormatFrame(SCCOL nCol, SCROW nRow, USHORT nFlags, USHORT nIndex, ScAutoFormatData& rData);
727 BOOL SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRow,
728 const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
729 BOOL Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
730 const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
731 BOOL SearchAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
732 String& rUndoStr, ScDocument* pUndoDoc);
733 BOOL Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
734 const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
735 BOOL ReplaceAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
736 String& rUndoStr, ScDocument* pUndoDoc);
738 BOOL SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
739 ScMarkData& rMark);
740 BOOL ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
741 ScMarkData& rMark, BOOL bIsUndo);
742 BOOL SearchAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark);
743 BOOL ReplaceAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
744 ScDocument* pUndoDoc);
745 bool SearchAndReplaceEmptyCells(
746 const SvxSearchItem& rSearchItem,
747 SCCOL& rCol, SCROW& rRow, ScMarkData& rMark,
748 String& rUndoStr, ScDocument* pUndoDoc);
749 bool SearchRangeForEmptyCell(const ScRange& rRange,
750 const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
751 String& rUndoStr, ScDocument* pUndoDoc);
752 bool SearchRangeForAllEmptyCells(const ScRange& rRange,
753 const SvxSearchItem& rSearchItem, ScMarkData& rMark,
754 String& rUndoStr, ScDocument* pUndoDoc);
756 // benutzen globalen SortParam:
757 BOOL IsSorted(SCCOLROW nStart, SCCOLROW nEnd);
758 void DecoladeRow( ScSortInfoArray*, SCROW nRow1, SCROW nRow2 );
759 void SwapCol(SCCOL nCol1, SCCOL nCol2);
760 void SwapRow(SCROW nRow1, SCROW nRow2);
761 short CompareCell( USHORT nSort,
762 ScBaseCell* pCell1, SCCOL nCell1Col, SCROW nCell1Row,
763 ScBaseCell* pCell2, SCCOL nCell2Col, SCROW nCell2Row );
764 short Compare(SCCOLROW nIndex1, SCCOLROW nIndex2);
765 short Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2);
766 ScSortInfoArray* CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 );
767 void QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi);
768 void SortReorder( ScSortInfoArray*, ScProgress& );
770 BOOL CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
771 BOOL CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
772 void GetUpperCellString(SCCOL nCol, SCROW nRow, String& rStr);
774 BOOL RefVisible(ScFormulaCell* pCell);
776 BOOL IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol);
778 void IncDate(double& rVal, USHORT& nDayOfMonth, double nStep, FillDateCmd eCmd);
779 void FillFormula(ULONG& nFormulaCounter, BOOL bFirst, ScFormulaCell* pSrcCell,
780 SCCOL nDestCol, SCROW nDestRow, BOOL bLast );
781 void UpdateInsertTabAbs(SCTAB nNewPos);
782 BOOL GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, BOOL bInSel,
783 const ScMarkData& rMark) const;
784 BOOL GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark );
785 void SetDrawPageSize();
786 BOOL TestTabRefAbs(SCTAB nTable);
787 void CompileDBFormula();
788 void CompileDBFormula( BOOL bCreateFormulaString );
789 void CompileNameFormula( BOOL bCreateFormulaString );
790 void CompileColRowNameFormula();
792 void StartListening( const ScAddress& rAddress, SvtListener* pListener );
793 void EndListening( const ScAddress& rAddress, SvtListener* pListener );
794 void StartAllListeners();
795 void StartNeededListeners(); // only for cells where NeedsListening()==TRUE
796 void SetRelNameDirty();
798 SCSIZE FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2,
799 SCCOL nCol, SCROW nAttrRow1, SCROW nAttrRow2, SCSIZE nArrY,
800 const ScPatternAttr* pPattern, const SfxItemSet* pCondSet );
802 // idle calculation of OutputDevice text width for cell
803 // also invalidates script type, broadcasts for "calc as shown"
804 void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
805 BOOL bNumFormatChanged, BOOL bBroadcast );
809 #endif