Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sc/inc/column.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
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/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
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 .
18
 */
19
20
#pragma once
21
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>
33
34
#include <optional>
35
#include <set>
36
#include <vector>
37
38
#include <mdds/flat_segment_tree.hpp>
39
40
namespace editeng { class SvxBorderLine; }
41
namespace formula { struct VectorRefArray; }
42
43
namespace sc {
44
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
class RowHeightContext;
63
class CompileFormulaContext;
64
struct SetFormulaDirtyContext;
65
class ColumnIterator;
66
class Sparkline;
67
68
}
69
70
class Fraction;
71
class OutputDevice;
72
class ScItemPoolCache;
73
class SvtListener;
74
class SfxPoolItem;
75
class SfxStyleSheetBase;
76
class SvxBoxInfoItem;
77
class SvxBoxItem;
78
79
class ScDocument;
80
class ScEditDataArray;
81
class ScFormulaCell;
82
class ScStyleSheet;
83
class SvtBroadcaster;
84
class ScTypedStrData;
85
class ScProgress;
86
class ScFunctionData;
87
class ScFlatBoolRowSegments;
88
struct ScSetStringParam;
89
struct ScColWidthParam;
90
struct ScRefCellValue;
91
struct ScCellValue;
92
enum class ScMF;
93
struct ScFilterEntries;
94
struct ScInterpreterContext;
95
96
struct ScNeededSizeOptions
97
{
98
    CellAttributeHolder aPattern;
99
100
    bool                bFormula;
101
    bool                bSkipMerged;
102
    bool                bGetFont;
103
    bool                bTotalSize;
104
105
    ScNeededSizeOptions();
106
};
107
108
// A shared implementation of some column code and data.
109
// This is used by ScColumn, but also by ScTable for the unallocated
110
// columns (one instance that is the default for all not-yet allocated columns).
111
class ScColumnData
112
{
113
protected:
114
    std::unique_ptr<ScAttrArray> pAttrArray;
115
116
    ScColumnData(const ScColumnData&) = delete;
117
    ScColumnData& operator= (const ScColumnData&) = delete;
118
119
public:
120
213M
    ScColumnData() = default;
121
213M
    void InitAttrArray(ScAttrArray* attrArray) { pAttrArray.reset(attrArray); }
122
123
664M
    ScDocument& GetDoc() const { return pAttrArray->GetDoc(); }
124
125
213M
    ScAttrArray& AttrArray() { return *pAttrArray; }
126
0
    const ScAttrArray& AttrArray() const { return *pAttrArray; }
127
128
    const SfxPoolItem&      GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
129
    template<class T> const T&  GetAttr( SCROW nRow, TypedWhichId<T> nWhich ) const
130
0
    {
131
0
        return static_cast<const T&>(GetAttr(nRow, sal_uInt16(nWhich)));
132
0
    }
133
    const SfxPoolItem&      GetAttr( SCROW nRow, sal_uInt16 nWhich, SCROW& nStartRow, SCROW& nEndRow ) const;
134
    template<class T> const T&  GetAttr( SCROW nRow, TypedWhichId<T> nWhich, SCROW& nStartRow, SCROW& nEndRow ) const
135
    {
136
        return static_cast<const T&>(GetAttr(nRow, sal_uInt16(nWhich), nStartRow, nEndRow));
137
    }
138
139
    void        SetAttrEntries(std::vector<ScAttrEntry> && vNewData);
140
141
    const ScPatternAttr*    GetPattern( SCROW nRow ) const;
142
    const ScPatternAttr*    GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const;
143
    void        ApplySelectionStyle(const ScStyleSheet& rStyle, SCROW nTop, SCROW nBottom);
144
    void        ApplySelectionCache(ScItemPoolCache& rCache, SCROW nStartRow, SCROW nEndRow,
145
                                    ScEditDataArray* pDataArray, bool* pIsChanged);
146
    void        ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr,
147
                                  ScEditDataArray* pDataArray = nullptr,
148
                                  bool* const pIsChanged = nullptr);
149
    void        MergePatternArea( ScMergePatternState& rState, SCROW nRow1, SCROW nRow2, bool bDeep ) const;
150
151
    sal_uInt32  GetNumberFormat( const ScInterpreterContext& rContext, SCROW nRow ) const;
152
    sal_uInt32  GetNumberFormat( SCROW nStartRow, SCROW nEndRow ) const;
153
154
    /// Including current, may return -1
155
    SCROW       GetNextUnprotected( SCROW nRow, bool bUp ) const;
156
157
    const ScStyleSheet* GetStyle( SCROW nRow ) const;
158
    void        ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle );
159
160
    bool        HasAttrib( SCROW nRow1, SCROW nRow2, HasAttrFlags nMask ) const;
161
    bool        HasAttrib( SCROW nRow, HasAttrFlags nMask, SCROW* nStartRow = nullptr, SCROW* nEndRow = nullptr ) const;
162
163
    ScAttrIterator CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) const;
164
165
    bool        IsAllAttrEqual( const ScColumnData& rCol, SCROW nStartRow, SCROW nEndRow ) const;
166
167
    void        ClearSelectionItems(const sal_uInt16* pWhich, SCROW nStartRow, SCROW nEndRow);
168
    void        ChangeSelectionIndent(bool bIncrement, SCROW nStartRow, SCROW nEndRow);
169
170
    bool        TestInsertRow( SCSIZE nSize ) const;
171
    void        InsertRow( SCROW nStartRow, SCSIZE nSize );
172
    void        DeleteRow( SCROW nStartRow, SCSIZE nSize );
