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 .
20 #ifndef INCLUDED_SC_INC_COLUMN_HXX
21 #define INCLUDED_SC_INC_COLUMN_HXX
24 #include "address.hxx"
25 #include "rangelst.hxx"
27 #include "mtvelements.hxx"
28 #include <formula/types.hxx>
29 #include <svl/zforlist.hxx>
30 #include <svx/svdobj.hxx>
31 #include "attarray.hxx"
36 #include <mdds/flat_segment_tree.hpp>
38 namespace editeng
{ class SvxBorderLine
; }
39 namespace formula
{ struct VectorRefArray
; }
43 struct FormulaGroupContext
;
44 struct FormulaGroupEntry
;
45 class StartListeningContext
;
46 class EndListeningContext
;
47 class CopyFromClipContext
;
48 class CopyToClipContext
;
49 class CopyToDocContext
;
52 struct ColumnBlockPosition
;
53 class SingleColumnSpanSet
;
54 struct RefUpdateContext
;
55 struct RefUpdateInsertTabContext
;
56 struct RefUpdateDeleteTabContext
;
57 struct RefUpdateMoveTabContext
;
58 class EditTextIterator
;
60 class DocumentStreamAccess
;
64 class RowHeightContext
;
65 class CompileFormulaContext
;
66 struct SetFormulaDirtyContext
;
68 enum class MatrixEdge
;
75 class SfxItemPoolCache
;
78 class SfxStyleSheetBase
;
83 class ScEditDataArray
;
91 struct ScFunctionData
;
92 class ScFlatBoolRowSegments
;
93 struct ScSetStringParam
;
94 struct ScColWidthParam
;
95 struct ScRefCellValue
;
99 struct ScFilterEntries
;
100 struct ScInterpreterContext
;
102 struct ScNeededSizeOptions
104 const ScPatternAttr
* pPattern
;
110 ScNeededSizeOptions();
115 // Empty values correspond with empty cells. All non-empty cell positions
116 // must have non-empty elements. For text width, the value should be
117 // either the real text width, or TEXTWIDTH_DIRTY in case it hasn't been
118 // calculated yet. For script type, it should be either the real script
119 // type value or SvtScriptType::UNKNOWN.
120 sc::CellTextAttrStoreType maCellTextAttrs
;
123 sc::CellNoteStoreType maCellNotes
;
125 // Broadcasters for formula cells.
126 sc::BroadcasterStoreType maBroadcasters
;
128 sc::CellStoreEvent maCellsEvent
;
131 sc::CellStoreType maCells
;
133 std::unique_ptr
<ScAttrArray
> pAttrArray
;
135 size_t mnBlkCountFormula
;
140 friend class ScDocument
; // for FillInfo
141 friend class ScTable
;
142 friend class ScValueIterator
;
143 friend class ScHorizontalValueIterator
;
144 friend class ScDBQueryDataIterator
;
145 friend class ScQueryCellIterator
;
146 friend class ScFormulaGroupIterator
;
147 friend class ScCellIterator
;
148 friend class ScHorizontalCellIterator
;
149 friend class ScHorizontalAttrIterator
;
150 friend class ScColumnTextWidthIterator
;
151 friend class ScDocumentImport
;
152 friend class sc::DocumentStreamAccess
;
153 friend class sc::SingleColumnSpanSet
;
154 friend class sc::ColumnSpanSet
;
155 friend class sc::EditTextIterator
;
156 friend class sc::CellValues
;
157 friend class sc::TableValues
;
158 friend class sc::CellStoreEvent
;
160 ScColumn(const ScColumn
&) = delete;
161 ScColumn
& operator= (const ScColumn
&) = delete;
165 SCROW nRow
, SCTAB nTab
, const OUString
& rString
, formula::FormulaGrammar::AddressConvention eConv
,
166 const ScSetStringParam
* pParam
);
170 /** Broadcast mode for SetDirty(SCROW,SCROW,BroadcastMode). */
173 BROADCAST_NONE
, ///< no broadcasting
174 BROADCAST_DATA_POSITIONS
, ///< broadcast existing cells with position => does AreaBroadcast
175 BROADCAST_BROADCASTERS
///< broadcast only existing cell broadcasters => no AreaBroadcast of range!
179 ~ScColumn() COVERITY_NOEXCEPT_FALSE
;
181 void Init(SCCOL nNewCol
, SCTAB nNewTab
, ScDocument
* pDoc
, bool bEmptyAttrArray
);
183 ScDocument
* GetDoc() const { return pAttrArray
->GetDoc(); }
184 SCTAB
GetTab() const { return nTab
; }
185 SCCOL
GetCol() const { return nCol
; }
186 sc::CellStoreType
& GetCellStore() { return maCells
; }
187 const sc::CellStoreType
& GetCellStore() const { return maCells
; }
188 sc::CellTextAttrStoreType
& GetCellAttrStore() { return maCellTextAttrs
; }
189 const sc::CellTextAttrStoreType
& GetCellAttrStore() const { return maCellTextAttrs
; }
190 sc::CellNoteStoreType
& GetCellNoteStore() { return maCellNotes
; }
191 const sc::CellNoteStoreType
& GetCellNoteStore() const { return maCellNotes
; }
193 ScRefCellValue
GetCellValue( SCROW nRow
) const;
194 ScRefCellValue
GetCellValue( sc::ColumnBlockConstPosition
& rBlockPos
, SCROW nRow
) const;
195 static ScRefCellValue
GetCellValue( const sc::CellStoreType::const_iterator
& itPos
, size_t nOffset
);
197 const sc::CellTextAttr
* GetCellTextAttr( SCROW nRow
) const;
198 const sc::CellTextAttr
* GetCellTextAttr( sc::ColumnBlockConstPosition
& rBlockPos
, SCROW nRow
) const;
200 void Delete( SCROW nRow
);
201 void DeleteContent( SCROW nRow
, bool bBroadcast
= true );
204 void Swap( ScColumn
& rOther
, SCROW nRow1
, SCROW nRow2
, bool bPattern
);
206 bool HasAttrib( SCROW nRow1
, SCROW nRow2
, HasAttrFlags nMask
) const;
207 bool HasAttribSelection( const ScMarkData
& rMark
, HasAttrFlags nMask
) const;
208 bool IsMerged( SCROW nRow
) const;
209 bool ExtendMerge( SCCOL nThisCol
, SCROW nStartRow
, SCROW nEndRow
,
210 SCCOL
& rPaintCol
, SCROW
& rPaintRow
,
213 bool IsEmptyData() const;
214 bool IsEmptyAttr() const;
217 bool IsEmptyBlock(SCROW nStartRow
, SCROW nEndRow
) const;
218 SCSIZE
GetEmptyLinesInBlock( SCROW nStartRow
, SCROW nEndRow
, ScDirection eDir
) const;
219 bool HasDataAt(SCROW nRow
, bool bConsiderCellNotes
=false,
220 bool bConsiderCellDrawObjects
=false) const;
221 bool HasVisibleDataAt(SCROW nRow
) const;
222 SCROW
GetFirstDataPos() const;
223 SCROW
GetLastDataPos() const;
224 SCROW
GetLastDataPos( SCROW nLastRow
, bool bConsiderCellNotes
=false,
225 bool bConsiderCellDrawObjects
=false ) const;
226 bool GetPrevDataPos(SCROW
& rRow
) const;
227 bool GetNextDataPos(SCROW
& rRow
) const;
228 void FindDataAreaPos(SCROW
& rRow
, bool bDown
) const; // (without Broadcaster)
229 void FindUsed( SCROW nStartRow
, SCROW nEndRow
, mdds::flat_segment_tree
<SCROW
, bool>& rUsed
) const;
231 SCSIZE
VisibleCount( SCROW nStartRow
, SCROW nEndRow
) const;
232 sc::MatrixEdge
GetBlockMatrixEdges(SCROW nRow1
, SCROW nRow2
, sc::MatrixEdge nMask
) const;
233 bool HasSelectionMatrixFragment(const ScMarkData
& rMark
) const;
235 bool GetFirstVisibleAttr( SCROW
& rFirstRow
) const;
236 bool GetLastVisibleAttr( SCROW
& rLastRow
) const;
237 bool HasVisibleAttrIn( SCROW nStartRow
, SCROW nEndRow
) const;
238 bool IsVisibleAttrEqual( const ScColumn
& rCol
, SCROW nStartRow
= 0,
239 SCROW nEndRow
= MAXROW
) const;
240 bool IsAllAttrEqual( const ScColumn
& rCol
, SCROW nStartRow
, SCROW nEndRow
) const;
242 bool TestInsertCol( SCROW nStartRow
, SCROW nEndRow
) const;
243 bool TestInsertRow( SCROW nStartRow
, SCSIZE nSize
) const;
244 void InsertRow( SCROW nStartRow
, SCSIZE nSize
);
245 void GetUnprotectedCells(SCROW nStartRow
, SCROW nEndRow
, ScRangeList
& rRangeList
) const;
248 * @param nStartRow top row position
249 * @param nSize size of the segment to delete.
250 * @param pGroupPos when non-NULL, stores the top position of formula
251 * group that's been merged as a result of row deletion.
253 void DeleteRow( SCROW nStartRow
, SCSIZE nSize
, std::vector
<ScAddress
>* pGroupPos
);
256 SCROW nStartRow
, SCROW nEndRow
, InsertDeleteFlags nDelFlag
,
257 bool bBroadcast
= true, sc::ColumnSpanSet
* pBroadcastSpans
= nullptr );
259 void DeleteRanges( const std::vector
<sc::RowSpan
>& rRanges
, InsertDeleteFlags nDelFlag
);
262 sc::CopyToClipContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, ScColumn
& rColumn
) const;
264 void CopyStaticToDocument(
265 SCROW nRow1
, SCROW nRow2
, const SvNumberFormatterMergeMap
& rMap
, ScColumn
& rDestCol
);
267 void CopyCellToDocument( SCROW nSrcRow
, SCROW nDestRow
, ScColumn
& rDestCol
);
268 bool InitBlockPosition( sc::ColumnBlockPosition
& rBlockPos
);
269 void InitBlockPosition( sc::ColumnBlockConstPosition
& rBlockPos
) const;
271 void DeleteBeforeCopyFromClip(
272 sc::CopyFromClipContext
& rCxt
, const ScColumn
& rClipCol
, sc::ColumnSpanSet
& rBroadcastSpans
);
274 void CopyOneCellFromClip( sc::CopyFromClipContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, size_t nColOffset
);
277 sc::CopyFromClipContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, long nDy
, ScColumn
& rColumn
);
279 void RemoveEditAttribs( SCROW nStartRow
, SCROW nEndRow
);
281 // Selection (?) of this document
283 sc::MixDocContext
& rCxt
, const ScMarkData
& rMark
, ScPasteFunc nFunction
,
284 bool bSkipEmpty
, const ScColumn
& rSrcCol
);
286 sc::MixDocContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, ScPasteFunc nFunction
, bool bSkipEmpty
,
287 const ScColumn
& rSrcCol
);
289 ScAttrIterator
* CreateAttrIterator( SCROW nStartRow
, SCROW nEndRow
) const;
291 void UpdateSelectionFunction(
292 const ScRangeList
& rRanges
, ScFunctionData
& rData
, const ScFlatBoolRowSegments
& rHiddenRows
);
295 sc::CopyToDocContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, InsertDeleteFlags nFlags
, bool bMarked
,
296 ScColumn
& rColumn
, const ScMarkData
* pMarkData
= nullptr, bool bAsLink
= false,
297 bool bGlobalNamesToLocal
= false ) const;
300 sc::CopyToDocContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, InsertDeleteFlags nFlags
, bool bMarked
,
301 ScColumn
& rColumn
) const;
303 void CopyScenarioFrom( const ScColumn
& rSrcCol
);
304 void CopyScenarioTo( ScColumn
& rDestCol
) const;
305 bool TestCopyScenarioTo( const ScColumn
& rDestCol
) const;
306 void MarkScenarioIn( ScMarkData
& rDestMark
) const;
308 void CopyUpdated( const ScColumn
& rPosCol
, ScColumn
& rDestCol
) const;
310 void SwapCol(ScColumn
& rCol
);
311 void MoveTo(SCROW nStartRow
, SCROW nEndRow
, ScColumn
& rCol
);
313 bool HasEditCells(SCROW nStartRow
, SCROW nEndRow
, SCROW
& rFirst
);
316 SCROW nRow
, SCTAB nTab
, const OUString
& rString
, formula::FormulaGrammar::AddressConvention eConv
,
317 const ScSetStringParam
* pParam
= nullptr );
319 void SetEditText( SCROW nRow
, std::unique_ptr
<EditTextObject
> pEditText
);
320 void SetEditText( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow
, std::unique_ptr
<EditTextObject
> pEditText
);
321 void SetEditText( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow
, const EditTextObject
& rEditText
);
322 void SetEditText( SCROW nRow
, const EditTextObject
& rEditText
, const SfxItemPool
* pEditPool
);
323 void SetFormula( SCROW nRow
, const ScTokenArray
& rArray
, formula::FormulaGrammar::Grammar eGram
);
324 void SetFormula( SCROW nRow
, const OUString
& rFormula
, formula::FormulaGrammar::Grammar eGram
);
327 * Takes ownership of pCell
329 * @return pCell if it was successfully inserted, NULL otherwise. pCell
330 * is deleted automatically on failure to insert.
332 ScFormulaCell
* SetFormulaCell(
333 SCROW nRow
, ScFormulaCell
* pCell
,
334 sc::StartListeningType eListenType
= sc::SingleCellListening
,
335 bool bInheritNumFormatIfNeeded
= true);
337 sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow
, ScFormulaCell
* pCell
,
338 sc::StartListeningType eListenType
= sc::SingleCellListening
,
339 bool bInheritNumFormatIfNeeded
= true);
341 bool SetFormulaCells( SCROW nRow
, std::vector
<ScFormulaCell
*>& rCells
);
343 bool HasFormulaCell() const;
344 bool HasFormulaCell( SCROW nRow1
, SCROW nRow2
) const;
346 void CloneFormulaCell(
347 const ScFormulaCell
& rSrc
, const sc::CellTextAttr
& rAttr
,
348 const std::vector
<sc::RowSpan
>& rRanges
);
350 svl::SharedString
GetSharedString( SCROW nRow
) const;
352 void SetRawString( SCROW nRow
, const OUString
& rStr
);
353 void SetRawString( SCROW nRow
, const svl::SharedString
& rStr
);
354 void SetRawString( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow
, const svl::SharedString
& rStr
, bool bBroadcast
= true );
355 void SetValue( SCROW nRow
, double fVal
);
356 void SetValues( const SCROW nRow
, const std::vector
<double>& rVals
);
357 void SetValue( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow
, double fVal
, bool bBroadcast
= true );
358 void SetError( SCROW nRow
, const FormulaError nError
);
360 void GetString( SCROW nRow
, OUString
& rString
, const ScInterpreterContext
* pContext
= nullptr ) const;
361 double* GetValueCell( SCROW nRow
);
362 void GetInputString( SCROW nRow
, OUString
& rString
) const;
363 double GetValue( SCROW nRow
) const;
364 const EditTextObject
* GetEditText( SCROW nRow
) const;
365 void RemoveEditTextCharAttribs( SCROW nRow
, const ScPatternAttr
& rAttr
);
366 void GetFormula( SCROW nRow
, OUString
& rFormula
) const;
367 const ScFormulaCell
* GetFormulaCell( SCROW nRow
) const;
368 ScFormulaCell
* GetFormulaCell( SCROW nRow
);
369 ScFormulaCell
* const * GetFormulaCellBlockAddress( SCROW nRow
, size_t& rBlockSize
) const;
370 CellType
GetCellType( SCROW nRow
) const;
371 SCSIZE
GetCellCount() const;
372 sal_uInt32
GetWeightedCount() const;
373 sal_uInt32
GetCodeCount() const; // RPN-Code in formulas
374 FormulaError
GetErrCode( SCROW nRow
) const;
376 bool HasStringData( SCROW nRow
) const;
377 bool HasValueData( SCROW nRow
) const;
378 bool HasStringCells( SCROW nStartRow
, SCROW nEndRow
) const;
380 sc::MultiDataCellState::StateType
HasDataCellsInRange(
381 SCROW nRow1
, SCROW nRow2
, SCROW
* pRow1
) const;
383 bool IsFormulaDirty( SCROW nRow
) const;
385 void CheckVectorizationState();
386 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext
& rCxt
);
387 void SetDirtyFromClip( SCROW nRow1
, SCROW nRow2
, sc::ColumnSpanSet
& rBroadcastSpans
);
388 void SetDirty( SCROW nRow1
, SCROW nRow2
, BroadcastMode
);
390 void SetDirtyAfterLoad();
391 void SetTableOpDirty( const ScRange
& );
393 void CalcAfterLoad( sc::CompileFormulaContext
& rCxt
, bool bStartListening
);
394 void CompileAll( sc::CompileFormulaContext
& rCxt
);
395 void CompileXML( sc::CompileFormulaContext
& rCxt
, ScProgress
& rProgress
);
397 /** Broadcast single broadcasters in range, without explicitly setting
398 anything dirty, not doing area broadcasts.
399 @param rHint address is modified to adapt to the actual broadcasted
400 position on each iteration and upon return points to the last
401 position broadcasted. */
402 bool BroadcastBroadcasters( SCROW nRow1
, SCROW nRow2
, ScHint
& rHint
);
404 bool CompileErrorCells( sc::CompileFormulaContext
& rCxt
, FormulaError nErrCode
);
406 void ResetChanged( SCROW nStartRow
, SCROW nEndRow
);
408 bool UpdateReferenceOnCopy( const sc::RefUpdateContext
& rCxt
, ScDocument
* pUndoDoc
= nullptr );
411 * Update reference addresses in formula cell in response to mass cell
414 * @return true if reference of at least one formula cell has been
415 * updated, false otherwise.
417 bool UpdateReference( sc::RefUpdateContext
& rCxt
, ScDocument
* pUndoDoc
);
419 void UpdateInsertTab( sc::RefUpdateInsertTabContext
& rCxt
);
420 void UpdateInsertTabOnlyCells( sc::RefUpdateInsertTabContext
& rCxt
);
421 void UpdateDeleteTab( sc::RefUpdateDeleteTabContext
& rCxt
);
422 void UpdateMoveTab( sc::RefUpdateMoveTabContext
& rCxt
, SCTAB nTabNo
);
423 void UpdateCompile( bool bForceIfNameInUse
= false );
424 void UpdateTranspose( const ScRange
& rSource
, const ScAddress
& rDest
,
425 ScDocument
* pUndoDoc
);
426 void UpdateGrow( const ScRange
& rArea
, SCCOL nGrowX
, SCROW nGrowY
);
428 void SetTabNo(SCTAB nNewTab
);
429 void FindRangeNamesInUse(SCROW nRow1
, SCROW nRow2
, sc::UpdatedRangeNames
& rIndexes
) const;
431 void PreprocessRangeNameUpdate(
432 sc::EndListeningContext
& rEndListenCxt
, sc::CompileFormulaContext
& rCompileCxt
);
434 void CompileHybridFormula(
435 sc::StartListeningContext
& rStartListenCxt
, sc::CompileFormulaContext
& rCompileCxt
);
437 void PreprocessDBDataUpdate(
438 sc::EndListeningContext
& rEndListenCxt
, sc::CompileFormulaContext
& rCompileCxt
);
440 const SfxPoolItem
& GetAttr( SCROW nRow
, sal_uInt16 nWhich
) const;
441 template<class T
> const T
& GetAttr( SCROW nRow
, TypedWhichId
<T
> nWhich
) const
443 return static_cast<const T
&>(GetAttr(nRow
, sal_uInt16(nWhich
)));
445 const ScPatternAttr
* GetPattern( SCROW nRow
) const;
446 const ScPatternAttr
* GetMostUsedPattern( SCROW nStartRow
, SCROW nEndRow
) const;
448 sal_uInt32
GetNumberFormat( const ScInterpreterContext
& rContext
, SCROW nRow
) const;
449 sal_uInt32
GetNumberFormat( SCROW nStartRow
, SCROW nEndRow
) const;
451 void MergeSelectionPattern( ScMergePatternState
& rState
, const ScMarkData
& rMark
, bool bDeep
) const;
452 void MergePatternArea( ScMergePatternState
& rState
, SCROW nRow1
, SCROW nRow2
, bool bDeep
) const;
453 void MergeBlockFrame( SvxBoxItem
* pLineOuter
, SvxBoxInfoItem
* pLineInner
,
455 SCROW nStartRow
, SCROW nEndRow
, bool bLeft
, SCCOL nDistRight
) const;
456 void ApplyBlockFrame(const SvxBoxItem
& rLineOuter
, const SvxBoxInfoItem
* pLineInner
,
457 SCROW nStartRow
, SCROW nEndRow
, bool bLeft
, SCCOL nDistRight
);
459 void ApplyAttr( SCROW nRow
, const SfxPoolItem
& rAttr
);
460 void ApplyPattern( SCROW nRow
, const ScPatternAttr
& rPatAttr
);
461 void ApplyPatternArea( SCROW nStartRow
, SCROW nEndRow
, const ScPatternAttr
& rPatAttr
,
462 ScEditDataArray
* pDataArray
= nullptr,
463 bool* const pIsChanged
= nullptr);
464 void SetPattern( SCROW nRow
, const ScPatternAttr
& rPatAttr
);
465 void SetPatternArea( SCROW nStartRow
, SCROW nEndRow
,
466 const ScPatternAttr
& rPatAttr
);
467 void ApplyPatternIfNumberformatIncompatible( const ScRange
& rRange
,
468 const ScPatternAttr
& rPattern
, SvNumFormatType nNewType
);
470 void ApplyStyle( SCROW nRow
, const ScStyleSheet
* rStyle
);
471 void ApplyStyleArea( SCROW nStartRow
, SCROW nEndRow
, const ScStyleSheet
& rStyle
);
472 void ApplySelectionStyle(const ScStyleSheet
& rStyle
, const ScMarkData
& rMark
);
473 void ApplySelectionLineStyle( const ScMarkData
& rMark
,
474 const ::editeng::SvxBorderLine
* pLine
, bool bColorOnly
);
475 void AddCondFormat(SCROW nStartRow
, SCROW nEndRow
, sal_uInt32 nIndex
);
476 void RemoveCondFormat(SCROW nStartRow
, SCROW nEndRow
, sal_uInt32 nIndex
);
478 const ScStyleSheet
* GetStyle( SCROW nRow
) const;
479 const ScStyleSheet
* GetSelectionStyle( const ScMarkData
& rMark
, bool& rFound
) const;
480 const ScStyleSheet
* GetAreaStyle( bool& rFound
, SCROW nRow1
, SCROW nRow2
) const;
482 void FindStyleSheet( const SfxStyleSheetBase
* pStyleSheet
, ScFlatBoolRowSegments
& rUsedRows
, bool bReset
);
483 bool IsStyleSheetUsed( const ScStyleSheet
& rStyle
) const;
485 /// May return -1 if not found
487 SCROW nRow
, const ScStyleSheet
* pSearchStyle
, bool bUp
, bool bInSelection
,
488 const ScMarkData
& rMark
) const;
490 bool SearchStyleRange(
491 SCROW
& rRow
, SCROW
& rEndRow
, const ScStyleSheet
* pSearchStyle
, bool bUp
,
492 bool bInSelection
, const ScMarkData
& rMark
) const;
494 bool ApplyFlags( SCROW nStartRow
, SCROW nEndRow
, ScMF nFlags
);
495 bool RemoveFlags( SCROW nStartRow
, SCROW nEndRow
, ScMF nFlags
);
496 void ClearItems( SCROW nStartRow
, SCROW nEndRow
, const sal_uInt16
* pWhich
);
498 void RemoveProtected( SCROW nStartRow
, SCROW nEndRow
);
500 SCROW
ApplySelectionCache( SfxItemPoolCache
* pCache
, const ScMarkData
& rMark
, ScEditDataArray
* pDataArray
, bool* const pIsChanged
);
501 void DeleteSelection( InsertDeleteFlags nDelFlag
, const ScMarkData
& rMark
, bool bBroadcast
);
503 void ClearSelectionItems( const sal_uInt16
* pWhich
, const ScMarkData
& rMark
);
504 void ChangeSelectionIndent( bool bIncrement
, const ScMarkData
& rMark
);
507 SCROW nRow
, OutputDevice
* pDev
, double nPPTX
, double nPPTY
,
508 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
509 bool bWidth
, const ScNeededSizeOptions
& rOptions
, const ScPatternAttr
** pPatternChange
) const;
511 sal_uInt16
GetOptimalColWidth(
512 OutputDevice
* pDev
, double nPPTX
, double nPPTY
,
513 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
514 bool bFormula
, sal_uInt16 nOldWidth
, const ScMarkData
* pMarkData
, const ScColWidthParam
* pParam
) const;
516 void GetOptimalHeight(
517 sc::RowHeightContext
& rCxt
, SCROW nStartRow
, SCROW nEndRow
, sal_uInt16 nMinHeight
, SCROW nMinStart
);
519 /// Including current, may return -1
520 SCROW
GetNextUnprotected( SCROW nRow
, bool bUp
) const;
522 void GetFilterEntries(
523 sc::ColumnBlockConstPosition
& rBlockPos
, SCROW nStartRow
, SCROW nEndRow
,
524 ScFilterEntries
& rFilterEntries
);
526 bool GetDataEntries( SCROW nRow
, std::set
<ScTypedStrData
>& rStrings
, bool bLimit
) const;
528 void UpdateInsertTabAbs(SCTAB nNewPos
);
529 bool TestTabRefAbs(SCTAB nTable
) const;
530 bool GetNextSpellingCell(SCROW
& nRow
, bool bInSel
, const ScMarkData
& rData
) const;
532 void StartListeningFormulaCells(
533 sc::StartListeningContext
& rStartCxt
, sc::EndListeningContext
& rEndCxt
, SCROW nRow1
, SCROW nRow2
);
535 void EndListeningFormulaCells(
536 sc::EndListeningContext
& rCxt
, SCROW nRow1
, SCROW nRow2
,
537 SCROW
* pStartRow
, SCROW
* pEndRow
);
539 void StartListening( SvtListener
& rLst
, SCROW nRow
);
540 void EndListening( SvtListener
& rLst
, SCROW nRow
);
541 void StartListening( sc::StartListeningContext
& rCxt
, const ScAddress
& rAddress
, SvtListener
& rListener
);
542 void EndListening( sc::EndListeningContext
& rCxt
, const ScAddress
& rAddress
, SvtListener
& rListener
);
543 void StartListeners( sc::StartListeningContext
& rCxt
, bool bAll
);
544 void SetDirtyIfPostponed();
545 void BroadcastRecalcOnRefMove();
546 void TransferListeners( ScColumn
& rDestCol
, SCROW nRow1
, SCROW nRow2
, SCROW nRowDelta
);
547 void CollectListeners( std::vector
<SvtListener
*>& rListeners
, SCROW nRow1
, SCROW nRow2
);
548 void CollectFormulaCells( std::vector
<ScFormulaCell
*>& rCells
, SCROW nRow1
, SCROW nRow2
);
550 void CompileDBFormula( sc::CompileFormulaContext
& rCxt
);
551 void CompileColRowNameFormula( sc::CompileFormulaContext
& rCxt
);
553 sal_Int32
GetMaxStringLen( SCROW nRowStart
, SCROW nRowEnd
, rtl_TextEncoding eCharSet
) const;
554 sal_Int32
GetMaxNumberStringLen( sal_uInt16
& nPrecision
,
555 SCROW nRowStart
, SCROW nRowEnd
) const;
557 sal_uInt16
GetTextWidth(SCROW nRow
) const;
558 void SetTextWidth(SCROW nRow
, sal_uInt16 nWidth
);
560 SvtScriptType
GetScriptType( SCROW nRow
) const;
563 * Get combined script types of the specified range. This method may
564 * update script types on demand if they have not been determined.
566 SvtScriptType
GetRangeScriptType( sc::CellTextAttrStoreType::iterator
& itPos
, SCROW nRow1
, SCROW nRow2
,
567 const sc::CellStoreType::iterator
& itr
);
569 void SetScriptType( SCROW nRow
, SvtScriptType nType
);
570 void UpdateScriptTypes( SCROW nRow1
, SCROW nRow2
);
572 size_t GetFormulaHash( SCROW nRow
) const;
574 ScFormulaVectorState
GetFormulaVectorState( SCROW nRow
) const;
575 formula::FormulaTokenRef
ResolveStaticReference( SCROW nRow
);
576 bool ResolveStaticReference( ScMatrix
& rMat
, SCCOL nMatCol
, SCROW nRow1
, SCROW nRow2
);
577 void FillMatrix( ScMatrix
& rMat
, size_t nMatCol
, SCROW nRow1
, SCROW nRow2
, svl::SharedStringPool
* pPool
) const;
578 formula::VectorRefArray
FetchVectorRefArray( SCROW nRow1
, SCROW nRow2
);
579 bool HandleRefArrayForParallelism( SCROW nRow1
, SCROW nRow2
);
580 void SetFormulaResults( SCROW nRow
, const double* pResults
, size_t nLen
);
581 void SetFormulaResults( SCROW nRow
, const formula::FormulaConstTokenRef
* pResults
, size_t nLen
);
583 void CalculateInThread( ScInterpreterContext
& rContext
, SCROW nRow
, size_t nLen
, unsigned nThisThread
, unsigned nThreadsTotal
);
584 void HandleStuffAfterParallelCalculation( SCROW nRow
, size_t nLen
);
586 void SetNumberFormat( SCROW nRow
, sal_uInt32 nNumberFormat
);
588 SvtBroadcaster
* GetBroadcaster( SCROW nRow
);
589 const SvtBroadcaster
* GetBroadcaster( SCROW nRow
) const;
591 void DeleteBroadcasters( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow1
, SCROW nRow2
);
592 void PrepareBroadcastersForDestruction();
594 void Broadcast( SCROW nRow
);
595 void BroadcastCells( const std::vector
<SCROW
>& rRows
, SfxHintId nHint
);
596 void BroadcastRows( SCROW nStartRow
, SCROW nEndRow
, SfxHintId nHint
);
599 ScPostIt
* GetCellNote( SCROW nRow
);
600 const ScPostIt
* GetCellNote( SCROW nRow
) const;
601 const ScPostIt
* GetCellNote( sc::ColumnBlockConstPosition
& rBlockPos
, SCROW nRow
) const;
602 void DeleteCellNotes( sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow1
, SCROW nRow2
, bool bForgetCaptionOwnership
);
603 bool HasCellNotes() const;
604 void SetCellNote( SCROW nRow
, ScPostIt
* pNote
);
605 bool IsNotesEmptyBlock(SCROW nStartRow
, SCROW nEndRow
) const;
607 ScPostIt
* ReleaseNote( SCROW nRow
);
608 size_t GetNoteCount() const;
609 void CreateAllNoteCaptions();
610 void ForgetNoteCaptions( SCROW nRow1
, SCROW nRow2
, bool bPreserveData
);
611 SCROW
GetNotePosition( size_t nIndex
) const;
612 void GetAllNoteEntries( std::vector
<sc::NoteEntry
>& rNotes
) const;
613 void GetNotesInRange( SCROW nStartRow
, SCROW nEndRow
, std::vector
<sc::NoteEntry
>& rNotes
) const;
615 SCROW
GetCellNotesMaxRow() const;
616 SCROW
GetCellNotesMinRow() const;
618 void CopyCellNotesToDocument(
619 SCROW nRow1
, SCROW nRow2
, ScColumn
& rDestCol
, bool bCloneCaption
= true,
620 SCROW nRowOffsetDest
= 0) const;
622 void DuplicateNotes(SCROW nStartRow
, size_t nDataSize
, ScColumn
& rDestCol
,
623 sc::ColumnBlockPosition
& maDestBlockPos
, bool bCloneCaption
, SCROW nRowOffsetDest
=0 ) const;
625 void UpdateNoteCaptions( SCROW nRow1
, SCROW nRow2
);
627 void UpdateDrawObjects( std::vector
<std::vector
<SdrObject
*>>& pObjects
, SCROW nRowStart
, SCROW nRowEnd
);
628 void UpdateDrawObjectsForRow( std::vector
<SdrObject
*>& pObjects
, SCCOL nTargetCol
, SCROW nTargetRow
);
629 bool IsDrawObjectsEmptyBlock(SCROW nStartRow
, SCROW nEndRow
) const;
631 void InterpretDirtyCells( SCROW nRow1
, SCROW nRow2
);
633 static void JoinNewFormulaCell( const sc::CellStoreType::position_type
& aPos
, ScFormulaCell
& rCell
);
636 * Detach a formula cell that's about to be deleted, or removed from
637 * document storage (if that ever happens).
639 void DetachFormulaCell( const sc::CellStoreType::position_type
& aPos
, ScFormulaCell
& rCell
);
641 void DetachFormulaCells( const sc::CellStoreType::position_type
& aPos
, size_t nLength
);
643 void AttachFormulaCells( sc::StartListeningContext
& rCxt
, SCROW nRow1
, SCROW nRow2
);
644 void DetachFormulaCells( sc::EndListeningContext
& rCxt
, SCROW nRow1
, SCROW nRow2
);
647 * Regroup formula cells for the entire column.
649 void RegroupFormulaCells( std::vector
<ScAddress
>* pGroupPos
= nullptr );
652 * Reset column position of formula cells within specified row range.
653 * If bUpdateRefs==true then reference positions are also adjusted to
654 * reflect the new position so that the formula cells still reference the
655 * same cells or ranges after the position change.
656 * The position of a formula cell before the call is interpreted as the old
657 * position of that cell.
659 * Caller needs to ensure that no formula groups cross the top and bottom
662 * @param nRow1 top row boundary
663 * @param nRow2 bottom row boundary
664 * @param bUpdateRefs whether to adjust references
666 void ResetFormulaCellPositions( SCROW nRow1
, SCROW nRow2
, bool bUpdateRefs
);
668 void SplitFormulaGroupByRelativeRef( const ScRange
& rBoundRange
);
670 void TransferCellValuesTo( SCROW nRow
, size_t nLen
, sc::CellValues
& rDest
);
671 void CopyCellValuesFrom( SCROW nRow
, const sc::CellValues
& rSrc
);
672 void ConvertFormulaToValue(
673 sc::EndListeningContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, sc::TableValues
* pUndo
);
676 sc::TableValues
& rValues
, sc::StartListeningContext
& rStartCxt
, sc::EndListeningContext
& rEndCxt
);
678 std::unique_ptr
<sc::ColumnIterator
> GetColumnIterator( SCROW nRow1
, SCROW nRow2
) const;
680 void EnsureFormulaCellResults( SCROW nRow1
, SCROW nRow2
);
682 void StoreToCache(SvStream
& rStrm
) const;
683 void RestoreFromCache(SvStream
& rStrm
);
685 #if DUMP_COLUMN_STORAGE
686 void DumpColumnStorage() const;
689 SCSIZE
GetPatternCount() const;
690 SCSIZE
GetPatternCount( SCROW nRow1
, SCROW nRow2
) const;
691 bool ReservePatternCount( SCSIZE nReserve
);
694 sc::CellStoreType::iterator
GetPositionToInsert( SCROW nRow
);
695 sc::CellStoreType::iterator
GetPositionToInsert( const sc::CellStoreType::iterator
& it
, SCROW nRow
);
697 void AttachNewFormulaCell(
698 const sc::CellStoreType::iterator
& itPos
, SCROW nRow
, ScFormulaCell
& rCell
,
699 bool bJoin
= true, sc::StartListeningType eListenType
= sc::SingleCellListening
);
701 void AttachNewFormulaCell(
702 const sc::CellStoreType::position_type
& aPos
, ScFormulaCell
& rCell
,
703 bool bJoin
= true, sc::StartListeningType eListenType
= sc::SingleCellListening
);
705 void AttachNewFormulaCells( const sc::CellStoreType::position_type
& aPos
, size_t nLength
);
706 void BroadcastNewCell( SCROW nRow
);
707 bool UpdateScriptType( sc::CellTextAttr
& rAttr
, SCROW nRow
, sc::CellStoreType::iterator
& itr
);
709 const ScFormulaCell
* FetchFormulaCell( SCROW nRow
) const;
711 SCROW
FindNextVisibleRowWithContent(
712 sc::CellStoreType::const_iterator
& itPos
, SCROW nRow
, bool bForward
) const;
713 SCROW
FindNextVisibleRow(SCROW nRow
, bool bForward
) const;
716 * Called whenever the state of cell array gets modified i.e. new cell
717 * insertion, cell removal or relocation, cell value update and so on.
719 * Call this only from those methods where maCells is modified directly.
721 void CellStorageModified();
722 void CellNotesDeleting(SCROW nRow1
, SCROW nRow2
, bool bForgetCaptionOwnership
);
724 void CopyCellTextAttrsToDocument(SCROW nRow1
, SCROW nRow2
, ScColumn
& rDestCol
) const;
727 sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow1
, SCROW nRow2
, InsertDeleteFlags nDelFlag
,
728 sc::SingleColumnSpanSet
& rDeleted
);
731 * Get all non-grouped formula cells and formula cell groups in the whole
734 std::vector
<sc::FormulaGroupEntry
> GetFormulaGroupEntries();
736 void EndListeningIntersectedGroup(
737 sc::EndListeningContext
& rCxt
, SCROW nRow
, std::vector
<ScAddress
>* pGroupPos
);
739 void EndListeningIntersectedGroups(
740 sc::EndListeningContext
& rCxt
, SCROW nRow1
, SCROW nRow2
, std::vector
<ScAddress
>* pGroupPos
);
742 void EndListeningGroup( sc::EndListeningContext
& rCxt
, SCROW nRow
);
743 void SetNeedsListeningGroup( SCROW nRow
);
748 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */