LibreOffice Module sw (master) 1
untbl.cxx
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
20#include <libxml/xmlwriter.h>
21
22#include <UndoTable.hxx>
23#include <UndoRedline.hxx>
24#include <UndoDelete.hxx>
25#include <UndoSplitMove.hxx>
26#include <UndoCore.hxx>
27#include <fesh.hxx>
28#include <fmtpdsc.hxx>
29#include <hintids.hxx>
30#include <hints.hxx>
31#include <doc.hxx>
32#include <docredln.hxx>
33#include <IDocumentUndoRedo.hxx>
39#include <rootfrm.hxx>
40#include <editsh.hxx>
41#include <docary.hxx>
42#include <ndtxt.hxx>
43#include <swtable.hxx>
44#include <pam.hxx>
45#include <tblsel.hxx>
46#include <swundo.hxx>
47#include <rolbck.hxx>
48#include <ddefld.hxx>
49#include <tabfrm.hxx>
50#include <tblafmt.hxx>
51#include <poolfmt.hxx>
52#include <mvsave.hxx>
53#include <cellatr.hxx>
54#include <swtblfmt.hxx>
55#include <swddetbl.hxx>
56#include <redline.hxx>
57#include <node2lay.hxx>
58#include <tblrwcl.hxx>
59#include <fmtanchr.hxx>
60#include <strings.hrc>
61#include <unochart.hxx>
62#include <calbck.hxx>
63#include <frameformats.hxx>
65#include <osl/diagnose.h>
66#include <docsh.hxx>
67
68#include <memory>
69#include <utility>
70#include <vector>
71
72#ifdef DBG_UTIL
73#define CHECK_TABLE(t) (t).CheckConsistency();
74#else
75#define CHECK_TABLE(t)
76#endif
77
78#ifdef DBG_UTIL
79 #define DEBUG_REDLINE( pDoc ) sw_DebugRedline( pDoc );
80#else
81 #define DEBUG_REDLINE( pDoc )
82#endif
83
84typedef std::vector<std::shared_ptr<SfxItemSet> > SfxItemSets;
85
87{
89 std::unique_ptr<SfxItemSet> pBoxNumAttr;
90 std::unique_ptr<SwUndo> pUndo;
91
92 // Was the last paragraph of the new and the first paragraph of the old content joined?
93 bool bJoin; // For redlining only
94
95 explicit UndoTableCpyTable_Entry( const SwTableBox& rBox );
96
97 void dumpAsXml(xmlTextWriterPtr pWriter) const;
98};
99
100namespace {
101
102class SaveBox;
103class SaveLine;
104
105void KillEmptyFrameFormat(SwFrameFormat& rFormat)
106{
107 if(!rFormat.HasWriterListeners())
108 delete &rFormat;
109};
110
111}
112
114{
115 friend SaveBox;
116 friend SaveLine;
118 std::unique_ptr<SaveLine> m_pLine;
122 sal_uInt16 m_nLineCount;
123 bool m_bModifyBox : 1;
125 bool m_bNewModel : 1;
126
127 SaveTable(const SaveTable&) = delete;
128 SaveTable& operator=(const SaveTable&) = delete;
129 SwFrameFormat& CreateNewFormat(SwFrameFormat& rFormat, sal_uInt16 nFormatPos);
130
131public:
132 SaveTable( const SwTable& rTable, sal_uInt16 nLnCnt = USHRT_MAX,
133 bool bSaveFormula = true );
134
135 sal_uInt16 AddFormat( SwFrameFormat* pFormat, bool bIsLine );
136 void NewFrameFormatForLine(const SwTableLine&, sal_uInt16 nFormatPos, SwFrameFormat* pOldFormat);
137 void NewFrameFormatForBox(const SwTableBox&, sal_uInt16 nFormatPos, SwFrameFormat* pOldFormat);
138
139 void RestoreAttr( SwTable& rTable, bool bModifyBox = false );
140 void SaveContentAttrs( SwDoc* pDoc );
141 void CreateNew( SwTable& rTable, bool bCreateFrames = true,
142 bool bRestoreChart = true );
143 bool IsNewModel() const { return m_bNewModel; }
144};
145
146namespace {
147
148class SaveLine
149{
150 friend SaveTable;
151 friend class SaveBox;
152
153 SaveLine* m_pNext;
154 SaveBox* m_pBox;
155 sal_uInt16 m_nItemSet;
156
157 SaveLine(const SaveLine&) = delete;
158 SaveLine& operator=(const SaveLine&) = delete;
159
160public:
161 SaveLine( SaveLine* pPrev, const SwTableLine& rLine, SaveTable& rSTable );
162 ~SaveLine();
163
164 void RestoreAttr( SwTableLine& rLine, SaveTable& rSTable );
165 void SaveContentAttrs( SwDoc* pDoc );
166
167 void CreateNew( SwTable& rTable, SwTableBox& rParent, SaveTable& rSTable );
168};
169
170class SaveBox
171{
172 friend class SaveLine;
173
174 SaveBox* m_pNext;
175 SwNodeOffset m_nStartNode;
176 sal_Int32 m_nRowSpan;
177 sal_uInt16 m_nItemSet;
178 union
179 {
180 SfxItemSets* pContentAttrs;
181 SaveLine* pLine;
182 } m_Ptrs;
183
184public:
185 SaveBox( SaveBox* pPrev, const SwTableBox& rBox, SaveTable& rSTable );
186 ~SaveBox();
187
188 void RestoreAttr( SwTableBox& rBox, SaveTable& rSTable );
189 void SaveContentAttrs( SwDoc* pDoc );
190
191 void CreateNew( SwTable& rTable, SwTableLine& rParent, SaveTable& rSTable );
192};
193
194}
195
196#if OSL_DEBUG_LEVEL > 0
197static void CheckTable( const SwTable& );
198#define CHECKTABLE(t) CheckTable( t );
199#else
200#define CHECKTABLE(t)
201#endif
202
203/* #130880: Crash in undo of table to text when the table has (freshly) merged cells
204The order of cell content nodes in the nodes array is not given by the recursive table structure.
205The algorithm must not rely on this even it holds for a fresh loaded table in odt file format.
206So we need to remember not only the start node position but the end node position as well.
207*/
208
210{
213 sal_Int32 m_nContent;
214 std::unique_ptr<SwHistory> m_pHstry;
215 // metadata references for first and last paragraph in cell
216 std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
217 std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
218
219 SwTableToTextSave( SwDoc& rDoc, SwNodeOffset nNd, SwNodeOffset nEndIdx, sal_Int32 nContent );
220
221private:
224
225};
226
233
234SwUndoInsTable::SwUndoInsTable( const SwPosition& rPos, sal_uInt16 nCl, sal_uInt16 nRw,
235 sal_uInt16 nAdj, const SwInsertTableOptions& rInsTableOpts,
236 const SwTableAutoFormat* pTAFormat,
237 const std::vector<sal_uInt16> *pColArr,
238 const OUString & rName)
239 : SwUndo( SwUndoId::INSTABLE, &rPos.GetDoc() ),
240 m_aInsTableOptions( rInsTableOpts ),
241 m_nStartNode( rPos.GetNodeIndex() ), m_nRows( nRw ), m_nColumns( nCl ), m_nAdjust( nAdj )
242{
243 if( pColArr )
244 {
245 m_oColumnWidth.emplace( *pColArr );
246 }
247 if( pTAFormat )
248 m_pAutoFormat.reset( new SwTableAutoFormat( *pTAFormat ) );
249
250 // consider redline
251 SwDoc& rDoc = rPos.GetNode().GetDoc();
253 {
254 m_pRedlineData.reset( new SwRedlineData( RedlineType::Insert, rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() ) );
256 }
257
258 m_sTableName = rName;
259}
260
262{
263 m_pDDEFieldType.reset();
264 m_oColumnWidth.reset();
265 m_pRedlineData.reset();
266 m_pAutoFormat.reset();
267}
268
270{
271 SwDoc & rDoc = rContext.GetDoc();
272 SwNodeIndex aIdx( rDoc.GetNodes(), m_nStartNode );
273
274 SwTableNode* pTableNd = aIdx.GetNode().GetTableNode();
275 OSL_ENSURE( pTableNd, "no TableNode" );
276 pTableNd->DelFrames();
277
279 rDoc.getIDocumentRedlineAccess().DeleteRedline( *pTableNd, true, RedlineType::Any );
281
282 // move hard page breaks into next node
283 SwContentNode* pNextNd = rDoc.GetNodes()[ pTableNd->EndOfSectionIndex()+1 ]->GetContentNode();
284 if( pNextNd )
285 {
286 SwFrameFormat* pTableFormat = pTableNd->GetTable().GetFrameFormat();
287
288 if( const SwFormatPageDesc* pItem = pTableFormat->GetItemIfSet( RES_PAGEDESC,
289 false ) )
290 pNextNd->SetAttr( *pItem );
291
292 if( const SvxFormatBreakItem* pItem = pTableFormat->GetItemIfSet( RES_BREAK,
293 false ) )
294 pNextNd->SetAttr( *pItem );
295
296 ::sw::NotifyTableCollapsedParagraph(pNextNd, nullptr);
297 }
298
299 m_sTableName = pTableNd->GetTable().GetFrameFormat()->GetName();
300 if( auto pDDETable = dynamic_cast<const SwDDETable *>(&pTableNd->GetTable()) )
301 m_pDDEFieldType.reset(static_cast<SwDDEFieldType*>(pDDETable->GetDDEFieldType()->Copy().release()));
302
303 rDoc.GetNodes().Delete( aIdx, pTableNd->EndOfSectionIndex() -
304 aIdx.GetIndex() + 1 );
305
306 SwPaM & rPam( rContext.GetCursorSupplier().CreateNewShellCursor() );
307 rPam.DeleteMark();
308 rPam.GetPoint()->Assign(aIdx);
309}
310
312{
313 SwDoc & rDoc = rContext.GetDoc();
314
315 SwPosition const aPos(rDoc.GetNodes(), m_nStartNode);
316 const SwTable* pTable = rDoc.InsertTable( m_aInsTableOptions, aPos, m_nRows, m_nColumns,
317 m_nAdjust,
318 m_pAutoFormat.get(),
319 m_oColumnWidth ? &*m_oColumnWidth : nullptr );
321 static_cast<SwFrameFormat*>(pTable->GetFrameFormat())->SetFormatName( m_sTableName );
322 SwTableNode* pTableNode = rDoc.GetNodes()[m_nStartNode]->GetTableNode();
323
324 if( m_pDDEFieldType )
325 {
328 std::unique_ptr<SwDDETable> pDDETable(new SwDDETable( pTableNode->GetTable(), pNewType ));
329 pTableNode->SetNewTable( std::move(pDDETable) );
330 m_pDDEFieldType.reset();
331 }
332
336 return;
337
338 SwPaM aPam( *pTableNode->EndOfSectionNode(), *pTableNode, SwNodeOffset(1) );
339
341 {
344
347 }
348 else
350}
351
353{
354 rContext.GetDoc().InsertTable(
357 m_oColumnWidth ? &*m_oColumnWidth : nullptr );
358}
359
361{
362 SwRewriter aRewriter;
363
364 aRewriter.AddRule(UndoArg1, SwResId(STR_START_QUOTE));
365 aRewriter.AddRule(UndoArg2, m_sTableName);
366 aRewriter.AddRule(UndoArg3, SwResId(STR_END_QUOTE));
367
368 return aRewriter;
369}
370
372 : m_nSttNd( nNd ), m_nEndNd( nEndIdx), m_nContent( nCnt )
373{
374 // keep attributes of the joined node
375 SwTextNode* pNd = rDoc.GetNodes()[ nNd ]->GetTextNode();
376 if( pNd )
377 {
378 m_pHstry.reset( new SwHistory );
379
380 m_pHstry->Add( pNd->GetTextColl(), nNd, SwNodeType::Text );
381 if ( pNd->GetpSwpHints() )
382 {
383 m_pHstry->CopyAttr( pNd->GetpSwpHints(), nNd, 0,
384 pNd->GetText().getLength(), false );
385 }
386 if( pNd->HasSwAttrSet() )
387 m_pHstry->CopyFormatAttr( *pNd->GetpSwAttrSet(), nNd );
388
389 if( !m_pHstry->Count() )
390 {
391 m_pHstry.reset();
392 }
393
394 // METADATA: store
396 }
397
398 // we also need to store the metadata reference of the _last_ paragraph
399 // we subtract 1 to account for the removed cell start/end node pair
400 // (after SectionUp, the end of the range points to the node after the cell)
401 if ( nEndIdx - 1 > nNd )
402 {
403 SwTextNode* pLastNode( rDoc.GetNodes()[ nEndIdx - 1 ]->GetTextNode() );
404 if( pLastNode )
405 {
406 // METADATA: store
407 m_pMetadataUndoEnd = pLastNode->CreateUndo();
408 }
409 }
410}
411
413 : SwUndo( SwUndoId::TABLETOTEXT, rTable.GetFrameFormat()->GetDoc() ),
414 m_sTableName( rTable.GetFrameFormat()->GetName() ),
415 m_nStartNode( 0 ), m_nEndNode( 0 ),
416 m_cSeparator( cCh ), m_nHeadlineRepeat( rTable.GetRowsToRepeat() )
417{
418 m_pTableSave.reset( new SaveTable( rTable ) );
419 m_vBoxSaves.reserve(rTable.GetTabSortBoxes().size());
420
421 if( auto pDDETable = dynamic_cast<const SwDDETable *>(&rTable) )
422 m_pDDEFieldType.reset(static_cast<SwDDEFieldType*>(pDDETable->GetDDEFieldType()->Copy().release()));
423
425
426 m_pHistory.reset(new SwHistory);
427 const SwTableNode* pTableNd = rTable.GetTableNode();
428 SwNodeOffset nTableStt = pTableNd->GetIndex(), nTableEnd = pTableNd->EndOfSectionIndex();
429
430 const SwFrameFormats& rFrameFormatTable = *pTableNd->GetDoc().GetSpzFrameFormats();
431 for( size_t n = 0; n < rFrameFormatTable.size(); ++n )
432 {
433 SwFrameFormat* pFormat = rFrameFormatTable[ n ];
434 SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor();
435 SwPosition const*const pAPos = pAnchor->GetContentAnchor();
436 if (pAPos &&
437 ((RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId()) ||
438 (RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId())) &&
439 nTableStt <= pAPos->GetNodeIndex() &&
440 pAPos->GetNodeIndex() < nTableEnd )
441 {
442 m_pHistory->AddChangeFlyAnchor(*pFormat);
443 }
444 }
445
446 if( !m_pHistory->Count() )
447 {
448 m_pHistory.reset();
449 }
450}
451
453{
454 m_pDDEFieldType.reset();
455 m_pTableSave.reset();
456 m_vBoxSaves.clear();
457 m_pHistory.reset();
458}
459
461{
462 SwDoc & rDoc = rContext.GetDoc();
463 SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
464
465 SwNodeIndex aFrameIdx( rDoc.GetNodes(), m_nStartNode );
466 SwNodeIndex aEndIdx( rDoc.GetNodes(), m_nEndNode );
467
468 pPam->GetPoint()->Assign( aFrameIdx );
469 pPam->SetMark();
470 pPam->GetPoint()->Assign( aEndIdx );
471 rDoc.DelNumRules( *pPam );
472 pPam->DeleteMark();
473
474 // now collect all Uppers
475 SwNode2LayoutSaveUpperFrames aNode2Layout(aFrameIdx.GetNode());
476
477 // create TableNode structure
479 pTableNd->GetTable().SetTableModel( m_pTableSave->IsNewModel() );
481 pTableNd->GetTable().RegisterToFormat( *pTableFormat );
483
484 // create old table structure
485 m_pTableSave->CreateNew( pTableNd->GetTable() );
486
487 if( m_pDDEFieldType )
488 {
491 std::unique_ptr<SwDDETable> pDDETable( new SwDDETable( pTableNd->GetTable(), pNewType ) );
492 pTableNd->SetNewTable( std::move(pDDETable), false );
493 m_pDDEFieldType.reset();
494 }
495
497 {
498 SwTableSortBoxes& rBxs = pTableNd->GetTable().GetTabSortBoxes();
499 for (size_t nBoxes = rBxs.size(); nBoxes; )
500 {
501 rDoc.ChkBoxNumFormat( *rBxs[ --nBoxes ], false );
502 }
503 }
504
505 if( m_pHistory )
506 {
507 sal_uInt16 nTmpEnd = m_pHistory->GetTmpEnd();
508 m_pHistory->TmpRollback( &rDoc, 0 );
509 m_pHistory->SetTmpEnd( nTmpEnd );
510 }
511
512 aNode2Layout.RestoreUpperFrames( rDoc.GetNodes(),
513 pTableNd->GetIndex(), pTableNd->GetIndex()+1 );
514
515 // Is a table selection requested?
516 pPam->DeleteMark();
517 pPam->GetPoint()->Assign( *pTableNd->EndOfSectionNode() );
518 pPam->SetMark();
519 pPam->GetPoint()->Assign( *pPam->GetPointNode().StartOfSectionNode() );
521 pPam->Exchange();
523
524 ClearFEShellTabCols(rDoc, nullptr);
525}
526
527// located in untbl.cxx and only an Undo object is allowed to call it
529 const SwTableToTextSaves& rSavedData )
530{
531 SwNodeIndex aSttIdx( *this, nSttNd );
532 SwNodeIndex aEndIdx( *this, nEndNd+1 );
533
534 SwTableNode * pTableNd = new SwTableNode( aSttIdx.GetNode() );
535 SwEndNode* pEndNd = new SwEndNode( aEndIdx.GetNode(), *pTableNd );
536
537 aEndIdx = *pEndNd;
538
539 /* Set pTableNd as start of section for all nodes in [nSttNd, nEndNd].
540 Delete all Frames attached to the nodes in that range. */
541 SwNode* pNd;
542 {
543 SwNodeOffset n, nTmpEnd = aEndIdx.GetIndex();
544 for( n = pTableNd->GetIndex() + 1; n < nTmpEnd; ++n )
545 {
546 if( ( pNd = (*this)[ n ] )->IsContentNode() )
547 static_cast<SwContentNode*>(pNd)->DelFrames(nullptr);
548 pNd->m_pStartOfSection = pTableNd;
549 }
550 }
551
552 // than create table structure partially. First a single line that contains
553 // all boxes. The correct structure is then taken from SaveStruct.
556 SwTableLine* pLine = new SwTableLine( pLineFormat, rSavedData.size(), nullptr );
557 pTableNd->GetTable().GetTabLines().insert( pTableNd->GetTable().GetTabLines().begin(), pLine );
558
559 const std::shared_ptr<sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
560 for( size_t n = rSavedData.size(); n; )
561 {
562 const SwTableToTextSave *const pSave = rSavedData[ --n ].get();
563 // if the start node was merged with last from prev. cell,
564 // subtract 1 from index to get the merged paragraph, and split that
565 aSttIdx = pSave->m_nSttNd - ( ( SAL_MAX_INT32 != pSave->m_nContent ) ? 1 : 0);
566 SwTextNode* pTextNd = aSttIdx.GetNode().GetTextNode();
567
568 if( SAL_MAX_INT32 != pSave->m_nContent )
569 {
570 // split at ContentPosition, delete previous char (= separator)
571 OSL_ENSURE( pTextNd, "Where is my TextNode?" );
572 SwContentIndex aCntPos( pTextNd, pSave->m_nContent - 1 );
573
574 pTextNd->EraseText( aCntPos, 1 );
575
576 std::function<void (SwTextNode *, sw::mark::RestoreMode, bool)> restoreFunc(
577 [&](SwTextNode *const pNewNode, sw::mark::RestoreMode const eMode, bool)
578 {
579 if (!pContentStore->Empty())
580 {
581 pContentStore->Restore(*pNewNode, pSave->m_nContent, pSave->m_nContent + 1, eMode);
582 }
583 });
584 pTextNd->SplitContentNode(
585 SwPosition(aSttIdx, aCntPos), &restoreFunc);
586 }
587 else
588 {
589 pContentStore->Clear();
590 if( pTextNd )
591 {
592 pContentStore->Save(GetDoc(), aSttIdx.GetIndex(), SAL_MAX_INT32);
593 }
594 }
595
596 if( pTextNd )
597 {
598 // METADATA: restore
600 if( pTextNd->HasSwAttrSet() )
601 pTextNd->ResetAllAttr();
602
603 if( pTextNd->GetpSwpHints() )
604 pTextNd->ClearSwpHintsArr( false );
605 }
606
607 if( pSave->m_pHstry )
608 {
609 sal_uInt16 nTmpEnd = pSave->m_pHstry->GetTmpEnd();
610 pSave->m_pHstry->TmpRollback( &GetDoc(), 0 );
611 pSave->m_pHstry->SetTmpEnd( nTmpEnd );
612 }
613
614 // METADATA: restore
615 // end points to node after cell
616 if ( pSave->m_nEndNd - 1 > pSave->m_nSttNd )
617 {
618 SwTextNode* pLastNode = (*this)[ pSave->m_nEndNd - 1 ]->GetTextNode();
619 if (pLastNode)
620 {
621 pLastNode->RestoreMetadata(pSave->m_pMetadataUndoEnd);
622 }
623 }
624
625 aEndIdx = pSave->m_nEndNd;
626 SwStartNode* pSttNd = new SwStartNode( aSttIdx.GetNode(), SwNodeType::Start,
628 pSttNd->m_pStartOfSection = pTableNd;
629 new SwEndNode( aEndIdx.GetNode(), *pSttNd );
630
631 for( SwNodeOffset i = aSttIdx.GetIndex(); i < aEndIdx.GetIndex()-1; ++i )
632 {
633 pNd = (*this)[ i ];
634 pNd->m_pStartOfSection = pSttNd;
635 if( pNd->IsStartNode() )
636 i = pNd->EndOfSectionIndex();
637 }
638
639 SwTableBox* pBox = new SwTableBox( pBoxFormat, *pSttNd, pLine );
640 pLine->GetTabBoxes().insert( pLine->GetTabBoxes().begin(), pBox );
641 }
642 return pTableNd;
643}
644
646{
647 SwDoc & rDoc = rContext.GetDoc();
648 SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
649
650 pPam->GetPoint()->Assign( m_nStartNode );
651 SwNodeIndex aSaveIdx( pPam->GetPoint()->GetNode(), -1 );
652
653 pPam->SetMark(); // log off all indices
654 pPam->DeleteMark();
655
656 SwTableNode* pTableNd = pPam->GetPointNode().GetTableNode();
657 OSL_ENSURE( pTableNd, "Could not find any TableNode" );
658
659 if( auto pDDETable = dynamic_cast<const SwDDETable *>(&pTableNd->GetTable()) )
660 m_pDDEFieldType.reset(static_cast<SwDDEFieldType*>(pDDETable->GetDDEFieldType()->Copy().release()));
661
662 rDoc.TableToText( pTableNd, m_cSeparator );
663
664 ++aSaveIdx;
665 SwContentNode* pCNd = aSaveIdx.GetNode().GetContentNode();
666 if( !pCNd && nullptr == ( pCNd = rDoc.GetNodes().GoNext( &aSaveIdx ) ) &&
667 nullptr == ( pCNd = SwNodes::GoPrevious( &aSaveIdx )) )
668 {
669 OSL_FAIL( "Where is the TextNode now?" );
670 }
671
672 pPam->GetPoint()->Assign( aSaveIdx );
673
674 pPam->SetMark(); // log off all indices
675 pPam->DeleteMark();
676}
677
679{
680 SwPaM *const pPam = & rContext.GetRepeatPaM();
681 SwTableNode *const pTableNd = pPam->GetPointNode().FindTableNode();
682 if( pTableNd )
683 {
684 // move cursor out of table
685 pPam->GetPoint()->Assign( *pTableNd->EndOfSectionNode() );
687 pPam->SetMark();
688 pPam->DeleteMark();
689
690 rContext.GetDoc().TableToText( pTableNd, m_cSeparator );
691 }
692}
693
695{
697 m_nEndNode = rRg.aEnd.GetIndex();
698}
699
700void SwUndoTableToText::AddBoxPos( SwDoc& rDoc, SwNodeOffset nNdIdx, SwNodeOffset nEndIdx, sal_Int32 nContentIdx )
701{
702 m_vBoxSaves.push_back(std::make_unique<SwTableToTextSave>(rDoc, nNdIdx, nEndIdx, nContentIdx));
703}
704
706 const SwInsertTableOptions& rInsTableOpts,
707 sal_Unicode cCh, sal_uInt16 nAdj,
708 const SwTableAutoFormat* pAFormat )
709 : SwUndo( SwUndoId::TEXTTOTABLE, &rRg.GetDoc() ), SwUndRng( rRg ), m_aInsertTableOpts( rInsTableOpts ),
710 m_pHistory( nullptr ), m_cSeparator( cCh ), m_nAdjust( nAdj )
711{
712 if( pAFormat )
713 m_pAutoFormat.reset( new SwTableAutoFormat( *pAFormat ) );
714
715 const SwPosition* pEnd = rRg.End();
716 SwNodes& rNds = rRg.GetDoc().GetNodes();
717 m_bSplitEnd = pEnd->GetContentIndex() && ( pEnd->GetContentIndex()
718 != pEnd->GetNode().GetContentNode()->Len() ||
719 pEnd->GetNodeIndex() >= rNds.GetEndOfContent().GetIndex()-1 );
720}
721
723{
724 m_pAutoFormat.reset();
725}
726
728{
729 SwDoc & rDoc = rContext.GetDoc();
730
731 SwNodeOffset nTableNd = m_nSttNode;
732 if( m_nSttContent )
733 ++nTableNd; // Node was split previously
734 SwNodeIndex aIdx( rDoc.GetNodes(), nTableNd );
735 SwTableNode *const pTNd = aIdx.GetNode().GetTableNode();
736 OSL_ENSURE( pTNd, "Could not find a TableNode" );
737
738 RemoveIdxFromSection( rDoc, nTableNd );
739
741
742 if( m_pHistory )
743 {
744 m_pHistory->TmpRollback( &rDoc, 0 );
746 }
747
748 if( !mvDelBoxes.empty() )
749 {
750 pTNd->DelFrames();
751 SwTable& rTable = pTNd->GetTable();
752 for( size_t n = mvDelBoxes.size(); n; )
753 {
754 SwTableBox* pBox = rTable.GetTableBox( mvDelBoxes[ --n ] );
755 if( pBox )
756 ::DeleteBox_( rTable, pBox, nullptr, false, false );
757 else {
758 OSL_ENSURE( false, "Where is my box?" );
759 }
760 }
761 }
762
763 rDoc.TableToText( pTNd, 0x0b == m_cSeparator ? 0x09 : m_cSeparator );
764
765 // join again at start?
766 SwPaM aPam(rDoc.GetNodes().GetEndOfContent());
767 SwPosition *const pPos = aPam.GetPoint();
768 if( m_nSttContent )
769 {
770 pPos->Assign(nTableNd);
772 {
773 SwNode & rIdx = aPam.GetPoint()->GetNode();
774
775 // than move, relatively, the Cursor/etc. again
776 RemoveIdxRel( rIdx.GetIndex()+1, *pPos );
777
778 rIdx.GetContentNode()->JoinNext();
779 }
780 }
781
782 // join again at end?
783 if( m_bSplitEnd )
784 {
785 pPos->Assign( m_nEndNode );
786 SwTextNode* pTextNd = pPos->GetNode().GetTextNode();
787 if( pTextNd && pTextNd->CanJoinNext() )
788 {
789 aPam.GetMark()->nContent.Assign( nullptr, 0 );
790 aPam.GetPoint()->nContent.Assign( nullptr, 0 );
791
792 // than move, relatively, the Cursor/etc. again
793 pPos->SetContent(pTextNd->GetText().getLength());
794 RemoveIdxRel( m_nEndNode + 1, *pPos );
795
796 pTextNd->JoinNext();
797 }
798 }
799
800 AddUndoRedoPaM(rContext);
801}
802
804{
805 SwPaM & rPam( AddUndoRedoPaM(rContext) );
806 RemoveIdxFromRange(rPam, false);
807 SetPaM(rPam);
808
809 SwTable const*const pTable = rContext.GetDoc().TextToTable(
811 static_cast<SwFrameFormat*>(pTable->GetFrameFormat())->SetFormatName( m_sTableName );
812}
813
815{
816 // no Table In Table
817 if (!rContext.GetRepeatPaM().GetPointNode().FindTableNode())
818 {
819 rContext.GetDoc().TextToTable( m_aInsertTableOpts, rContext.GetRepeatPaM(),
821 m_pAutoFormat.get() );
822 }
823}
824
826{
827 mvDelBoxes.push_back( rBox.GetSttIdx() );
828}
829
831{
832 if( !m_pHistory )
833 m_pHistory = new SwHistory;
834 return *m_pHistory;
835}
836
837SwUndoTableHeadline::SwUndoTableHeadline( const SwTable& rTable, sal_uInt16 nOldHdl,
838 sal_uInt16 nNewHdl )
839 : SwUndo( SwUndoId::TABLEHEADLINE, rTable.GetFrameFormat()->GetDoc() ),
840 m_nOldHeadline( nOldHdl ),
841 m_nNewHeadline( nNewHdl )
842{
843 OSL_ENSURE( !rTable.GetTabSortBoxes().empty(), "Table without content" );
844 const SwStartNode *pSttNd = rTable.GetTabSortBoxes()[ 0 ]->GetSttNd();
845 OSL_ENSURE( pSttNd, "Box without content" );
846
848}
849
851{
852 SwDoc & rDoc = rContext.GetDoc();
853 SwTableNode* pTNd = rDoc.GetNodes()[ m_nTableNode ]->GetTableNode();
854 OSL_ENSURE( pTNd, "could not find any TableNode" );
855
856 rDoc.SetRowsToRepeat( pTNd->GetTable(), m_nOldHeadline );
857}
858
860{
861 SwDoc & rDoc = rContext.GetDoc();
862
863 SwTableNode* pTNd = rDoc.GetNodes()[ m_nTableNode ]->GetTableNode();
864 OSL_ENSURE( pTNd, "could not find any TableNode" );
865
866 rDoc.SetRowsToRepeat( pTNd->GetTable(), m_nNewHeadline );
867}
868
870{
871 SwTableNode *const pTableNd =
873 if( pTableNd )
874 {
875 rContext.GetDoc().SetRowsToRepeat( pTableNd->GetTable(), m_nNewHeadline );
876 }
877}
878
879SaveTable::SaveTable( const SwTable& rTable, sal_uInt16 nLnCnt, bool bSaveFormula )
880 : m_aTableSet(*rTable.GetFrameFormat()->GetAttrSet().GetPool(), aTableSetRange),
881 m_pSwTable(&rTable), m_nLineCount(nLnCnt), m_bSaveFormula(bSaveFormula)
882{
883 m_bModifyBox = false;
884 m_bNewModel = rTable.IsNewModel();
886 m_pLine.reset( new SaveLine( nullptr, *rTable.GetTabLines()[ 0 ], *this ) );
887
888 SaveLine* pLn = m_pLine.get();
889 if( USHRT_MAX == nLnCnt )
890 nLnCnt = rTable.GetTabLines().size();
891 for( sal_uInt16 n = 1; n < nLnCnt; ++n )
892 pLn = new SaveLine( pLn, *rTable.GetTabLines()[ n ], *this );
893
895 m_pSwTable = nullptr;
896}
897
898sal_uInt16 SaveTable::AddFormat( SwFrameFormat* pFormat, bool bIsLine )
899{
900 size_t nRet = m_aFrameFormats.GetPos(pFormat);
901 if( SIZE_MAX == nRet )
902 {
903 // Create copy of ItemSet
904 auto pSet = std::make_shared<SfxItemSet>( *pFormat->GetAttrSet().GetPool(),
906 pSet->Put( pFormat->GetAttrSet() );
907 // When a formula is set, never save the value. It possibly must be
908 // recalculated.
909 // Save formulas always in plain text.
910 if( const SwTableBoxFormula* pItem = pSet->GetItemIfSet( RES_BOXATR_FORMULA ))
911 {
912 pSet->ClearItem( RES_BOXATR_VALUE );
914 {
916 aMsgHint.m_eFlags = TBL_BOXNAME;
917 SwTableBoxFormula* pFormulaItem = const_cast<SwTableBoxFormula*>(pItem);
918 pFormulaItem->ChgDefinedIn( pFormat );
919 pFormulaItem->ChangeState( &aMsgHint );
920 pFormulaItem->ChgDefinedIn( nullptr );
921 }
922 }
923 nRet = m_aSets.size();
924 m_aSets.push_back(pSet);
925 m_aFrameFormats.insert(m_aFrameFormats.begin() + nRet, pFormat);
926 }
927 return o3tl::narrowing<sal_uInt16>(nRet);
928}
929
930void SaveTable::RestoreAttr( SwTable& rTable, bool bMdfyBox )
931{
932 m_bModifyBox = bMdfyBox;
933
934 FndBox_ aTmpBox( nullptr, nullptr );
935 bool bHideChanges = rTable.GetFrameFormat()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->IsHideRedlines();
936 // TODO delete/make frames only at changing line attribute TextChangesOnly (RES_PRINT) to true again
937 if ( bHideChanges )
938 aTmpBox.DelFrames( rTable );
939
940 // first, get back attributes of TableFrameFormat
941 SwFrameFormat* pFormat = rTable.GetFrameFormat();
942 SfxItemSet& rFormatSet = const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pFormat->GetAttrSet()));
943 rFormatSet.ClearItem();
944 rFormatSet.Put(m_aTableSet);
945
947
948 // table without table frame
949 bool bHiddenTable = true;
950
951 // for safety, invalidate all TableFrames
952 SwIterator<SwTabFrame,SwFormat> aIter( *pFormat );
953 for( SwTabFrame* pLast = aIter.First(); pLast; pLast = aIter.Next() )
954 {
955 if( pLast->GetTable() == &rTable )
956 {
957 pLast->InvalidateAll();
958 pLast->SetCompletePaint();
959 bHiddenTable = false;
960 }
961 }
962
963 // fill FrameFormats with defaults (0)
964 pFormat = nullptr;
965 for (size_t n = m_aSets.size(); n; --n)
966 m_aFrameFormats.push_back(pFormat);
967
968 const size_t nLnCnt = (USHRT_MAX == m_nLineCount)
969 ? rTable.GetTabLines().size()
970 : m_nLineCount;
971
972 SaveLine* pLn = m_pLine.get();
973 for (size_t n = 0; n < nLnCnt; ++n, pLn = pLn->m_pNext)
974 {
975 if( !pLn )
976 {
977 OSL_ENSURE( false, "Number of lines changed" );
978 break;
979 }
980
981 pLn->RestoreAttr( *rTable.GetTabLines()[ n ], *this );
982 }
983
985 m_bModifyBox = false;
986
987 if ( bHideChanges )
988 {
989 if ( bHiddenTable )
990 {
991 SwTableNode* pTableNode = rTable.GetTableNode();
992 pTableNode->DelFrames();
993 pTableNode->MakeOwnFrames();
994 }
995 else
996 {
997 aTmpBox.MakeFrames( rTable );
998 }
999 }
1000}
1001
1003{
1004 m_pLine->SaveContentAttrs(pDoc);
1005}
1006
1007void SaveTable::CreateNew( SwTable& rTable, bool bCreateFrames,
1008 bool bRestoreChart )
1009{
1010 FndBox_ aTmpBox( nullptr, nullptr );
1011 aTmpBox.DelFrames( rTable );
1012
1013 // first, get back attributes of TableFrameFormat
1014 SwFrameFormat* pFormat = rTable.GetFrameFormat();
1015 SfxItemSet& rFormatSet = const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pFormat->GetAttrSet()));
1016 rFormatSet.ClearItem();
1017 rFormatSet.Put(m_aTableSet);
1018
1020
1021 // SwTableBox must have a format - the SwTableBox takes ownership of it
1022 SwTableBoxFormat *const pNewFormat(pFormat->GetDoc()->MakeTableBoxFormat());
1023 SwTableBox aParent(pNewFormat, rTable.GetTabLines().size(), nullptr);
1024
1025 // fill FrameFormats with defaults (0)
1026 pFormat = nullptr;
1027 for( size_t n = m_aSets.size(); n; --n )
1028 m_aFrameFormats.push_back(pFormat);
1029
1030 m_pLine->CreateNew(rTable, aParent, *this);
1032
1033 // add new lines, delete old ones
1034 const size_t nOldLines = (USHRT_MAX == m_nLineCount)
1035 ? rTable.GetTabLines().size()
1036 : m_nLineCount;
1037
1038 SwDoc *pDoc = rTable.GetFrameFormat()->GetDoc();
1040 size_t n = 0;
1041 for( ; n < aParent.GetTabLines().size(); ++n )
1042 {
1043 SwTableLine* pLn = aParent.GetTabLines()[ n ];
1044 pLn->SetUpper( nullptr );
1045 if( n < nOldLines )
1046 {
1047 SwTableLine* pOld = rTable.GetTabLines()[ n ];
1048
1049 // TL_CHART2: notify chart about boxes to be removed
1050 const SwTableBoxes &rBoxes = pOld->GetTabBoxes();
1051 const size_t nBoxes = rBoxes.size();
1052 for (size_t k = 0; k < nBoxes; ++k)
1053 {
1054 SwTableBox *pBox = rBoxes[k];
1055 if (pPCD)
1056 pPCD->DeleteBox( &rTable, *pBox );
1057 }
1058
1059 rTable.GetTabLines()[n] = pLn;
1060 delete pOld;
1061 }
1062 else
1063 rTable.GetTabLines().insert( rTable.GetTabLines().begin() + n, pLn );
1064 }
1065
1066 if( n < nOldLines )
1067 {
1068 // remove remaining lines...
1069 for (size_t k1 = 0; k1 < nOldLines - n; ++k1)
1070 {
1071 const SwTableBoxes &rBoxes = rTable.GetTabLines()[n + k1]->GetTabBoxes();
1072 const size_t nBoxes = rBoxes.size();
1073 for (size_t k2 = 0; k2 < nBoxes; ++k2)
1074 {
1075 SwTableBox *pBox = rBoxes[k2];
1076 // TL_CHART2: notify chart about boxes to be removed
1077 if (pPCD)
1078 pPCD->DeleteBox( &rTable, *pBox );
1079 }
1080 }
1081
1082 for( SwTableLines::const_iterator it = rTable.GetTabLines().begin() + n;
1083 it != rTable.GetTabLines().begin() + nOldLines; ++it )
1084 delete *it;
1085 rTable.GetTabLines().erase( rTable.GetTabLines().begin() + n, rTable.GetTabLines().begin() + nOldLines );
1086 }
1087
1088 aParent.GetTabLines().erase( aParent.GetTabLines().begin(), aParent.GetTabLines().begin() + n );
1089 assert(aParent.GetTabLines().empty());
1090
1091 if( bCreateFrames )
1092 aTmpBox.MakeFrames( rTable );
1093 if( bRestoreChart )
1094 {
1095 // TL_CHART2: need to inform chart of probably changed cell names
1096 pDoc->UpdateCharts( rTable.GetFrameFormat()->GetName() );
1097 }
1098}
1099
1101{
1102 rFormat.SetFormatAttr(*m_aSets[nFormatPos]);
1103 m_aFrameFormats[nFormatPos] = &rFormat;
1104 return rFormat;
1105}
1106
1107void SaveTable::NewFrameFormatForLine(const SwTableLine& rTableLn, sal_uInt16 nFormatPos, SwFrameFormat* pOldFormat)
1108{
1109 SwFrameFormat* pFormat = m_aFrameFormats[nFormatPos];
1110 if(!pFormat)
1111 pFormat = &CreateNewFormat(*pOldFormat->GetDoc()->MakeTableLineFormat(), nFormatPos);
1112 pOldFormat->CallSwClientNotify(sw::MoveTableLineHint(*pFormat, rTableLn));
1113 pFormat->Add(const_cast<SwTableLine*>(&rTableLn));
1114 KillEmptyFrameFormat(*pOldFormat);
1115}
1116
1117void SaveTable::NewFrameFormatForBox(const SwTableBox& rTableBx, sal_uInt16 nFormatPos, SwFrameFormat* pOldFormat)
1118{
1119 SwFrameFormat* pFormat = m_aFrameFormats[nFormatPos];
1120 if(!pFormat)
1121 pFormat = &CreateNewFormat(*pOldFormat->GetDoc()->MakeTableBoxFormat(), nFormatPos);
1122 pOldFormat->CallSwClientNotify(sw::MoveTableBoxHint(*pFormat, rTableBx));
1123 pFormat->MoveTableBox(*const_cast<SwTableBox*>(&rTableBx), m_bModifyBox ? pOldFormat : nullptr);
1124 KillEmptyFrameFormat(*pOldFormat);
1125}
1126
1127SaveLine::SaveLine(SaveLine* pPrev, const SwTableLine& rLine, SaveTable& rSTable)
1128 : m_pNext(nullptr)
1129{
1130 if( pPrev )
1131 pPrev->m_pNext = this;
1132
1133 m_nItemSet = rSTable.AddFormat(rLine.GetFrameFormat(), true);
1134
1135 m_pBox = new SaveBox(nullptr, *rLine.GetTabBoxes()[0], rSTable);
1136 SaveBox* pBx = m_pBox;
1137 for( size_t n = 1; n < rLine.GetTabBoxes().size(); ++n )
1138 pBx = new SaveBox( pBx, *rLine.GetTabBoxes()[ n ], rSTable );
1139}
1140
1141SaveLine::~SaveLine()
1142{
1143 delete m_pBox;
1144 delete m_pNext;
1145}
1146
1147void SaveLine::RestoreAttr( SwTableLine& rLine, SaveTable& rSTable )
1148{
1149 rSTable.NewFrameFormatForLine(rLine, m_nItemSet, rLine.GetFrameFormat());
1150
1151 SaveBox* pBx = m_pBox;
1152 for (size_t n = 0; n < rLine.GetTabBoxes().size(); ++n, pBx = pBx->m_pNext)
1153 {
1154 if( !pBx )
1155 {
1156 OSL_ENSURE( false, "Number of boxes changed" );
1157 break;
1158 }
1159 pBx->RestoreAttr( *rLine.GetTabBoxes()[ n ], rSTable );
1160 }
1161}
1162
1163void SaveLine::SaveContentAttrs( SwDoc* pDoc )
1164{
1165 m_pBox->SaveContentAttrs(pDoc);
1166 if (m_pNext)
1167 m_pNext->SaveContentAttrs(pDoc);
1168}
1169
1170void SaveLine::CreateNew( SwTable& rTable, SwTableBox& rParent, SaveTable& rSTable )
1171{
1172 SwTableLineFormat* pFormat
1173 = static_cast<SwTableLineFormat*>(rSTable.m_aFrameFormats[m_nItemSet]);
1174 if( !pFormat )
1175 {
1176 SwDoc* pDoc = rTable.GetFrameFormat()->GetDoc();
1177 pFormat = pDoc->MakeTableLineFormat();
1178 pFormat->SetFormatAttr(*rSTable.m_aSets[m_nItemSet]);
1179 rSTable.m_aFrameFormats[m_nItemSet] = pFormat;
1180 }
1181 SwTableLine* pNew = new SwTableLine( pFormat, 1, &rParent );
1182
1183 rParent.GetTabLines().push_back( pNew );
1184
1185 m_pBox->CreateNew(rTable, *pNew, rSTable);
1186
1187 if (m_pNext)
1188 m_pNext->CreateNew(rTable, rParent, rSTable);
1189}
1190
1191SaveBox::SaveBox(SaveBox* pPrev, const SwTableBox& rBox, SaveTable& rSTable)
1192 : m_pNext(nullptr)
1193 , m_nStartNode(NODE_OFFSET_MAX)
1194 , m_nRowSpan(0)
1195{
1196 m_Ptrs.pLine = nullptr;
1197
1198 if( pPrev )
1199 pPrev->m_pNext = this;
1200
1201 m_nItemSet = rSTable.AddFormat(rBox.GetFrameFormat(), false);
1202
1203 if( rBox.GetSttNd() )
1204 {
1205 m_nStartNode = rBox.GetSttIdx();
1206 m_nRowSpan = rBox.getRowSpan();
1207 }
1208 else
1209 {
1210 m_Ptrs.pLine = new SaveLine(nullptr, *rBox.GetTabLines()[0], rSTable);
1211
1212 SaveLine* pLn = m_Ptrs.pLine;
1213 for( size_t n = 1; n < rBox.GetTabLines().size(); ++n )
1214 pLn = new SaveLine( pLn, *rBox.GetTabLines()[ n ], rSTable );
1215 }
1216}
1217
1218SaveBox::~SaveBox()
1219{
1220 if (NODE_OFFSET_MAX == m_nStartNode) // no EndBox
1221 delete m_Ptrs.pLine;
1222 else
1223 delete m_Ptrs.pContentAttrs;
1224 delete m_pNext;
1225}
1226
1227void SaveBox::RestoreAttr( SwTableBox& rBox, SaveTable& rSTable )
1228{
1229 rSTable.NewFrameFormatForBox(rBox, m_nItemSet, rBox.GetFrameFormat());
1230
1231 if (NODE_OFFSET_MAX == m_nStartNode) // no EndBox
1232 {
1233 if( rBox.GetTabLines().empty() )
1234 {
1235 OSL_ENSURE( false, "Number of lines changed" );
1236 }
1237 else
1238 {
1239 SaveLine* pLn = m_Ptrs.pLine;
1240 for (size_t n = 0; n < rBox.GetTabLines().size(); ++n, pLn = pLn->m_pNext)
1241 {
1242 if( !pLn )
1243 {
1244 OSL_ENSURE( false, "Number of lines changed" );
1245 break;
1246 }
1247
1248 pLn->RestoreAttr( *rBox.GetTabLines()[ n ], rSTable );
1249 }
1250 }
1251 }
1252 else if (rBox.GetSttNd() && rBox.GetSttIdx() == m_nStartNode)
1253 {
1254 if (m_Ptrs.pContentAttrs)
1255 {
1256 SwNodes& rNds = rBox.GetFrameFormat()->GetDoc()->GetNodes();
1257 sal_uInt16 nSet = 0;
1258 SwNodeOffset nEnd = rBox.GetSttNd()->EndOfSectionIndex();
1259 for (SwNodeOffset n = m_nStartNode + 1; n < nEnd; ++n)
1260 {
1261 SwContentNode* pCNd = rNds[ n ]->GetContentNode();
1262 if( pCNd )
1263 {
1264 std::shared_ptr<SfxItemSet> pSet((*m_Ptrs.pContentAttrs)[nSet++]);
1265 if( pSet )
1266 {
1267 for( const WhichPair& rPair : aSave_BoxContentSet )
1268 pCNd->ResetAttr( rPair.first, rPair.second );
1269 pCNd->SetAttr( *pSet );
1270 }
1271 else
1272 pCNd->ResetAllAttr();
1273 }
1274 }
1275 }
1276 }
1277 else
1278 {
1279 OSL_ENSURE( false, "Box not anymore at the same node" );
1280 }
1281}
1282
1283void SaveBox::SaveContentAttrs( SwDoc* pDoc )
1284{
1285 if (NODE_OFFSET_MAX == m_nStartNode) // no EndBox
1286 {
1287 // continue in current line
1288 m_Ptrs.pLine->SaveContentAttrs(pDoc);
1289 }
1290 else
1291 {
1292 SwNodeOffset nEnd = pDoc->GetNodes()[m_nStartNode]->EndOfSectionIndex();
1293 m_Ptrs.pContentAttrs = new SfxItemSets;
1294 for (SwNodeOffset n = m_nStartNode + 1; n < nEnd; ++n)
1295 {
1296 SwContentNode* pCNd = pDoc->GetNodes()[ n ]->GetContentNode();
1297 if( pCNd )
1298 {
1299 std::shared_ptr<SfxItemSet> pSet;
1300 if( pCNd->HasSwAttrSet() )
1301 {
1302 pSet = std::make_shared<SfxItemSet>( pDoc->GetAttrPool(),
1304 pSet->Put( *pCNd->GetpSwAttrSet() );
1305 }
1306
1307 m_Ptrs.pContentAttrs->push_back(pSet);
1308 }
1309 }
1310 }
1311 if (m_pNext)
1312 m_pNext->SaveContentAttrs(pDoc);
1313}
1314
1315void SaveBox::CreateNew( SwTable& rTable, SwTableLine& rParent, SaveTable& rSTable )
1316{
1317 SwTableBoxFormat* pFormat = static_cast<SwTableBoxFormat*>(rSTable.m_aFrameFormats[m_nItemSet]);
1318 if( !pFormat )
1319 {
1320 SwDoc* pDoc = rTable.GetFrameFormat()->GetDoc();
1321 pFormat = pDoc->MakeTableBoxFormat();
1322 pFormat->SetFormatAttr(*rSTable.m_aSets[m_nItemSet]);
1323 rSTable.m_aFrameFormats[m_nItemSet] = pFormat;
1324 }
1325
1326 if (NODE_OFFSET_MAX == m_nStartNode) // no EndBox
1327 {
1328 SwTableBox* pNew = new SwTableBox( pFormat, 1, &rParent );
1329 rParent.GetTabBoxes().push_back( pNew );
1330
1331 m_Ptrs.pLine->CreateNew(rTable, *pNew, rSTable);
1332 }
1333 else
1334 {
1335 // search box for StartNode in old table
1336 SwTableBox* pBox = rTable.GetTableBox(m_nStartNode);
1337 if (pBox)
1338 {
1339 SwFrameFormat* pOld = pBox->GetFrameFormat();
1340 pBox->RegisterToFormat( *pFormat );
1341 if( !pOld->HasWriterListeners() )
1342 delete pOld;
1343
1344 pBox->setRowSpan(m_nRowSpan);
1345
1346 SwTableBoxes* pTBoxes = &pBox->GetUpper()->GetTabBoxes();
1347 pTBoxes->erase( std::find( pTBoxes->begin(), pTBoxes->end(), pBox ) );
1348
1349 pBox->SetUpper( &rParent );
1350 pTBoxes = &rParent.GetTabBoxes();
1351 pTBoxes->push_back( pBox );
1352 }
1353 }
1354
1355 if (m_pNext)
1356 m_pNext->CreateNew(rTable, rParent, rSTable);
1357}
1358
1359// UndoObject for attribute changes on table
1360SwUndoAttrTable::SwUndoAttrTable( const SwTableNode& rTableNd, bool bClearTabCols )
1361 : SwUndo( SwUndoId::TABLE_ATTR, &rTableNd.GetDoc() ),
1362 m_nStartNode( rTableNd.GetIndex() )
1363{
1364 m_bClearTableCol = bClearTabCols;
1365 m_pSaveTable.reset( new SaveTable( rTableNd.GetTable() ) );
1366}
1367
1369{
1370}
1371
1373{
1374 SwDoc & rDoc = rContext.GetDoc();
1375 SwTableNode* pTableNd = rDoc.GetNodes()[ m_nStartNode ]->GetTableNode();
1376 OSL_ENSURE( pTableNd, "no TableNode" );
1377
1378 if (pTableNd)
1379 {
1380 SaveTable* pOrig = new SaveTable( pTableNd->GetTable() );
1381 m_pSaveTable->RestoreAttr( pTableNd->GetTable() );
1382 m_pSaveTable.reset( pOrig );
1383 }
1384
1385 if( m_bClearTableCol )
1386 {
1387 ClearFEShellTabCols(rDoc, nullptr);
1388 }
1389}
1390
1392{
1393 UndoImpl(rContext);
1394}
1395
1396// UndoObject for AutoFormat on Table
1398 const SwTableAutoFormat& rAFormat )
1399 : SwUndo( SwUndoId::TABLE_AUTOFMT, &rTableNd.GetDoc() )
1400 , m_TableStyleName(rTableNd.GetTable().GetTableStyleName())
1401 , m_nStartNode( rTableNd.GetIndex() )
1402 , m_bSaveContentAttr( false )
1403 , m_nRepeatHeading(rTableNd.GetTable().GetRowsToRepeat())
1404{
1405 m_pSaveTable.reset( new SaveTable( rTableNd.GetTable() ) );
1406
1407 if( rAFormat.IsFont() || rAFormat.IsJustify() )
1408 {
1409 // then also go over the ContentNodes of the EndBoxes and collect
1410 // all paragraph attributes
1411 m_pSaveTable->SaveContentAttrs( &const_cast<SwDoc&>(rTableNd.GetDoc()) );
1412 m_bSaveContentAttr = true;
1413 }
1414}
1415
1417{
1418}
1419
1421{
1422 m_Undos.push_back(std::make_shared<SwUndoTableNumFormat>(rBox));
1423}
1424
1425void
1427{
1428 SwDoc & rDoc = rContext.GetDoc();
1429 SwTableNode* pTableNd = rDoc.GetNodes()[ m_nStartNode ]->GetTableNode();
1430 OSL_ENSURE( pTableNd, "no TableNode" );
1431
1432 SwTable& table = pTableNd->GetTable();
1433 if (table.GetTableStyleName() != m_TableStyleName)
1434 {
1435 OUString const temp(table.GetTableStyleName());
1436 table.SetTableStyleName(m_TableStyleName);
1437 m_TableStyleName = temp;
1438 }
1439 SaveTable* pOrig = new SaveTable( table );
1440 // then go also over the ContentNodes of the EndBoxes and collect
1441 // all paragraph attributes
1442 if( m_bSaveContentAttr )
1443 pOrig->SaveContentAttrs( &rDoc );
1444
1445 if (bUndo)
1446 {
1447 for (size_t n = m_Undos.size(); 0 < n; --n)
1448 {
1449 m_Undos.at(n-1)->UndoImpl(rContext);
1450 }
1451
1452 table.SetRowsToRepeat(m_nRepeatHeading);
1453 }
1454
1455 m_pSaveTable->RestoreAttr( pTableNd->GetTable(), !bUndo );
1456 m_pSaveTable.reset( pOrig );
1457}
1458
1460{
1461 UndoRedo(true, rContext);
1462}
1463
1465{
1466 UndoRedo(false, rContext);
1467}
1468
1470 const SwSelBoxes& rBoxes,
1471 const SwTableNode& rTableNd,
1472 tools::Long nMn, tools::Long nMx,
1473 sal_uInt16 nCnt, bool bFlg, bool bSmHght )
1474 : SwUndo( nAction, &rTableNd.GetDoc() ),
1475 m_nMin( nMn ), m_nMax( nMx ),
1476 m_nSttNode( rTableNd.GetIndex() ),
1477 m_nCount( nCnt ),
1478 m_bFlag( bFlg ),
1479 m_bSameHeight( bSmHght )
1480{
1481 const SwTable& rTable = rTableNd.GetTable();
1482 m_pSaveTable.reset( new SaveTable( rTable ) );
1483
1484 // and remember selection
1485 ReNewBoxes( rBoxes );
1486}
1487
1489{
1490 if (rBoxes.size() != m_Boxes.size())
1491 {
1492 m_Boxes.clear();
1493 for (size_t n = 0; n < rBoxes.size(); ++n)
1494 {
1495 m_Boxes.insert( rBoxes[n]->GetSttIdx() );
1496 }
1497 }
1498}
1499
1501{
1502}
1503
1505 const SwTableSortBoxes& rOld )
1506{
1507 const SwTable& rTable = rTableNd.GetTable();
1508 const SwTableSortBoxes& rTableBoxes = rTable.GetTabSortBoxes();
1509
1510 OSL_ENSURE( ! IsDelBox(), "wrong Action" );
1511 m_xNewSttNds.emplace();
1512
1513 size_t i = 0;
1514 for (size_t n = 0; n < rOld.size(); ++i)
1515 {
1516 if( rOld[ n ] == rTableBoxes[ i ] )
1517 ++n;
1518 else
1519 // new box: insert sorted
1520 m_xNewSttNds->insert( BoxMove(rTableBoxes[ i ]->GetSttIdx()) );
1521 }
1522
1523 for( ; i < rTableBoxes.size(); ++i )
1524 // new box: insert sorted
1525 m_xNewSttNds->insert( BoxMove(rTableBoxes[ i ]->GetSttIdx()) );
1526}
1527
1529 const SwTableBox& rBox )
1530{
1531 SwTableLine* pRet = nullptr;
1532 // i63949: For nested cells we have to take nLineNo - 1, too, not 0!
1533 const SwTableLines &rTableLines = ( rBox.GetUpper()->GetUpper() != nullptr ) ?
1534 rBox.GetUpper()->GetUpper()->GetTabLines()
1535 : rTable.GetTabLines();
1536 const SwTableLine* pLine = rBox.GetUpper();
1537 sal_uInt16 nLineNo = rTableLines.GetPos( pLine );
1538 pRet = rTableLines[nLineNo - 1];
1539
1540 return pRet;
1541}
1542
1543static const SwTableLines& lcl_FindParentLines( const SwTable& rTable,
1544 const SwTableBox& rBox )
1545{
1546 const SwTableLines& rRet =
1547 ( rBox.GetUpper()->GetUpper() != nullptr ) ?
1548 rBox.GetUpper()->GetUpper()->GetTabLines() :
1549 rTable.GetTabLines();
1550
1551 return rRet;
1552}
1553
1555 const SwTableSortBoxes& rOld,
1556 const SwSelBoxes& rBoxes,
1557 const std::vector<SwNodeOffset> &rNodeCnts )
1558{
1559 const SwTable& rTable = rTableNd.GetTable();
1560 const SwTableSortBoxes& rTableBoxes = rTable.GetTabSortBoxes();
1561
1562 OSL_ENSURE( ! IsDelBox(), "wrong Action" );
1563 m_xNewSttNds.emplace();
1564
1565 OSL_ENSURE( rTable.IsNewModel() || rOld.size() + m_nCount * rBoxes.size() == rTableBoxes.size(),
1566 "unexpected boxes" );
1567 OSL_ENSURE( rOld.size() <= rTableBoxes.size(), "more unexpected boxes" );
1568 for (size_t n = 0, i = 0; i < rTableBoxes.size(); ++i)
1569 {
1570 if( ( n < rOld.size() ) &&
1571 ( rOld[ n ] == rTableBoxes[ i ] ) )
1572 {
1573 // box already known? Then nothing to be done.
1574 ++n;
1575 }
1576 else
1577 {
1578 // new box found: insert (obey sort order)
1579 const SwTableBox* pBox = rTableBoxes[ i ];
1580
1581 // find the source box. It must be one in rBoxes.
1582 // We found the right one if it's in the same column as pBox.
1583 // No, if more than one selected cell in the same column has been split,
1584 // we have to look for the nearest one (i65201)!
1585 const SwTableBox* pSourceBox = nullptr;
1586 const SwTableBox* pCheckBox = nullptr;
1587 const SwTableLine* pBoxLine = pBox->GetUpper();
1588 sal_uInt16 nLineDiff = lcl_FindParentLines(rTable,*pBox).GetPos(pBoxLine);
1589 sal_uInt16 nLineNo = 0;
1590 for (size_t j = 0; j < rBoxes.size(); ++j)
1591 {
1592 pCheckBox = rBoxes[j];
1593 if( pCheckBox->GetUpper()->GetUpper() == pBox->GetUpper()->GetUpper() )
1594 {
1595 const SwTableLine* pCheckLine = pCheckBox->GetUpper();
1596 sal_uInt16 nCheckLine = lcl_FindParentLines( rTable, *pCheckBox ).
1597 GetPos( pCheckLine );
1598 if( ( !pSourceBox || nCheckLine > nLineNo ) && nCheckLine < nLineDiff )
1599 {
1600 nLineNo = nCheckLine;
1601 pSourceBox = pCheckBox;
1602 }
1603 }
1604 }
1605
1606 // find the line number difference
1607 // (to help determine bNodesMoved flag below)
1608 nLineDiff = nLineDiff - nLineNo;
1609 OSL_ENSURE( pSourceBox, "Split source box not found!" );
1610 // find out how many nodes the source box used to have
1611 // (to help determine bNodesMoved flag below)
1612 size_t nNdsPos = 0;
1613 while( rBoxes[ nNdsPos ] != pSourceBox )
1614 ++nNdsPos;
1615 SwNodeOffset nNodes = rNodeCnts[ nNdsPos ];
1616
1617 // When a new table cell is created, it either gets a new
1618 // node, or it gets node(s) from elsewhere. The undo must
1619 // know, of course, and thus we must determine here just
1620 // where pBox's nodes are from:
1621 // If 1) the source box has lost nodes, and
1622 // 2) we're in the node range that got nodes
1623 // then pBox received nodes from elsewhere.
1624 // If bNodesMoved is set for pBox the undo must move the
1625 // boxes back, otherwise it must delete them.
1626 bool bNodesMoved = pSourceBox &&
1627 ( nNodes != ( pSourceBox->GetSttNd()->EndOfSectionIndex() -
1628 pSourceBox->GetSttIdx() ) )
1629 && ( nNodes - 1 > SwNodeOffset(nLineDiff) );
1630 m_xNewSttNds->insert( BoxMove(pBox->GetSttIdx(), bNodesMoved) );
1631 }
1632 }
1633}
1634
1636{
1637 OSL_ENSURE( IsDelBox(), "wrong Action" );
1638 if (m_pDelSects == nullptr)
1640
1641 SwTableNode* pTableNd = pSttNd->FindTableNode();
1642 std::unique_ptr<SwUndoSaveSection, o3tl::default_delete<SwUndoSaveSection>> pSave(new SwUndoSaveSection);
1643 pSave->SaveSection( SwNodeIndex( *pSttNd ));
1644
1645 m_pDelSects->push_back(std::move(pSave));
1646 m_nSttNode = pTableNd->GetIndex();
1647}
1648
1650{
1651 SwDoc & rDoc = rContext.GetDoc();
1652 SwNodeIndex aIdx( rDoc.GetNodes(), m_nSttNode );
1653
1654 SwTableNode *const pTableNd = aIdx.GetNode().GetTableNode();
1655 OSL_ENSURE( pTableNd, "no TableNode" );
1656
1657 SwTableFormulaUpdate aMsgHint( &pTableNd->GetTable() );
1658 aMsgHint.m_eFlags = TBL_BOXPTR;
1659 rDoc.getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
1660
1661 CHECK_TABLE( pTableNd->GetTable() )
1662
1663 FndBox_ aTmpBox( nullptr, nullptr );
1664 // ? TL_CHART2: notification or locking of controller required ?
1665
1667 SwSelBoxes aDelBoxes;
1668 std::vector< std::pair<SwTableBox *, SwNodeOffset> > aDelNodes;
1669 if( IsDelBox() )
1670 {
1671 // Trick: add missing boxes in any line, they will be connected
1672 // correctly when calling CreateNew
1673 SwTableBox* pCpyBox = pTableNd->GetTable().GetTabSortBoxes()[0];
1674 SwTableBoxes& rLnBoxes = pCpyBox->GetUpper()->GetTabBoxes();
1675
1676 // restore sections
1677 for (size_t n = m_pDelSects->size(); n; )
1678 {
1679 SwUndoSaveSection *const pSave = (*m_pDelSects)[ --n ].get();
1680 pSave->RestoreSection( &rDoc, &aIdx, SwTableBoxStartNode );
1681 if( pSave->GetHistory() )
1682 pSave->GetHistory()->Rollback( &rDoc );
1683 SwTableBox* pBox = new SwTableBox( static_cast<SwTableBoxFormat*>(pCpyBox->GetFrameFormat()), aIdx,
1684 pCpyBox->GetUpper() );
1685 rLnBoxes.push_back( pBox );
1686 }
1687 m_pDelSects->clear();
1688 }
1689 else if( !m_xNewSttNds->empty() )
1690 {
1691 // Then the nodes have be moved and not deleted!
1692 // But for that we need a temp array.
1693 std::vector<BoxMove> aTmp( m_xNewSttNds->begin(), m_xNewSttNds->end() );
1694
1695 // backwards
1696 for (size_t n = aTmp.size(); n > 0 ; )
1697 {
1698 --n;
1699 // delete box from table structure
1700 SwNodeOffset nIdx = aTmp[n].index;
1701 SwTableBox* pBox = pTableNd->GetTable().GetTableBox( nIdx );
1702 OSL_ENSURE( pBox, "Where is my TableBox?" );
1703
1704 // TL_CHART2: notify chart about box to be removed
1705 if (pPCD)
1706 pPCD->DeleteBox( &pTableNd->GetTable(), *pBox );
1707
1708 // insert _before_ deleting the section - otherwise the box
1709 // has no start node so all boxes sort equal in SwSelBoxes
1710 aDelBoxes.insert(pBox);
1711
1712 if( aTmp[n].hasMoved )
1713 {
1714 SwNodeRange aRg( *pBox->GetSttNd(), SwNodeOffset(1),
1715 *pBox->GetSttNd()->EndOfSectionNode() );
1716
1717 SwTableLine* pLine = lcl_FindTableLine( pTableNd->GetTable(), *pBox );
1718 SwNodeIndex aInsPos( *(pLine->GetTabBoxes()[0]->GetSttNd()), 2 );
1719
1720 // adjust all StartNode indices
1721 size_t i = n;
1722 SwNodeOffset nSttIdx = aInsPos.GetIndex() - 2,
1723 nNdCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex();
1724 while( i && aTmp[ --i ].index > nSttIdx )
1725 aTmp[ i ].index += nNdCnt;
1726
1727 // first delete box
1728 delete pBox;
1729 // than move nodes
1730 rDoc.GetNodes().MoveNodes( aRg, rDoc.GetNodes(), aInsPos.GetNode(), false );
1731 }
1732 else
1733 {
1734 aDelNodes.emplace_back(pBox, nIdx);
1735 }
1736 }
1737 }
1738 else
1739 {
1740 // Remove nodes from nodes array (backwards!)
1741 std::set<BoxMove>::reverse_iterator it;
1742 for( it = m_xNewSttNds->rbegin(); it != m_xNewSttNds->rend(); ++it )
1743 {
1744 SwNodeOffset nIdx = (*it).index;
1745 SwTableBox* pBox = pTableNd->GetTable().GetTableBox( nIdx );
1746 OSL_ENSURE( pBox, "Where's my table box?" );
1747 // TL_CHART2: notify chart about box to be removed
1748 if (pPCD)
1749 pPCD->DeleteBox( &pTableNd->GetTable(), *pBox );
1750 aDelBoxes.insert(pBox);
1751 aDelNodes.emplace_back(pBox, nIdx);
1752 }
1753 }
1754
1755 // fdo#57197: before deleting the SwTableBoxes, delete the SwTabFrames
1756 aTmpBox.SetTableLines(aDelBoxes, pTableNd->GetTable());
1757 aTmpBox.DelFrames(pTableNd->GetTable());
1758
1759 // do this _after_ deleting Frames because disposing SwAccessible requires
1760 // connection to the nodes, see SwAccessibleChild::IsAccessible()
1761 for (const std::pair<SwTableBox *, SwNodeOffset> & rDelNode : aDelNodes)
1762 {
1763 // first disconnect box from node, otherwise ~SwTableBox would
1764 // access pBox->pSttNd, deleted by DeleteSection
1765 rDelNode.first->RemoveFromTable();
1766 rDoc.getIDocumentContentOperations().DeleteSection(rDoc.GetNodes()[ rDelNode.second ]);
1767 }
1768
1769 // Remove boxes from table structure
1770 for( size_t n = 0; n < aDelBoxes.size(); ++n )
1771 {
1772 SwTableBox* pCurrBox = aDelBoxes[n];
1773 SwTableBoxes* pTBoxes = &pCurrBox->GetUpper()->GetTabBoxes();
1774 pTBoxes->erase( std::find( pTBoxes->begin(), pTBoxes->end(), pCurrBox ) );
1775 delete pCurrBox;
1776 }
1777
1778 m_pSaveTable->CreateNew( pTableNd->GetTable(), true, false );
1779
1780 // TL_CHART2: need to inform chart of probably changed cell names
1781 rDoc.UpdateCharts( pTableNd->GetTable().GetFrameFormat()->GetName() );
1783 if( IsDelBox() )
1784 m_nSttNode = pTableNd->GetIndex();
1785 ClearFEShellTabCols(rDoc, nullptr);
1786 CHECK_TABLE( pTableNd->GetTable() )
1787}
1788
1790{
1791 SwDoc & rDoc = rContext.GetDoc();
1792
1793 SwTableNode* pTableNd = rDoc.GetNodes()[ m_nSttNode ]->GetTableNode();
1794 OSL_ENSURE( pTableNd, "no TableNode" );
1795 CHECK_TABLE( pTableNd->GetTable() )
1796
1797 SwSelBoxes aSelBoxes;
1798 for (const auto& rBox : m_Boxes)
1799 {
1800 SwTableBox* pBox = pTableNd->GetTable().GetTableBox( rBox );
1801 aSelBoxes.insert( pBox );
1802 }
1803
1804 // create SelBoxes and call InsertCell/-Row/SplitTable
1805 switch( GetId() )
1806 {
1808 rDoc.InsertCol( aSelBoxes, m_nCount, m_bFlag );
1809 break;
1810
1812 rDoc.InsertRow( aSelBoxes, m_nCount, m_bFlag );
1813 break;
1814
1816 rDoc.SplitTable( aSelBoxes, m_bFlag, m_nCount, m_bSameHeight );
1817 break;
1821 {
1822 SwTableFormulaUpdate aMsgHint( &pTableNd->GetTable() );
1823 aMsgHint.m_eFlags = TBL_BOXPTR;
1824 rDoc.getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
1825 SwTable &rTable = pTableNd->GetTable();
1826 if( m_nMax > m_nMin && rTable.IsNewModel() )
1827 rTable.PrepareDeleteCol( m_nMin, m_nMax );
1828 rTable.DeleteSel( &rDoc, aSelBoxes, nullptr, this, true, true );
1829 m_nSttNode = pTableNd->GetIndex();
1830 }
1831 break;
1832 default:
1833 ;
1834 }
1835 ClearFEShellTabCols(rDoc, nullptr);
1836 CHECK_TABLE( pTableNd->GetTable() )
1837}
1838
1840 : SwUndo( SwUndoId::TABLE_MERGE, &rTableSel.GetDoc() ), SwUndRng( rTableSel )
1841{
1842 const SwTableNode* pTableNd = rTableSel.GetPointNode().FindTableNode();
1843 OSL_ENSURE( pTableNd, "Where is the TableNode?" );
1844 m_pSaveTable.reset( new SaveTable( pTableNd->GetTable() ) );
1845 m_nTableNode = pTableNd->GetIndex();
1846}
1847
1849{
1850 m_pSaveTable.reset();
1851 m_vMoves.clear();
1852 m_pHistory.reset();
1853}
1854
1856{
1857 SwDoc & rDoc = rContext.GetDoc();
1858 SwNodeIndex aIdx( rDoc.GetNodes(), m_nTableNode );
1859
1860 SwTableNode *const pTableNd = aIdx.GetNode().GetTableNode();
1861 OSL_ENSURE( pTableNd, "no TableNode" );
1862
1863 SwTableFormulaUpdate aMsgHint( &pTableNd->GetTable() );
1864 aMsgHint.m_eFlags = TBL_BOXPTR;
1865 rDoc.getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
1866
1867 // ? TL_CHART2: notification or locking of controller required ?
1868
1869 // 1. restore deleted boxes:
1870 // Trick: add missing boxes in any line, they will be connected
1871 // correctly when calling CreateNew
1872 SwTableBox *pBox, *pCpyBox = pTableNd->GetTable().GetTabSortBoxes()[0];
1873 SwTableBoxes& rLnBoxes = pCpyBox->GetUpper()->GetTabBoxes();
1874
1875 CHECKTABLE(pTableNd->GetTable())
1876
1877 SwSelBoxes aSelBoxes;
1879
1880 for (const auto& rBox : m_Boxes)
1881 {
1882 aIdx = rBox;
1883 SwStartNode* pSttNd = rDoc.GetNodes().MakeTextSection( aIdx.GetNode(),
1884 SwTableBoxStartNode, pColl );
1885 pBox = new SwTableBox( static_cast<SwTableBoxFormat*>(pCpyBox->GetFrameFormat()), *pSttNd,
1886 pCpyBox->GetUpper() );
1887 rLnBoxes.push_back( pBox );
1888
1889 aSelBoxes.insert( pBox );
1890 }
1891
1892 CHECKTABLE(pTableNd->GetTable())
1893
1895 // 2. deleted the inserted boxes
1896 // delete nodes (from last to first)
1897 for( size_t n = m_aNewStartNodes.size(); n; )
1898 {
1899 // remove box from table structure
1900 SwNodeOffset nIdx = m_aNewStartNodes[ --n ];
1901
1902 if( !nIdx && n )
1903 {
1904 nIdx = m_aNewStartNodes[ --n ];
1905 pBox = pTableNd->GetTable().GetTableBox( nIdx );
1906 OSL_ENSURE( pBox, "Where is my TableBox?" );
1907
1908 if( !m_pSaveTable->IsNewModel() )
1909 rDoc.GetNodes().MakeTextNode(
1910 const_cast<SwEndNode&>(*pBox->GetSttNd()->EndOfSectionNode()), pColl );
1911
1912 // this was the separator -> restore moved ones
1913 for (size_t i = m_vMoves.size(); i; )
1914 {
1915 SwTextNode* pTextNd = nullptr;
1916 sal_Int32 nDelPos = 0;
1917 SwUndoMove *const pUndo = m_vMoves[ --i ].get();
1918 if( !pUndo->IsMoveRange() )
1919 {
1920 pTextNd = rDoc.GetNodes()[ pUndo->GetDestSttNode() ]->GetTextNode();
1921 nDelPos = pUndo->GetDestSttContent() - 1;
1922 }
1923 pUndo->UndoImpl(rContext);
1924 if( pUndo->IsMoveRange() )
1925 {
1926 // delete the unnecessary node
1927 aIdx = pUndo->GetEndNode();
1928 SwContentNode *pCNd = aIdx.GetNode().GetContentNode();
1929 if( pCNd )
1930 {
1931 SwNodeIndex aTmp( aIdx, -1 );
1932 SwContentNode *pMove = aTmp.GetNode().GetContentNode();
1933 if( pMove )
1934 pCNd->MoveTo( *pMove );
1935 }
1936 rDoc.GetNodes().Delete( aIdx );
1937 }
1938 else if( pTextNd )
1939 {
1940 // also delete not needed attributes
1941 SwContentIndex aTmpIdx( pTextNd, nDelPos );
1942 if( pTextNd->GetpSwpHints() && pTextNd->GetpSwpHints()->Count() )
1943 pTextNd->RstTextAttr( aTmpIdx, pTextNd->GetText().getLength() - nDelPos + 1 );
1944 // delete separator
1945 pTextNd->EraseText( aTmpIdx, 1 );
1946 }
1947 }
1948 nIdx = pBox->GetSttIdx();
1949 }
1950 else
1951 pBox = pTableNd->GetTable().GetTableBox( nIdx );
1952
1953 if( !m_pSaveTable->IsNewModel() )
1954 {
1955 // TL_CHART2: notify chart about box to be removed
1956 if (pPCD)
1957 pPCD->DeleteBox( &pTableNd->GetTable(), *pBox );
1958
1959 SwTableBoxes* pTBoxes = &pBox->GetUpper()->GetTabBoxes();
1960 pTBoxes->erase( std::find(pTBoxes->begin(), pTBoxes->end(), pBox ) );
1961
1962 // delete indices from section
1963 {
1964 SwNodeIndex aTmpIdx( *pBox->GetSttNd() );
1965 SwDoc::CorrAbs( SwNodeIndex( aTmpIdx, 1 ),
1966 SwNodeIndex( *aTmpIdx.GetNode().EndOfSectionNode() ),
1967 SwPosition( aTmpIdx, nullptr, 0 ), true );
1968 }
1969
1970 delete pBox;
1971 rDoc.getIDocumentContentOperations().DeleteSection( rDoc.GetNodes()[ nIdx ] );
1972 }
1973 }
1974 CHECKTABLE(pTableNd->GetTable())
1975
1976 m_pSaveTable->CreateNew( pTableNd->GetTable(), true, false );
1977
1978 // TL_CHART2: need to inform chart of probably changed cell names
1979 rDoc.UpdateCharts( pTableNd->GetTable().GetFrameFormat()->GetName() );
1980
1981 if( m_pHistory )
1982 {
1983 m_pHistory->TmpRollback( &rDoc, 0 );
1984 m_pHistory->SetTmpEnd( m_pHistory->Count() );
1985 }
1986 SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
1987 pPam->DeleteMark();
1989 pPam->SetMark();
1990 pPam->DeleteMark();
1991
1992 CHECKTABLE(pTableNd->GetTable())
1993 ClearFEShellTabCols(rDoc, nullptr);
1994}
1995
1997{
1998 SwDoc & rDoc = rContext.GetDoc();
1999 SwPaM & rPam( AddUndoRedoPaM(rContext) );
2000 rDoc.MergeTable(rPam);
2001}
2002
2004{
2005 SwNodeIndex aTmp( rRg.aStart, -1 ), aTmp2( rPos, -1 );
2006 std::unique_ptr<SwUndoMove> pUndo(new SwUndoMove( rDoc, rRg, rPos ));
2007 ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
2008 rDoc.getIDocumentContentOperations().MoveNodeRange( rRg, rPos, m_pSaveTable->IsNewModel() ?
2011 ++aTmp;
2012 ++aTmp2;
2013 pUndo->SetDestRange( aTmp2.GetNode(), rPos, aTmp );
2014
2015 m_vMoves.push_back(std::move(pUndo));
2016}
2017
2019{
2020 // memorize selection
2021 for (size_t n = 0; n < rBoxes.size(); ++n)
2022 {
2023 m_Boxes.insert(rBoxes[n]->GetSttIdx());
2024 }
2025
2026 // as separator for inserts of new boxes after shifting
2027 m_aNewStartNodes.push_back( SwNodeOffset(0) );
2028
2029 // The new table model does not delete overlapped cells (by row span),
2030 // so the rBoxes array might be empty even some cells have been merged.
2031 if( !rBoxes.empty() )
2032 m_nTableNode = rBoxes[ 0 ]->GetSttNd()->FindTableNode()->GetIndex();
2033}
2034
2036{
2037 if( !m_pHistory )
2038 m_pHistory.reset(new SwHistory);
2039
2040 SwNodeIndex aIdx( *rBox.GetSttNd(), 1 );
2041 SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
2042 if( !pCNd )
2043 pCNd = aIdx.GetNodes().GoNext( &aIdx );
2044
2045 m_pHistory->Add( pCNd->GetFormatColl(), aIdx.GetIndex(), pCNd->GetNodeType());
2046 if( pCNd->HasSwAttrSet() )
2047 m_pHistory->CopyFormatAttr( *pCNd->GetpSwAttrSet(), aIdx.GetIndex() );
2048}
2049
2051 const SfxItemSet* pNewSet )
2052 : SwUndo(SwUndoId::TBLNUMFMT, rBox.GetFrameFormat()->GetDoc())
2053 , m_nFormatIdx(getSwDefaultTextFormat())
2054 , m_nNewFormatIdx(0)
2055 , m_fNum(0.0)
2056 , m_fNewNum(0.0)
2057 , m_bNewFormat(false)
2058 , m_bNewFormula(false)
2059 , m_bNewValue(false)
2060{
2061 m_nNode = rBox.GetSttIdx();
2062
2063 m_nNodePos = rBox.IsValidNumTextNd( nullptr == pNewSet );
2064 SwDoc* pDoc = rBox.GetFrameFormat()->GetDoc();
2065
2067 {
2068 SwTextNode* pTNd = pDoc->GetNodes()[ m_nNodePos ]->GetTextNode();
2069
2070 m_pHistory.reset(new SwHistory);
2071 SwRegHistory aRHst( *rBox.GetSttNd(), m_pHistory.get() );
2072 // always save all text atttibutes because of possibly overlapping
2073 // areas of on/off
2074 m_pHistory->CopyAttr( pTNd->GetpSwpHints(), m_nNodePos, 0,
2075 pTNd->GetText().getLength(), true );
2076
2077 if( pTNd->HasSwAttrSet() )
2078 m_pHistory->CopyFormatAttr( *pTNd->GetpSwAttrSet(), m_nNodePos );
2079
2080 m_aStr = pTNd->GetText();
2081 if( pTNd->GetpSwpHints() )
2082 pTNd->GetpSwpHints()->DeRegister();
2083 }
2084
2085 m_pBoxSet.reset( new SfxItemSet( pDoc->GetAttrPool(), aTableBoxSetRange ) );
2086 m_pBoxSet->Put( rBox.GetFrameFormat()->GetAttrSet() );
2087
2088 if( pNewSet )
2089 {
2090 if( const SwTableBoxNumFormat* pItem = pNewSet->GetItemIfSet( RES_BOXATR_FORMAT,
2091 false ))
2092 {
2093 m_bNewFormat = true;
2094 m_nNewFormatIdx = pItem->GetValue();
2095 }
2096 if( const SwTableBoxFormula* pItem = pNewSet->GetItemIfSet( RES_BOXATR_FORMULA,
2097 false ))
2098 {
2099 m_bNewFormula = true;
2100 m_aNewFormula = pItem->GetFormula();
2101 }
2102 if( const SwTableBoxValue* pItem = pNewSet->GetItemIfSet( RES_BOXATR_VALUE,
2103 false ))
2104 {
2105 m_bNewValue = true;
2106 m_fNewNum = pItem->GetValue();
2107 }
2108 }
2109
2110 // is a history needed at all?
2111 if (m_pHistory && !m_pHistory->Count())
2112 {
2113 m_pHistory.reset();
2114 }
2115}
2116
2118{
2119 m_pHistory.reset();
2120 m_pBoxSet.reset();
2121}
2122
2124{
2125 OSL_ENSURE( m_pBoxSet, "Where's the stored item set?" );
2126
2127 SwDoc & rDoc = rContext.GetDoc();
2128 SwStartNode* pSttNd = rDoc.GetNodes()[ m_nNode ]->
2129 FindSttNodeByType( SwTableBoxStartNode );
2130 OSL_ENSURE( pSttNd, "without StartNode no TableBox" );
2131 SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().GetTableBox(
2132 pSttNd->GetIndex() );
2133 OSL_ENSURE( pBox, "found no TableBox" );
2134
2135 SwTableBoxFormat* pFormat = rDoc.MakeTableBoxFormat();
2136 pFormat->SetFormatAttr( *m_pBoxSet );
2137 pBox->ChgFrameFormat( pFormat );
2138
2140 return;
2141
2142 SwTextNode* pTextNd = rDoc.GetNodes()[ m_nNodePos ]->GetTextNode();
2143 // If more than one node was deleted then all "node" attributes were also
2144 // saved
2145 if( pTextNd->HasSwAttrSet() )
2146 pTextNd->ResetAllAttr();
2147
2148 if( pTextNd->GetpSwpHints() && !m_aStr.isEmpty() )
2149 pTextNd->ClearSwpHintsArr( true );
2150
2151 // ChgTextToNum(..) only acts when the strings are different. We need to do
2152 // the same here.
2153 if( pTextNd->GetText() != m_aStr )
2154 {
2155 rDoc.getIDocumentRedlineAccess().DeleteRedline( *( pBox->GetSttNd() ), false, RedlineType::Any );
2156
2157 SwContentIndex aIdx( pTextNd, 0 );
2158 if( !m_aStr.isEmpty() )
2159 {
2160 pTextNd->EraseText( aIdx );
2161 pTextNd->InsertText( m_aStr, aIdx,
2163 }
2164 }
2165
2166 if( m_pHistory )
2167 {
2168 sal_uInt16 nTmpEnd = m_pHistory->GetTmpEnd();
2169 m_pHistory->TmpRollback( &rDoc, 0 );
2170 m_pHistory->SetTmpEnd( nTmpEnd );
2171 }
2172
2173 SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
2174 pPam->DeleteMark();
2175 pPam->GetPoint()->Assign( m_nNode + 1 );
2176}
2177
2178namespace {
2179
2185class RedlineFlagsInternGuard
2186{
2187 SwDoc& mrDoc;
2188 RedlineFlags meOldRedlineFlags;
2189
2190public:
2191 RedlineFlagsInternGuard(
2192 SwDoc& rDoc, // change mode of this document
2193 RedlineFlags eNewRedlineFlags, // new redline mode
2194 RedlineFlags eRedlineFlagsMask /*change only bits set in this mask*/);
2195
2196 ~RedlineFlagsInternGuard();
2197};
2198
2199}
2200
2201RedlineFlagsInternGuard::RedlineFlagsInternGuard(
2202 SwDoc& rDoc,
2203 RedlineFlags eNewRedlineFlags,
2204 RedlineFlags eRedlineFlagsMask )
2205 : mrDoc( rDoc ),
2206 meOldRedlineFlags( rDoc.getIDocumentRedlineAccess().GetRedlineFlags() )
2207{
2208 mrDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( ( meOldRedlineFlags & ~eRedlineFlagsMask ) |
2209 ( eNewRedlineFlags & eRedlineFlagsMask ) );
2210}
2211
2212RedlineFlagsInternGuard::~RedlineFlagsInternGuard()
2213{
2214 mrDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( meOldRedlineFlags );
2215}
2216
2218{
2219 // Could the box be changed?
2220 if( !m_pBoxSet )
2221 return ;
2222
2223 SwDoc & rDoc = rContext.GetDoc();
2224 SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
2225
2226 pPam->DeleteMark();
2227 pPam->GetPoint()->Assign( m_nNode );
2228
2229 SwNode * pNd = & pPam->GetPoint()->GetNode();
2231 assert(pSttNd && "without StartNode no TableBox");
2232 SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().GetTableBox(
2233 pSttNd->GetIndex() );
2234 OSL_ENSURE( pBox, "found no TableBox" );
2235
2236 SwFrameFormat* pBoxFormat = pBox->ClaimFrameFormat();
2238 {
2240
2241 // Resetting attributes is not enough. In addition, take care that the
2242 // text will be also formatted correctly.
2243 pBoxFormat->LockModify();
2244
2245 if( m_bNewFormula )
2246 aBoxSet.Put( SwTableBoxFormula( m_aNewFormula ));
2247 else
2248 pBoxFormat->ResetFormatAttr( RES_BOXATR_FORMULA );
2249 if( m_bNewFormat )
2251 else
2252 pBoxFormat->ResetFormatAttr( RES_BOXATR_FORMAT );
2253 if( m_bNewValue )
2254 aBoxSet.Put( SwTableBoxValue( m_fNewNum ));
2255 else
2256 pBoxFormat->ResetFormatAttr( RES_BOXATR_VALUE );
2257 pBoxFormat->UnlockModify();
2258
2259 // dvo: When redlining is (was) enabled, setting the attribute
2260 // will also change the cell content. To allow this, the
2261 // RedlineFlags::Ignore flag must be removed during Redo. #108450#
2262 RedlineFlagsInternGuard aGuard( rDoc, RedlineFlags::NONE, RedlineFlags::Ignore );
2263 pBoxFormat->SetFormatAttr( aBoxSet );
2264 }
2265 else if( getSwDefaultTextFormat() != m_nFormatIdx )
2266 {
2268
2270 aBoxSet.Put( SwTableBoxValue( m_fNum ));
2271
2272 // Resetting attributes is not enough. In addition, take care that the
2273 // text will be also formatted correctly.
2274 pBoxFormat->LockModify();
2275 pBoxFormat->ResetFormatAttr( RES_BOXATR_FORMULA );
2276 pBoxFormat->UnlockModify();
2277
2278 // dvo: When redlining is (was) enabled, setting the attribute
2279 // will also change the cell content. To allow this, the
2280 // RedlineFlags::Ignore flag must be removed during Redo. #108450#
2281 RedlineFlagsInternGuard aGuard( rDoc, RedlineFlags::NONE, RedlineFlags::Ignore );
2282 pBoxFormat->SetFormatAttr( aBoxSet );
2283 }
2284 else
2285 {
2286 // it's no number
2287
2288 // Resetting attributes is not enough. In addition, take care that the
2289 // text will be also formatted correctly.
2291
2293 }
2294
2295 if( m_bNewFormula )
2296 {
2297 // No matter what was set, an update of the table is always a good idea
2298 SwTableFormulaUpdate aTableUpdate( &pSttNd->FindTableNode()->GetTable() );
2299 rDoc.getIDocumentFieldsAccess().UpdateTableFields( &aTableUpdate );
2300 }
2301
2302 if( !pNd->IsContentNode() )
2303 pNd = rDoc.GetNodes().GoNext( pPam->GetPoint() );
2304}
2305
2307{
2308 m_nNode = rBox.GetSttIdx();
2309}
2310
2312 : nBoxIdx( rBox.GetSttIdx() ), nOffset( 0 ),
2313 bJoin( false )
2314{
2315}
2316
2318{
2319 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("UndoTableCpyTable_Entry"));
2320
2321 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("nBoxIdx"));
2322 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
2323 BAD_CAST(OString::number(sal_Int32(nBoxIdx)).getStr()));
2324 (void)xmlTextWriterEndElement(pWriter);
2325
2326 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("nOffset"));
2327 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
2328 BAD_CAST(OString::number(sal_Int32(nOffset)).getStr()));
2329 (void)xmlTextWriterEndElement(pWriter);
2330
2331 if (pBoxNumAttr)
2332 {
2333 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("pBoxNumAttr"));
2334 pBoxNumAttr->dumpAsXml(pWriter);
2335 (void)xmlTextWriterEndElement(pWriter);
2336 }
2337
2338 if (pUndo)
2339 {
2340 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("pUndo"));
2341 pUndo->dumpAsXml(pWriter);
2342 (void)xmlTextWriterEndElement(pWriter);
2343 }
2344
2345 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("bJoin"));
2346 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
2347 BAD_CAST(OString::boolean(bJoin).getStr()));
2348 (void)xmlTextWriterEndElement(pWriter);
2349
2350 (void)xmlTextWriterEndElement(pWriter);
2351}
2352
2354 : SwUndo( SwUndoId::TBLCPYTBL, &rDoc )
2355{
2356}
2357
2359{
2360 m_vArr.clear();
2361 m_pInsRowUndo.reset();
2362}
2363
2365{
2366 SwDoc & rDoc = rContext.GetDoc();
2367 DEBUG_REDLINE( &rDoc )
2368
2369 SwTableNode* pTableNd = nullptr;
2370 for (size_t n = m_vArr.size(); n; )
2371 {
2372 UndoTableCpyTable_Entry *const pEntry = m_vArr[ --n ].get();
2373 SwNodeOffset nSttPos = pEntry->nBoxIdx + pEntry->nOffset;
2374 SwStartNode* pSNd = rDoc.GetNodes()[ nSttPos ]->StartOfSectionNode();
2375 if( !pTableNd )
2376 pTableNd = pSNd->FindTableNode();
2377
2378 SwTableBox* pBox = pTableNd->GetTable().GetTableBox( nSttPos );
2379 if (!pBox)
2380 {
2381 SAL_WARN("sw.core",
2382 "SwUndoTableCpyTable::UndoImpl: invalid start node index for table box");
2383 continue;
2384 }
2385
2386 SwTableBox& rBox = *pBox;
2387
2388 SwNodeIndex aInsIdx( *rBox.GetSttNd(), 1 );
2389 rDoc.GetNodes().MakeTextNode( aInsIdx.GetNode(), rDoc.GetDfltTextFormatColl() );
2390
2391 // b62341295: Redline for copying tables
2392 const SwNode *pEndNode = rBox.GetSttNd()->EndOfSectionNode();
2393 SwPaM aPam( aInsIdx.GetNode(), *pEndNode );
2394 std::unique_ptr<SwUndoDelete> pUndo;
2395
2397 {
2398 bool bDeleteCompleteParagraph = false;
2399 bool bShiftPam = false;
2400 // There are a couple of different situations to consider during redlining
2401 if( pEntry->pUndo )
2402 {
2403 SwUndoDelete *const pUndoDelete =
2404 dynamic_cast<SwUndoDelete*>(pEntry->pUndo.get());
2405 SwUndoRedlineDelete *const pUndoRedlineDelete =
2406 dynamic_cast<SwUndoRedlineDelete*>(pEntry->pUndo.get());
2407 assert(pUndoDelete || pUndoRedlineDelete);
2408 if (pUndoRedlineDelete)
2409 {
2410 // The old content was not empty or he has been merged with the new content
2411 bDeleteCompleteParagraph = !pEntry->bJoin; // bJoin is set when merged
2412 // Set aTmpIdx to the beginning of the old content
2413 SwNodeIndex aTmpIdx( *pEndNode,
2414 pUndoRedlineDelete->NodeDiff()-1 );
2415 SwTextNode *pText = aTmpIdx.GetNode().GetTextNode();
2416 if( pText )
2417 {
2418 aPam.GetPoint()->Assign(*pText,
2419 pUndoRedlineDelete->ContentStart() );
2420 }
2421 else
2422 aPam.GetPoint()->Assign( aTmpIdx );
2423 }
2424 else if (pUndoDelete && pUndoDelete->IsDelFullPara())
2425 {
2426 // When the old content was an empty paragraph, but could not be joined
2427 // with the new content (e.g. because of a section or table)
2428 // We "save" the aPam.Point, we go one step backwards (because later on the
2429 // empty paragraph will be inserted by the undo) and set the "ShiftPam-flag
2430 // for step forward later on.
2431 bDeleteCompleteParagraph = true;
2432 bShiftPam = true;
2433 aPam.GetPoint()->Assign(*pEndNode, SwNodeOffset(-1));
2434 }
2435 }
2436 rDoc.getIDocumentRedlineAccess().DeleteRedline( aPam, true, RedlineType::Any );
2437
2438 if( pEntry->pUndo )
2439 {
2440 pEntry->pUndo->UndoImpl(rContext);
2441 pEntry->pUndo.reset();
2442 }
2443 if( bShiftPam )
2444 {
2445 // The aPam.Point is at the moment at the last position of the new content and has to be
2446 // moved to the first position of the old content for the SwUndoDelete operation
2447 aPam.GetPoint()->Assign(aPam.GetPoint()->GetNode(), SwNodeOffset(1));
2448 }
2449 pUndo = std::make_unique<SwUndoDelete>(aPam, SwDeleteFlags::Default, bDeleteCompleteParagraph, true);
2450 }
2451 else
2452 {
2453 pUndo = std::make_unique<SwUndoDelete>(aPam, SwDeleteFlags::Default, true);
2454 if( pEntry->pUndo )
2455 {
2456 pEntry->pUndo->UndoImpl(rContext);
2457 pEntry->pUndo.reset();
2458 }
2459 }
2460 pEntry->pUndo = std::move(pUndo);
2461
2462 aInsIdx = rBox.GetSttIdx() + 1;
2463 rDoc.GetNodes().Delete( aInsIdx );
2464
2468 aTmpSet(rDoc.GetAttrPool());
2469 aTmpSet.Put( rBox.GetFrameFormat()->GetAttrSet() );
2470 if( aTmpSet.Count() )
2471 {
2472 SwFrameFormat* pBoxFormat = rBox.ClaimFrameFormat();
2474 pBoxFormat->ResetFormatAttr( RES_VERT_ORIENT );
2475 }
2476
2477 if( pEntry->pBoxNumAttr )
2478 {
2479 rBox.ClaimFrameFormat()->SetFormatAttr( *pEntry->pBoxNumAttr );
2480 pEntry->pBoxNumAttr.reset();
2481 }
2482
2483 if( aTmpSet.Count() )
2484 {
2485 pEntry->pBoxNumAttr = std::make_unique<SfxItemSetFixed<
2488 pEntry->pBoxNumAttr->Put( aTmpSet );
2489 }
2490
2491 pEntry->nOffset = rBox.GetSttIdx() - pEntry->nBoxIdx;
2492 }
2493
2494 if( m_pInsRowUndo )
2495 {
2496 m_pInsRowUndo->UndoImpl(rContext);
2497 }
2498 DEBUG_REDLINE( &rDoc )
2499}
2500
2502{
2503 SwDoc & rDoc = rContext.GetDoc();
2504 DEBUG_REDLINE( &rDoc )
2505
2506 if( m_pInsRowUndo )
2507 {
2508 m_pInsRowUndo->RedoImpl(rContext);
2509 }
2510
2511 SwTableNode* pTableNd = nullptr;
2512 for (size_t n = 0; n < m_vArr.size(); ++n)
2513 {
2514 UndoTableCpyTable_Entry *const pEntry = m_vArr[ n ].get();
2515 SwNodeOffset nSttPos = pEntry->nBoxIdx + pEntry->nOffset;
2516 SwStartNode* pSNd = rDoc.GetNodes()[ nSttPos ]->StartOfSectionNode();
2517 if( !pTableNd )
2518 pTableNd = pSNd->FindTableNode();
2519
2520 SwTableBox& rBox = *pTableNd->GetTable().GetTableBox( nSttPos );
2521
2522 SwNodeIndex aInsIdx( *rBox.GetSttNd(), 1 );
2523
2524 // b62341295: Redline for copying tables - Start.
2525 rDoc.GetNodes().MakeTextNode( aInsIdx.GetNode(), rDoc.GetDfltTextFormatColl() );
2526 SwPaM aPam( aInsIdx.GetNode(), *rBox.GetSttNd()->EndOfSectionNode());
2527 std::unique_ptr<SwUndo> pUndo(IDocumentRedlineAccess::IsRedlineOn(GetRedlineFlags())
2528 ? nullptr
2529 : std::make_unique<SwUndoDelete>(aPam, SwDeleteFlags::Default, true));
2530 if( pEntry->pUndo )
2531 {
2532 pEntry->pUndo->UndoImpl(rContext);
2534 {
2535 // PrepareRedline has to be called with the beginning of the old content
2536 // When new and old content has been joined, the rIter.pAktPam has been set
2537 // by the Undo operation to this point.
2538 // Otherwise aInsIdx has been moved during the Undo operation
2539 if( pEntry->bJoin )
2540 {
2541 SwPaM& rLastPam =
2543 pUndo = PrepareRedline( &rDoc, rBox, *rLastPam.GetPoint(),
2544 pEntry->bJoin, true );
2545 }
2546 else
2547 {
2548 SwPosition aTmpPos( aInsIdx );
2549 pUndo = PrepareRedline( &rDoc, rBox, aTmpPos, pEntry->bJoin, true );
2550 }
2551 }
2552 pEntry->pUndo.reset();
2553 }
2554 pEntry->pUndo = std::move(pUndo);
2555 // b62341295: Redline for copying tables - End.
2556
2557 aInsIdx = rBox.GetSttIdx() + 1;
2558 rDoc.GetNodes().Delete( aInsIdx );
2559
2563 aTmpSet.Put( rBox.GetFrameFormat()->GetAttrSet() );
2564 if( aTmpSet.Count() )
2565 {
2566 SwFrameFormat* pBoxFormat = rBox.ClaimFrameFormat();
2568 pBoxFormat->ResetFormatAttr( RES_VERT_ORIENT );
2569 }
2570 if( pEntry->pBoxNumAttr )
2571 {
2572 rBox.ClaimFrameFormat()->SetFormatAttr( *pEntry->pBoxNumAttr );
2573 pEntry->pBoxNumAttr.reset();
2574 }
2575
2576 if( aTmpSet.Count() )
2577 {
2578 pEntry->pBoxNumAttr = std::make_unique<SfxItemSetFixed<
2581 pEntry->pBoxNumAttr->Put( aTmpSet );
2582 }
2583
2584 pEntry->nOffset = rBox.GetSttIdx() - pEntry->nBoxIdx;
2585 }
2586 DEBUG_REDLINE( &rDoc )
2587}
2588
2589void SwUndoTableCpyTable::AddBoxBefore( const SwTableBox& rBox, bool bDelContent )
2590{
2591 if (!m_vArr.empty() && !bDelContent)
2592 return;
2593
2595 m_vArr.push_back(std::unique_ptr<UndoTableCpyTable_Entry>(pEntry));
2596
2597 SwDoc* pDoc = rBox.GetFrameFormat()->GetDoc();
2598 DEBUG_REDLINE( pDoc )
2599 if( bDelContent )
2600 {
2601 SwNodeIndex aInsIdx( *rBox.GetSttNd(), 1 );
2602 pDoc->GetNodes().MakeTextNode( aInsIdx.GetNode(), pDoc->GetDfltTextFormatColl() );
2603 SwPaM aPam( aInsIdx.GetNode(), *rBox.GetSttNd()->EndOfSectionNode() );
2604
2605 if( !pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
2606 pEntry->pUndo = std::make_unique<SwUndoDelete>(aPam, SwDeleteFlags::Default, true);
2607 }
2608
2609 pEntry->pBoxNumAttr = std::make_unique<SfxItemSetFixed<
2612 pEntry->pBoxNumAttr->Put( rBox.GetFrameFormat()->GetAttrSet() );
2613 if( !pEntry->pBoxNumAttr->Count() )
2614 {
2615 pEntry->pBoxNumAttr.reset();
2616 }
2617 DEBUG_REDLINE( pDoc )
2618}
2619
2620void SwUndoTableCpyTable::AddBoxAfter( const SwTableBox& rBox, const SwNodeIndex& rIdx, bool bDelContent )
2621{
2622 UndoTableCpyTable_Entry *const pEntry = m_vArr.back().get();
2623
2624 // If the content was deleted then remove also the temporarily created node
2625 if( bDelContent )
2626 {
2627 SwDoc* pDoc = rBox.GetFrameFormat()->GetDoc();
2628 DEBUG_REDLINE( pDoc )
2629
2631 {
2632 SwPosition aTmpPos( rIdx );
2633 pEntry->pUndo = PrepareRedline( pDoc, rBox, aTmpPos, pEntry->bJoin, false );
2634 }
2635 SwNodeIndex aDelIdx( *rBox.GetSttNd(), 1 );
2636 rBox.GetFrameFormat()->GetDoc()->GetNodes().Delete( aDelIdx );
2637 DEBUG_REDLINE( pDoc )
2638 }
2639
2640 pEntry->nOffset = rBox.GetSttIdx() - pEntry->nBoxIdx;
2641}
2642
2643// PrepareRedline is called from AddBoxAfter() and from Redo() in slightly different situations.
2644// bRedo is set by calling from Redo()
2645// rJoin is false by calling from AddBoxAfter() and will be set if the old and new content has
2646// been merged.
2647// rJoin is true if Redo() is calling and the content has already been merged
2648
2649std::unique_ptr<SwUndo> SwUndoTableCpyTable::PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox,
2650 SwPosition& rPos, bool& rJoin, bool bRedo )
2651{
2652 std::unique_ptr<SwUndo> pUndo;
2653 // b62341295: Redline for copying tables
2654 // What's to do?
2655 // Mark the cell content before rIdx as insertion,
2656 // mark the cell content behind rIdx as deletion
2657 // merge text nodes at rIdx if possible
2660 SwPosition aInsertEnd( rPos );
2661 SwTextNode* pText;
2662 if( !rJoin )
2663 {
2664 // If the content is not merged, the end of the insertion is at the end of the node
2665 // _before_ the given position rPos
2666 aInsertEnd.Adjust(SwNodeOffset(-1));
2667 pText = aInsertEnd.GetNode().GetTextNode();
2668 if( pText )
2669 {
2670 aInsertEnd.SetContent(pText->GetText().getLength());
2671 if( !bRedo && rPos.GetNode().GetTextNode() )
2672 { // Try to merge, if not called by Redo()
2673 rJoin = true;
2674
2675 // Park this somewhere else so nothing points to the to-be-deleted node.
2676 rPos.nContent.Assign(pText, 0);
2677
2678 pText->JoinNext();
2679 }
2680 }
2681 else
2682 aInsertEnd.nContent.Assign(nullptr, 0);
2683 }
2684 // For joined (merged) contents the start of deletion and end of insertion are identical
2685 // otherwise adjacent nodes.
2686 SwPosition aDeleteStart( rJoin ? aInsertEnd : rPos );
2687 if( !rJoin )
2688 {
2689 pText = aDeleteStart.GetNode().GetTextNode();
2690 if( pText )
2691 aDeleteStart.nContent.Assign( pText, 0 );
2692 }
2693 SwPosition aCellEnd( *rBox.GetSttNd()->EndOfSectionNode(), SwNodeOffset(-1) );
2694 pText = aCellEnd.GetNode().GetTextNode();
2695 if( pText )
2696 aCellEnd.nContent.Assign(pText, pText->GetText().getLength());
2697 if( aDeleteStart != aCellEnd )
2698 { // If the old (deleted) part is not empty, here we are...
2699 SwPaM aDeletePam( aDeleteStart, aCellEnd );
2700 pUndo = std::make_unique<SwUndoRedlineDelete>( aDeletePam, SwUndoId::DELETE );
2701 pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( RedlineType::Delete, aDeletePam ), true );
2702 }
2703 else if( !rJoin ) // If the old part is empty and joined, we are finished
2704 { // if it is not joined, we have to delete this empty paragraph
2705 aCellEnd.Assign(*rBox.GetSttNd()->EndOfSectionNode());
2706 SwPaM aTmpPam( aDeleteStart, aCellEnd );
2707 pUndo = std::make_unique<SwUndoDelete>(aTmpPam, SwDeleteFlags::Default, true);
2708 }
2709 SwPosition aCellStart( *rBox.GetSttNd(), SwNodeOffset(2) );
2710 pText = aCellStart.GetNode().GetTextNode();
2711 if( pText )
2712 aCellStart.nContent.Assign( pText, 0 );
2713 if( aCellStart != aInsertEnd ) // An empty insertion will not been marked
2714 {
2715 SwPaM aTmpPam( aCellStart, aInsertEnd );
2716 pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( RedlineType::Insert, aTmpPam ), true );
2717 }
2718
2720 return pUndo;
2721}
2722
2724 sal_uInt16 nCnt )
2725{
2726 SwTableNode* pTableNd = const_cast<SwTableNode*>(rTable.GetTabSortBoxes()[0]->
2727 GetSttNd()->FindTableNode());
2728
2729 m_pInsRowUndo.reset( new SwUndoTableNdsChg( SwUndoId::TABLE_INSROW, rBoxes, *pTableNd,
2730 0, 0, nCnt, true, false ) );
2731 SwTableSortBoxes aTmpLst( rTable.GetTabSortBoxes() );
2732
2733 bool bRet = rTable.InsertRow( rTable.GetFrameFormat()->GetDoc(), rBoxes, nCnt, /*bBehind*/true );
2734 if( bRet )
2735 m_pInsRowUndo->SaveNewBoxes( *pTableNd, aTmpLst );
2736 else
2737 {
2738 m_pInsRowUndo.reset();
2739 }
2740 return bRet;
2741}
2742
2744{
2745 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwUndoTableCpyTable"));
2746
2747 for (const auto& pEntry : m_vArr)
2748 {
2749 pEntry->dumpAsXml(pWriter);
2750 }
2751
2752 if (m_pInsRowUndo)
2753 {
2754 m_pInsRowUndo->dumpAsXml(pWriter);
2755 }
2756
2757 (void)xmlTextWriterEndElement(pWriter);
2758}
2759
2761{
2762 return !m_pInsRowUndo && m_vArr.empty();
2763}
2764
2766 : SwUndo( SwUndoId::CPYTBL, &rDoc ), m_nTableNode( 0 )
2767{
2768}
2769
2771{
2772}
2773
2775{
2776 SwDoc & rDoc = rContext.GetDoc();
2777 SwTableNode* pTNd = rDoc.GetNodes()[ m_nTableNode ]->GetTableNode();
2778
2779 // move hard page breaks into next node
2780 SwContentNode* pNextNd = rDoc.GetNodes()[ pTNd->EndOfSectionIndex()+1 ]->GetContentNode();
2781 if( pNextNd )
2782 {
2783 SwFrameFormat* pTableFormat = pTNd->GetTable().GetFrameFormat();
2784
2785 if( const SwFormatPageDesc* pItem = pTableFormat->GetItemIfSet( RES_PAGEDESC,
2786 false ) )
2787 pNextNd->SetAttr( *pItem );
2788
2789 if( const SvxFormatBreakItem* pItem = pTableFormat->GetItemIfSet( RES_BREAK,
2790 false ) )
2791 pNextNd->SetAttr( *pItem );
2792 }
2793
2794 SwPaM aPam( *pTNd, *pTNd->EndOfSectionNode(), SwNodeOffset(0) , SwNodeOffset(1) );
2795 m_pDelete.reset(new SwUndoDelete(aPam, SwDeleteFlags::Default, true));
2796}
2797
2799{
2800 m_pDelete->UndoImpl(rContext);
2801 m_pDelete.reset();
2802}
2803
2805 std::unique_ptr<SwSaveRowSpan> pRowSp, SplitTable_HeadlineOption eMode, bool bNewSize )
2806 : SwUndo( SwUndoId::SPLIT_TABLE, &rTableNd.GetDoc() ),
2807 m_nTableNode( rTableNd.GetIndex() ), m_nOffset( 0 ), mpSaveRowSpan( std::move(pRowSp) ),
2808 m_nMode( eMode ), m_nFormulaEnd( 0 ), m_bCalcNewSize( bNewSize )
2809{
2810 switch( m_nMode )
2811 {
2813 m_pHistory.reset(new SwHistory);
2814 [[fallthrough]];
2817 m_pSavedTable.reset(new SaveTable( rTableNd.GetTable(), 1, false ));
2818 break;
2819 default: break;
2820 }
2821}
2822
2824{
2825 m_pSavedTable.reset();
2826 m_pHistory.reset();
2827 mpSaveRowSpan.reset();
2828}
2829
2831{
2832 SwDoc *const pDoc = & rContext.GetDoc();
2833 SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
2834
2835 SwPosition& rPtPos = *pPam->GetPoint();
2836 rPtPos.Assign( m_nTableNode + m_nOffset );
2837 assert(rPtPos.GetNode().GetContentNode()->Len() == 0); // empty para inserted
2838
2839 {
2840 // avoid asserts from ~SwContentIndexReg
2841 SwNodeIndex const idx(pDoc->GetNodes(), m_nTableNode + m_nOffset);
2842 {
2843 SwPaM pam(idx);
2845 ::PaMCorrAbs(*pPam, *pam.GetPoint());
2846 }
2847
2848 // remove implicitly created paragraph again
2849 pDoc->GetNodes().Delete( idx );
2850 }
2851
2852 rPtPos.Assign( m_nTableNode + m_nOffset );
2853 SwTableNode* pTableNd = rPtPos.GetNode().GetTableNode();
2854 SwTable& rTable = pTableNd->GetTable();
2855
2856 SwTableFormulaUpdate aMsgHint( &rTable );
2857 aMsgHint.m_eFlags = TBL_BOXPTR;
2858 pDoc->getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
2859
2860 switch( m_nMode )
2861 {
2863 if( m_pHistory )
2864 m_pHistory->TmpRollback( pDoc, m_nFormulaEnd );
2865 [[fallthrough]];
2868 {
2869 m_pSavedTable->CreateNew( rTable, false );
2870 m_pSavedTable->RestoreAttr( rTable );
2871 }
2872 break;
2873
2875 // the created first line has to be removed again
2876 {
2877 SwSelBoxes aSelBoxes;
2878 SwTableBox* pBox = rTable.GetTableBox( m_nTableNode + m_nOffset + 1 );
2879 SwTable::SelLineFromBox( pBox, aSelBoxes );
2880 FndBox_ aTmpBox( nullptr, nullptr );
2881 aTmpBox.SetTableLines( aSelBoxes, rTable );
2882 aTmpBox.DelFrames( rTable );
2883 rTable.DeleteSel( pDoc, aSelBoxes, nullptr, nullptr, false, false );
2884 }
2885 break;
2886 default: break;
2887 }
2888
2889 pDoc->GetNodes().MergeTable( rPtPos.GetNode() );
2890
2891 if( m_pHistory )
2892 {
2893 m_pHistory->TmpRollback( pDoc, 0 );
2894 m_pHistory->SetTmpEnd( m_pHistory->Count() );
2895 }
2896 if( mpSaveRowSpan )
2897 {
2898 pTableNd = rPtPos.GetNode().FindTableNode();
2899 if( pTableNd )
2900 pTableNd->GetTable().RestoreRowSpan( *mpSaveRowSpan );
2901 }
2902 ClearFEShellTabCols(*pDoc, nullptr);
2903}
2904
2906{
2907 SwDoc *const pDoc = & rContext.GetDoc();
2908 SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
2909
2910 pPam->DeleteMark();
2911 pPam->GetPoint()->Assign( m_nTableNode );
2912 pDoc->SplitTable( *pPam->GetPoint(), m_nMode, m_bCalcNewSize );
2913
2914 ClearFEShellTabCols(*pDoc, nullptr);
2915}
2916
2918{
2919 SwPaM *const pPam = & rContext.GetRepeatPaM();
2920 SwDoc *const pDoc = & rContext.GetDoc();
2921
2922 pDoc->SplitTable( *pPam->GetPoint(), m_nMode, m_bCalcNewSize );
2923 ClearFEShellTabCols(*pDoc, nullptr);
2924}
2925
2927{
2928 if( !m_pHistory )
2929 m_pHistory.reset(new SwHistory);
2930
2931 m_nFormulaEnd = rHistory.Count();
2932 m_pHistory->Move( 0, &rHistory );
2933}
2934
2936 const SwTableNode& rDelTableNd,
2937 bool bWithPrv )
2938 : SwUndo( SwUndoId::MERGE_TABLE, &rTableNd.GetDoc() ),
2939 m_bWithPrev( bWithPrv )
2940{
2941 // memorize end node of the last table cell that'll stay in position
2942 if( m_bWithPrev )
2943 m_nTableNode = rDelTableNd.EndOfSectionIndex() - 1;
2944 else
2945 m_nTableNode = rTableNd.EndOfSectionIndex() - 1;
2946
2947 m_aName = rDelTableNd.GetTable().GetFrameFormat()->GetName();
2948 m_pSaveTable.reset(new SaveTable( rDelTableNd.GetTable() ));
2949
2950 if (m_bWithPrev)
2951 m_pSaveHdl.reset( new SaveTable( rTableNd.GetTable(), 1 ) );
2952}
2953
2955{
2956 m_pSaveTable.reset();
2957 m_pSaveHdl.reset();
2958 m_pHistory.reset();
2959}
2960
2962{
2963 SwDoc *const pDoc = & rContext.GetDoc();
2964 SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
2965
2966 pPam->DeleteMark();
2967 SwPosition& rPtPos = *pPam->GetPoint();
2968 rPtPos.Assign( m_nTableNode);
2969
2970 SwTableNode* pTableNd = rPtPos.GetNode().FindTableNode();
2971 SwTable* pTable = &pTableNd->GetTable();
2972
2973 SwTableFormulaUpdate aMsgHint( pTable );
2974 aMsgHint.m_eFlags = TBL_BOXPTR;
2975 pDoc->getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
2976
2977 // get lines for layout update
2978 FndBox_ aFndBox( nullptr, nullptr );
2979 aFndBox.SetTableLines( *pTable );
2980 aFndBox.DelFrames( *pTable );
2981 // ? TL_CHART2: notification or locking of controller required ?
2982
2983 SwTableNode* pNew = pDoc->GetNodes().SplitTable( rPtPos.GetNode() );
2984
2985 // update layout
2986 aFndBox.MakeFrames( *pTable );
2987 // ? TL_CHART2: notification or locking of controller required ?
2988
2989 if( m_bWithPrev )
2990 {
2991 // move name
2992 pNew->GetTable().GetFrameFormat()->SetFormatName( pTable->GetFrameFormat()->GetName() );
2993 m_pSaveHdl->RestoreAttr( pNew->GetTable() );
2994 }
2995 else
2996 pTable = &pNew->GetTable();
2997
2998 pTable->GetFrameFormat()->SetFormatName( m_aName );
2999 m_pSaveTable->RestoreAttr( *pTable );
3000
3001 if( m_pHistory )
3002 {
3003 m_pHistory->TmpRollback( pDoc, 0 );
3004 m_pHistory->SetTmpEnd( m_pHistory->Count() );
3005 }
3006
3007 // create frames for the new table
3008 pNew->MakeOwnFrames();
3009
3010 // position cursor somewhere in content
3011 pDoc->GetNodes().GoNext( &rPtPos );
3012
3013 ClearFEShellTabCols(*pDoc, nullptr);
3014
3015 // TL_CHART2: need to inform chart of probably changed cell names
3017 if (pPCD)
3018 {
3019 pDoc->UpdateCharts( pTable->GetFrameFormat()->GetName() );
3020 pDoc->UpdateCharts( pNew->GetTable().GetFrameFormat()->GetName() );
3021 }
3022}
3023
3025{
3026 SwDoc *const pDoc = & rContext.GetDoc();
3027 SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
3028
3029 pPam->DeleteMark();
3030 if( m_bWithPrev )
3031 pPam->GetPoint()->Assign( m_nTableNode + 3 );
3032 else
3033 pPam->GetPoint()->Assign( m_nTableNode );
3034
3035 pDoc->MergeTable( *pPam->GetPoint(), m_bWithPrev );
3036
3037 ClearFEShellTabCols(*pDoc, nullptr);
3038}
3039
3041{
3042 SwDoc *const pDoc = & rContext.GetDoc();
3043 SwPaM *const pPam = & rContext.GetRepeatPaM();
3044
3045 pDoc->MergeTable( *pPam->GetPoint(), m_bWithPrev );
3046 ClearFEShellTabCols(*pDoc, nullptr);
3047}
3048
3050{
3051 if( !m_pHistory )
3052 m_pHistory.reset( new SwHistory );
3053 m_pHistory->Move( 0, &rHistory );
3054}
3055
3056void InsertSort( std::vector<sal_uInt16>& rArr, sal_uInt16 nIdx )
3057{
3058 size_t nO = rArr.size();
3059 size_t nU = 0;
3060 if( nO > 0 )
3061 {
3062 nO--;
3063 while( nU <= nO )
3064 {
3065 const size_t nM = nU + ( nO - nU ) / 2;
3066 if ( rArr[nM] == nIdx )
3067 {
3068 OSL_FAIL( "Index already exists. This should never happen." );
3069 return;
3070 }
3071 if( rArr[nM] < nIdx )
3072 nU = nM + 1;
3073 else if( nM == 0 )
3074 break;
3075 else
3076 nO = nM - 1;
3077 }
3078 }
3079 rArr.insert( rArr.begin() + nU, nIdx );
3080}
3081
3082#if OSL_DEBUG_LEVEL > 0
3083void CheckTable( const SwTable& rTable )
3084{
3085 const SwNodes& rNds = rTable.GetFrameFormat()->GetDoc()->GetNodes();
3086 const SwTableSortBoxes& rSrtArr = rTable.GetTabSortBoxes();
3087 for (size_t n = 0; n < rSrtArr.size(); ++n)
3088 {
3089 const SwTableBox* pBox = rSrtArr[ n ];
3090 const SwNode* pNd = pBox->GetSttNd();
3091 OSL_ENSURE( rNds[ pBox->GetSttIdx() ] == pNd, "Box with wrong StartNode" );
3092 }
3093}
3094#endif
3095
3097 : SwUndo(SwUndoId::TBLSTYLE_CREATE, &rDoc),
3098 m_sName(std::move(aName))
3099{ }
3100
3102{ }
3103
3105{
3106 m_pAutoFormat = rContext.GetDoc().DelTableStyle(m_sName, true);
3107}
3108
3110{
3111 if (m_pAutoFormat)
3112 {
3113 SwTableAutoFormat* pFormat = rContext.GetDoc().MakeTableStyle(m_sName, true);
3114 if (pFormat)
3115 {
3116 *pFormat = *m_pAutoFormat;
3117 m_pAutoFormat.reset();
3118 }
3119 }
3120}
3121
3123{
3124 SwRewriter aResult;
3125 aResult.AddRule(UndoArg1, m_sName);
3126 return aResult;
3127}
3128
3129SwUndoTableStyleDelete::SwUndoTableStyleDelete(std::unique_ptr<SwTableAutoFormat> pAutoFormat, std::vector<SwTable*>&& rAffectedTables, const SwDoc& rDoc)
3130 : SwUndo(SwUndoId::TBLSTYLE_DELETE, &rDoc),
3131 m_pAutoFormat(std::move(pAutoFormat)),
3132 m_rAffectedTables(std::move(rAffectedTables))
3133{ }
3134
3136{ }
3137
3139{
3140 SwTableAutoFormat* pNewFormat = rContext.GetDoc().MakeTableStyle(m_pAutoFormat->GetName(), true);
3141 *pNewFormat = *m_pAutoFormat;
3142 for (size_t i=0; i < m_rAffectedTables.size(); i++)
3143 m_rAffectedTables[i]->SetTableStyleName(m_pAutoFormat->GetName());
3144}
3145
3147{
3148 // Don't need to remember deleted table style nor affected tables, because they must be the same as these already known.
3149 rContext.GetDoc().DelTableStyle(m_pAutoFormat->GetName());
3150}
3151
3153{
3154 SwRewriter aResult;
3155 aResult.AddRule(UndoArg1, m_pAutoFormat->GetName());
3156 return aResult;
3157}
3158
3161 , m_pOldFormat(new SwTableAutoFormat(rOldFormat))
3162 , m_pNewFormat(new SwTableAutoFormat(rNewFormat))
3163{ }
3164
3166{ }
3167
3169{
3170 rContext.GetDoc().ChgTableStyle(m_pNewFormat->GetName(), *m_pOldFormat);
3171}
3172
3174{
3175 rContext.GetDoc().ChgTableStyle(m_pNewFormat->GetName(), *m_pNewFormat);
3176}
3177
3179{
3180 SwRewriter aResult;
3181 aResult.AddRule(UndoArg1, m_pNewFormat->GetName());
3182 return aResult;
3183}
3184
3185/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _xmlTextWriter * xmlTextWriterPtr
@ NONE
no RedlineFlags
@ Ignore
ignore Redlines
@ UndoArg1
Definition: SwRewriter.hxx:29
@ UndoArg3
Definition: SwRewriter.hxx:31
@ UndoArg2
Definition: SwRewriter.hxx:30
std::vector< std::unique_ptr< SwUndoSaveSection, o3tl::default_delete< SwUndoSaveSection > > > SwUndoSaveSections
Definition: UndoTable.hxx:174
OUString m_sTableName
constexpr sal_uInt32 getSwDefaultTextFormat()
The number formatter's default locale's @ Text format.
Definition: cellatr.hxx:34
void SetTableLines(const SwSelBoxes &rBoxes, const SwTable &rTable)
Definition: tblsel.cxx:2097
void MakeFrames(SwTable &rTable)
Definition: tblsel.cxx:2320
void DelFrames(SwTable &rTable)
Definition: tblsel.cxx:2159
virtual SwChartDataProvider * GetChartDataProvider(bool bCreate=false) const =0
returns or creates the data-provider for chart
virtual void DeleteSection(SwNode *pNode)=0
Delete section containing the node.
virtual bool MoveNodeRange(SwNodeRange &, SwNode &, SwMoveFlags)=0
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
virtual void UpdateTableFields(SfxPoolItem *pHt)=0
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual bool IsRedlineOn() const =0
Query if redlining is on.
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
static bool IsRedlineOn(const RedlineFlags eM)
virtual std::size_t GetRedlineAuthor()=0
virtual bool SplitRedline(const SwPaM &rPam)=0
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
SwFrameFormat & CreateNewFormat(SwFrameFormat &rFormat, sal_uInt16 nFormatPos)
Definition: untbl.cxx:1100
bool m_bNewModel
Definition: untbl.cxx:125
bool m_bSaveFormula
Definition: untbl.cxx:124
void CreateNew(SwTable &rTable, bool bCreateFrames=true, bool bRestoreChart=true)
Definition: untbl.cxx:1007
SwFrameFormatsV m_aFrameFormats
Definition: untbl.cxx:121
SaveTable(const SaveTable &)=delete
SaveTable & operator=(const SaveTable &)=delete
friend SaveBox
Definition: untbl.cxx:115
void RestoreAttr(SwTable &rTable, bool bModifyBox=false)
Definition: untbl.cxx:930
SfxItemSet m_aTableSet
Definition: untbl.cxx:117
std::unique_ptr< SaveLine > m_pLine
Definition: untbl.cxx:118
sal_uInt16 m_nLineCount
Definition: untbl.cxx:122
void NewFrameFormatForBox(const SwTableBox &, sal_uInt16 nFormatPos, SwFrameFormat *pOldFormat)
Definition: untbl.cxx:1117
void SaveContentAttrs(SwDoc *pDoc)
Definition: untbl.cxx:1002
friend SaveLine
Definition: untbl.cxx:116
SfxItemSets m_aSets
Definition: untbl.cxx:120
void NewFrameFormatForLine(const SwTableLine &, sal_uInt16 nFormatPos, SwFrameFormat *pOldFormat)
Definition: untbl.cxx:1107
sal_uInt16 AddFormat(SwFrameFormat *pFormat, bool bIsLine)
Definition: untbl.cxx:898
bool IsNewModel() const
Definition: untbl.cxx:143
const SwTable * m_pSwTable
Definition: untbl.cxx:119
bool m_bModifyBox
Definition: untbl.cxx:123
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwAttrPool * GetPool() const
Definition: swatrset.hxx:183
void DeleteBox(const SwTable *pTable, const SwTableBox &rBox)
Definition: unochart.cxx:1451
void MoveTo(SwContentNode &rArr)
Definition: index.cxx:283
Marks a character position inside a document model content node (SwContentNode)
SwContentIndex & Assign(const SwContentNode *, sal_Int32)
Definition: index.cxx:206
SwFormatColl * GetFormatColl() const
Definition: node.hxx:476
bool HasSwAttrSet() const
Definition: node.hxx:473
bool CanJoinNext(SwNodeIndex *pIdx=nullptr) const
Is it possible to join two nodes? In pIdx the second position can be returned.
Definition: node.cxx:1844
virtual SwContentNode * JoinNext()
Definition: node.cxx:1552
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1586
virtual sal_Int32 Len() const
Definition: node.cxx:1257
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:472
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: node.cxx:1679
virtual sal_uInt16 ResetAllAttr()
Definition: node.cxx:1749
bool MoveTable(SwWhichTable, SwMoveFnCollection const &)
Definition: trvltbl.cxx:679
SwFEShell * GetFEShell()
For Core - it knows the DocShell but not the WrtShell!
Definition: docsh.cxx:1225
Definition: doc.hxx:192
const SwTable * TextToTable(const SwInsertTableOptions &rInsTableOpts, const SwPaM &rRange, sal_Unicode cCh, sal_Int16 eAdjust, const SwTableAutoFormat *)
Text to Table.
Definition: ndtbl.cxx:625
SwTableBoxFormat * MakeTableBoxFormat()
Definition: docfmt.cxx:1714
void ChgTableStyle(const OUString &rName, const SwTableAutoFormat &rNewFormat)
Definition: ndtbl.cxx:4623
void InsertCol(const SwCursor &rCursor, sal_uInt16 nCnt=1, bool bBehind=true)
Inserting Columns/Rows.
Definition: ndtbl.cxx:1690
void UpdateCharts(const OUString &rName) const
Definition: docchart.cxx:141
IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const
Definition: doc.cxx:228
TableMergeErr MergeTable(SwPaM &rPam)
Definition: ndtbl.cxx:2209
void CorrAbs(const SwNode &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:170
SwTableLineFormat * MakeTableLineFormat()
Definition: docfmt.cxx:1722
SwTableFormat * MakeTableFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
Definition: docfmt.cxx:809
const SwTable * InsertTable(const SwInsertTableOptions &rInsTableOpts, const SwPosition &rPos, sal_uInt16 nRows, sal_uInt16 nCols, sal_Int16 eAdjust, const SwTableAutoFormat *pTAFormat=nullptr, const std::vector< sal_uInt16 > *pColArr=nullptr, bool bCalledFromShell=false, bool bNewModel=true)
Insert new table at position.
Definition: ndtbl.cxx:341
void ChkBoxNumFormat(SwTableBox &rCurrentBox, bool bCallUpdate)
Definition: ndtbl.cxx:4033
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:316
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:145
SwNodes & GetNodes()
Definition: doc.hxx:413
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:358
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:336
void DelNumRules(const SwPaM &, SwRootFrame const *pLayout=nullptr)
Definition: docnum.cxx:1314
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:330
bool TableToText(const SwTableNode *pTableNd, sal_Unicode cCh)
Table to Text.
Definition: ndtbl.cxx:1435
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:406
void InsertRow(const SwCursor &rCursor, sal_uInt16 nCnt=1, bool bBehind=true)
Definition: ndtbl.cxx:1748
std::unique_ptr< SwTableAutoFormat > DelTableStyle(const OUString &rName, bool bBroadcast=false)
Definition: ndtbl.cxx:4589
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:427
const SwTextFormatColl * GetDfltTextFormatColl() const
Definition: doc.hxx:780
bool SplitTable(const SwSelBoxes &rBoxes, bool bVert, sal_uInt16 nCnt, bool bSameHeight=false)
Split up/merge Boxes in the Table.
Definition: ndtbl.cxx:2143
bool IsInsTableFormatNum() const
Definition: doc.cxx:1674
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1322
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:751
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:748
void SetRowsToRepeat(SwTable &rTable, sal_uInt16 nSet)
Definition: ndtbl.cxx:2906
SwDocShell * GetDocShell()
Definition: doc.hxx:1355
SwTableAutoFormat * MakeTableStyle(const OUString &rName, bool bBroadcast=false)
Definition: ndtbl.cxx:4569
Ends a section of nodes in the document model.
Definition: node.hxx:355
bool UpdateTableStyleFormatting(SwTableNode *pTableNode=nullptr, bool bResetDirect=false, OUString const *pStyleName=nullptr)
Update the direct formatting according to the current table style.
Definition: fetab.cxx:1310
FlyAnchors.
Definition: fmtanchr.hxx:37
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:69
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:36
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:620
const OUString & GetName() const
Definition: format.hxx:131
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:83
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:449
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Templatized version of GetItemState() to directly return the correct type.
Definition: format.hxx:111
size_t GetPos(const SwFormat *p) const
Definition: docary.hxx:161
Style of a layout element.
Definition: frmfmt.hxx:62
virtual void SetFormatName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2568
void MoveTableBox(SwTableBox &rTableBox, const SwFrameFormat *pOldFormat)
Definition: atrfrm.cxx:3609
Unsorted, undeleting SwFrameFormat vector.
Definition: docary.hxx:178
Specific frame formats (frames, DrawObjects).
size_t size() const
sal_uInt16 Count() const
Definition: rolbck.hxx:378
sal_uInt16 SetTmpEnd(sal_uInt16 nTmpEnd)
Definition: rolbck.cxx:1247
bool TmpRollback(SwDoc *pDoc, sal_uInt16 nStart, bool ToFirst=true)
Definition: rolbck.cxx:1222
bool Rollback(SwDoc *pDoc, sal_uInt16 nStart=0)
Definition: rolbck.cxx:1207
TElementType * Next()
Definition: calbck.hxx:364
TElementType * First()
Definition: calbck.hxx:356
void LockModify()
Definition: calbck.hxx:208
void UnlockModify()
Definition: calbck.hxx:209
void Add(SwClient *pDepend)
Definition: calbck.cxx:172
bool HasWriterListeners() const
Definition: calbck.hxx:202
void RestoreUpperFrames(SwNodes &rNds, SwNodeOffset nStt, SwNodeOffset nEnd)
Definition: node2lay.cxx:489
Marks a node in the document model.
Definition: ndindex.hxx:31
const SwNodes & GetNodes() const
Definition: ndindex.hxx:175
SwNode & GetNode() const
Definition: ndindex.hxx:136
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:171
SwNodeIndex aStart
Definition: ndindex.hxx:149
SwNodeIndex aEnd
Definition: ndindex.hxx:150
Base class of the Writer document model elements.
Definition: node.hxx:84
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:876
SwNodeOffset GetIndex() const
Definition: node.hxx:296
SwStartNode * m_pStartOfSection
Definition: node.hxx:115
bool IsContentNode() const
Definition: node.hxx:656
SwDoc & GetDoc()
Definition: node.hxx:217
bool IsStartNode() const
Definition: node.hxx:652
SwNodeOffset StartOfSectionIndex() const
Definition: node.hxx:701
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:370
SwStartNode * FindSttNodeByType(SwStartNodeType eTyp)
Definition: node.cxx:776
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:137
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:705
SwContentNode * GetContentNode()
Definition: node.hxx:643
SwTableNode * GetTableNode()
Definition: node.hxx:627
SwNodeType GetNodeType() const
Definition: node.hxx:150
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:710
SwTextNode * MakeTextNode(SwNode &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
Definition: ndtxt.cxx:103
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:165
bool MoveNodes(const SwNodeRange &, SwNodes &rNodes, SwNode &rPos, bool bNewFrames=true)
move the node pointer
Definition: nodes.cxx:405
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
Definition: nodes.cxx:1071
static SwContentNode * GoPrevious(SwNodeIndex *)
Definition: nodes.cxx:1334
SwStartNode * MakeTextSection(const SwNode &rWhere, SwStartNodeType eSttNdTyp, SwTextFormatColl *pColl)
Definition: nodes.cxx:1929
SwTableNode * SplitTable(SwNode &rPos, bool bAfter=true, bool bCalcNewSize=false)
Splits a table at the base-line which contains the index.
Definition: ndtbl.cxx:3346
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1300
SwTableNode * UndoTableToText(SwNodeOffset nStt, SwNodeOffset nEnd, const SwTableToTextSaves &rSavedData)
Is in untbl.cxx and may called only by Undo-object.
Definition: untbl.cxx:528
bool MergeTable(SwNode &rPos, bool bWithPrev=true)
Two Tables that are following one another are merged.
Definition: ndtbl.cxx:3523
friend class SwStartNode
Definition: ndarr.hxx:95
SwDoc & GetDoc()
Which Doc contains the nodes-array?
Definition: ndarr.hxx:311
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
const SwPosition * GetMark() const
Definition: pam.hxx:263
SwNode & GetPointNode() const
Definition: pam.hxx:283
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:612
void Exchange()
Definition: pam.cxx:626
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:638
const SwPosition * End() const
Definition: pam.hxx:271
SwDoc & GetDoc() const
Definition: pam.hxx:299
void DeleteMark()
Definition: pam.hxx:231
const SwPosition * GetPoint() const
Definition: pam.hxx:261
bool empty() const
Definition: docary.hxx:266
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
Definition: rootfrm.hxx:421
Starts a section of nodes in the document model.
Definition: node.hxx:325
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:47
bool IsJustify() const
Definition: tblafmt.hxx:214
bool IsFont() const
Definition: tblafmt.hxx:213
void ChangeState(const SfxPoolItem *pItem)
Definition: cellatr.cxx:97
void ChgDefinedIn(const sw::BroadcastingModify *pNew)
Definition: cellatr.hxx:65
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:419
SwTableLine * GetUpper()
Definition: swtable.hxx:453
void SetUpper(SwTableLine *pNew)
Definition: swtable.hxx:455
SwNodeOffset IsValidNumTextNd(bool bCheckAttr=true) const
Definition: swtable.cxx:2653
sal_Int32 getRowSpan() const
Definition: swtable.hxx:514
SwNodeOffset GetSttIdx() const
Definition: swtable.cxx:2049
void setRowSpan(sal_Int32 nNewRowSpan)
Definition: swtable.cxx:77
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:457
SwTableLines & GetTabLines()
Definition: swtable.hxx:450
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:471
void RegisterToFormat(SwFormat &rFormat)
Definition: swtable.cxx:2945
void ChgFrameFormat(SwTableBoxFormat *pNewFormat, bool bNeedToReregister=true)
Definition: swtable.cxx:1937
SwFrameFormat * ClaimFrameFormat()
Definition: swtable.cxx:1901
TableFormulaUpdateFlags m_eFlags
Definition: hints.hxx:271
SwTableLine is one table row in the document model.
Definition: swtable.hxx:358
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:380
SwTableBoxes & GetTabBoxes()
Definition: swtable.hxx:368
void SetUpper(SwTableBox *pNew)
Definition: swtable.hxx:378
SwTableBox * GetUpper()
Definition: swtable.hxx:376
std::vector< SwTableLine * >::const_iterator const_iterator
Definition: swtable.hxx:70
size_type size() const
Definition: swtable.hxx:76
iterator erase(iterator aIt)
Definition: swtable.hxx:84
void push_back(SwTableLine *pLine)
Definition: swtable.hxx:92
iterator insert(iterator aIt, SwTableLine *pLine)
Definition: swtable.hxx:86
iterator begin()
Definition: swtable.hxx:77
sal_uInt16 GetPos(const SwTableLine *pBox) const
Definition: swtable.hxx:98
bool empty() const
Definition: swtable.hxx:75
void SetNewTable(std::unique_ptr< SwTable >, bool bNewFrames=true)
Definition: ndtbl.cxx:2473
const SwTable & GetTable() const
Definition: node.hxx:521
void MakeOwnFrames(SwNodeIndex *pIdxBehind=nullptr)
Creates the frms for the table node (i.e.
Definition: ndtbl.cxx:2381
void DelFrames(SwRootFrame const *pLayout=nullptr)
Method deletes all views of document for the node.
Definition: ndtbl.cxx:2428
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:113
SwTableNode * GetTableNode() const
Definition: swtable.cxx:2111
void SetTableModel(bool bNew)
Definition: swtable.hxx:187
void SetRowsToRepeat(sal_uInt16 nNumOfRows)
Definition: swtable.hxx:197
SwTableLines & GetTabLines()
Definition: swtable.hxx:201
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:204
bool DeleteSel(SwDoc *, const SwSelBoxes &rBoxes, const SwSelBoxes *pMerged, SwUndo *pUndo, const bool bDelMakeFrames, const bool bCorrBorder)
Definition: tblrwcl.cxx:948
void RegisterToFormat(SwFormat &rFormat)
Definition: swtable.cxx:2933
bool InsertRow(SwDoc *, const SwSelBoxes &rBoxes, sal_uInt16 nCnt, bool bBehind)
SwTable::InsertRow(..) inserts one or more rows before or behind the selected boxes.
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
Definition: swtable.cxx:1340
SwTableSortBoxes & GetTabSortBoxes()
Definition: swtable.hxx:262
void RestoreRowSpan(const SwSaveRowSpan &)
void PrepareDeleteCol(tools::Long nMin, tools::Long nMax)
SwTable::PrepareDeleteCol(..) adjusts the widths of the neighbour cells of a cell selection for an up...
bool IsNewModel() const
Definition: swtable.hxx:188
static SwSelBoxes & SelLineFromBox(const SwTableBox *pBox, SwSelBoxes &rBoxes, bool bToTop=true)
Definition: tblcpy.cxx:1028
Represents the style of a paragraph.
Definition: fmtcol.hxx:59
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:86
void RstTextAttr(const SwContentIndex &rIdx, const sal_Int32 nLen, const sal_uInt16 nWhich=0, const SfxItemSet *pSet=nullptr, const bool bInclRefToxMark=false, const bool bExactRange=false)
delete all attributes.
Definition: txtedt.cxx:367
virtual SwContentNode * JoinNext() override
Definition: ndtxt.cxx:980
void ClearSwpHintsArr(bool bDelFields)
Definition: thints.cxx:3427
void EraseText(const SwContentIndex &rIdx, const sal_Int32 nCount=SAL_MAX_INT32, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
delete text content ATTENTION: must not be called with a range that overlaps the start of an attribut...
Definition: ndtxt.cxx:2724
OUString InsertText(const OUString &rStr, const SwContentIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2322
SwTextNode * SplitContentNode(const SwPosition &, std::function< void(SwTextNode *, sw::mark::RestoreMode, bool AtStart)> const *pContentIndexRestore)
Definition: ndtxt.cxx:412
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:230
const OUString & GetText() const
Definition: ndtxt.hxx:222
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:870
virtual sal_uInt16 ResetAllAttr() override
Definition: ndtxt.cxx:5252
SwPaM & AddUndoRedoPaM(::sw::UndoRedoContext &, bool const bCorrToContent=false) const
Definition: undobj.cxx:100
void SetPaM(SwPaM &, bool bCorrToContent=false) const
Definition: undobj.cxx:80
sal_Int32 m_nSttContent
Definition: undobj.hxx:232
SwNodeOffset m_nSttNode
Definition: undobj.hxx:231
SwNodeOffset m_nEndNode
Definition: undobj.hxx:231
SwNodeOffset m_nStartNode
Definition: UndoTable.hxx:137
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:1391
SwUndoAttrTable(const SwTableNode &rTableNd, bool bClearTabCols=false)
Definition: untbl.cxx:1360
std::unique_ptr< SaveTable > m_pSaveTable
Definition: UndoTable.hxx:138
virtual ~SwUndoAttrTable() override
Definition: untbl.cxx:1368
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:1372
SwNodeOffset m_nTableNode
Definition: UndoTable.hxx:307
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:2774
virtual ~SwUndoCpyTable() override
Definition: untbl.cxx:2770
SwUndoCpyTable(const SwDoc &rDoc)
Definition: untbl.cxx:2765
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:2798
std::unique_ptr< SwUndoDelete > m_pDelete
Definition: UndoTable.hxx:306
bool IsDelFullPara() const
Definition: UndoDelete.hxx:105
std::optional< std::vector< sal_uInt16 > > m_oColumnWidth
Definition: UndoTable.hxx:61
virtual ~SwUndoInsTable() override
Definition: untbl.cxx:261
sal_uInt16 m_nColumns
Definition: UndoTable.hxx:65
sal_uInt16 m_nRows
Definition: UndoTable.hxx:65
SwNodeOffset m_nStartNode
Definition: UndoTable.hxx:64
OUString m_sTableName
Definition: UndoTable.hxx:58
SwUndoInsTable(const SwPosition &, sal_uInt16 nCols, sal_uInt16 nRows, sal_uInt16 eAdjust, const SwInsertTableOptions &rInsTableOpts, const SwTableAutoFormat *pTAFormat, const std::vector< sal_uInt16 > *pColArr, const OUString &rName)
Definition: untbl.cxx:234
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: untbl.cxx:360
std::unique_ptr< SwTableAutoFormat > m_pAutoFormat
Definition: UndoTable.hxx:63
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:311
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:269
std::unique_ptr< SwRedlineData > m_pRedlineData
Definition: UndoTable.hxx:62
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: untbl.cxx:352
sal_uInt16 const m_nAdjust
Definition: UndoTable.hxx:66
std::unique_ptr< SwDDEFieldType > m_pDDEFieldType
Definition: UndoTable.hxx:60
SwInsertTableOptions m_aInsTableOptions
Definition: UndoTable.hxx:59
SwNodeOffset m_nTableNode
Definition: UndoTable.hxx:348
std::unique_ptr< SaveTable > m_pSaveHdl
Definition: UndoTable.hxx:349
SwUndoMergeTable(const SwTableNode &rTableNd, const SwTableNode &rDelTableNd, bool bWithPrev)
Definition: untbl.cxx:2935
void SaveFormula(SwHistory &rHistory)
Definition: untbl.cxx:3049
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: untbl.cxx:3040
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:2961
virtual ~SwUndoMergeTable() override
Definition: untbl.cxx:2954
std::unique_ptr< SaveTable > m_pSaveTable
Definition: UndoTable.hxx:349
std::unique_ptr< SwHistory > m_pHistory
Definition: UndoTable.hxx:350
OUString m_aName
Definition: UndoTable.hxx:347
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:3024
sal_Int32 GetDestSttContent() const
SwNodeOffset GetDestSttNode() const
SwNodeOffset GetEndNode() const
bool IsMoveRange() const
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unmove.cxx:153
SwNodeOffset NodeDiff() const
Definition: UndoRedline.hxx:77
sal_Int32 ContentStart() const
Definition: UndoRedline.hxx:78
const SwHistory * GetHistory() const
Definition: undobj.hxx:221
void RestoreSection(SwDoc *pDoc, SwNodeIndex *pIdx, sal_uInt16 nSectType)
Definition: undobj.cxx:1280
std::unique_ptr< SwSaveRowSpan > mpSaveRowSpan
Definition: UndoTable.hxx:323
std::unique_ptr< SwHistory > m_pHistory
Definition: UndoTable.hxx:325
SplitTable_HeadlineOption const m_nMode
Definition: UndoTable.hxx:326
void SaveFormula(SwHistory &rHistory)
Definition: untbl.cxx:2926
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:2830
SwNodeOffset m_nOffset
Definition: UndoTable.hxx:322
virtual ~SwUndoSplitTable() override
Definition: untbl.cxx:2823
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: untbl.cxx:2917
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:2905
std::unique_ptr< SaveTable > m_pSavedTable
Definition: UndoTable.hxx:324
SwNodeOffset m_nTableNode
Definition: UndoTable.hxx:322
sal_uInt16 m_nFormulaEnd
Definition: UndoTable.hxx:327
SwUndoSplitTable(const SwTableNode &rTableNd, std::unique_ptr< SwSaveRowSpan > pRowSp, SplitTable_HeadlineOption nMode, bool bCalcNewSize)
Definition: untbl.cxx:2804
SwNodeOffset m_nStartNode
Definition: UndoTable.hxx:155
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:1459
virtual ~SwUndoTableAutoFormat() override
Definition: untbl.cxx:1416
void UndoRedo(bool const bUndo, ::sw::UndoRedoContext &rContext)
Definition: untbl.cxx:1426
SwUndoTableAutoFormat(const SwTableNode &rTableNd, const SwTableAutoFormat &)
Definition: untbl.cxx:1397
void SaveBoxContent(const SwTableBox &rBox)
Definition: untbl.cxx:1420
sal_uInt16 m_nRepeatHeading
Definition: UndoTable.hxx:159
std::vector< std::shared_ptr< SwUndoTableNumFormat > > m_Undos
Definition: UndoTable.hxx:157
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:1464
std::unique_ptr< SaveTable > m_pSaveTable
Definition: UndoTable.hxx:156
std::vector< std::unique_ptr< UndoTableCpyTable_Entry > > m_vArr
Definition: UndoTable.hxx:279
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:2501
void AddBoxAfter(const SwTableBox &rBox, const SwNodeIndex &rIdx, bool bDelContent)
Definition: untbl.cxx:2620
static std::unique_ptr< SwUndo > PrepareRedline(SwDoc *pDoc, const SwTableBox &rBox, SwPosition &rPos, bool &rJoin, bool bRedo)
Definition: untbl.cxx:2649
virtual ~SwUndoTableCpyTable() override
Definition: untbl.cxx:2358
SwUndoTableCpyTable(const SwDoc &rDoc)
Definition: untbl.cxx:2353
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:2364
std::unique_ptr< SwUndoTableNdsChg > m_pInsRowUndo
Definition: UndoTable.hxx:280
bool IsEmpty() const
Definition: untbl.cxx:2760
bool InsertRow(SwTable &rTable, const SwSelBoxes &rBoxes, sal_uInt16 nCnt)
Definition: untbl.cxx:2723
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: untbl.cxx:2743
void AddBoxBefore(const SwTableBox &rBox, bool bDelContent)
Definition: untbl.cxx:2589
SwUndoTableHeadline(const SwTable &, sal_uInt16 nOldHdl, sal_uInt16 nNewHdl)
Definition: untbl.cxx:837
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:859
SwNodeOffset m_nTableNode
Definition: UndoTable.hxx:368
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: untbl.cxx:869
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:850
sal_uInt16 m_nOldHeadline
Definition: UndoTable.hxx:369
sal_uInt16 m_nNewHeadline
Definition: UndoTable.hxx:370
virtual ~SwUndoTableMerge() override
Definition: untbl.cxx:1848
std::unique_ptr< SaveTable > m_pSaveTable
Definition: UndoTable.hxx:223
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:1996
std::set< SwNodeOffset > m_Boxes
Definition: UndoTable.hxx:224
void SetSelBoxes(const SwSelBoxes &rBoxes)
Definition: untbl.cxx:2018
std::vector< SwNodeOffset > m_aNewStartNodes
Definition: UndoTable.hxx:225
SwNodeOffset m_nTableNode
Definition: UndoTable.hxx:222
void MoveBoxContent(SwDoc &rDoc, SwNodeRange &rRg, SwNode &rPos)
Definition: untbl.cxx:2003
SwUndoTableMerge(const SwPaM &rTableSel)
Definition: untbl.cxx:1839
std::vector< std::unique_ptr< SwUndoMove > > m_vMoves
Definition: UndoTable.hxx:226
void SaveCollection(const SwTableBox &rBox)
Definition: untbl.cxx:2035
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:1855
std::unique_ptr< SwHistory > m_pHistory
Definition: UndoTable.hxx:227
std::optional< std::set< BoxMove > > m_xNewSttNds
Definition: UndoTable.hxx:187
void ReNewBoxes(const SwSelBoxes &rBoxes)
Definition: untbl.cxx:1488
virtual ~SwUndoTableNdsChg() override
Definition: untbl.cxx:1500
std::unique_ptr< SwUndoSaveSections > m_pDelSects
Definition: UndoTable.hxx:188
std::set< SwNodeOffset > m_Boxes
Definition: UndoTable.hxx:179
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:1789
void SaveSection(SwStartNode *pSttNd)
Definition: untbl.cxx:1635
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:1649
tools::Long m_nMax
Definition: UndoTable.hxx:189
SwNodeOffset m_nSttNode
Definition: UndoTable.hxx:190
SwUndoTableNdsChg(SwUndoTableNdsChg const &)=delete
std::unique_ptr< SaveTable > m_pSaveTable
Definition: UndoTable.hxx:178
void SaveNewBoxes(const SwTableNode &rTableNd, const SwTableSortBoxes &rOld)
Definition: untbl.cxx:1504
tools::Long m_nMin
Definition: UndoTable.hxx:189
sal_uInt16 m_nCount
Definition: UndoTable.hxx:191
sal_uLong m_nNewFormatIdx
Definition: UndoTable.hxx:253
void SetBox(const SwTableBox &rBox)
Definition: untbl.cxx:2306
SwNodeOffset m_nNodePos
Definition: UndoTable.hxx:256
SwUndoTableNumFormat(const SwTableBox &rBox, const SfxItemSet *pNewSet=nullptr)
Definition: untbl.cxx:2050
std::unique_ptr< SwHistory > m_pHistory
Definition: UndoTable.hxx:250
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:2217
virtual ~SwUndoTableNumFormat() override
Definition: untbl.cxx:2117
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:2123
std::unique_ptr< SfxItemSet > m_pBoxSet
Definition: UndoTable.hxx:249
SwNodeOffset m_nNode
Definition: UndoTable.hxx:255
sal_uLong m_nFormatIdx
Definition: UndoTable.hxx:253
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:3138
std::unique_ptr< SwTableAutoFormat > m_pAutoFormat
Definition: UndoTable.hxx:399
virtual ~SwUndoTableStyleDelete() override
Definition: untbl.cxx:3135
std::vector< SwTable * > m_rAffectedTables
Definition: UndoTable.hxx:400
SwUndoTableStyleDelete(std::unique_ptr< SwTableAutoFormat > pAutoFormat, std::vector< SwTable * > &&rAffectedTables, const SwDoc &rDoc)
Definition: untbl.cxx:3129
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:3146
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: untbl.cxx:3152
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: untbl.cxx:3122
SwUndoTableStyleMake(OUString aName, const SwDoc &rDoc)
Definition: untbl.cxx:3096
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:3109
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:3104
virtual ~SwUndoTableStyleMake() override
Definition: untbl.cxx:3101
std::unique_ptr< SwTableAutoFormat > m_pAutoFormat
Definition: UndoTable.hxx:385
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:3173
SwUndoTableStyleUpdate(const SwTableAutoFormat &rNewFormat, const SwTableAutoFormat &rOldFormat, const SwDoc &rDoc)
Definition: untbl.cxx:3159
std::unique_ptr< SwTableAutoFormat > m_pNewFormat
Definition: UndoTable.hxx:414
std::unique_ptr< SwTableAutoFormat > m_pOldFormat
Definition: UndoTable.hxx:414
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:3168
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: untbl.cxx:3178
virtual ~SwUndoTableStyleUpdate() override
Definition: untbl.cxx:3165
std::unique_ptr< SwHistory > m_pHistory
Definition: UndoTable.hxx:115
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: untbl.cxx:678
sal_Unicode m_cSeparator
Definition: UndoTable.hxx:117
std::unique_ptr< SwDDEFieldType > m_pDDEFieldType
Definition: UndoTable.hxx:112
void AddBoxPos(SwDoc &rDoc, SwNodeOffset nNdIdx, SwNodeOffset nEndIdx, sal_Int32 nContentIdx=SAL_MAX_INT32)
Definition: untbl.cxx:700
SwNodeOffset m_nEndNode
Definition: UndoTable.hxx:116
virtual ~SwUndoTableToText() override
Definition: untbl.cxx:452
OUString m_sTableName
Definition: UndoTable.hxx:111
SwNodeOffset m_nStartNode
Definition: UndoTable.hxx:116
std::unique_ptr< SaveTable > m_pTableSave
Definition: UndoTable.hxx:113
SwTableToTextSaves m_vBoxSaves
Definition: UndoTable.hxx:114
SwUndoTableToText(const SwTable &rTable, sal_Unicode cCh)
Definition: untbl.cxx:412
void SetRange(const SwNodeRange &)
Definition: untbl.cxx:694
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:460
sal_uInt16 m_nHeadlineRepeat
Definition: UndoTable.hxx:118
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:645
void AddFillBox(const SwTableBox &rBox)
Definition: untbl.cxx:825
SwHistory * m_pHistory
Definition: UndoTable.hxx:89
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:727
sal_Unicode m_cSeparator
Definition: UndoTable.hxx:90
sal_uInt16 m_nAdjust
Definition: UndoTable.hxx:91
std::vector< SwNodeOffset > mvDelBoxes
Definition: UndoTable.hxx:87
SwUndoTextToTable(const SwPaM &, const SwInsertTableOptions &, sal_Unicode, sal_uInt16, const SwTableAutoFormat *pAFormat)
Definition: untbl.cxx:705
std::unique_ptr< SwTableAutoFormat > m_pAutoFormat
Definition: UndoTable.hxx:88
OUString m_sTableName
Definition: UndoTable.hxx:85
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: untbl.cxx:814
SwInsertTableOptions m_aInsertTableOpts
Definition: UndoTable.hxx:86
virtual ~SwUndoTextToTable() override
Definition: untbl.cxx:722
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: untbl.cxx:803
SwHistory & GetHistory()
Definition: untbl.cxx:830
void SetRedlineFlags(RedlineFlags eMode)
Definition: undobj.hxx:121
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:120
static void RemoveIdxRel(SwNodeOffset, const SwPosition &)
Definition: undobj.cxx:144
static void RemoveIdxFromRange(SwPaM &rPam, bool bMoveNext)
Definition: undobj.cxx:118
bool IsDelBox() const
Definition: undobj.cxx:172
SwUndoId GetId() const
Definition: undobj.hxx:102
static void RemoveIdxFromSection(SwDoc &, SwNodeOffset nSttIdx, const SwNodeOffset *pEndIdx=nullptr)
Definition: undobj.cxx:108
iterator begin()
Definition: docary.hxx:88
iterator insert(iterator aIt, Value const &rVal)
Definition: docary.hxx:95
void push_back(Value const &rVal)
Definition: docary.hxx:101
void DeRegister()
deregister the currently registered History
Definition: ndhints.hxx:197
size_t Count() const
Definition: ndhints.hxx:142
bool empty() const
size_type size() const
std::pair< const_iterator, bool > insert(Value &&x)
void RestoreMetadata(std::shared_ptr< MetadatableUndo > const &i_pUndo)
std::shared_ptr< MetadatableUndo > CreateUndo() const
void InvalidateInSwCache(const sal_uInt16)
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:325
virtual SwCursor & GetCurrentShellCursor()=0
virtual SwCursor & CreateNewShellCursor()=0
SwDoc & GetDoc() const
Definition: UndoCore.hxx:132
SwPaM & GetRepeatPaM()
Definition: UndoCore.hxx:134
SwDoc & GetDoc() const
Definition: UndoCore.hxx:95
IShellCursorSupplier & GetCursorSupplier()
Definition: UndoCore.hxx:97
static std::shared_ptr< ContentIdxStore > Create()
virtual OUString GetName() const override
void PaMCorrAbs(const SwPaM &rRange, const SwPosition &rNewPos)
Function declarations so that everything below the CursorShell can move the Cursor once in a while.
Definition: doccorr.cxx:88
OUString m_sName
void ClearFEShellTabCols(SwDoc &rDoc, SwTabFrame const *const pFrame)
Definition: fetab.cxx:2193
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
constexpr TypedWhichId< SvxCrossedOutItem > RES_CHRATR_CROSSEDOUT(5)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
constexpr TypedWhichId< SvxShadowedItem > RES_CHRATR_SHADOWED(13)
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(152)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
constexpr TypedWhichId< SwTableBoxFormula > RES_BOXATR_FORMULA(151)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(163)
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:157
@ TBL_BOXPTR
Definition: hints.hxx:256
@ TBL_BOXNAME
Definition: hints.hxx:255
const sal_uInt16 idx[]
WhichRangesContainer const aTableSetRange(svl::Items< RES_FILL_ORDER, RES_FRM_SIZE, RES_LR_SPACE, RES_BREAK, RES_HORI_ORIENT, RES_HORI_ORIENT, RES_BACKGROUND, RES_SHADOW, RES_KEEP, RES_KEEP, RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT, RES_FRAMEDIR, RES_FRAMEDIR, RES_COLLAPSING_BORDERS, RES_COLLAPSING_BORDERS, RES_FRMATR_GRABBAG, RES_FRMATR_GRABBAG, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1 >)
WhichRangesContainer const aTableLineSetRange(svl::Items< RES_FILL_ORDER, RES_FRM_SIZE, RES_LR_SPACE, RES_UL_SPACE, RES_PRINT, RES_PRINT, RES_PROTECT, RES_PROTECT, RES_VERT_ORIENT, RES_VERT_ORIENT, RES_BACKGROUND, RES_SHADOW, RES_ROW_SPLIT, RES_ROW_SPLIT, RES_FRMATR_GRABBAG, RES_FRMATR_GRABBAG, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1 >)
WhichRangesContainer const aTableBoxSetRange(svl::Items< RES_FILL_ORDER, RES_FRM_SIZE, RES_LR_SPACE, RES_UL_SPACE, RES_PROTECT, RES_PROTECT, RES_VERT_ORIENT, RES_VERT_ORIENT, RES_BACKGROUND, RES_SHADOW, RES_FRAMEDIR, RES_FRAMEDIR, RES_FRMATR_GRABBAG, RES_FRMATR_GRABBAG, RES_BOXATR_BEGIN, RES_BOXATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1 >)
OUString aName
Mode eMode
sal_Int64 n
sal_Int16 m_nCount
#define SAL_WARN(area, stream)
size
int i
index
static constexpr auto Items
RestoreMode
Definition: mvsave.hxx:73
void NotifyTableCollapsedParagraph(const SwContentNode *const pNode, SwCursorShell *const pShell)
An empty paragraph inside a table with a nested table preceding it should be hidden,...
Definition: callnk.cxx:73
long Long
std::vector< std::unique_ptr< SwTableToTextSave > > SwTableToTextSaves
Definition: ndarr.hxx:87
@ SwTableBoxStartNode
Definition: ndtyp.hxx:53
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32)
bool GoInContent(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:1142
SwMoveFnCollection const & fnTableStart
Definition: paminit.cxx:52
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:59
@ RES_POOLCOLL_STANDARD
Standard.
Definition: poolfmt.hxx:250
Marks a position in the document model.
Definition: pam.hxx:37
void Adjust(SwNodeOffset nDelta)
Adjust node position, and resets content position to zero.
Definition: pam.cxx:256
SwNode & GetNode() const
Definition: pam.hxx:80
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:230
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:266
SwNodeOffset GetNodeIndex() const
Definition: pam.hxx:77
sal_Int32 GetContentIndex() const
Definition: pam.hxx:84
SwContentIndex nContent
Definition: pam.hxx:39
std::unique_ptr< SwHistory > m_pHstry
Definition: untbl.cxx:214
sal_Int32 m_nContent
Definition: untbl.cxx:213
SwNodeOffset m_nEndNd
Definition: untbl.cxx:212
std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd
Definition: untbl.cxx:217
std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart
Definition: untbl.cxx:216
SwTableToTextSave & operator=(const SwTableToTextSave &)=delete
SwTableToTextSave(SwDoc &rDoc, SwNodeOffset nNd, SwNodeOffset nEndIdx, sal_Int32 nContent)
Definition: untbl.cxx:371
SwTableToTextSave(const SwTableToTextSave &)=delete
SwNodeOffset m_nSttNd
Definition: untbl.cxx:211
Definition: untbl.cxx:87
UndoTableCpyTable_Entry(const SwTableBox &rBox)
Definition: untbl.cxx:2311
SwNodeOffset nOffset
Definition: untbl.cxx:88
bool bJoin
Definition: untbl.cxx:93
std::unique_ptr< SwUndo > pUndo
Definition: untbl.cxx:90
std::unique_ptr< SfxItemSet > pBoxNumAttr
Definition: untbl.cxx:89
SwNodeOffset nBoxIdx
Definition: untbl.cxx:88
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: untbl.cxx:2317
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:164
std::vector< SwTableBox * > SwTableBoxes
Definition: swtable.hxx:105
SwUndoId
Definition: swundo.hxx:30
@ TBLSTYLE_UPDATE
@ TBLSTYLE_CREATE
@ TBLSTYLE_DELETE
SplitTable_HeadlineOption
Definition: tblenum.hxx:55
void DeleteBox_(SwTable &rTable, SwTableBox *pBox, SwUndo *pUndo, bool bCalcNewSize, const bool bCorrBorder, SwShareBoxFormats *pShareFormats)
Definition: tblrwcl.cxx:669
bool GotoPrevTable(SwPaM &rCurrentCursor, SwMoveFnCollection const &fnPosTable, bool bInReadOnly)
Definition: trvltbl.cxx:481
#define SAL_MAX_INT32
sal_uInt16 sal_Unicode
static void CheckTable(const SwTable &)
Definition: untbl.cxx:3083
static SwTableLine * lcl_FindTableLine(const SwTable &rTable, const SwTableBox &rBox)
Definition: untbl.cxx:1528
WhichRangesContainer const aSave_BoxContentSet(svl::Items< RES_CHRATR_COLOR, RES_CHRATR_CROSSEDOUT, RES_CHRATR_FONT, RES_CHRATR_FONTSIZE, RES_CHRATR_POSTURE, RES_CHRATR_POSTURE, RES_CHRATR_SHADOWED, RES_CHRATR_WEIGHT, RES_PARATR_ADJUST, RES_PARATR_ADJUST >)
#define CHECKTABLE(t)
Definition: untbl.cxx:198
#define DEBUG_REDLINE(pDoc)
Definition: untbl.cxx:79
void InsertSort(std::vector< sal_uInt16 > &rArr, sal_uInt16 nIdx)
Definition: untbl.cxx:3056
#define CHECK_TABLE(t)
Definition: untbl.cxx:73
std::vector< std::shared_ptr< SfxItemSet > > SfxItemSets
Definition: untbl.cxx:84
static const SwTableLines & lcl_FindParentLines(const SwTable &rTable, const SwTableBox &rBox)
Definition: untbl.cxx:1543
std::pair< sal_uInt16, sal_uInt16 > WhichPair