LibreOffice Module sw (master) 1
unattr.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 <sal/config.h>
21
22#include <utility>
23
24#include <UndoAttribute.hxx>
25#include <svl/itemiter.hxx>
26#include <editeng/tstpitem.hxx>
27#include <svx/svdobj.hxx>
28#include <osl/diagnose.h>
29#include <hintids.hxx>
30#include <fmtflcnt.hxx>
31#include <txtftn.hxx>
32#include <fmtanchr.hxx>
33#include <fmtfsize.hxx>
34#include <frmfmt.hxx>
35#include <fmtcntnt.hxx>
36#include <ftnidx.hxx>
37#include <doc.hxx>
40#include <IDocumentState.hxx>
41#include <IDocumentUndoRedo.hxx>
43#include <docary.hxx>
44#include <swcrsr.hxx>
45#include <swundo.hxx>
46#include <pam.hxx>
47#include <ndtxt.hxx>
48#include <swtable.hxx>
49#include <swtblfmt.hxx>
50#include <UndoCore.hxx>
51#include <hints.hxx>
52#include <rolbck.hxx>
53#include <ndnotxt.hxx>
54#include <ftninfo.hxx>
55#include <redline.hxx>
56#include <section.hxx>
57#include <charfmt.hxx>
58#include <calbck.hxx>
59#include <frameformats.hxx>
60#include <editsh.hxx>
61
63 : SwClient(&rFormat)
64 , m_rFormat(rFormat)
65 , m_bSaveDrawPt(bSvDrwPt)
66{
67}
68
70{
71 if (rHint.GetId() != SfxHintId::SwLegacyModify)
72 return;
73 auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
74 if(!pLegacy->m_pOld)
75 return;
76 assert(pLegacy->m_pOld->Which() != RES_OBJECTDYING);
77 if(!pLegacy->m_pNew)
78 return;
79 const SwDoc& rDoc = *m_rFormat.GetDoc();
80 auto pOld = pLegacy->m_pOld;
81 if(POOLATTR_END >= pLegacy->m_pOld->Which()) {
82 if(!GetUndo())
84 else
85 m_pUndo->PutAttr(*pOld, rDoc);
86 } else if(RES_ATTRSET_CHG == pOld->Which()) {
87 auto& rChgSet = *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet();
88 if(!GetUndo())
90 else {
91 SfxItemIter aIter(rChgSet);
92 for(auto pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
93 m_pUndo->PutAttr(*pItem, rDoc);
94 }
95 }
96}
97
99 : doc(format.GetName().isEmpty() ? nullptr : format.GetDoc())
100 , helper(doc ? new SwUndoFormatAttrHelper(format) : nullptr)
101{
102}
103
105{
106 if (helper && helper->GetUndo())
107 {
108 // helper tracks changes, even when DoesUndo is false, to detect modified state
109 if (doc->GetIDocumentUndoRedo().DoesUndo())
110 doc->GetIDocumentUndoRedo().AppendUndo(helper->ReleaseUndo());
111
113 }
114}
115
117 SwFormat& rChgFormat,
118 bool bSaveDrawPt )
119 : SwUndo( SwUndoId::INSFMTATTR, rChgFormat.GetDoc() )
120 , m_sFormatName ( rChgFormat.GetName() )
121 // #i56253#
122 , m_oOldSet( std::move( rOldSet ) )
123 , m_nAnchorContentOffset( 0 )
124 , m_nNodeIndex( 0 )
125 , m_nFormatWhich( rChgFormat.Which() )
126 , m_bSaveDrawPt( bSaveDrawPt )
127{
128 assert(m_sFormatName.getLength());
129
130 Init( rChgFormat );
131}
132
134 bool bSaveDrawPt )
135 : SwUndo( SwUndoId::INSFMTATTR, rChgFormat.GetDoc() )
136 , m_sFormatName(rChgFormat.GetName())
137 , m_oOldSet( rChgFormat.GetAttrSet().CloneAsValue( false ) )
138 , m_nAnchorContentOffset( 0 )
139 , m_nNodeIndex( 0 )
140 , m_nFormatWhich( rChgFormat.Which() )
141 , m_bSaveDrawPt( bSaveDrawPt )
142{
143 assert(m_sFormatName.getLength());
144
145 m_oOldSet->Put( rItem );
146 Init( rChgFormat );
147}
148
149void SwUndoFormatAttr::Init( const SwFormat & rFormat )
150{
151 // tdf#126017 never save SwNodeIndex, it will go stale
152 m_oOldSet->ClearItem(RES_CNTNT);
153 // treat change of anchor specially
154 if ( SfxItemState::SET == m_oOldSet->GetItemState( RES_ANCHOR, false )) {
155 SaveFlyAnchor( &rFormat, m_bSaveDrawPt );
156 } else if ( RES_FRMFMT == m_nFormatWhich ) {
157 const SwDoc* pDoc = rFormat.GetDoc();
158 auto pTableFormat = dynamic_cast<const SwTableFormat*>(&rFormat);
159 if (pTableFormat && pDoc->GetTableFrameFormats()->ContainsFormat(const_cast<SwTableFormat*>(pTableFormat)))
160 {
161 // Table Format: save table position, table formats are volatile!
162 SwTable * pTable = SwIterator<SwTable,SwFormat>( rFormat ).First();
163 if ( pTable ) {
164 m_nNodeIndex = pTable->GetTabSortBoxes()[ 0 ]->GetSttNd()
165 ->FindTableNode()->GetIndex();
166 }
167 } else if (dynamic_cast<const SwSectionFormat*>(&rFormat)) {
168 if (auto pContentIndex = rFormat.GetContent().GetContentIdx())
169 m_nNodeIndex = pContentIndex->GetIndex();
170 } else if(auto pBoxFormat = dynamic_cast<const SwTableBoxFormat*>(&rFormat))
171 {
172 auto pTableBox = pBoxFormat->GetTableBox();
173 if(pTableBox)
174 m_nNodeIndex = pTableBox->GetSttIdx();
175 }
176 }
177}
178
180{
181}
182
184{
185 // OD 2004-10-26 #i35443#
186 // Important note: <Undo(..)> also called by <ReDo(..)>
187
188 if (!m_oOldSet)
189 return;
190
191 SwFormat * pFormat = GetFormat(rContext.GetDoc());
192 if (!pFormat)
193 return;
194
195 // #i35443# - If anchor attribute has been successful
196 // restored, all other attributes are also restored.
197 // Thus, keep track of its restoration
198 bool bAnchorAttrRestored( false );
199 if ( SfxItemState::SET == m_oOldSet->GetItemState( RES_ANCHOR, false )) {
200 bAnchorAttrRestored = RestoreFlyAnchor(rContext);
201 if ( bAnchorAttrRestored ) {
202 // Anchor attribute successful restored.
203 // Thus, keep anchor position for redo
204 SaveFlyAnchor(pFormat);
205 } else {
206 // Anchor attribute not restored due to invalid anchor position.
207 // Thus, delete anchor attribute.
208 m_oOldSet->ClearItem( RES_ANCHOR );
209 }
210 }
211
212 if ( bAnchorAttrRestored ) return;
213
214 SwUndoFormatAttrHelper aTmp( *pFormat, m_bSaveDrawPt );
215 pFormat->SetFormatAttr( *m_oOldSet );
216 if ( aTmp.GetUndo() ) {
217 // transfer ownership of helper object's old set
218 if (aTmp.GetUndo()->m_oOldSet)
219 m_oOldSet.emplace(std::move(*aTmp.GetUndo()->m_oOldSet));
220 else
221 m_oOldSet.reset();
222 } else {
223 m_oOldSet->ClearItem();
224 }
225
227 rContext.SetSelections(static_cast<SwFrameFormat*>(pFormat), nullptr);
228 }
229}
230
231// Check if it is still in Doc
233{
234 switch (m_nFormatWhich)
235 {
236 case RES_TXTFMTCOLL:
239
240 case RES_GRFFMTCOLL:
242
243 case RES_CHRFMT:
245
246 case RES_FRMFMT:
247 if (m_nNodeIndex && (m_nNodeIndex < rDoc.GetNodes().Count()))
248 {
249 SwNode* pNd = rDoc.GetNodes()[m_nNodeIndex];
250 if (pNd->IsTableNode())
251 {
252 return static_cast<SwTableNode*>(pNd)->GetTable().GetFrameFormat();
253 }
254 else if (pNd->IsSectionNode())
255 {
256 return static_cast<SwSectionNode*>(pNd)->GetSection().GetFormat();
257 }
258 else if (pNd->IsStartNode() && (SwTableBoxStartNode ==
259 static_cast<SwStartNode*>(pNd)->GetStartNodeType()))
260 {
261 SwTableNode* pTableNode = pNd->FindTableNode();
262 if (pTableNode)
263 {
264 SwTableBox* pBox = pTableNode->GetTable().GetTableBox(m_nNodeIndex);
265 if (pBox)
266 {
267 return pBox->GetFrameFormat();
268 }
269 }
270 }
271 }
272 [[fallthrough]];
273 case RES_DRAWFRMFMT:
274 case RES_FLYFRMFMT:
275 {
276 auto it = rDoc.GetSpzFrameFormats()->findByTypeAndName( m_nFormatWhich, m_sFormatName );
277 if( it != rDoc.GetSpzFrameFormats()->typeAndNameEnd() )
278 return *it;
279 SwFormat* pFormat = rDoc.GetFrameFormats()->FindFormatByName(m_sFormatName);
280 if (pFormat)
281 return pFormat;
282 }
283 break;
284 }
285
286 return nullptr;
287}
288
290{
291 // #i35443# - Because the undo stores the attributes for
292 // redo, the same code as for <Undo(..)> can be applied for <Redo(..)>
293 UndoImpl(rContext);
294}
295
297{
298 if (!m_oOldSet)
299 return;
300
301 SwDoc & rDoc(rContext.GetDoc());
302
303 SwFormat * pFormat = GetFormat(rDoc);
304 if (!pFormat)
305 return;
306
307 switch ( m_nFormatWhich ) {
308 case RES_GRFFMTCOLL: {
309 SwNoTextNode *const pNd =
311 if( pNd ) {
312 rDoc.SetAttr( pFormat->GetAttrSet(), *pNd->GetFormatColl() );
313 }
314 }
315 break;
316
317 case RES_TXTFMTCOLL:
319 {
320 SwTextNode *const pNd =
322 if( pNd ) {
323 rDoc.SetAttr( pFormat->GetAttrSet(), *pNd->GetFormatColl() );
324 }
325 }
326 break;
327
328 case RES_FLYFRMFMT: {
329 // Check if the cursor is in a flying frame
330 // Steps: search in all FlyFrameFormats for the FlyContent attribute
331 // and validate if the cursor is in the respective section
332 SwFrameFormat *const pFly =
334 if( pFly ) {
335 // Bug 43672: do not set all attributes!
336 if (SfxItemState::SET ==
337 pFormat->GetAttrSet().GetItemState( RES_CNTNT )) {
338 SfxItemSet aTmpSet( pFormat->GetAttrSet() );
339 aTmpSet.ClearItem( RES_CNTNT );
340 if( aTmpSet.Count() ) {
341 rDoc.SetAttr( aTmpSet, *pFly );
342 }
343 } else {
344 rDoc.SetAttr( pFormat->GetAttrSet(), *pFly );
345 }
346 }
347 break;
348 }
349 }
350}
351
353{
354 SwRewriter aRewriter;
355
356 aRewriter.AddRule(UndoArg1, m_sFormatName);
357
358 return aRewriter;
359}
360
361void SwUndoFormatAttr::PutAttr( const SfxPoolItem& rItem, const SwDoc& rDoc )
362{
363 if (RES_CNTNT == rItem.Which())
364 {
365 return; // tdf#126017 never save SwNodeIndex, it will go stale
366 }
367 m_oOldSet->Put( rItem );
368 if ( RES_ANCHOR == rItem.Which() )
369 {
370 SwFormat * pFormat = GetFormat( rDoc );
371 SaveFlyAnchor( pFormat, m_bSaveDrawPt );
372 }
373}
374
375void SwUndoFormatAttr::SaveFlyAnchor( const SwFormat * pFormat, bool bSvDrwPt )
376{
377 // Format is valid, otherwise you would not reach this point here
378 if( bSvDrwPt ) {
379 if ( RES_DRAWFRMFMT == pFormat->Which() ) {
380 Point aPt( static_cast<const SwFrameFormat*>(pFormat)->FindSdrObject()
381 ->GetRelativePos() );
382 // store old value as attribute, to keep SwUndoFormatAttr small
383 m_oOldSet->Put( SwFormatFrameSize( SwFrameSize::Variable, aPt.X(), aPt.Y() ) );
384 }
385 }
386
387 const SwFormatAnchor& rAnchor =
388 m_oOldSet->Get( RES_ANCHOR, false );
389 if( !rAnchor.GetAnchorNode() || rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
390 return;
391
392 switch( rAnchor.GetAnchorId() ) {
393 case RndStdIds::FLY_AS_CHAR:
394 case RndStdIds::FLY_AT_CHAR:
396 [[fallthrough]];
397 case RndStdIds::FLY_AT_PARA:
398 case RndStdIds::FLY_AT_FLY:
399 m_nNodeIndex = rAnchor.GetAnchorNode()->GetIndex();
400 break;
401 default:
402 assert(false);
403 }
404
405 SwFormatAnchor aAnchor( rAnchor.GetAnchorId(), 0 );
406 m_oOldSet->Put( aAnchor );
407}
408
409// #i35443# - Add return value, type <bool>.
410// Return value indicates, if anchor attribute is restored.
411// Note: If anchor attribute is restored, all other existing attributes
412// are also restored.
414{
415 SwDoc *const pDoc = & rContext.GetDoc();
416 SwFrameFormat* pFrameFormat = static_cast<SwFrameFormat*>( GetFormat( *pDoc ) );
417 const SwFormatAnchor& rAnchor =
418 m_oOldSet->Get( RES_ANCHOR, false );
419
420 SwFormatAnchor aNewAnchor( rAnchor.GetAnchorId() );
421 if (RndStdIds::FLY_AT_PAGE != rAnchor.GetAnchorId()) {
422 SwNode* pNd = pDoc->GetNodes()[ m_nNodeIndex ];
423
424 if ( (RndStdIds::FLY_AT_FLY == rAnchor.GetAnchorId())
425 ? ( !pNd->IsStartNode() || (SwFlyStartNode !=
426 static_cast<SwStartNode*>(pNd)->GetStartNodeType()) )
427 : !pNd->IsTextNode() ) {
428 // #i35443# - invalid position.
429 // Thus, anchor attribute not restored
430 return false;
431 }
432
433 SwPosition aPos( *pNd );
434 if ((RndStdIds::FLY_AS_CHAR == rAnchor.GetAnchorId()) ||
435 (RndStdIds::FLY_AT_CHAR == rAnchor.GetAnchorId())) {
437 if ( aPos.GetContentIndex() > pNd->GetTextNode()->GetText().getLength()) {
438 // #i35443# - invalid position.
439 // Thus, anchor attribute not restored
440 return false;
441 }
442 }
443 aNewAnchor.SetAnchor( &aPos );
444 } else
445 aNewAnchor.SetPageNum( rAnchor.GetPageNum() );
446
447 Point aDrawSavePt, aDrawOldPt;
449 if( RES_DRAWFRMFMT == pFrameFormat->Which() ) {
450 // get the old cached value
451 const SwFormatFrameSize& rOldSize = m_oOldSet->Get( RES_FRM_SIZE );
452 aDrawSavePt.setX( rOldSize.GetWidth() );
453 aDrawSavePt.setY( rOldSize.GetHeight() );
454 m_oOldSet->ClearItem( RES_FRM_SIZE );
455
456 // write the current value into cache
457 aDrawOldPt = pFrameFormat->FindSdrObject()->GetRelativePos();
458 } else {
459 pFrameFormat->DelFrames(); // delete Frames
460 }
461 }
462
463 const SwFormatAnchor &rOldAnch = pFrameFormat->GetAnchor();
464 // #i54336#
465 // Consider case, that as-character anchored object has moved its anchor position.
466 if (RndStdIds::FLY_AS_CHAR == rOldAnch.GetAnchorId()) {
467 // With InContents it's tricky: the text attribute needs to be deleted.
468 // Unfortunately, this not only destroys the Frames but also the format.
469 // To prevent that, first detach the connection between attribute and
470 // format.
471 SwTextNode *pTextNode = static_cast<SwTextNode*>(rOldAnch.GetAnchorNode());
472 OSL_ENSURE( pTextNode->HasHints(), "Missing FlyInCnt-Hint." );
473 const sal_Int32 nIdx = rOldAnch.GetAnchorContentOffset();
474 SwTextAttr * const pHint =
475 pTextNode->GetTextAttrForCharAt( nIdx, RES_TXTATR_FLYCNT );
476 assert(pHint && "Missing Hint.");
477 OSL_ENSURE( pHint->Which() == RES_TXTATR_FLYCNT,
478 "Missing FlyInCnt-Hint." );
479 OSL_ENSURE( pHint->GetFlyCnt().GetFrameFormat() == pFrameFormat,
480 "Wrong TextFlyCnt-Hint." );
481 const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt()).SetFlyFormat();
482
483 // Connection is now detached, therefore the attribute can be deleted
484 pTextNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
485 }
486
487 {
488 m_oOldSet->Put( aNewAnchor );
489 SwUndoFormatAttrHelper aTmp( *pFrameFormat, m_bSaveDrawPt );
490 pFrameFormat->SetFormatAttr( *m_oOldSet );
491 if ( aTmp.GetUndo() ) {
493 // transfer ownership of helper object's old set
494 if (aTmp.GetUndo()->m_oOldSet)
495 m_oOldSet.emplace(std::move(*aTmp.GetUndo()->m_oOldSet));
496 else
497 m_oOldSet.reset();
498 } else {
499 m_oOldSet->ClearItem();
500 }
501 }
502
503 if ( RES_DRAWFRMFMT == pFrameFormat->Which() )
504 {
505 // The Draw model also prepared an Undo object for its right positioning
506 // which unfortunately is relative. Therefore block here a position
507 // change of the Contact object by setting the anchor.
508 pFrameFormat->CallSwClientNotify(sw::RestoreFlyAnchorHint(aDrawSavePt));
509 // cache the old value again
510 m_oOldSet->Put(SwFormatFrameSize(SwFrameSize::Variable, aDrawOldPt.X(), aDrawOldPt.Y()));
511 }
512
513 if (RndStdIds::FLY_AS_CHAR == aNewAnchor.GetAnchorId()) {
514 SwTextNode* pTextNd = aNewAnchor.GetAnchorNode()->GetTextNode();
515 OSL_ENSURE( pTextNd, "no Text Node at position." );
516 SwFormatFlyCnt aFormat( pFrameFormat );
517 pTextNd->InsertItem( aFormat, aNewAnchor.GetAnchorContentOffset(), 0 );
518 }
519
520 if (RES_DRAWFRMFMT != pFrameFormat->Which())
521 pFrameFormat->MakeFrames();
522 else
523 {
525 }
526
527 rContext.SetSelections(pFrameFormat, nullptr);
528
529 // #i35443# - anchor attribute restored.
530 return true;
531}
532
534 const sal_uInt16 nWhichId )
535 : SwUndo( SwUndoId::RESETATTR, rChangedFormat.GetDoc() )
536 , m_pChangedFormat( &rChangedFormat )
537 , m_nWhichId( nWhichId )
538{
539 const SfxPoolItem* pItem = nullptr;
540 if (rChangedFormat.GetItemState(nWhichId, false, &pItem ) == SfxItemState::SET && pItem) {
541 m_pOldItem.reset( pItem->Clone() );
542 }
543}
544
546{
547}
548
550{
551 if (m_pOldItem)
552 {
554 }
555}
556
558{
559 if (m_pOldItem)
560 {
562 }
563}
564
565SwUndoResetAttr::SwUndoResetAttr( const SwPaM& rRange, sal_uInt16 nFormatId )
566 : SwUndo( SwUndoId::RESETATTR, &rRange.GetDoc() ), SwUndRng( rRange )
567 , m_pHistory( new SwHistory )
568 , m_nFormatId( nFormatId )
569{
570}
571
572SwUndoResetAttr::SwUndoResetAttr( const SwPosition& rPos, sal_uInt16 nFormatId )
573 : SwUndo( SwUndoId::RESETATTR, &rPos.GetDoc() )
574 , m_pHistory( new SwHistory )
575 , m_nFormatId( nFormatId )
576{
579}
580
582{
583}
584
586{
587 // reset old values
588 SwDoc & rDoc = rContext.GetDoc();
589 m_pHistory->TmpRollback( &rDoc, 0 );
590 m_pHistory->SetTmpEnd( m_pHistory->Count() );
591
594 SwTextNode* pTNd = rDoc.GetNodes()[ m_nSttNode ]->GetTextNode();
595 if( pTNd )
596 pTNd->DontExpandFormat( m_nSttContent, false );
597 }
599 {
600 rDoc.GetEditShell()->SwViewShell::UpdateFields();
601 }
602
603 AddUndoRedoPaM(rContext);
604}
605
607{
608 SwDoc & rDoc = rContext.GetDoc();
609 SwPaM & rPam = AddUndoRedoPaM(rContext);
610
611 switch ( m_nFormatId ) {
612 case RES_CHRFMT:
613 rDoc.RstTextAttrs(rPam);
614 break;
615 case RES_TXTFMTCOLL:
616 rDoc.ResetAttrs(rPam, false, m_Ids );
617 break;
619 rDoc.ResetAttrs(rPam, true, m_Ids );
620
621 break;
623 // special treatment for TOXMarks
624 {
626 SwNodeIndex aIdx( rDoc.GetNodes(), m_nSttNode );
627 SwPosition aPos( aIdx, aIdx.GetNode().GetContentNode(), m_nSttContent );
628
629 sal_uInt16 nCnt = SwDoc::GetCurTOXMark( aPos, aArr );
630 if( nCnt ) {
631 if( 1 < nCnt ) {
632 // search for the right one
633 SwHistoryHint* pHHint = (GetHistory())[ 0 ];
634 if( pHHint && HSTRY_SETTOXMARKHNT == pHHint->Which() ) {
635 while( nCnt ) {
636 if ( static_cast<SwHistorySetTOXMark*>(pHHint)
637 ->IsEqual( *aArr[ --nCnt ] ) ) {
638 ++nCnt;
639 break;
640 }
641 }
642 } else
643 nCnt = 0;
644 }
645 // found one, thus delete it
646 if( nCnt-- ) {
647 rDoc.DeleteTOXMark( aArr[ nCnt ] );
648 }
649 }
650 }
651 break;
653 {
655 SwHistoryHint* pHistoryHint = GetHistory()[0];
656 if (pHistoryHint && HSTRY_SETREFMARKHNT == pHistoryHint->Which())
657 {
658 for (const SfxPoolItem* pItem : aRange)
659 {
660 assert(dynamic_cast<const SwFormatRefMark*>(pItem));
661 const auto pFormatRefMark = static_cast<const SwFormatRefMark*>(pItem);
662 if (static_cast<SwHistorySetRefMark*>(pHistoryHint)->GetRefName() ==
663 pFormatRefMark->GetRefName())
664 {
665 rDoc.DeleteFormatRefMark(pFormatRefMark);
666 rDoc.GetEditShell()->SwViewShell::UpdateFields();
667 break;
668 }
669 }
670 }
671 }
672 break;
673 }
674}
675
677{
679 return;
680 }
681
682 switch ( m_nFormatId ) {
683 case RES_CHRFMT:
684 rContext.GetDoc().RstTextAttrs(rContext.GetRepeatPaM());
685 break;
686 case RES_TXTFMTCOLL:
687 rContext.GetDoc().ResetAttrs(rContext.GetRepeatPaM(), false, m_Ids);
688 break;
690 rContext.GetDoc().ResetAttrs(rContext.GetRepeatPaM(), true, m_Ids);
691 break;
692 }
693}
694
696{
697 m_Ids = std::move(rAttrs);
698}
699
700SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxPoolItem& rAttr,
701 const SetAttrMode nFlags )
702 : SwUndo( SwUndoId::INSATTR, &rRange.GetDoc() ), SwUndRng( rRange )
703 , m_AttrSet( rRange.GetDoc().GetAttrPool(), rAttr.Which(), rAttr.Which() )
704 , m_pHistory( new SwHistory )
705 , m_nNodeIndex( NODE_OFFSET_MAX )
706 , m_nInsertFlags( nFlags )
707{
708 m_AttrSet.Put( rAttr );
709
710 // Save character style as a style name, not as a reference
712 if (pItem)
713 {
714 uno::Any aValue;
715 pItem->QueryValue(aValue, RES_TXTATR_CHARFMT);
716 aValue >>= m_aChrFormatName;
717 }
718}
719
721 const SetAttrMode nFlags )
722 : SwUndo( SwUndoId::INSATTR, &rRange.GetDoc() ), SwUndRng( rRange )
723 , m_AttrSet(std::move( aSet ))
724 , m_pHistory( new SwHistory )
725 , m_nNodeIndex( NODE_OFFSET_MAX )
726 , m_nInsertFlags( nFlags )
727{
728 // Save character style as a style name, not as a reference
730 if (pItem)
731 {
732 uno::Any aValue;
733 pItem->QueryValue(aValue, RES_TXTATR_CHARFMT);
734 aValue >>= m_aChrFormatName;
735 }
736}
737
739{
740}
741
742void SwUndoAttr::SaveRedlineData( const SwPaM& rPam, bool bIsContent )
743{
744 SwDoc& rDoc = rPam.GetDoc();
745 if ( rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) {
746 m_pRedlineData.reset( new SwRedlineData( bIsContent
747 ? RedlineType::Insert
748 : RedlineType::Format,
750 }
751
754 m_pRedlineSaveData.reset();
755
757 if ( bIsContent ) {
759 }
760}
761
763{
764 SwDoc *const pDoc = & rContext.GetDoc();
765
766 RemoveIdx( *pDoc );
767
769 SwPaM aPam(pDoc->GetNodes().GetEndOfContent());
770 if ( NODE_OFFSET_MAX != m_nNodeIndex ) {
771 aPam.DeleteMark();
773 aPam.SetMark();
774 aPam.GetPoint()->AdjustContent(+1);
775 pDoc->getIDocumentRedlineAccess().DeleteRedline(aPam, false, RedlineType::Any);
776 } else {
777 // remove all format redlines, will be recreated if needed
778 SetPaM(aPam);
779 pDoc->getIDocumentRedlineAccess().DeleteRedline(aPam, false, RedlineType::Format);
781 {
783 }
784 }
785 }
786
787 const bool bToLast = (1 == m_AttrSet.Count())
788 && (RES_TXTATR_FIELD <= m_AttrSet.GetRanges()[0].first)
789 && (m_AttrSet.GetRanges()[0].first <= RES_TXTATR_ANNOTATION);
790
791 // restore old values
792 m_pHistory->TmpRollback( pDoc, 0, !bToLast );
793 m_pHistory->SetTmpEnd( m_pHistory->Count() );
794
795 // set cursor onto Undo area
797 AddUndoRedoPaM(rContext);
798}
799
801{
802 // RefMarks are not repeat capable
803 if ( SfxItemState::SET != m_AttrSet.GetItemState( RES_TXTATR_REFMARK, false ) ) {
806 } else if ( 1 < m_AttrSet.Count() ) {
807 SfxItemSet aTmpSet( m_AttrSet );
808 aTmpSet.ClearItem( RES_TXTATR_REFMARK );
810 aTmpSet, m_nInsertFlags );
811 }
812}
813
815{
816 SwDoc & rDoc = rContext.GetDoc();
817
818 // Restore pointer to char format from name
819 if (!m_aChrFormatName.isEmpty())
820 {
822 if (pCharFormat)
823 {
824 SwFormatCharFormat aFormat(pCharFormat);
825 m_AttrSet.Put(aFormat);
826 }
827 }
828
829 if ( m_pRedlineData &&
834
835 if ( NODE_OFFSET_MAX != m_nNodeIndex ) {
836 rPam.SetMark();
837 if ( rPam.Move( fnMoveBackward ) ) {
839 true);
840 }
841 rPam.DeleteMark();
842 } else {
844 }
845
847 } else {
849 }
850}
851
853{
855 {
856 SwPaM aPam(rContext.GetDoc().GetNodes().GetEndOfContent());
857 SetPaM(aPam, false);
858 redoAttribute(aPam, rContext);
859 }
860 else
861 {
862 SwPaM& rPam = AddUndoRedoPaM(rContext);
863 redoAttribute(rPam, rContext);
864 }
865}
866
868{
869 if ( SfxItemState::SET != m_AttrSet.GetItemState( RES_TXTATR_FTN, false ))
870 return ;
871
872 SwNodes& rNds = rDoc.GetNodes();
873 for ( sal_uInt16 n = 0; n < m_pHistory->Count(); ++n ) {
874 sal_Int32 nContent = 0;
875 SwNodeOffset nNode(0);
876 SwHistoryHint* pHstHint = (*m_pHistory)[ n ];
877 switch ( pHstHint->Which() ) {
878 case HSTRY_RESETTXTHNT: {
879 SwHistoryResetText * pHistoryHint
880 = static_cast<SwHistoryResetText*>(pHstHint);
881 if ( RES_TXTATR_FTN == pHistoryHint->GetWhich() ) {
882 nNode = pHistoryHint->GetNode();
883 nContent = pHistoryHint->GetContent();
884 }
885 }
886 break;
887
888 default:
889 break;
890 }
891
892 if( nNode ) {
893 SwTextNode* pTextNd = rNds[ nNode ]->GetTextNode();
894 if( pTextNd ) {
895 SwTextAttr *const pTextHt =
896 pTextNd->GetTextAttrForCharAt(nContent, RES_TXTATR_FTN);
897 if( pTextHt ) {
898 // ok, so get values
899 SwTextFootnote* pFootnote = static_cast<SwTextFootnote*>(pTextHt);
900 RemoveIdxFromSection( rDoc, pFootnote->GetStartNode()->GetIndex() );
901 return ;
902 }
903 }
904 }
905 }
906}
907
909 : SwUndo( SwUndoId::SETDEFTATTR, &rDoc )
910{
911 const SvxTabStopItem* pItem = rSet.GetItemIfSet( RES_PARATR_TABSTOP, false );
912 if( pItem )
913 {
914 // store separately, because it may change!
915 m_pTabStop.reset(pItem->Clone());
916 if ( 1 != rSet.Count() ) { // are there more attributes?
917 m_oOldSet.emplace( rSet );
918 }
919 } else {
920 m_oOldSet.emplace( rSet );
921 }
922}
923
925{
926}
927
929{
930 SwDoc & rDoc = rContext.GetDoc();
931 if (m_oOldSet)
932 {
934 *rDoc.GetDfltTextFormatColl() );
935 rDoc.SetDefault( *m_oOldSet );
936 m_oOldSet.reset();
937 if ( aTmp.GetUndo() ) {
938 // transfer ownership of helper object's old set
939 if (aTmp.GetUndo()->m_oOldSet)
940 m_oOldSet.emplace(std::move(*aTmp.GetUndo()->m_oOldSet));
941 }
942 }
943 if (m_pTabStop)
944 {
945 std::unique_ptr<SvxTabStopItem> pOld(rDoc.GetDefault(RES_PARATR_TABSTOP).Clone());
946 rDoc.SetDefault( *m_pTabStop );
947 m_pTabStop = std::move( pOld );
948 }
949}
950
952{
953 UndoImpl(rContext);
954}
955
957 const SwPaM& rPam, bool bFlag, bool bMod )
958 : SwUndo( bFlag ? SwUndoId::INC_LEFTMARGIN : SwUndoId::DEC_LEFTMARGIN, &rPam.GetDoc() )
959 , SwUndRng( rPam )
960 , m_pHistory( new SwHistory )
961 , m_bModulus( bMod )
962{
963}
964
966{
967}
968
970{
971 SwDoc & rDoc = rContext.GetDoc();
972
973 // restore old values
974 m_pHistory->TmpRollback( & rDoc, 0 );
975 m_pHistory->SetTmpEnd( m_pHistory->Count() );
976
977 AddUndoRedoPaM(rContext);
978}
979
981{
982 SwDoc & rDoc = rContext.GetDoc();
983 SwPaM & rPam = AddUndoRedoPaM(rContext);
984
985 rDoc.MoveLeftMargin( rPam,
988}
989
991{
992 SwDoc & rDoc = rContext.GetDoc();
995}
996
998 const SwPaM& rRange, OUString aText,
999 bool const bIsEndNote)
1000 : SwUndo( SwUndoId::CHGFTN, &rRange.GetDoc() ), SwUndRng( rRange )
1001 , m_pHistory( new SwHistory() )
1002 , m_Text(std::move( aText ))
1003 , m_bEndNote( bIsEndNote )
1004{
1005}
1006
1008{
1009}
1010
1012{
1013 SwDoc & rDoc = rContext.GetDoc();
1014
1015 m_pHistory->TmpRollback( &rDoc, 0 );
1016 m_pHistory->SetTmpEnd( m_pHistory->Count() );
1017
1019
1020 AddUndoRedoPaM(rContext);
1021}
1022
1024{
1025 SwDoc & rDoc( rContext.GetDoc() );
1026 SwPaM & rPaM = AddUndoRedoPaM(rContext);
1027 rDoc.SetCurFootnote(rPaM, m_Text, m_bEndNote);
1028 SetPaM(rPaM);
1029}
1030
1032{
1033 SwDoc & rDoc = rContext.GetDoc();
1034 rDoc.SetCurFootnote(rContext.GetRepeatPaM(), m_Text, m_bEndNote);
1035}
1036
1038 : SwUndo( SwUndoId::FTNINFO, &rDoc )
1039 , m_pFootNoteInfo( new SwFootnoteInfo( rInfo ) )
1040{
1041}
1042
1044{
1045}
1046
1048{
1049 SwDoc & rDoc = rContext.GetDoc();
1050 SwFootnoteInfo *pInf = new SwFootnoteInfo( rDoc.GetFootnoteInfo() );
1052 m_pFootNoteInfo.reset( pInf );
1053}
1054
1056{
1057 SwDoc & rDoc = rContext.GetDoc();
1058 SwFootnoteInfo *pInf = new SwFootnoteInfo( rDoc.GetFootnoteInfo() );
1060 m_pFootNoteInfo.reset( pInf );
1061}
1062
1064 : SwUndo( SwUndoId::FTNINFO, &rDoc )
1065 , m_pEndNoteInfo( new SwEndNoteInfo( rInfo ) )
1066{
1067}
1068
1070{
1071}
1072
1074{
1075 SwDoc & rDoc = rContext.GetDoc();
1076 SwEndNoteInfo *pInf = new SwEndNoteInfo( rDoc.GetEndNoteInfo() );
1078 m_pEndNoteInfo.reset( pInf );
1079}
1080
1082{
1083 SwDoc & rDoc = rContext.GetDoc();
1084 SwEndNoteInfo *pInf = new SwEndNoteInfo( rDoc.GetEndNoteInfo() );
1086 m_pEndNoteInfo.reset( pInf );
1087}
1088
1090 : SwUndo( SwUndoId::DONTEXPAND, &rPos.GetDoc() )
1091 , m_nNodeIndex( rPos.GetNodeIndex() )
1092 , m_nContentIndex( rPos.GetContentIndex() )
1093{
1094}
1095
1097{
1098 SwCursor *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
1099 SwDoc *const pDoc = & rContext.GetDoc();
1100
1101 SwPosition& rPos = *pPam->GetPoint();
1103 pDoc->DontExpandFormat( rPos, false );
1104}
1105
1107{
1108 SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
1109 SwDoc *const pDoc = & rContext.GetDoc();
1110
1111 SwPosition& rPos = *pPam->GetPoint();
1113 pDoc->DontExpandFormat( rPos );
1114}
1115
1117{
1118 SwPaM & rPam = rContext.GetRepeatPaM();
1119 SwDoc & rDoc = rContext.GetDoc();
1120 rDoc.DontExpandFormat( *rPam.GetPoint() );
1121}
1122
1123/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ Ignore
ignore Redlines
@ UndoArg1
Definition: SwRewriter.hxx:29
virtual void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr)=0
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
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 void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual void SetModified()=0
Must be called manually at changes of format.
virtual Point GetRelativePos() const
SfxHintId GetId() const
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
const WhichRangesContainer & GetRanges() const
sal_uInt16 Count() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
sal_uInt16 Which() const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
tools::Long GetHeight() const
tools::Long GetWidth() const
virtual SvxTabStopItem * Clone(SfxItemPool *pPool=nullptr) const override
Represents the style of a text portion.
Definition: charfmt.hxx:27
SwFormatColl * GetFormatColl() const
Definition: node.hxx:497
SwDocModifyAndUndoGuard(SwFormat &format)
Definition: unattr.cxx:98
Definition: doc.hxx:197
void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark=false, bool bExactRange=false, SwRootFrame const *pLayout=nullptr)
Definition: docfmt.cxx:222
const SwFootnoteInfo & GetFootnoteInfo() const
Definition: doc.hxx:643
static sal_uInt16 GetCurTOXMark(const SwPosition &rPos, SwTOXMarks &)
Get current table of contents Mark.
Definition: doctxm.cxx:117
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:408
const sw::TableFrameFormats * GetTableFrameFormats() const
Definition: doc.hxx:824
void DeleteFormatRefMark(const SwFormatRefMark *pFormatRefMark)
Definition: doc.cxx:1126
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history.
Definition: docfmt.cxx:452
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in current document.
Definition: docfmt.cxx:540
const sw::FrameFormats< SwFrameFormat * > * GetFrameFormats() const
Definition: doc.hxx:751
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: doc.hxx:784
void SetFootnoteInfo(const SwFootnoteInfo &rInfo)
Definition: docftn.cxx:294
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:329
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:158
SwNodes & GetNodes()
Definition: doc.hxx:422
bool SetCurFootnote(const SwPaM &rPam, const OUString &rNumStr, bool bIsEndNote)
change footnotes in range
Definition: docftn.cxx:432
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:349
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:330
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:419
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:647
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:664
const SwEndNoteInfo & GetEndNoteInfo() const
Definition: doc.hxx:645
void ResetAttrs(const SwPaM &rRg, bool bTextAttr=true, const o3tl::sorted_vector< sal_uInt16 > &rAttrs=o3tl::sorted_vector< sal_uInt16 >(), const bool bSendDataChangedEvents=true, SwRootFrame const *pLayout=nullptr)
Reset attributes.
Definition: docfmt.cxx:243
const SwTextFormatColl * GetDfltTextFormatColl() const
Definition: doc.hxx:789
void SetEndNoteInfo(const SwEndNoteInfo &rInfo)
Definition: docftn.cxx:365
bool DontExpandFormat(const SwPosition &rPos, bool bFlag=true)
Definition: docfmt.cxx:1704
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: doc.hxx:812
void DeleteTOXMark(const SwTOXMark *pTOXMark)
Delete table of contents Mark.
Definition: doctxm.cxx:155
const SwGrfFormatColls * GetGrfFormatColls() const
Definition: doc.hxx:819
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1334
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
Definition: doc.hxx:757
void MoveLeftMargin(const SwPaM &rPam, bool bRight, bool bModulus, SwRootFrame const *pLayout=nullptr)
Adjust left margin via object bar (similar to adjustment of numerations).
Definition: docfmt.cxx:1631
void UpdateAllFootnote()
Definition: ftnidx.cxx:266
FlyAnchors.
Definition: fmtanchr.hxx:37
sal_Int32 GetAnchorContentOffset() const
Definition: atrfrm.cxx:1631
sal_uInt16 GetPageNum() const
Definition: fmtanchr.hxx:70
void SetPageNum(sal_uInt16 nNew)
Definition: fmtanchr.hxx:71
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1593
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
SwNode * GetAnchorNode() const
Definition: atrfrm.cxx:1614
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
Format of a fly content.
Definition: fmtflcnt.hxx:33
SwFrameFormat * GetFrameFormat() const
Definition: fmtflcnt.hxx:45
Base class for various Writer styles.
Definition: format.hxx:47
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
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:385
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:88
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
virtual Value FindFormatByName(const OUString &rName) const override
Definition: docary.hxx:166
Style of a layout element.
Definition: frmfmt.hxx:72
virtual void DelFrames()
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: atrfrm.cxx:2733
virtual void MakeFrames()
Creates the views.
Definition: atrfrm.cxx:2744
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:153
HISTORY_HINT Which() const
Definition: rolbck.hxx:89
sal_uInt16 GetWhich() const
Definition: rolbck.hxx:197
sal_Int32 GetContent() const
Definition: rolbck.hxx:199
SwNodeOffset GetNode() const
Definition: rolbck.hxx:198
const OUString & GetRefName()
Definition: rolbck.hxx:165
bool IsEqual(const SwTOXMark &rCmp) const
Definition: rolbck.cxx:418
TElementType * First()
Definition: calbck.hxx:372
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Definition: ndnotxt.hxx:30
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:111
Base class of the Writer document model elements.
Definition: node.hxx:98
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:738
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
SwNodeOffset GetIndex() const
Definition: node.hxx:312
bool IsStartNode() const
Definition: node.hxx:675
bool IsSectionNode() const
Definition: node.hxx:695
bool IsTableNode() const
Definition: node.hxx:691
bool IsTextNode() const
Definition: node.hxx:687
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:380
SwContentNode * GetContentNode()
Definition: node.hxx:666
SwNoTextNode * GetNoTextNode()
Definition: ndnotxt.hxx:95
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:165
SwNodeOffset Count() const
Definition: ndarr.hxx:142
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
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:657
SwDoc & GetDoc() const
Definition: pam.hxx:291
void DeleteMark()
Definition: pam.hxx:232
const SwPosition * GetPoint() const
Definition: pam.hxx:253
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
A section node represents the start of a section on the UI, i.e.
Definition: node.hxx:575
Starts a section of nodes in the document model.
Definition: node.hxx:348
SwStartNodeType GetStartNodeType() const
Definition: node.hxx:364
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:443
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:481
const SwTable & GetTable() const
Definition: node.hxx:542
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:113
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
Definition: swtable.cxx:1344
SwTableSortBoxes & GetTabSortBoxes()
Definition: swtable.hxx:267
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
const SwFormatFlyCnt & GetFlyCnt() const
Definition: txatbase.hxx:226
sal_uInt16 Which() const
Definition: txatbase.hxx:116
SwTextAttr subclass for footnotes and endnotes.
Definition: txtftn.hxx:34
const SwNodeIndex * GetStartNode() const
Definition: txtftn.hxx:43
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
void DeleteAttributes(const sal_uInt16 nWhich, const sal_Int32 nStart, const sal_Int32 nEnd=0)
delete all attributes of type nWhich at nStart (opt. end nEnd)
Definition: thints.cxx:1801
SwTextAttr * InsertItem(SfxPoolItem &rAttr, const sal_Int32 nStart, const sal_Int32 nEnd, const SetAttrMode nMode=SetAttrMode::DEFAULT)
create new text attribute from rAttr and insert it
Definition: thints.cxx:1305
bool HasHints() const
Definition: ndtxt.hxx:254
const OUString & GetText() const
Definition: ndtxt.hxx:244
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
Definition: ndtxt.cxx:3153
bool DontExpandFormat(sal_Int32 nContentIdx, bool bFlag=true, bool bFormatToTextAttributes=true)
When appropriate set DontExpand-flag at INet or character styles respectively.
Definition: ndtxt.cxx:1679
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
sal_Int32 m_nEndContent
Definition: undobj.hxx:232
SfxItemSet m_AttrSet
SwNodeOffset m_nNodeIndex
void RemoveIdx(SwDoc &rDoc)
Definition: unattr.cxx:867
void redoAttribute(SwPaM &rPam, sw::UndoRedoContext &rContext)
Definition: unattr.cxx:814
const std::unique_ptr< SwHistory > m_pHistory
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:852
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:762
SwUndoAttr(const SwPaM &, SfxItemSet, const SetAttrMode nFlags)
Definition: unattr.cxx:720
void SaveRedlineData(const SwPaM &rPam, bool bInsContent)
Definition: unattr.cxx:742
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:800
OUString m_aChrFormatName
std::unique_ptr< SwRedlineSaveDatas > m_pRedlineSaveData
virtual ~SwUndoAttr() override
Definition: unattr.cxx:738
std::unique_ptr< SwRedlineData > m_pRedlineData
const SetAttrMode m_nInsertFlags
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1011
const std::unique_ptr< SwHistory > m_pHistory
SwUndoChangeFootNote(const SwPaM &rRange, OUString aText, bool bIsEndNote)
Definition: unattr.cxx:997
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1023
virtual ~SwUndoChangeFootNote() override
Definition: unattr.cxx:1007
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:1031
const OUString m_Text
std::optional< SfxItemSet > m_oOldSet
SwUndoDefaultAttr(const SfxItemSet &rOldSet, const SwDoc &rDoc)
Definition: unattr.cxx:908
virtual ~SwUndoDefaultAttr() override
Definition: unattr.cxx:924
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:951
std::unique_ptr< SvxTabStopItem > m_pTabStop
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:928
const sal_Int32 m_nContentIndex
const SwNodeOffset m_nNodeIndex
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1106
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1096
SwUndoDontExpandFormat(const SwPosition &rPos)
Definition: unattr.cxx:1089
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:1116
std::unique_ptr< SwEndNoteInfo > m_pEndNoteInfo
SwUndoEndNoteInfo(const SwEndNoteInfo &rInfo, const SwDoc &rDoc)
Definition: unattr.cxx:1063
virtual ~SwUndoEndNoteInfo() override
Definition: unattr.cxx:1069
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1073
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1081
std::unique_ptr< SwFootnoteInfo > m_pFootNoteInfo
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1055
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1047
virtual ~SwUndoFootNoteInfo() override
Definition: unattr.cxx:1043
SwUndoFootNoteInfo(const SwFootnoteInfo &rInfo, const SwDoc &rDoc)
Definition: unattr.cxx:1037
std::unique_ptr< SwUndoFormatAttr > m_pUndo
SwUndoFormatAttr * GetUndo() const
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: unattr.cxx:69
SwUndoFormatAttrHelper(SwFormat &rFormat, bool bSaveDrawPt=true)
Definition: unattr.cxx:62
sal_Int32 m_nAnchorContentOffset
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:289
const sal_uInt16 m_nFormatWhich
SwUndoFormatAttr(SfxItemSet &&rOldSet, SwFormat &rFormat, bool bSaveDrawPt)
Definition: unattr.cxx:116
bool RestoreFlyAnchor(::sw::UndoRedoContext &rContext)
Definition: unattr.cxx:413
void SaveFlyAnchor(const SwFormat *pFormat, bool bSaveDrawPt=false)
Definition: unattr.cxx:375
void Init(const SwFormat &rFormat)
Definition: unattr.cxx:149
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:296
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: unattr.cxx:352
SwFormat * GetFormat(const SwDoc &rDoc)
Definition: unattr.cxx:232
SwNodeOffset m_nNodeIndex
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:183
OUString m_sFormatName
std::optional< SfxItemSet > m_oOldSet
virtual ~SwUndoFormatAttr() override
Definition: unattr.cxx:179
const bool m_bSaveDrawPt
void PutAttr(const SfxPoolItem &rItem, const SwDoc &rDoc)
Definition: unattr.cxx:361
SwUndoFormatResetAttr(SwFormat &rChangedFormat, const sal_uInt16 nWhichId)
Definition: unattr.cxx:533
std::unique_ptr< SfxPoolItem > m_pOldItem
virtual ~SwUndoFormatResetAttr() override
Definition: unattr.cxx:545
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:549
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:557
SwFormat *const m_pChangedFormat
const sal_uInt16 m_nWhichId
virtual ~SwUndoMoveLeftMargin() override
Definition: unattr.cxx:965
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:969
const std::unique_ptr< SwHistory > m_pHistory
SwUndoMoveLeftMargin(const SwPaM &, bool bRight, bool bModulus)
Definition: unattr.cxx:956
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:990
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:980
void SetAttrs(o3tl::sorted_vector< sal_uInt16 > &&rAttrs)
Definition: unattr.cxx:695
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:585
const std::unique_ptr< SwHistory > m_pHistory
SwUndoResetAttr(const SwPaM &, sal_uInt16 nFormatId)
Definition: unattr.cxx:565
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:676
SwHistory & GetHistory()
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:606
virtual ~SwUndoResetAttr() override
Definition: unattr.cxx:581
o3tl::sorted_vector< sal_uInt16 > m_Ids
const sal_uInt16 m_nFormatId
void SetRedlineFlags(RedlineFlags eMode)
Definition: undobj.hxx:121
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:120
static void SetSaveData(SwDoc &rDoc, SwRedlineSaveDatas &rSData)
Definition: undobj.cxx:1516
SwUndoId GetId() const
Definition: undobj.hxx:102
static bool FillSaveDataForFormat(const SwPaM &, SwRedlineSaveDatas &)
Definition: undobj.cxx:1486
static void RemoveIdxFromSection(SwDoc &, SwNodeOffset nSttIdx, const SwNodeOffset *pEndIdx=nullptr)
Definition: undobj.cxx:108
bool ContainsFormat(const value_type &rpFormat) const
fast check if given format is contained here @precond pFormat must not have been deleted
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
void SetSelections(SwFrameFormat *const pSelFormat, SdrMarkList *const pMarkList)
Definition: UndoCore.hxx:99
virtual OUString GetName() const override
@ Variable
Frame is variable in Var-direction.
constexpr TypedWhichId< SwGrfFormatColl > RES_GRFFMTCOLL(164)
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(59)
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(166)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(169)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr TypedWhichId< SwCharFormat > RES_CHRFMT(RES_FMT_BEGIN)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(165)
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(58)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
constexpr TypedWhichId< SwTextFormatColl > RES_TXTFMTCOLL(163)
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(101)
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_OBJECTDYING(RES_FORMAT_MSG_BEGIN)
constexpr sal_uInt16 RES_FMT_BEGIN(RES_UNKNOWNATR_END)
constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END)
constexpr TypedWhichId< SwFrameFormat > RES_FRMFMT(161)
sal_Int64 n
const SvxPageUsage aArr[]
@ SwFlyStartNode
Definition: ndtyp.hxx:54
@ SwTableBoxStartNode
Definition: ndtyp.hxx:53
constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32)
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:60
@ HSTRY_SETTOXMARKHNT
Definition: rolbck.hxx:67
@ HSTRY_RESETTXTHNT
Definition: rolbck.hxx:68
@ HSTRY_SETREFMARKHNT
Definition: rolbck.hxx:66
static SfxItemSet & rSet
Marks a position in the document model.
Definition: pam.hxx:38
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
void AdjustContent(sal_Int32 nDelta)
Adjust content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:262
SetAttrMode
Definition: swtypes.hxx:133
@ NO_CURSOR_CHANGE
don't change the cursor position
SwUndoId
Definition: swundo.hxx:30
@ INC_LEFTMARGIN
@ DEC_LEFTMARGIN
std::vector< SwTOXMark * > SwTOXMarks
Definition: tox.hxx:46