LibreOffice Module sw (master)  1
swtable.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_SW_INC_SWTABLE_HXX
20 #define INCLUDED_SW_INC_SWTABLE_HXX
21 
22 #include <tools/ref.hxx>
23 #include "tblenum.hxx"
24 #include "swtypes.hxx"
25 #include "calbck.hxx"
26 #include "swrect.hxx"
27 #include "swtblfmt.hxx"
28 #include "docary.hxx"
29 #include "nodeoffset.hxx"
30 
31 #include <memory>
32 #include <vector>
33 #include <algorithm>
34 #include <o3tl/sorted_vector.hxx>
35 #include <optional>
36 
37 class SwStartNode;
38 class SwFormat;
39 class Color;
40 class SwHTMLTableLayout;
41 class SwTableLine;
42 class SwTableBox;
43 class SwTableNode;
44 class SwTabCols;
45 class SwDoc;
46 class SwSelBoxes;
47 class SwTableCalcPara;
48 struct SwPosition;
49 class SwNodeIndex;
50 class SwNode;
51 class SfxPoolItem;
52 class SwUndoTableMerge;
53 class SwUndo;
54 class SwPaM;
56 class SwBoxSelection;
57 struct SwSaveRowSpan;
58 struct Parm;
59 class SwServerObject;
60 
61 void sw_GetTableBoxColStr( sal_uInt16 nCol, OUString& rNm );
62 
64 {
65  std::vector<SwTableLine*> m_vLines;
66 
67 public:
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;
71 
72  // free's any remaining child objects
73  ~SwTableLines();
74 
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 )
89  {
90  m_vLines.insert( aIt, aFirst, aLast );
91  }
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 ]; }
96 
97  // return USHRT_MAX if not found, else index of position
98  sal_uInt16 GetPos(const SwTableLine* pBox) const
99  {
100  const_iterator it = std::find(begin(), end(), pBox);
101  return it == end() ? USHRT_MAX : it - begin();
102  }
103 };
104 
105 using SwTableBoxes = std::vector<SwTableBox*>;
106 
107 // Save content-bearing box-pointers additionally in a sorted array
108 // (for calculation in table).
109 class SwTableSortBoxes : public o3tl::sorted_vector<SwTableBox*> {};
110 
112 class SW_DLLPUBLIC SwTable: public SwClient //Client of FrameFormat.
113 {
114 
115 protected:
118  tools::SvRef<SwServerObject> m_xRefObj; // In case DataServer -> pointer is set.
119 
120  std::shared_ptr<SwHTMLTableLayout> m_xHTMLLayout;
121 
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).
127 
128  // Should that be adjustable for every table?
130 
131  sal_uInt16 m_nGraphicsThatResize; // Count of Grfs that initiate a resize of table
132  // at HTML-import.
133  sal_uInt16 m_nRowsToRepeat; // Number of rows to repeat on every page.
134 
137 
138  bool m_bModifyLocked :1;
139  bool m_bNewModel :1; // false: old SubTableModel; true: new RowSpanModel
140 
141  virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
142 
143 public:
145  {
146  SEARCH_NONE, // Default: expand to rectangle
147  SEARCH_ROW, // row selection
148  SEARCH_COL // column selection
149  };
150 
151 
152  explicit SwTable();
153  virtual ~SwTable() override;
154 
155  // @@@ public copy ctor, but no copy assignment?
156  SwTable( const SwTable& rTable ); // no copy of the lines !!
157 private:
158  // @@@ public copy ctor, but no copy assignment?
159  SwTable & operator= (const SwTable &) = delete;
160  bool OldMerge( SwDoc*, const SwSelBoxes&, SwTableBox*, SwUndoTableMerge* );
161  bool OldSplitRow( SwDoc&, const SwSelBoxes&, sal_uInt16, bool );
162  bool NewMerge( SwDoc*, const SwSelBoxes&, const SwSelBoxes& rMerged,
163  SwUndoTableMerge* );
164  bool NewSplitRow( SwDoc&, const SwSelBoxes&, sal_uInt16, bool );
165  std::unique_ptr<SwBoxSelection> CollectBoxSelection( const SwPaM& rPam ) const;
166  void InsertSpannedRow( SwDoc& rDoc, sal_uInt16 nIdx, sal_uInt16 nCnt );
167  bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind );
168  bool NewInsertCol( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool );
169  void FindSuperfluousRows_( SwSelBoxes& rBoxes, SwTableLine*, SwTableLine* );
170  void AdjustWidths( const tools::Long nOld, const tools::Long nNew );
171  void NewSetTabCols( Parm &rP, const SwTabCols &rNew, const SwTabCols &rOld,
172  const SwTableBox *pStart, bool bCurRowOnly );
173  void ConvertSubtableBox(sal_uInt16 const nRow, sal_uInt16 const nBox);
174 
175 public:
176 
177  SwHTMLTableLayout *GetHTMLTableLayout() { return m_xHTMLLayout.get(); }
178  const SwHTMLTableLayout *GetHTMLTableLayout() const { return m_xHTMLLayout.get(); }
179  void SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout> const& r); //Change of property!
180 
181  sal_uInt16 IncGrfsThatResize() { return ++m_nGraphicsThatResize; }
182  sal_uInt16 DecGrfsThatResize() { return m_nGraphicsThatResize ? --m_nGraphicsThatResize : 0; }
183 
184  void LockModify() { m_bModifyLocked = true; } // Must be used always
185  void UnlockModify() { m_bModifyLocked = false;} // in pairs!
186 
187  void SetTableModel( bool bNew ){ m_bNewModel = bNew; }
188  bool IsNewModel() const { return m_bNewModel; }
189 
191  const OUString& GetTableStyleName() const { return maTableStyleName; }
192 
194  void SetTableStyleName(const OUString& rName) { maTableStyleName = rName; }
195 
196  sal_uInt16 GetRowsToRepeat() const { return std::min( o3tl::narrowing<sal_uInt16>(GetTabLines().size()), m_nRowsToRepeat ); }
197  void SetRowsToRepeat( sal_uInt16 nNumOfRows ) { m_nRowsToRepeat = nNumOfRows; }
198 
199  bool IsHeadline( const SwTableLine& rLine ) const;
200 
201  SwTableLines &GetTabLines() { return m_aLines; }
202  const SwTableLines &GetTabLines() const { return m_aLines; }
203 
205  SwTableFormat* GetFrameFormat() const { return const_cast<SwTableFormat*>(static_cast<const SwTableFormat*>(GetRegisteredIn())); }
206 
207  void GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart,
208  bool bHidden = false, bool bCurRowOnly = false ) const;
209  void SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld,
210  const SwTableBox *pStart, bool bCurRowOnly );
211 
212 // The following functions are for new table model only...
213  void CreateSelection( const SwPaM& rPam, SwSelBoxes& rBoxes,
214  const SearchType eSearchType, bool bProtect ) const;
215  void CreateSelection( const SwNode* pStart, const SwNode* pEnd,
216  SwSelBoxes& rBoxes, const SearchType eSearchType, bool bProtect ) const;
217  void ExpandSelection( SwSelBoxes& rBoxes ) const;
218  // When a table is split into two tables, the row spans which overlaps
219  // the split have to be corrected and stored for undo
220  // SwSavRowSpan is the structure needed by Undo to undo the split operation
221  // CleanUpRowSpan corrects the (top of the) second table and delivers the structure
222  // for Undo
223  std::unique_ptr<SwSaveRowSpan> CleanUpTopRowSpan( sal_uInt16 nSplitLine );
224  // RestoreRowSpan is called by Undo to restore the old row span values
225  void RestoreRowSpan( const SwSaveRowSpan& );
226  // CleanUpBottomRowSpan corrects the overhanging row spans at the end of the first table
227  void CleanUpBottomRowSpan( sal_uInt16 nDelLines );
228 
229 // The following functions are "pseudo-virtual", i.e. they are different for old and new table model
230 // It's not allowed to change the table model after the first call of one of these functions.
231 
232  bool Merge( SwDoc* pDoc, const SwSelBoxes& rBoxes, const SwSelBoxes& rMerged,
233  SwTableBox* pMergeBox, SwUndoTableMerge* pUndo )
234  {
235  return m_bNewModel ? NewMerge( pDoc, rBoxes, rMerged, pUndo ) :
236  OldMerge( pDoc, rBoxes, pMergeBox, pUndo );
237  }
238  bool SplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt,
239  bool bSameHeight )
240  {
241  return m_bNewModel ? NewSplitRow( rDoc, rBoxes, nCnt, bSameHeight ) :
242  OldSplitRow( rDoc, rBoxes, nCnt, bSameHeight );
243  }
244  bool PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
245  SwSelBoxes& rMerged, SwTableBox** ppMergeBox, SwUndoTableMerge* pUndo );
246  void ExpandColumnSelection( SwSelBoxes& rBoxes, tools::Long &rMin, tools::Long &rMax ) const;
247  void PrepareDeleteCol( tools::Long nMin, tools::Long nMax );
248 
249  bool InsertCol( SwDoc&, const SwSelBoxes& rBoxes,
250  sal_uInt16 nCnt, bool bBehind );
251  bool InsertRow( SwDoc*, const SwSelBoxes& rBoxes,
252  sal_uInt16 nCnt, bool bBehind );
253  void PrepareDelBoxes( const SwSelBoxes& rBoxes );
254  bool DeleteSel( SwDoc*, const SwSelBoxes& rBoxes, const SwSelBoxes* pMerged,
255  SwUndo* pUndo, const bool bDelMakeFrames, const bool bCorrBorder );
256  bool SplitCol( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt );
257 
259  { FindSuperfluousRows_( rBoxes, nullptr, nullptr ); }
260  void CheckRowSpan( SwTableLine* &rpLine, bool bUp ) const;
261 
262  SwTableSortBoxes& GetTabSortBoxes() { return m_TabSortContentBoxes; }
263  const SwTableSortBoxes& GetTabSortBoxes() const { return m_TabSortContentBoxes; }
264 
265  // Read 1st number and delete it from string (used by GetTableBox and SwTableField).
266 
267  // #i80314#
268  // add 3rd parameter in order to control validation check on <rStr>
269  static sal_uInt16 GetBoxNum( OUString& rStr,
270  bool bFirst = false,
271  const bool bPerformValidCheck = false );
272 
273  // Search content-bearing box with that name.
274 
275  // #i80314#
276  // add 2nd parameter in order to control validation check in called method
277  // <GetBoxNum(..)>
278  const SwTableBox* GetTableBox( const OUString& rName,
279  const bool bPerformValidCheck = false ) const;
280  // Copy selected boxes to another document.
281  bool MakeCopy( SwDoc&, const SwPosition&, const SwSelBoxes&,
282  bool bCpyName = false, const OUString& rStyleName = "" ) const;
283  // Copy table in this
284  bool InsTable( const SwTable& rCpyTable, const SwNodeIndex&,
285  SwUndoTableCpyTable* pUndo );
286  bool InsTable( const SwTable& rCpyTable, const SwSelBoxes&,
287  SwUndoTableCpyTable* pUndo );
288  bool InsNewTable( const SwTable& rCpyTable, const SwSelBoxes&,
289  SwUndoTableCpyTable* pUndo );
290  // Copy headline of table (with content!) into another one.
291  void CopyHeadlineIntoTable( SwTableNode& rTableNd );
292 
293  // Get box, whose start index is set on nBoxStt.
294  SwTableBox* GetTableBox( SwNodeOffset nSttIdx );
295  const SwTableBox* GetTableBox( SwNodeOffset nSttIdx ) const
296  { return const_cast<SwTable*>(this)->GetTableBox( nSttIdx ); }
297 
298  // Returns true if table contains nestings.
299  bool IsTableComplex() const;
300 
301  // Returns true if table or selection is balanced.
302  bool IsTableComplexForChart( const OUString& rSel ) const;
303 
304  // Search all content-bearing boxes of the base line on which this box stands.
305  // rBoxes as a return value for immediate use.
306  // bToTop = true -> up to base line, false-> else only line of box.
307  static SwSelBoxes& SelLineFromBox( const SwTableBox* pBox,
308  SwSelBoxes& rBoxes, bool bToTop = true );
309 
310  // Get information from client.
311  virtual bool GetInfo( SfxPoolItem& ) const override;
312 
313  // Search in format for registered table.
314  static SwTable * FindTable( SwFrameFormat const*const pFormat );
315 
316  // Clean up structure of subtables a bit:
317  // convert row with 1 box with subtable; box with subtable with 1 row;
318  // by removing the subtable (both recursively)
319  void GCLines();
320 
321  // Returns the table node via m_TabSortContentBoxes or pTableNode.
322  SwTableNode* GetTableNode() const;
323  void SetTableNode( SwTableNode* pNode ) { m_pTableNode = pNode; }
324 
325  // Data server methods.
326  void SetRefObject( SwServerObject* );
327  const SwServerObject* GetObject() const { return m_xRefObj.get(); }
328  SwServerObject* GetObject() { return m_xRefObj.get(); }
329 
330  // Fill data for chart.
331  void UpdateCharts() const;
332 
333  TableChgMode GetTableChgMode() const { return m_eTableChgMode; }
334  void SetTableChgMode( TableChgMode eMode ) { m_eTableChgMode = eMode; }
335 
336  bool SetColWidth( SwTableBox& rCurrentBox, TableChgWidthHeightType eType,
337  SwTwips nAbsDiff, SwTwips nRelDiff, std::unique_ptr<SwUndo>* ppUndo );
338  bool SetRowHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType,
339  SwTwips nAbsDiff, SwTwips nRelDiff, std::unique_ptr<SwUndo>* ppUndo );
340  void RegisterToFormat( SwFormat& rFormat );
341 #ifdef DBG_UTIL
342  void CheckConsistency() const;
343 #endif
344 
345  bool HasLayout() const;
346 
347  bool CanConvertSubtables() const;
348  void ConvertSubtables();
349 
350  // is it a table deleted completely with change tracking
351  bool IsDeleted() const;
352  // is it a table with deleted row(s)
353  bool HasDeletedRow() const;
354 };
355 
357 class SW_DLLPUBLIC SwTableLine final : public SwClient // Client of FrameFormat.
358 {
362 
363 public:
364 
365  SwTableLine( SwTableLineFormat*, sal_uInt16 nBoxes, SwTableBox *pUp );
366  virtual ~SwTableLine() override;
367 
368  SwTableBoxes &GetTabBoxes() { return m_aBoxes; }
369  const SwTableBoxes &GetTabBoxes() const { return m_aBoxes; }
370  sal_uInt16 GetBoxPos(const SwTableBox* pBox) const
371  {
372  SwTableBoxes::const_iterator it = std::find(m_aBoxes.begin(), m_aBoxes.end(), pBox);
373  return it == m_aBoxes.end() ? USHRT_MAX : it - m_aBoxes.begin();
374  }
375 
376  SwTableBox *GetUpper() { return m_pUpper; }
377  const SwTableBox *GetUpper() const { return m_pUpper; }
378  void SetUpper( SwTableBox *pNew ) { m_pUpper = pNew; }
379 
381  SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); }
382 
383  // Creates an own FrameFormat if more lines depend on it.
384  SwFrameFormat* ClaimFrameFormat();
385  void ChgFrameFormat( SwTableLineFormat* pNewFormat );
386 
387  // Search next/previous box with content.
388  SwTableBox* FindNextBox( const SwTable&, const SwTableBox* =nullptr,
389  bool bOvrTableLns=true ) const;
390  SwTableBox* FindPreviousBox( const SwTable&, const SwTableBox* =nullptr,
391  bool bOvrTableLns=true ) const;
392 
393  SwTwips GetTableLineHeight( bool& bLayoutAvailable ) const;
394 
395  bool hasSoftPageBreak() const;
396 
397  // it doesn't contain box content
398  bool IsEmpty() const;
399 
400  // Update TextChangesOnly property based on the redlines of the table row.
401  // rRedlinePos: search from this redline index to speed up SwTable::IsDeleted().
402  // bUpdateProperty: don't update HasTextChangesOnly property, if bUpdateProperty = false.
403  // Set rRedlinePos after the last redline index of the table row.
404  // Return with the redline, which associated to the row change (latest deletion
405  // in the case of deleted row, the first insertion in the case of row insertion
406  // or npos, if TextChangesOnly is true, i.e. the table row is not deleted or inserted).
407  // Cache also the type of the redline associated to the changed table row.
408  SwRedlineTable::size_type UpdateTextChangesOnly(
409  SwRedlineTable::size_type& rRedlinePos, bool bUpdateProperty = true) const;
410  // is it a tracked deleted row
411  bool IsDeleted(SwRedlineTable::size_type& rRedlinePos) const;
412  // set/get (if it's possible, cached) redline type
413  RedlineType GetRedlineType() const;
414  void SetRedlineType(RedlineType eType) { m_eRedlineType = eType; }
415 };
416 
418 class SW_DLLPUBLIC SwTableBox final : public SwClient //Client of FrameFormat.
419 {
420  friend class SwNodes; // Transpose index.
421  friend void DelBoxNode(SwTableSortBoxes const &); // Delete StartNode* !
422  friend class SwXMLTableContext;
423 
424  SwTableBox( const SwTableBox & ) = delete;
425  SwTableBox &operator=( const SwTableBox &) = delete;
426 
430 
431  std::optional<Color> mxUserColor;
432  std::optional<Color> mxNumFormatColor;
433  sal_Int32 mnRowSpan;
435 
438 
439  // In case Format contains formulas/values already,
440  // a new one must be created for the new box.
441  static SwTableBoxFormat* CheckBoxFormat( SwTableBoxFormat* );
442 
443 public:
444 
445  SwTableBox( SwTableBoxFormat*, sal_uInt16 nLines, SwTableLine *pUp );
448  virtual ~SwTableBox() override;
449 
450  SwTableLines &GetTabLines() { return m_aLines; }
451  const SwTableLines &GetTabLines() const { return m_aLines; }
452 
453  SwTableLine *GetUpper() { return m_pUpper; }
454  const SwTableLine *GetUpper() const { return m_pUpper; }
455  void SetUpper( SwTableLine *pNew ) { m_pUpper = pNew; }
456 
458  SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); }
459 
461  void SetDirectFormatting(bool bDirect) { mbDirectFormatting = bDirect; }
462 
464  bool HasDirectFormatting() const { return mbDirectFormatting; }
465 
466  // Creates its own FrameFormat if more boxes depend on it.
467  SwFrameFormat* ClaimFrameFormat();
468  void ChgFrameFormat( SwTableBoxFormat *pNewFormat, bool bNeedToReregister = true );
469 
470  void RemoveFromTable();
471  const SwStartNode *GetSttNd() const { return m_pStartNode; }
472  SwNodeOffset GetSttIdx() const;
473  // it doesn't contain box content
474  bool IsEmpty() const;
475 
476  // Search next/previous box with content.
477  SwTableBox* FindNextBox( const SwTable&, const SwTableBox*,
478  bool bOvrTableLns=true ) const;
479  SwTableBox* FindPreviousBox( const SwTable&, const SwTableBox* ) const;
480  // Return name of this box. It is determined dynamically and
481  // is calculated from the position in the lines/boxes/table.
482  OUString GetName() const;
483  // Return "value" of box (for calculating in table).
484  double GetValue( SwTableCalcPara& rPara ) const;
485 
486  // Computes "coordinates" of a box, used to computed selection
487  // width or height when inserting cols or rows
488  Point GetCoordinates() const;
489 
490  bool IsInHeadline( const SwTable* pTable ) const;
491 
492  // Contains box contents, that can be formatted as a number?
493  bool HasNumContent( double& rNum, sal_uInt32& rFormatIndex,
494  bool& rIsEmptyTextNd ) const;
495  SwNodeOffset IsValidNumTextNd( bool bCheckAttr = true ) const;
496  // If a table formula is set, test if box contents is congruent with number.
497  // (For Redo of change of NumFormat!).
498  bool IsNumberChanged() const;
499 
500  // Is that a formula box or a box with numeric contents (AutoSum)?
501  // What it is indicated by the return value - the WhichId of the attribute.
502  // Empty boxes have the return value USHRT_MAX !!
503  sal_uInt16 IsFormulaOrValueBox() const;
504 
505  // Loading of a document requires an actualization of cells with values
506  void ActualiseValueBox();
507 
508  // Access on internal data - currently used for the NumFormatter.
509  const std::optional<Color>& GetSaveUserColor() const { return mxUserColor; }
510  const std::optional<Color>& GetSaveNumFormatColor() const { return mxNumFormatColor; }
511  void SetSaveUserColor(std::optional<Color> p ) { mxUserColor = p; }
512  void SetSaveNumFormatColor( std::optional<Color> p ) { mxNumFormatColor = p; }
513 
514  sal_Int32 getRowSpan() const;
515  void setRowSpan( sal_Int32 nNewRowSpan );
516  bool getDummyFlag() const;
517  void setDummyFlag( bool bDummy );
518 
519  SwTableBox& FindStartOfRowSpan( const SwTable&, sal_uInt16 nMaxStep = USHRT_MAX );
520  const SwTableBox& FindStartOfRowSpan( const SwTable& rTable,
521  sal_uInt16 nMaxStep = USHRT_MAX ) const
522  { return const_cast<SwTableBox*>(this)->FindStartOfRowSpan( rTable, nMaxStep ); }
523 
524  SwTableBox& FindEndOfRowSpan( const SwTable&, sal_uInt16 nMaxStep );
525  const SwTableBox& FindEndOfRowSpan( const SwTable& rTable,
526  sal_uInt16 nMaxStep ) const
527  { return const_cast<SwTableBox*>(this)->FindEndOfRowSpan( rTable, nMaxStep ); }
528  void RegisterToFormat( SwFormat& rFormat ) ;
529 };
530 
531 class SwCellFrame;
533 {
534  struct Impl;
535  std::unique_ptr<Impl> m_pImpl;
536 
537  const SwCellFrame * getCellFrame() const;
538 
539  SwTableCellInfo(SwTableCellInfo const&) = delete;
540  SwTableCellInfo& operator=(SwTableCellInfo const&) = delete;
541 
542 public:
543  SwTableCellInfo(const SwTable * pTable);
544  ~SwTableCellInfo();
545 
546  bool getNext();
547  SwRect getRect() const;
548  const SwTableBox * getTableBox() const;
549 };
550 
551 #endif // INCLUDED_SW_INC_SWTABLE_HXX
552 
553 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const std::optional< Color > & GetSaveNumFormatColor() const
Definition: swtable.hxx:510
SwTableNode * m_pTableNode
Definition: swtable.hxx:126
const_iterator begin() const
Definition: swtable.hxx:78
Starts a section of nodes in the document model.
Definition: node.hxx:313
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
std::vector< SwTableLine * >::size_type size_type
Definition: swtable.hxx:68
const SwHTMLTableLayout * GetHTMLTableLayout() const
Definition: swtable.hxx:178
void SetRowsToRepeat(sal_uInt16 nNumOfRows)
Definition: swtable.hxx:197
Marks a position in the document model.
Definition: pam.hxx:36
const_iterator end() const
Definition: swtable.hxx:80
bool SplitRow(SwDoc &rDoc, const SwSelBoxes &rBoxes, sal_uInt16 nCnt, bool bSameHeight)
Definition: swtable.hxx:238
const SwTableBox * GetUpper() const
Definition: swtable.hxx:377
void FindSuperfluousRows(SwSelBoxes &rBoxes)
Definition: swtable.hxx:258
std::optional< Color > mxUserColor
Definition: swtable.hxx:431
std::string GetValue
bool mbDummyFlag
Definition: swtable.hxx:434
long Long
const SwTableBoxes & GetTabBoxes() const
Definition: swtable.hxx:369
Definition: doc.hxx:187
const SwTableSortBoxes & GetTabSortBoxes() const
Definition: swtable.hxx:263
const SwTableLines & GetTabLines() const
Definition: swtable.hxx:202
TableChgWidthHeightType
Definition: tblenum.hxx:26
void push_back(SwTableLine *pLine)
Definition: swtable.hxx:92
SwTableLine is one table row in the document model.
Definition: swtable.hxx:357
sal_uInt16 GetRowsToRepeat() const
Definition: swtable.hxx:196
void SetRedlineType(RedlineType eType)
Definition: swtable.hxx:414
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: calbck.cxx:120
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
iterator begin()
Definition: swtable.hxx:77
SwTableLine * front() const
Definition: swtable.hxx:81
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:204
size_type size() const
Definition: swtable.hxx:76
std::optional< Color > mxNumFormatColor
Definition: swtable.hxx:432
SwTableBoxes m_aBoxes
Definition: swtable.hxx:359
SwTableLine * back() const
Definition: swtable.hxx:82
SwTableLines m_aLines
Definition: swtable.hxx:116
const SwTableBox & FindEndOfRowSpan(const SwTable &rTable, sal_uInt16 nMaxStep) const
Definition: swtable.hxx:525
void SetSaveUserColor(std::optional< Color > p)
Definition: swtable.hxx:511
void SetTableModel(bool bNew)
Definition: swtable.hxx:187
void UnlockModify()
Definition: swtable.hxx:185
SwTableBox * m_pUpper
Definition: swtable.hxx:360
This structure is needed by Undo to restore row span attributes when a table has been split into two ...
Definition: tblrwcl.hxx:110
TableChgMode m_eTableChgMode
Definition: swtable.hxx:129
iterator insert(iterator aIt, SwTableLine *pLine)
Definition: swtable.hxx:86
const OUString & GetTableStyleName() const
Return the table style name of this table.
Definition: swtable.hxx:191
virtual OUString GetName() const override
void SetTableNode(SwTableNode *pNode)
Definition: swtable.hxx:323
std::vector< SwTableLine * >::const_iterator const_iterator
Definition: swtable.hxx:70
const SwStartNode * m_pStartNode
Definition: swtable.hxx:428
tools::SvRef< SwServerObject > m_xRefObj
Definition: swtable.hxx:118
Base class for various Writer styles.
Definition: format.hxx:46
std::vector< SwTableLine * >::iterator iterator
Definition: swtable.hxx:69
SwTableSortBoxes m_TabSortContentBoxes
Definition: swtable.hxx:117
RedlineType m_eRedlineType
Definition: swtable.hxx:361
SwTableSortBoxes & GetTabSortBoxes()
Definition: swtable.hxx:262
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
T * get() const
Style of a layout element.
Definition: frmfmt.hxx:59
const SwTableBox * GetTableBox(SwNodeOffset nSttIdx) const
Definition: swtable.hxx:295
bool empty() const
Definition: swtable.hxx:75
bool HasDirectFormatting() const
Do we contain any direct formatting (ie. something not affected by the table style)?
Definition: swtable.hxx:464
void clear()
Definition: swtable.hxx:83
const std::optional< Color > & GetSaveUserColor() const
Definition: swtable.hxx:509
void insert(iterator aIt, TInputIterator aFirst, TInputIterator aLast)
Definition: swtable.hxx:88
void LockModify()
Definition: swtable.hxx:184
vector_type::size_type size_type
Definition: docary.hxx:222
SwFrameFormat * GetFrameFormat() const
Definition: swtable.hxx:458
sal_Int32 mnRowSpan
Definition: swtable.hxx:433
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:380
void SetSaveNumFormatColor(std::optional< Color > p)
Definition: swtable.hxx:512
size
SwTableLines m_aLines
Definition: swtable.hxx:427
Marks a node in the document model.
Definition: ndindex.hxx:30
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:457
bool mbDirectFormatting
Do we contain any direct formatting?
Definition: swtable.hxx:437
std::shared_ptr< SwHTMLTableLayout > m_xHTMLLayout
Definition: swtable.hxx:120
const SwTableBox & FindStartOfRowSpan(const SwTable &rTable, sal_uInt16 nMaxStep=USHRT_MAX) const
Definition: swtable.hxx:520
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
iterator erase(iterator aFirst, iterator aLast)
Definition: swtable.hxx:85
sal_uInt16 m_nRowsToRepeat
Definition: swtable.hxx:133
sal_uInt16 GetBoxPos(const SwTableBox *pBox) const
Definition: swtable.hxx:370
SwTableLine * m_pUpper
Definition: swtable.hxx:429
void DelBoxNode(SwTableSortBoxes const &rSortCntBoxes)
Definition: swtable.cxx:212
sal_uInt16 IncGrfsThatResize()
Definition: swtable.hxx:181
SwTableLines & GetTabLines()
Definition: swtable.hxx:201
tools::Long SwTwips
Definition: swtypes.hxx:51
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:112
SwTableLines & GetTabLines()
Definition: swtable.hxx:450
void reserve(size_type nSize)
Definition: swtable.hxx:93
const SwServerObject * GetObject() const
Definition: swtable.hxx:327
void SetTableChgMode(TableChgMode eMode)
Definition: swtable.hxx:334
SwTableBoxes & GetTabBoxes()
Definition: swtable.hxx:368
std::vector< SwTableBox * > SwTableBoxes
Definition: swtable.hxx:105
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:471
SwServerObject * GetObject()
Definition: swtable.hxx:328
sal_uInt16 DecGrfsThatResize()
Definition: swtable.hxx:182
std::vector< SwTableLine * > m_vLines
Definition: swtable.hxx:65
const SwTableLines & GetTabLines() const
Definition: swtable.hxx:451
void SetDirectFormatting(bool bDirect)
Set that this table box contains formatting that is not set by the table style.
Definition: swtable.hxx:461
OUString maTableStyleName
Name of the table style to be applied on this table.
Definition: swtable.hxx:136
void SetTableStyleName(const OUString &rName)
Set the new table style name for this table.
Definition: swtable.hxx:194
SwHTMLTableLayout * GetHTMLTableLayout()
Definition: swtable.hxx:177
const SwTableLine * GetUpper() const
Definition: swtable.hxx:454
SwFrameFormat * GetFrameFormat() const
Definition: swtable.hxx:381
SwTableLine *& operator[](size_type nPos)
Definition: swtable.hxx:94
bool Merge(SwDoc *pDoc, const SwSelBoxes &rBoxes, const SwSelBoxes &rMerged, SwTableBox *pMergeBox, SwUndoTableMerge *pUndo)
Definition: swtable.hxx:232
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:164
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:418
WriterListener & operator=(WriterListener const &)=delete
SwTableBox * GetUpper()
Definition: swtable.hxx:376
virtual bool GetInfo(SfxPoolItem &) const
Definition: calbck.hxx:171
void SetUpper(SwTableBox *pNew)
Definition: swtable.hxx:378
void SetUpper(SwTableLine *pNew)
Definition: swtable.hxx:455
sal_uInt16 GetPos(const SwTableLine *pBox) const
Definition: swtable.hxx:98
TableChgMode
Definition: tblenum.hxx:47
RedlineType
iterator end()
Definition: swtable.hxx:79
bool IsNewModel() const
Definition: swtable.hxx:188
SwTableLine * GetUpper()
Definition: swtable.hxx:453
SwBoxSelection is a small helperclass (structure) to handle selections of cells (boxes) between table...
Definition: swnewtable.cxx:64
void sw_GetTableBoxColStr(sal_uInt16 nCol, OUString &rNm)
Definition: swtable.cxx:1955
TableChgMode GetTableChgMode() const
Definition: swtable.hxx:333
SwCellFrame is one table cell in the document layout.
Definition: cellfrm.hxx:30
iterator erase(iterator aIt)
Definition: swtable.hxx:84
std::unique_ptr< Impl > m_pImpl
Definition: swtable.hxx:534
SwTableFormat * GetFrameFormat() const
Definition: swtable.hxx:205
sal_uInt16 m_nGraphicsThatResize
Definition: swtable.hxx:131
Base class of the Writer document model elements.
Definition: node.hxx:81
SwTableLine * operator[](size_type nPos) const
Definition: swtable.hxx:95