173
};
174
175
// Use protected inheritance to prevent publishing some internal ScColumnData
176
// functions as part of ScColumn. If they should be public in ScColumn,
177
// use 'using' to make them public.
178
class ScColumn : protected ScColumnData
179
{
180
    // Empty values correspond with empty cells. All non-empty cell positions
181
    // must have non-empty elements. For text width, the value should be
182
    // either the real text width, or TEXTWIDTH_DIRTY in case it hasn't been
183
    // calculated yet. For script type, it should be either the real script
184
    // type value or SvtScriptType::UNKNOWN.
185
    sc::CellTextAttrStoreType maCellTextAttrs;
186
187
    // Cell notes
188
    sc::CellNoteStoreType maCellNotes;
189
190
    // Broadcasters for formula cells.
191
    sc::BroadcasterStoreType maBroadcasters;
192
193
    // Cell values.
194
    sc::CellStoreType maCells;
195
196
    // Sparklines
197
    sc::SparklineStoreType maSparklines;
198
199
    sal_uInt32 mnBlkCountFormula;
200
    sal_uInt32 mnBlkCountCellNotes;
201
202
    SCCOL           nCol;
203
    SCTAB           nTab;
204
205
    bool mbEmptyBroadcastersPending : 1; // a broadcaster not removed during EnableDelayDeletingBroadcasters()
206
207
friend class ScDocument;                    // for FillInfo
208
friend class ScTable;
209
friend class ScValueIterator;
210
friend class ScHorizontalValueIterator;
211
friend class ScDBQueryDataIterator;
212
template< ScQueryCellIteratorAccess accessType, ScQueryCellIteratorType queryType >
213
friend class ScQueryCellIteratorBase;
214
template< ScQueryCellIteratorAccess accessType >
215
friend class ScQueryCellIteratorAccessSpecific;
216
friend class ScFormulaGroupIterator;
217
friend class ScCellIterator;
218
friend class ScHorizontalCellIterator;
219
friend class ScColumnTextWidthIterator;
220
friend class ScDocumentImport;
221
friend class sc::DocumentStreamAccess;
222
friend class sc::SingleColumnSpanSet;
223
friend class sc::ColumnSpanSet;
224
friend class sc::EditTextIterator;
225
friend class sc::CellValues;
226
friend class sc::TableValues;
227
friend class sc::CellStoreEvent;
228
229
    bool ParseString(
230
        ScCellValue& rCell,
231
        SCROW nRow, SCTAB nTab, const OUString& rString, formula::FormulaGrammar::AddressConvention eConv,
232
        const ScSetStringParam* pParam );
233
234
    void duplicateSparkline(const sc::CopyFromClipContext& rContext, sc::ColumnBlockPosition* pBlockPos,
235
                            size_t nColOffset, size_t nDestSize, ScAddress aDestPosition);
236
237
public:
238
239
    /** Broadcast mode for SetDirty(SCROW,SCROW,BroadcastMode). */
240
    enum BroadcastMode
241
    {
242
        BROADCAST_NONE,             ///< no broadcasting
243
        BROADCAST_DATA_POSITIONS,   ///< broadcast existing cells with position => does AreaBroadcast
244
        BROADCAST_BROADCASTERS      ///< broadcast only existing cell broadcasters => no AreaBroadcast of range!
245
    };
246
247
    ScColumn(ScSheetLimits const &);
248
    ~ScColumn();
249
250
    void        Init(SCCOL nNewCol, SCTAB nNewTab, ScDocument& rDoc, bool bEmptyAttrArray);
251
252
    using ScColumnData::GetDoc;
253
36
    SCTAB GetTab() const { return nTab; }
254
12
    SCCOL GetCol() const { return nCol; }
255
3.37M
    sc::CellStoreType& GetCellStore() { return maCells; }
256
0
    const sc::CellStoreType& GetCellStore() const { return maCells; }
257
3.34M
    sc::CellTextAttrStoreType& GetCellAttrStore() { return maCellTextAttrs; }
258
0
    const sc::CellTextAttrStoreType& GetCellAttrStore() const { return maCellTextAttrs; }
259
0
    sc::CellNoteStoreType& GetCellNoteStore() { return maCellNotes; }
260
0
    const sc::CellNoteStoreType& GetCellNoteStore() const { return maCellNotes; }
261
0
    sc::SparklineStoreType& GetSparklineStore() { return maSparklines; }
262
0
    const sc::SparklineStoreType& GetSparklineStore() const { return maSparklines; }
263
264
    ScRefCellValue GetCellValue( SCROW nRow ) const;
265
    ScRefCellValue GetCellValue( sc::ColumnBlockPosition& rBlockPos, SCROW nRow );
266
    ScRefCellValue GetCellValue( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
267
    static ScRefCellValue GetCellValue( const sc::CellStoreType::const_iterator& itPos, size_t nOffset );
268
269
    const sc::CellTextAttr* GetCellTextAttr( SCROW nRow ) const;
270
    const sc::CellTextAttr* GetCellTextAttr( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
271
272
    void        Delete( SCROW nRow );
273
    void        DeleteContent( SCROW nRow, bool bBroadcast = true );
274
    void        ImplDestroy();
275
    void        FreeNotes();
276
    void        Swap( ScColumn& rOther, SCROW nRow1, SCROW nRow2, bool bPattern );
277
278
    bool        HasAttribSelection( const ScMarkData& rMark, HasAttrFlags nMask ) const;
279
    bool        IsMerged( SCROW nRow ) const;
280
    bool        ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
281
                                SCCOL& rPaintCol, SCROW& rPaintRow,
282
                                bool bRefresh );
283
284
    bool        IsEmptyData() const;
285
    bool        IsEmptyAttr() const;
286
287
                // data only:
288
    bool        IsEmptyData(SCROW nStartRow, SCROW nEndRow) const;
289
    SCSIZE      GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const;
290
    bool        HasDataAt( SCROW nRow, ScDataAreaExtras* pDataAreaExtras = nullptr ) const;
291
    bool        HasDataAt( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow,
292
                           ScDataAreaExtras* pDataAreaExtras = nullptr ) const;
293
    bool        HasDataAt( sc::ColumnBlockPosition& rBlockPos, SCROW nRow,
294
                           ScDataAreaExtras* pDataAreaExtras = nullptr );
295
    void        GetDataExtrasAt( SCROW nRow, ScDataAreaExtras& rDataAreaExtras ) const;
296
    bool        HasVisibleDataAt(SCROW nRow) const;
297
    SCROW       GetFirstDataPos() const;
298
    SCROW       GetLastDataPos() const;
299
    SCROW       GetLastDataPos( SCROW nLastRow, ScDataAreaExtras* pDataAreaExtras = nullptr ) const;
300
    bool        GetPrevDataPos(SCROW& rRow) const;
301
    bool        GetNextDataPos(SCROW& rRow) const;
302
    bool        TrimEmptyBlocks(SCROW& rRowStart, SCROW& rRowEnd) const;
303
    void        FindDataAreaPos(SCROW& rRow, bool bDown) const; // (without Broadcaster)
304
    void        FindUsed( SCROW nStartRow, SCROW nEndRow, mdds::flat_segment_tree<SCROW, bool>& rUsed ) const;
305
306
    SCSIZE             VisibleCount( SCROW nStartRow, SCROW nEndRow ) const;
307
    sc::MatrixEdge     GetBlockMatrixEdges(SCROW nRow1, SCROW nRow2, sc::MatrixEdge nMask, bool bNoMatrixAtAll ) const;
308
    // Repeated calls to HasSelectionMatrixFragment() repeatedly call rMark.GetMarkedRanges(),
309
    // which may be quite slow. For that reason first save the result of rMark.GetMarkedRanges()
310
    // pass that to HasSelectionMatrixFragment() calls.
311
    bool    HasSelectionMatrixFragment(const ScMarkData& rMark, const ScRangeList& rRangeList) const;
312
313
    bool    GetFirstVisibleAttr( SCROW& rFirstRow ) const;
314
    bool    GetLastVisibleAttr( SCROW& rLastRow, bool bSkipEmpty ) const;
315
    bool    HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
316
    bool    IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const;
317
318
    bool    TestInsertCol( SCROW nStartRow, SCROW nEndRow) const;
319
    bool TestInsertRow( SCROW nStartRow, SCSIZE nSize ) const;
320
    void        InsertRow( SCROW nStartRow, SCSIZE nSize );
321
    void GetUnprotectedCells(SCROW nStartRow, SCROW nEndRow, ScRangeList& rRangeList ) const;
322
323
    /**
324
     * @param nStartRow top row position
325
     * @param nSize size of the segment to delete.
326
     * @param pGroupPos when non-NULL, stores the top position of formula
327
     *                  group that's been merged as a result of row deletion.
328
     */
329
    void DeleteRow( SCROW nStartRow, SCSIZE nSize, std::vector<ScAddress>* pGroupPos );
330
331
    void DeleteArea(
332
        SCROW nStartRow, SCROW nEndRow, InsertDeleteFlags nDelFlag,
333
        bool bBroadcast = true, sc::ColumnSpanSet* pBroadcastSpans = nullptr );
334
335
    void DeleteRanges( const std::vector<sc::RowSpan>& rRanges, InsertDeleteFlags nDelFlag );
336
337
    void CopyToClip(
338
        sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn ) const;
339
340
    void CopyStaticToDocument(
341
        SCROW nRow1, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScColumn& rDestCol );
342
343
    void CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol );
344
    void InitBlockPosition( sc::ColumnBlockPosition& rBlockPos );
345
    void InitBlockPosition( sc::ColumnBlockConstPosition& rBlockPos ) const;
346
347
    void DeleteBeforeCopyFromClip(
348
        sc::CopyFromClipContext& rCxt, const ScColumn& rClipCol, sc::ColumnSpanSet& rBroadcastSpans );
349
350
    void CopyOneCellFromClip( sc::CopyFromClipContext& rCxt, SCROW nRow1, SCROW nRow2, size_t nColOffset );
351
352
    void CopyFromClip(
353
        sc::CopyFromClipContext& rCxt, SCROW nRow1, SCROW nRow2, tools::Long nDy, ScColumn& rColumn );
354
355
    void RemoveEditAttribs( sc::ColumnBlockPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow );
356
357
                //  Selection (?) of this document
358
    void MixMarked(
359
        sc::MixDocContext& rCxt, const ScMarkData& rMark, ScPasteFunc nFunction,
360
        bool bSkipEmpty, const ScColumn& rSrcCol );
361
    void MixData(
362
        sc::MixDocContext& rCxt, SCROW nRow1, SCROW nRow2, ScPasteFunc nFunction, bool bSkipEmpty,
363
        const ScColumn& rSrcCol );
364
365
    void UpdateSelectionFunction(
366
        const ScRangeList& rRanges, ScFunctionData& rData, const ScFlatBoolRowSegments& rHiddenRows );
367
368
    void CopyToColumn(
369
        sc::CopyToDocContext& rCxt, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nFlags, bool bMarked,
370
        ScColumn& rColumn, const ScMarkData* pMarkData = nullptr, bool bAsLink = false,
371
        bool bGlobalNamesToLocal = false ) const;
372
373
    void UndoToColumn(
374
        sc::CopyToDocContext& rCxt, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nFlags, bool bMarked,
375
        ScColumn& rColumn) const;
376
377
    void        CopyScenarioFrom( const ScColumn& rSrcCol );
378
    void        CopyScenarioTo( ScColumn& rDestCol ) const;
379
    bool       TestCopyScenarioTo( const ScColumn& rDestCol ) const;
380
    void        MarkScenarioIn( ScMarkData& rDestMark ) const;
381
382
    void        CopyUpdated( const ScColumn* pPosCol, ScColumn& rDestCol ) const;
383
384
    void        SwapCol(ScColumn& rCol);
385
    void        MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol);
386
387
    bool HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst);
388
389
    bool SetString(
390
        SCROW nRow, SCTAB nTab, const OUString& rString, formula::FormulaGrammar::AddressConvention eConv,
391
        const ScSetStringParam* pParam = nullptr );
392
393
    void SetEditText( SCROW nRow, std::unique_ptr<EditTextObject> pEditText );
394
    void SetEditText( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, std::unique_ptr<EditTextObject> pEditText );
395
    void SetEditText( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const EditTextObject& rEditText );
396
    void SetEditText( SCROW nRow, const EditTextObject& rEditText, const SfxItemPool* pEditPool );
397
    void SetFormula( SCROW nRow, const ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram );
398
    void SetFormula( SCROW nRow, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram );
399
400
    /**
401
     * Takes ownership of pCell
402
     *
403
     * @return pCell if it was successfully inserted, NULL otherwise. pCell
404
     *         is deleted automatically on failure to insert.
405
     */
406
    ScFormulaCell* SetFormulaCell(
407
        SCROW nRow, ScFormulaCell* pCell,
408
        sc::StartListeningType eListenType = sc::SingleCellListening,
409
        bool bInheritNumFormatIfNeeded = true);
410
    void SetFormulaCell(
411
        sc::ColumnBlockPosition& rBlockPos, SCROW nRow, ScFormulaCell* pCell,
412
        sc::StartListeningType eListenType = sc::SingleCellListening,
413
        bool bInheritNumFormatIfNeeded = true);
414
415
    bool SetFormulaCells( SCROW nRow, std::vector<ScFormulaCell*>& rCells );
416
417
    bool HasFormulaCell() const;
418
    bool HasFormulaCell( SCROW nRow1, SCROW nRow2 ) const;
419
420
    void CloneFormulaCell(
421
        sc::ColumnBlockPosition& rBlockPos,
422
        const ScFormulaCell& rSrc, const sc::CellTextAttr& rAttr,
423
        const std::vector<sc::RowSpan>& rRanges );
424
425
    void CloneFormulaCell(
426
        const ScFormulaCell& rSrc, const sc::CellTextAttr& rAttr,
427
        const std::vector<sc::RowSpan>& rRanges );
428
429
    svl::SharedString GetSharedString( SCROW nRow ) const;
430
431
    void SetRawString( SCROW nRow, const OUString& rStr );
432
    void SetRawString( SCROW nRow, const svl::SharedString& rStr );
433
    void SetRawString( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const svl::SharedString& rStr, bool bBroadcast = true );
434
    void SetValue( SCROW nRow, double fVal );
435
    void SetValues( const SCROW nRow, const std::vector<double>& rVals );
436
    void SetValue( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, double fVal, bool bBroadcast = true );
437
    void        SetError( SCROW nRow, const FormulaError nError);
438
439
    OUString    GetString( SCROW nRow, ScInterpreterContext* pContext = nullptr ) const
440
1
        { return GetString( GetCellValue( nRow ), nRow, pContext ); }
441
    OUString    GetString( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow,
442
                           ScInterpreterContext* pContext = nullptr ) const
443
0
        { return GetString( GetCellValue( rBlockPos, nRow ), nRow, pContext ); }
444
    double* GetValueCell( SCROW nRow );
445
    // Note that if pShared is set and a value is returned that way, the returned OUString is empty.
446
    OUString    GetInputString( SCROW nRow, bool bForceSystemLocale = false ) const
447
299
        { return GetInputString( GetCellValue( nRow ), nRow, bForceSystemLocale ); }
448
    OUString    GetInputString( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow,
449
                    bool bForceSystemLocale = false ) const
450
0
        { return GetInputString( GetCellValue( rBlockPos, nRow ), nRow, bForceSystemLocale ); }
451
    double      GetValue( SCROW nRow ) const;
452
    const EditTextObject* GetEditText( SCROW nRow ) const;
453
    void RemoveEditTextCharAttribs( SCROW nRow, const ScPatternAttr& rAttr );
454
    OUString GetFormula( SCROW nRow ) const;
455
    const ScFormulaCell* GetFormulaCell( SCROW nRow ) const;
456
    ScFormulaCell* GetFormulaCell( SCROW nRow );
457
    ScFormulaCell * const * GetFormulaCellBlockAddress( SCROW nRow, size_t& rBlockSize ) const;
458
    CellType    GetCellType( SCROW nRow ) const;
459
    SCSIZE      GetCellCount() const;
460
    bool        IsCellCountZero() const;
461
    sal_uInt64  GetWeightedCount() const;
462
    sal_uInt64  GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const;
463
    sal_uInt64  GetCodeCount() const;       // RPN-Code in formulas
464
    FormulaError  GetErrCode( SCROW nRow ) const;
465
466
    bool    HasStringData( SCROW nRow ) const;
467
    bool    HasValueData( SCROW nRow ) const;
468
    bool    HasStringCells( SCROW nStartRow, SCROW nEndRow ) const;
469
470
    sc::MultiDataCellState::StateType HasDataCellsInRange(
471
        SCROW nRow1, SCROW nRow2, SCROW* pRow1 ) const;
472
473
    bool IsFormulaDirty( SCROW nRow ) const;
474
475
    void CheckVectorizationState();
476
    void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
477
    void SetDirtyFromClip( SCROW nRow1, SCROW nRow2, sc::ColumnSpanSet& rBroadcastSpans );
478
    void SetDirty( SCROW nRow1, SCROW nRow2, BroadcastMode );
479
    void        SetDirtyVar();
480
    void        SetDirtyAfterLoad();
481
    void        SetTableOpDirty( const ScRange& );
482
    void        CalcAll();
483
    void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening );
484
    void CompileAll( sc::CompileFormulaContext& rCxt );
485
    void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress );
486
487
    /** Broadcast single broadcasters in range, without explicitly setting
488
        anything dirty, not doing area broadcasts.
489
        @param rHint address is modified to adapt to the actual broadcasted
490
                position on each iteration and upon return points to the last
491
                position broadcasted. */
492
    bool BroadcastBroadcasters( SCROW nRow1, SCROW nRow2, SfxHintId nHint );
493
494
    bool CompileErrorCells( sc::CompileFormulaContext& rCxt, FormulaError nErrCode );
495
496
    void        ResetChanged( SCROW nStartRow, SCROW nEndRow );
497
498
    bool UpdateReferenceOnCopy( sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = nullptr );
499
500
    /**
501
     * Update reference addresses in formula cell in response to mass cell
502
     * movement.
503
     *
504
     * @return true if reference of at least one formula cell has been
505
     *         updated, false otherwise.
506
     */
507
    bool UpdateReference( sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc );
508
509
    void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt );
510
    void UpdateInsertTabOnlyCells( sc::RefUpdateInsertTabContext& rCxt );
511
    void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt );
512
    void UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTabNo );
513
    void        UpdateCompile( bool bForceIfNameInUse = false );
514
    void        UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
515
                                    ScDocument* pUndoDoc );
516
    void        UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
517
518
    void        SetTabNo(SCTAB nNewTab);
519
    void        FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, sc::UpdatedRangeNames& rIndexes) const;
520
521
    void PreprocessRangeNameUpdate(
522
        sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
523
524
    void CompileHybridFormula(
525
        sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt );
526
527
    void PreprocessDBDataUpdate(
528
        sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
529
530
    using ScColumnData::GetAttr;
531
    using ScColumnData::GetPattern;
532
    using ScColumnData::GetNumberFormat;
533
534
    void        MergeSelectionPattern( ScMergePatternState& rState, const ScMarkData& rMark, bool bDeep ) const;
535
    void        MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
536
                            ScLineFlags& rFlags,
537
                            SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight ) const;
538
    void        ApplyBlockFrame(const SvxBoxItem& rLineOuter, const SvxBoxInfoItem* pLineInner,
539
                                SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight);
540
541
    void        ApplyAttr( SCROW nRow, const SfxPoolItem& rAttr );
542
    void        ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
543
    void        SetPattern( SCROW nRow, const CellAttributeHolder& rHolder );
544
    void        SetPattern( SCROW nRow, const ScPatternAttr& rPattern );
545
    void        SetPatternArea( SCROW nStartRow, SCROW nEndRow, const CellAttributeHolder& );
546
    void        ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
547
                            const ScPatternAttr& rPattern, SvNumFormatType nNewType );
548
549
    void        ApplyStyle( SCROW nRow, const ScStyleSheet* rStyle );
550
    void        ApplySelectionLineStyle( const ScMarkData& rMark,
551
                                    const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
552
    void        AddCondFormat(SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex );
553
    void        RemoveCondFormat(SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex );
554
555
    const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const;
556
    const ScStyleSheet* GetAreaStyle( bool& rFound, SCROW nRow1, SCROW nRow2 ) const;
557
558
    void        FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBoolRowSegments& rUsedRows, bool bReset );
559
    bool        IsStyleSheetUsed( const ScStyleSheet& rStyle ) const;
560
561
                /// May return -1 if not found
562
    SCROW SearchStyle(
563
        SCROW nRow, const ScStyleSheet* pSearchStyle, bool bUp, bool bInSelection,
564
        const ScMarkData& rMark) const;
565
566
    bool SearchStyleRange(
567
        SCROW& rRow, SCROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp,
568
        bool bInSelection, const ScMarkData& rMark) const;
569
570
    bool        ApplyFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags );
571
    bool        RemoveFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags );
572
    void        ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich );
573
574
    void        RemoveProtected( SCROW nStartRow, SCROW nEndRow );
575
576
    void DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast );
577
578
    tools::Long GetNeededSize(
579
        SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY,
580
        const Fraction& rZoomX, const Fraction& rZoomY,
581
        bool bWidth, const ScNeededSizeOptions& rOptions, const ScPatternAttr** pPatternChange,
582
        bool bInPrintTwips = false ) const;
583
584
    sal_uInt16 GetOptimalColWidth(
585
        OutputDevice* pDev, double nPPTX, double nPPTY,
586
        const Fraction& rZoomX, const Fraction& rZoomY,
587
        bool bFormula, sal_uInt16 nOldWidth, const ScMarkData* pMarkData, const ScColWidthParam* pParam) const;
588
589
    void GetOptimalHeight(
590
        sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow, sal_uInt16 nMinHeight, SCROW nMinStart );
591
592
    void GetFilterEntries(
593
        sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow,
594
        ScFilterEntries& rFilterEntries, bool bFiltering, bool bFilteredRow );
595
596
    void GetBackColorFilterEntries(SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries );
597
598
    bool GetDataEntries( SCROW nRow, std::set<ScTypedStrData>& rStrings) const;
599
600
    void UpdateInsertTabAbs(SCTAB nNewPos);
601
    bool    TestTabRefAbs(SCTAB nTable) const;
602
    bool    GetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& rData) const;
603
604
    void StartListeningFormulaCells(
605
        sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt, SCROW nRow1, SCROW nRow2 );
606
607
    void EndListeningFormulaCells(
608
        sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2,
609
        SCROW* pStartRow, SCROW* pEndRow );
610
611
    void        StartListening( SvtListener& rLst, SCROW nRow );
612
    void        EndListening( SvtListener& rLst, SCROW nRow );
613
    void StartListening( sc::StartListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
614
    void EndListening( sc::EndListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
615
    void StartListeningSingleRefFormulaCells( sc::StartListeningContext& rCxt, const ScSingleRefData* pRef,
616
                                const ScAddress& rAddress, ScFormulaCell** pp, ScFormulaCell** ppEnd );
617
    void StartListeners( sc::StartListeningContext& rCxt, bool bAll );
618
    void        SetDirtyIfPostponed();
619
    void BroadcastRecalcOnRefMove();
620
    void CollectListeners( std::vector<SvtListener*>& rListeners, SCROW nRow1, SCROW nRow2 );
621
    void CollectFormulaCells( std::vector<ScFormulaCell*>& rCells, SCROW nRow1, SCROW nRow2 );
622
623
    void CompileDBFormula( sc::CompileFormulaContext& rCxt );
624
    void CompileColRowNameFormula( sc::CompileFormulaContext& rCxt );
625
626
    sal_Int32   GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, rtl_TextEncoding eCharSet ) const;
627
    sal_Int32   GetMaxNumberStringLen( sal_uInt16& nPrecision,
628
                                       SCROW nRowStart, SCROW nRowEnd ) const;
629
630
    sal_uInt16 GetTextWidth(SCROW nRow) const;
631
    void SetTextWidth(SCROW nRow, sal_uInt16 nWidth);
632
633
    SvtScriptType GetScriptType( SCROW nRow ) const;
634
635
    /**
636
     * Get combined script types of the specified range. This method may
637
     * update script types on demand if they have not been determined.
638
     */
639
    SvtScriptType GetRangeScriptType( sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2,
640
            const sc::CellStoreType::iterator& itr);
641
642
    void SetScriptType( SCROW nRow, SvtScriptType nType );
643
    void UpdateScriptTypes( SCROW nRow1, SCROW nRow2 );
644
645
    formula::FormulaTokenRef ResolveStaticReference( SCROW nRow );
646
    bool ResolveStaticReference( ScMatrix& rMat, SCCOL nMatCol, SCROW nRow1, SCROW nRow2 );
647
    void FillMatrix( ScMatrix& rMat, size_t nMatCol, SCROW nRow1, SCROW nRow2, svl::SharedStringPool* pPool ) const;
648
    formula::VectorRefArray FetchVectorRefArray( SCROW nRow1, SCROW nRow2 );
649
    bool HandleRefArrayForParallelism( SCROW nRow1, SCROW nRow2,
650
                                       const ScFormulaCellGroupRef& mxGroup, ScAddress* pDirtiedAddress );
651
#ifdef DBG_UTIL
652
    void AssertNoInterpretNeeded( SCROW nRow1, SCROW nRow2 );
653
#endif
654
    void SetFormulaResults( SCROW nRow, const double* pResults, size_t nLen );
655
656
    void CalculateInThread( ScInterpreterContext& rContext, SCROW nRow, size_t nLen, size_t nOffset,
657
                            unsigned nThisThread, unsigned nThreadsTotal );
658
    void HandleStuffAfterParallelCalculation( SCROW nRow, size_t nLen, ScInterpreter* pInterpreter );
659
660
    void SetNumberFormat( SCROW nRow, sal_uInt32 nNumberFormat );
661
662
    SvtBroadcaster* GetBroadcaster( SCROW nRow );
663
    const SvtBroadcaster* GetBroadcaster( SCROW nRow ) const;
664
665
    void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2 );
666
    void PrepareBroadcastersForDestruction();
667
    void DeleteEmptyBroadcasters();
668
669
    void Broadcast( SCROW nRow );
670
    void BroadcastCells( const std::vector<SCROW>& rRows, SfxHintId nHint );
671
    void BroadcastRows( SCROW nStartRow, SCROW nEndRow, SfxHintId nHint );
672
673
    // Spaklines
674
    sc::SparklineCell* GetSparklineCell(SCROW nRow);
675
    void CreateSparklineCell(SCROW nRow, std::shared_ptr<sc::Sparkline> const& pSparkline);
676
    void DeleteSparklineCells(sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2);
677
    bool DeleteSparkline(SCROW nRow);
678
    bool IsSparklinesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
679
    void CopyCellSparklinesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, SCROW nRowOffsetDest = 0) const;
680
    void DuplicateSparklines(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol,
681
                             sc::ColumnBlockPosition& rDestBlockPos, SCROW nRowOffsetDest = 0) const;
682
    bool HasSparklines() const;
683
    SCROW GetSparklinesMaxRow() const;
684
    SCROW GetSparklinesMinRow() const;
685
686
    // cell notes
687
    ScPostIt* GetCellNote( SCROW nRow );
688
    const ScPostIt* GetCellNote( SCROW nRow ) const;
689
    ScPostIt* GetCellNote( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow );
690
    const ScPostIt* GetCellNote( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
691
    void DeleteCellNotes( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2, bool bForgetCaptionOwnership );
692
    bool HasCellNote(SCROW nStartRow, SCROW nEndRow) const;
693
    bool HasCellNotes() const;
694
    void SetCellNote( SCROW nRow, std::unique_ptr<ScPostIt> pNote);
695
    bool IsNotesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
696
697
    std::unique_ptr<ScPostIt> ReleaseNote( SCROW nRow );
698
    size_t GetNoteCount() const;
699
    void CreateAllNoteCaptions();
700
    void ForgetNoteCaptions( SCROW nRow1, SCROW nRow2, bool bPreserveData );
701
    SCROW GetNotePosition( size_t nIndex ) const;
702
    void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
703
    void GetNotesInRange( SCROW nStartRow, SCROW nEndRow, std::vector<sc::NoteEntry>& rNotes ) const;
704
705
    SCROW GetCellNotesMaxRow() const;
706
    SCROW GetCellNotesMinRow() const;
707
708
    void CopyCellNotesToDocument(
709
        SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, bool bCloneCaption = true,
710
        SCROW nRowOffsetDest = 0) const;
711
712
    void DuplicateNotes(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol,
713
                            sc::ColumnBlockPosition& rDestBlockPos, bool bCloneCaption, SCROW nRowOffsetDest = 0) const;
714
715
    void UpdateNoteCaptions( SCROW nRow1, SCROW nRow2, bool bAddressChanged = true );
716
    void CommentNotifyAddressChange( SCROW nRow1, SCROW nRow2 );
717
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;
721
722
    void InterpretDirtyCells( SCROW nRow1, SCROW nRow2 );
723
    bool InterpretCellsIfNeeded( SCROW nRow1, SCROW nRow2 );
724
725
    static void JoinNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell );
726
727
    /**
728
     * Detach a formula cell that's about to be deleted, or removed from
729
     * document storage (if that ever happens).
730
     *
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.
734
     */
735
    void DetachFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell,
736
                            std::vector<SCROW>& rNewSharedRows );
737
738
    /** Re-establish listeners on unshared formula groups */
739
    void StartListeningUnshared( const std::vector<SCROW>& rNewSharedRows );
740
741
    void DetachFormulaCells( const sc::CellStoreType::position_type& aPos, size_t nLength,
742
                             std::vector<SCROW>* pNewSharedRows );
743
744
    void AttachFormulaCells( sc::StartListeningContext& rCxt, SCROW nRow1, SCROW nRow2 );
745
    void DetachFormulaCells( sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2 );
746
747
    /**
748
     * Regroup formula cells for the entire column.
749
     */
750
    void RegroupFormulaCells( std::vector<ScAddress>* pGroupPos = nullptr );
751
752
    /**
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.
759
     *
760
     * Caller needs to ensure that no formula groups cross the top and bottom
761
     * row boundaries.
762
     *
763
     * @param nRow1 top row boundary
764
     * @param nRow2 bottom row boundary
765
     * @param bUpdateRefs whether to adjust references
766
     */
767
    void ResetFormulaCellPositions( SCROW nRow1, SCROW nRow2, bool bUpdateRefs );
768
769
    void SplitFormulaGroupByRelativeRef( const ScRange& rBoundRange );
770
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 );
775
776
    void SwapNonEmpty(
777
        sc::TableValues& rValues, sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt );
778
779
    std::optional<sc::ColumnIterator> GetColumnIterator( SCROW nRow1, SCROW nRow2 ) const;
780
781
    bool EnsureFormulaCellResults( SCROW nRow1, SCROW nRow2, bool bSkipRunning = false );
782
783
    void StoreToCache(SvStream& rStrm) const;
784
    void RestoreFromCache(SvStream& rStrm);
785
786
#if DUMP_COLUMN_STORAGE
787
    void DumpColumnStorage() const;
788
#endif
789
790
    SCSIZE      GetPatternCount() const;
791
    SCSIZE      GetPatternCount( SCROW nRow1, SCROW nRow2 ) const;
792
    bool        ReservePatternCount( SCSIZE nReserve );
793
794
    void CheckIntegrity() const;
795
796
private:
797
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 );
802
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 );
807
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 );
812
813
public:
814
    void AttachNewFormulaCells(const sc::CellStoreType::position_type& aPos, size_t nLength,
815
                               std::vector<SCROW>& rNewSharedRows);
816
817
private:
818
    void BroadcastNewCell( SCROW nRow );
819
    bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, sc::CellStoreType::iterator& itr );
820
821
    const ScFormulaCell* FetchFormulaCell( SCROW nRow ) const;
822
823
    SCROW FindNextVisibleRowWithContent(
824
        sc::CellStoreType::const_iterator& itPos, SCROW nRow, bool bForward) const;
825
    SCROW FindNextVisibleRow(SCROW nRow, bool bForward) const;
826
827
    OUString GetString( const ScRefCellValue& cell, SCROW nRow, ScInterpreterContext* pContext = nullptr ) const;
828
    OUString GetInputString( const ScRefCellValue& cell, SCROW nRow, bool bForceSystemLocale = false ) const;
829
830
    /**
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.
833
     *
834
     * Call this only from those methods where maCells is modified directly.
835
     */
836
    void CellStorageModified();
837
    void CellNotesDeleting(SCROW nRow1, SCROW nRow2, bool bForgetCaptionOwnership );
838
839
    void CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) const;
840
841
    struct DeleteCellsResult
842
    {
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;
847
848
        DeleteCellsResult( const ScDocument& rDoc );
849
        DeleteCellsResult( const DeleteCellsResult& ) = delete;
850
    };
851
852
    std::unique_ptr<DeleteCellsResult> DeleteCells(
853
        sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nDelFlag );
854
855
    /**
856
     * Get all non-grouped formula cells and formula cell groups in the whole
857
     * column.
858
     */
859
    std::vector<sc::FormulaGroupEntry> GetFormulaGroupEntries();
860
861
    void EndListeningIntersectedGroup(
862
        sc::EndListeningContext& rCxt, SCROW nRow, std::vector<ScAddress>* pGroupPos );
863
864
    void EndListeningIntersectedGroups(
865
        sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2, std::vector<ScAddress>* pGroupPos );
866
867
    void EndListeningGroup( sc::EndListeningContext& rCxt, SCROW nRow );
868
    void SetNeedsListeningGroup( SCROW nRow );
869
870
    void CollectBroadcasterState(sc::BroadcasterState& rState) const;
871
};
872
873
inline bool ScColumn::IsEmptyAttr() const
874
0
{
875
0
    return pAttrArray->IsEmpty();
876
0
}
877
878
inline bool ScColumnData::IsAllAttrEqual( const ScColumnData& rCol, SCROW nStartRow, SCROW nEndRow ) const
879
0
{
880
0
    return pAttrArray->IsAllEqual( *rCol.pAttrArray, nStartRow, nEndRow );
881
0
}
882
883
inline bool ScColumn::IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const
884
196k
{
885
196k
    return pAttrArray->IsVisibleEqual( *rCol.pAttrArray, nStartRow, nEndRow );
886
196k
}
887
888
inline bool ScColumn::GetFirstVisibleAttr( SCROW& rFirstRow ) const
889
0
{
890
0
    return pAttrArray->GetFirstVisibleAttr( rFirstRow );
891
0
}
892
893
inline bool ScColumn::GetLastVisibleAttr( SCROW& rLastRow, bool bSkipEmpty ) const
894
2.00M
{
895
    // row of last cell is needed
896
2.00M
    SCROW nLastData = GetLastDataPos();    // always including notes, 0 if none
897
2.00M
    return pAttrArray->GetLastVisibleAttr( rLastRow, nLastData, bSkipEmpty );
898
2.00M
}
899
900
inline bool ScColumn::HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const
901
0
{
902
0
    return pAttrArray->HasVisibleAttrIn( nStartRow, nEndRow );
903
0
}
904
905
inline SCSIZE ScColumn::GetPatternCount() const
906
0
{
907
0
    return pAttrArray->Count();
908
0
}
909
910
inline SCSIZE ScColumn::GetPatternCount( SCROW nRow1, SCROW nRow2 ) const
911
0
{
912
0
    return pAttrArray->Count( nRow1, nRow2 );
913
0
}
914
915
inline bool ScColumn::ReservePatternCount( SCSIZE nReserve )
916
0
{
917
0
    return pAttrArray && pAttrArray->Reserve( nReserve );
918
0
}
919
920
inline bool ScColumn::IsMerged( SCROW nRow ) const
921
0
{
922
0
    return pAttrArray->IsMerged(nRow);
923
0
}
924
925
inline SCROW ScColumnData::GetNextUnprotected( SCROW nRow, bool bUp ) const
926
0
{
927
0
    return pAttrArray->GetNextUnprotected(nRow, bUp);
928
0
}
929
930
inline bool ScColumnData::HasAttrib( SCROW nRow1, SCROW nRow2, HasAttrFlags nMask ) const
931
442k
{
932
442k
    return pAttrArray->HasAttrib( nRow1, nRow2, nMask );
933
442k
}
934
935
inline bool ScColumnData::HasAttrib( SCROW nRow, HasAttrFlags nMask, SCROW* nStartRow, SCROW* nEndRow ) const
936
0
{
937
0
    return pAttrArray->HasAttrib( nRow, nMask, nStartRow, nEndRow );
938
0
}
939
940
inline bool ScColumn::ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
941
                            SCCOL& rPaintCol, SCROW& rPaintRow,
942
                            bool bRefresh )
943
80.2k
{
944
80.2k
    return pAttrArray->ExtendMerge( nThisCol, nStartRow, nEndRow, rPaintCol, rPaintRow, bRefresh );
945
80.2k
}
946
947
inline void ScColumnData::MergePatternArea( ScMergePatternState& rState, SCROW nRow1, SCROW nRow2, bool bDeep ) const
948
18.4k
{
949
18.4k
    pAttrArray->MergePatternArea( nRow1, nRow2, rState, bDeep );
950
18.4k
}
951
952
inline void ScColumn::MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
953
                            ScLineFlags& rFlags,
954
                            SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight ) const
955
0
{
956
0
    pAttrArray->MergeBlockFrame( pLineOuter, pLineInner, rFlags, nStartRow, nEndRow, bLeft, nDistRight );
957
0
}
958
959
inline void ScColumn::ApplyBlockFrame(const SvxBoxItem& rLineOuter, const SvxBoxInfoItem* pLineInner,
960
                               SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight)
961
3.95k
{
962
3.95k
    pAttrArray->ApplyBlockFrame(rLineOuter, pLineInner, nStartRow, nEndRow, bLeft, nDistRight);
963
3.95k
}
964
965
inline const ScPatternAttr* ScColumnData::GetPattern( SCROW nRow ) const
966
94.9M
{
967
94.9M
    return pAttrArray->GetPattern( nRow );
968
94.9M
}
969
970
inline const SfxPoolItem& ScColumnData::GetAttr( SCROW nRow, sal_uInt16 nWhich ) const
971
52.4k
{
972
52.4k
    return pAttrArray->GetPattern( nRow )->GetItem(nWhich);
973
52.4k
}
974
975
inline const SfxPoolItem& ScColumnData::GetAttr( SCROW nRow, sal_uInt16 nWhich, SCROW& nStartRow, SCROW& nEndRow ) const
976
0
{
977
0
    return pAttrArray->GetPatternRange( nStartRow, nEndRow, nRow )->GetItem(nWhich);
978
0
}
979
980
inline sal_uInt32 ScColumnData::GetNumberFormat( const ScInterpreterContext& rContext, SCROW nRow ) const
981
4.45M
{
982
4.45M
    return pAttrArray->GetPattern( nRow )->GetNumberFormat( rContext );
983
4.45M
}
984
985
inline void ScColumn::AddCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex )
986
2.80M
{
987
2.80M
    pAttrArray->AddCondFormat( nStartRow, nEndRow, nIndex );
988
2.80M
}
989
990
inline void ScColumn::RemoveCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex )
991
0
{
992
0
    pAttrArray->RemoveCondFormat( nStartRow, nEndRow, nIndex );
993
0
}
994
995
inline void ScColumnData::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle )
996
1.47M
{
997
1.47M
    pAttrArray->ApplyStyleArea(nStartRow, nEndRow, rStyle);
998
1.47M
}
999
1000
inline const ScStyleSheet* ScColumnData::GetStyle( SCROW nRow ) const
1001
0
{
1002
0
    return pAttrArray->GetPattern( nRow )->GetStyleSheet();
1003
0
}
1004
1005
inline void ScColumn::FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBoolRowSegments& rUsedRows, bool bReset )
1006
27.3k
{
1007
27.3k
    pAttrArray->FindStyleSheet( pStyleSheet, rUsedRows, bReset );
1008
27.3k
}
1009
1010
inline bool ScColumn::IsStyleSheetUsed( const ScStyleSheet& rStyle ) const
1011
0
{
1012
0
    return pAttrArray->IsStyleSheetUsed( rStyle );
1013
0
}
1014
1015
inline bool ScColumn::ApplyFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags )
1016
19.9M
{
1017
19.9M
    return pAttrArray->ApplyFlags( nStartRow, nEndRow, nFlags );
1018
19.9M
}
1019
1020
inline bool ScColumn::RemoveFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags )
1021
1.24k
{
1022
1.24k
    return pAttrArray->RemoveFlags( nStartRow, nEndRow, nFlags );
1023
1.24k
}
1024
1025
inline void ScColumn::ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich )
1026
0
{
1027
0
    pAttrArray->ClearItems( nStartRow, nEndRow, pWhich );
1028
0
}
1029
1030
inline void ScColumn::SetPattern( SCROW nRow, const CellAttributeHolder& rHolder )
1031
896k
{
1032
896k
    return pAttrArray->SetPattern( nRow, rHolder );
1033
896k
}
1034
1035
inline void ScColumn::SetPattern( SCROW nRow, const ScPatternAttr& rPattern )
1036
0
{
1037
0
    pAttrArray->SetPattern( nRow, CellAttributeHolder(&rPattern) );
1038
0
}
1039
1040
inline void ScColumn::SetPatternArea( SCROW nStartRow, SCROW nEndRow, const CellAttributeHolder& rHolder )
1041
0
{
1042
0
    pAttrArray->SetPatternArea( nStartRow, nEndRow, rHolder );
1043
0
}
1044
1045
inline void ScColumnData::SetAttrEntries(std::vector<ScAttrEntry> && vNewData)
1046
1.70M
{
1047
1.70M
    pAttrArray->SetAttrEntries( std::move( vNewData ));
1048
1.70M
}
1049
1050
inline bool ScColumnData::TestInsertRow( SCSIZE nSize ) const
1051
0
{
1052
0
    return pAttrArray->TestInsertRow( nSize );
1053
0
}
1054
1055
inline void ScColumnData::InsertRow( SCROW nStartRow, SCSIZE nSize )
1056
0
{
1057
0
    pAttrArray->InsertRow( nStartRow, nSize );
1058
0
}
1059
1060
inline void ScColumnData::DeleteRow(SCROW nStartRow, SCSIZE nSize)
1061
0
{
1062
0
    pAttrArray->DeleteRow( nStartRow, nSize );
1063
0
}
1064
1065
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */