Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / inc / table.hxx
blob7877a1ce883849ca900296d813562239d3f0ceb0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SC_TABLE_HXX
21 #define SC_TABLE_HXX
23 #include <vector>
24 #include <utility>
25 #include <tools/gen.hxx>
26 #include <tools/color.hxx>
27 #include <com/sun/star/uno/Sequence.hxx>
28 #include "column.hxx"
29 #include "sortparam.hxx"
30 #include "compressedarray.hxx"
31 #include "postit.hxx"
32 #include "types.hxx"
33 #include "cellvalue.hxx"
34 #include "formula/types.hxx"
35 #include "calcmacros.hxx"
37 #include <set>
38 #include <map>
39 #include <boost/scoped_ptr.hpp>
40 #include <boost/noncopyable.hpp>
42 namespace utl {
43 class TextSearch;
46 namespace com { namespace sun { namespace star {
47 namespace sheet {
48 struct TablePageBreakData;
50 } } }
52 namespace formula { struct VectorRefArray; }
53 namespace sc {
55 struct FormulaGroupContext;
56 class StartListeningContext;
57 class EndListeningContext;
58 class CopyFromClipContext;
59 class CopyToClipContext;
60 class CopyToDocContext;
61 class MixDocContext;
62 class ColumnSpanSet;
63 class ColumnSet;
64 struct ColumnBlockPosition;
65 struct RefUpdateContext;
66 struct RefUpdateInsertTabContext;
67 struct RefUpdateDeleteTabContext;
68 struct RefUpdateMoveTabContext;
69 struct NoteEntry;
70 class DocumentStreamAccess;
74 class SfxItemSet;
75 class SfxStyleSheetBase;
76 class SvxBoxInfoItem;
77 class SvxBoxItem;
78 class SvxSearchItem;
80 class ScAutoFormatData;
81 class ScDocument;
82 class ScEditDataArray;
83 class ScFormulaCell;
84 class ScOutlineTable;
85 class ScPrintSaverTab;
86 class ScProgress;
87 class ScRangeList;
88 class ScSheetEvents;
89 class ScSortInfoArray;
90 class ScConditionalFormat;
91 class ScConditionalFormatList;
92 class ScStyleSheet;
93 class ScTableProtection;
94 class ScUserListData;
95 struct RowInfo;
96 struct ScFunctionData;
97 struct ScLineFlags;
98 class CollatorWrapper;
99 class ScFlatUInt16RowSegments;
100 class ScFlatBoolRowSegments;
101 class ScFlatBoolColSegments;
102 struct ScSetStringParam;
103 struct ScColWidthParam;
104 struct ScColWidthParam;
105 class ScRangeName;
106 class ScDBData;
107 class ScDocumentImport;
109 class ScTable : boost::noncopyable
111 private:
112 typedef ::std::vector< ScRange > ScRangeVec;
114 ScColumn aCol[MAXCOLCOUNT];
116 OUString aName;
117 OUString aCodeName;
118 OUString aComment;
120 OUString aLinkDoc;
121 OUString aLinkFlt;
122 OUString aLinkOpt;
123 OUString aLinkTab;
124 sal_uLong nLinkRefreshDelay;
125 sal_uInt8 nLinkMode;
127 // page style template
128 OUString aPageStyle;
129 Size aPageSizeTwips; // size of the print-page
130 SCCOL nRepeatStartX; // repeating rows/columns
131 SCCOL nRepeatEndX; // REPEAT_NONE, if not used
132 SCROW nRepeatStartY;
133 SCROW nRepeatEndY;
135 boost::scoped_ptr<ScTableProtection> pTabProtection;
137 sal_uInt16* pColWidth;
138 boost::scoped_ptr<ScFlatUInt16RowSegments> mpRowHeights;
140 sal_uInt8* pColFlags;
141 ScBitMaskCompressedArray< SCROW, sal_uInt8>* pRowFlags;
142 boost::scoped_ptr<ScFlatBoolColSegments> mpHiddenCols;
143 boost::scoped_ptr<ScFlatBoolRowSegments> mpHiddenRows;
144 boost::scoped_ptr<ScFlatBoolColSegments> mpFilteredCols;
145 boost::scoped_ptr<ScFlatBoolRowSegments> mpFilteredRows;
147 ::std::set<SCROW> maRowPageBreaks;
148 ::std::set<SCROW> maRowManualBreaks;
149 ::std::set<SCCOL> maColPageBreaks;
150 ::std::set<SCCOL> maColManualBreaks;
152 ScOutlineTable* pOutlineTable;
154 ScSheetEvents* pSheetEvents;
156 mutable SCCOL nTableAreaX;
157 mutable SCROW nTableAreaY;
159 SCTAB nTab;
160 ScDocument* pDocument;
161 utl::TextSearch* pSearchText;
163 mutable OUString aUpperName; // #i62977# filled only on demand, reset in SetName
165 // sort parameter to minimize stack size of quicksort
166 ScSortParam aSortParam;
167 CollatorWrapper* pSortCollator;
169 ScRangeVec aPrintRanges;
171 ScRange* pRepeatColRange;
172 ScRange* pRepeatRowRange;
174 sal_uInt16 nLockCount;
176 ScRangeList* pScenarioRanges;
177 Color aScenarioColor;
178 Color aTabBgColor;
179 sal_uInt16 nScenarioFlags;
180 ScDBData* pDBDataNoName;
181 mutable ScRangeName* mpRangeName;
183 boost::scoped_ptr<ScConditionalFormatList> mpCondFormatList;
185 bool bScenario:1;
186 bool bLayoutRTL:1;
187 bool bLoadingRTL:1;
188 bool bPageSizeValid:1;
189 mutable bool bTableAreaValid:1;
190 bool bVisible:1;
191 bool bStreamValid:1;
192 bool bPendingRowHeights:1;
193 bool bCalcNotification:1;
194 bool bGlobalKeepQuery:1;
195 bool bPrintEntireSheet:1;
196 bool bActiveScenario:1;
197 bool mbPageBreaksValid:1;
198 bool mbForceBreaks:1;
200 friend class ScDocument; // for FillInfo
201 friend class ScValueIterator;
202 friend class ScHorizontalValueIterator;
203 friend class ScDBQueryDataIterator;
204 friend class ScCellIterator;
205 friend class ScQueryCellIterator;
206 friend class ScHorizontalCellIterator;
207 friend class ScHorizontalAttrIterator;
208 friend class ScDocAttrIterator;
209 friend class ScAttrRectIterator;
210 friend class ScColumnTextWidthIterator;
211 friend class ScDocumentImport;
212 friend class sc::DocumentStreamAccess;
213 friend class sc::ColumnSpanSet;
214 friend class sc::EditTextIterator;
216 public:
217 ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,
218 bool bColInfo = true, bool bRowInfo = true );
219 ~ScTable();
221 ScDocument& GetDoc();
222 const ScDocument& GetDoc() const;
223 SCTAB GetTab() const { return nTab; }
225 ScOutlineTable* GetOutlineTable() { return pOutlineTable; }
227 SCSIZE GetCellCount(SCCOL nCol) const;
228 sal_uLong GetCellCount() const;
229 sal_uLong GetWeightedCount() const;
230 sal_uLong GetCodeCount() const; // RPN code in formula
232 sal_uInt16 GetTextWidth(SCCOL nCol, SCROW nRow) const;
234 bool SetOutlineTable( const ScOutlineTable* pNewOutline );
235 void StartOutlineTable();
237 void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
239 bool TestRemoveSubTotals( const ScSubTotalParam& rParam );
240 void RemoveSubTotals( ScSubTotalParam& rParam );
241 bool DoSubTotals( ScSubTotalParam& rParam );
243 void MarkSubTotalCells( sc::ColumnSpanSet& rSet, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bVal ) const;
245 const ScSheetEvents* GetSheetEvents() const { return pSheetEvents; }
246 void SetSheetEvents( const ScSheetEvents* pNew );
248 bool IsVisible() const { return bVisible; }
249 void SetVisible( bool bVis );
251 bool IsStreamValid() const { return bStreamValid; }
252 void SetStreamValid( bool bSet, bool bIgnoreLock = false );
254 bool IsPendingRowHeights() const { return bPendingRowHeights; }
255 void SetPendingRowHeights( bool bSet );
257 bool GetCalcNotification() const { return bCalcNotification; }
258 void SetCalcNotification( bool bSet );
260 bool IsLayoutRTL() const { return bLayoutRTL; }
261 bool IsLoadingRTL() const { return bLoadingRTL; }
262 void SetLayoutRTL( bool bSet );
263 void SetLoadingRTL( bool bSet );
265 bool IsScenario() const { return bScenario; }
266 void SetScenario( bool bFlag );
267 void GetScenarioComment( OUString& rComment) const { rComment = aComment; }
268 void SetScenarioComment( const OUString& rComment ) { aComment = rComment; }
269 const Color& GetScenarioColor() const { return aScenarioColor; }
270 void SetScenarioColor(const Color& rNew) { aScenarioColor = rNew; }
271 const Color& GetTabBgColor() const;
272 void SetTabBgColor(const Color& rColor);
273 sal_uInt16 GetScenarioFlags() const { return nScenarioFlags; }
274 void SetScenarioFlags(sal_uInt16 nNew) { nScenarioFlags = nNew; }
275 void SetActiveScenario(bool bSet) { bActiveScenario = bSet; }
276 bool IsActiveScenario() const { return bActiveScenario; }
278 sal_uInt8 GetLinkMode() const { return nLinkMode; }
279 bool IsLinked() const { return nLinkMode != SC_LINK_NONE; }
280 const OUString& GetLinkDoc() const { return aLinkDoc; }
281 const OUString& GetLinkFlt() const { return aLinkFlt; }
282 const OUString& GetLinkOpt() const { return aLinkOpt; }
283 const OUString& GetLinkTab() const { return aLinkTab; }
284 sal_uLong GetLinkRefreshDelay() const { return nLinkRefreshDelay; }
286 void SetLink( sal_uInt8 nMode, const OUString& rDoc, const OUString& rFlt,
287 const OUString& rOpt, const OUString& rTab, sal_uLong nRefreshDelay );
289 void GetName( OUString& rName ) const;
290 void SetName( const OUString& rNewName );
292 void SetAnonymousDBData(ScDBData* pDBData);
293 ScDBData* GetAnonymousDBData();
295 void GetCodeName( OUString& rName ) const { rName = aCodeName; }
296 void SetCodeName( const OUString& rNewName ) { aCodeName = rNewName; }
298 const OUString& GetUpperName() const;
300 const OUString& GetPageStyle() const { return aPageStyle; }
301 void SetPageStyle( const OUString& rName );
302 void PageStyleModified( const OUString& rNewName );
304 bool IsProtected() const;
305 void SetProtection(const ScTableProtection* pProtect);
306 ScTableProtection* GetProtection();
308 Size GetPageSize() const;
309 void SetPageSize( const Size& rSize );
310 void SetRepeatArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
312 void LockTable();
313 void UnlockTable();
315 bool IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
316 SCROW nRow2, bool* pOnlyNotBecauseOfMatrix = NULL ) const;
317 bool IsSelectionEditable( const ScMarkData& rMark,
318 bool* pOnlyNotBecauseOfMatrix = NULL ) const;
320 bool HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
321 bool HasSelectionMatrixFragment( const ScMarkData& rMark ) const;
323 bool IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes = false ) const;
325 bool SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString,
326 ScSetStringParam* pParam = NULL );
328 void SetEditText( SCCOL nCol, SCROW nRow, EditTextObject* pEditText );
329 void SetEditText( SCCOL nCol, SCROW nRow, const EditTextObject& rEditText, const SfxItemPool* pEditPool );
331 void SetEmptyCell( SCCOL nCol, SCROW nRow );
332 void SetFormula(
333 SCCOL nCol, SCROW nRow, const ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram );
334 void SetFormula(
335 SCCOL nCol, SCROW nRow, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram );
338 * Takes ownership of pCell
340 * @return pCell if it was successfully inserted, NULL otherwise. pCell
341 * is deleted automatically on failure to insert.
343 ScFormulaCell* SetFormulaCell( SCCOL nCol, SCROW nRow, ScFormulaCell* pCell );
345 svl::SharedString GetSharedString( SCCOL nCol, SCROW nRow ) const;
347 void SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
348 void SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError);
350 void SetRawString( SCCOL nCol, SCROW nRow, const OUString& rStr );
351 void SetRawString( SCCOL nCol, SCROW nRow, const svl::SharedString& rStr );
352 void GetString( SCCOL nCol, SCROW nRow, OUString& rString ) const;
353 double* GetValueCell( SCCOL nCol, SCROW nRow );
354 void GetInputString( SCCOL nCol, SCROW nRow, OUString& rString ) const;
355 double GetValue( const ScAddress& rPos ) const
357 return ValidColRow(rPos.Col(),rPos.Row()) ?
358 aCol[rPos.Col()].GetValue( rPos.Row() ) :
359 0.0;
361 double GetValue( SCCOL nCol, SCROW nRow ) const;
362 const EditTextObject* GetEditText( SCCOL nCol, SCROW nRow ) const;
363 void RemoveEditTextCharAttribs( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
364 void GetFormula( SCCOL nCol, SCROW nRow, OUString& rFormula ) const;
365 const ScTokenArray* GetFormulaTokens( SCCOL nCol, SCROW nRow ) const;
366 const ScFormulaCell* GetFormulaCell( SCCOL nCol, SCROW nRow ) const;
367 ScFormulaCell* GetFormulaCell( SCCOL nCol, SCROW nRow );
369 CellType GetCellType( const ScAddress& rPos ) const
371 return ValidColRow(rPos.Col(),rPos.Row()) ?
372 aCol[rPos.Col()].GetCellType( rPos.Row() ) :
373 CELLTYPE_NONE;
375 CellType GetCellType( SCCOL nCol, SCROW nRow ) const;
376 ScRefCellValue GetCellValue( SCCOL nCol, SCROW nRow ) const;
378 void GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const;
379 void GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
381 ScPostIt* GetNote(const SCCOL nCol, const SCROW nRow);
383 size_t GetNoteCount( SCCOL nCol ) const;
384 SCROW GetNotePosition( SCCOL nCol, size_t nIndex ) const;
386 void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
387 void GetNotesInRange( const ScRange& rRange, std::vector<sc::NoteEntry>& rNotes ) const;
388 bool ContainsNotesInRange( const ScRange& rRange ) const;
390 bool TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize ) const;
391 void InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize );
392 void DeleteRow(
393 const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize, bool* pUndoOutline = NULL );
395 bool TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) const;
396 void InsertCol(
397 const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
398 void DeleteCol(
399 const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize, bool* pUndoOutline = NULL );
401 void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nDelFlag);
402 void CopyToClip( sc::CopyToClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable );
403 void CopyToClip( sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable );
404 void CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab);
405 void CopyCellToDocument( SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, SCROW nDestRow, ScTable& rDestTab );
407 bool InitColumnBlockPosition( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol );
409 void CopyFromClip(
410 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
411 SCsCOL nDx, SCsROW nDy, ScTable* pTable );
413 void StartListeningInArea(
414 sc::StartListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
416 void BroadcastInArea( SCCOL nCol1, SCROW nRow1,
417 SCCOL nCol2, SCROW nRow2 );
419 void CopyToTable(
420 sc::CopyToDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
421 sal_uInt16 nFlags, bool bMarked, ScTable* pDestTab,
422 const ScMarkData* pMarkData = NULL, bool bAsLink = false, bool bColRowFlags = true );
424 void UndoToTable(
425 sc::CopyToDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
426 sal_uInt16 nFlags, bool bMarked, ScTable* pDestTab, const ScMarkData* pMarkData = NULL );
428 void CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
429 SCsCOL nDx, SCsROW nDy, ScTable* pTable);
430 void TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
431 ScTable* pTransClip, sal_uInt16 nFlags, bool bAsLink );
433 // mark of this document
434 void MixMarked(
435 sc::MixDocContext& rCxt, const ScMarkData& rMark, sal_uInt16 nFunction,
436 bool bSkipEmpty, const ScTable* pSrcTab );
438 void MixData(
439 sc::MixDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
440 sal_uInt16 nFunction, bool bSkipEmpty, const ScTable* pSrcTab );
442 void CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
443 SCCOL nDestCol, SCROW nDestRow, SCTAB nDestTab );
445 void CopyScenarioFrom( const ScTable* pSrcTab );
446 void CopyScenarioTo( ScTable* pDestTab ) const;
447 bool TestCopyScenarioTo( const ScTable* pDestTab ) const;
448 void MarkScenarioIn( ScMarkData& rMark, sal_uInt16 nNeededBits ) const;
449 bool HasScenarioRange( const ScRange& rRange ) const;
450 void InvalidateScenarioRanges();
451 const ScRangeList* GetScenarioRanges() const;
453 void CopyUpdated( const ScTable* pPosTab, ScTable* pDestTab ) const;
455 void InvalidateTableArea();
456 void InvalidatePageBreaks();
458 bool GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const; // FALSE = empty
459 bool GetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const;
460 bool GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes, bool bFullFormattedArea = false ) const;
461 bool GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
462 SCCOL& rEndCol, bool bNotes ) const;
463 bool GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
464 SCROW& rEndRow, bool bNotes ) const;
466 bool GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const;
468 void ExtendPrintArea( OutputDevice* pDev,
469 SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow );
471 void GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
472 bool bIncludeOld, bool bOnlyDown ) const;
474 bool ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
475 SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
477 SCROW GetLastDataRow( SCCOL nCol1, SCCOL nCol2, SCROW nLastRow ) const;
479 SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
480 SCCOL nEndCol, SCROW nEndRow, ScDirection eDir ) const;
482 void FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection ) const;
483 void GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY,
484 bool bMarked, bool bUnprotected, const ScMarkData& rMark ) const;
486 void LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
488 bool HasData( SCCOL nCol, SCROW nRow ) const;
489 bool HasStringData( SCCOL nCol, SCROW nRow ) const;
490 bool HasValueData( SCCOL nCol, SCROW nRow ) const;
491 bool HasStringCells( SCCOL nStartCol, SCROW nStartRow,
492 SCCOL nEndCol, SCROW nEndRow ) const;
494 sal_uInt16 GetErrCode( const ScAddress& rPos ) const
496 return ValidColRow(rPos.Col(),rPos.Row()) ?
497 aCol[rPos.Col()].GetErrCode( rPos.Row() ) :
501 bool IsEmptyData( SCCOL nCol ) const;
503 void ResetChanged( const ScRange& rRange );
505 void SetDirty();
506 void SetDirty( const ScRange& );
507 void SetDirtyAfterLoad();
508 void SetDirtyVar();
509 void SetTableOpDirty( const ScRange& );
510 void CalcAll();
511 void CalcAfterLoad();
512 void CompileAll();
513 void CompileXML( ScProgress& rProgress );
515 bool CompileErrorCells(sal_uInt16 nErrCode);
517 void UpdateReference(
518 sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = NULL,
519 bool bIncludeDraw = true, bool bUpdateNoteCaptionPos = true );
521 void UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
522 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
523 SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bUpdateNoteCaptionPos = true );
525 void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
526 ScDocument* pUndoDoc );
528 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
530 void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt );
531 void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt );
532 void UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTabNo, ScProgress* pProgress );
533 void UpdateCompile( bool bForceIfNameInUse = false );
534 void SetTabNo(SCTAB nNewTab);
535 void FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
536 std::set<sal_uInt16>& rIndexes) const;
537 void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
538 sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
539 double nStepValue, double nMaxValue, ScProgress* pProgress);
540 OUString GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
542 void UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData& rMark );
544 void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
545 sal_uInt16 nFormatNo );
546 void GetAutoFormatData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData& rData);
547 void ScReplaceTabsStr( OUString& rStr, const OUString& rSrch, const OUString& rRepl ); // from sw
548 bool SearchAndReplace(
549 const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark,
550 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
552 void FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2 );
554 void GetBorderLines( SCCOL nCol, SCROW nRow,
555 const ::editeng::SvxBorderLine** ppLeft, const ::editeng::SvxBorderLine** ppTop,
556 const ::editeng::SvxBorderLine** ppRight, const ::editeng::SvxBorderLine** ppBottom ) const;
558 bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nMask ) const;
559 bool HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
560 bool ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
561 SCCOL& rEndCol, SCROW& rEndRow,
562 bool bRefresh );
563 const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const;
564 const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow ) const;
565 const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
567 sal_uInt32 GetNumberFormat( const ScAddress& rPos ) const;
568 sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
569 sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
571 void SetNumberFormat( SCCOL nCol, SCROW nRow, sal_uInt32 nNumberFormat );
573 void MergeSelectionPattern( ScMergePatternState& rState,
574 const ScMarkData& rMark, bool bDeep ) const;
575 void MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1,
576 SCCOL nCol2, SCROW nRow2, bool bDeep ) const;
577 void MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
578 ScLineFlags& rFlags,
579 SCCOL nStartCol, SCROW nStartRow,
580 SCCOL nEndCol, SCROW nEndRow ) const;
581 void ApplyBlockFrame( const SvxBoxItem* pLineOuter,
582 const SvxBoxInfoItem* pLineInner,
583 SCCOL nStartCol, SCROW nStartRow,
584 SCCOL nEndCol, SCROW nEndRow );
586 void ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
587 void ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
588 void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
589 const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = NULL );
590 bool SetAttrEntries(SCCOL nCol, ScAttrEntry* pData, SCSIZE nSize);
592 void SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, bool bPutToPool = false )
594 if (ValidColRow(rPos.Col(),rPos.Row()))
595 aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool );
597 void SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, bool bPutToPool = false );
598 void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
599 const ScPatternAttr& rPattern, short nNewType );
600 void AddCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
601 void RemoveCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
603 void ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet& rStyle );
604 void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet& rStyle );
605 void ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
606 void ApplySelectionLineStyle( const ScMarkData& rMark,
607 const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
609 const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow ) const;
610 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const;
611 const ScStyleSheet* GetAreaStyle( bool& rFound, SCCOL nCol1, SCROW nRow1,
612 SCCOL nCol2, SCROW nRow2 ) const;
614 void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRemoved,
615 OutputDevice* pDev,
616 double nPPTX, double nPPTY,
617 const Fraction& rZoomX, const Fraction& rZoomY );
619 bool IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const;
621 bool ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
622 bool RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
624 void ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
625 void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
627 void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
628 void ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
630 const ScRange* GetRepeatColRange() const { return pRepeatColRange; }
631 const ScRange* GetRepeatRowRange() const { return pRepeatRowRange; }
632 void SetRepeatColRange( const ScRange* pNew );
633 void SetRepeatRowRange( const ScRange* pNew );
635 sal_uInt16 GetPrintRangeCount() const { return static_cast< sal_uInt16 >( aPrintRanges.size() ); }
636 const ScRange* GetPrintRange(sal_uInt16 nPos) const;
637 /** Returns true, if the sheet is always printed. */
638 bool IsPrintEntireSheet() const { return bPrintEntireSheet; }
640 /** Removes all print ranges. */
641 void ClearPrintRanges();
642 /** Adds a new print ranges. */
643 void AddPrintRange( const ScRange& rNew );
644 /** Marks the specified sheet to be printed completely. Deletes old print ranges! */
645 void SetPrintEntireSheet();
647 void FillPrintSaver( ScPrintSaverTab& rSaveTab ) const;
648 void RestorePrintRanges( const ScPrintSaverTab& rSaveTab );
650 sal_uInt16 GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
651 double nPPTX, double nPPTY,
652 const Fraction& rZoomX, const Fraction& rZoomY,
653 bool bFormula, const ScMarkData* pMarkData,
654 const ScColWidthParam* pParam );
655 bool SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra,
656 OutputDevice* pDev,
657 double nPPTX, double nPPTY,
658 const Fraction& rZoomX, const Fraction& rZoomY,
659 bool bForce,
660 ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 );
662 void SetOptimalHeightOnly(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra,
663 OutputDevice* pDev,
664 double nPPTX, double nPPTY,
665 const Fraction& rZoomX, const Fraction& rZoomY,
666 bool bForce,
667 ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 );
669 long GetNeededSize( SCCOL nCol, SCROW nRow,
670 OutputDevice* pDev,
671 double nPPTX, double nPPTY,
672 const Fraction& rZoomX, const Fraction& rZoomY,
673 bool bWidth, bool bTotalSize );
674 void SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth );
675 void SetColWidthOnly( SCCOL nCol, sal_uInt16 nNewWidth );
676 void SetRowHeight( SCROW nRow, sal_uInt16 nNewHeight );
677 bool SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight,
678 double nPPTX, double nPPTY );
681 * Set specified row height to specified ranges. Don't check for drawing
682 * objects etc. Just set the row height. Nothing else.
684 * Note that setting a new row height via this function will not
685 * invalidate page breaks.
687 void SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight );
689 // nPPT to test for modification
690 void SetManualHeight( SCROW nStartRow, SCROW nEndRow, bool bManual );
692 sal_uInt16 GetColWidth( SCCOL nCol, bool bHiddenAsZero = true ) const;
693 SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true ) const;
694 sal_uLong GetRowHeight( SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero = true ) const;
695 sal_uLong GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const;
696 sal_uLong GetColOffset( SCCOL nCol, bool bHiddenAsZero = true ) const;
697 sal_uLong GetRowOffset( SCROW nRow, bool bHiddenAsZero = true ) const;
700 * Get the last row such that the height of row 0 to the end row is as
701 * high as possible without exceeding the specified height value.
703 * @param nHeight maximum desired height
705 * @return SCROW last row of the range within specified height.
707 SCROW GetRowForHeight(sal_uLong nHeight) const;
709 sal_uInt16 GetOriginalWidth( SCCOL nCol ) const;
710 sal_uInt16 GetOriginalHeight( SCROW nRow ) const;
712 sal_uInt16 GetCommonWidth( SCCOL nEndCol ) const;
714 SCROW GetHiddenRowCount( SCROW nRow ) const;
716 void ShowCol(SCCOL nCol, bool bShow);
717 void ShowRow(SCROW nRow, bool bShow);
718 void DBShowRow(SCROW nRow, bool bShow);
720 void ShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
721 void DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
723 void SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags );
724 void SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags );
726 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
727 SCROW GetLastFlaggedRow() const;
729 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
730 SCCOL GetLastChangedCol() const;
731 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
732 SCROW GetLastChangedRow() const;
734 bool IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const;
735 bool IsDataFiltered(const ScRange& rRange) const;
736 sal_uInt8 GetColFlags( SCCOL nCol ) const;
737 sal_uInt8 GetRowFlags( SCROW nRow ) const;
739 const ScBitMaskCompressedArray< SCROW, sal_uInt8> * GetRowFlagsArray() const
740 { return pRowFlags; }
742 bool UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, bool bShow );
743 bool UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, bool bShow );
745 void UpdatePageBreaks( const ScRange* pUserArea );
746 void RemoveManualBreaks();
747 bool HasManualBreaks() const;
748 void SetRowManualBreaks( const ::std::set<SCROW>& rBreaks );
749 void SetColManualBreaks( const ::std::set<SCCOL>& rBreaks );
751 void GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const;
752 void GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const;
753 bool HasRowPageBreak(SCROW nRow) const;
754 bool HasColPageBreak(SCCOL nCol) const;
755 bool HasRowManualBreak(SCROW nRow) const;
756 bool HasColManualBreak(SCCOL nCol) const;
759 * Get the row position of the next manual break that occurs at or below
760 * specified row. When no more manual breaks are present at or below
761 * the specified row, -1 is returned.
763 * @param nRow row at which the search begins.
765 * @return SCROW next row position with manual page break, or -1 if no
766 * more manual breaks are present.
768 SCROW GetNextManualBreak(SCROW nRow) const;
770 void RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow);
771 void RemoveRowBreak(SCROW nRow, bool bPage, bool bManual);
772 void RemoveColBreak(SCCOL nCol, bool bPage, bool bManual);
773 void SetRowBreak(SCROW nRow, bool bPage, bool bManual);
774 void SetColBreak(SCCOL nCol, bool bPage, bool bManual);
775 ::com::sun::star::uno::Sequence<
776 ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const;
778 bool RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
779 bool RowHiddenLeaf(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
780 bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
781 bool ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
782 bool SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
783 bool SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden);
784 void CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
785 void CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
786 void CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset);
787 SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
788 SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
789 SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
790 sal_uInt32 GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero = true) const;
792 SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol) const;
794 bool RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
795 bool ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
796 bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
797 void CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
798 void CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
799 void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered);
800 void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered);
801 SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
802 SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
803 SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
805 bool IsManualRowHeight(SCROW nRow) const;
807 void SyncColRowFlags();
809 void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
810 void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
812 void Sort(const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress);
813 bool ValidQuery(
814 SCROW nRow, const ScQueryParam& rQueryParam, ScRefCellValue* pCell = NULL,
815 bool* pbTestEqualCondition = NULL);
816 void TopTenQuery( ScQueryParam& );
817 SCSIZE Query(ScQueryParam& rQueryParam, bool bKeepSub);
818 bool CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
820 void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
821 void GetFilteredFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, std::vector<ScTypedStrData>& rStrings, bool& rHasDates );
822 bool GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit);
824 bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
825 bool HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
827 sal_Int32 GetMaxStringLen( SCCOL nCol,
828 SCROW nRowStart, SCROW nRowEnd, rtl_TextEncoding eCharSet ) const;
829 xub_StrLen GetMaxNumberStringLen( sal_uInt16& nPrecision,
830 SCCOL nCol,
831 SCROW nRowStart, SCROW nRowEnd ) const;
833 bool IsSortCollatorGlobal() const;
834 void InitSortCollator( const ScSortParam& rPar );
835 void DestroySortCollator();
836 void SetDrawPageSize( bool bResetStreamValid = true, bool bUpdateNoteCaptionPos = true );
838 void SetRangeName(ScRangeName* pNew);
839 ScRangeName* GetRangeName() const;
841 ScConditionalFormatList* GetCondFormList();
842 const ScConditionalFormatList* GetCondFormList() const;
843 void SetCondFormList( ScConditionalFormatList* pList );
845 void DeleteConditionalFormat(sal_uLong nOldIndex);
847 sal_uLong AddCondFormat( ScConditionalFormat* pNew );
849 sal_uInt8 GetScriptType( SCCOL nCol, SCROW nRow ) const;
850 void SetScriptType( SCCOL nCol, SCROW nRow, sal_uInt8 nType );
852 sal_uInt8 GetRangeScriptType( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 );
854 size_t GetFormulaHash( SCCOL nCol, SCROW nRow ) const;
856 ScFormulaVectorState GetFormulaVectorState( SCCOL nCol, SCROW nRow ) const;
857 formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol, SCROW nRow );
858 formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
859 formula::VectorRefArray FetchVectorRefArray( SCCOL nCol, SCROW nRow1, SCROW nRow2 );
861 ScRefCellValue GetRefCellValue( SCCOL nCol, SCROW nRow );
863 SvtBroadcaster* GetBroadcaster( SCCOL nCol, SCROW nRow );
864 const SvtBroadcaster* GetBroadcaster( SCCOL nCol, SCROW nRow ) const;
865 void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 );
866 bool HasBroadcaster( SCCOL nCol ) const;
868 void FillMatrix( ScMatrix& rMat, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
870 void InterpretDirtyCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
872 void SetFormulaResults( SCCOL nCol, SCROW nRow, const double* pResults, size_t nLen );
873 void SetFormulaResults( SCCOL nCol, SCROW nRow, const formula::FormulaTokenRef* pResults, size_t nLen );
876 * Have formula cells with NeedsListening() == true start listening to the
877 * document.
879 void StartNeededListeners();
882 * Mark formula cells dirty that have the mbPostponedDirty flag set or
883 * contain named ranges with relative references.
885 void SetDirtyIfPostponed();
888 * Broadcast dirty formula cells that contain functions such as CELL(),
889 * COLUMN() or ROW() which may change its value on move.
891 void BroadcastRecalcOnRefMove();
893 #if DEBUG_COLUMN_STORAGE
894 void DumpFormulaGroups( SCCOL nCol ) const;
895 #endif
897 /** Replace behaves differently to the Search; adjust the rCol and rRow accordingly.
899 'Replace' replaces at the 'current' position, but in order to achieve
900 that, we have to 'shift' the rCol / rRow to the 'previous' position -
901 what it is depends on various settings in rSearchItem.
903 static void UpdateSearchItemAddressForReplace( const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow );
905 private:
906 void FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
907 sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd,
908 FillDateCmd eFillDateCmd,
909 double nStepValue, double nMaxValue, sal_uInt16 nMinDigits,
910 bool bAttribs, ScProgress* pProgress );
911 void FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
912 FillCmd& rCmd, FillDateCmd& rDateCmd,
913 double& rInc, sal_uInt16& rMinDigits,
914 ScUserListData*& rListData, sal_uInt16& rListIndex);
915 void FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
916 sal_uLong nFillCount, FillDir eFillDir, ScProgress* pProgress );
918 bool ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
919 bool bMarked, bool bUnprotected ) const;
921 void AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
922 const ScPatternAttr& rAttr, sal_uInt16 nFormatNo);
923 void GetAutoFormatAttr(SCCOL nCol, SCROW nRow, sal_uInt16 nIndex, ScAutoFormatData& rData);
924 void GetAutoFormatFrame(SCCOL nCol, SCROW nRow, sal_uInt16 nFlags, sal_uInt16 nIndex, ScAutoFormatData& rData);
925 bool SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRow,
926 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
927 bool Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
928 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
929 bool SearchAll(const SvxSearchItem& rSearchItem, const ScMarkData& rMark,
930 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
931 bool Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
932 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
933 bool ReplaceAll(
934 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
935 OUString& rUndoStr, ScDocument* pUndoDoc);
937 bool SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
938 const ScMarkData& rMark);
939 bool ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
940 const ScMarkData& rMark, bool bIsUndo);
941 bool SearchAllStyle(
942 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges);
943 bool ReplaceAllStyle(
944 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
945 ScDocument* pUndoDoc);
946 bool SearchAndReplaceEmptyCells(
947 const SvxSearchItem& rSearchItem,
948 SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
949 OUString& rUndoStr, ScDocument* pUndoDoc);
950 bool SearchRangeForEmptyCell(const ScRange& rRange,
951 const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
952 OUString& rUndoStr);
953 bool SearchRangeForAllEmptyCells(
954 const ScRange& rRange, const SvxSearchItem& rSearchItem,
955 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
957 // use the global sort parameter:
958 bool IsSorted(SCCOLROW nStart, SCCOLROW nEnd) const;
959 void DecoladeRow( ScSortInfoArray*, SCROW nRow1, SCROW nRow2 );
960 void SwapCol(SCCOL nCol1, SCCOL nCol2);
961 void SwapRow(SCROW nRow1, SCROW nRow2);
962 short CompareCell(
963 sal_uInt16 nSort,
964 ScRefCellValue& rCell1, SCCOL nCell1Col, SCROW nCell1Row,
965 ScRefCellValue& rCell2, SCCOL nCell2Col, SCROW nCell2Row ) const;
966 short Compare(SCCOLROW nIndex1, SCCOLROW nIndex2) const;
967 short Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2) const;
968 ScSortInfoArray* CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 );
969 void QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi);
970 void SortReorder( ScSortInfoArray*, ScProgress* );
972 bool CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
973 bool CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
974 void GetUpperCellString(SCCOL nCol, SCROW nRow, OUString& rStr);
976 bool RefVisible(ScFormulaCell* pCell);
978 bool IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol) const;
980 void IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillDateCmd eCmd);
981 void FillFormula(sal_uLong& nFormulaCounter, bool bFirst, ScFormulaCell* pSrcCell,
982 SCCOL nDestCol, SCROW nDestRow, bool bLast );
983 void UpdateInsertTabAbs(SCTAB nNewPos);
984 bool GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel,
985 const ScMarkData& rMark) const;
986 bool GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ) const;
987 bool TestTabRefAbs(SCTAB nTable) const;
988 void CompileDBFormula();
989 void CompileDBFormula( bool bCreateFormulaString );
990 void CompileNameFormula( bool bCreateFormulaString );
991 void CompileColRowNameFormula();
992 void RebuildFormulaGroups();
994 void StartListening( const ScAddress& rAddress, SvtListener* pListener );
995 void EndListening( const ScAddress& rAddress, SvtListener* pListener );
996 void StartListening( sc::StartListeningContext& rCxt, SCCOL nCol, SCROW nRow, SvtListener& rListener );
997 void EndListening( sc::EndListeningContext& rCxt, SCCOL nCol, SCROW nRow, SvtListener& rListener );
998 void StartAllListeners();
1000 void SetLoadingMedium(bool bLoading);
1002 SCSIZE FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2,
1003 SCCOL nCol, SCROW nAttrRow1, SCROW nAttrRow2, SCSIZE nArrY,
1004 const ScPatternAttr* pPattern, const SfxItemSet* pCondSet );
1006 // idle calculation of OutputDevice text width for cell
1007 // also invalidates script type, broadcasts for "calc as shown"
1008 void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
1009 bool bNumFormatChanged, bool bBroadcast );
1011 void SkipFilteredRows(SCROW& rRow, SCROW& rLastNonFilteredRow, bool bForward);
1014 * In case the cell text goes beyond the column width, move the max column
1015 * position to the right. This is called from ExtendPrintArea.
1017 void MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY);
1019 void CopyPrintRange(const ScTable& rTable);
1021 SCCOL FindNextVisibleColWithContent(SCCOL nCol, bool bRight, SCROW nRow) const;
1023 SCCOL FindNextVisibleCol(SCCOL nCol, bool bRight) const;
1025 // Clipboard transpose for notes
1026 void TransposeColNotes(ScTable* pTransClip, SCCOL nCol1, SCCOL nCol, SCROW nRow1, SCROW nRow2);
1029 * Use this to iterate through non-empty visible cells in a single column.
1031 class VisibleDataCellIterator
1033 public:
1034 static SCROW ROW_NOT_FOUND;
1036 explicit VisibleDataCellIterator(ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn);
1037 ~VisibleDataCellIterator();
1040 * Set the start row position. In case there is not visible data cell
1041 * at the specified row position, it will move to the position of the
1042 * first visible data cell below that point.
1044 * @return First visible data cell if found, or NULL otherwise.
1046 ScRefCellValue reset(SCROW nRow);
1049 * Find the next visible data cell position.
1051 * @return Next visible data cell if found, or NULL otherwise.
1053 ScRefCellValue next();
1056 * Get the current row position.
1058 * @return Current row position, or ROW_NOT_FOUND if the iterator
1059 * doesn't point to a valid data cell position.
1061 SCROW getRow() const;
1063 private:
1064 ScFlatBoolRowSegments& mrRowSegs;
1065 ScColumn& mrColumn;
1066 ScRefCellValue maCell;
1067 SCROW mnCurRow;
1068 SCROW mnUBound;
1073 #endif
1076 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */