1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
23 #include "address.hxx"
24 #include "cellvalue.hxx"
25 #include "columnspanset.hxx"
26 #include "rangelst.hxx"
28 #include "mtvelements.hxx"
29 #include <formula/types.hxx>
30 #include <svl/zforlist.hxx>
31 #include <svx/svdobj.hxx>
32 #include "attarray.hxx"
38 #include <mdds/flat_segment_tree.hpp>
40 namespace editeng
{ class SvxBorderLine
; }
41 namespace formula
{ struct VectorRefArray
; }
45 struct BroadcasterState
;
46 struct FormulaGroupEntry
;
47 class StartListeningContext
;
48 class EndListeningContext
;
49 class CopyFromClipContext
;
50 class CopyToClipContext
;
51 class CopyToDocContext
;
53 struct RefUpdateContext
;
54 struct RefUpdateInsertTabContext
;
55 struct RefUpdateDeleteTabContext
;
56 struct RefUpdateMoveTabContext
;
57 class EditTextIterator
;
59 class DocumentStreamAccess
;
63 class RowHeightContext
;
64 class CompileFormulaContext
;
65 struct SetFormulaDirtyContext
;
66 enum class MatrixEdge
;
74 class SfxItemPoolCache
;
77 class SfxStyleSheetBase
;
82 class ScEditDataArray
;
91 class ScFlatBoolRowSegments
;
92 struct ScSetStringParam
;
93 struct ScColWidthParam
;
94 struct ScRefCellValue
;
98 struct ScFilterEntries
;
99 struct ScInterpreterContext
;
101 struct ScNeededSizeOptions
103 const ScPatternAttr
* pPattern
;
109 ScNeededSizeOptions();
112 // A shared implementation of some column code and data.
113 // This is used by ScColumn, but also by ScTable for the unallocated
114 // columns (one instance that is the default for all not-yet allocated columns).
118 std::unique_ptr
<ScAttrArray
> pAttrArray
;
120 ScColumnData(const ScColumnData
&) = delete;
121 ScColumnData
& operator= (const ScColumnData
&) = delete;
124 ScColumnData() = default;
125 void InitAttrArray(ScAttrArray
* attrArray
) { pAttrArray
.reset(attrArray
); }
127 ScDocument
& GetDoc() const { return pAttrArray
->GetDoc(); }
129 ScAttrArray
& AttrArray() { return *pAttrArray
; }
130 const ScAttrArray
& AttrArray() const { return *pAttrArray
; }
132 const SfxPoolItem
& GetAttr( SCROW nRow
, sal_uInt16 nWhich
) const;
133 template<class T
> const T
& GetAttr( SCROW nRow
, TypedWhichId
<T
> nWhich
) const
135 return static_cast<const T
&>(GetAttr(nRow
, sal_uInt16(nWhich
)));
137 const SfxPoolItem
& GetAttr( SCROW nRow
, sal_uInt16 nWhich
, SCROW
& nStartRow
, SCROW
& nEndRow
) const;
138 template<class T
> const T
& GetAttr( SCROW nRow
, TypedWhichId
<T
> nWhich
, SCROW
& nStartRow
, SCROW
& nEndRow
) const
140 return static_cast<const T
&>(GetAttr(nRow
, sal_uInt16(nWhich
), nStartRow
, nEndRow
));
143 void SetAttrEntries(std::vector
<ScAttrEntry
> && vNewData
);
145 const ScPatternAttr
* GetPattern( SCROW nRow
) const;
146 const ScPatternAttr
* GetMostUsedPattern( SCROW nStartRow
, SCROW nEndRow
) const;
147 SCROW
ApplySelectionCache( SfxItemPoolCache
* pCache
, const ScMarkData
& rMark
, ScEditDataArray
* pDataArray
, bool* const pIsChanged
,
149 void ApplyPatternArea( SCROW nStartRow
, SCROW nEndRow
, const ScPatternAttr
& rPatAttr
,
150 ScEditDataArray
* pDataArray
= nullptr,
151 bool* const pIsChanged
= nullptr);
152 void MergePatternArea( ScMergePatternState
& rState
, SCROW nRow1
, SCROW nRow2
, bool bDeep
) const;
154 sal_uInt32
GetNumberFormat( const ScInterpreterContext
& rContext
, SCROW nRow
) const;
155 sal_uInt32
GetNumberFormat( SCROW nStartRow
, SCROW nEndRow
) const;
157 /// Including current, may return -1
158 SCROW
GetNextUnprotected( SCROW nRow
, bool bUp
) const;
160 const ScStyleSheet
* GetStyle( SCROW nRow
) const;
161 void ApplyStyleArea( SCROW nStartRow
, SCROW nEndRow
, const ScStyleSheet
& rStyle
);
163 bool HasAttrib( SCROW nRow1
, SCROW nRow2
, HasAttrFlags nMask
) const;
164 bool HasAttrib( SCROW nRow
, HasAttrFlags nMask
, SCROW
* nStartRow
= nullptr, SCROW
* nEndRow
= nullptr ) const;
166 std::unique_ptr
<ScAttrIterator
> CreateAttrIterator( SCROW nStartRow
, SCROW nEndRow
) const;
168 bool IsAllAttrEqual( const ScColumnData
& rCol
, SCROW nStartRow
, SCROW nEndRow
) const;
170 void ClearSelectionItems( const sal_uInt16
* pWhich
, const ScMarkData
& rMark
, SCCOL nCol
);
171 void ChangeSelectionIndent( bool bIncrement
, const ScMarkData
& rMark
, SCCOL nCol
);
173 bool TestInsertRow( SCSIZE nSize
) const;
174 void InsertRow( SCROW nStartRow
, SCSIZE nSize
);
175 void DeleteRow( SCROW nStartRow
, SCSIZE nSize
);
178 // Use protected inheritance to prevent publishing some internal ScColumnData
179 // functions as part of ScColumn. If they should be public in ScColumn,
180 // use 'using' to make them public.
181 class ScColumn
: protected ScColumnData
183 // Empty values correspond with empty cells. All non-empty cell positions
184 // must have non-empty elements. For text width, the value should be
185 // either the real text width, or TEXTWIDTH_DIRTY in case it hasn't been
186 // calculated yet. For script type, it should be either the real script
187 // type value or SvtScriptType::UNKNOWN.
188 sc::CellTextAttrStoreType maCellTextAttrs
;
191 sc::CellNoteStoreType maCellNotes
;
193 // Broadcasters for formula cells.
194 sc::BroadcasterStoreType maBroadcasters
;
197 sc::CellStoreType maCells
;
200 sc::SparklineStoreType maSparklines
;
202 size_t mnBlkCountFormula
;
207 bool mbEmptyBroadcastersPending
: 1; // a broadcaster not removed during EnableDelayDeletingBroadcasters()
209 friend class ScDocument
; // for FillInfo
210 friend class ScTable
;
211 friend class ScValueIterator
;
212 friend class ScHorizontalValueIterator
;
213 friend class ScDBQueryDataIterator
;
214 template< ScQueryCellIteratorAccess accessType
, ScQueryCellIteratorType queryType
>
215 friend class ScQueryCellIteratorBase
;
216 template< ScQueryCellIteratorAccess accessType
>
217 friend class ScQueryCellIteratorAccessSpecific
;
218 friend class ScFormulaGroupIterator
;
219 friend class ScCellIterator
;
220 friend class ScHorizontalCellIterator
;
221 friend class ScColumnTextWidthIterator
;
222 friend class ScDocumentImport
;
223 friend class sc::DocumentStreamAccess
;
224 friend class sc::SingleColumnSpanSet
;
225 friend class sc::ColumnSpanSet
;
226 friend class sc::EditTextIterator
;
227 friend class sc::CellValues
;
228 friend class sc::TableValues
;
229 friend class sc::CellStoreEvent
;
233 SCROW nRow
, SCTAB nTab
, const OUString
& rString
, formula::FormulaGrammar::AddressConvention eConv
,
234 const ScSetStringParam
* pParam
);
236 void duplicateSparkline(sc::CopyFromClipContext
& rContext
, sc::ColumnBlockPosition
* pBlockPos
,
237 size_t nColOffset
, size_t nDestSize
, ScAddress aDestPosition
);
241 /** Broadcast mode for SetDirty(SCROW,SCROW,BroadcastMode). */
244 BROADCAST_NONE
, ///< no broadcasting
245 BROADCAST_DATA_POSITIONS
, ///< broadcast existing cells with position => does AreaBroadcast
246 BROADCAST_BROADCASTERS
///< broadcast only existing cell broadcasters => no AreaBroadcast of range!
249 ScColumn(ScSheetLimits
const &);
250 ~ScColumn() COVERITY_NOEXCEPT_FALSE
;
252 void Init(SCCOL nNewCol
, SCTAB nNewTab
, ScDocument
& rDoc
, bool bEmptyAttrArray
);
254 using ScColumnData::GetDoc
;
255 SCTAB
GetTab() const { return nTab
; }
256 SCCOL
GetCol() const { return nCol
; }
257 sc::CellStoreType
& GetCellStore() { return maCells
; }
258 const sc::CellStoreType
& GetCellStore() const { return maCells
; }
259 sc::CellTextAttrStoreType
& GetCellAttrStore() { return maCellTextAttrs
; }
260 const sc::CellTextAttrStoreType
& GetCellAttrStore() const { return maCellTextAttrs
; }
261 sc::CellNoteStoreType
& GetCellNoteStore() { return maCellNotes
; }
262 const sc::CellNoteStoreType
& GetCellNoteStore() const { return maCellNotes
; }
263 sc::SparklineStoreType
& GetSparklineStore() { return maSparklines
; }
264 const sc::SparklineStoreType
& GetSparklineStore() const { return maSparklines
; }
266 ScRefCellValue
GetCellValue( SCROW nRow
) const;
267 ScRefCellValue
GetCellValue( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow
);
268 ScRefCellValue
GetCellValue( sc::ColumnBlockConstPosition
& rBlockPos
, SCROW nRow
) const;
269 static ScRefCellValue
GetCellValue( const sc::CellStoreType::const_iterator
& itPos
, size_t nOffset
);
271 const sc::CellTextAttr
* GetCellTextAttr( SCROW nRow
) const;
272 const sc::CellTextAttr
* GetCellTextAttr( sc::ColumnBlockConstPosition
& rBlockPos
, SCROW nRow
) const;
274 void Delete( SCROW nRow
);
275 void DeleteContent( SCROW nRow
, bool bBroadcast
= true );
278 void Swap( ScColumn
& rOther
, SCROW nRow1
, SCROW nRow2
, bool bPattern
);
280 bool HasAttribSelection( const ScMarkData
& rMark
, HasAttrFlags nMask
) const;
281 bool IsMerged( SCROW nRow
) const;
282 bool ExtendMerge( SCCOL nThisCol
, SCROW nStartRow
, SCROW nEndRow
,
283 SCCOL
& rPaintCol
, SCROW
& rPaintRow
,
286 bool IsEmptyData() const;
287 bool IsEmptyAttr() const;
290 bool IsEmptyData(SCROW nStartRow
, SCROW nEndRow
) const;
291 SCSIZE
GetEmptyLinesInBlock( SCROW nStartRow
, SCROW nEndRow
, ScDirection eDir
) const;
292 bool HasDataAt( SCROW nRow
, ScDataAreaExtras
* pDataAreaExtras
= nullptr ) const;
293 bool HasDataAt( sc::ColumnBlockConstPosition
& rBlockPos
, SCROW nRow
,
294 ScDataAreaExtras
* pDataAreaExtras
= nullptr ) const;
295 bool HasDataAt( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow
,
296 ScDataAreaExtras
* pDataAreaExtras
= nullptr );
297 void GetDataExtrasAt( SCROW nRow
, ScDataAreaExtras
& rDataAreaExtras
) const;
298 bool HasVisibleDataAt(SCROW nRow
) const;
299 SCROW
GetFirstDataPos() const;
300 SCROW
GetLastDataPos() const;
301 SCROW
GetLastDataPos( SCROW nLastRow
, ScDataAreaExtras
* pDataAreaExtras
= nullptr ) const;
302 bool GetPrevDataPos(SCROW
& rRow
) const;
303 bool GetNextDataPos(SCROW
& rRow
) const;
304 bool TrimEmptyBlocks(SCROW
& rRowStart
, SCROW
& rRowEnd
) const;
305 void FindDataAreaPos(SCROW
& rRow
, bool bDown
) const; // (without Broadcaster)
306 void FindUsed( SCROW nStartRow
, SCROW nEndRow
, mdds::flat_segment_tree
<SCROW
, bool>& rUsed
) const;
308 SCSIZE
VisibleCount( SCROW nStartRow
, SCROW nEndRow
) const;
309 sc::MatrixEdge
GetBlockMatrixEdges(SCROW nRow1
, SCROW nRow2
, sc::MatrixEdge nMask
, bool bNoMatrixAtAll
) const;
310 // Repeated calls to HasSelectionMatrixFragment() repeatedly call rMark.GetMarkedRanges(),
311 // which may be quite slow. For that reason first save the result of rMark.GetMarkedRanges()
312 // pass that to HasSelectionMatrixFragment() calls.
313 bool HasSelectionMatrixFragment(const ScMarkData
& rMark
, const ScRangeList
& rRangeList
) const;
315 bool GetFirstVisibleAttr( SCROW
& rFirstRow
) const;
316 bool GetLastVisibleAttr( SCROW
& rLastRow
) const;
317 bool HasVisibleAttrIn( SCROW nStartRow
, SCROW nEndRow
) const;
318 bool IsVisibleAttrEqual( const ScColumn
& rCol
, SCROW nStartRow
, SCROW nEndRow
) const;
320 bool TestInsertCol( SCROW nStartRow
, SCROW nEndRow
) const;
321 bool TestInsertRow( SCROW nStartRow
, SCSIZE nSize
) const;
322 void InsertRow( SCROW nStartRow
, SCSIZE nSize
);
323 void GetUnprotectedCells(SCROW nStartRow
, SCROW nEndRow
, ScRangeList
& rRangeList
) const;
326 * @param nStartRow top row position
327 * @param nSize size of the segment to delete.
328 * @param pGroupPos when non-NULL, stores the top position of formula
329 * group that's been merged as a result of row deletion.
331 void DeleteRow( SCROW nStartRow
, SCSIZE nSize
, std::vector
<ScAddress
>* pGroupPos
);
334 SCROW nStartRow
, SCROW nEndRow
, InsertDeleteFlags nDelFlag
,
335 bool bBroadcast
= true, sc::ColumnSpanSet
* pBroadcastSpans
= nullptr );
337 void DeleteRanges( const std::vector
<sc::RowSpan
>& rRanges
, InsertDeleteFlags nDelFlag
);
340 sc::CopyToClipContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, ScColumn
& rColumn
) const;
342 void CopyStaticToDocument(
343 SCROW nRow1
, SCROW nRow2
, const SvNumberFormatterMergeMap
& rMap
, ScColumn
& rDestCol
);
345 void CopyCellToDocument( SCROW nSrcRow
, SCROW nDestRow
, ScColumn
& rDestCol
);
346 void InitBlockPosition( sc::ColumnBlockPosition
& rBlockPos
);
347 void InitBlockPosition( sc::ColumnBlockConstPosition
& rBlockPos
) const;
349 void DeleteBeforeCopyFromClip(
350 sc::CopyFromClipContext
& rCxt
, const ScColumn
& rClipCol
, sc::ColumnSpanSet
& rBroadcastSpans
);
352 void CopyOneCellFromClip( sc::CopyFromClipContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, size_t nColOffset
);
355 sc::CopyFromClipContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, tools::Long nDy
, ScColumn
& rColumn
);
357 void RemoveEditAttribs( sc::ColumnBlockPosition
& rBlockPos
, SCROW nStartRow
, SCROW nEndRow
);
359 // Selection (?) of this document
361 sc::MixDocContext
& rCxt
, const ScMarkData
& rMark
, ScPasteFunc nFunction
,
362 bool bSkipEmpty
, const ScColumn
& rSrcCol
);
364 sc::MixDocContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, ScPasteFunc nFunction
, bool bSkipEmpty
,
365 const ScColumn
& rSrcCol
);
367 void UpdateSelectionFunction(
368 const ScRangeList
& rRanges
, ScFunctionData
& rData
, const ScFlatBoolRowSegments
& rHiddenRows
);
371 sc::CopyToDocContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, InsertDeleteFlags nFlags
, bool bMarked
,
372 ScColumn
& rColumn
, const ScMarkData
* pMarkData
= nullptr, bool bAsLink
= false,
373 bool bGlobalNamesToLocal
= false ) const;
376 sc::CopyToDocContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, InsertDeleteFlags nFlags
, bool bMarked
,
377 ScColumn
& rColumn
) const;
379 void CopyScenarioFrom( const ScColumn
& rSrcCol
);
380 void CopyScenarioTo( ScColumn
& rDestCol
) const;
381 bool TestCopyScenarioTo( const ScColumn
& rDestCol
) const;
382 void MarkScenarioIn( ScMarkData
& rDestMark
) const;
384 void CopyUpdated( const ScColumn
* pPosCol
, ScColumn
& rDestCol
) const;
386 void SwapCol(ScColumn
& rCol
);
387 void MoveTo(SCROW nStartRow
, SCROW nEndRow
, ScColumn
& rCol
);
389 bool HasEditCells(SCROW nStartRow
, SCROW nEndRow
, SCROW
& rFirst
);
392 SCROW nRow
, SCTAB nTab
, const OUString
& rString
, formula::FormulaGrammar::AddressConvention eConv
,
393 const ScSetStringParam
* pParam
= nullptr );
395 void SetEditText( SCROW nRow
, std::unique_ptr
<EditTextObject
> pEditText
);
396 void SetEditText( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow
, std::unique_ptr
<EditTextObject
> pEditText
);
397 void SetEditText( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow
, const EditTextObject
& rEditText
);
398 void SetEditText( SCROW nRow
, const EditTextObject
& rEditText
, const SfxItemPool
* pEditPool
);
399 void SetFormula( SCROW nRow
, const ScTokenArray
& rArray
, formula::FormulaGrammar::Grammar eGram
);
400 void SetFormula( SCROW nRow
, const OUString
& rFormula
, formula::FormulaGrammar::Grammar eGram
);
403 * Takes ownership of pCell
405 * @return pCell if it was successfully inserted, NULL otherwise. pCell
406 * is deleted automatically on failure to insert.
408 ScFormulaCell
* SetFormulaCell(
409 SCROW nRow
, ScFormulaCell
* pCell
,
410 sc::StartListeningType eListenType
= sc::SingleCellListening
,
411 bool bInheritNumFormatIfNeeded
= true);
413 sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow
, ScFormulaCell
* pCell
,
414 sc::StartListeningType eListenType
= sc::SingleCellListening
,
415 bool bInheritNumFormatIfNeeded
= true);
417 bool SetFormulaCells( SCROW nRow
, std::vector
<ScFormulaCell
*>& rCells
);
419 bool HasFormulaCell() const;
420 bool HasFormulaCell( SCROW nRow1
, SCROW nRow2
) const;
422 void CloneFormulaCell(
423 sc::ColumnBlockPosition
& rBlockPos
,
424 const ScFormulaCell
& rSrc
, const sc::CellTextAttr
& rAttr
,
425 const std::vector
<sc::RowSpan
>& rRanges
);
427 void CloneFormulaCell(
428 const ScFormulaCell
& rSrc
, const sc::CellTextAttr
& rAttr
,
429 const std::vector
<sc::RowSpan
>& rRanges
);
431 svl::SharedString
GetSharedString( SCROW nRow
) const;
433 void SetRawString( SCROW nRow
, const OUString
& rStr
);
434 void SetRawString( SCROW nRow
, const svl::SharedString
& rStr
);
435 void SetRawString( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow
, const svl::SharedString
& rStr
, bool bBroadcast
= true );
436 void SetValue( SCROW nRow
, double fVal
);
437 void SetValues( const SCROW nRow
, const std::vector
<double>& rVals
);
438 void SetValue( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow
, double fVal
, bool bBroadcast
= true );
439 void SetError( SCROW nRow
, const FormulaError nError
);
441 OUString
GetString( SCROW nRow
, const ScInterpreterContext
* pContext
= nullptr ) const
442 { return GetString( GetCellValue( nRow
), nRow
, pContext
); }
443 OUString
GetString( sc::ColumnBlockConstPosition
& rBlockPos
, SCROW nRow
,
444 const ScInterpreterContext
* pContext
= nullptr ) const
445 { return GetString( GetCellValue( rBlockPos
, nRow
), nRow
, pContext
); }
446 double* GetValueCell( SCROW nRow
);
447 // Note that if pShared is set and a value is returned that way, the returned OUString is empty.
448 OUString
GetInputString( SCROW nRow
, bool bForceSystemLocale
= false ) const
449 { return GetInputString( GetCellValue( nRow
), nRow
, bForceSystemLocale
); }
450 OUString
GetInputString( sc::ColumnBlockConstPosition
& rBlockPos
, SCROW nRow
,
451 bool bForceSystemLocale
= false ) const
452 { return GetInputString( GetCellValue( rBlockPos
, nRow
), nRow
, bForceSystemLocale
); }
453 double GetValue( SCROW nRow
) const;
454 const EditTextObject
* GetEditText( SCROW nRow
) const;
455 void RemoveEditTextCharAttribs( SCROW nRow
, const ScPatternAttr
& rAttr
);
456 OUString
GetFormula( SCROW nRow
) const;
457 const ScFormulaCell
* GetFormulaCell( SCROW nRow
) const;
458 ScFormulaCell
* GetFormulaCell( SCROW nRow
);
459 ScFormulaCell
* const * GetFormulaCellBlockAddress( SCROW nRow
, size_t& rBlockSize
) const;
460 CellType
GetCellType( SCROW nRow
) const;
461 SCSIZE
GetCellCount() const;
462 sal_uInt64
GetWeightedCount() const;
463 sal_uInt64
GetWeightedCount(SCROW nStartRow
, SCROW nEndRow
) const;
464 sal_uInt64
GetCodeCount() const; // RPN-Code in formulas
465 FormulaError
GetErrCode( SCROW nRow
) const;
467 bool HasStringData( SCROW nRow
) const;
468 bool HasValueData( SCROW nRow
) const;
469 bool HasStringCells( SCROW nStartRow
, SCROW nEndRow
) const;
471 sc::MultiDataCellState::StateType
HasDataCellsInRange(
472 SCROW nRow1
, SCROW nRow2
, SCROW
* pRow1
) const;
474 bool IsFormulaDirty( SCROW nRow
) const;
476 void CheckVectorizationState();
477 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext
& rCxt
);
478 void SetDirtyFromClip( SCROW nRow1
, SCROW nRow2
, sc::ColumnSpanSet
& rBroadcastSpans
);
479 void SetDirty( SCROW nRow1
, SCROW nRow2
, BroadcastMode
);
481 void SetDirtyAfterLoad();
482 void SetTableOpDirty( const ScRange
& );
484 void CalcAfterLoad( sc::CompileFormulaContext
& rCxt
, bool bStartListening
);
485 void CompileAll( sc::CompileFormulaContext
& rCxt
);
486 void CompileXML( sc::CompileFormulaContext
& rCxt
, ScProgress
& rProgress
);
488 /** Broadcast single broadcasters in range, without explicitly setting
489 anything dirty, not doing area broadcasts.
490 @param rHint address is modified to adapt to the actual broadcasted
491 position on each iteration and upon return points to the last
492 position broadcasted. */
493 bool BroadcastBroadcasters( SCROW nRow1
, SCROW nRow2
, SfxHintId nHint
);
495 bool CompileErrorCells( sc::CompileFormulaContext
& rCxt
, FormulaError nErrCode
);
497 void ResetChanged( SCROW nStartRow
, SCROW nEndRow
);
499 bool UpdateReferenceOnCopy( sc::RefUpdateContext
& rCxt
, ScDocument
* pUndoDoc
= nullptr );
502 * Update reference addresses in formula cell in response to mass cell
505 * @return true if reference of at least one formula cell has been
506 * updated, false otherwise.
508 bool UpdateReference( sc::RefUpdateContext
& rCxt
, ScDocument
* pUndoDoc
);
510 void UpdateInsertTab( sc::RefUpdateInsertTabContext
& rCxt
);
511 void UpdateInsertTabOnlyCells( sc::RefUpdateInsertTabContext
& rCxt
);
512 void UpdateDeleteTab( sc::RefUpdateDeleteTabContext
& rCxt
);
513 void UpdateMoveTab( sc::RefUpdateMoveTabContext
& rCxt
, SCTAB nTabNo
);
514 void UpdateCompile( bool bForceIfNameInUse
= false );
515 void UpdateTranspose( const ScRange
& rSource
, const ScAddress
& rDest
,
516 ScDocument
* pUndoDoc
);
517 void UpdateGrow( const ScRange
& rArea
, SCCOL nGrowX
, SCROW nGrowY
);
519 void SetTabNo(SCTAB nNewTab
);
520 void FindRangeNamesInUse(SCROW nRow1
, SCROW nRow2
, sc::UpdatedRangeNames
& rIndexes
) const;
522 void PreprocessRangeNameUpdate(
523 sc::EndListeningContext
& rEndListenCxt
, sc::CompileFormulaContext
& rCompileCxt
);
525 void CompileHybridFormula(
526 sc::StartListeningContext
& rStartListenCxt
, sc::CompileFormulaContext
& rCompileCxt
);
528 void PreprocessDBDataUpdate(
529 sc::EndListeningContext
& rEndListenCxt
, sc::CompileFormulaContext
& rCompileCxt
);
531 using ScColumnData::GetAttr
;
532 using ScColumnData::GetPattern
;
533 using ScColumnData::GetNumberFormat
;
535 void MergeSelectionPattern( ScMergePatternState
& rState
, const ScMarkData
& rMark
, bool bDeep
) const;
536 void MergeBlockFrame( SvxBoxItem
* pLineOuter
, SvxBoxInfoItem
* pLineInner
,
538 SCROW nStartRow
, SCROW nEndRow
, bool bLeft
, SCCOL nDistRight
) const;
539 void ApplyBlockFrame(const SvxBoxItem
& rLineOuter
, const SvxBoxInfoItem
* pLineInner
,
540 SCROW nStartRow
, SCROW nEndRow
, bool bLeft
, SCCOL nDistRight
);
542 void ApplyAttr( SCROW nRow
, const SfxPoolItem
& rAttr
);
543 void ApplyPattern( SCROW nRow
, const ScPatternAttr
& rPatAttr
);
544 const ScPatternAttr
* SetPattern( SCROW nRow
, std::unique_ptr
<ScPatternAttr
> );
545 void SetPattern( SCROW nRow
, const ScPatternAttr
& );
546 void SetPatternArea( SCROW nStartRow
, SCROW nEndRow
, const ScPatternAttr
& );
547 void ApplyPatternIfNumberformatIncompatible( const ScRange
& rRange
,
548 const ScPatternAttr
& rPattern
, SvNumFormatType nNewType
);
550 void ApplyStyle( SCROW nRow
, const ScStyleSheet
* rStyle
);
551 void ApplySelectionStyle(const ScStyleSheet
& rStyle
, const ScMarkData
& rMark
);
552 void ApplySelectionLineStyle( const ScMarkData
& rMark
,
553 const ::editeng::SvxBorderLine
* pLine
, bool bColorOnly
);
554 void AddCondFormat(SCROW nStartRow
, SCROW nEndRow
, sal_uInt32 nIndex
);
555 void RemoveCondFormat(SCROW nStartRow
, SCROW nEndRow
, sal_uInt32 nIndex
);
557 const ScStyleSheet
* GetSelectionStyle( const ScMarkData
& rMark
, bool& rFound
) const;
558 const ScStyleSheet
* GetAreaStyle( bool& rFound
, SCROW nRow1
, SCROW nRow2
) const;
560 void FindStyleSheet( const SfxStyleSheetBase
* pStyleSheet
, ScFlatBoolRowSegments
& rUsedRows
, bool bReset
);
561 bool IsStyleSheetUsed( const ScStyleSheet
& rStyle
) const;
563 /// May return -1 if not found
565 SCROW nRow
, const ScStyleSheet
* pSearchStyle
, bool bUp
, bool bInSelection
,
566 const ScMarkData
& rMark
) const;
568 bool SearchStyleRange(
569 SCROW
& rRow
, SCROW
& rEndRow
, const ScStyleSheet
* pSearchStyle
, bool bUp
,
570 bool bInSelection
, const ScMarkData
& rMark
) const;
572 bool ApplyFlags( SCROW nStartRow
, SCROW nEndRow
, ScMF nFlags
);
573 bool RemoveFlags( SCROW nStartRow
, SCROW nEndRow
, ScMF nFlags
);
574 void ClearItems( SCROW nStartRow
, SCROW nEndRow
, const sal_uInt16
* pWhich
);
576 void RemoveProtected( SCROW nStartRow
, SCROW nEndRow
);
578 SCROW
ApplySelectionCache( SfxItemPoolCache
* pCache
, const ScMarkData
& rMark
, ScEditDataArray
* pDataArray
, bool* const pIsChanged
);
579 void DeleteSelection( InsertDeleteFlags nDelFlag
, const ScMarkData
& rMark
, bool bBroadcast
);
581 void ClearSelectionItems( const sal_uInt16
* pWhich
, const ScMarkData
& rMark
);
582 void ChangeSelectionIndent( bool bIncrement
, const ScMarkData
& rMark
);
584 tools::Long
GetNeededSize(
585 SCROW nRow
, OutputDevice
* pDev
, double nPPTX
, double nPPTY
,
586 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
587 bool bWidth
, const ScNeededSizeOptions
& rOptions
, const ScPatternAttr
** pPatternChange
,
588 bool bInPrintTwips
= false ) const;
590 sal_uInt16
GetOptimalColWidth(
591 OutputDevice
* pDev
, double nPPTX
, double nPPTY
,
592 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
593 bool bFormula
, sal_uInt16 nOldWidth
, const ScMarkData
* pMarkData
, const ScColWidthParam
* pParam
) const;
595 void GetOptimalHeight(
596 sc::RowHeightContext
& rCxt
, SCROW nStartRow
, SCROW nEndRow
, sal_uInt16 nMinHeight
, SCROW nMinStart
);
598 void GetFilterEntries(
599 sc::ColumnBlockConstPosition
& rBlockPos
, SCROW nStartRow
, SCROW nEndRow
,
600 ScFilterEntries
& rFilterEntries
, bool bFiltering
, bool bFilteredRow
);
602 bool GetDataEntries( SCROW nRow
, std::set
<ScTypedStrData
>& rStrings
) const;
604 void UpdateInsertTabAbs(SCTAB nNewPos
);
605 bool TestTabRefAbs(SCTAB nTable
) const;
606 bool GetNextSpellingCell(SCROW
& nRow
, bool bInSel
, const ScMarkData
& rData
) const;
608 void StartListeningFormulaCells(
609 sc::StartListeningContext
& rStartCxt
, sc::EndListeningContext
& rEndCxt
, SCROW nRow1
, SCROW nRow2
);
611 void EndListeningFormulaCells(
612 sc::EndListeningContext
& rCxt
, SCROW nRow1
, SCROW nRow2
,
613 SCROW
* pStartRow
, SCROW
* pEndRow
);
615 void StartListening( SvtListener
& rLst
, SCROW nRow
);
616 void EndListening( SvtListener
& rLst
, SCROW nRow
);
617 void StartListening( sc::StartListeningContext
& rCxt
, const ScAddress
& rAddress
, SvtListener
& rListener
);
618 void EndListening( sc::EndListeningContext
& rCxt
, const ScAddress
& rAddress
, SvtListener
& rListener
);
619 void StartListeners( sc::StartListeningContext
& rCxt
, bool bAll
);
620 void SetDirtyIfPostponed();
621 void BroadcastRecalcOnRefMove();
622 void CollectListeners( std::vector
<SvtListener
*>& rListeners
, SCROW nRow1
, SCROW nRow2
);
623 void CollectFormulaCells( std::vector
<ScFormulaCell
*>& rCells
, SCROW nRow1
, SCROW nRow2
);
625 void CompileDBFormula( sc::CompileFormulaContext
& rCxt
);
626 void CompileColRowNameFormula( sc::CompileFormulaContext
& rCxt
);
628 sal_Int32
GetMaxStringLen( SCROW nRowStart
, SCROW nRowEnd
, rtl_TextEncoding eCharSet
) const;
629 sal_Int32
GetMaxNumberStringLen( sal_uInt16
& nPrecision
,
630 SCROW nRowStart
, SCROW nRowEnd
) const;
632 sal_uInt16
GetTextWidth(SCROW nRow
) const;
633 void SetTextWidth(SCROW nRow
, sal_uInt16 nWidth
);
635 SvtScriptType
GetScriptType( SCROW nRow
) const;
638 * Get combined script types of the specified range. This method may
639 * update script types on demand if they have not been determined.
641 SvtScriptType
GetRangeScriptType( sc::CellTextAttrStoreType::iterator
& itPos
, SCROW nRow1
, SCROW nRow2
,
642 const sc::CellStoreType::iterator
& itr
);
644 void SetScriptType( SCROW nRow
, SvtScriptType nType
);
645 void UpdateScriptTypes( SCROW nRow1
, SCROW nRow2
);
647 formula::FormulaTokenRef
ResolveStaticReference( SCROW nRow
);
648 bool ResolveStaticReference( ScMatrix
& rMat
, SCCOL nMatCol
, SCROW nRow1
, SCROW nRow2
);
649 void FillMatrix( ScMatrix
& rMat
, size_t nMatCol
, SCROW nRow1
, SCROW nRow2
, svl::SharedStringPool
* pPool
) const;
650 formula::VectorRefArray
FetchVectorRefArray( SCROW nRow1
, SCROW nRow2
);
651 bool HandleRefArrayForParallelism( SCROW nRow1
, SCROW nRow2
, const ScFormulaCellGroupRef
& mxGroup
);
653 void AssertNoInterpretNeeded( SCROW nRow1
, SCROW nRow2
);
655 void SetFormulaResults( SCROW nRow
, const double* pResults
, size_t nLen
);
657 void CalculateInThread( ScInterpreterContext
& rContext
, SCROW nRow
, size_t nLen
, size_t nOffset
,
658 unsigned nThisThread
, unsigned nThreadsTotal
);
659 void HandleStuffAfterParallelCalculation( SCROW nRow
, size_t nLen
, ScInterpreter
* pInterpreter
);
661 void SetNumberFormat( SCROW nRow
, sal_uInt32 nNumberFormat
);
663 SvtBroadcaster
* GetBroadcaster( SCROW nRow
);
664 const SvtBroadcaster
* GetBroadcaster( SCROW nRow
) const;
666 void DeleteBroadcasters( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow1
, SCROW nRow2
);
667 void PrepareBroadcastersForDestruction();
668 void DeleteEmptyBroadcasters();
670 void Broadcast( SCROW nRow
);
671 void BroadcastCells( const std::vector
<SCROW
>& rRows
, SfxHintId nHint
);
672 void BroadcastRows( SCROW nStartRow
, SCROW nEndRow
, SfxHintId nHint
);
675 sc::SparklineCell
* GetSparklineCell(SCROW nRow
);
676 void CreateSparklineCell(SCROW nRow
, std::shared_ptr
<sc::Sparkline
> const& pSparkline
);
677 void DeleteSparklineCells(sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow1
, SCROW nRow2
);
678 bool DeleteSparkline(SCROW nRow
);
679 bool IsSparklinesEmptyBlock(SCROW nStartRow
, SCROW nEndRow
) const;
680 void CopyCellSparklinesToDocument(SCROW nRow1
, SCROW nRow2
, ScColumn
& rDestCol
, SCROW nRowOffsetDest
= 0) const;
681 void DuplicateSparklines(SCROW nStartRow
, size_t nDataSize
, ScColumn
& rDestCol
,
682 sc::ColumnBlockPosition
& rDestBlockPos
, SCROW nRowOffsetDest
= 0) const;
683 bool HasSparklines() const;
684 SCROW
GetSparklinesMaxRow() const;
685 SCROW
GetSparklinesMinRow() const;
688 ScPostIt
* GetCellNote( SCROW nRow
);
689 const ScPostIt
* GetCellNote( SCROW nRow
) const;
690 ScPostIt
* GetCellNote( sc::ColumnBlockConstPosition
& rBlockPos
, SCROW nRow
);
691 const ScPostIt
* GetCellNote( sc::ColumnBlockConstPosition
& rBlockPos
, SCROW nRow
) const;
692 void DeleteCellNotes( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow1
, SCROW nRow2
, bool bForgetCaptionOwnership
);
693 bool HasCellNote(SCROW nStartRow
, SCROW nEndRow
) const;
694 bool HasCellNotes() const;
695 void SetCellNote( SCROW nRow
, std::unique_ptr
<ScPostIt
> pNote
);
696 bool IsNotesEmptyBlock(SCROW nStartRow
, SCROW nEndRow
) const;
698 std::unique_ptr
<ScPostIt
> ReleaseNote( SCROW nRow
);
699 size_t GetNoteCount() const;
700 void CreateAllNoteCaptions();
701 void ForgetNoteCaptions( SCROW nRow1
, SCROW nRow2
, bool bPreserveData
);
702 SCROW
GetNotePosition( size_t nIndex
) const;
703 void GetAllNoteEntries( std::vector
<sc::NoteEntry
>& rNotes
) const;
704 void GetNotesInRange( SCROW nStartRow
, SCROW nEndRow
, std::vector
<sc::NoteEntry
>& rNotes
) const;
706 SCROW
GetCellNotesMaxRow() const;
707 SCROW
GetCellNotesMinRow() const;
709 void CopyCellNotesToDocument(
710 SCROW nRow1
, SCROW nRow2
, ScColumn
& rDestCol
, bool bCloneCaption
= true,
711 SCROW nRowOffsetDest
= 0) const;
713 void DuplicateNotes(SCROW nStartRow
, size_t nDataSize
, ScColumn
& rDestCol
,
714 sc::ColumnBlockPosition
& rDestBlockPos
, bool bCloneCaption
, SCROW nRowOffsetDest
= 0) const;
716 void UpdateNoteCaptions( SCROW nRow1
, SCROW nRow2
);
718 void UpdateDrawObjects( std::vector
<std::vector
<SdrObject
*>>& pObjects
, SCROW nRowStart
, SCROW nRowEnd
);
719 void UpdateDrawObjectsForRow( std::vector
<SdrObject
*>& pObjects
, SCCOL nTargetCol
, SCROW nTargetRow
);
720 bool IsDrawObjectsEmptyBlock(SCROW nStartRow
, SCROW nEndRow
) const;
722 void InterpretDirtyCells( SCROW nRow1
, SCROW nRow2
);
723 bool InterpretCellsIfNeeded( SCROW nRow1
, SCROW nRow2
);
725 static void JoinNewFormulaCell( const sc::CellStoreType::position_type
& aPos
, ScFormulaCell
& rCell
);
728 * Detach a formula cell that's about to be deleted, or removed from
729 * document storage (if that ever happens).
731 * @param rNewSharedRows collects possible new shared row ranges (top and
732 * bottom of shared or remaining single twice) resulting from
733 * unsharing to reestablish listeners on.
735 void DetachFormulaCell( const sc::CellStoreType::position_type
& aPos
, ScFormulaCell
& rCell
,
736 std::vector
<SCROW
>& rNewSharedRows
);
738 /** Re-establish listeners on unshared formula groups */
739 void StartListeningUnshared( const std::vector
<SCROW
>& rNewSharedRows
);
741 void DetachFormulaCells( const sc::CellStoreType::position_type
& aPos
, size_t nLength
,
742 std::vector
<SCROW
>* pNewSharedRows
);
744 void AttachFormulaCells( sc::StartListeningContext
& rCxt
, SCROW nRow1
, SCROW nRow2
);
745 void DetachFormulaCells( sc::EndListeningContext
& rCxt
, SCROW nRow1
, SCROW nRow2
);
748 * Regroup formula cells for the entire column.
750 void RegroupFormulaCells( std::vector
<ScAddress
>* pGroupPos
= nullptr );
753 * Reset column position of formula cells within specified row range.
754 * If bUpdateRefs==true then reference positions are also adjusted to
755 * reflect the new position so that the formula cells still reference the
756 * same cells or ranges after the position change.
757 * The position of a formula cell before the call is interpreted as the old
758 * position of that cell.
760 * Caller needs to ensure that no formula groups cross the top and bottom
763 * @param nRow1 top row boundary
764 * @param nRow2 bottom row boundary
765 * @param bUpdateRefs whether to adjust references
767 void ResetFormulaCellPositions( SCROW nRow1
, SCROW nRow2
, bool bUpdateRefs
);
769 void SplitFormulaGroupByRelativeRef( const ScRange
& rBoundRange
);
771 void TransferCellValuesTo( SCROW nRow
, size_t nLen
, sc::CellValues
& rDest
);
772 void CopyCellValuesFrom( SCROW nRow
, const sc::CellValues
& rSrc
);
773 void ConvertFormulaToValue(
774 sc::EndListeningContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, sc::TableValues
* pUndo
);
777 sc::TableValues
& rValues
, sc::StartListeningContext
& rStartCxt
, sc::EndListeningContext
& rEndCxt
);
779 std::optional
<sc::ColumnIterator
> GetColumnIterator( SCROW nRow1
, SCROW nRow2
) const;
781 bool EnsureFormulaCellResults( SCROW nRow1
, SCROW nRow2
, bool bSkipRunning
= false );
783 void StoreToCache(SvStream
& rStrm
) const;
784 void RestoreFromCache(SvStream
& rStrm
);
786 #if DUMP_COLUMN_STORAGE
787 void DumpColumnStorage() const;
790 SCSIZE
GetPatternCount() const;
791 SCSIZE
GetPatternCount( SCROW nRow1
, SCROW nRow2
) const;
792 bool ReservePatternCount( SCSIZE nReserve
);
794 void CheckIntegrity() const;
798 sc::CellStoreType::iterator
GetPositionToInsert( SCROW nRow
, std::vector
<SCROW
>& rNewSharedRows
,
799 bool bInsertFormula
);
800 sc::CellStoreType::iterator
GetPositionToInsert( const sc::CellStoreType::iterator
& it
, SCROW nRow
,
801 std::vector
<SCROW
>& rNewSharedRows
, bool bInsertFormula
);
803 void AttachNewFormulaCell(
804 const sc::CellStoreType::iterator
& itPos
, SCROW nRow
, ScFormulaCell
& rCell
,
805 const std::vector
<SCROW
>& rNewSharedRows
,
806 bool bJoin
= true, sc::StartListeningType eListenType
= sc::SingleCellListening
);
808 void AttachNewFormulaCell(
809 const sc::CellStoreType::position_type
& aPos
, ScFormulaCell
& rCell
,
810 const std::vector
<SCROW
>& rNewSharedRows
,
811 bool bJoin
= true, sc::StartListeningType eListenType
= sc::SingleCellListening
);
814 void AttachNewFormulaCells(const sc::CellStoreType::position_type
& aPos
, size_t nLength
,
815 std::vector
<SCROW
>& rNewSharedRows
);
818 void BroadcastNewCell( SCROW nRow
);
819 bool UpdateScriptType( sc::CellTextAttr
& rAttr
, SCROW nRow
, sc::CellStoreType::iterator
& itr
);
821 const ScFormulaCell
* FetchFormulaCell( SCROW nRow
) const;
823 SCROW
FindNextVisibleRowWithContent(
824 sc::CellStoreType::const_iterator
& itPos
, SCROW nRow
, bool bForward
) const;
825 SCROW
FindNextVisibleRow(SCROW nRow
, bool bForward
) const;
827 OUString
GetString( const ScRefCellValue
& cell
, SCROW nRow
, const ScInterpreterContext
* pContext
= nullptr ) const;
828 OUString
GetInputString( const ScRefCellValue
& cell
, SCROW nRow
, bool bForceSystemLocale
= false ) const;
831 * Called whenever the state of cell array gets modified i.e. new cell
832 * insertion, cell removal or relocation, cell value update and so on.
834 * Call this only from those methods where maCells is modified directly.
836 void CellStorageModified();
837 void CellNotesDeleting(SCROW nRow1
, SCROW nRow2
, bool bForgetCaptionOwnership
);
839 void CopyCellTextAttrsToDocument(SCROW nRow1
, SCROW nRow2
, ScColumn
& rDestCol
) const;
841 struct DeleteCellsResult
843 /** cell ranges that have been deleted. */
844 sc::SingleColumnSpanSet aDeletedRows
;
845 /** formula cell range that has stopped listening. */
846 std::vector
<std::pair
<SCROW
, SCROW
>> aFormulaRanges
;
848 DeleteCellsResult( const ScDocument
& rDoc
);
849 DeleteCellsResult( const DeleteCellsResult
& ) = delete;
852 std::unique_ptr
<DeleteCellsResult
> DeleteCells(
853 sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow1
, SCROW nRow2
, InsertDeleteFlags nDelFlag
);
856 * Get all non-grouped formula cells and formula cell groups in the whole
859 std::vector
<sc::FormulaGroupEntry
> GetFormulaGroupEntries();
861 void EndListeningIntersectedGroup(
862 sc::EndListeningContext
& rCxt
, SCROW nRow
, std::vector
<ScAddress
>* pGroupPos
);
864 void EndListeningIntersectedGroups(
865 sc::EndListeningContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, std::vector
<ScAddress
>* pGroupPos
);
867 void EndListeningGroup( sc::EndListeningContext
& rCxt
, SCROW nRow
);
868 void SetNeedsListeningGroup( SCROW nRow
);
870 void CollectBroadcasterState(sc::BroadcasterState
& rState
) const;
873 inline bool ScColumn::IsEmptyAttr() const
875 return pAttrArray
->IsEmpty();
878 inline bool ScColumnData::IsAllAttrEqual( const ScColumnData
& rCol
, SCROW nStartRow
, SCROW nEndRow
) const
880 return pAttrArray
->IsAllEqual( *rCol
.pAttrArray
, nStartRow
, nEndRow
);
883 inline bool ScColumn::IsVisibleAttrEqual( const ScColumn
& rCol
, SCROW nStartRow
, SCROW nEndRow
) const
885 return pAttrArray
->IsVisibleEqual( *rCol
.pAttrArray
, nStartRow
, nEndRow
);
888 inline bool ScColumn::GetFirstVisibleAttr( SCROW
& rFirstRow
) const
890 return pAttrArray
->GetFirstVisibleAttr( rFirstRow
);
893 inline bool ScColumn::GetLastVisibleAttr( SCROW
& rLastRow
) const
895 // row of last cell is needed
896 SCROW nLastData
= GetLastDataPos(); // always including notes, 0 if none
897 return pAttrArray
->GetLastVisibleAttr( rLastRow
, nLastData
);
900 inline bool ScColumn::HasVisibleAttrIn( SCROW nStartRow
, SCROW nEndRow
) const
902 return pAttrArray
->HasVisibleAttrIn( nStartRow
, nEndRow
);
905 inline SCSIZE
ScColumn::GetPatternCount() const
907 return pAttrArray
->Count();
910 inline SCSIZE
ScColumn::GetPatternCount( SCROW nRow1
, SCROW nRow2
) const
912 return pAttrArray
->Count( nRow1
, nRow2
);
915 inline bool ScColumn::ReservePatternCount( SCSIZE nReserve
)
917 return pAttrArray
&& pAttrArray
->Reserve( nReserve
);
920 inline bool ScColumn::IsMerged( SCROW nRow
) const
922 return pAttrArray
->IsMerged(nRow
);
925 inline SCROW
ScColumnData::GetNextUnprotected( SCROW nRow
, bool bUp
) const
927 return pAttrArray
->GetNextUnprotected(nRow
, bUp
);
930 inline bool ScColumnData::HasAttrib( SCROW nRow1
, SCROW nRow2
, HasAttrFlags nMask
) const
932 return pAttrArray
->HasAttrib( nRow1
, nRow2
, nMask
);
935 inline bool ScColumnData::HasAttrib( SCROW nRow
, HasAttrFlags nMask
, SCROW
* nStartRow
, SCROW
* nEndRow
) const
937 return pAttrArray
->HasAttrib( nRow
, nMask
, nStartRow
, nEndRow
);
940 inline bool ScColumn::ExtendMerge( SCCOL nThisCol
, SCROW nStartRow
, SCROW nEndRow
,
941 SCCOL
& rPaintCol
, SCROW
& rPaintRow
,
944 return pAttrArray
->ExtendMerge( nThisCol
, nStartRow
, nEndRow
, rPaintCol
, rPaintRow
, bRefresh
);
947 inline void ScColumnData::MergePatternArea( ScMergePatternState
& rState
, SCROW nRow1
, SCROW nRow2
, bool bDeep
) const
949 pAttrArray
->MergePatternArea( nRow1
, nRow2
, rState
, bDeep
);
952 inline void ScColumn::MergeBlockFrame( SvxBoxItem
* pLineOuter
, SvxBoxInfoItem
* pLineInner
,
954 SCROW nStartRow
, SCROW nEndRow
, bool bLeft
, SCCOL nDistRight
) const
956 pAttrArray
->MergeBlockFrame( pLineOuter
, pLineInner
, rFlags
, nStartRow
, nEndRow
, bLeft
, nDistRight
);
959 inline void ScColumn::ApplyBlockFrame(const SvxBoxItem
& rLineOuter
, const SvxBoxInfoItem
* pLineInner
,
960 SCROW nStartRow
, SCROW nEndRow
, bool bLeft
, SCCOL nDistRight
)
962 pAttrArray
->ApplyBlockFrame(rLineOuter
, pLineInner
, nStartRow
, nEndRow
, bLeft
, nDistRight
);
965 inline const ScPatternAttr
* ScColumnData::GetPattern( SCROW nRow
) const
967 return pAttrArray
->GetPattern( nRow
);
970 inline const SfxPoolItem
& ScColumnData::GetAttr( SCROW nRow
, sal_uInt16 nWhich
) const
972 return pAttrArray
->GetPattern( nRow
)->GetItemSet().Get(nWhich
);
975 inline const SfxPoolItem
& ScColumnData::GetAttr( SCROW nRow
, sal_uInt16 nWhich
, SCROW
& nStartRow
, SCROW
& nEndRow
) const
977 return pAttrArray
->GetPatternRange( nStartRow
, nEndRow
, nRow
)->GetItemSet().Get(nWhich
);
980 inline sal_uInt32
ScColumnData::GetNumberFormat( const ScInterpreterContext
& rContext
, SCROW nRow
) const
982 return pAttrArray
->GetPattern( nRow
)->GetNumberFormat( rContext
.GetFormatTable() );
985 inline void ScColumn::AddCondFormat( SCROW nStartRow
, SCROW nEndRow
, sal_uInt32 nIndex
)
987 pAttrArray
->AddCondFormat( nStartRow
, nEndRow
, nIndex
);
990 inline void ScColumn::RemoveCondFormat( SCROW nStartRow
, SCROW nEndRow
, sal_uInt32 nIndex
)
992 pAttrArray
->RemoveCondFormat( nStartRow
, nEndRow
, nIndex
);
995 inline void ScColumnData::ApplyStyleArea( SCROW nStartRow
, SCROW nEndRow
, const ScStyleSheet
& rStyle
)
997 pAttrArray
->ApplyStyleArea(nStartRow
, nEndRow
, rStyle
);
1000 inline const ScStyleSheet
* ScColumnData::GetStyle( SCROW nRow
) const
1002 return pAttrArray
->GetPattern( nRow
)->GetStyleSheet();
1005 inline void ScColumn::FindStyleSheet( const SfxStyleSheetBase
* pStyleSheet
, ScFlatBoolRowSegments
& rUsedRows
, bool bReset
)
1007 pAttrArray
->FindStyleSheet( pStyleSheet
, rUsedRows
, bReset
);
1010 inline bool ScColumn::IsStyleSheetUsed( const ScStyleSheet
& rStyle
) const
1012 return pAttrArray
->IsStyleSheetUsed( rStyle
);
1015 inline bool ScColumn::ApplyFlags( SCROW nStartRow
, SCROW nEndRow
, ScMF nFlags
)
1017 return pAttrArray
->ApplyFlags( nStartRow
, nEndRow
, nFlags
);
1020 inline bool ScColumn::RemoveFlags( SCROW nStartRow
, SCROW nEndRow
, ScMF nFlags
)
1022 return pAttrArray
->RemoveFlags( nStartRow
, nEndRow
, nFlags
);
1025 inline void ScColumn::ClearItems( SCROW nStartRow
, SCROW nEndRow
, const sal_uInt16
* pWhich
)
1027 pAttrArray
->ClearItems( nStartRow
, nEndRow
, pWhich
);
1030 inline const ScPatternAttr
* ScColumn::SetPattern( SCROW nRow
, std::unique_ptr
<ScPatternAttr
> pPatAttr
)
1032 return pAttrArray
->SetPattern( nRow
, std::move(pPatAttr
), true/*bPutToPool*/ );
1035 inline void ScColumn::SetPattern( SCROW nRow
, const ScPatternAttr
& rPatAttr
)
1037 pAttrArray
->SetPattern( nRow
, &rPatAttr
, true/*bPutToPool*/ );
1040 inline void ScColumn::SetPatternArea( SCROW nStartRow
, SCROW nEndRow
,
1041 const ScPatternAttr
& rPatAttr
)
1043 pAttrArray
->SetPatternArea( nStartRow
, nEndRow
, &rPatAttr
, true/*bPutToPool*/ );
1046 inline void ScColumnData::SetAttrEntries(std::vector
<ScAttrEntry
> && vNewData
)
1048 pAttrArray
->SetAttrEntries( std::move( vNewData
));
1051 inline bool ScColumnData::TestInsertRow( SCSIZE nSize
) const
1053 return pAttrArray
->TestInsertRow( nSize
);
1056 inline void ScColumnData::InsertRow( SCROW nStartRow
, SCSIZE nSize
)
1058 pAttrArray
->InsertRow( nStartRow
, nSize
);
1061 inline void ScColumnData::DeleteRow(SCROW nStartRow
, SCSIZE nSize
)
1063 pAttrArray
->DeleteRow( nStartRow
, nSize
);
1066 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */