1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <tools/gen.hxx>
23 #include <tools/color.hxx>
24 #include "attarray.hxx"
26 #include "colcontainer.hxx"
27 #include "sortparam.hxx"
29 #include "cellvalue.hxx"
30 #include <formula/types.hxx>
31 #include "calcmacros.hxx"
32 #include <formula/errorcodes.hxx>
33 #include "document.hxx"
34 #include "drwlayer.hxx"
35 #include "SparklineList.hxx"
44 template <typename A
, typename D
> class ScBitMaskCompressedArray
;
45 template <typename A
, typename D
> class ScCompressedArray
;
51 namespace com::sun::star
{
53 struct TablePageBreakData
;
57 namespace formula
{ struct VectorRefArray
; }
60 class StartListeningContext
;
61 class EndListeningContext
;
62 class CopyFromClipContext
;
63 class CopyToClipContext
;
64 class CopyToDocContext
;
67 class RangeColumnSpanSet
;
69 struct ColumnBlockPosition
;
70 class TableColumnBlockPositionSet
;
71 struct RefUpdateContext
;
72 struct RefUpdateInsertTabContext
;
73 struct RefUpdateDeleteTabContext
;
74 struct RefUpdateMoveTabContext
;
76 class DocumentStreamAccess
;
79 class RowHeightContext
;
80 class CompileFormulaContext
;
81 struct SetFormulaDirtyContext
;
87 class SfxStyleSheetBase
;
92 class ScAutoFormatData
;
93 class ScEditDataArray
;
96 class ScPrintSaverTab
;
100 class ScSortInfoArray
;
101 class ScConditionalFormat
;
102 class ScConditionalFormatList
;
104 class ScTableProtection
;
105 class ScUserListData
;
107 class ScFunctionData
;
108 class CollatorWrapper
;
109 class ScFlatUInt16RowSegments
;
110 class ScFlatBoolRowSegments
;
111 class ScFlatBoolColSegments
;
112 struct ScSetStringParam
;
113 struct ScColWidthParam
;
118 struct ScInterpreterContext
;
121 class ScColumnsRange final
128 typedef std::input_iterator_tag iterator_category
;
129 typedef SCCOL value_type
;
130 typedef SCCOL difference_type
;
131 typedef const SCCOL
* pointer
;
132 typedef SCCOL reference
;
134 explicit Iterator(SCCOL nCol
) : mCol(nCol
) {}
136 Iterator
& operator++() { ++mCol
; return *this;}
137 Iterator
& operator--() { --mCol
; return *this;}
139 // Comparing iterators from different containers is undefined, so comparing mCol is enough.
140 bool operator==(const Iterator
& rOther
) const {return mCol
== rOther
.mCol
;}
141 bool operator!=(const Iterator
& rOther
) const {return !(*this == rOther
);}
142 SCCOL
operator*() const {return mCol
;}
145 ScColumnsRange(SCCOL nBegin
, SCCOL nEnd
) : maBegin(nBegin
), maEnd(nEnd
) {}
146 const Iterator
& begin() { return maBegin
; }
147 const Iterator
& end() { return maEnd
; }
148 std::reverse_iterator
<Iterator
> rbegin() { return std::reverse_iterator
<Iterator
>(maEnd
); }
149 std::reverse_iterator
<Iterator
> rend() { return std::reverse_iterator
<Iterator
>(maBegin
); }
151 const Iterator maBegin
;
152 const Iterator maEnd
;
158 typedef ::std::vector
< ScRange
> ScRangeVec
;
170 sal_uLong nLinkRefreshDelay
;
171 ScLinkMode nLinkMode
;
173 // page style template
175 Size aPageSizeTwips
; // size of the print-page
176 SCCOL nRepeatStartX
; // repeating rows/columns
177 SCCOL nRepeatEndX
; // REPEAT_NONE, if not used
181 // last used col and row
182 bool mbCellAreaDirty
;
183 bool mbCellAreaEmpty
;
187 std::unique_ptr
<ScTableProtection
> pTabProtection
;
189 std::unique_ptr
<ScCompressedArray
<SCCOL
, sal_uInt16
>> mpColWidth
;
190 std::unique_ptr
<ScFlatUInt16RowSegments
> mpRowHeights
;
192 std::unique_ptr
<ScBitMaskCompressedArray
<SCCOL
, CRFlags
>> mpColFlags
;
193 std::unique_ptr
<ScBitMaskCompressedArray
< SCROW
, CRFlags
>> pRowFlags
;
194 std::unique_ptr
<ScFlatBoolColSegments
> mpHiddenCols
;
195 std::unique_ptr
<ScFlatBoolRowSegments
> mpHiddenRows
;
196 std::unique_ptr
<ScFlatBoolColSegments
> mpFilteredCols
;
197 std::unique_ptr
<ScFlatBoolRowSegments
> mpFilteredRows
;
199 ::std::set
<SCROW
> maRowPageBreaks
;
200 ::std::set
<SCROW
> maRowManualBreaks
;
201 ::std::set
<SCCOL
> maColPageBreaks
;
202 ::std::set
<SCCOL
> maColManualBreaks
;
204 std::unique_ptr
<ScOutlineTable
> pOutlineTable
;
206 std::unique_ptr
<ScSheetEvents
> pSheetEvents
;
208 mutable SCCOL nTableAreaX
;
209 mutable SCROW nTableAreaY
;
210 mutable SCCOL nTableAreaVisibleX
;
211 mutable SCROW nTableAreaVisibleY
;
214 ScDocument
& rDocument
;
215 std::unique_ptr
<utl::TextSearch
> pSearchText
;
217 mutable OUString aUpperName
; // #i62977# filled only on demand, reset in SetName
219 // sort parameter to minimize stack size of quicksort
220 ScSortParam aSortParam
;
221 CollatorWrapper
* pSortCollator
;
223 ScRangeVec aPrintRanges
;
225 std::unique_ptr
<ScRange
> pRepeatColRange
;
226 std::unique_ptr
<ScRange
> pRepeatRowRange
;
228 sal_uInt16 nLockCount
;
230 std::unique_ptr
<ScRangeList
> pScenarioRanges
;
231 Color aScenarioColor
;
233 ScScenarioFlags nScenarioFlags
;
234 std::unique_ptr
<ScDBData
> pDBDataNoName
;
235 mutable std::unique_ptr
<ScRangeName
> mpRangeName
;
237 std::unique_ptr
<ScConditionalFormatList
> mpCondFormatList
;
238 sc::SparklineList maSparklineList
;
240 ScAddress maLOKFreezeCell
;
245 bool bPageSizeValid
:1;
246 mutable bool bTableAreaValid
:1;
247 mutable bool bTableAreaVisibleValid
:1;
249 bool bPendingRowHeights
:1;
250 bool bCalcNotification
:1;
251 bool bGlobalKeepQuery
:1;
252 bool bPrintEntireSheet
:1;
253 bool bActiveScenario
:1;
254 bool mbPageBreaksValid
:1;
255 bool mbForceBreaks
:1;
256 /** this is touched from formula group threading context */
257 std::atomic
<bool> bStreamValid
;
259 // Default attributes for the unallocated columns.
260 ScColumnData aDefaultColData
;
262 friend class ScDocument
; // for FillInfo
263 friend class ScColumn
;
264 friend class ScValueIterator
;
265 friend class ScHorizontalValueIterator
;
266 friend class ScDBQueryDataIterator
;
267 friend class ScFormulaGroupIterator
;
268 friend class ScCellIterator
;
269 friend class ScQueryCellIterator
;
270 friend class ScCountIfCellIterator
;
271 friend class ScHorizontalCellIterator
;
272 friend class ScColumnTextWidthIterator
;
273 friend class ScDocumentImport
;
274 friend class sc::DocumentStreamAccess
;
275 friend class sc::ColumnSpanSet
;
276 friend class sc::RangeColumnSpanSet
;
277 friend class sc::EditTextIterator
;
278 friend class sc::FormulaGroupAreaListener
;
281 ScTable( ScDocument
& rDoc
, SCTAB nNewTab
, const OUString
& rNewName
,
282 bool bColInfo
= true, bool bRowInfo
= true );
283 ~ScTable() COVERITY_NOEXCEPT_FALSE
;
284 ScTable(const ScTable
&) = delete;
285 ScTable
& operator=(const ScTable
&) = delete;
287 ScDocument
& GetDoc() { return rDocument
;}
288 const ScDocument
& GetDoc() const { return rDocument
;}
289 SCTAB
GetTab() const { return nTab
; }
291 ScOutlineTable
* GetOutlineTable() { return pOutlineTable
.get(); }
293 ScColumn
& CreateColumnIfNotExists( const SCCOL nScCol
)
295 if ( nScCol
>= aCol
.size() )
296 CreateColumnIfNotExistsImpl(nScCol
);
299 // out-of-line the cold part of the function
300 void CreateColumnIfNotExistsImpl( const SCCOL nScCol
);
301 sal_uInt64
GetCellCount() const;
302 sal_uInt64
GetWeightedCount() const;
303 sal_uInt64
GetWeightedCount(SCROW nStartRow
, SCROW nEndRow
) const;
304 sal_uInt64
GetCodeCount() const; // RPN code in formula
306 sal_uInt16
GetTextWidth(SCCOL nCol
, SCROW nRow
) const;
308 bool SetOutlineTable( const ScOutlineTable
* pNewOutline
);
309 void StartOutlineTable();
311 void DoAutoOutline( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
);
313 bool TestRemoveSubTotals( const ScSubTotalParam
& rParam
);
314 void RemoveSubTotals( ScSubTotalParam
& rParam
);
315 bool DoSubTotals( ScSubTotalParam
& rParam
);
317 const ScSheetEvents
* GetSheetEvents() const { return pSheetEvents
.get(); }
318 void SetSheetEvents( std::unique_ptr
<ScSheetEvents
> pNew
);
320 bool IsVisible() const { return bVisible
; }
321 void SetVisible( bool bVis
);
323 bool IsStreamValid() const { return bStreamValid
; }
324 void SetStreamValid( bool bSet
, bool bIgnoreLock
= false );
326 [[nodiscard
]] bool IsColValid( const SCCOL nScCol
) const
328 return nScCol
>= static_cast< SCCOL
>( 0 ) && nScCol
< aCol
.size();
330 [[nodiscard
]] bool IsColRowValid( const SCCOL nScCol
, const SCROW nScRow
) const
332 return IsColValid( nScCol
) && GetDoc().ValidRow( nScRow
);
334 [[nodiscard
]] bool IsColRowTabValid( const SCCOL nScCol
, const SCROW nScRow
, const SCTAB nScTab
) const
336 return IsColValid( nScCol
) && GetDoc().ValidRow( nScRow
) && ValidTab( nScTab
);
338 [[nodiscard
]] bool ValidCol(SCCOL nCol
) const { return GetDoc().ValidCol(nCol
); }
339 [[nodiscard
]] bool ValidRow(SCROW nRow
) const { return GetDoc().ValidRow(nRow
); }
340 [[nodiscard
]] bool ValidColRow(SCCOL nCol
, SCROW nRow
) const { return GetDoc().ValidColRow(nCol
, nRow
); }
342 bool IsPendingRowHeights() const { return bPendingRowHeights
; }
343 void SetPendingRowHeights( bool bSet
);
345 bool GetCalcNotification() const { return bCalcNotification
; }
346 void SetCalcNotification( bool bSet
);
348 bool IsLayoutRTL() const { return bLayoutRTL
; }
349 bool IsLoadingRTL() const { return bLoadingRTL
; }
350 void SetLayoutRTL( bool bSet
);
351 void SetLoadingRTL( bool bSet
);
353 bool IsScenario() const { return bScenario
; }
354 void SetScenario( bool bFlag
);
355 void GetScenarioComment( OUString
& rComment
) const { rComment
= aComment
; }
356 void SetScenarioComment( const OUString
& rComment
) { aComment
= rComment
; }
357 const Color
& GetScenarioColor() const { return aScenarioColor
; }
358 void SetScenarioColor(const Color
& rNew
) { aScenarioColor
= rNew
; }
359 const Color
& GetTabBgColor() const { return aTabBgColor
; }
360 void SetTabBgColor(const Color
& rColor
);
361 ScScenarioFlags
GetScenarioFlags() const { return nScenarioFlags
; }
362 void SetScenarioFlags(ScScenarioFlags nNew
) { nScenarioFlags
= nNew
; }
363 void SetActiveScenario(bool bSet
) { bActiveScenario
= bSet
; }
364 bool IsActiveScenario() const { return bActiveScenario
; }
366 ScLinkMode
GetLinkMode() const { return nLinkMode
; }
367 bool IsLinked() const { return nLinkMode
!= ScLinkMode::NONE
; }
368 const OUString
& GetLinkDoc() const { return aLinkDoc
; }
369 const OUString
& GetLinkFlt() const { return aLinkFlt
; }
370 const OUString
& GetLinkOpt() const { return aLinkOpt
; }
371 const OUString
& GetLinkTab() const { return aLinkTab
; }
372 sal_uLong
GetLinkRefreshDelay() const { return nLinkRefreshDelay
; }
374 void SetLink( ScLinkMode nMode
, const OUString
& rDoc
, const OUString
& rFlt
,
375 const OUString
& rOpt
, const OUString
& rTab
, sal_uLong nRefreshDelay
);
377 sal_Int64
GetHashCode () const;
379 const OUString
& GetName() const { return aName
; }
380 void SetName( const OUString
& rNewName
);
382 void SetAnonymousDBData(std::unique_ptr
<ScDBData
> pDBData
);
383 ScDBData
* GetAnonymousDBData() { return pDBDataNoName
.get();}
385 const OUString
& GetCodeName() const { return aCodeName
; }
386 void SetCodeName( const OUString
& rNewName
) { aCodeName
= rNewName
; }
388 const OUString
& GetUpperName() const;
390 const OUString
& GetPageStyle() const { return aPageStyle
; }
391 void SetPageStyle( const OUString
& rName
);
392 void PageStyleModified( const OUString
& rNewName
);
394 bool IsProtected() const;
395 void SetProtection(const ScTableProtection
* pProtect
);
396 const ScTableProtection
* GetProtection() const;
397 void GetUnprotectedCells( ScRangeList
& rRangeList
) const;
399 bool IsEditActionAllowed( sc::ColRowEditAction eAction
, SCCOLROW nStart
, SCCOLROW nEnd
) const;
401 Size
GetPageSize() const;
402 void SetPageSize( const Size
& rSize
);
403 void SetRepeatArea( SCCOL nStartCol
, SCCOL nEndCol
, SCROW nStartRow
, SCROW nEndRow
);
408 bool IsBlockEditable( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
,
409 SCROW nRow2
, bool* pOnlyNotBecauseOfMatrix
= nullptr,
410 bool bNoMatrixAtAll
= false ) const;
411 bool IsSelectionEditable( const ScMarkData
& rMark
,
412 bool* pOnlyNotBecauseOfMatrix
= nullptr ) const;
414 bool HasBlockMatrixFragment( const SCCOL nCol1
, SCROW nRow1
, const SCCOL nCol2
, SCROW nRow2
,
415 bool bNoMatrixAtAll
= false ) const;
416 bool HasSelectionMatrixFragment( const ScMarkData
& rMark
) const;
418 bool IsBlockEmpty( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, bool bIgnoreNotes
) const;
420 bool SetString( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const OUString
& rString
,
421 const ScSetStringParam
* pParam
= nullptr );
423 bool SetEditText( SCCOL nCol
, SCROW nRow
, std::unique_ptr
<EditTextObject
> pEditText
);
424 void SetEditText( SCCOL nCol
, SCROW nRow
, const EditTextObject
& rEditText
, const SfxItemPool
* pEditPool
);
425 SCROW
GetFirstEditTextRow( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
) const;
427 void SetEmptyCell( SCCOL nCol
, SCROW nRow
);
429 SCCOL nCol
, SCROW nRow
, const ScTokenArray
& rArray
, formula::FormulaGrammar::Grammar eGram
);
431 SCCOL nCol
, SCROW nRow
, const OUString
& rFormula
, formula::FormulaGrammar::Grammar eGram
);
434 * Takes ownership of pCell
436 * @return pCell if it was successfully inserted, NULL otherwise. pCell
437 * is deleted automatically on failure to insert.
439 ScFormulaCell
* SetFormulaCell( SCCOL nCol
, SCROW nRow
, ScFormulaCell
* pCell
);
441 bool SetFormulaCells( SCCOL nCol
, SCROW nRow
, std::vector
<ScFormulaCell
*>& rCells
);
443 bool HasFormulaCell( const SCCOL nCol1
, SCROW nRow1
, const SCCOL nCol2
, SCROW nRow2
) const;
445 svl::SharedString
GetSharedString( SCCOL nCol
, SCROW nRow
) const;
447 void SetValue( SCCOL nCol
, SCROW nRow
, const double& rVal
);
448 void SetValues( const SCCOL nCol
, const SCROW nRow
, const std::vector
<double>& rVals
);
449 void SetError( SCCOL nCol
, SCROW nRow
, FormulaError nError
);
450 SCSIZE
GetPatternCount( SCCOL nCol
) const;
451 SCSIZE
GetPatternCount( SCCOL nCol
, SCROW nRow1
, SCROW nRow2
) const;
452 bool ReservePatternCount( SCCOL nCol
, SCSIZE nReserve
);
454 void SetRawString( SCCOL nCol
, SCROW nRow
, const svl::SharedString
& rStr
);
455 OUString
GetString( SCCOL nCol
, SCROW nRow
, const ScInterpreterContext
* pContext
= nullptr ) const;
456 double* GetValueCell( SCCOL nCol
, SCROW nRow
);
457 // Note that if pShared is set and a value is returned that way, the returned OUString is empty.
458 OUString
GetInputString( SCCOL nCol
, SCROW nRow
, const svl::SharedString
** pShared
= nullptr ) const;
459 double GetValue( SCCOL nCol
, SCROW nRow
) const;
460 const EditTextObject
* GetEditText( SCCOL nCol
, SCROW nRow
) const;
461 void RemoveEditTextCharAttribs( SCCOL nCol
, SCROW nRow
, const ScPatternAttr
& rAttr
);
462 OUString
GetFormula( SCCOL nCol
, SCROW nRow
) const;
463 const ScFormulaCell
* GetFormulaCell( SCCOL nCol
, SCROW nRow
) const;
464 ScFormulaCell
* GetFormulaCell( SCCOL nCol
, SCROW nRow
);
466 CellType
GetCellType( const ScAddress
& rPos
) const
468 if (!GetDoc().ValidColRow(rPos
.Col(),rPos
.Row()))
469 return CELLTYPE_NONE
;
470 if (rPos
.Col() >= aCol
.size())
471 return CELLTYPE_NONE
;
472 return aCol
[rPos
.Col()].GetCellType( rPos
.Row() );
474 CellType
GetCellType( SCCOL nCol
, SCROW nRow
) const;
475 ScRefCellValue
GetCellValue( SCCOL nCol
, sc::ColumnBlockPosition
& rBlockPos
, SCROW nRow
);
476 ScRefCellValue
GetCellValue( SCCOL nCol
, SCROW nRow
) const;
478 void GetFirstDataPos(SCCOL
& rCol
, SCROW
& rRow
) const;
479 void GetLastDataPos(SCCOL
& rCol
, SCROW
& rRow
) const;
483 std::shared_ptr
<sc::Sparkline
> GetSparkline(SCCOL nCol
, SCROW nRow
);
484 sc::Sparkline
* CreateSparkline(SCCOL nCol
, SCROW nRow
, std::shared_ptr
<sc::SparklineGroup
> const& pSparklineGroup
);
485 bool DeleteSparkline(SCCOL nCol
, SCROW nRow
);
487 sc::SparklineList
& GetSparklineList();
488 void CopySparklinesToTable(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, ScTable
* pDestTab
);
489 void FillSparkline(bool bVertical
, SCCOLROW nFixed
, SCCOLROW nIteratingStart
, SCCOLROW nIteratingEnd
, SCCOLROW nFillStart
, SCCOLROW nFillEnd
);
492 std::unique_ptr
<ScPostIt
> ReleaseNote( SCCOL nCol
, SCROW nRow
);
493 ScPostIt
* GetNote( SCCOL nCol
, SCROW nRow
);
494 void SetNote( SCCOL nCol
, SCROW nRow
, std::unique_ptr
<ScPostIt
> pNote
);
496 size_t GetNoteCount( SCCOL nCol
) const;
497 SCROW
GetNotePosition( SCCOL nCol
, size_t nIndex
) const;
498 void CreateAllNoteCaptions();
499 void ForgetNoteCaptions( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, bool bPreserveData
);
501 void GetAllNoteEntries( std::vector
<sc::NoteEntry
>& rNotes
) const;
502 void GetNotesInRange( const ScRange
& rRange
, std::vector
<sc::NoteEntry
>& rNotes
) const;
503 CommentCaptionState
GetAllNoteCaptionsState( const ScRange
& rRange
, std::vector
<sc::NoteEntry
>& rNotes
);
504 bool ContainsNotesInRange( const ScRange
& rRange
) const;
506 bool TestInsertRow( SCCOL nStartCol
, SCCOL nEndCol
, SCROW nStartRow
, SCSIZE nSize
) const;
507 void InsertRow( SCCOL nStartCol
, SCCOL nEndCol
, SCROW nStartRow
, SCSIZE nSize
);
509 const sc::ColumnSet
& rRegroupCols
, SCCOL nStartCol
, SCCOL nEndCol
, SCROW nStartRow
, SCSIZE nSize
,
510 bool* pUndoOutline
, std::vector
<ScAddress
>* pGroupPos
);
512 bool TestInsertCol( SCROW nStartRow
, SCROW nEndRow
, SCSIZE nSize
) const;
514 const sc::ColumnSet
& rRegroupCols
, SCCOL nStartCol
, SCROW nStartRow
, SCROW nEndRow
, SCSIZE nSize
);
516 const sc::ColumnSet
& rRegroupCols
, SCCOL nStartCol
, SCROW nStartRow
, SCROW nEndRow
, SCSIZE nSize
, bool* pUndoOutline
);
519 SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, InsertDeleteFlags nDelFlag
,
520 bool bBroadcast
= true, sc::ColumnSpanSet
* pBroadcastSpans
= nullptr );
522 void CopyToClip( sc::CopyToClipContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, ScTable
* pTable
);
523 void CopyToClip( sc::CopyToClipContext
& rCxt
, const ScRangeList
& rRanges
, ScTable
* pTable
);
525 void CopyStaticToDocument(
526 SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, const SvNumberFormatterMergeMap
& rMap
,
529 void CopyCellToDocument( SCCOL nSrcCol
, SCROW nSrcRow
, SCCOL nDestCol
, SCROW nDestRow
, ScTable
& rDestTab
);
531 bool InitColumnBlockPosition( sc::ColumnBlockPosition
& rBlockPos
, SCCOL nCol
);
533 void DeleteBeforeCopyFromClip(
534 sc::CopyFromClipContext
& rCxt
, const ScTable
& rClipTab
, sc::ColumnSpanSet
& rBroadcastSpans
);
536 void CopyOneCellFromClip(
537 sc::CopyFromClipContext
& rCxt
, const SCCOL nCol1
, const SCROW nRow1
,
538 const SCCOL nCol2
, const SCROW nRow2
,
539 const SCROW nSrcRow
, const ScTable
* pSrcTab
);
542 sc::CopyFromClipContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
543 SCCOL nDx
, SCROW nDy
, ScTable
* pTable
);
545 void StartListeningFormulaCells(
546 sc::StartListeningContext
& rStartCxt
, sc::EndListeningContext
& rEndCxt
,
547 SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
549 void SetDirtyFromClip(
550 SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, sc::ColumnSpanSet
& rBroadcastSpans
);
553 sc::CopyToDocContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
554 InsertDeleteFlags nFlags
, bool bMarked
, ScTable
* pDestTab
,
555 const ScMarkData
* pMarkData
, bool bAsLink
, bool bColRowFlags
,
556 bool bGlobalNamesToLocal
, bool bCopyCaptions
);
558 void CopyCaptionsToTable( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, ScTable
* pDestTab
, bool bCloneCaption
);
561 sc::CopyToDocContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
562 InsertDeleteFlags nFlags
, bool bMarked
, ScTable
* pDestTab
);
564 void CopyConditionalFormat( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
565 SCCOL nDx
, SCROW nDy
, const ScTable
* pTable
);
567 * @param nCombinedStartRow start row of the combined range;
568 * used for transposed multi range selection with row direction;
569 * for other cases than multi range row selection this it equal to nRow1
570 * @param nRowDestOffset adjustment of destination row position;
571 * used for transposed multi range selection with row direction, otherwise 0
573 void TransposeClip(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, SCROW nCombinedStartRow
,
574 SCROW nRowDestOffset
, ScTable
* pTransClip
, InsertDeleteFlags nFlags
,
575 bool bAsLink
, bool bIncludeFiltered
);
577 // mark of this document
579 sc::MixDocContext
& rCxt
, const ScMarkData
& rMark
, ScPasteFunc nFunction
,
580 bool bSkipEmpty
, const ScTable
* pSrcTab
);
583 sc::MixDocContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
584 ScPasteFunc nFunction
, bool bSkipEmpty
, const ScTable
* pSrcTab
);
586 void CopyData( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
587 SCCOL nDestCol
, SCROW nDestRow
, SCTAB nDestTab
);
589 void CopyScenarioFrom( const ScTable
* pSrcTab
);
590 void CopyScenarioTo( ScTable
* pDestTab
) const;
591 bool TestCopyScenarioTo( const ScTable
* pDestTab
) const;
592 void MarkScenarioIn(ScMarkData
& rMark
, ScScenarioFlags nNeededBits
) const;
593 bool HasScenarioRange( const ScRange
& rRange
) const;
594 void InvalidateScenarioRanges();
595 const ScRangeList
* GetScenarioRanges() const;
597 void CopyUpdated( const ScTable
* pPosTab
, ScTable
* pDestTab
) const;
599 void InvalidateTableArea();
600 void InvalidatePageBreaks();
602 void InvalidateCellArea() { mbCellAreaDirty
= true; }
603 bool GetCellArea( SCCOL
& rEndCol
, SCROW
& rEndRow
); // FALSE = empty
604 bool GetTableArea( SCCOL
& rEndCol
, SCROW
& rEndRow
, bool bCalcHiddens
= false) const;
605 bool GetPrintArea( SCCOL
& rEndCol
, SCROW
& rEndRow
, bool bNotes
, bool bCalcHiddens
= false) const;
606 bool GetPrintAreaHor( SCROW nStartRow
, SCROW nEndRow
,
607 SCCOL
& rEndCol
) const;
608 bool GetPrintAreaVer( SCCOL nStartCol
, SCCOL nEndCol
,
609 SCROW
& rEndRow
, bool bNotes
) const;
611 bool GetDataStart( SCCOL
& rStartCol
, SCROW
& rStartRow
) const;
613 void ExtendPrintArea( OutputDevice
* pDev
,
614 SCCOL nStartCol
, SCROW nStartRow
, SCCOL
& rEndCol
, SCROW nEndRow
);
616 void GetDataArea( SCCOL
& rStartCol
, SCROW
& rStartRow
, SCCOL
& rEndCol
, SCROW
& rEndRow
,
617 bool bIncludeOld
, bool bOnlyDown
) const;
619 bool GetDataAreaSubrange( ScRange
& rRange
) const;
621 bool ShrinkToUsedDataArea( bool& o_bShrunk
, SCCOL
& rStartCol
, SCROW
& rStartRow
,
622 SCCOL
& rEndCol
, SCROW
& rEndRow
, bool bColumnsOnly
,
623 bool bStickyTopRow
, bool bStickyLeftCol
,
624 ScDataAreaExtras
* pDataAreaExtras
) const;
626 SCROW
GetLastDataRow( SCCOL nCol1
, SCCOL nCol2
, SCROW nLastRow
,
627 ScDataAreaExtras
* pDataAreaExtras
= nullptr ) const;
629 bool IsEmptyBlock(SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
) const;
630 SCSIZE
GetEmptyLinesInBlock( SCCOL nStartCol
, SCROW nStartRow
,
631 SCCOL nEndCol
, SCROW nEndRow
, ScDirection eDir
) const;
633 void FindAreaPos( SCCOL
& rCol
, SCROW
& rRow
, ScMoveDirection eDirection
) const;
634 void GetNextPos( SCCOL
& rCol
, SCROW
& rRow
, SCCOL nMovX
, SCROW nMovY
,
635 bool bMarked
, bool bUnprotected
, const ScMarkData
& rMark
, SCCOL nTabStartCol
) const;
637 bool SkipRow( const SCCOL rCol
, SCROW
& rRow
, const SCROW nMovY
, const ScMarkData
& rMark
,
638 const bool bUp
, const SCROW nUsedY
, const bool bMarked
, const bool bSheetProtected
) const;
639 void LimitChartArea( SCCOL
& rStartCol
, SCROW
& rStartRow
, SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
641 bool HasData( SCCOL nCol
, SCROW nRow
) const;
642 bool HasStringData( SCCOL nCol
, SCROW nRow
) const;
643 bool HasValueData( SCCOL nCol
, SCROW nRow
) const;
644 bool HasStringCells( SCCOL nStartCol
, SCROW nStartRow
,
645 SCCOL nEndCol
, SCROW nEndRow
) const;
647 sc::MultiDataCellState
HasMultipleDataCells( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
) const;
649 FormulaError
GetErrCode( const ScAddress
& rPos
) const
651 return IsColRowValid(rPos
.Col(),rPos
.Row()) ?
652 aCol
[rPos
.Col()].GetErrCode( rPos
.Row() ) :
656 void ResetChanged( const ScRange
& rRange
);
658 void CheckVectorizationState();
659 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext
& rCxt
);
660 void SetDirty( const ScRange
&, ScColumn::BroadcastMode
);
661 void SetDirtyAfterLoad();
663 void SetTableOpDirty( const ScRange
& );
665 void CalcAfterLoad( sc::CompileFormulaContext
& rCxt
, bool bStartListening
);
666 void CompileAll( sc::CompileFormulaContext
& rCxt
);
667 void CompileXML( sc::CompileFormulaContext
& rCxt
, ScProgress
& rProgress
);
669 /** Broadcast single broadcasters in range, without explicitly setting
670 anything dirty, not doing area broadcasts.
671 @param rHint address is modified to adapt to the actual broadcasted
672 position on each iteration and upon return points to the last
673 position broadcasted. */
674 bool BroadcastBroadcasters( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, SfxHintId nHint
);
676 bool CompileErrorCells( sc::CompileFormulaContext
& rCxt
, FormulaError nErrCode
);
678 void UpdateReference(
679 sc::RefUpdateContext
& rCxt
, ScDocument
* pUndoDoc
= nullptr,
680 bool bIncludeDraw
= true, bool bUpdateNoteCaptionPos
= true );
682 void UpdateDrawRef( UpdateRefMode eUpdateRefMode
, SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
683 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
,
684 SCCOL nDx
, SCROW nDy
, SCTAB nDz
, bool bUpdateNoteCaptionPos
= true );
686 void UpdateTranspose( const ScRange
& rSource
, const ScAddress
& rDest
,
687 ScDocument
* pUndoDoc
);
689 void UpdateGrow( const ScRange
& rArea
, SCCOL nGrowX
, SCROW nGrowY
);
691 void UpdateInsertTab( sc::RefUpdateInsertTabContext
& rCxt
);
692 void UpdateDeleteTab( sc::RefUpdateDeleteTabContext
& rCxt
);
693 void UpdateMoveTab( sc::RefUpdateMoveTabContext
& rCxt
, SCTAB nTabNo
, ScProgress
* pProgress
);
694 void UpdateCompile( bool bForceIfNameInUse
= false );
695 void SetTabNo(SCTAB nNewTab
);
696 void FindRangeNamesInUse(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
697 sc::UpdatedRangeNames
& rIndexes
) const;
698 void Fill( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
699 sal_uInt64 nFillCount
, FillDir eFillDir
, FillCmd eFillCmd
, FillDateCmd eFillDateCmd
,
700 double nStepValue
, double nMaxValue
, ScProgress
* pProgress
);
701 OUString
GetAutoFillPreview( const ScRange
& rSource
, SCCOL nEndX
, SCROW nEndY
);
703 void UpdateSelectionFunction( ScFunctionData
& rData
, const ScMarkData
& rMark
);
705 void AutoFormat( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
706 sal_uInt16 nFormatNo
);
707 void GetAutoFormatData(SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
, ScAutoFormatData
& rData
);
708 bool SearchAndReplace(
709 const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
, const ScMarkData
& rMark
,
710 ScRangeList
& rMatchedRanges
, OUString
& rUndoStr
, ScDocument
* pUndoDoc
, bool& bMatchedRangesWereClamped
);
712 void FindMaxRotCol( RowInfo
* pRowInfo
, SCSIZE nArrCount
, SCCOL nX1
, SCCOL nX2
);
714 bool HasAttrib( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, HasAttrFlags nMask
) const;
715 bool HasAttribSelection( const ScMarkData
& rMark
, HasAttrFlags nMask
) const;
716 bool HasAttrib( SCCOL nCol
, SCROW nRow
, HasAttrFlags nMask
,
717 SCROW
* nStartRow
= nullptr, SCROW
* nEndRow
= nullptr ) const;
718 bool IsMerged( SCCOL nCol
, SCROW nRow
) const;
719 bool ExtendMerge( SCCOL nStartCol
, SCROW nStartRow
,
720 SCCOL
& rEndCol
, SCROW
& rEndRow
,
722 void SetMergedCells( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
724 const SfxPoolItem
* GetAttr( SCCOL nCol
, SCROW nRow
, sal_uInt16 nWhich
) const;
725 template<class T
> const T
* GetAttr( SCCOL nCol
, SCROW nRow
, TypedWhichId
<T
> nWhich
) const
727 return static_cast<const T
*>(GetAttr(nCol
, nRow
, sal_uInt16(nWhich
)));
729 const SfxPoolItem
* GetAttr( SCCOL nCol
, SCROW nRow
, sal_uInt16 nWhich
, SCROW
& nStartRow
, SCROW
& nEndRow
) const;
730 template<class T
> const T
* GetAttr( SCCOL nCol
, SCROW nRow
, TypedWhichId
<T
> nWhich
, SCROW
& nStartRow
, SCROW
& nEndRow
) const
732 return static_cast<const T
*>(GetAttr(nCol
, nRow
, sal_uInt16(nWhich
), nStartRow
, nEndRow
));
734 const ScPatternAttr
* GetPattern( SCCOL nCol
, SCROW nRow
) const;
735 const ScPatternAttr
* GetMostUsedPattern( SCCOL nCol
, SCROW nStartRow
, SCROW nEndRow
) const;
737 sal_uInt32
GetNumberFormat( const ScInterpreterContext
& rContext
, const ScAddress
& rPos
) const;
738 sal_uInt32
GetNumberFormat( SCCOL nCol
, SCROW nRow
) const;
739 sal_uInt32
GetNumberFormat( SCCOL nCol
, SCROW nStartRow
, SCROW nEndRow
) const;
741 void SetNumberFormat( SCCOL nCol
, SCROW nRow
, sal_uInt32 nNumberFormat
);
743 void MergeSelectionPattern( ScMergePatternState
& rState
,
744 const ScMarkData
& rMark
, bool bDeep
) const;
745 void MergePatternArea( ScMergePatternState
& rState
, SCCOL nCol1
, SCROW nRow1
,
746 SCCOL nCol2
, SCROW nRow2
, bool bDeep
) const;
747 void MergeBlockFrame( SvxBoxItem
* pLineOuter
, SvxBoxInfoItem
* pLineInner
,
749 SCCOL nStartCol
, SCROW nStartRow
,
750 SCCOL nEndCol
, SCROW nEndRow
) const;
751 void ApplyBlockFrame(const SvxBoxItem
& rLineOuter
,
752 const SvxBoxInfoItem
* pLineInner
,
753 SCCOL nStartCol
, SCROW nStartRow
,
754 SCCOL nEndCol
, SCROW nEndRow
);
756 void ApplyAttr( SCCOL nCol
, SCROW nRow
, const SfxPoolItem
& rAttr
);
757 void ApplyPattern( SCCOL nCol
, SCROW nRow
, const ScPatternAttr
& rAttr
);
758 void ApplyPatternArea( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
759 const ScPatternAttr
& rAttr
, ScEditDataArray
* pDataArray
= nullptr,
760 bool* const pIsChanged
= nullptr );
761 void SetAttrEntries( SCCOL nStartCol
, SCCOL nEndCol
, std::vector
<ScAttrEntry
> && vNewData
);
763 void SetPattern( const ScAddress
& rPos
, const ScPatternAttr
& rAttr
);
764 const ScPatternAttr
* SetPattern( SCCOL nCol
, SCROW nRow
, std::unique_ptr
<ScPatternAttr
> );
765 void SetPattern( SCCOL nCol
, SCROW nRow
, const ScPatternAttr
& rAttr
);
766 void ApplyPatternIfNumberformatIncompatible( const ScRange
& rRange
,
767 const ScPatternAttr
& rPattern
, SvNumFormatType nNewType
);
768 void AddCondFormatData( const ScRangeList
& rRange
, sal_uInt32 nIndex
);
769 void RemoveCondFormatData( const ScRangeList
& rRange
, sal_uInt32 nIndex
);
770 void SetPatternAreaCondFormat( SCCOL nCol
, SCROW nStartRow
, SCROW nEndRow
,
771 const ScPatternAttr
& rAttr
, const ScCondFormatIndexes
& rCondFormatIndexes
);
773 void ApplyStyle( SCCOL nCol
, SCROW nRow
, const ScStyleSheet
* rStyle
);
774 void ApplyStyleArea( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
, const ScStyleSheet
& rStyle
);
775 void ApplySelectionStyle(const ScStyleSheet
& rStyle
, const ScMarkData
& rMark
);
776 void ApplySelectionLineStyle( const ScMarkData
& rMark
,
777 const ::editeng::SvxBorderLine
* pLine
, bool bColorOnly
);
779 const ScStyleSheet
* GetStyle( SCCOL nCol
, SCROW nRow
) const;
780 const ScStyleSheet
* GetSelectionStyle( const ScMarkData
& rMark
, bool& rFound
) const;
781 const ScStyleSheet
* GetAreaStyle( bool& rFound
, SCCOL nCol1
, SCROW nRow1
,
782 SCCOL nCol2
, SCROW nRow2
) const;
784 void StyleSheetChanged( const SfxStyleSheetBase
* pStyleSheet
, bool bRemoved
,
786 double nPPTX
, double nPPTY
,
787 const Fraction
& rZoomX
, const Fraction
& rZoomY
);
789 bool IsStyleSheetUsed( const ScStyleSheet
& rStyle
) const;
791 bool ApplyFlags( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
, ScMF nFlags
);
792 bool RemoveFlags( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
, ScMF nFlags
);
794 void ApplySelectionCache( SfxItemPoolCache
* pCache
, const ScMarkData
& rMark
, ScEditDataArray
* pDataArray
= nullptr, bool* const pIsChanged
= nullptr );
795 void DeleteSelection( InsertDeleteFlags nDelFlag
, const ScMarkData
& rMark
, bool bBroadcast
= true );
797 void ClearSelectionItems( const sal_uInt16
* pWhich
, const ScMarkData
& rMark
);
798 void ChangeSelectionIndent( bool bIncrement
, const ScMarkData
& rMark
);
800 const ScRange
* GetRepeatColRange() const { return pRepeatColRange
.get(); }
801 const ScRange
* GetRepeatRowRange() const { return pRepeatRowRange
.get(); }
802 void SetRepeatColRange( std::unique_ptr
<ScRange
> pNew
);
803 void SetRepeatRowRange( std::unique_ptr
<ScRange
> pNew
);
805 sal_uInt16
GetPrintRangeCount() const { return static_cast< sal_uInt16
>( aPrintRanges
.size() ); }
806 const ScRange
* GetPrintRange(sal_uInt16 nPos
) const;
807 /** Returns true, if the sheet is always printed. */
808 bool IsPrintEntireSheet() const { return bPrintEntireSheet
; }
810 /** Removes all print ranges. */
811 void ClearPrintRanges();
812 /** Adds a new print ranges. */
813 void AddPrintRange( const ScRange
& rNew
);
814 /** Marks the specified sheet to be printed completely. Deletes old print ranges! */
815 void SetPrintEntireSheet();
817 void FillPrintSaver( ScPrintSaverTab
& rSaveTab
) const;
818 void RestorePrintRanges( const ScPrintSaverTab
& rSaveTab
);
820 sal_uInt16
GetOptimalColWidth( SCCOL nCol
, OutputDevice
* pDev
,
821 double nPPTX
, double nPPTY
,
822 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
823 bool bFormula
, const ScMarkData
* pMarkData
,
824 const ScColWidthParam
* pParam
);
825 bool SetOptimalHeight(
826 sc::RowHeightContext
& rCxt
, SCROW nStartRow
, SCROW nEndRow
, bool bApi
,
827 ScProgress
* pOuterProgress
= nullptr, sal_uInt64 nProgressStart
= 0 );
829 void SetOptimalHeightOnly(
830 sc::RowHeightContext
& rCxt
, SCROW nStartRow
, SCROW nEndRow
,
831 ScProgress
* pOuterProgress
= nullptr, sal_uInt64 nProgressStart
= 0 );
833 tools::Long
GetNeededSize( SCCOL nCol
, SCROW nRow
,
835 double nPPTX
, double nPPTY
,
836 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
837 bool bWidth
, bool bTotalSize
,
838 bool bInPrintTwips
= false);
839 void SetColWidth( SCCOL nCol
, sal_uInt16 nNewWidth
);
840 void SetColWidthOnly( SCCOL nCol
, sal_uInt16 nNewWidth
);
841 void SetRowHeight( SCROW nRow
, sal_uInt16 nNewHeight
);
842 bool SetRowHeightRange( SCROW nStartRow
, SCROW nEndRow
, sal_uInt16 nNewHeight
,
843 double nPPTY
, bool bApi
);
846 * Set specified row height to specified ranges. Don't check for drawing
847 * objects etc. Just set the row height. Nothing else.
849 * Note that setting a new row height via this function will not
850 * invalidate page breaks.
852 void SetRowHeightOnly( SCROW nStartRow
, SCROW nEndRow
, sal_uInt16 nNewHeight
);
854 // nPPT to test for modification
855 void SetManualHeight( SCROW nStartRow
, SCROW nEndRow
, bool bManual
);
857 sal_uInt16
GetColWidth( SCCOL nCol
, bool bHiddenAsZero
= true ) const;
858 tools::Long
GetColWidth( SCCOL nStartCol
, SCCOL nEndCol
) const;
859 sal_uInt16
GetRowHeight( SCROW nRow
, SCROW
* pStartRow
, SCROW
* pEndRow
, bool bHiddenAsZero
= true ) const;
860 tools::Long
GetRowHeight( SCROW nStartRow
, SCROW nEndRow
, bool bHiddenAsZero
= true ) const;
861 tools::Long
GetScaledRowHeight( SCROW nStartRow
, SCROW nEndRow
, double fScale
, const tools::Long
* pnMaxHeight
= nullptr ) const;
862 tools::Long
GetColOffset( SCCOL nCol
, bool bHiddenAsZero
= true ) const;
863 tools::Long
GetRowOffset( SCROW nRow
, bool bHiddenAsZero
= true ) const;
866 * Get the last row such that the height of row 0 to the end row is as
867 * high as possible without exceeding the specified height value.
869 * @param nHeight maximum desired height
871 * @return SCROW last row of the range within specified height.
873 SCROW
GetRowForHeight(tools::Long nHeight
) const;
875 sal_uInt16
GetOriginalWidth( SCCOL nCol
) const;
876 sal_uInt16
GetOriginalHeight( SCROW nRow
) const;
878 sal_uInt16
GetCommonWidth( SCCOL nEndCol
) const;
880 SCROW
GetHiddenRowCount( SCROW nRow
) const;
882 void ShowCol(SCCOL nCol
, bool bShow
);
883 void ShowRow(SCROW nRow
, bool bShow
);
884 void DBShowRow(SCROW nRow
, bool bShow
);
886 void ShowRows(SCROW nRow1
, SCROW nRow2
, bool bShow
);
887 void DBShowRows(SCROW nRow1
, SCROW nRow2
, bool bShow
);
889 void SetRowFlags( SCROW nRow
, CRFlags nNewFlags
);
890 void SetRowFlags( SCROW nStartRow
, SCROW nEndRow
, CRFlags nNewFlags
);
892 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
893 SCROW
GetLastFlaggedRow() const;
895 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
896 SCCOL
GetLastChangedColFlagsWidth() const;
897 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
898 SCROW
GetLastChangedRowFlagsWidth() const;
900 bool IsDataFiltered(SCCOL nColStart
, SCROW nRowStart
, SCCOL nColEnd
, SCROW nRowEnd
) const;
901 bool IsDataFiltered(const ScRange
& rRange
) const;
902 CRFlags
GetColFlags( SCCOL nCol
) const;
903 CRFlags
GetRowFlags( SCROW nRow
) const;
905 const ScBitMaskCompressedArray
< SCROW
, CRFlags
> * GetRowFlagsArray() const
906 { return pRowFlags
.get(); }
908 bool UpdateOutlineCol( SCCOL nStartCol
, SCCOL nEndCol
, bool bShow
);
909 bool UpdateOutlineRow( SCROW nStartRow
, SCROW nEndRow
, bool bShow
);
911 void UpdatePageBreaks( const ScRange
* pUserArea
);
912 void RemoveManualBreaks();
913 bool HasManualBreaks() const;
914 void SetRowManualBreaks( ::std::set
<SCROW
>&& rBreaks
);
915 void SetColManualBreaks( ::std::set
<SCCOL
>&& rBreaks
);
917 void GetAllRowBreaks(::std::set
<SCROW
>& rBreaks
, bool bPage
, bool bManual
) const;
918 void GetAllColBreaks(::std::set
<SCCOL
>& rBreaks
, bool bPage
, bool bManual
) const;
919 bool HasRowPageBreak(SCROW nRow
) const;
920 bool HasColPageBreak(SCCOL nCol
) const;
921 bool HasRowManualBreak(SCROW nRow
) const;
922 bool HasColManualBreak(SCCOL nCol
) const;
925 * Get the row position of the next manual break that occurs at or below
926 * specified row. When no more manual breaks are present at or below
927 * the specified row, -1 is returned.
929 * @param nRow row at which the search begins.
931 * @return SCROW next row position with manual page break, or -1 if no
932 * more manual breaks are present.
934 SCROW
GetNextManualBreak(SCROW nRow
) const;
936 void RemoveRowPageBreaks(SCROW nStartRow
, SCROW nEndRow
);
937 void RemoveRowBreak(SCROW nRow
, bool bPage
, bool bManual
);
938 void RemoveColBreak(SCCOL nCol
, bool bPage
, bool bManual
);
939 void SetRowBreak(SCROW nRow
, bool bPage
, bool bManual
);
940 void SetColBreak(SCCOL nCol
, bool bPage
, bool bManual
);
942 css::sheet::TablePageBreakData
> GetRowBreakData() const;
944 bool RowHidden(SCROW nRow
, SCROW
* pFirstRow
= nullptr, SCROW
* pLastRow
= nullptr) const;
945 bool RowHiddenLeaf(SCROW nRow
, SCROW
* pFirstRow
= nullptr, SCROW
* pLastRow
= nullptr) const;
946 bool HasHiddenRows(SCROW nStartRow
, SCROW nEndRow
) const;
947 bool ColHidden(SCCOL nCol
, SCCOL
* pFirstCol
= nullptr, SCCOL
* pLastCol
= nullptr) const;
948 bool SetRowHidden(SCROW nStartRow
, SCROW nEndRow
, bool bHidden
);
949 void SetColHidden(SCCOL nStartCol
, SCCOL nEndCol
, bool bHidden
);
950 void CopyColHidden(const ScTable
& rTable
, SCCOL nStartCol
, SCCOL nEndCol
);
951 void CopyRowHidden(const ScTable
& rTable
, SCROW nStartRow
, SCROW nEndRow
);
952 void CopyRowHeight(const ScTable
& rSrcTable
, SCROW nStartRow
, SCROW nEndRow
, SCROW nSrcOffset
);
953 SCROW
FirstVisibleRow(SCROW nStartRow
, SCROW nEndRow
) const;
954 SCROW
LastVisibleRow(SCROW nStartRow
, SCROW nEndRow
) const;
955 SCROW
CountVisibleRows(SCROW nStartRow
, SCROW nEndRow
) const;
956 tools::Long
GetTotalRowHeight(SCROW nStartRow
, SCROW nEndRow
, bool bHiddenAsZero
= true) const;
958 SCCOLROW
LastHiddenColRow(SCCOLROW nPos
, bool bCol
) const;
960 bool RowFiltered(SCROW nRow
, SCROW
* pFirstRow
= nullptr, SCROW
* pLastRow
= nullptr) const;
961 bool ColFiltered(SCCOL nCol
, SCCOL
* pFirstCol
= nullptr, SCCOL
* pLastCol
= nullptr) const;
962 bool HasFilteredRows(SCROW nStartRow
, SCROW nEndRow
) const;
963 void CopyColFiltered(const ScTable
& rTable
, SCCOL nStartCol
, SCCOL nEndCol
);
964 void CopyRowFiltered(const ScTable
& rTable
, SCROW nStartRow
, SCROW nEndRow
);
965 void SetRowFiltered(SCROW nStartRow
, SCROW nEndRow
, bool bFiltered
);
966 void SetColFiltered(SCCOL nStartCol
, SCCOL nEndCol
, bool bFiltered
);
967 SCROW
FirstNonFilteredRow(SCROW nStartRow
, SCROW nEndRow
) const;
968 SCROW
LastNonFilteredRow(SCROW nStartRow
, SCROW nEndRow
) const;
969 SCROW
CountNonFilteredRows(SCROW nStartRow
, SCROW nEndRow
) const;
971 bool IsManualRowHeight(SCROW nRow
) const;
973 bool HasUniformRowHeight( SCROW nRow1
, SCROW nRow2
) const;
975 void SyncColRowFlags();
977 void StripHidden( SCCOL
& rX1
, SCROW
& rY1
, SCCOL
& rX2
, SCROW
& rY2
);
978 void ExtendHidden( SCCOL
& rX1
, SCROW
& rY1
, SCCOL
& rX2
, SCROW
& rY2
);
980 /** Sort a range of data. */
982 const ScSortParam
& rSortParam
, bool bKeepQuery
, bool bUpdateRefs
,
983 ScProgress
* pProgress
, sc::ReorderParam
* pUndo
);
985 void Reorder( const sc::ReorderParam
& rParam
);
987 // For ValidQuery() see ScQueryEvalutor class.
988 void TopTenQuery( ScQueryParam
& );
989 void PrepareQuery( ScQueryParam
& rQueryParam
);
990 SCSIZE
Query(const ScQueryParam
& rQueryParam
, bool bKeepSub
);
991 bool CreateQueryParam(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, ScQueryParam
& rQueryParam
);
993 void GetFilterEntries(SCCOL nCol
, SCROW nRow1
, SCROW nRow2
, ScFilterEntries
& rFilterEntries
, bool bFiltering
= false);
994 void GetFilteredFilterEntries(SCCOL nCol
, SCROW nRow1
, SCROW nRow2
, const ScQueryParam
& rParam
, ScFilterEntries
& rFilterEntries
, bool bFiltering
);
996 bool GetDataEntries(SCCOL nCol
, SCROW nRow
, std::set
<ScTypedStrData
>& rStrings
);
998 bool HasColHeader( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
) const;
999 bool HasRowHeader( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
) const;
1001 sal_Int32
GetMaxStringLen( SCCOL nCol
,
1002 SCROW nRowStart
, SCROW nRowEnd
, rtl_TextEncoding eCharSet
) const;
1003 sal_Int32
GetMaxNumberStringLen( sal_uInt16
& nPrecision
,
1005 SCROW nRowStart
, SCROW nRowEnd
) const;
1007 bool IsSortCollatorGlobal() const;
1008 void InitSortCollator( const ScSortParam
& rPar
);
1009 void DestroySortCollator();
1010 void SetDrawPageSize( bool bResetStreamValid
= true, bool bUpdateNoteCaptionPos
= true,
1011 const ScObjectHandling eObjectHandling
= ScObjectHandling::RecalcPosMode
);
1013 void SetRangeName(std::unique_ptr
<ScRangeName
> pNew
);
1014 ScRangeName
* GetRangeName() const;
1016 void PreprocessRangeNameUpdate(
1017 sc::EndListeningContext
& rEndListenCxt
, sc::CompileFormulaContext
& rCompileCxt
);
1019 void CompileHybridFormula(
1020 sc::StartListeningContext
& rStartListenCxt
, sc::CompileFormulaContext
& rCompileCxt
);
1022 void PreprocessDBDataUpdate(
1023 sc::EndListeningContext
& rEndListenCxt
, sc::CompileFormulaContext
& rCompileCxt
);
1025 ScConditionalFormatList
* GetCondFormList();
1026 const ScConditionalFormatList
* GetCondFormList() const;
1027 void SetCondFormList( ScConditionalFormatList
* pList
);
1029 void DeleteConditionalFormat(sal_uLong nOldIndex
);
1031 sal_uLong
AddCondFormat( std::unique_ptr
<ScConditionalFormat
> pNew
);
1033 SvtScriptType
GetScriptType( SCCOL nCol
, SCROW nRow
) const;
1034 void SetScriptType( SCCOL nCol
, SCROW nRow
, SvtScriptType nType
);
1035 void UpdateScriptTypes( const SCCOL nCol1
, SCROW nRow1
, const SCCOL nCol2
, SCROW nRow2
);
1037 SvtScriptType
GetRangeScriptType( sc::ColumnBlockPosition
& rBlockPos
, SCCOL nCol
, SCROW nRow1
, SCROW nRow2
);
1039 formula::FormulaTokenRef
ResolveStaticReference( SCCOL nCol
, SCROW nRow
);
1040 formula::FormulaTokenRef
ResolveStaticReference( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
1041 formula::VectorRefArray
FetchVectorRefArray( SCCOL nCol
, SCROW nRow1
, SCROW nRow2
);
1042 bool HandleRefArrayForParallelism( SCCOL nCol
, SCROW nRow1
, SCROW nRow2
, const ScFormulaCellGroupRef
& mxGroup
);
1044 void AssertNoInterpretNeeded( SCCOL nCol
, SCROW nRow1
, SCROW nRow2
);
1047 void SplitFormulaGroups( SCCOL nCol
, std::vector
<SCROW
>& rRows
);
1048 void UnshareFormulaCells( SCCOL nCol
, std::vector
<SCROW
>& rRows
);
1049 void RegroupFormulaCells( SCCOL nCol
);
1051 ScRefCellValue
GetRefCellValue( SCCOL nCol
, SCROW nRow
);
1052 ScRefCellValue
GetRefCellValue( SCCOL nCol
, SCROW nRow
, sc::ColumnBlockPosition
& rBlockPos
);
1054 SvtBroadcaster
* GetBroadcaster( SCCOL nCol
, SCROW nRow
);
1055 const SvtBroadcaster
* GetBroadcaster( SCCOL nCol
, SCROW nRow
) const;
1056 void DeleteBroadcasters( sc::ColumnBlockPosition
& rBlockPos
, SCCOL nCol
, SCROW nRow1
, SCROW nRow2
);
1058 void FillMatrix( ScMatrix
& rMat
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, svl::SharedStringPool
* pPool
) const;
1060 void InterpretDirtyCells( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
1061 void InterpretCellsIfNeeded( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
1063 void SetFormulaResults( SCCOL nCol
, SCROW nRow
, const double* pResults
, size_t nLen
);
1065 void CalculateInColumnInThread( ScInterpreterContext
& rContext
, SCCOL nColStart
, SCCOL nColEnd
,
1066 SCROW nRowStart
, SCROW nRowEnd
, unsigned nThisThread
, unsigned nThreadsTotal
);
1067 void HandleStuffAfterParallelCalculation( SCCOL nColStart
, SCCOL nColEnd
, SCROW nRow
, size_t nLen
, ScInterpreter
* pInterpreter
);
1070 * Either start all formula cells as listeners unconditionally, or start
1071 * those that are marked "needs listening".
1073 * @param rCxt context object.
1074 * @param bAll when true, start all formula cells as listeners. When
1075 * false, only start those that are marked "needs listening".
1077 void StartListeners( sc::StartListeningContext
& rCxt
, bool bAll
);
1080 * Mark formula cells dirty that have the mbPostponedDirty flag set or
1081 * contain named ranges with relative references.
1083 void SetDirtyIfPostponed();
1086 * Broadcast dirty formula cells that contain functions such as CELL(),
1087 * COLUMN() or ROW() which may change its value on move.
1089 void BroadcastRecalcOnRefMove();
1091 void TransferCellValuesTo( const SCCOL nCol
, SCROW nRow
, size_t nLen
, sc::CellValues
& rDest
);
1092 void CopyCellValuesFrom( const SCCOL nCol
, SCROW nRow
, const sc::CellValues
& rSrc
);
1094 std::optional
<sc::ColumnIterator
> GetColumnIterator( SCCOL nCol
, SCROW nRow1
, SCROW nRow2
) const;
1096 bool EnsureFormulaCellResults( const SCCOL nCol1
, SCROW nRow1
, const SCCOL nCol2
, SCROW nRow2
, bool bSkipRunning
= false );
1098 void ConvertFormulaToValue(
1099 sc::EndListeningContext
& rCxt
,
1100 const SCCOL nCol1
, const SCROW nRow1
, const SCCOL nCol2
, const SCROW nRow2
,
1101 sc::TableValues
* pUndo
);
1104 sc::TableValues
& rValues
, sc::StartListeningContext
& rStartCxt
, sc::EndListeningContext
& rEndCxt
);
1106 void finalizeOutlineImport();
1108 void StoreToCache(SvStream
& rStrm
) const;
1110 void RestoreFromCache(SvStream
& rStrm
);
1112 #if DUMP_COLUMN_STORAGE
1113 void DumpColumnStorage( SCCOL nCol
) const;
1116 /** Replace behaves differently to the Search; adjust the rCol and rRow accordingly.
1118 'Replace' replaces at the 'current' position, but in order to achieve
1119 that, we have to 'shift' the rCol / rRow to the 'previous' position -
1120 what it is depends on various settings in rSearchItem.
1122 static void UpdateSearchItemAddressForReplace( const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
);
1124 ScColumnsRange
GetWritableColumnsRange(SCCOL begin
, SCCOL end
);
1125 ScColumnsRange
GetAllocatedColumnsRange(SCCOL begin
, SCCOL end
) const;
1126 ScColumnsRange
GetColumnsRange(SCCOL begin
, SCCOL end
) const;
1127 SCCOL
ClampToAllocatedColumns(SCCOL nCol
) const { return std::min(nCol
, static_cast<SCCOL
>(aCol
.size() - 1)); }
1128 SCCOL
GetAllocatedColumnsCount() const { return aCol
.size(); }
1131 * Serializes the sheet's geometry data.
1133 * @param bColumns - if true it dumps the data for columns, else it does for rows.
1134 * @param eGeomType indicates the type of data to be dumped for rows/columns.
1135 * @return the serialization of the sheet's geometry data as an OString.
1137 OString
dumpSheetGeomData(bool bColumns
, SheetGeomType eGeomType
);
1139 std::set
<SCCOL
> QueryColumnsWithFormulaCells() const;
1141 const ScColumnData
& ColumnData( SCCOL nCol
) const { return nCol
< aCol
.size() ? aCol
[ nCol
] : aDefaultColData
; }
1143 void CheckIntegrity() const;
1147 void FillFormulaVertical(
1148 const ScFormulaCell
& rSrcCell
,
1149 SCCOLROW
& rInner
, SCCOL nCol
, SCROW nRow1
, SCROW nRow2
,
1150 ScProgress
* pProgress
, sal_uInt64
& rProgress
);
1152 void FillSeriesSimple(
1153 const ScCellValue
& rSrcCell
, SCCOLROW
& rInner
, SCCOLROW nIMin
, SCCOLROW nIMax
,
1154 const SCCOLROW
& rCol
, const SCCOLROW
& rRow
, bool bVertical
, ScProgress
* pProgress
, sal_uInt64
& rProgress
);
1156 void FillAutoSimple(
1157 SCCOLROW nISrcStart
, SCCOLROW nISrcEnd
, SCCOLROW nIStart
, SCCOLROW nIEnd
,
1158 SCCOLROW
& rInner
, const SCCOLROW
& rCol
, const SCCOLROW
& rRow
,
1159 sal_uInt64 nActFormCnt
, sal_uInt64 nMaxFormCnt
,
1160 bool bHasFiltered
, bool bVertical
, bool bPositive
,
1161 ScProgress
* pProgress
, sal_uInt64
& rProgress
);
1163 void FillSeries( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1164 sal_uInt64 nFillCount
, FillDir eFillDir
, FillCmd eFillCmd
,
1165 FillDateCmd eFillDateCmd
,
1166 double nStepValue
, double nMaxValue
, sal_uInt16 nMinDigits
,
1167 bool bAttribs
, ScProgress
* pProgress
,
1168 bool bSkipOverlappedCells
= false,
1169 std::vector
<sal_Int32
>* pNonOverlappedCellIdx
= nullptr);
1170 void FillAnalyse( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1171 FillCmd
& rCmd
, FillDateCmd
& rDateCmd
,
1172 double& rInc
, sal_uInt16
& rMinDigits
,
1173 ScUserListData
*& rListData
, sal_uInt16
& rListIndex
,
1174 bool bHasFiltered
, bool& rSkipOverlappedCells
,
1175 std::vector
<sal_Int32
>& rNonOverlappedCellIdx
);
1176 void FillAuto( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
1177 sal_uInt64 nFillCount
, FillDir eFillDir
, ScProgress
* pProgress
);
1179 bool ValidNextPos( SCCOL nCol
, SCROW nRow
, const ScMarkData
& rMark
,
1180 bool bMarked
, bool bUnprotected
) const;
1182 void AutoFormatArea(SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
1183 const ScPatternAttr
& rAttr
, sal_uInt16 nFormatNo
);
1184 void GetAutoFormatAttr(SCCOL nCol
, SCROW nRow
, sal_uInt16 nIndex
, ScAutoFormatData
& rData
);
1185 void GetAutoFormatFrame(SCCOL nCol
, SCROW nRow
, sal_uInt16 nFlags
, sal_uInt16 nIndex
, ScAutoFormatData
& rData
);
1186 bool SearchCell(const SvxSearchItem
& rSearchItem
, SCCOL nCol
, sc::ColumnBlockConstPosition
& rBlockPos
, SCROW nRow
,
1187 const ScMarkData
& rMark
, OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
1188 bool Search(const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
,
1189 const ScMarkData
& rMark
, OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
1190 bool Search(const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
,
1191 SCCOL nLastCol
, SCROW nLastRow
,
1192 const ScMarkData
& rMark
, OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
1193 bool SearchAll(const SvxSearchItem
& rSearchItem
, const ScMarkData
& rMark
,
1194 ScRangeList
& rMatchedRanges
, OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
1195 bool Replace(const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
,
1196 const ScMarkData
& rMark
, OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
1198 const SvxSearchItem
& rSearchItem
, const ScMarkData
& rMark
, ScRangeList
& rMatchedRanges
,
1199 OUString
& rUndoStr
, ScDocument
* pUndoDoc
, bool& bMatchedRangesWereClamped
);
1201 bool SearchStyle(const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
,
1202 const ScMarkData
& rMark
);
1203 bool ReplaceStyle(const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
,
1204 const ScMarkData
& rMark
, bool bIsUndo
);
1205 bool SearchAllStyle(
1206 const SvxSearchItem
& rSearchItem
, const ScMarkData
& rMark
, ScRangeList
& rMatchedRanges
);
1207 bool ReplaceAllStyle(
1208 const SvxSearchItem
& rSearchItem
, const ScMarkData
& rMark
, ScRangeList
& rMatchedRanges
,
1209 ScDocument
* pUndoDoc
);
1210 bool SearchAndReplaceEmptyCells(
1211 const SvxSearchItem
& rSearchItem
,
1212 SCCOL
& rCol
, SCROW
& rRow
, const ScMarkData
& rMark
, ScRangeList
& rMatchedRanges
,
1213 OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
1214 bool SearchRangeForEmptyCell(const ScRange
& rRange
,
1215 const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
,
1216 OUString
& rUndoStr
);
1217 bool SearchRangeForAllEmptyCells(
1218 const ScRange
& rRange
, const SvxSearchItem
& rSearchItem
,
1219 ScRangeList
& rMatchedRanges
, OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
1221 // use the global sort parameter:
1222 bool IsSorted(SCCOLROW nStart
, SCCOLROW nEnd
) const;
1223 static void DecoladeRow( ScSortInfoArray
*, SCROW nRow1
, SCROW nRow2
);
1226 ScRefCellValue
& rCell1
, SCCOL nCell1Col
, SCROW nCell1Row
,
1227 ScRefCellValue
& rCell2
, SCCOL nCell2Col
, SCROW nCell2Row
) const;
1228 short Compare(SCCOLROW nIndex1
, SCCOLROW nIndex2
) const;
1229 short Compare( ScSortInfoArray
*, SCCOLROW nIndex1
, SCCOLROW nIndex2
) const;
1230 std::unique_ptr
<ScSortInfoArray
> CreateSortInfoArray( const sc::ReorderParam
& rParam
);
1231 std::unique_ptr
<ScSortInfoArray
> CreateSortInfoArray(
1232 const ScSortParam
& rSortParam
, SCCOLROW nInd1
, SCCOLROW nInd2
,
1233 bool bKeepQuery
, bool bUpdateRefs
);
1234 void QuickSort( ScSortInfoArray
*, SCCOLROW nLo
, SCCOLROW nHi
);
1235 void SortReorderByColumn( const ScSortInfoArray
* pArray
, SCROW nRow1
, SCROW nRow2
,
1236 bool bPattern
, ScProgress
* pProgress
);
1237 void SortReorderAreaExtrasByColumn( const ScSortInfoArray
* pArray
, SCROW nDataRow1
, SCROW nDataRow2
,
1238 const ScDataAreaExtras
& rDataAreaExtras
, ScProgress
* pProgress
);
1240 void SortReorderByRow( ScSortInfoArray
* pArray
, SCCOL nCol1
, SCCOL nCol2
,
1241 ScProgress
* pProgress
, bool bOnlyDataAreaExtras
);
1242 void SortReorderByRowRefUpdate( ScSortInfoArray
* pArray
, SCCOL nCol1
, SCCOL nCol2
,
1243 ScProgress
* pProgress
);
1244 void SortReorderAreaExtrasByRow( ScSortInfoArray
* pArray
, SCCOL nDataCol1
, SCCOL nDataCol2
,
1245 const ScDataAreaExtras
& rDataAreaExtras
, ScProgress
* pProgress
);
1247 bool CreateExcelQuery(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, ScQueryParam
& rQueryParam
);
1248 bool CreateStarQuery(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, ScQueryParam
& rQueryParam
);
1249 OUString
GetUpperCellString(SCCOL nCol
, SCROW nRow
);
1251 bool RefVisible(const ScFormulaCell
* pCell
);
1253 bool IsEmptyLine(SCROW nRow
, SCCOL nStartCol
, SCCOL nEndCol
) const;
1255 void IncDate(double& rVal
, sal_uInt16
& nDayOfMonth
, double nStep
, FillDateCmd eCmd
);
1257 const ScFormulaCell
* pSrcCell
, SCCOL nDestCol
, SCROW nDestRow
, bool bLast
);
1258 void UpdateInsertTabAbs(SCTAB nNewPos
);
1259 bool GetNextSpellingCell(SCCOL
& rCol
, SCROW
& rRow
, bool bInSel
,
1260 const ScMarkData
& rMark
) const;
1261 bool GetNextMarkedCell( SCCOL
& rCol
, SCROW
& rRow
, const ScMarkData
& rMark
) const;
1262 void TestTabRefAbs(SCTAB nTable
) const;
1263 void CompileDBFormula( sc::CompileFormulaContext
& rCxt
);
1264 void CompileColRowNameFormula( sc::CompileFormulaContext
& rCxt
);
1266 void StartListening( const ScAddress
& rAddress
, SvtListener
* pListener
);
1267 void EndListening( const ScAddress
& rAddress
, SvtListener
* pListener
);
1268 void StartListening( sc::StartListeningContext
& rCxt
, const ScAddress
& rAddress
, SvtListener
& rListener
);
1269 void EndListening( sc::EndListeningContext
& rCxt
, const ScAddress
& rAddress
, SvtListener
& rListener
);
1271 void AttachFormulaCells( sc::StartListeningContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
1272 void DetachFormulaCells( sc::EndListeningContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
1274 void SetLoadingMedium(bool bLoading
);
1276 SCSIZE
FillMaxRot( RowInfo
* pRowInfo
, SCSIZE nArrCount
, SCCOL nX1
, SCCOL nX2
,
1277 SCCOL nCol
, SCROW nAttrRow1
, SCROW nAttrRow2
, SCSIZE nArrY
,
1278 const ScPatternAttr
* pPattern
, const SfxItemSet
* pCondSet
);
1280 // idle calculation of OutputDevice text width for cell
1281 // also invalidates script type, broadcasts for "calc as shown"
1282 void InvalidateTextWidth( const ScAddress
* pAdrFrom
, const ScAddress
* pAdrTo
,
1283 bool bNumFormatChanged
, bool bBroadcast
);
1285 void SkipFilteredRows(SCROW
& rRow
, SCROW
& rLastNonFilteredRow
, bool bForward
);
1288 * In case the cell text goes beyond the column width, move the max column
1289 * position to the right. This is called from ExtendPrintArea.
1291 void MaybeAddExtraColumn(SCCOL
& rCol
, SCROW nRow
, OutputDevice
* pDev
, double nPPTX
, double nPPTY
);
1293 void CopyPrintRange(const ScTable
& rTable
);
1295 SCCOL
FindNextVisibleColWithContent(SCCOL nCol
, bool bRight
, SCROW nRow
) const;
1297 SCCOL
FindNextVisibleCol(SCCOL nCol
, bool bRight
) const;
1300 * Transpose clipboard patterns
1301 * @param nCombinedStartRow start row of the combined range;
1302 * used for transposed multi range selection with row direction;
1303 * for other cases than multi range row selection this it equal to nRow1
1304 * @param nRowDestOffset adjustment of destination row position;
1305 * used for transposed multi range row selections, otherwise 0
1307 void TransposeColPatterns(ScTable
* pTransClip
, SCCOL nCol1
, SCCOL nCol
, SCROW nRow1
,
1308 SCROW nRow2
, SCROW nCombinedStartRow
, bool bIncludeFiltered
,
1309 const std::vector
<SCROW
>& rFilteredRows
, SCROW nRowDestOffset
);
1312 * Transpose clipboard notes
1313 * @param nCombinedStartRow start row of the combined range;
1314 * used for transposed multi range selection with row direction;
1315 * for other cases than multi range row selection this it equal to nRow1
1316 * @param nRowDestOffset adjustment of destination row position;
1317 * used for transposed multi range row selections, otherwise 0
1319 void TransposeColNotes(ScTable
* pTransClip
, SCCOL nCol1
, SCCOL nCol
, SCROW nRow1
, SCROW nRow2
,
1320 SCROW nCombinedStartRow
, bool bIncludeFiltered
, SCROW nRowDestOffset
);
1322 ScColumn
* FetchColumn( SCCOL nCol
);
1323 const ScColumn
* FetchColumn( SCCOL nCol
) const;
1325 void EndListeningIntersectedGroup(
1326 sc::EndListeningContext
& rCxt
, SCCOL nCol
, SCROW nRow
, std::vector
<ScAddress
>* pGroupPos
);
1328 void EndListeningIntersectedGroups(
1329 sc::EndListeningContext
& rCxt
, const SCCOL nCol1
, SCROW nRow1
, const SCCOL nCol2
, SCROW nRow2
,
1330 std::vector
<ScAddress
>* pGroupPos
);
1332 void EndListeningGroup( sc::EndListeningContext
& rCxt
, const SCCOL nCol
, SCROW nRow
);
1333 void SetNeedsListeningGroup( SCCOL nCol
, SCROW nRow
);
1335 /// Returns list-of-spans representation of the column-widths/row-heights in twips encoded as an OString.
1336 OString
dumpColumnRowSizes(bool bColumns
);
1337 /// Returns list-of-spans representation of hidden/filtered states of columns/rows encoded as an OString.
1338 OString
dumpHiddenFiltered(bool bColumns
, bool bHidden
);
1339 /// Returns list-of-spans representation of the column/row groupings encoded as an OString.
1340 OString
dumpColumnRowGroups(bool bColumns
) const;
1342 SCCOL
GetLOKFreezeCol() const;
1343 SCROW
GetLOKFreezeRow() const;
1344 bool SetLOKFreezeCol(SCCOL nFreezeCol
);
1345 bool SetLOKFreezeRow(SCROW nFreezeRow
);
1348 * Use this to iterate through non-empty visible cells in a single column.
1350 class VisibleDataCellIterator
1352 static constexpr SCROW ROW_NOT_FOUND
= -1;
1355 explicit VisibleDataCellIterator(const ScDocument
& rDoc
, ScFlatBoolRowSegments
& rRowSegs
, ScColumn
& rColumn
);
1356 ~VisibleDataCellIterator();
1359 * Set the start row position. In case there is not visible data cell
1360 * at the specified row position, it will move to the position of the
1361 * first visible data cell below that point.
1363 * @return First visible data cell if found, or NULL otherwise.
1365 ScRefCellValue
reset(SCROW nRow
);
1368 * Find the next visible data cell position.
1370 * @return Next visible data cell if found, or NULL otherwise.
1372 ScRefCellValue
next();
1375 * Get the current row position.
1377 * @return Current row position, or ROW_NOT_FOUND if the iterator
1378 * doesn't point to a valid data cell position.
1380 SCROW
getRow() const { return mnCurRow
;}
1383 const ScDocument
& mrDocument
;
1384 ScFlatBoolRowSegments
& mrRowSegs
;
1386 ScRefCellValue maCell
;
1393 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */