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