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