bump product version to 4.1.6.2
[LibreOffice.git] / sc / inc / table.hxx
blob7f95d7f58bdd1102bdcee25fc1c8285c82e276b0
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 "formula/types.hxx"
35 #include <set>
36 #include <map>
37 #include <boost/scoped_ptr.hpp>
38 #include <boost/noncopyable.hpp>
40 namespace utl {
41 class TextSearch;
44 namespace com { namespace sun { namespace star {
45 namespace sheet {
46 struct TablePageBreakData;
48 } } }
50 namespace sc {
51 struct FormulaGroupContext;
52 class StartListeningContext;
53 class EndListeningContext;
54 class CopyFromClipContext;
55 class CopyToClipContext;
56 class CopyToDocContext;
57 class MixDocContext;
58 struct ColumnBlockPosition;
61 class SfxItemSet;
62 class SfxStyleSheetBase;
63 class SvxBoxInfoItem;
64 class SvxBoxItem;
65 class SvxSearchItem;
67 class ScAutoFormatData;
68 class ScBaseCell;
69 class ScDocument;
70 class ScEditDataArray;
71 class ScFormulaCell;
72 class ScOutlineTable;
73 class ScPrintSaverTab;
74 class ScProgress;
75 class ScRangeList;
76 class ScSheetEvents;
77 class ScSortInfoArray;
78 class ScConditionalFormat;
79 class ScConditionalFormatList;
80 class ScStyleSheet;
81 class ScTableProtection;
82 class ScUserListData;
83 struct RowInfo;
84 struct ScFunctionData;
85 struct ScLineFlags;
86 class CollatorWrapper;
87 class ScFlatUInt16RowSegments;
88 class ScFlatBoolRowSegments;
89 class ScFlatBoolColSegments;
90 struct ScSetStringParam;
91 struct ScColWidthParam;
92 struct ScColWidthParam;
93 class ScRangeName;
94 class ScDBData;
95 class ScDocumentImport;
97 class ScTable : boost::noncopyable
99 private:
100 typedef ::std::vector< ScRange > ScRangeVec;
101 typedef ::std::pair< SCCOL, SCROW > ScAddress2D;
102 typedef ::std::vector< ScAddress2D > ScAddress2DVec;
104 ScColumn aCol[MAXCOLCOUNT];
106 OUString aName;
107 OUString aCodeName;
108 OUString aComment;
110 OUString aLinkDoc;
111 OUString aLinkFlt;
112 OUString aLinkOpt;
113 OUString aLinkTab;
114 sal_uLong nLinkRefreshDelay;
115 sal_uInt8 nLinkMode;
117 // page style template
118 OUString aPageStyle;
119 Size aPageSizeTwips; // size of the print-page
120 SCCOL nRepeatStartX; // repeating rows/columns
121 SCCOL nRepeatEndX; // REPEAT_NONE, if not used
122 SCROW nRepeatStartY;
123 SCROW nRepeatEndY;
125 boost::scoped_ptr<ScTableProtection> pTabProtection;
127 sal_uInt16* pColWidth;
128 boost::scoped_ptr<ScFlatUInt16RowSegments> mpRowHeights;
130 sal_uInt8* pColFlags;
131 ScBitMaskCompressedArray< SCROW, sal_uInt8>* pRowFlags;
132 boost::scoped_ptr<ScFlatBoolColSegments> mpHiddenCols;
133 boost::scoped_ptr<ScFlatBoolRowSegments> mpHiddenRows;
134 boost::scoped_ptr<ScFlatBoolColSegments> mpFilteredCols;
135 boost::scoped_ptr<ScFlatBoolRowSegments> mpFilteredRows;
137 ::std::set<SCROW> maRowPageBreaks;
138 ::std::set<SCROW> maRowManualBreaks;
139 ::std::set<SCCOL> maColPageBreaks;
140 ::std::set<SCCOL> maColManualBreaks;
142 ScOutlineTable* pOutlineTable;
144 ScSheetEvents* pSheetEvents;
146 mutable SCCOL nTableAreaX;
147 mutable SCROW nTableAreaY;
149 SCTAB nTab;
150 ScDocument* pDocument;
151 utl::TextSearch* pSearchText;
153 mutable OUString aUpperName; // #i62977# filled only on demand, reset in SetName
155 boost::scoped_ptr<ScAddress2DVec> mxUninitNotes;
157 // sort parameter to minimize stack size of quicksort
158 ScSortParam aSortParam;
159 CollatorWrapper* pSortCollator;
161 ScRangeVec aPrintRanges;
163 ScRange* pRepeatColRange;
164 ScRange* pRepeatRowRange;
166 sal_uInt16 nLockCount;
168 ScRangeList* pScenarioRanges;
169 Color aScenarioColor;
170 Color aTabBgColor;
171 sal_uInt16 nScenarioFlags;
172 ScDBData* pDBDataNoName;
173 mutable ScRangeName* mpRangeName;
175 boost::scoped_ptr<ScConditionalFormatList> mpCondFormatList;
177 ScNotes maNotes;
179 bool bScenario:1;
180 bool bLayoutRTL:1;
181 bool bLoadingRTL:1;
182 bool bPageSizeValid:1;
183 mutable bool bTableAreaValid:1;
184 bool bVisible:1;
185 bool bStreamValid:1;
186 bool bPendingRowHeights:1;
187 bool bCalcNotification:1;
188 bool bGlobalKeepQuery:1;
189 bool bPrintEntireSheet:1;
190 bool bActiveScenario:1;
191 bool mbPageBreaksValid:1;
193 friend class ScDocument; // for FillInfo
194 friend class ScDocumentIterator;
195 friend class ScValueIterator;
196 friend class ScHorizontalValueIterator;
197 friend class ScDBQueryDataIterator;
198 friend class ScCellIterator;
199 friend class ScQueryCellIterator;
200 friend class ScHorizontalCellIterator;
201 friend class ScHorizontalAttrIterator;
202 friend class ScDocAttrIterator;
203 friend class ScAttrRectIterator;
204 friend class ScColumnTextWidthIterator;
205 friend class ScDocumentImport;
207 public:
208 ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,
209 bool bColInfo = true, bool bRowInfo = true );
210 ~ScTable();
212 ScOutlineTable* GetOutlineTable() { return pOutlineTable; }
214 SCSIZE GetCellCount(SCCOL nCol) const;
215 sal_uLong GetCellCount() const;
216 sal_uLong GetWeightedCount() const;
217 sal_uLong GetCodeCount() const; // RPN code in formula
219 sal_uInt16 GetTextWidth(SCCOL nCol, SCROW nRow) const;
220 void SetTextWidth(SCCOL nCol, SCROW nRow, sal_uInt16 nWidth);
222 bool SetOutlineTable( const ScOutlineTable* pNewOutline );
223 void StartOutlineTable();
225 void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
227 bool TestRemoveSubTotals( const ScSubTotalParam& rParam );
228 void RemoveSubTotals( ScSubTotalParam& rParam );
229 bool DoSubTotals( ScSubTotalParam& rParam );
231 const ScSheetEvents* GetSheetEvents() const { return pSheetEvents; }
232 void SetSheetEvents( const ScSheetEvents* pNew );
234 bool IsVisible() const { return bVisible; }
235 void SetVisible( bool bVis );
237 bool IsStreamValid() const { return bStreamValid; }
238 void SetStreamValid( bool bSet, bool bIgnoreLock = false );
240 bool IsPendingRowHeights() const { return bPendingRowHeights; }
241 void SetPendingRowHeights( bool bSet );
243 bool GetCalcNotification() const { return bCalcNotification; }
244 void SetCalcNotification( bool bSet );
246 bool IsLayoutRTL() const { return bLayoutRTL; }
247 bool IsLoadingRTL() const { return bLoadingRTL; }
248 void SetLayoutRTL( bool bSet );
249 void SetLoadingRTL( bool bSet );
251 bool IsScenario() const { return bScenario; }
252 void SetScenario( bool bFlag );
253 void GetScenarioComment( OUString& rComment) const { rComment = aComment; }
254 void SetScenarioComment( const OUString& rComment ) { aComment = rComment; }
255 const Color& GetScenarioColor() const { return aScenarioColor; }
256 void SetScenarioColor(const Color& rNew) { aScenarioColor = rNew; }
257 const Color& GetTabBgColor() const;
258 void SetTabBgColor(const Color& rColor);
259 sal_uInt16 GetScenarioFlags() const { return nScenarioFlags; }
260 void SetScenarioFlags(sal_uInt16 nNew) { nScenarioFlags = nNew; }
261 void SetActiveScenario(bool bSet) { bActiveScenario = bSet; }
262 bool IsActiveScenario() const { return bActiveScenario; }
264 sal_uInt8 GetLinkMode() const { return nLinkMode; }
265 bool IsLinked() const { return nLinkMode != SC_LINK_NONE; }
266 const OUString& GetLinkDoc() const { return aLinkDoc; }
267 const OUString& GetLinkFlt() const { return aLinkFlt; }
268 const OUString& GetLinkOpt() const { return aLinkOpt; }
269 const OUString& GetLinkTab() const { return aLinkTab; }
270 sal_uLong GetLinkRefreshDelay() const { return nLinkRefreshDelay; }
272 void SetLink( sal_uInt8 nMode, const String& rDoc, const String& rFlt,
273 const String& rOpt, const String& rTab, sal_uLong nRefreshDelay );
275 void GetName( OUString& rName ) const;
276 void SetName( const OUString& rNewName );
278 void SetAnonymousDBData(ScDBData* pDBData);
279 ScDBData* GetAnonymousDBData();
281 void GetCodeName( OUString& rName ) const { rName = aCodeName; }
282 void SetCodeName( const OUString& rNewName ) { aCodeName = rNewName; }
284 const OUString& GetUpperName() const;
286 const OUString& GetPageStyle() const { return aPageStyle; }
287 void SetPageStyle( const OUString& rName );
288 void PageStyleModified( const String& rNewName );
290 bool IsProtected() const;
291 void SetProtection(const ScTableProtection* pProtect);
292 ScTableProtection* GetProtection();
294 Size GetPageSize() const;
295 void SetPageSize( const Size& rSize );
296 void SetRepeatArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
298 void RemoveAutoSpellObj();
300 void LockTable();
301 void UnlockTable();
303 bool IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
304 SCROW nRow2, bool* pOnlyNotBecauseOfMatrix = NULL ) const;
305 bool IsSelectionEditable( const ScMarkData& rMark,
306 bool* pOnlyNotBecauseOfMatrix = NULL ) const;
308 bool HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
309 bool HasSelectionMatrixFragment( const ScMarkData& rMark ) const;
311 bool IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes = false ) const;
313 void PutCell( const ScAddress&, ScBaseCell* pCell );
314 void PutCell( SCCOL nCol, SCROW nRow, ScBaseCell* pCell );
315 void PutCell(SCCOL nCol, SCROW nRow, sal_uLong nFormatIndex, ScBaseCell* pCell);
317 bool SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
318 ScSetStringParam* pParam = NULL );
320 void SetEditText( SCCOL nCol, SCROW nRow, EditTextObject* pEditText );
321 void SetEditText( SCCOL nCol, SCROW nRow, const EditTextObject& rEditText, const SfxItemPool* pEditPool );
323 void SetEmptyCell( SCCOL nCol, SCROW nRow );
324 void SetFormula(
325 SCCOL nCol, SCROW nRow, const ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram );
326 void SetFormula(
327 SCCOL nCol, SCROW nRow, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram );
329 void SetFormulaCell( SCCOL nCol, SCROW nRow, ScFormulaCell* pCell );
331 void SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
332 void SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError);
334 void GetString( SCCOL nCol, SCROW nRow, OUString& rString ) const;
335 const OUString* GetStringCell( SCCOL nCol, SCROW nRow ) const;
336 double* GetValueCell( SCCOL nCol, SCROW nRow );
337 void GetInputString( SCCOL nCol, SCROW nRow, OUString& rString ) const;
338 double GetValue( const ScAddress& rPos ) const
340 return ValidColRow(rPos.Col(),rPos.Row()) ?
341 aCol[rPos.Col()].GetValue( rPos.Row() ) :
342 0.0;
344 double GetValue( SCCOL nCol, SCROW nRow ) const;
345 const EditTextObject* GetEditText( SCCOL nCol, SCROW nRow ) const;
346 void RemoveEditTextCharAttribs( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
347 void GetFormula( SCCOL nCol, SCROW nRow, OUString& rFormula ) const;
348 const ScTokenArray* GetFormulaTokens( SCCOL nCol, SCROW nRow ) const;
349 const ScFormulaCell* GetFormulaCell( SCCOL nCol, SCROW nRow ) const;
350 ScFormulaCell* GetFormulaCell( SCCOL nCol, SCROW nRow );
352 CellType GetCellType( const ScAddress& rPos ) const
354 return ValidColRow(rPos.Col(),rPos.Row()) ?
355 aCol[rPos.Col()].GetCellType( rPos.Row() ) :
356 CELLTYPE_NONE;
358 CellType GetCellType( SCCOL nCol, SCROW nRow ) const;
359 ScBaseCell* GetCell( const ScAddress& rPos ) const
361 return ValidColRow(rPos.Col(),rPos.Row()) ?
362 aCol[rPos.Col()].GetCell( rPos.Row() ) :
363 NULL;
365 ScBaseCell* GetCell( SCCOL nCol, SCROW nRow ) const;
367 void GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const;
368 void GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
370 ScNotes* GetNotes();
371 /** Creates the captions of all uninitialized cell notes.
372 @param bForced True = always create all captions, false = skip when Undo is disabled. */
373 void InitializeNoteCaptions( bool bForced = false );
375 bool TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize ) const;
376 void InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize );
377 void DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize,
378 bool* pUndoOutline = NULL );
380 bool TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) const;
381 void InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
382 void DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize,
383 bool* pUndoOutline = NULL );
385 void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nDelFlag);
386 void CopyToClip( sc::CopyToClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable );
387 void CopyToClip( sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable );
388 void CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab);
389 void CopyCellToDocument( SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, SCROW nDestRow, ScTable& rDestTab );
391 bool InitColumnBlockPosition( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol );
393 void CopyFromClip(
394 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
395 SCsCOL nDx, SCsROW nDy, ScTable* pTable );
397 void StartListeningInArea(
398 sc::StartListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
400 void BroadcastInArea( SCCOL nCol1, SCROW nRow1,
401 SCCOL nCol2, SCROW nRow2 );
403 void CopyToTable(
404 sc::CopyToDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
405 sal_uInt16 nFlags, bool bMarked, ScTable* pDestTab,
406 const ScMarkData* pMarkData = NULL, bool bAsLink = false, bool bColRowFlags = true );
408 void UndoToTable(
409 sc::CopyToDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
410 sal_uInt16 nFlags, bool bMarked, ScTable* pDestTab, const ScMarkData* pMarkData = NULL );
412 void CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
413 SCsCOL nDx, SCsROW nDy, ScTable* pTable);
414 void TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
415 ScTable* pTransClip, sal_uInt16 nFlags, bool bAsLink );
417 // mark of this document
418 void MixMarked(
419 sc::MixDocContext& rCxt, const ScMarkData& rMark, sal_uInt16 nFunction,
420 bool bSkipEmpty, const ScTable* pSrcTab );
422 void MixData(
423 sc::MixDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
424 sal_uInt16 nFunction, bool bSkipEmpty, const ScTable* pSrcTab );
426 void CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
427 SCCOL nDestCol, SCROW nDestRow, SCTAB nDestTab );
429 void CopyScenarioFrom( const ScTable* pSrcTab );
430 void CopyScenarioTo( ScTable* pDestTab ) const;
431 bool TestCopyScenarioTo( const ScTable* pDestTab ) const;
432 void MarkScenarioIn( ScMarkData& rMark, sal_uInt16 nNeededBits ) const;
433 bool HasScenarioRange( const ScRange& rRange ) const;
434 void InvalidateScenarioRanges();
435 const ScRangeList* GetScenarioRanges() const;
437 void CopyUpdated( const ScTable* pPosTab, ScTable* pDestTab ) const;
439 void InvalidateTableArea();
440 void InvalidatePageBreaks();
442 bool GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const; // FALSE = empty
443 bool GetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const;
444 bool GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes, bool bFullFormattedArea = false ) const;
445 bool GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
446 SCCOL& rEndCol, bool bNotes ) const;
447 bool GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
448 SCROW& rEndRow, bool bNotes ) const;
450 bool GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const;
452 void ExtendPrintArea( OutputDevice* pDev,
453 SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow );
455 void GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
456 bool bIncludeOld, bool bOnlyDown ) const;
458 bool ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
459 SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
461 SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
462 SCCOL nEndCol, SCROW nEndRow, ScDirection eDir ) const;
464 void FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection ) const;
465 void GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY,
466 bool bMarked, bool bUnprotected, const ScMarkData& rMark ) const;
468 void LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
470 bool HasData( SCCOL nCol, SCROW nRow ) const;
471 bool HasStringData( SCCOL nCol, SCROW nRow ) const;
472 bool HasValueData( SCCOL nCol, SCROW nRow ) const;
473 bool HasStringCells( SCCOL nStartCol, SCROW nStartRow,
474 SCCOL nEndCol, SCROW nEndRow ) const;
476 sal_uInt16 GetErrCode( const ScAddress& rPos ) const
478 return ValidColRow(rPos.Col(),rPos.Row()) ?
479 aCol[rPos.Col()].GetErrCode( rPos.Row() ) :
483 void ResetChanged( const ScRange& rRange );
485 void SetDirty();
486 void SetDirty( const ScRange& );
487 void SetDirtyAfterLoad();
488 void SetDirtyVar();
489 void SetTableOpDirty( const ScRange& );
490 void CalcAll();
491 void CalcAfterLoad();
492 void CompileAll();
493 void CompileXML( ScProgress& rProgress );
495 bool CompileErrorCells(sal_uInt16 nErrCode);
497 void UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
498 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
499 SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
500 ScDocument* pUndoDoc = NULL, bool bIncludeDraw = true, bool bUpdateNoteCaptionPos = true );
502 void UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
503 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
504 SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bUpdateNoteCaptionPos = true );
506 void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
507 ScDocument* pUndoDoc );
509 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
511 void UpdateInsertTab(SCTAB nTable, SCTAB nNewSheets = 1);
512 void UpdateDeleteTab( SCTAB nTable, bool bIsMove, ScTable* pRefUndo = NULL, SCTAB nSheets = 1 );
513 void UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, ScProgress* pProgress );
514 void UpdateCompile( bool bForceIfNameInUse = false );
515 void SetTabNo(SCTAB nNewTab);
516 void FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
517 std::set<sal_uInt16>& rIndexes) const;
518 void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
519 sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
520 double nStepValue, double nMaxValue, ScProgress* pProgress);
521 String GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
523 void UpdateSelectionFunction( ScFunctionData& rData,
524 SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
525 const ScMarkData& rMark );
527 void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
528 sal_uInt16 nFormatNo );
529 void GetAutoFormatData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData& rData);
530 void ScReplaceTabsStr( String& rStr, const String& rSrch, const String& rRepl ); // from sw
531 bool SearchAndReplace(
532 const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark,
533 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
535 void FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2 );
537 void GetBorderLines( SCCOL nCol, SCROW nRow,
538 const ::editeng::SvxBorderLine** ppLeft, const ::editeng::SvxBorderLine** ppTop,
539 const ::editeng::SvxBorderLine** ppRight, const ::editeng::SvxBorderLine** ppBottom ) const;
541 bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nMask ) const;
542 bool HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
543 bool ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
544 SCCOL& rEndCol, SCROW& rEndRow,
545 bool bRefresh );
546 const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const;
547 const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow ) const;
548 const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
550 sal_uInt32 GetNumberFormat( const ScAddress& rPos ) const;
551 sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
552 sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
554 void SetNumberFormat( SCCOL nCol, SCROW nRow, sal_uInt32 nNumberFormat );
556 void MergeSelectionPattern( ScMergePatternState& rState,
557 const ScMarkData& rMark, bool bDeep ) const;
558 void MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1,
559 SCCOL nCol2, SCROW nRow2, bool bDeep ) const;
560 void MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
561 ScLineFlags& rFlags,
562 SCCOL nStartCol, SCROW nStartRow,
563 SCCOL nEndCol, SCROW nEndRow ) const;
564 void ApplyBlockFrame( const SvxBoxItem* pLineOuter,
565 const SvxBoxInfoItem* pLineInner,
566 SCCOL nStartCol, SCROW nStartRow,
567 SCCOL nEndCol, SCROW nEndRow );
569 void ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
570 void ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
571 void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
572 const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = NULL );
573 bool SetAttrEntries(SCCOL nCol, ScAttrEntry* pData, SCSIZE nSize);
575 void SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, bool bPutToPool = false )
577 if (ValidColRow(rPos.Col(),rPos.Row()))
578 aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool );
580 void SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, bool bPutToPool = false );
581 void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
582 const ScPatternAttr& rPattern, short nNewType );
583 void AddCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
584 void RemoveCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
586 void ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet& rStyle );
587 void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet& rStyle );
588 void ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
589 void ApplySelectionLineStyle( const ScMarkData& rMark,
590 const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
592 const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow ) const;
593 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const;
594 const ScStyleSheet* GetAreaStyle( bool& rFound, SCCOL nCol1, SCROW nRow1,
595 SCCOL nCol2, SCROW nRow2 ) const;
597 void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRemoved,
598 OutputDevice* pDev,
599 double nPPTX, double nPPTY,
600 const Fraction& rZoomX, const Fraction& rZoomY );
602 bool IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const;
604 bool ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
605 bool RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
607 void ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
608 void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
610 void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
611 void ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
613 const ScRange* GetRepeatColRange() const { return pRepeatColRange; }
614 const ScRange* GetRepeatRowRange() const { return pRepeatRowRange; }
615 void SetRepeatColRange( const ScRange* pNew );
616 void SetRepeatRowRange( const ScRange* pNew );
618 sal_uInt16 GetPrintRangeCount() const { return static_cast< sal_uInt16 >( aPrintRanges.size() ); }
619 const ScRange* GetPrintRange(sal_uInt16 nPos) const;
620 /** Returns true, if the sheet is always printed. */
621 bool IsPrintEntireSheet() const { return bPrintEntireSheet; }
623 /** Removes all print ranges. */
624 void ClearPrintRanges();
625 /** Adds a new print ranges. */
626 void AddPrintRange( const ScRange& rNew );
627 /** Marks the specified sheet to be printed completely. Deletes old print ranges! */
628 void SetPrintEntireSheet();
630 void FillPrintSaver( ScPrintSaverTab& rSaveTab ) const;
631 void RestorePrintRanges( const ScPrintSaverTab& rSaveTab );
633 sal_uInt16 GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
634 double nPPTX, double nPPTY,
635 const Fraction& rZoomX, const Fraction& rZoomY,
636 bool bFormula, const ScMarkData* pMarkData,
637 const ScColWidthParam* pParam );
638 bool SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra,
639 OutputDevice* pDev,
640 double nPPTX, double nPPTY,
641 const Fraction& rZoomX, const Fraction& rZoomY,
642 bool bForce,
643 ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 );
645 void SetOptimalHeightOnly(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra,
646 OutputDevice* pDev,
647 double nPPTX, double nPPTY,
648 const Fraction& rZoomX, const Fraction& rZoomY,
649 bool bForce,
650 ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 );
652 long GetNeededSize( SCCOL nCol, SCROW nRow,
653 OutputDevice* pDev,
654 double nPPTX, double nPPTY,
655 const Fraction& rZoomX, const Fraction& rZoomY,
656 bool bWidth, bool bTotalSize );
657 void SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth );
658 void SetColWidthOnly( SCCOL nCol, sal_uInt16 nNewWidth );
659 void SetRowHeight( SCROW nRow, sal_uInt16 nNewHeight );
660 bool SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight,
661 double nPPTX, double nPPTY );
664 * Set specified row height to specified ranges. Don't check for drawing
665 * objects etc. Just set the row height. Nothing else.
667 * Note that setting a new row height via this function will not
668 * invalidate page breaks.
670 void SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight );
672 // nPPT to test for modification
673 void SetManualHeight( SCROW nStartRow, SCROW nEndRow, bool bManual );
675 sal_uInt16 GetColWidth( SCCOL nCol, bool bHiddenAsZero = true ) const;
676 SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true ) const;
677 sal_uLong GetRowHeight( SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero = true ) const;
678 sal_uLong GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const;
679 sal_uLong GetColOffset( SCCOL nCol, bool bHiddenAsZero = true ) const;
680 sal_uLong GetRowOffset( SCROW nRow, bool bHiddenAsZero = true ) const;
683 * Get the last row such that the height of row 0 to the end row is as
684 * high as possible without exceeding the specified height value.
686 * @param nHeight maximum desired height
688 * @return SCROW last row of the range within specified height.
690 SCROW GetRowForHeight(sal_uLong nHeight) const;
692 sal_uInt16 GetOriginalWidth( SCCOL nCol ) const;
693 sal_uInt16 GetOriginalHeight( SCROW nRow ) const;
695 sal_uInt16 GetCommonWidth( SCCOL nEndCol ) const;
697 SCROW GetHiddenRowCount( SCROW nRow ) const;
699 void ShowCol(SCCOL nCol, bool bShow);
700 void ShowRow(SCROW nRow, bool bShow);
701 void DBShowRow(SCROW nRow, bool bShow);
703 void ShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
704 void DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
706 void SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags );
707 void SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags );
709 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
710 SCROW GetLastFlaggedRow() const;
712 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
713 SCCOL GetLastChangedCol() const;
714 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
715 SCROW GetLastChangedRow() const;
717 bool IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const;
718 bool IsDataFiltered(const ScRange& rRange) const;
719 sal_uInt8 GetColFlags( SCCOL nCol ) const;
720 sal_uInt8 GetRowFlags( SCROW nRow ) const;
722 const ScBitMaskCompressedArray< SCROW, sal_uInt8> * GetRowFlagsArray() const
723 { return pRowFlags; }
725 bool UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, bool bShow );
726 bool UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, bool bShow );
728 void UpdatePageBreaks( const ScRange* pUserArea );
729 void RemoveManualBreaks();
730 bool HasManualBreaks() const;
731 void SetRowManualBreaks( const ::std::set<SCROW>& rBreaks );
732 void SetColManualBreaks( const ::std::set<SCCOL>& rBreaks );
734 void GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const;
735 void GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const;
736 bool HasRowPageBreak(SCROW nRow) const;
737 bool HasColPageBreak(SCCOL nCol) const;
738 bool HasRowManualBreak(SCROW nRow) const;
739 bool HasColManualBreak(SCCOL nCol) const;
742 * Get the row position of the next manual break that occurs at or below
743 * specified row. When no more manual breaks are present at or below
744 * the specified row, -1 is returned.
746 * @param nRow row at which the search begins.
748 * @return SCROW next row position with manual page break, or -1 if no
749 * more manual breaks are present.
751 SCROW GetNextManualBreak(SCROW nRow) const;
753 void RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow);
754 void RemoveRowBreak(SCROW nRow, bool bPage, bool bManual);
755 void RemoveColBreak(SCCOL nCol, bool bPage, bool bManual);
756 void SetRowBreak(SCROW nRow, bool bPage, bool bManual);
757 void SetColBreak(SCCOL nCol, bool bPage, bool bManual);
758 ::com::sun::star::uno::Sequence<
759 ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const;
761 bool RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
762 bool RowHiddenLeaf(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
763 bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
764 bool ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
765 bool SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
766 bool SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden);
767 void CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
768 void CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
769 void CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset);
770 SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
771 SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
772 SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
773 sal_uInt32 GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero = true) const;
775 SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol) const;
777 bool RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
778 bool ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
779 bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
780 void CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
781 void CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
782 void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered);
783 void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered);
784 SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
785 SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
786 SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
788 bool IsManualRowHeight(SCROW nRow) const;
790 void SyncColRowFlags();
792 void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
793 void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
795 void Sort(const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress);
796 bool ValidQuery(
797 SCROW nRow, const ScQueryParam& rQueryParam, ScBaseCell* pCell = NULL,
798 bool* pbTestEqualCondition = NULL);
799 void TopTenQuery( ScQueryParam& );
800 SCSIZE Query(ScQueryParam& rQueryParam, bool bKeepSub);
801 bool CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
803 void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
804 void GetFilteredFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, std::vector<ScTypedStrData>& rStrings, bool& rHasDates );
805 bool GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit);
807 bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
808 bool HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
810 void DoColResize( SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd );
813 sal_Int32 GetMaxStringLen( SCCOL nCol,
814 SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const;
815 xub_StrLen GetMaxNumberStringLen( sal_uInt16& nPrecision,
816 SCCOL nCol,
817 SCROW nRowStart, SCROW nRowEnd ) const;
819 bool IsSortCollatorGlobal() const;
820 void InitSortCollator( const ScSortParam& rPar );
821 void DestroySortCollator();
822 void SetDrawPageSize( bool bResetStreamValid = true, bool bUpdateNoteCaptionPos = true );
824 void SetRangeName(ScRangeName* pNew);
825 ScRangeName* GetRangeName() const;
826 void UpdateMoveTab(SCTAB nOldPos,SCTAB nNewPos);
828 ScConditionalFormatList* GetCondFormList();
829 const ScConditionalFormatList* GetCondFormList() const;
830 void SetCondFormList( ScConditionalFormatList* pList );
832 void DeleteConditionalFormat(sal_uLong nOldIndex);
834 sal_uLong AddCondFormat( ScConditionalFormat* pNew );
836 sal_uInt8 GetScriptType( SCCOL nCol, SCROW nRow ) const;
837 void SetScriptType( SCCOL nCol, SCROW nRow, sal_uInt8 nType );
839 sal_uInt8 GetRangeScriptType( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 );
841 size_t GetFormulaHash( SCCOL nCol, SCROW nRow ) const;
843 ScFormulaVectorState GetFormulaVectorState( SCCOL nCol, SCROW nRow ) const;
844 formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol, SCROW nRow );
845 formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
846 const double* FetchDoubleArray(
847 sc::FormulaGroupContext& rCxt, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const;
849 ScRefCellValue GetRefCellValue( SCCOL nCol, SCROW nRow );
851 SvtBroadcaster* GetBroadcaster( SCCOL nCol, SCROW nRow );
852 const SvtBroadcaster* GetBroadcaster( SCCOL nCol, SCROW nRow ) const;
853 void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 );
854 bool HasBroadcaster( SCCOL nCol ) const;
857 * Mark formula cells dirty that have the mbPostponedDirty flag set or
858 * contain named ranges with relative references.
860 void SetDirtyIfPostponed();
863 * Broadcast dirty formula cells that contain functions such as CELL(),
864 * COLUMN() or ROW() which may change its value on move.
866 void BroadcastRecalcOnRefMove();
868 /** Replace behaves differently to the Search; adjust the rCol and rRow accordingly.
870 'Replace' replaces at the 'current' position, but in order to achieve
871 that, we have to 'shift' the rCol / rRow to the 'previous' position -
872 what it is depends on various settings in rSearchItem.
874 static void UpdateSearchItemAddressForReplace( const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow );
876 private:
877 void FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
878 sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd,
879 FillDateCmd eFillDateCmd,
880 double nStepValue, double nMaxValue, sal_uInt16 nMinDigits,
881 bool bAttribs, ScProgress* pProgress );
882 void FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
883 FillCmd& rCmd, FillDateCmd& rDateCmd,
884 double& rInc, sal_uInt16& rMinDigits,
885 ScUserListData*& rListData, sal_uInt16& rListIndex);
886 void FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
887 sal_uLong nFillCount, FillDir eFillDir, ScProgress* pProgress );
889 bool ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
890 bool bMarked, bool bUnprotected ) const;
892 void AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
893 const ScPatternAttr& rAttr, sal_uInt16 nFormatNo);
894 void GetAutoFormatAttr(SCCOL nCol, SCROW nRow, sal_uInt16 nIndex, ScAutoFormatData& rData);
895 void GetAutoFormatFrame(SCCOL nCol, SCROW nRow, sal_uInt16 nFlags, sal_uInt16 nIndex, ScAutoFormatData& rData);
896 bool SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRow,
897 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
898 bool Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
899 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
900 bool SearchAll(const SvxSearchItem& rSearchItem, const ScMarkData& rMark,
901 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
902 bool Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
903 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
904 bool ReplaceAll(
905 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
906 OUString& rUndoStr, ScDocument* pUndoDoc);
908 bool SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
909 const ScMarkData& rMark);
910 bool ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
911 const ScMarkData& rMark, bool bIsUndo);
912 bool SearchAllStyle(
913 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges);
914 bool ReplaceAllStyle(
915 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
916 ScDocument* pUndoDoc);
917 bool SearchAndReplaceEmptyCells(
918 const SvxSearchItem& rSearchItem,
919 SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
920 OUString& rUndoStr, ScDocument* pUndoDoc);
921 bool SearchRangeForEmptyCell(const ScRange& rRange,
922 const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
923 OUString& rUndoStr);
924 bool SearchRangeForAllEmptyCells(
925 const ScRange& rRange, const SvxSearchItem& rSearchItem,
926 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
928 // use the global sort parameter:
929 bool IsSorted(SCCOLROW nStart, SCCOLROW nEnd) const;
930 void DecoladeRow( ScSortInfoArray*, SCROW nRow1, SCROW nRow2 );
931 void SwapCol(SCCOL nCol1, SCCOL nCol2);
932 void SwapRow(SCROW nRow1, SCROW nRow2);
933 short CompareCell( sal_uInt16 nSort,
934 ScBaseCell* pCell1, SCCOL nCell1Col, SCROW nCell1Row,
935 ScBaseCell* pCell2, SCCOL nCell2Col, SCROW nCell2Row ) const;
936 short Compare(SCCOLROW nIndex1, SCCOLROW nIndex2) const;
937 short Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2) const;
938 ScSortInfoArray* CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 );
939 void QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi);
940 void SortReorder( ScSortInfoArray*, ScProgress* );
942 bool CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
943 bool CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
944 void GetUpperCellString(SCCOL nCol, SCROW nRow, OUString& rStr);
946 bool RefVisible(ScFormulaCell* pCell);
948 bool IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol) const;
950 void IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillDateCmd eCmd);
951 void FillFormula(sal_uLong& nFormulaCounter, bool bFirst, ScFormulaCell* pSrcCell,
952 SCCOL nDestCol, SCROW nDestRow, bool bLast );
953 void UpdateInsertTabAbs(SCTAB nNewPos);
954 bool GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel,
955 const ScMarkData& rMark) const;
956 bool GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ) const;
957 bool TestTabRefAbs(SCTAB nTable) const;
958 void CompileDBFormula();
959 void CompileDBFormula( bool bCreateFormulaString );
960 void CompileNameFormula( bool bCreateFormulaString );
961 void CompileColRowNameFormula();
962 void RebuildFormulaGroups();
964 void StartListening( const ScAddress& rAddress, SvtListener* pListener );
965 void EndListening( const ScAddress& rAddress, SvtListener* pListener );
966 void StartListening( sc::StartListeningContext& rCxt, SCCOL nCol, SCROW nRow, SvtListener& rListener );
967 void EndListening( sc::EndListeningContext& rCxt, SCCOL nCol, SCROW nRow, SvtListener& rListener );
968 void StartAllListeners();
969 void StartNeededListeners(); // only for cells where NeedsListening()==TRUE
971 void SetLoadingMedium(bool bLoading);
973 SCSIZE FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2,
974 SCCOL nCol, SCROW nAttrRow1, SCROW nAttrRow2, SCSIZE nArrY,
975 const ScPatternAttr* pPattern, const SfxItemSet* pCondSet );
977 // idle calculation of OutputDevice text width for cell
978 // also invalidates script type, broadcasts for "calc as shown"
979 void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
980 bool bNumFormatChanged, bool bBroadcast );
982 void SkipFilteredRows(SCROW& rRow, SCROW& rLastNonFilteredRow, bool bForward);
985 * In case the cell text goes beyond the column width, move the max column
986 * position to the right. This is called from ExtendPrintArea.
988 void MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY);
990 void CopyPrintRange(const ScTable& rTable);
992 SCCOL FindNextVisibleColWithContent(SCCOL nCol, bool bRight, SCROW nRow) const;
994 SCCOL FindNextVisibleCol(SCCOL nCol, bool bRight) const;
997 * Use this to iterate through non-empty visible cells in a single column.
999 class VisibleDataCellIterator
1001 public:
1002 static SCROW ROW_NOT_FOUND;
1004 explicit VisibleDataCellIterator(ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn);
1005 ~VisibleDataCellIterator();
1008 * Set the start row position. In case there is not visible data cell
1009 * at the specified row position, it will move to the position of the
1010 * first visible data cell below that point.
1012 * @return First visible data cell if found, or NULL otherwise.
1014 ScBaseCell* reset(SCROW nRow);
1017 * Find the next visible data cell position.
1019 * @return Next visible data cell if found, or NULL otherwise.
1021 ScBaseCell* next();
1024 * Get the current row position.
1026 * @return Current row position, or ROW_NOT_FOUND if the iterator
1027 * doesn't point to a valid data cell position.
1029 SCROW getRow() const;
1031 private:
1032 ScFlatBoolRowSegments& mrRowSegs;
1033 ScColumn& mrColumn;
1034 ScBaseCell* mpCell;
1035 SCROW mnCurRow;
1036 SCROW mnUBound;
1041 #endif
1044 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */