update emoji autocorrect entries from po-files
[LibreOffice.git] / sc / inc / table.hxx
blob7454188f04a726d5a164f1e075980a2c2596842a
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 INCLUDED_SC_INC_TABLE_HXX
21 #define INCLUDED_SC_INC_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;
71 class CellValues;
72 class TableValues;
73 class RowHeightContext;
74 class CompileFormulaContext;
75 struct SetFormulaDirtyContext;
76 class RefMovedHint;
77 struct ReorderParam;
81 class SfxItemSet;
82 class SfxStyleSheetBase;
83 class SvxBoxInfoItem;
84 class SvxBoxItem;
85 class SvxSearchItem;
87 class ScAutoFormatData;
88 class ScDocument;
89 class ScEditDataArray;
90 class ScFormulaCell;
91 class ScOutlineTable;
92 class ScPrintSaverTab;
93 class ScProgress;
94 class ScRangeList;
95 class ScSheetEvents;
96 class ScSortInfoArray;
97 class ScConditionalFormat;
98 class ScConditionalFormatList;
99 class ScStyleSheet;
100 class ScTableProtection;
101 class ScUserListData;
102 struct RowInfo;
103 struct ScFunctionData;
104 struct ScLineFlags;
105 class CollatorWrapper;
106 class ScFlatUInt16RowSegments;
107 class ScFlatBoolRowSegments;
108 class ScFlatBoolColSegments;
109 struct ScSetStringParam;
110 struct ScColWidthParam;
111 struct ScColWidthParam;
112 class ScRangeName;
113 class ScDBData;
114 class ScDocumentImport;
115 class ScHint;
117 class ScTable : boost::noncopyable
119 private:
120 typedef ::std::vector< ScRange > ScRangeVec;
122 ScColumn aCol[MAXCOLCOUNT];
124 OUString aName;
125 OUString aCodeName;
126 OUString aComment;
128 OUString aLinkDoc;
129 OUString aLinkFlt;
130 OUString aLinkOpt;
131 OUString aLinkTab;
132 sal_uLong nLinkRefreshDelay;
133 sal_uInt8 nLinkMode;
135 // page style template
136 OUString aPageStyle;
137 Size aPageSizeTwips; // size of the print-page
138 SCCOL nRepeatStartX; // repeating rows/columns
139 SCCOL nRepeatEndX; // REPEAT_NONE, if not used
140 SCROW nRepeatStartY;
141 SCROW nRepeatEndY;
143 boost::scoped_ptr<ScTableProtection> pTabProtection;
145 sal_uInt16* pColWidth;
146 boost::scoped_ptr<ScFlatUInt16RowSegments> mpRowHeights;
148 sal_uInt8* pColFlags;
149 ScBitMaskCompressedArray< SCROW, sal_uInt8>* pRowFlags;
150 boost::scoped_ptr<ScFlatBoolColSegments> mpHiddenCols;
151 boost::scoped_ptr<ScFlatBoolRowSegments> mpHiddenRows;
152 boost::scoped_ptr<ScFlatBoolColSegments> mpFilteredCols;
153 boost::scoped_ptr<ScFlatBoolRowSegments> mpFilteredRows;
155 ::std::set<SCROW> maRowPageBreaks;
156 ::std::set<SCROW> maRowManualBreaks;
157 ::std::set<SCCOL> maColPageBreaks;
158 ::std::set<SCCOL> maColManualBreaks;
160 ScOutlineTable* pOutlineTable;
162 ScSheetEvents* pSheetEvents;
164 mutable SCCOL nTableAreaX;
165 mutable SCROW nTableAreaY;
167 SCTAB nTab;
168 ScDocument* pDocument;
169 utl::TextSearch* pSearchText;
171 mutable OUString aUpperName; // #i62977# filled only on demand, reset in SetName
173 // sort parameter to minimize stack size of quicksort
174 ScSortParam aSortParam;
175 CollatorWrapper* pSortCollator;
177 ScRangeVec aPrintRanges;
179 ScRange* pRepeatColRange;
180 ScRange* pRepeatRowRange;
182 sal_uInt16 nLockCount;
184 ScRangeList* pScenarioRanges;
185 Color aScenarioColor;
186 Color aTabBgColor;
187 sal_uInt16 nScenarioFlags;
188 ScDBData* pDBDataNoName;
189 mutable ScRangeName* mpRangeName;
191 boost::scoped_ptr<ScConditionalFormatList> mpCondFormatList;
193 bool bScenario:1;
194 bool bLayoutRTL:1;
195 bool bLoadingRTL:1;
196 bool bPageSizeValid:1;
197 mutable bool bTableAreaValid:1;
198 bool bVisible:1;
199 bool bStreamValid:1;
200 bool bPendingRowHeights:1;
201 bool bCalcNotification:1;
202 bool bGlobalKeepQuery:1;
203 bool bPrintEntireSheet:1;
204 bool bActiveScenario:1;
205 bool mbPageBreaksValid:1;
206 bool mbForceBreaks:1;
208 friend class ScDocument; // for FillInfo
209 friend class ScValueIterator;
210 friend class ScHorizontalValueIterator;
211 friend class ScDBQueryDataIterator;
212 friend class ScCellIterator;
213 friend class ScQueryCellIterator;
214 friend class ScHorizontalCellIterator;
215 friend class ScHorizontalAttrIterator;
216 friend class ScDocAttrIterator;
217 friend class ScAttrRectIterator;
218 friend class ScColumnTextWidthIterator;
219 friend class ScDocumentImport;
220 friend class sc::DocumentStreamAccess;
221 friend class sc::ColumnSpanSet;
222 friend class sc::EditTextIterator;
223 friend class sc::FormulaGroupAreaListener;
225 public:
226 ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,
227 bool bColInfo = true, bool bRowInfo = true );
228 ~ScTable();
230 ScDocument& GetDoc() { return *pDocument;}
231 const ScDocument& GetDoc() const { return *pDocument;}
232 SCTAB GetTab() const { return nTab; }
234 ScOutlineTable* GetOutlineTable() { return pOutlineTable; }
236 sal_uLong GetCellCount() const;
237 sal_uLong GetWeightedCount() const;
238 sal_uLong GetCodeCount() const; // RPN code in formula
240 sal_uInt16 GetTextWidth(SCCOL nCol, SCROW nRow) const;
242 bool SetOutlineTable( const ScOutlineTable* pNewOutline );
243 void StartOutlineTable();
245 void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
247 bool TestRemoveSubTotals( const ScSubTotalParam& rParam );
248 void RemoveSubTotals( ScSubTotalParam& rParam );
249 bool DoSubTotals( ScSubTotalParam& rParam );
251 const ScSheetEvents* GetSheetEvents() const { return pSheetEvents; }
252 void SetSheetEvents( const ScSheetEvents* pNew );
254 bool IsVisible() const { return bVisible; }
255 void SetVisible( bool bVis );
257 bool IsStreamValid() const { return bStreamValid; }
258 void SetStreamValid( bool bSet, bool bIgnoreLock = false );
260 bool IsPendingRowHeights() const { return bPendingRowHeights; }
261 void SetPendingRowHeights( bool bSet );
263 bool GetCalcNotification() const { return bCalcNotification; }
264 void SetCalcNotification( bool bSet );
266 bool IsLayoutRTL() const { return bLayoutRTL; }
267 bool IsLoadingRTL() const { return bLoadingRTL; }
268 void SetLayoutRTL( bool bSet );
269 void SetLoadingRTL( bool bSet );
271 bool IsScenario() const { return bScenario; }
272 void SetScenario( bool bFlag );
273 void GetScenarioComment( OUString& rComment) const { rComment = aComment; }
274 void SetScenarioComment( const OUString& rComment ) { aComment = rComment; }
275 const Color& GetScenarioColor() const { return aScenarioColor; }
276 void SetScenarioColor(const Color& rNew) { aScenarioColor = rNew; }
277 const Color& GetTabBgColor() const { return aTabBgColor; }
278 void SetTabBgColor(const Color& rColor);
279 sal_uInt16 GetScenarioFlags() const { return nScenarioFlags; }
280 void SetScenarioFlags(sal_uInt16 nNew) { nScenarioFlags = nNew; }
281 void SetActiveScenario(bool bSet) { bActiveScenario = bSet; }
282 bool IsActiveScenario() const { return bActiveScenario; }
284 sal_uInt8 GetLinkMode() const { return nLinkMode; }
285 bool IsLinked() const { return nLinkMode != SC_LINK_NONE; }
286 const OUString& GetLinkDoc() const { return aLinkDoc; }
287 const OUString& GetLinkFlt() const { return aLinkFlt; }
288 const OUString& GetLinkOpt() const { return aLinkOpt; }
289 const OUString& GetLinkTab() const { return aLinkTab; }
290 sal_uLong GetLinkRefreshDelay() const { return nLinkRefreshDelay; }
292 void SetLink( sal_uInt8 nMode, const OUString& rDoc, const OUString& rFlt,
293 const OUString& rOpt, const OUString& rTab, sal_uLong nRefreshDelay );
295 void GetName( OUString& rName ) const;
296 void SetName( const OUString& rNewName );
298 void SetAnonymousDBData(ScDBData* pDBData);
299 ScDBData* GetAnonymousDBData() { return pDBDataNoName;}
301 void GetCodeName( OUString& rName ) const { rName = aCodeName; }
302 void SetCodeName( const OUString& rNewName ) { aCodeName = rNewName; }
304 const OUString& GetUpperName() const;
306 const OUString& GetPageStyle() const { return aPageStyle; }
307 void SetPageStyle( const OUString& rName );
308 void PageStyleModified( const OUString& rNewName );
310 bool IsProtected() const;
311 void SetProtection(const ScTableProtection* pProtect);
312 ScTableProtection* GetProtection();
314 Size GetPageSize() const;
315 void SetPageSize( const Size& rSize );
316 void SetRepeatArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
318 void LockTable();
319 void UnlockTable();
321 bool IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
322 SCROW nRow2, bool* pOnlyNotBecauseOfMatrix = NULL ) const;
323 bool IsSelectionEditable( const ScMarkData& rMark,
324 bool* pOnlyNotBecauseOfMatrix = NULL ) const;
326 bool HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
327 bool HasSelectionMatrixFragment( const ScMarkData& rMark ) const;
329 bool IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes = false ) const;
331 bool SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString,
332 ScSetStringParam* pParam = NULL );
334 bool SetEditText( SCCOL nCol, SCROW nRow, EditTextObject* pEditText );
335 void SetEditText( SCCOL nCol, SCROW nRow, const EditTextObject& rEditText, const SfxItemPool* pEditPool );
336 SCROW GetFirstEditTextRow( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
338 void SetEmptyCell( SCCOL nCol, SCROW nRow );
339 void SetFormula(
340 SCCOL nCol, SCROW nRow, const ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram );
341 void SetFormula(
342 SCCOL nCol, SCROW nRow, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram );
345 * Takes ownership of pCell
347 * @return pCell if it was successfully inserted, NULL otherwise. pCell
348 * is deleted automatically on failure to insert.
350 ScFormulaCell* SetFormulaCell( SCCOL nCol, SCROW nRow, ScFormulaCell* pCell );
352 bool SetFormulaCells( SCCOL nCol, SCROW nRow, std::vector<ScFormulaCell*>& rCells );
354 bool HasFormulaCell( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
356 svl::SharedString GetSharedString( SCCOL nCol, SCROW nRow ) const;
358 void SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
359 void SetValues( SCCOL nCol, SCROW nRow, const std::vector<double>& rVals );
360 void SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError);
361 SCSIZE GetPatternCount( SCCOL nCol ) const;
362 SCSIZE GetPatternCount( SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const;
363 bool ReservePatternCount( SCCOL nCol, SCSIZE nReserve );
365 void SetRawString( SCCOL nCol, SCROW nRow, const svl::SharedString& rStr );
366 void GetString( SCCOL nCol, SCROW nRow, OUString& rString ) const;
367 double* GetValueCell( SCCOL nCol, SCROW nRow );
368 void GetInputString( SCCOL nCol, SCROW nRow, OUString& rString ) const;
369 double GetValue( const ScAddress& rPos ) const
371 return ValidColRow(rPos.Col(),rPos.Row()) ?
372 aCol[rPos.Col()].GetValue( rPos.Row() ) :
373 0.0;
375 double GetValue( SCCOL nCol, SCROW nRow ) const;
376 const EditTextObject* GetEditText( SCCOL nCol, SCROW nRow ) const;
377 void RemoveEditTextCharAttribs( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
378 void GetFormula( SCCOL nCol, SCROW nRow, OUString& rFormula ) const;
379 const ScFormulaCell* GetFormulaCell( SCCOL nCol, SCROW nRow ) const;
380 ScFormulaCell* GetFormulaCell( SCCOL nCol, SCROW nRow );
382 CellType GetCellType( const ScAddress& rPos ) const
384 return ValidColRow(rPos.Col(),rPos.Row()) ?
385 aCol[rPos.Col()].GetCellType( rPos.Row() ) :
386 CELLTYPE_NONE;
388 CellType GetCellType( SCCOL nCol, SCROW nRow ) const;
389 ScRefCellValue GetCellValue( SCCOL nCol, SCROW nRow ) const;
391 void GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const;
392 void GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
394 ScPostIt* ReleaseNote( SCCOL nCol, SCROW nRow );
396 size_t GetNoteCount( SCCOL nCol ) const;
397 SCROW GetNotePosition( SCCOL nCol, size_t nIndex ) const;
398 void CreateAllNoteCaptions();
399 void ForgetNoteCaptions( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
401 void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
402 void GetNotesInRange( const ScRange& rRange, std::vector<sc::NoteEntry>& rNotes ) const;
403 bool ContainsNotesInRange( const ScRange& rRange ) const;
405 bool TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize ) const;
406 void InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize );
407 void DeleteRow(
408 const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize,
409 bool* pUndoOutline = NULL, std::vector<ScAddress>* pGroupPos = NULL );
411 bool TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) const;
412 void InsertCol(
413 const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
414 void DeleteCol(
415 const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize, bool* pUndoOutline = NULL );
417 void DeleteArea(
418 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, InsertDeleteFlags nDelFlag,
419 bool bBroadcast = true, sc::ColumnSpanSet* pBroadcastSpans = NULL );
421 void CopyToClip( sc::CopyToClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable );
422 void CopyToClip( sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable );
424 void CopyStaticToDocument(
425 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const SvNumberFormatterMergeMap& rMap,
426 ScTable* pDestTab );
428 void CopyCellToDocument( SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, SCROW nDestRow, ScTable& rDestTab );
430 bool InitColumnBlockPosition( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol );
432 void DeleteBeforeCopyFromClip(
433 sc::CopyFromClipContext& rCxt, const ScTable& rClipTab, sc::ColumnSpanSet& rBroadcastSpans );
435 void CopyOneCellFromClip(
436 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
438 void CopyFromClip(
439 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
440 SCsCOL nDx, SCsROW nDy, ScTable* pTable );
442 void StartListeningFormulaCells(
443 sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt,
444 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
446 void EndListeningFormulaCells(
447 sc::EndListeningContext& rEndCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
449 void SetDirtyFromClip(
450 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sc::ColumnSpanSet& rBroadcastSpans );
452 void CopyToTable(
453 sc::CopyToDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
454 InsertDeleteFlags nFlags, bool bMarked, ScTable* pDestTab,
455 const ScMarkData* pMarkData = NULL, bool bAsLink = false, bool bColRowFlags = true );
457 void UndoToTable(
458 sc::CopyToDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
459 InsertDeleteFlags nFlags, bool bMarked, ScTable* pDestTab, const ScMarkData* pMarkData = NULL );
461 void CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
462 SCsCOL nDx, SCsROW nDy, ScTable* pTable);
463 void TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
464 ScTable* pTransClip, InsertDeleteFlags nFlags, bool bAsLink );
466 // mark of this document
467 void MixMarked(
468 sc::MixDocContext& rCxt, const ScMarkData& rMark, sal_uInt16 nFunction,
469 bool bSkipEmpty, const ScTable* pSrcTab );
471 void MixData(
472 sc::MixDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
473 sal_uInt16 nFunction, bool bSkipEmpty, const ScTable* pSrcTab );
475 void CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
476 SCCOL nDestCol, SCROW nDestRow, SCTAB nDestTab );
478 void CopyScenarioFrom( const ScTable* pSrcTab );
479 void CopyScenarioTo( ScTable* pDestTab ) const;
480 bool TestCopyScenarioTo( const ScTable* pDestTab ) const;
481 void MarkScenarioIn( ScMarkData& rMark, sal_uInt16 nNeededBits ) const;
482 bool HasScenarioRange( const ScRange& rRange ) const;
483 void InvalidateScenarioRanges();
484 const ScRangeList* GetScenarioRanges() const;
486 void CopyUpdated( const ScTable* pPosTab, ScTable* pDestTab ) const;
488 void InvalidateTableArea();
489 void InvalidatePageBreaks();
491 bool GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const; // FALSE = empty
492 bool GetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const;
493 bool GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes, bool bFullFormattedArea = false ) const;
494 bool GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
495 SCCOL& rEndCol, bool bNotes ) const;
496 bool GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
497 SCROW& rEndRow, bool bNotes ) const;
499 bool GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const;
501 void ExtendPrintArea( OutputDevice* pDev,
502 SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow );
504 void GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
505 bool bIncludeOld, bool bOnlyDown ) const;
507 bool ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
508 SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly,
509 bool bStickyTopRow, bool bStickyLeftCol ) const;
511 SCROW GetLastDataRow( SCCOL nCol1, SCCOL nCol2, SCROW nLastRow ) const;
513 SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
514 SCCOL nEndCol, SCROW nEndRow, ScDirection eDir ) const;
516 void FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection ) const;
517 void GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY,
518 bool bMarked, bool bUnprotected, const ScMarkData& rMark ) const;
520 void LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
522 bool HasData( SCCOL nCol, SCROW nRow ) const;
523 bool HasStringData( SCCOL nCol, SCROW nRow ) const;
524 bool HasValueData( SCCOL nCol, SCROW nRow ) const;
525 bool HasStringCells( SCCOL nStartCol, SCROW nStartRow,
526 SCCOL nEndCol, SCROW nEndRow ) const;
528 sal_uInt16 GetErrCode( const ScAddress& rPos ) const
530 return ValidColRow(rPos.Col(),rPos.Row()) ?
531 aCol[rPos.Col()].GetErrCode( rPos.Row() ) :
535 void ResetChanged( const ScRange& rRange );
537 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
538 void SetDirty( const ScRange&, ScColumn::BroadcastMode );
539 void SetDirtyAfterLoad();
540 void SetDirtyVar();
541 void SetTableOpDirty( const ScRange& );
542 void CalcAll();
543 void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening );
544 void CompileAll( sc::CompileFormulaContext& rCxt );
545 void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress );
547 /** Broadcast single broadcasters in range, without explicitly setting
548 anything dirty, not doing area broadcasts.
549 @param rHint address is modified to adapt to the actual broadcasted
550 position on each iteration and upon return points to the last
551 position broadcasted. */
552 bool BroadcastBroadcasters( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScHint& rHint );
554 bool CompileErrorCells( sc::CompileFormulaContext& rCxt, sal_uInt16 nErrCode );
556 void UpdateReference(
557 sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = NULL,
558 bool bIncludeDraw = true, bool bUpdateNoteCaptionPos = true );
560 void UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
561 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
562 SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bUpdateNoteCaptionPos = true );
564 void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
565 ScDocument* pUndoDoc );
567 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
569 void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt );
570 void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt );
571 void UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTabNo, ScProgress* pProgress );
572 void UpdateCompile( bool bForceIfNameInUse = false );
573 void SetTabNo(SCTAB nNewTab);
574 void FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
575 std::set<sal_uInt16>& rIndexes) const;
576 void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
577 sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
578 double nStepValue, double nMaxValue, ScProgress* pProgress);
579 OUString GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
581 void UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData& rMark );
583 void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
584 sal_uInt16 nFormatNo );
585 void GetAutoFormatData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData& rData);
586 void ScReplaceTabsStr( OUString& rStr, const OUString& rSrch, const OUString& rRepl ); // from sw
587 bool SearchAndReplace(
588 const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark,
589 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
591 void FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2 );
593 void GetBorderLines( SCCOL nCol, SCROW nRow,
594 const ::editeng::SvxBorderLine** ppLeft, const ::editeng::SvxBorderLine** ppTop,
595 const ::editeng::SvxBorderLine** ppRight, const ::editeng::SvxBorderLine** ppBottom ) const;
597 bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nMask ) const;
598 bool HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
599 bool IsMerged( SCCOL nCol, SCROW nRow ) const;
600 bool ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
601 SCCOL& rEndCol, SCROW& rEndRow,
602 bool bRefresh );
603 const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const;
604 const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow ) const;
605 const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
607 sal_uInt32 GetNumberFormat( const ScAddress& rPos ) const;
608 sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
609 sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
611 void SetNumberFormat( SCCOL nCol, SCROW nRow, sal_uInt32 nNumberFormat );
613 void MergeSelectionPattern( ScMergePatternState& rState,
614 const ScMarkData& rMark, bool bDeep ) const;
615 void MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1,
616 SCCOL nCol2, SCROW nRow2, bool bDeep ) const;
617 void MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
618 ScLineFlags& rFlags,
619 SCCOL nStartCol, SCROW nStartRow,
620 SCCOL nEndCol, SCROW nEndRow ) const;
621 void ApplyBlockFrame( const SvxBoxItem* pLineOuter,
622 const SvxBoxInfoItem* pLineInner,
623 SCCOL nStartCol, SCROW nStartRow,
624 SCCOL nEndCol, SCROW nEndRow );
626 void ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
627 void ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
628 void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
629 const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = NULL );
631 void SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, bool bPutToPool = false )
633 if (ValidColRow(rPos.Col(),rPos.Row()))
634 aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool );
636 void SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, bool bPutToPool = false );
637 void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
638 const ScPatternAttr& rPattern, short nNewType );
639 void AddCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
640 void RemoveCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
642 void ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet& rStyle );
643 void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet& rStyle );
644 void ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
645 void ApplySelectionLineStyle( const ScMarkData& rMark,
646 const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
648 const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow ) const;
649 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const;
650 const ScStyleSheet* GetAreaStyle( bool& rFound, SCCOL nCol1, SCROW nRow1,
651 SCCOL nCol2, SCROW nRow2 ) const;
653 void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRemoved,
654 OutputDevice* pDev,
655 double nPPTX, double nPPTY,
656 const Fraction& rZoomX, const Fraction& rZoomY );
658 bool IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const;
660 bool ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
661 bool RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
663 void ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
664 void DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast = true );
666 void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
667 void ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
669 const ScRange* GetRepeatColRange() const { return pRepeatColRange; }
670 const ScRange* GetRepeatRowRange() const { return pRepeatRowRange; }
671 void SetRepeatColRange( const ScRange* pNew );
672 void SetRepeatRowRange( const ScRange* pNew );
674 sal_uInt16 GetPrintRangeCount() const { return static_cast< sal_uInt16 >( aPrintRanges.size() ); }
675 const ScRange* GetPrintRange(sal_uInt16 nPos) const;
676 /** Returns true, if the sheet is always printed. */
677 bool IsPrintEntireSheet() const { return bPrintEntireSheet; }
679 /** Removes all print ranges. */
680 void ClearPrintRanges();
681 /** Adds a new print ranges. */
682 void AddPrintRange( const ScRange& rNew );
683 /** Marks the specified sheet to be printed completely. Deletes old print ranges! */
684 void SetPrintEntireSheet();
686 void FillPrintSaver( ScPrintSaverTab& rSaveTab ) const;
687 void RestorePrintRanges( const ScPrintSaverTab& rSaveTab );
689 sal_uInt16 GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
690 double nPPTX, double nPPTY,
691 const Fraction& rZoomX, const Fraction& rZoomY,
692 bool bFormula, const ScMarkData* pMarkData,
693 const ScColWidthParam* pParam );
694 bool SetOptimalHeight(
695 sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow,
696 ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 );
698 void SetOptimalHeightOnly(
699 sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow,
700 ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 );
702 long GetNeededSize( SCCOL nCol, SCROW nRow,
703 OutputDevice* pDev,
704 double nPPTX, double nPPTY,
705 const Fraction& rZoomX, const Fraction& rZoomY,
706 bool bWidth, bool bTotalSize );
707 void SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth );
708 void SetColWidthOnly( SCCOL nCol, sal_uInt16 nNewWidth );
709 void SetRowHeight( SCROW nRow, sal_uInt16 nNewHeight );
710 bool SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight,
711 double nPPTX, double nPPTY );
714 * Set specified row height to specified ranges. Don't check for drawing
715 * objects etc. Just set the row height. Nothing else.
717 * Note that setting a new row height via this function will not
718 * invalidate page breaks.
720 void SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight );
722 // nPPT to test for modification
723 void SetManualHeight( SCROW nStartRow, SCROW nEndRow, bool bManual );
725 sal_uInt16 GetColWidth( SCCOL nCol, bool bHiddenAsZero = true ) const;
726 sal_uLong GetColWidth( SCCOL nStartCol, SCCOL nEndCol, bool bHiddenAsZero = true ) const;
727 SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true ) const;
728 sal_uLong GetRowHeight( SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero = true ) const;
729 sal_uLong GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const;
730 sal_uLong GetColOffset( SCCOL nCol, bool bHiddenAsZero = true ) const;
731 sal_uLong GetRowOffset( SCROW nRow, bool bHiddenAsZero = true ) const;
734 * Get the last row such that the height of row 0 to the end row is as
735 * high as possible without exceeding the specified height value.
737 * @param nHeight maximum desired height
739 * @return SCROW last row of the range within specified height.
741 SCROW GetRowForHeight(sal_uLong nHeight) const;
743 sal_uInt16 GetOriginalWidth( SCCOL nCol ) const;
744 sal_uInt16 GetOriginalHeight( SCROW nRow ) const;
746 sal_uInt16 GetCommonWidth( SCCOL nEndCol ) const;
748 SCROW GetHiddenRowCount( SCROW nRow ) const;
750 void ShowCol(SCCOL nCol, bool bShow);
751 void ShowRow(SCROW nRow, bool bShow);
752 void DBShowRow(SCROW nRow, bool bShow);
754 void ShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
755 void DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
757 void SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags );
758 void SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags );
760 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
761 SCROW GetLastFlaggedRow() const;
763 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
764 SCCOL GetLastChangedCol() const;
765 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
766 SCROW GetLastChangedRow() const;
768 bool IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const;
769 bool IsDataFiltered(const ScRange& rRange) const;
770 sal_uInt8 GetColFlags( SCCOL nCol ) const;
771 sal_uInt8 GetRowFlags( SCROW nRow ) const;
773 const ScBitMaskCompressedArray< SCROW, sal_uInt8> * GetRowFlagsArray() const
774 { return pRowFlags; }
776 bool UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, bool bShow );
777 bool UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, bool bShow );
779 void UpdatePageBreaks( const ScRange* pUserArea );
780 void RemoveManualBreaks();
781 bool HasManualBreaks() const;
782 void SetRowManualBreaks( const ::std::set<SCROW>& rBreaks );
783 void SetColManualBreaks( const ::std::set<SCCOL>& rBreaks );
785 void GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const;
786 void GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const;
787 bool HasRowPageBreak(SCROW nRow) const;
788 bool HasColPageBreak(SCCOL nCol) const;
789 bool HasRowManualBreak(SCROW nRow) const;
790 bool HasColManualBreak(SCCOL nCol) const;
793 * Get the row position of the next manual break that occurs at or below
794 * specified row. When no more manual breaks are present at or below
795 * the specified row, -1 is returned.
797 * @param nRow row at which the search begins.
799 * @return SCROW next row position with manual page break, or -1 if no
800 * more manual breaks are present.
802 SCROW GetNextManualBreak(SCROW nRow) const;
804 void RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow);
805 void RemoveRowBreak(SCROW nRow, bool bPage, bool bManual);
806 void RemoveColBreak(SCCOL nCol, bool bPage, bool bManual);
807 void SetRowBreak(SCROW nRow, bool bPage, bool bManual);
808 void SetColBreak(SCCOL nCol, bool bPage, bool bManual);
809 ::com::sun::star::uno::Sequence<
810 ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const;
812 bool RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
813 bool RowHiddenLeaf(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
814 bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
815 bool ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
816 bool SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
817 bool SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden);
818 void CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
819 void CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
820 void CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset);
821 SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
822 SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
823 SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
824 sal_uInt32 GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero = true) const;
826 SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol) const;
828 bool RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
829 bool ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
830 bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
831 void CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
832 void CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
833 void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered);
834 void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered);
835 SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
836 SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
837 SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
839 bool IsManualRowHeight(SCROW nRow) const;
841 bool HasUniformRowHeight( SCROW nRow1, SCROW nRow2 ) const;
843 void SyncColRowFlags();
845 void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
846 void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
848 /** Sort a range of data. */
849 void Sort(
850 const ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs,
851 ScProgress* pProgress, sc::ReorderParam* pUndo );
853 void Reorder( const sc::ReorderParam& rParam, ScProgress* pProgress );
855 bool ValidQuery(
856 SCROW nRow, const ScQueryParam& rQueryParam, ScRefCellValue* pCell = NULL,
857 bool* pbTestEqualCondition = NULL);
858 void TopTenQuery( ScQueryParam& );
859 SCSIZE Query(ScQueryParam& rQueryParam, bool bKeepSub);
860 bool CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
862 void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
863 void GetFilteredFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, std::vector<ScTypedStrData>& rStrings, bool& rHasDates );
864 bool GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit);
866 bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
867 bool HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
869 sal_Int32 GetMaxStringLen( SCCOL nCol,
870 SCROW nRowStart, SCROW nRowEnd, rtl_TextEncoding eCharSet ) const;
871 sal_Int32 GetMaxNumberStringLen( sal_uInt16& nPrecision,
872 SCCOL nCol,
873 SCROW nRowStart, SCROW nRowEnd ) const;
875 bool IsSortCollatorGlobal() const;
876 void InitSortCollator( const ScSortParam& rPar );
877 void DestroySortCollator();
878 void SetDrawPageSize( bool bResetStreamValid = true, bool bUpdateNoteCaptionPos = true );
880 void SetRangeName(ScRangeName* pNew);
881 ScRangeName* GetRangeName() const;
883 void PreprocessRangeNameUpdate(
884 sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
886 void CompileHybridFormula(
887 sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt );
889 void PreprocessDBDataUpdate(
890 sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
892 ScConditionalFormatList* GetCondFormList();
893 const ScConditionalFormatList* GetCondFormList() const;
894 void SetCondFormList( ScConditionalFormatList* pList );
896 void DeleteConditionalFormat(sal_uLong nOldIndex);
898 sal_uLong AddCondFormat( ScConditionalFormat* pNew );
900 SvtScriptType GetScriptType( SCCOL nCol, SCROW nRow ) const;
901 void SetScriptType( SCCOL nCol, SCROW nRow, SvtScriptType nType );
902 void UpdateScriptTypes( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
904 SvtScriptType GetRangeScriptType( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 );
906 size_t GetFormulaHash( SCCOL nCol, SCROW nRow ) const;
908 ScFormulaVectorState GetFormulaVectorState( SCCOL nCol, SCROW nRow ) const;
909 formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol, SCROW nRow );
910 formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
911 formula::VectorRefArray FetchVectorRefArray( SCCOL nCol, SCROW nRow1, SCROW nRow2 );
913 void SplitFormulaGroups( SCCOL nCol, std::vector<SCROW>& rRows );
914 void UnshareFormulaCells( SCCOL nCol, std::vector<SCROW>& rRows );
915 void RegroupFormulaCells( SCCOL nCol );
917 ScRefCellValue GetRefCellValue( SCCOL nCol, SCROW nRow );
919 SvtBroadcaster* GetBroadcaster( SCCOL nCol, SCROW nRow );
920 const SvtBroadcaster* GetBroadcaster( SCCOL nCol, SCROW nRow ) const;
921 void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 );
922 bool HasBroadcaster( SCCOL nCol ) const;
924 void FillMatrix( ScMatrix& rMat, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
926 void InterpretDirtyCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
928 void SetFormulaResults( SCCOL nCol, SCROW nRow, const double* pResults, size_t nLen );
929 void SetFormulaResults( SCCOL nCol, SCROW nRow, const formula::FormulaTokenRef* pResults, size_t nLen );
932 * Either start all formula cells as listeners unconditionally, or start
933 * those that are marked "needs listening".
935 * @param rCxt context object.
936 * @param bAll when true, start all formula cells as listeners. When
937 * false, only start those that are marked "needs listening".
939 void StartListeners( sc::StartListeningContext& rCxt, bool bAll );
942 * Mark formula cells dirty that have the mbPostponedDirty flag set or
943 * contain named ranges with relative references.
945 void SetDirtyIfPostponed();
948 * Broadcast dirty formula cells that contain functions such as CELL(),
949 * COLUMN() or ROW() which may change its value on move.
951 void BroadcastRecalcOnRefMove();
953 void CollectListeners( std::vector<SvtListener*>& rListeners, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
955 void TransferListeners(
956 ScTable& rDestTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
957 SCCOL nColDelta, SCROW nRowDelta );
959 void TransferCellValuesTo( SCCOL nCol, SCROW nRow, size_t nLen, sc::CellValues& rDest );
960 void CopyCellValuesFrom( SCCOL nCol, SCROW nRow, const sc::CellValues& rSrc );
962 void ConvertFormulaToValue(
963 sc::EndListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
964 sc::TableValues* pUndo );
966 void SwapNonEmpty(
967 sc::TableValues& rValues, sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt );
969 #if DEBUG_COLUMN_STORAGE
970 void DumpFormulaGroups( SCCOL nCol ) const;
971 #endif
973 /** Replace behaves differently to the Search; adjust the rCol and rRow accordingly.
975 'Replace' replaces at the 'current' position, but in order to achieve
976 that, we have to 'shift' the rCol / rRow to the 'previous' position -
977 what it is depends on various settings in rSearchItem.
979 static void UpdateSearchItemAddressForReplace( const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow );
981 private:
983 void FillFormulaVertical(
984 const ScFormulaCell& rSrcCell,
985 SCCOLROW& rInner, SCCOL nCol, SCROW nRow1, SCROW nRow2,
986 ScProgress* pProgress, sal_uLong& rProgress );
988 void FillSeriesSimple(
989 ScCellValue& rSrcCell, SCCOLROW& rInner, SCCOLROW nIMin, SCCOLROW nIMax,
990 SCCOLROW& rCol, SCCOLROW& rRow, bool bVertical, ScProgress* pProgress, sal_uLong& rProgress );
992 void FillAutoSimple(
993 SCCOLROW nISrcStart, SCCOLROW nISrcEnd, SCCOLROW nIStart, SCCOLROW nIEnd,
994 SCCOLROW& rInner, SCCOLROW& rCol, SCCOLROW& rRow,
995 sal_uLong nActFormCnt, sal_uLong nMaxFormCnt,
996 bool bHasFiltered, bool bVertical, bool bPositive,
997 ScProgress* pProgress, sal_uLong& rProgress );
999 void FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1000 sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd,
1001 FillDateCmd eFillDateCmd,
1002 double nStepValue, double nMaxValue, sal_uInt16 nMinDigits,
1003 bool bAttribs, ScProgress* pProgress );
1004 void FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1005 FillCmd& rCmd, FillDateCmd& rDateCmd,
1006 double& rInc, sal_uInt16& rMinDigits,
1007 ScUserListData*& rListData, sal_uInt16& rListIndex);
1008 void FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1009 sal_uLong nFillCount, FillDir eFillDir, ScProgress* pProgress );
1011 bool ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
1012 bool bMarked, bool bUnprotected ) const;
1014 void AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1015 const ScPatternAttr& rAttr, sal_uInt16 nFormatNo);
1016 void GetAutoFormatAttr(SCCOL nCol, SCROW nRow, sal_uInt16 nIndex, ScAutoFormatData& rData);
1017 void GetAutoFormatFrame(SCCOL nCol, SCROW nRow, sal_uInt16 nFlags, sal_uInt16 nIndex, ScAutoFormatData& rData);
1018 bool SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRow,
1019 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
1020 bool Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1021 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
1022 bool Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1023 const SCCOL& nLastCol, const SCROW& nLastRow,
1024 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
1025 bool SearchAll(const SvxSearchItem& rSearchItem, const ScMarkData& rMark,
1026 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
1027 bool Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1028 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
1029 bool ReplaceAll(
1030 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
1031 OUString& rUndoStr, ScDocument* pUndoDoc);
1033 bool SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1034 const ScMarkData& rMark);
1035 bool ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1036 const ScMarkData& rMark, bool bIsUndo);
1037 bool SearchAllStyle(
1038 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges);
1039 bool ReplaceAllStyle(
1040 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
1041 ScDocument* pUndoDoc);
1042 bool SearchAndReplaceEmptyCells(
1043 const SvxSearchItem& rSearchItem,
1044 SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
1045 OUString& rUndoStr, ScDocument* pUndoDoc);
1046 bool SearchRangeForEmptyCell(const ScRange& rRange,
1047 const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1048 OUString& rUndoStr);
1049 bool SearchRangeForAllEmptyCells(
1050 const ScRange& rRange, const SvxSearchItem& rSearchItem,
1051 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
1053 // use the global sort parameter:
1054 bool IsSorted(SCCOLROW nStart, SCCOLROW nEnd) const;
1055 static void DecoladeRow( ScSortInfoArray*, SCROW nRow1, SCROW nRow2 );
1056 short CompareCell(
1057 sal_uInt16 nSort,
1058 ScRefCellValue& rCell1, SCCOL nCell1Col, SCROW nCell1Row,
1059 ScRefCellValue& rCell2, SCCOL nCell2Col, SCROW nCell2Row ) const;
1060 short Compare(SCCOLROW nIndex1, SCCOLROW nIndex2) const;
1061 short Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2) const;
1062 ScSortInfoArray* CreateSortInfoArray( const sc::ReorderParam& rParam );
1063 ScSortInfoArray* CreateSortInfoArray(
1064 const ScSortParam& rSortParam, SCCOLROW nInd1, SCCOLROW nInd2,
1065 bool bKeepQuery, bool bUpdateRefs );
1066 void QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi);
1067 void SortReorderByColumn( ScSortInfoArray* pArray, SCROW nRow1, SCROW nRow2, bool bPattern, ScProgress* pProgress );
1069 void SortReorderByRow( ScSortInfoArray* pArray, SCCOL nCol1, SCCOL nCol2, ScProgress* pProgress );
1070 void SortReorderByRowRefUpdate( ScSortInfoArray* pArray, SCCOL nCol1, SCCOL nCol2, ScProgress* pProgress );
1072 bool CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
1073 bool CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
1074 void GetUpperCellString(SCCOL nCol, SCROW nRow, OUString& rStr);
1076 bool RefVisible(ScFormulaCell* pCell);
1078 bool IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol) const;
1080 void IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillDateCmd eCmd);
1081 void FillFormula(
1082 ScFormulaCell* pSrcCell, SCCOL nDestCol, SCROW nDestRow, bool bLast );
1083 void UpdateInsertTabAbs(SCTAB nNewPos);
1084 bool GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel,
1085 const ScMarkData& rMark) const;
1086 bool GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ) const;
1087 bool TestTabRefAbs(SCTAB nTable) const;
1088 void CompileDBFormula( sc::CompileFormulaContext& rCxt );
1089 void CompileColRowNameFormula( sc::CompileFormulaContext& rCxt );
1091 void StartListening( const ScAddress& rAddress, SvtListener* pListener );
1092 void EndListening( const ScAddress& rAddress, SvtListener* pListener );
1093 void StartListening( sc::StartListeningContext& rCxt, SCCOL nCol, SCROW nRow, SvtListener& rListener );
1094 void EndListening( sc::EndListeningContext& rCxt, SCCOL nCol, SCROW nRow, SvtListener& rListener );
1096 void AttachFormulaCells( sc::StartListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
1097 void DetachFormulaCells( sc::EndListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
1099 void SetLoadingMedium(bool bLoading);
1101 SCSIZE FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2,
1102 SCCOL nCol, SCROW nAttrRow1, SCROW nAttrRow2, SCSIZE nArrY,
1103 const ScPatternAttr* pPattern, const SfxItemSet* pCondSet );
1105 // idle calculation of OutputDevice text width for cell
1106 // also invalidates script type, broadcasts for "calc as shown"
1107 void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
1108 bool bNumFormatChanged, bool bBroadcast );
1110 void SkipFilteredRows(SCROW& rRow, SCROW& rLastNonFilteredRow, bool bForward);
1113 * In case the cell text goes beyond the column width, move the max column
1114 * position to the right. This is called from ExtendPrintArea.
1116 void MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY);
1118 void CopyPrintRange(const ScTable& rTable);
1120 SCCOL FindNextVisibleColWithContent(SCCOL nCol, bool bRight, SCROW nRow) const;
1122 SCCOL FindNextVisibleCol(SCCOL nCol, bool bRight) const;
1124 // Clipboard transpose for notes
1125 void TransposeColNotes(ScTable* pTransClip, SCCOL nCol1, SCCOL nCol, SCROW nRow1, SCROW nRow2);
1127 ScColumn* FetchColumn( SCCOL nCol );
1128 const ScColumn* FetchColumn( SCCOL nCol ) const;
1130 void EndListeningIntersectedGroup(
1131 sc::EndListeningContext& rCxt, SCCOL nCol, SCROW nRow, std::vector<ScAddress>* pGroupPos = NULL );
1133 void EndListeningIntersectedGroups(
1134 sc::EndListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1135 std::vector<ScAddress>* pGroupPos = NULL );
1137 void EndListeningGroup( sc::EndListeningContext& rCxt, SCCOL nCol, SCROW nRow );
1138 void SetNeedsListeningGroup( SCCOL nCol, SCROW nRow );
1141 * Use this to iterate through non-empty visible cells in a single column.
1143 class VisibleDataCellIterator
1145 public:
1146 static SCROW ROW_NOT_FOUND;
1148 explicit VisibleDataCellIterator(ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn);
1149 ~VisibleDataCellIterator();
1152 * Set the start row position. In case there is not visible data cell
1153 * at the specified row position, it will move to the position of the
1154 * first visible data cell below that point.
1156 * @return First visible data cell if found, or NULL otherwise.
1158 ScRefCellValue reset(SCROW nRow);
1161 * Find the next visible data cell position.
1163 * @return Next visible data cell if found, or NULL otherwise.
1165 ScRefCellValue next();
1168 * Get the current row position.
1170 * @return Current row position, or ROW_NOT_FOUND if the iterator
1171 * doesn't point to a valid data cell position.
1173 SCROW getRow() const { return mnCurRow;}
1175 private:
1176 ScFlatBoolRowSegments& mrRowSegs;
1177 ScColumn& mrColumn;
1178 ScRefCellValue maCell;
1179 SCROW mnCurRow;
1180 SCROW mnUBound;
1185 #endif
1187 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */