Drop unneeded indirection and unused argument
[LibreOffice.git] / sc / inc / column.hxx
blob22e3ad1e284cf159e67e675c225524cd676f3c1f
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 #pragma once
22 #include "global.hxx"
23 #include "address.hxx"
24 #include "cellvalue.hxx"
25 #include "columnspanset.hxx"
26 #include "rangelst.hxx"
27 #include "types.hxx"
28 #include "mtvelements.hxx"
29 #include "attarray.hxx"
30 #include <formula/types.hxx>
31 #include <svl/zforlist.hxx>
32 #include <svx/svdobj.hxx>
34 #include <optional>
35 #include <set>
36 #include <vector>
38 #include <mdds/flat_segment_tree.hpp>
40 namespace editeng { class SvxBorderLine; }
41 namespace formula { struct VectorRefArray; }
43 namespace sc {
45 struct BroadcasterState;
46 struct FormulaGroupEntry;
47 class StartListeningContext;
48 class EndListeningContext;
49 class CopyFromClipContext;
50 class CopyToClipContext;
51 class CopyToDocContext;
52 class MixDocContext;
53 struct RefUpdateContext;
54 struct RefUpdateInsertTabContext;
55 struct RefUpdateDeleteTabContext;
56 struct RefUpdateMoveTabContext;
57 class EditTextIterator;
58 struct NoteEntry;
59 class DocumentStreamAccess;
60 class CellValues;
61 class TableValues;
62 struct RowSpan;
63 class RowHeightContext;
64 class CompileFormulaContext;
65 struct SetFormulaDirtyContext;
66 enum class MatrixEdge;
67 class ColumnIterator;
68 class Sparkline;
72 class Fraction;
73 class OutputDevice;
74 class ScItemPoolCache;
75 class SvtListener;
76 class SfxPoolItem;
77 class SfxStyleSheetBase;
78 class SvxBoxInfoItem;
79 class SvxBoxItem;
81 class ScDocument;
82 class ScEditDataArray;
83 class ScFormulaCell;
84 class ScMarkData;
85 class ScPatternAttr;
86 class ScStyleSheet;
87 class SvtBroadcaster;
88 class ScTypedStrData;
89 class ScProgress;
90 class ScFunctionData;
91 class ScFlatBoolRowSegments;
92 struct ScSetStringParam;
93 struct ScColWidthParam;
94 struct ScRefCellValue;
95 struct ScCellValue;
96 class ScHint;
97 enum class ScMF;
98 struct ScFilterEntries;
99 struct ScInterpreterContext;
101 struct ScNeededSizeOptions
103 CellAttributeHolder aPattern;
105 bool bFormula;
106 bool bSkipMerged;
107 bool bGetFont;
108 bool bTotalSize;
110 ScNeededSizeOptions();
113 // A shared implementation of some column code and data.
114 // This is used by ScColumn, but also by ScTable for the unallocated
115 // columns (one instance that is the default for all not-yet allocated columns).
116 class ScColumnData
118 protected:
119 std::unique_ptr<ScAttrArray> pAttrArray;
121 ScColumnData(const ScColumnData&) = delete;
122 ScColumnData& operator= (const ScColumnData&) = delete;
124 public:
125 ScColumnData() = default;
126 void InitAttrArray(ScAttrArray* attrArray) { pAttrArray.reset(attrArray); }
128 ScDocument& GetDoc() const { return pAttrArray->GetDoc(); }
130 ScAttrArray& AttrArray() { return *pAttrArray; }
131 const ScAttrArray& AttrArray() const { return *pAttrArray; }
133 const SfxPoolItem& GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
134 template<class T> const T& GetAttr( SCROW nRow, TypedWhichId<T> nWhich ) const
136 return static_cast<const T&>(GetAttr(nRow, sal_uInt16(nWhich)));
138 const SfxPoolItem& GetAttr( SCROW nRow, sal_uInt16 nWhich, SCROW& nStartRow, SCROW& nEndRow ) const;
139 template<class T> const T& GetAttr( SCROW nRow, TypedWhichId<T> nWhich, SCROW& nStartRow, SCROW& nEndRow ) const
141 return static_cast<const T&>(GetAttr(nRow, sal_uInt16(nWhich), nStartRow, nEndRow));
144 void SetAttrEntries(std::vector<ScAttrEntry> && vNewData);
146 const ScPatternAttr* GetPattern( SCROW nRow ) const;
147 const ScPatternAttr* GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const;
148 void ApplySelectionStyle(const ScStyleSheet& rStyle, SCROW nTop, SCROW nBottom);
149 void ApplySelectionCache(ScItemPoolCache& rCache, SCROW nStartRow, SCROW nEndRow,
150 ScEditDataArray* pDataArray, bool* pIsChanged);
151 void ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr,
152 ScEditDataArray* pDataArray = nullptr,
153 bool* const pIsChanged = nullptr);
154 void MergePatternArea( ScMergePatternState& rState, SCROW nRow1, SCROW nRow2, bool bDeep ) const;
156 sal_uInt32 GetNumberFormat( const ScInterpreterContext& rContext, SCROW nRow ) const;
157 sal_uInt32 GetNumberFormat( SCROW nStartRow, SCROW nEndRow ) const;
159 /// Including current, may return -1
160 SCROW GetNextUnprotected( SCROW nRow, bool bUp ) const;
162 const ScStyleSheet* GetStyle( SCROW nRow ) const;
163 void ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle );
165 bool HasAttrib( SCROW nRow1, SCROW nRow2, HasAttrFlags nMask ) const;
166 bool HasAttrib( SCROW nRow, HasAttrFlags nMask, SCROW* nStartRow = nullptr, SCROW* nEndRow = nullptr ) const;
168 ScAttrIterator CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) const;
170 bool IsAllAttrEqual( const ScColumnData& rCol, SCROW nStartRow, SCROW nEndRow ) const;
172 void ClearSelectionItems(const sal_uInt16* pWhich, SCROW nStartRow, SCROW nEndRow);
173 void ChangeSelectionIndent(bool bIncrement, SCROW nStartRow, SCROW nEndRow);
175 bool TestInsertRow( SCSIZE nSize ) const;
176 void InsertRow( SCROW nStartRow, SCSIZE nSize );
177 void DeleteRow( SCROW nStartRow, SCSIZE nSize );
179 // Applies a function to the selected ranges.
180 // The function looks like
181 // ApplyDataFunc(ScColumnData& applyTo, SCROW nTop, SCROW nBottom)
182 template <typename ApplyDataFunc> void Apply(const ScMarkData&, SCCOL, ApplyDataFunc);
185 // Use protected inheritance to prevent publishing some internal ScColumnData
186 // functions as part of ScColumn. If they should be public in ScColumn,
187 // use 'using' to make them public.
188 class ScColumn : protected ScColumnData
190 // Empty values correspond with empty cells. All non-empty cell positions
191 // must have non-empty elements. For text width, the value should be
192 // either the real text width, or TEXTWIDTH_DIRTY in case it hasn't been
193 // calculated yet. For script type, it should be either the real script
194 // type value or SvtScriptType::UNKNOWN.
195 sc::CellTextAttrStoreType maCellTextAttrs;
197 // Cell notes
198 sc::CellNoteStoreType maCellNotes;
200 // Broadcasters for formula cells.
201 sc::BroadcasterStoreType maBroadcasters;
203 // Cell values.
204 sc::CellStoreType maCells;
206 // Sparklines
207 sc::SparklineStoreType maSparklines;
209 sal_uInt32 mnBlkCountFormula;
210 sal_uInt32 mnBlkCountCellNotes;
212 SCCOL nCol;
213 SCTAB nTab;
215 bool mbEmptyBroadcastersPending : 1; // a broadcaster not removed during EnableDelayDeletingBroadcasters()
217 friend class ScDocument; // for FillInfo
218 friend class ScTable;
219 friend class ScValueIterator;
220 friend class ScHorizontalValueIterator;
221 friend class ScDBQueryDataIterator;
222 template< ScQueryCellIteratorAccess accessType, ScQueryCellIteratorType queryType >
223 friend class ScQueryCellIteratorBase;
224 template< ScQueryCellIteratorAccess accessType >
225 friend class ScQueryCellIteratorAccessSpecific;
226 friend class ScFormulaGroupIterator;
227 friend class ScCellIterator;
228 friend class ScHorizontalCellIterator;
229 friend class ScColumnTextWidthIterator;
230 friend class ScDocumentImport;
231 friend class sc::DocumentStreamAccess;
232 friend class sc::SingleColumnSpanSet;
233 friend class sc::ColumnSpanSet;
234 friend class sc::EditTextIterator;
235 friend class sc::CellValues;
236 friend class sc::TableValues;
237 friend class sc::CellStoreEvent;
239 bool ParseString(
240 ScCellValue& rCell,
241 SCROW nRow, SCTAB nTab, const OUString& rString, formula::FormulaGrammar::AddressConvention eConv,
242 const ScSetStringParam* pParam );
244 void duplicateSparkline(sc::CopyFromClipContext& rContext, sc::ColumnBlockPosition* pBlockPos,
245 size_t nColOffset, size_t nDestSize, ScAddress aDestPosition);
247 public:
249 /** Broadcast mode for SetDirty(SCROW,SCROW,BroadcastMode). */
250 enum BroadcastMode
252 BROADCAST_NONE, ///< no broadcasting
253 BROADCAST_DATA_POSITIONS, ///< broadcast existing cells with position => does AreaBroadcast
254 BROADCAST_BROADCASTERS ///< broadcast only existing cell broadcasters => no AreaBroadcast of range!
257 ScColumn(ScSheetLimits const &);
258 ~ScColumn() COVERITY_NOEXCEPT_FALSE;
260 void Init(SCCOL nNewCol, SCTAB nNewTab, ScDocument& rDoc, bool bEmptyAttrArray);
262 using ScColumnData::GetDoc;
263 SCTAB GetTab() const { return nTab; }
264 SCCOL GetCol() const { return nCol; }
265 sc::CellStoreType& GetCellStore() { return maCells; }
266 const sc::CellStoreType& GetCellStore() const { return maCells; }
267 sc::CellTextAttrStoreType& GetCellAttrStore() { return maCellTextAttrs; }
268 const sc::CellTextAttrStoreType& GetCellAttrStore() const { return maCellTextAttrs; }
269 sc::CellNoteStoreType& GetCellNoteStore() { return maCellNotes; }
270 const sc::CellNoteStoreType& GetCellNoteStore() const { return maCellNotes; }
271 sc::SparklineStoreType& GetSparklineStore() { return maSparklines; }
272 const sc::SparklineStoreType& GetSparklineStore() const { return maSparklines; }
274 ScRefCellValue GetCellValue( SCROW nRow ) const;
275 ScRefCellValue GetCellValue( sc::ColumnBlockPosition& rBlockPos, SCROW nRow );
276 ScRefCellValue GetCellValue( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
277 static ScRefCellValue GetCellValue( const sc::CellStoreType::const_iterator& itPos, size_t nOffset );
279 const sc::CellTextAttr* GetCellTextAttr( SCROW nRow ) const;
280 const sc::CellTextAttr* GetCellTextAttr( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
282 void Delete( SCROW nRow );
283 void DeleteContent( SCROW nRow, bool bBroadcast = true );
284 void FreeAll();
285 void FreeNotes();
286 void Swap( ScColumn& rOther, SCROW nRow1, SCROW nRow2, bool bPattern );
288 bool HasAttribSelection( const ScMarkData& rMark, HasAttrFlags nMask ) const;
289 bool IsMerged( SCROW nRow ) const;
290 bool ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
291 SCCOL& rPaintCol, SCROW& rPaintRow,
292 bool bRefresh );
294 bool IsEmptyData() const;
295 bool IsEmptyAttr() const;
297 // data only:
298 bool IsEmptyData(SCROW nStartRow, SCROW nEndRow) const;
299 SCSIZE GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const;
300 bool HasDataAt( SCROW nRow, ScDataAreaExtras* pDataAreaExtras = nullptr ) const;
301 bool HasDataAt( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow,
302 ScDataAreaExtras* pDataAreaExtras = nullptr ) const;
303 bool HasDataAt( sc::ColumnBlockPosition& rBlockPos, SCROW nRow,
304 ScDataAreaExtras* pDataAreaExtras = nullptr );
305 void GetDataExtrasAt( SCROW nRow, ScDataAreaExtras& rDataAreaExtras ) const;
306 bool HasVisibleDataAt(SCROW nRow) const;
307 SCROW GetFirstDataPos() const;
308 SCROW GetLastDataPos() const;
309 SCROW GetLastDataPos( SCROW nLastRow, ScDataAreaExtras* pDataAreaExtras = nullptr ) const;
310 bool GetPrevDataPos(SCROW& rRow) const;
311 bool GetNextDataPos(SCROW& rRow) const;
312 bool TrimEmptyBlocks(SCROW& rRowStart, SCROW& rRowEnd) const;
313 void FindDataAreaPos(SCROW& rRow, bool bDown) const; // (without Broadcaster)
314 void FindUsed( SCROW nStartRow, SCROW nEndRow, mdds::flat_segment_tree<SCROW, bool>& rUsed ) const;
316 SCSIZE VisibleCount( SCROW nStartRow, SCROW nEndRow ) const;
317 sc::MatrixEdge GetBlockMatrixEdges(SCROW nRow1, SCROW nRow2, sc::MatrixEdge nMask, bool bNoMatrixAtAll ) const;
318 // Repeated calls to HasSelectionMatrixFragment() repeatedly call rMark.GetMarkedRanges(),
319 // which may be quite slow. For that reason first save the result of rMark.GetMarkedRanges()
320 // pass that to HasSelectionMatrixFragment() calls.
321 bool HasSelectionMatrixFragment(const ScMarkData& rMark, const ScRangeList& rRangeList) const;
323 bool GetFirstVisibleAttr( SCROW& rFirstRow ) const;
324 bool GetLastVisibleAttr( SCROW& rLastRow, bool bSkipEmpty ) const;
325 bool HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
326 bool IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const;
328 bool TestInsertCol( SCROW nStartRow, SCROW nEndRow) const;
329 bool TestInsertRow( SCROW nStartRow, SCSIZE nSize ) const;
330 void InsertRow( SCROW nStartRow, SCSIZE nSize );
331 void GetUnprotectedCells(SCROW nStartRow, SCROW nEndRow, ScRangeList& rRangeList ) const;
334 * @param nStartRow top row position
335 * @param nSize size of the segment to delete.
336 * @param pGroupPos when non-NULL, stores the top position of formula
337 * group that's been merged as a result of row deletion.
339 void DeleteRow( SCROW nStartRow, SCSIZE nSize, std::vector<ScAddress>* pGroupPos );
341 void DeleteArea(
342 SCROW nStartRow, SCROW nEndRow, InsertDeleteFlags nDelFlag,
343 bool bBroadcast = true, sc::ColumnSpanSet* pBroadcastSpans = nullptr );
345 void DeleteRanges( const std::vector<sc::RowSpan>& rRanges, InsertDeleteFlags nDelFlag );
347 void CopyToClip(
348 sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn ) const;
350 void CopyStaticToDocument(
351 SCROW nRow1, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScColumn& rDestCol );
353 void CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol );
354 void InitBlockPosition( sc::ColumnBlockPosition& rBlockPos );
355 void InitBlockPosition( sc::ColumnBlockConstPosition& rBlockPos ) const;
357 void DeleteBeforeCopyFromClip(
358 sc::CopyFromClipContext& rCxt, const ScColumn& rClipCol, sc::ColumnSpanSet& rBroadcastSpans );
360 void CopyOneCellFromClip( sc::CopyFromClipContext& rCxt, SCROW nRow1, SCROW nRow2, size_t nColOffset );
362 void CopyFromClip(
363 sc::CopyFromClipContext& rCxt, SCROW nRow1, SCROW nRow2, tools::Long nDy, ScColumn& rColumn );
365 void RemoveEditAttribs( sc::ColumnBlockPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow );
367 // Selection (?) of this document
368 void MixMarked(
369 sc::MixDocContext& rCxt, const ScMarkData& rMark, ScPasteFunc nFunction,
370 bool bSkipEmpty, const ScColumn& rSrcCol );
371 void MixData(
372 sc::MixDocContext& rCxt, SCROW nRow1, SCROW nRow2, ScPasteFunc nFunction, bool bSkipEmpty,
373 const ScColumn& rSrcCol );
375 void UpdateSelectionFunction(
376 const ScRangeList& rRanges, ScFunctionData& rData, const ScFlatBoolRowSegments& rHiddenRows );
378 void CopyToColumn(
379 sc::CopyToDocContext& rCxt, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nFlags, bool bMarked,
380 ScColumn& rColumn, const ScMarkData* pMarkData = nullptr, bool bAsLink = false,
381 bool bGlobalNamesToLocal = false ) const;
383 void UndoToColumn(
384 sc::CopyToDocContext& rCxt, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nFlags, bool bMarked,
385 ScColumn& rColumn) const;
387 void CopyScenarioFrom( const ScColumn& rSrcCol );
388 void CopyScenarioTo( ScColumn& rDestCol ) const;
389 bool TestCopyScenarioTo( const ScColumn& rDestCol ) const;
390 void MarkScenarioIn( ScMarkData& rDestMark ) const;
392 void CopyUpdated( const ScColumn* pPosCol, ScColumn& rDestCol ) const;
394 void SwapCol(ScColumn& rCol);
395 void MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol);
397 bool HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst);
399 bool SetString(
400 SCROW nRow, SCTAB nTab, const OUString& rString, formula::FormulaGrammar::AddressConvention eConv,
401 const ScSetStringParam* pParam = nullptr );
403 void SetEditText( SCROW nRow, std::unique_ptr<EditTextObject> pEditText );
404 void SetEditText( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, std::unique_ptr<EditTextObject> pEditText );
405 void SetEditText( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const EditTextObject& rEditText );
406 void SetEditText( SCROW nRow, const EditTextObject& rEditText, const SfxItemPool* pEditPool );
407 void SetFormula( SCROW nRow, const ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram );
408 void SetFormula( SCROW nRow, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram );
411 * Takes ownership of pCell
413 * @return pCell if it was successfully inserted, NULL otherwise. pCell
414 * is deleted automatically on failure to insert.
416 ScFormulaCell* SetFormulaCell(
417 SCROW nRow, ScFormulaCell* pCell,
418 sc::StartListeningType eListenType = sc::SingleCellListening,
419 bool bInheritNumFormatIfNeeded = true);
420 void SetFormulaCell(
421 sc::ColumnBlockPosition& rBlockPos, SCROW nRow, ScFormulaCell* pCell,
422 sc::StartListeningType eListenType = sc::SingleCellListening,
423 bool bInheritNumFormatIfNeeded = true);
425 bool SetFormulaCells( SCROW nRow, std::vector<ScFormulaCell*>& rCells );
427 bool HasFormulaCell() const;
428 bool HasFormulaCell( SCROW nRow1, SCROW nRow2 ) const;
430 void CloneFormulaCell(
431 sc::ColumnBlockPosition& rBlockPos,
432 const ScFormulaCell& rSrc, const sc::CellTextAttr& rAttr,
433 const std::vector<sc::RowSpan>& rRanges );
435 void CloneFormulaCell(
436 const ScFormulaCell& rSrc, const sc::CellTextAttr& rAttr,
437 const std::vector<sc::RowSpan>& rRanges );
439 svl::SharedString GetSharedString( SCROW nRow ) const;
441 void SetRawString( SCROW nRow, const OUString& rStr );
442 void SetRawString( SCROW nRow, const svl::SharedString& rStr );
443 void SetRawString( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const svl::SharedString& rStr, bool bBroadcast = true );
444 void SetValue( SCROW nRow, double fVal );
445 void SetValues( const SCROW nRow, const std::vector<double>& rVals );
446 void SetValue( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, double fVal, bool bBroadcast = true );
447 void SetError( SCROW nRow, const FormulaError nError);
449 OUString GetString( SCROW nRow, ScInterpreterContext* pContext = nullptr ) const
450 { return GetString( GetCellValue( nRow ), nRow, pContext ); }
451 OUString GetString( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow,
452 ScInterpreterContext* pContext = nullptr ) const
453 { return GetString( GetCellValue( rBlockPos, nRow ), nRow, pContext ); }
454 double* GetValueCell( SCROW nRow );
455 // Note that if pShared is set and a value is returned that way, the returned OUString is empty.
456 OUString GetInputString( SCROW nRow, bool bForceSystemLocale = false ) const
457 { return GetInputString( GetCellValue( nRow ), nRow, bForceSystemLocale ); }
458 OUString GetInputString( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow,
459 bool bForceSystemLocale = false ) const
460 { return GetInputString( GetCellValue( rBlockPos, nRow ), nRow, bForceSystemLocale ); }
461 double GetValue( SCROW nRow ) const;
462 const EditTextObject* GetEditText( SCROW nRow ) const;
463 void RemoveEditTextCharAttribs( SCROW nRow, const ScPatternAttr& rAttr );
464 OUString GetFormula( SCROW nRow ) const;
465 const ScFormulaCell* GetFormulaCell( SCROW nRow ) const;
466 ScFormulaCell* GetFormulaCell( SCROW nRow );
467 ScFormulaCell * const * GetFormulaCellBlockAddress( SCROW nRow, size_t& rBlockSize ) const;
468 CellType GetCellType( SCROW nRow ) const;
469 SCSIZE GetCellCount() const;
470 bool IsCellCountZero() const;
471 sal_uInt64 GetWeightedCount() const;
472 sal_uInt64 GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const;
473 sal_uInt64 GetCodeCount() const; // RPN-Code in formulas
474 FormulaError GetErrCode( SCROW nRow ) const;
476 bool HasStringData( SCROW nRow ) const;
477 bool HasValueData( SCROW nRow ) const;
478 bool HasStringCells( SCROW nStartRow, SCROW nEndRow ) const;
480 sc::MultiDataCellState::StateType HasDataCellsInRange(
481 SCROW nRow1, SCROW nRow2, SCROW* pRow1 ) const;
483 bool IsFormulaDirty( SCROW nRow ) const;
485 void CheckVectorizationState();
486 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
487 void SetDirtyFromClip( SCROW nRow1, SCROW nRow2, sc::ColumnSpanSet& rBroadcastSpans );
488 void SetDirty( SCROW nRow1, SCROW nRow2, BroadcastMode );
489 void SetDirtyVar();
490 void SetDirtyAfterLoad();
491 void SetTableOpDirty( const ScRange& );
492 void CalcAll();
493 void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening );
494 void CompileAll( sc::CompileFormulaContext& rCxt );
495 void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress );
497 /** Broadcast single broadcasters in range, without explicitly setting
498 anything dirty, not doing area broadcasts.
499 @param rHint address is modified to adapt to the actual broadcasted
500 position on each iteration and upon return points to the last
501 position broadcasted. */
502 bool BroadcastBroadcasters( SCROW nRow1, SCROW nRow2, SfxHintId nHint );
504 bool CompileErrorCells( sc::CompileFormulaContext& rCxt, FormulaError nErrCode );
506 void ResetChanged( SCROW nStartRow, SCROW nEndRow );
508 bool UpdateReferenceOnCopy( sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = nullptr );
511 * Update reference addresses in formula cell in response to mass cell
512 * movement.
514 * @return true if reference of at least one formula cell has been
515 * updated, false otherwise.
517 bool UpdateReference( sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc );
519 void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt );
520 void UpdateInsertTabOnlyCells( sc::RefUpdateInsertTabContext& rCxt );
521 void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt );
522 void UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTabNo );
523 void UpdateCompile( bool bForceIfNameInUse = false );
524 void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
525 ScDocument* pUndoDoc );
526 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
528 void SetTabNo(SCTAB nNewTab);
529 void FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, sc::UpdatedRangeNames& rIndexes) const;
531 void PreprocessRangeNameUpdate(
532 sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
534 void CompileHybridFormula(
535 sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt );
537 void PreprocessDBDataUpdate(
538 sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
540 using ScColumnData::GetAttr;
541 using ScColumnData::GetPattern;
542 using ScColumnData::GetNumberFormat;
544 void MergeSelectionPattern( ScMergePatternState& rState, const ScMarkData& rMark, bool bDeep ) const;
545 void MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
546 ScLineFlags& rFlags,
547 SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight ) const;
548 void ApplyBlockFrame(const SvxBoxItem& rLineOuter, const SvxBoxInfoItem* pLineInner,
549 SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight);
551 void ApplyAttr( SCROW nRow, const SfxPoolItem& rAttr );
552 void ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
553 void SetPattern( SCROW nRow, const CellAttributeHolder& rHolder );
554 void SetPattern( SCROW nRow, const ScPatternAttr& rPattern );
555 void SetPatternArea( SCROW nStartRow, SCROW nEndRow, const CellAttributeHolder& );
556 void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
557 const ScPatternAttr& rPattern, SvNumFormatType nNewType );
559 void ApplyStyle( SCROW nRow, const ScStyleSheet* rStyle );
560 void ApplySelectionLineStyle( const ScMarkData& rMark,
561 const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
562 void AddCondFormat(SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex );
563 void RemoveCondFormat(SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex );
565 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const;
566 const ScStyleSheet* GetAreaStyle( bool& rFound, SCROW nRow1, SCROW nRow2 ) const;
568 void FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBoolRowSegments& rUsedRows, bool bReset );
569 bool IsStyleSheetUsed( const ScStyleSheet& rStyle ) const;
571 /// May return -1 if not found
572 SCROW SearchStyle(
573 SCROW nRow, const ScStyleSheet* pSearchStyle, bool bUp, bool bInSelection,
574 const ScMarkData& rMark) const;
576 bool SearchStyleRange(
577 SCROW& rRow, SCROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp,
578 bool bInSelection, const ScMarkData& rMark) const;
580 bool ApplyFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags );
581 bool RemoveFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags );
582 void ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich );
584 void RemoveProtected( SCROW nStartRow, SCROW nEndRow );
586 void DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast );
588 tools::Long GetNeededSize(
589 SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY,
590 const Fraction& rZoomX, const Fraction& rZoomY,
591 bool bWidth, const ScNeededSizeOptions& rOptions, const ScPatternAttr** pPatternChange,
592 bool bInPrintTwips = false ) const;
594 sal_uInt16 GetOptimalColWidth(
595 OutputDevice* pDev, double nPPTX, double nPPTY,
596 const Fraction& rZoomX, const Fraction& rZoomY,
597 bool bFormula, sal_uInt16 nOldWidth, const ScMarkData* pMarkData, const ScColWidthParam* pParam) const;
599 void GetOptimalHeight(
600 sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow, sal_uInt16 nMinHeight, SCROW nMinStart );
602 void GetFilterEntries(
603 sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow,
604 ScFilterEntries& rFilterEntries, bool bFiltering, bool bFilteredRow );
606 void GetBackColorFilterEntries(SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries );
608 bool GetDataEntries( SCROW nRow, std::set<ScTypedStrData>& rStrings) const;
610 void UpdateInsertTabAbs(SCTAB nNewPos);
611 bool TestTabRefAbs(SCTAB nTable) const;
612 bool GetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& rData) const;
614 void StartListeningFormulaCells(
615 sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt, SCROW nRow1, SCROW nRow2 );
617 void EndListeningFormulaCells(
618 sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2,
619 SCROW* pStartRow, SCROW* pEndRow );
621 void StartListening( SvtListener& rLst, SCROW nRow );
622 void EndListening( SvtListener& rLst, SCROW nRow );
623 void StartListening( sc::StartListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
624 void EndListening( sc::EndListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
625 void StartListeners( sc::StartListeningContext& rCxt, bool bAll );
626 void SetDirtyIfPostponed();
627 void BroadcastRecalcOnRefMove();
628 void CollectListeners( std::vector<SvtListener*>& rListeners, SCROW nRow1, SCROW nRow2 );
629 void CollectFormulaCells( std::vector<ScFormulaCell*>& rCells, SCROW nRow1, SCROW nRow2 );
631 void CompileDBFormula( sc::CompileFormulaContext& rCxt );
632 void CompileColRowNameFormula( sc::CompileFormulaContext& rCxt );
634 sal_Int32 GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, rtl_TextEncoding eCharSet ) const;
635 sal_Int32 GetMaxNumberStringLen( sal_uInt16& nPrecision,
636 SCROW nRowStart, SCROW nRowEnd ) const;
638 sal_uInt16 GetTextWidth(SCROW nRow) const;
639 void SetTextWidth(SCROW nRow, sal_uInt16 nWidth);
641 SvtScriptType GetScriptType( SCROW nRow ) const;
644 * Get combined script types of the specified range. This method may
645 * update script types on demand if they have not been determined.
647 SvtScriptType GetRangeScriptType( sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2,
648 const sc::CellStoreType::iterator& itr);
650 void SetScriptType( SCROW nRow, SvtScriptType nType );
651 void UpdateScriptTypes( SCROW nRow1, SCROW nRow2 );
653 formula::FormulaTokenRef ResolveStaticReference( SCROW nRow );
654 bool ResolveStaticReference( ScMatrix& rMat, SCCOL nMatCol, SCROW nRow1, SCROW nRow2 );
655 void FillMatrix( ScMatrix& rMat, size_t nMatCol, SCROW nRow1, SCROW nRow2, svl::SharedStringPool* pPool ) const;
656 formula::VectorRefArray FetchVectorRefArray( SCROW nRow1, SCROW nRow2 );
657 bool HandleRefArrayForParallelism( SCROW nRow1, SCROW nRow2,
658 const ScFormulaCellGroupRef& mxGroup, ScAddress* pDirtiedAddress );
659 #ifdef DBG_UTIL
660 void AssertNoInterpretNeeded( SCROW nRow1, SCROW nRow2 );
661 #endif
662 void SetFormulaResults( SCROW nRow, const double* pResults, size_t nLen );
664 void CalculateInThread( ScInterpreterContext& rContext, SCROW nRow, size_t nLen, size_t nOffset,
665 unsigned nThisThread, unsigned nThreadsTotal );
666 void HandleStuffAfterParallelCalculation( SCROW nRow, size_t nLen, ScInterpreter* pInterpreter );
668 void SetNumberFormat( SCROW nRow, sal_uInt32 nNumberFormat );
670 SvtBroadcaster* GetBroadcaster( SCROW nRow );
671 const SvtBroadcaster* GetBroadcaster( SCROW nRow ) const;
673 void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2 );
674 void PrepareBroadcastersForDestruction();
675 void DeleteEmptyBroadcasters();
677 void Broadcast( SCROW nRow );
678 void BroadcastCells( const std::vector<SCROW>& rRows, SfxHintId nHint );
679 void BroadcastRows( SCROW nStartRow, SCROW nEndRow, SfxHintId nHint );
681 // Spaklines
682 sc::SparklineCell* GetSparklineCell(SCROW nRow);
683 void CreateSparklineCell(SCROW nRow, std::shared_ptr<sc::Sparkline> const& pSparkline);
684 void DeleteSparklineCells(sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2);
685 bool DeleteSparkline(SCROW nRow);
686 bool IsSparklinesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
687 void CopyCellSparklinesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, SCROW nRowOffsetDest = 0) const;
688 void DuplicateSparklines(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol,
689 sc::ColumnBlockPosition& rDestBlockPos, SCROW nRowOffsetDest = 0) const;
690 bool HasSparklines() const;
691 SCROW GetSparklinesMaxRow() const;
692 SCROW GetSparklinesMinRow() const;
694 // cell notes
695 ScPostIt* GetCellNote( SCROW nRow );
696 const ScPostIt* GetCellNote( SCROW nRow ) const;
697 ScPostIt* GetCellNote( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow );
698 const ScPostIt* GetCellNote( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
699 void DeleteCellNotes( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2, bool bForgetCaptionOwnership );
700 bool HasCellNote(SCROW nStartRow, SCROW nEndRow) const;
701 bool HasCellNotes() const;
702 void SetCellNote( SCROW nRow, std::unique_ptr<ScPostIt> pNote);
703 bool IsNotesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
705 std::unique_ptr<ScPostIt> ReleaseNote( SCROW nRow );
706 size_t GetNoteCount() const;
707 void CreateAllNoteCaptions();
708 void ForgetNoteCaptions( SCROW nRow1, SCROW nRow2, bool bPreserveData );
709 SCROW GetNotePosition( size_t nIndex ) const;
710 void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
711 void GetNotesInRange( SCROW nStartRow, SCROW nEndRow, std::vector<sc::NoteEntry>& rNotes ) const;
713 SCROW GetCellNotesMaxRow() const;
714 SCROW GetCellNotesMinRow() const;
716 void CopyCellNotesToDocument(
717 SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, bool bCloneCaption = true,
718 SCROW nRowOffsetDest = 0) const;
720 void DuplicateNotes(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol,
721 sc::ColumnBlockPosition& rDestBlockPos, bool bCloneCaption, SCROW nRowOffsetDest = 0) const;
723 void UpdateNoteCaptions( SCROW nRow1, SCROW nRow2, bool bAddressChanged = true );
724 void CommentNotifyAddressChange( SCROW nRow1, SCROW nRow2 );
726 void UpdateDrawObjects( std::vector<std::vector<SdrObject*>>& pObjects, SCROW nRowStart, SCROW nRowEnd );
727 void UpdateDrawObjectsForRow( std::vector<SdrObject*>& pObjects, SCCOL nTargetCol, SCROW nTargetRow );
728 bool IsDrawObjectsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
730 void InterpretDirtyCells( SCROW nRow1, SCROW nRow2 );
731 bool InterpretCellsIfNeeded( SCROW nRow1, SCROW nRow2 );
733 static void JoinNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell );
736 * Detach a formula cell that's about to be deleted, or removed from
737 * document storage (if that ever happens).
739 * @param rNewSharedRows collects possible new shared row ranges (top and
740 * bottom of shared or remaining single twice) resulting from
741 * unsharing to reestablish listeners on.
743 void DetachFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell,
744 std::vector<SCROW>& rNewSharedRows );
746 /** Re-establish listeners on unshared formula groups */
747 void StartListeningUnshared( const std::vector<SCROW>& rNewSharedRows );
749 void DetachFormulaCells( const sc::CellStoreType::position_type& aPos, size_t nLength,
750 std::vector<SCROW>* pNewSharedRows );
752 void AttachFormulaCells( sc::StartListeningContext& rCxt, SCROW nRow1, SCROW nRow2 );
753 void DetachFormulaCells( sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2 );
756 * Regroup formula cells for the entire column.
758 void RegroupFormulaCells( std::vector<ScAddress>* pGroupPos = nullptr );
761 * Reset column position of formula cells within specified row range.
762 * If bUpdateRefs==true then reference positions are also adjusted to
763 * reflect the new position so that the formula cells still reference the
764 * same cells or ranges after the position change.
765 * The position of a formula cell before the call is interpreted as the old
766 * position of that cell.
768 * Caller needs to ensure that no formula groups cross the top and bottom
769 * row boundaries.
771 * @param nRow1 top row boundary
772 * @param nRow2 bottom row boundary
773 * @param bUpdateRefs whether to adjust references
775 void ResetFormulaCellPositions( SCROW nRow1, SCROW nRow2, bool bUpdateRefs );
777 void SplitFormulaGroupByRelativeRef( const ScRange& rBoundRange );
779 void TransferCellValuesTo( SCROW nRow, size_t nLen, sc::CellValues& rDest );
780 void CopyCellValuesFrom( SCROW nRow, const sc::CellValues& rSrc );
781 void ConvertFormulaToValue(
782 sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2, sc::TableValues* pUndo );
784 void SwapNonEmpty(
785 sc::TableValues& rValues, sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt );
787 std::optional<sc::ColumnIterator> GetColumnIterator( SCROW nRow1, SCROW nRow2 ) const;
789 bool EnsureFormulaCellResults( SCROW nRow1, SCROW nRow2, bool bSkipRunning = false );
791 void StoreToCache(SvStream& rStrm) const;
792 void RestoreFromCache(SvStream& rStrm);
794 #if DUMP_COLUMN_STORAGE
795 void DumpColumnStorage() const;
796 #endif
798 SCSIZE GetPatternCount() const;
799 SCSIZE GetPatternCount( SCROW nRow1, SCROW nRow2 ) const;
800 bool ReservePatternCount( SCSIZE nReserve );
802 void CheckIntegrity() const;
804 private:
806 sc::CellStoreType::iterator GetPositionToInsert( SCROW nRow, std::vector<SCROW>& rNewSharedRows,
807 bool bInsertFormula );
808 sc::CellStoreType::iterator GetPositionToInsert( const sc::CellStoreType::iterator& it, SCROW nRow,
809 std::vector<SCROW>& rNewSharedRows, bool bInsertFormula );
811 void AttachNewFormulaCell(
812 const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell,
813 const std::vector<SCROW>& rNewSharedRows,
814 bool bJoin = true, sc::StartListeningType eListenType = sc::SingleCellListening );
816 void AttachNewFormulaCell(
817 const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell,
818 const std::vector<SCROW>& rNewSharedRows,
819 bool bJoin = true, sc::StartListeningType eListenType = sc::SingleCellListening );
821 public:
822 void AttachNewFormulaCells(const sc::CellStoreType::position_type& aPos, size_t nLength,
823 std::vector<SCROW>& rNewSharedRows);
825 private:
826 void BroadcastNewCell( SCROW nRow );
827 bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, sc::CellStoreType::iterator& itr );
829 const ScFormulaCell* FetchFormulaCell( SCROW nRow ) const;
831 SCROW FindNextVisibleRowWithContent(
832 sc::CellStoreType::const_iterator& itPos, SCROW nRow, bool bForward) const;
833 SCROW FindNextVisibleRow(SCROW nRow, bool bForward) const;
835 OUString GetString( const ScRefCellValue& cell, SCROW nRow, ScInterpreterContext* pContext = nullptr ) const;
836 OUString GetInputString( const ScRefCellValue& cell, SCROW nRow, bool bForceSystemLocale = false ) const;
839 * Called whenever the state of cell array gets modified i.e. new cell
840 * insertion, cell removal or relocation, cell value update and so on.
842 * Call this only from those methods where maCells is modified directly.
844 void CellStorageModified();
845 void CellNotesDeleting(SCROW nRow1, SCROW nRow2, bool bForgetCaptionOwnership );
847 void CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) const;
849 struct DeleteCellsResult
851 /** cell ranges that have been deleted. */
852 sc::SingleColumnSpanSet aDeletedRows;
853 /** formula cell range that has stopped listening. */
854 std::vector<std::pair<SCROW, SCROW>> aFormulaRanges;
856 DeleteCellsResult( const ScDocument& rDoc );
857 DeleteCellsResult( const DeleteCellsResult& ) = delete;
860 std::unique_ptr<DeleteCellsResult> DeleteCells(
861 sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nDelFlag );
864 * Get all non-grouped formula cells and formula cell groups in the whole
865 * column.
867 std::vector<sc::FormulaGroupEntry> GetFormulaGroupEntries();
869 void EndListeningIntersectedGroup(
870 sc::EndListeningContext& rCxt, SCROW nRow, std::vector<ScAddress>* pGroupPos );
872 void EndListeningIntersectedGroups(
873 sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2, std::vector<ScAddress>* pGroupPos );
875 void EndListeningGroup( sc::EndListeningContext& rCxt, SCROW nRow );
876 void SetNeedsListeningGroup( SCROW nRow );
878 void CollectBroadcasterState(sc::BroadcasterState& rState) const;
881 inline bool ScColumn::IsEmptyAttr() const
883 return pAttrArray->IsEmpty();
886 inline bool ScColumnData::IsAllAttrEqual( const ScColumnData& rCol, SCROW nStartRow, SCROW nEndRow ) const
888 return pAttrArray->IsAllEqual( *rCol.pAttrArray, nStartRow, nEndRow );
891 inline bool ScColumn::IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const
893 return pAttrArray->IsVisibleEqual( *rCol.pAttrArray, nStartRow, nEndRow );
896 inline bool ScColumn::GetFirstVisibleAttr( SCROW& rFirstRow ) const
898 return pAttrArray->GetFirstVisibleAttr( rFirstRow );
901 inline bool ScColumn::GetLastVisibleAttr( SCROW& rLastRow, bool bSkipEmpty ) const
903 // row of last cell is needed
904 SCROW nLastData = GetLastDataPos(); // always including notes, 0 if none
905 return pAttrArray->GetLastVisibleAttr( rLastRow, nLastData, bSkipEmpty );
908 inline bool ScColumn::HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const
910 return pAttrArray->HasVisibleAttrIn( nStartRow, nEndRow );
913 inline SCSIZE ScColumn::GetPatternCount() const
915 return pAttrArray->Count();
918 inline SCSIZE ScColumn::GetPatternCount( SCROW nRow1, SCROW nRow2 ) const
920 return pAttrArray->Count( nRow1, nRow2 );
923 inline bool ScColumn::ReservePatternCount( SCSIZE nReserve )
925 return pAttrArray && pAttrArray->Reserve( nReserve );
928 inline bool ScColumn::IsMerged( SCROW nRow ) const
930 return pAttrArray->IsMerged(nRow);
933 inline SCROW ScColumnData::GetNextUnprotected( SCROW nRow, bool bUp ) const
935 return pAttrArray->GetNextUnprotected(nRow, bUp);
938 inline bool ScColumnData::HasAttrib( SCROW nRow1, SCROW nRow2, HasAttrFlags nMask ) const
940 return pAttrArray->HasAttrib( nRow1, nRow2, nMask );
943 inline bool ScColumnData::HasAttrib( SCROW nRow, HasAttrFlags nMask, SCROW* nStartRow, SCROW* nEndRow ) const
945 return pAttrArray->HasAttrib( nRow, nMask, nStartRow, nEndRow );
948 inline bool ScColumn::ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
949 SCCOL& rPaintCol, SCROW& rPaintRow,
950 bool bRefresh )
952 return pAttrArray->ExtendMerge( nThisCol, nStartRow, nEndRow, rPaintCol, rPaintRow, bRefresh );
955 inline void ScColumnData::MergePatternArea( ScMergePatternState& rState, SCROW nRow1, SCROW nRow2, bool bDeep ) const
957 pAttrArray->MergePatternArea( nRow1, nRow2, rState, bDeep );
960 inline void ScColumn::MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
961 ScLineFlags& rFlags,
962 SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight ) const
964 pAttrArray->MergeBlockFrame( pLineOuter, pLineInner, rFlags, nStartRow, nEndRow, bLeft, nDistRight );
967 inline void ScColumn::ApplyBlockFrame(const SvxBoxItem& rLineOuter, const SvxBoxInfoItem* pLineInner,
968 SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight)
970 pAttrArray->ApplyBlockFrame(rLineOuter, pLineInner, nStartRow, nEndRow, bLeft, nDistRight);
973 inline const ScPatternAttr* ScColumnData::GetPattern( SCROW nRow ) const
975 return pAttrArray->GetPattern( nRow );
978 inline const SfxPoolItem& ScColumnData::GetAttr( SCROW nRow, sal_uInt16 nWhich ) const
980 return pAttrArray->GetPattern( nRow )->GetItem(nWhich);
983 inline const SfxPoolItem& ScColumnData::GetAttr( SCROW nRow, sal_uInt16 nWhich, SCROW& nStartRow, SCROW& nEndRow ) const
985 return pAttrArray->GetPatternRange( nStartRow, nEndRow, nRow )->GetItem(nWhich);
988 inline sal_uInt32 ScColumnData::GetNumberFormat( const ScInterpreterContext& rContext, SCROW nRow ) const
990 return pAttrArray->GetPattern( nRow )->GetNumberFormat( rContext );
993 inline void ScColumn::AddCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex )
995 pAttrArray->AddCondFormat( nStartRow, nEndRow, nIndex );
998 inline void ScColumn::RemoveCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex )
1000 pAttrArray->RemoveCondFormat( nStartRow, nEndRow, nIndex );
1003 inline void ScColumnData::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle )
1005 pAttrArray->ApplyStyleArea(nStartRow, nEndRow, rStyle);
1008 inline const ScStyleSheet* ScColumnData::GetStyle( SCROW nRow ) const
1010 return pAttrArray->GetPattern( nRow )->GetStyleSheet();
1013 inline void ScColumn::FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBoolRowSegments& rUsedRows, bool bReset )
1015 pAttrArray->FindStyleSheet( pStyleSheet, rUsedRows, bReset );
1018 inline bool ScColumn::IsStyleSheetUsed( const ScStyleSheet& rStyle ) const
1020 return pAttrArray->IsStyleSheetUsed( rStyle );
1023 inline bool ScColumn::ApplyFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags )
1025 return pAttrArray->ApplyFlags( nStartRow, nEndRow, nFlags );
1028 inline bool ScColumn::RemoveFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags )
1030 return pAttrArray->RemoveFlags( nStartRow, nEndRow, nFlags );
1033 inline void ScColumn::ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich )
1035 pAttrArray->ClearItems( nStartRow, nEndRow, pWhich );
1038 inline void ScColumn::SetPattern( SCROW nRow, const CellAttributeHolder& rHolder )
1040 return pAttrArray->SetPattern( nRow, rHolder );
1043 inline void ScColumn::SetPattern( SCROW nRow, const ScPatternAttr& rPattern )
1045 pAttrArray->SetPattern( nRow, CellAttributeHolder(&rPattern) );
1048 inline void ScColumn::SetPatternArea( SCROW nStartRow, SCROW nEndRow, const CellAttributeHolder& rHolder )
1050 pAttrArray->SetPatternArea( nStartRow, nEndRow, rHolder );
1053 inline void ScColumnData::SetAttrEntries(std::vector<ScAttrEntry> && vNewData)
1055 pAttrArray->SetAttrEntries( std::move( vNewData ));
1058 inline bool ScColumnData::TestInsertRow( SCSIZE nSize ) const
1060 return pAttrArray->TestInsertRow( nSize );
1063 inline void ScColumnData::InsertRow( SCROW nStartRow, SCSIZE nSize )
1065 pAttrArray->InsertRow( nStartRow, nSize );
1068 inline void ScColumnData::DeleteRow(SCROW nStartRow, SCSIZE nSize)
1070 pAttrArray->DeleteRow( nStartRow, nSize );
1073 template <typename ApplyDataFunc>
1074 void ScColumnData::Apply(const ScMarkData& rMark, SCCOL nCol, ApplyDataFunc apply)
1076 if (rMark.IsMultiMarked())
1078 ScMultiSelIter aMultiIter(rMark.GetMultiSelData(), nCol);
1079 SCROW nTop, nBottom;
1080 while (aMultiIter.Next(nTop, nBottom))
1081 apply(*this, nTop, nBottom);
1083 else if (rMark.IsMarked())
1085 const ScRange& aRange = rMark.GetMarkArea();
1086 if (aRange.aStart.Col() <= nCol && nCol <= aRange.aEnd.Col())
1087 apply(*this, aRange.aStart.Row(), aRange.aEnd.Row());
1091 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */