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 .
19 #ifndef INCLUDED_SW_INC_SWTABLE_HXX
20 #define INCLUDED_SW_INC_SWTABLE_HXX
22 #include <tools/ref.hxx>
23 #include "tblenum.hxx"
24 #include "swtypes.hxx"
27 #include "swtblfmt.hxx"
29 #include "nodeoffset.hxx"
34 #include <o3tl/sorted_vector.hxx>
40 class SwHTMLTableLayout
;
47 class SwTableCalcPara
;
52 class SwUndoTableMerge
;
55 class SwUndoTableCpyTable
;
61 void sw_GetTableBoxColStr( sal_uInt16 nCol
, OUString
& rNm
);
65 std::vector
<SwTableLine
*> m_vLines
;
68 typedef std::vector
<SwTableLine
*>::size_type size_type
;
69 typedef std::vector
<SwTableLine
*>::iterator iterator
;
70 typedef std::vector
<SwTableLine
*>::const_iterator const_iterator
;
72 // free's any remaining child objects
75 bool empty() const { return m_vLines
.empty(); }
76 size_type
size() const { return m_vLines
.size(); }
77 iterator
begin() { return m_vLines
.begin(); }
78 const_iterator
begin() const { return m_vLines
.begin(); }
79 iterator
end() { return m_vLines
.end(); }
80 const_iterator
end() const { return m_vLines
.end(); }
81 SwTableLine
* front() const { return m_vLines
.front(); }
82 SwTableLine
* back() const { return m_vLines
.back(); }
83 void clear() { m_vLines
.clear(); }
84 iterator
erase( iterator aIt
) { return m_vLines
.erase( aIt
); }
85 iterator
erase( iterator aFirst
, iterator aLast
) { return m_vLines
.erase( aFirst
, aLast
); }
86 iterator
insert( iterator aIt
, SwTableLine
* pLine
) { return m_vLines
.insert( aIt
, pLine
); }
87 template<typename TInputIterator
>
88 void insert( iterator aIt
, TInputIterator aFirst
, TInputIterator aLast
)
90 m_vLines
.insert( aIt
, aFirst
, aLast
);
92 void push_back( SwTableLine
* pLine
) { m_vLines
.push_back( pLine
); }
93 void reserve( size_type nSize
) { m_vLines
.reserve( nSize
); }
94 SwTableLine
*& operator[]( size_type nPos
) { return m_vLines
[ nPos
]; }
95 SwTableLine
* operator[]( size_type nPos
) const { return m_vLines
[ nPos
]; }
97 // return USHRT_MAX if not found, else index of position
98 sal_uInt16
GetPos(const SwTableLine
* pBox
) const
100 const_iterator it
= std::find(begin(), end(), pBox
);
101 return it
== end() ? USHRT_MAX
: it
- begin();
105 using SwTableBoxes
= std::vector
<SwTableBox
*>;
107 // Save content-bearing box-pointers additionally in a sorted array
108 // (for calculation in table).
109 class SwTableSortBoxes
: public o3tl::sorted_vector
<SwTableBox
*> {};
111 /// SwTable is one table in the document model, containing rows (which contain cells).
112 class SW_DLLPUBLIC SwTable
: public SwClient
//Client of FrameFormat.
116 SwTableLines m_aLines
;
117 SwTableSortBoxes m_TabSortContentBoxes
;
118 tools::SvRef
<SwServerObject
> m_xRefObj
; // In case DataServer -> pointer is set.
120 std::shared_ptr
<SwHTMLTableLayout
> m_xHTMLLayout
;
122 // Usually, the table node of a SwTable can be accessed by getting a box
123 // out of m_TabSortContentBoxes, which know their SwStartNode. But in some rare
124 // cases, we need to know the table node of a SwTable, before the table
125 // boxes have been build (SwTableNode::MakeCopy with tables in tables).
126 SwTableNode
* m_pTableNode
;
128 // Should that be adjustable for every table?
129 TableChgMode m_eTableChgMode
;
131 sal_uInt16 m_nGraphicsThatResize
; // Count of Grfs that initiate a resize of table
133 sal_uInt16 m_nRowsToRepeat
; // Number of rows to repeat on every page.
135 /// Name of the table style to be applied on this table.
136 OUString maTableStyleName
;
138 bool m_bModifyLocked
:1;
139 bool m_bNewModel
:1; // false: old SubTableModel; true: new RowSpanModel
141 virtual void SwClientNotify(const SwModify
&, const SfxHint
&) override
;
146 SEARCH_NONE
, // Default: expand to rectangle
147 SEARCH_ROW
, // row selection
148 SEARCH_COL
// column selection
153 virtual ~SwTable() override
;
155 // @@@ public copy ctor, but no copy assignment?
156 SwTable( const SwTable
& rTable
); // no copy of the lines !!
158 virtual const SwTable
* DynCastTable() const override
{ return this; }
161 // @@@ public copy ctor, but no copy assignment?
162 SwTable
& operator= (const SwTable
&) = delete;
163 bool OldMerge( SwDoc
*, const SwSelBoxes
&, SwTableBox
*, SwUndoTableMerge
* );
164 bool OldSplitRow( SwDoc
&, const SwSelBoxes
&, sal_uInt16
, bool );
165 bool NewMerge( SwDoc
*, const SwSelBoxes
&, const SwSelBoxes
& rMerged
,
167 bool NewSplitRow( SwDoc
&, const SwSelBoxes
&, sal_uInt16
, bool );
168 std::optional
<SwBoxSelection
> CollectBoxSelection( const SwPaM
& rPam
) const;
169 void InsertSpannedRow( SwDoc
& rDoc
, sal_uInt16 nIdx
, sal_uInt16 nCnt
);
170 bool InsertRow_( SwDoc
*, const SwSelBoxes
&, sal_uInt16 nCnt
, bool bBehind
, bool bInsertDummy
);
171 bool NewInsertCol( SwDoc
&, const SwSelBoxes
& rBoxes
, sal_uInt16 nCnt
, bool, bool bInsertDummy
);
172 void FindSuperfluousRows_( SwSelBoxes
& rBoxes
, SwTableLine
*, SwTableLine
* );
173 void AdjustWidths( const tools::Long nOld
, const tools::Long nNew
);
174 void NewSetTabCols( Parm
&rP
, const SwTabCols
&rNew
, const SwTabCols
&rOld
,
175 const SwTableBox
*pStart
, bool bCurRowOnly
);
176 void ConvertSubtableBox(sal_uInt16
const nRow
, sal_uInt16
const nBox
);
177 // Only used for TBL_BOXNAME and TBL_RELBOXNAME for now
178 void UpdateFields(TableFormulaUpdateFlags eFlags
);
179 void GatherFormulas(std::vector
<SwTableBoxFormula
*>& rvFormulas
);
182 SwHTMLTableLayout
*GetHTMLTableLayout() { return m_xHTMLLayout
.get(); }
183 const SwHTMLTableLayout
*GetHTMLTableLayout() const { return m_xHTMLLayout
.get(); }
184 void SetHTMLTableLayout(std::shared_ptr
<SwHTMLTableLayout
> const& r
); //Change of property!
186 sal_uInt16
IncGrfsThatResize() { return ++m_nGraphicsThatResize
; }
187 sal_uInt16
DecGrfsThatResize() { return m_nGraphicsThatResize
? --m_nGraphicsThatResize
: 0; }
189 void LockModify() { m_bModifyLocked
= true; } // Must be used always
190 void UnlockModify() { m_bModifyLocked
= false;} // in pairs!
192 void SetTableModel( bool bNew
){ m_bNewModel
= bNew
; }
193 bool IsNewModel() const { return m_bNewModel
; }
195 /// Return the table style name of this table.
196 const OUString
& GetTableStyleName() const { return maTableStyleName
; }
198 /// Set the new table style name for this table.
199 void SetTableStyleName(const OUString
& rName
) { maTableStyleName
= rName
; }
201 sal_uInt16
GetRowsToRepeat() const { return std::min( o3tl::narrowing
<sal_uInt16
>(GetTabLines().size()), m_nRowsToRepeat
); }
202 void SetRowsToRepeat( sal_uInt16 nNumOfRows
) { m_nRowsToRepeat
= nNumOfRows
; }
204 bool IsHeadline( const SwTableLine
& rLine
) const;
206 SwTableLines
&GetTabLines() { return m_aLines
; }
207 const SwTableLines
&GetTabLines() const { return m_aLines
; }
209 SwTableFormat
* GetFrameFormat() { return static_cast<SwTableFormat
*>(GetRegisteredIn()); }
210 SwTableFormat
* GetFrameFormat() const { return const_cast<SwTableFormat
*>(static_cast<const SwTableFormat
*>(GetRegisteredIn())); }
212 void GetTabCols( SwTabCols
&rToFill
, const SwTableBox
*pStart
,
213 bool bHidden
= false, bool bCurRowOnly
= false ) const;
214 void SetTabCols( const SwTabCols
&rNew
, const SwTabCols
&rOld
,
215 const SwTableBox
*pStart
, bool bCurRowOnly
);
217 // The following functions are for new table model only...
218 void CreateSelection( const SwPaM
& rPam
, SwSelBoxes
& rBoxes
,
219 const SearchType eSearchType
, bool bProtect
) const;
220 void CreateSelection( const SwNode
* pStart
, const SwNode
* pEnd
,
221 SwSelBoxes
& rBoxes
, const SearchType eSearchType
, bool bProtect
) const;
222 void ExpandSelection( SwSelBoxes
& rBoxes
) const;
223 // When a table is split into two tables, the row spans which overlaps
224 // the split have to be corrected and stored for undo
225 // SwSavRowSpan is the structure needed by Undo to undo the split operation
226 // CleanUpRowSpan corrects the (top of the) second table and delivers the structure
228 std::unique_ptr
<SwSaveRowSpan
> CleanUpTopRowSpan( sal_uInt16 nSplitLine
);
229 // RestoreRowSpan is called by Undo to restore the old row span values
230 void RestoreRowSpan( const SwSaveRowSpan
& );
231 // CleanUpBottomRowSpan corrects the overhanging row spans at the end of the first table
232 void CleanUpBottomRowSpan( sal_uInt16 nDelLines
);
234 // The following functions are "pseudo-virtual", i.e. they are different for old and new table model
235 // It's not allowed to change the table model after the first call of one of these functions.
237 bool Merge( SwDoc
* pDoc
, const SwSelBoxes
& rBoxes
, const SwSelBoxes
& rMerged
,
238 SwTableBox
* pMergeBox
, SwUndoTableMerge
* pUndo
)
240 return m_bNewModel
? NewMerge( pDoc
, rBoxes
, rMerged
, pUndo
) :
241 OldMerge( pDoc
, rBoxes
, pMergeBox
, pUndo
);
243 bool SplitRow( SwDoc
& rDoc
, const SwSelBoxes
& rBoxes
, sal_uInt16 nCnt
,
246 return m_bNewModel
? NewSplitRow( rDoc
, rBoxes
, nCnt
, bSameHeight
) :
247 OldSplitRow( rDoc
, rBoxes
, nCnt
, bSameHeight
);
249 bool PrepareMerge( const SwPaM
& rPam
, SwSelBoxes
& rBoxes
,
250 SwSelBoxes
& rMerged
, SwTableBox
** ppMergeBox
, SwUndoTableMerge
* pUndo
);
251 void ExpandColumnSelection( SwSelBoxes
& rBoxes
, tools::Long
&rMin
, tools::Long
&rMax
) const;
252 void PrepareDeleteCol( tools::Long nMin
, tools::Long nMax
);
254 bool InsertCol( SwDoc
&, const SwSelBoxes
& rBoxes
,
255 sal_uInt16 nCnt
, bool bBehind
, bool bInsertDummy
);
256 bool InsertRow( SwDoc
*, const SwSelBoxes
& rBoxes
,
257 sal_uInt16 nCnt
, bool bBehind
, bool bInsertDummy
= true );
258 void PrepareDelBoxes( const SwSelBoxes
& rBoxes
);
259 bool DeleteSel( SwDoc
*, const SwSelBoxes
& rBoxes
, const SwSelBoxes
* pMerged
,
260 SwUndo
* pUndo
, const bool bDelMakeFrames
, const bool bCorrBorder
);
261 bool SplitCol( SwDoc
& rDoc
, const SwSelBoxes
& rBoxes
, sal_uInt16 nCnt
);
263 void FindSuperfluousRows( SwSelBoxes
& rBoxes
)
264 { FindSuperfluousRows_( rBoxes
, nullptr, nullptr ); }
265 void CheckRowSpan( SwTableLine
* &rpLine
, bool bUp
) const;
267 SwTableSortBoxes
& GetTabSortBoxes() { return m_TabSortContentBoxes
; }
268 const SwTableSortBoxes
& GetTabSortBoxes() const { return m_TabSortContentBoxes
; }
270 // Read 1st number and delete it from string (used by GetTableBox and SwTableField).
273 // add 3rd parameter in order to control validation check on <rStr>
274 static sal_uInt16
GetBoxNum( OUString
& rStr
,
276 const bool bPerformValidCheck
= false );
278 // Search content-bearing box with that name.
281 // add 2nd parameter in order to control validation check in called method
283 const SwTableBox
* GetTableBox( const OUString
& rName
,
284 const bool bPerformValidCheck
= false ) const;
285 // Copy selected boxes to another document.
286 bool MakeCopy( SwDoc
&, const SwPosition
&, const SwSelBoxes
&,
287 bool bCpyName
= false, const OUString
& rStyleName
= "" ) const;
288 // Copy table in this
289 bool InsTable( const SwTable
& rCpyTable
, const SwNodeIndex
&,
290 SwUndoTableCpyTable
* pUndo
);
291 bool InsTable( const SwTable
& rCpyTable
, const SwSelBoxes
&,
292 SwUndoTableCpyTable
* pUndo
);
293 bool InsNewTable( const SwTable
& rCpyTable
, const SwSelBoxes
&,
294 SwUndoTableCpyTable
* pUndo
);
295 // Copy headline of table (with content!) into another one.
296 void CopyHeadlineIntoTable( SwTableNode
& rTableNd
);
298 // Get box, whose start index is set on nBoxStt.
299 SwTableBox
* GetTableBox( SwNodeOffset nSttIdx
);
300 const SwTableBox
* GetTableBox( SwNodeOffset nSttIdx
) const
301 { return const_cast<SwTable
*>(this)->GetTableBox( nSttIdx
); }
303 // Returns true if table contains nestings.
304 bool IsTableComplex() const;
306 // Returns true if table or selection is balanced.
307 bool IsTableComplexForChart( std::u16string_view aSel
) const;
309 // Search all content-bearing boxes of the base line on which this box stands.
310 // rBoxes as a return value for immediate use.
311 // bToTop = true -> up to base line, false-> else only line of box.
312 static SwSelBoxes
& SelLineFromBox( const SwTableBox
* pBox
,
313 SwSelBoxes
& rBoxes
, bool bToTop
= true );
315 // Get information from client.
316 virtual bool GetInfo( SfxPoolItem
& ) const override
;
318 // Search in format for registered table.
319 static SwTable
* FindTable( SwFrameFormat
const*const pFormat
);
321 // Clean up structure of subtables a bit:
322 // convert row with 1 box with subtable; box with subtable with 1 row;
323 // by removing the subtable (both recursively)
326 // Returns the table node via m_TabSortContentBoxes or pTableNode.
327 SwTableNode
* GetTableNode() const;
328 void SetTableNode( SwTableNode
* pNode
) { m_pTableNode
= pNode
; }
330 // Data server methods.
331 void SetRefObject( SwServerObject
* );
332 const SwServerObject
* GetObject() const { return m_xRefObj
.get(); }
333 SwServerObject
* GetObject() { return m_xRefObj
.get(); }
335 // Fill data for chart.
336 void UpdateCharts() const;
338 TableChgMode
GetTableChgMode() const { return m_eTableChgMode
; }
339 void SetTableChgMode( TableChgMode eMode
) { m_eTableChgMode
= eMode
; }
341 bool SetColWidth( SwTableBox
& rCurrentBox
, TableChgWidthHeightType eType
,
342 SwTwips nAbsDiff
, SwTwips nRelDiff
, std::unique_ptr
<SwUndo
>* ppUndo
);
343 bool SetRowHeight( SwTableBox
& rCurrentBox
, TableChgWidthHeightType eType
,
344 SwTwips nAbsDiff
, SwTwips nRelDiff
, std::unique_ptr
<SwUndo
>* ppUndo
);
345 void RegisterToFormat( SwFormat
& rFormat
);
347 void CheckConsistency() const;
350 bool HasLayout() const;
352 bool CanConvertSubtables() const;
353 void ConvertSubtables();
355 // is it a table deleted completely with change tracking
356 bool IsDeleted() const;
357 // is it a table with a deleted row or cell
358 bool HasDeletedRowOrCell() const;
359 // it doesn't contain box content (except single empty nested tables of the boxes
360 // which could remain after deletion of text content of the selected table)
361 bool IsEmpty() const;
362 void SwitchFormulasToExternalRepresentation()
363 { UpdateFields(TBL_BOXNAME
); };
364 void SwitchFormulasToRelativeRepresentation()
365 { UpdateFields(TBL_RELBOXNAME
); };
366 void SwitchFormulasToInternalRepresentation()
367 { UpdateFields(TBL_BOXPTR
); }
368 void Merge(SwTable
& rTable
, SwHistory
* pHistory
);
369 void Split(OUString sNewTableName
, sal_uInt16 nSplitLine
, SwHistory
* pHistory
);
371 void dumpAsXml(xmlTextWriterPtr pWriter
) const;
374 /// SwTableLine is one table row in the document model.
375 class SW_DLLPUBLIC SwTableLine final
: public SwClient
// Client of FrameFormat.
377 SwTableBoxes m_aBoxes
;
378 SwTableBox
*m_pUpper
;
379 RedlineType m_eRedlineType
;
383 SwTableLine( SwTableLineFormat
*, sal_uInt16 nBoxes
, SwTableBox
*pUp
);
384 virtual ~SwTableLine() override
;
386 SwTableBoxes
&GetTabBoxes() { return m_aBoxes
; }
387 const SwTableBoxes
&GetTabBoxes() const { return m_aBoxes
; }
388 sal_uInt16
GetBoxPos(const SwTableBox
* pBox
) const
390 SwTableBoxes::const_iterator it
= std::find(m_aBoxes
.begin(), m_aBoxes
.end(), pBox
);
391 return it
== m_aBoxes
.end() ? USHRT_MAX
: it
- m_aBoxes
.begin();
394 SwTableBox
*GetUpper() { return m_pUpper
; }
395 const SwTableBox
*GetUpper() const { return m_pUpper
; }
396 void SetUpper( SwTableBox
*pNew
) { m_pUpper
= pNew
; }
398 SwFrameFormat
* GetFrameFormat() { return static_cast<SwFrameFormat
*>(GetRegisteredIn()); }
399 SwFrameFormat
* GetFrameFormat() const { return const_cast<SwFrameFormat
*>(static_cast<const SwFrameFormat
*>(GetRegisteredIn())); }
401 // Creates an own FrameFormat if more lines depend on it.
402 SwFrameFormat
* ClaimFrameFormat();
403 void ChgFrameFormat( SwTableLineFormat
* pNewFormat
);
405 // Search next/previous box with content.
406 SwTableBox
* FindNextBox( const SwTable
&, const SwTableBox
* =nullptr,
407 bool bOvrTableLns
=true ) const;
408 SwTableBox
* FindPreviousBox( const SwTable
&, const SwTableBox
* =nullptr,
409 bool bOvrTableLns
=true ) const;
411 SwTwips
GetTableLineHeight( bool& bLayoutAvailable
) const;
413 bool hasSoftPageBreak() const;
415 // it doesn't contain box content (except single empty nested tables of the boxes
416 // which could remain after deletion of text content of the selected table row)
417 bool IsEmpty() const;
419 // Update TextChangesOnly property based on the redlines of the table row.
420 // rRedlinePos: search from this redline index to speed up SwTable::IsDeleted().
421 // bUpdateProperty: don't update HasTextChangesOnly property, if bUpdateProperty = false.
422 // Set rRedlinePos after the last redline index of the table row.
423 // Return with the redline, which associated to the row change (latest deletion
424 // in the case of deleted row, the first insertion in the case of row insertion
425 // or npos, if TextChangesOnly is true, i.e. the table row is not deleted or inserted).
426 // Cache also the type of the redline associated to the changed table row.
427 SwRedlineTable::size_type
UpdateTextChangesOnly(
428 SwRedlineTable::size_type
& rRedlinePos
, bool bUpdateProperty
= true) const;
429 // tracked text changes, i.e. a single redline can contain tables
430 // get that redline for the table row, if it exists
431 SwRedlineTable::size_type
GetTableRedline() const;
432 // is it a tracked row
433 bool IsTracked(SwRedlineTable::size_type
& rRedlinePos
, bool bOnlyDeleted
= false) const;
434 // is it a tracked deleted row
435 bool IsDeleted(SwRedlineTable::size_type
& rRedlinePos
) const;
436 // set/get (if it's possible, cached) redline type
437 RedlineType
GetRedlineType() const;
438 void SetRedlineType(RedlineType eType
) { m_eRedlineType
= eType
; }
441 /// SwTableBox is one table cell in the document model.
442 class SW_DLLPUBLIC SwTableBox final
: public SwClient
//Client of FrameFormat.
444 friend class SwNodes
; // Transpose index.
445 friend void DelBoxNode(SwTableSortBoxes
const &); // Delete StartNode* !
446 friend class SwXMLTableContext
;
448 SwTableBox( const SwTableBox
& ) = delete;
449 SwTableBox
&operator=( const SwTableBox
&) = delete;
451 SwTableLines m_aLines
;
452 const SwStartNode
* m_pStartNode
;
453 SwTableLine
*m_pUpper
;
455 std::optional
<Color
> mxUserColor
;
456 std::optional
<Color
> mxNumFormatColor
;
460 /// Do we contain any direct formatting?
461 bool mbDirectFormatting
;
463 // In case Format contains formulas/values already,
464 // a new one must be created for the new box.
465 static SwTableBoxFormat
* CheckBoxFormat( SwTableBoxFormat
* );
469 SwTableBox( SwTableBoxFormat
*, sal_uInt16 nLines
, SwTableLine
*pUp
);
470 SwTableBox( SwTableBoxFormat
*, const SwStartNode
&, SwTableLine
*pUp
);
471 SwTableBox( SwTableBoxFormat
*, const SwNodeIndex
&, SwTableLine
*pUp
);
472 virtual ~SwTableBox() override
;
474 SwTableLines
&GetTabLines() { return m_aLines
; }
475 const SwTableLines
&GetTabLines() const { return m_aLines
; }
477 SwTableLine
*GetUpper() { return m_pUpper
; }
478 const SwTableLine
*GetUpper() const { return m_pUpper
; }
479 void SetUpper( SwTableLine
*pNew
) { m_pUpper
= pNew
; }
481 SwFrameFormat
* GetFrameFormat() { return static_cast<SwFrameFormat
*>(GetRegisteredIn()); }
482 SwFrameFormat
* GetFrameFormat() const { return const_cast<SwFrameFormat
*>(static_cast<const SwFrameFormat
*>(GetRegisteredIn())); }
484 /// Set that this table box contains formatting that is not set by the table style.
485 void SetDirectFormatting(bool bDirect
) { mbDirectFormatting
= bDirect
; }
487 /// Do we contain any direct formatting (ie. something not affected by the table style)?
488 bool HasDirectFormatting() const { return mbDirectFormatting
; }
490 // Creates its own FrameFormat if more boxes depend on it.
491 SwFrameFormat
* ClaimFrameFormat();
492 void ChgFrameFormat( SwTableBoxFormat
*pNewFormat
, bool bNeedToReregister
= true );
494 void RemoveFromTable();
495 const SwStartNode
*GetSttNd() const { return m_pStartNode
; }
496 SwNodeOffset
GetSttIdx() const;
497 // it doesn't contain box content or if bWithRemainingNestedTable = true,
498 // it contains only an empty nested table as box content (which
499 // could remain after deletion of the text content of the selected box).
500 bool IsEmpty( bool bWithRemainingNestedTable
= true ) const;
502 // Search next/previous box with content.
503 SwTableBox
* FindNextBox( const SwTable
&, const SwTableBox
*,
504 bool bOvrTableLns
=true ) const;
505 SwTableBox
* FindPreviousBox( const SwTable
&, const SwTableBox
* ) const;
506 // Return name of this box. It is determined dynamically and
507 // is calculated from the position in the lines/boxes/table.
508 OUString
GetName() const;
509 // Return "value" of box (for calculating in table).
510 double GetValue( SwTableCalcPara
& rPara
) const;
512 // Computes "coordinates" of a box, used to computed selection
513 // width or height when inserting cols or rows
514 Point
GetCoordinates() const;
516 bool IsInHeadline( const SwTable
* pTable
) const;
518 // Contains box contents, that can be formatted as a number?
519 bool HasNumContent( double& rNum
, sal_uInt32
& rFormatIndex
,
520 bool& rIsEmptyTextNd
) const;
521 SwNodeOffset
IsValidNumTextNd( bool bCheckAttr
= true ) const;
522 // If a table formula is set, test if box contents is congruent with number.
523 // (For Redo of change of NumFormat!).
524 bool IsNumberChanged() const;
526 // Is that a formula box or a box with numeric contents (AutoSum)?
527 // What it is indicated by the return value - the WhichId of the attribute.
528 // Empty boxes have the return value USHRT_MAX !!
529 sal_uInt16
IsFormulaOrValueBox() const;
531 // Loading of a document requires an actualization of cells with values
532 void ActualiseValueBox();
534 // Access on internal data - currently used for the NumFormatter.
535 const std::optional
<Color
>& GetSaveUserColor() const { return mxUserColor
; }
536 const std::optional
<Color
>& GetSaveNumFormatColor() const { return mxNumFormatColor
; }
537 void SetSaveUserColor(std::optional
<Color
> p
) { mxUserColor
= p
; }
538 void SetSaveNumFormatColor( std::optional
<Color
> p
) { mxNumFormatColor
= p
; }
540 sal_Int32
getRowSpan() const { return mnRowSpan
; }
541 void setRowSpan( sal_Int32 nNewRowSpan
);
542 bool getDummyFlag() const;
543 void setDummyFlag( bool bDummy
);
545 SwTableBox
& FindStartOfRowSpan( const SwTable
&, sal_uInt16 nMaxStep
= USHRT_MAX
);
546 const SwTableBox
& FindStartOfRowSpan( const SwTable
& rTable
,
547 sal_uInt16 nMaxStep
= USHRT_MAX
) const
548 { return const_cast<SwTableBox
*>(this)->FindStartOfRowSpan( rTable
, nMaxStep
); }
550 SwTableBox
& FindEndOfRowSpan( const SwTable
&, sal_uInt16 nMaxStep
);
551 const SwTableBox
& FindEndOfRowSpan( const SwTable
& rTable
,
552 sal_uInt16 nMaxStep
) const
553 { return const_cast<SwTableBox
*>(this)->FindEndOfRowSpan( rTable
, nMaxStep
); }
554 void RegisterToFormat( SwFormat
& rFormat
) ;
555 // get redline for the table cell, if it exists
556 SwRedlineTable::size_type
GetRedline() const;
558 RedlineType
GetRedlineType() const;
562 class SW_DLLPUBLIC SwTableCellInfo
565 std::unique_ptr
<Impl
> m_pImpl
;
567 const SwCellFrame
* getCellFrame() const;
569 SwTableCellInfo(SwTableCellInfo
const&) = delete;
570 SwTableCellInfo
& operator=(SwTableCellInfo
const&) = delete;
573 SwTableCellInfo(const SwTable
* pTable
);
577 SwRect
getRect() const;
578 const SwTableBox
* getTableBox() const;
581 #endif // INCLUDED_SW_INC_SWTABLE_HXX
583 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */