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