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