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 SfxStyleFamily nFamily = SfxStyleFamily::None;
232 nFamily = SfxStyleFamily::Para;
233 else if (RES_CHRFMT == m_nFormatWhich)
234 nFamily = SfxStyleFamily::Char;
235
236 if (m_oOldSet && m_oOldSet->Count() > 0 && nFamily != SfxStyleFamily::None)
237 rContext.GetDoc().BroadcastStyleOperation(pFormat->GetName(), nFamily, SfxHintId::StyleSheetModified);
238}
239
240// Check if it is still in Doc
242{
243 switch (m_nFormatWhich)
244 {
245 case RES_TXTFMTCOLL:
248
249 case RES_GRFFMTCOLL:
251
252 case RES_CHRFMT:
254
255 case RES_FRMFMT:
256 if (m_nNodeIndex && (m_nNodeIndex < rDoc.GetNodes().Count()))
257 {
258 SwNode* pNd = rDoc.GetNodes()[m_nNodeIndex];
259 if (pNd->IsTableNode())
260 {
261 return static_cast<SwTableNode*>(pNd)->GetTable().GetFrameFormat();
262 }
263 else if (pNd->IsSectionNode())
264 {
265 return static_cast<SwSectionNode*>(pNd)->GetSection().GetFormat();
266 }
267 else if (pNd->IsStartNode() && (SwTableBoxStartNode ==
268 static_cast<SwStartNode*>(pNd)->GetStartNodeType()))
269 {
270 SwTableNode* pTableNode = pNd->FindTableNode();
271 if (pTableNode)
272 {
273 SwTableBox* pBox = pTableNode->GetTable().GetTableBox(m_nNodeIndex);
274 if (pBox)
275 {
276 return pBox->GetFrameFormat();
277 }
278 }
279 }
280 }
281 [[fallthrough]];
282 case RES_DRAWFRMFMT:
283 case RES_FLYFRMFMT:
284 {
285 auto it = rDoc.GetSpzFrameFormats()->findByTypeAndName( m_nFormatWhich, m_sFormatName );
286 if( it != rDoc.GetSpzFrameFormats()->typeAndNameEnd() )
287 return *it;
288 SwFormat* pFormat = rDoc.GetFrameFormats()->FindFormatByName(m_sFormatName);
289 if (pFormat)
290 return pFormat;
291 }
292 break;
293 }
294
295 return nullptr;
296}
297
299{
300 // #i35443# - Because the undo stores the attributes for
301 // redo, the same code as for <Undo(..)> can be applied for <Redo(..)>
302 UndoImpl(rContext);
303}
304
306{
307 if (!m_oOldSet)
308 return;
309
310 SwDoc & rDoc(rContext.GetDoc());
311
312 SwFormat * pFormat = GetFormat(rDoc);
313 if (!pFormat)
314 return;
315
316 switch ( m_nFormatWhich ) {
317 case RES_GRFFMTCOLL: {
318 SwNoTextNode *const pNd =
320 if( pNd ) {
321 rDoc.SetAttr( pFormat->GetAttrSet(), *pNd->GetFormatColl() );
322 }
323 }
324 break;
325
326 case RES_TXTFMTCOLL:
328 {
329 SwTextNode *const pNd =
331 if( pNd ) {
332 rDoc.SetAttr( pFormat->GetAttrSet(), *pNd->GetFormatColl() );
333 }
334 }
335 break;
336
337 case RES_FLYFRMFMT: {
338 // Check if the cursor is in a flying frame
339 // Steps: search in all FlyFrameFormats for the FlyContent attribute
340 // and validate if the cursor is in the respective section
341 SwFrameFormat *const pFly =
343 if( pFly ) {
344 // Bug 43672: do not set all attributes!
345 if (SfxItemState::SET ==
346 pFormat->GetAttrSet().GetItemState( RES_CNTNT )) {
347 SfxItemSet aTmpSet( pFormat->GetAttrSet() );
348 aTmpSet.ClearItem( RES_CNTNT );
349 if( aTmpSet.Count() ) {
350 rDoc.SetAttr( aTmpSet, *pFly );
351 }
352 } else {
353 rDoc.SetAttr( pFormat->GetAttrSet(), *pFly );
354 }
355 }
356 break;
357 }
358 }
359}
360
362{
363 SwRewriter aRewriter;
364
365 aRewriter.AddRule(UndoArg1, m_sFormatName);
366
367 return aRewriter;
368}
369
370void SwUndoFormatAttr::PutAttr( const SfxPoolItem& rItem, const SwDoc& rDoc )
371{
372 if (RES_CNTNT == rItem.Which())
373 {
374 return; // tdf#126017 never save SwNodeIndex, it will go stale
375 }
376 m_oOldSet->Put( rItem );
377 if ( RES_ANCHOR == rItem.Which() )
378 {
379 SwFormat * pFormat = GetFormat( rDoc );
380 SaveFlyAnchor( pFormat, m_bSaveDrawPt );
381 }
382}
383
384void SwUndoFormatAttr::SaveFlyAnchor( const SwFormat * pFormat, bool bSvDrwPt )
385{
386 // Format is valid, otherwise you would not reach this point here
387 if( bSvDrwPt ) {
388 if ( RES_DRAWFRMFMT == pFormat->Which() ) {
389 Point aPt( static_cast<const SwFrameFormat*>(pFormat)->FindSdrObject()
390 ->GetRelativePos() );
391 // store old value as attribute, to keep SwUndoFormatAttr small
392 m_oOldSet->Put( SwFormatFrameSize( SwFrameSize::Variable, aPt.X(), aPt.Y() ) );
393 }
394 }
395
396 const SwFormatAnchor& rAnchor =
397 m_oOldSet->Get( RES_ANCHOR, false );
398 if( !rAnchor.GetAnchorNode() || rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
399 return;
400
401 switch( rAnchor.GetAnchorId() ) {
402 case RndStdIds::FLY_AS_CHAR:
403 case RndStdIds::FLY_AT_CHAR:
405 [[fallthrough]];
406 case RndStdIds::FLY_AT_PARA:
407 case RndStdIds::FLY_AT_FLY:
408 m_nNodeIndex = rAnchor.GetAnchorNode()->GetIndex();
409 break;
410 default:
411 assert(false);
412 }
413
414 SwFormatAnchor aAnchor( rAnchor.GetAnchorId(), 0 );
415 m_oOldSet->Put( aAnchor );
416}
417
418// #i35443# - Add return value, type <bool>.
419// Return value indicates, if anchor attribute is restored.
420// Note: If anchor attribute is restored, all other existing attributes
421// are also restored.
423{
424 SwDoc *const pDoc = & rContext.GetDoc();
425 SwFrameFormat* pFrameFormat = static_cast<SwFrameFormat*>( GetFormat( *pDoc ) );
426 const SwFormatAnchor& rAnchor =
427 m_oOldSet->Get( RES_ANCHOR, false );
428
429 SwFormatAnchor aNewAnchor( rAnchor.GetAnchorId() );
430 if (RndStdIds::FLY_AT_PAGE != rAnchor.GetAnchorId()) {
431 SwNode* pNd = pDoc->GetNodes()[ m_nNodeIndex ];
432
433 if ( (RndStdIds::FLY_AT_FLY == rAnchor.GetAnchorId())
434 ? ( !pNd->IsStartNode() || (SwFlyStartNode !=
435 static_cast<SwStartNode*>(pNd)->GetStartNodeType()) )
436 : !pNd->IsTextNode() ) {
437 // #i35443# - invalid position.
438 // Thus, anchor attribute not restored
439 return false;
440 }
441
442 SwPosition aPos( *pNd );
443 if ((RndStdIds::FLY_AS_CHAR == rAnchor.GetAnchorId()) ||
444 (RndStdIds::FLY_AT_CHAR == rAnchor.GetAnchorId())) {
446 if ( aPos.GetContentIndex() > pNd->GetTextNode()->GetText().getLength()) {
447 // #i35443# - invalid position.
448 // Thus, anchor attribute not restored
449 return false;
450 }
451 }
452 aNewAnchor.SetAnchor( &aPos );
453 } else
454 aNewAnchor.SetPageNum( rAnchor.GetPageNum() );
455
456 Point aDrawSavePt, aDrawOldPt;
458 if( RES_DRAWFRMFMT == pFrameFormat->Which() ) {
459 // get the old cached value
460 const SwFormatFrameSize& rOldSize = m_oOldSet->Get( RES_FRM_SIZE );
461 aDrawSavePt.setX( rOldSize.GetWidth() );
462 aDrawSavePt.setY( rOldSize.GetHeight() );
463 m_oOldSet->ClearItem( RES_FRM_SIZE );
464
465 // write the current value into cache
466 aDrawOldPt = pFrameFormat->FindSdrObject()->GetRelativePos();
467 } else {
468 pFrameFormat->DelFrames(); // delete Frames
469 }
470 }
471
472 const SwFormatAnchor &rOldAnch = pFrameFormat->GetAnchor();
473 // #i54336#
474 // Consider case, that as-character anchored object has moved its anchor position.
475 if (RndStdIds::FLY_AS_CHAR == rOldAnch.GetAnchorId()) {
476 // With InContents it's tricky: the text attribute needs to be deleted.
477 // Unfortunately, this not only destroys the Frames but also the format.
478 // To prevent that, first detach the connection between attribute and
479 // format.
480 SwTextNode *pTextNode = static_cast<SwTextNode*>(rOldAnch.GetAnchorNode());
481 OSL_ENSURE( pTextNode->HasHints(), "Missing FlyInCnt-Hint." );
482 const sal_Int32 nIdx = rOldAnch.GetAnchorContentOffset();
483 SwTextAttr * const pHint =
484 pTextNode->GetTextAttrForCharAt( nIdx, RES_TXTATR_FLYCNT );
485 assert(pHint && "Missing Hint.");
486 OSL_ENSURE( pHint->Which() == RES_TXTATR_FLYCNT,
487 "Missing FlyInCnt-Hint." );
488 OSL_ENSURE( pHint->GetFlyCnt().GetFrameFormat() == pFrameFormat,
489 "Wrong TextFlyCnt-Hint." );
490 const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt()).SetFlyFormat();
491
492 // Connection is now detached, therefore the attribute can be deleted
493 pTextNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx, nIdx );
494 }
495
496 {
497 m_oOldSet->Put( aNewAnchor );
498 SwUndoFormatAttrHelper aTmp( *pFrameFormat, m_bSaveDrawPt );
499 pFrameFormat->SetFormatAttr( *m_oOldSet );
500 if ( aTmp.GetUndo() ) {
502 // transfer ownership of helper object's old set
503 if (aTmp.GetUndo()->m_oOldSet)
504 m_oOldSet.emplace(std::move(*aTmp.GetUndo()->m_oOldSet));
505 else
506 m_oOldSet.reset();
507 } else {
508 m_oOldSet->ClearItem();
509 }
510 }
511
512 if ( RES_DRAWFRMFMT == pFrameFormat->Which() )
513 {
514 // The Draw model also prepared an Undo object for its right positioning
515 // which unfortunately is relative. Therefore block here a position
516 // change of the Contact object by setting the anchor.
517 const SwFormatVertOrient& rVertOrient = pFrameFormat->GetVertOrient();
518 const SwFormatHoriOrient& rHoriOrient = pFrameFormat->GetHoriOrient();
519 Point aFormatPos(rHoriOrient.GetPos(), rVertOrient.GetPos());
520 if (aDrawSavePt != aFormatPos)
521 {
522 // If the position would be the same, then skip the call: either it would do nothing or
523 // it would just go wrong.
524 pFrameFormat->CallSwClientNotify(sw::RestoreFlyAnchorHint(aDrawSavePt));
525 }
526
527 // cache the old value again
528 m_oOldSet->Put(SwFormatFrameSize(SwFrameSize::Variable, aDrawOldPt.X(), aDrawOldPt.Y()));
529 }
530
531 if (RndStdIds::FLY_AS_CHAR == aNewAnchor.GetAnchorId()) {
532 SwTextNode* pTextNd = aNewAnchor.GetAnchorNode()->GetTextNode();
533 OSL_ENSURE( pTextNd, "no Text Node at position." );
534 SwFormatFlyCnt aFormat( pFrameFormat );
535 pTextNd->InsertItem( aFormat, aNewAnchor.GetAnchorContentOffset(), 0 );
536 }
537
538 if (RES_DRAWFRMFMT != pFrameFormat->Which())
539 pFrameFormat->MakeFrames();
540 else
541 {
543 }
544
545 rContext.SetSelections(pFrameFormat, nullptr);
546
547 // #i35443# - anchor attribute restored.
548 return true;
549}
550
552 const std::vector<sal_uInt16>& rIds )
553 : SwUndo( SwUndoId::RESETATTR, rChangedFormat.GetDoc() )
554 , m_pChangedFormat( &rChangedFormat )
555 , m_aSet(*rChangedFormat.GetAttrSet().GetPool())
556{
557 for (const auto& nWhichId : rIds)
558 {
559 const SfxPoolItem* pItem = nullptr;
560 if (rChangedFormat.GetItemState(nWhichId, false, &pItem ) == SfxItemState::SET && pItem)
561 m_aSet.Put(*pItem);
562 }
563}
564
566{
567}
568
570{
573}
574
576{
577 SfxItemIter aIter(m_aSet);
578 for (auto pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
579 m_pChangedFormat->ResetFormatAttr(pItem->Which());
581}
582
584{
585 auto nWhich = m_pChangedFormat->Which();
586 SfxStyleFamily nFamily = SfxStyleFamily::None;
587
588 if (RES_TXTFMTCOLL == nWhich || RES_CONDTXTFMTCOLL == nWhich)
589 nFamily = SfxStyleFamily::Para;
590 else if (RES_CHRFMT == nWhich)
591 nFamily = SfxStyleFamily::Char;
592
593 if (nFamily != SfxStyleFamily::None)
594 m_pChangedFormat->GetDoc()->BroadcastStyleOperation(m_pChangedFormat->GetName(), nFamily, SfxHintId::StyleSheetModified);
595}
596
597SwUndoResetAttr::SwUndoResetAttr( const SwPaM& rRange, sal_uInt16 nFormatId )
598 : SwUndo( SwUndoId::RESETATTR, &rRange.GetDoc() ), SwUndRng( rRange )
599 , m_pHistory( new SwHistory )
600 , m_nFormatId( nFormatId )
601{
602}
603
604SwUndoResetAttr::SwUndoResetAttr( const SwPosition& rPos, sal_uInt16 nFormatId )
605 : SwUndo( SwUndoId::RESETATTR, &rPos.GetDoc() )
606 , m_pHistory( new SwHistory )
607 , m_nFormatId( nFormatId )
608{
611}
612
614{
615}
616
618{
619 // reset old values
620 SwDoc & rDoc = rContext.GetDoc();
621 m_pHistory->TmpRollback( &rDoc, 0 );
622 m_pHistory->SetTmpEnd( m_pHistory->Count() );
623
626 SwTextNode* pTNd = rDoc.GetNodes()[ m_nSttNode ]->GetTextNode();
627 if( pTNd )
628 pTNd->DontExpandFormat( m_nSttContent, false );
629 }
631 {
632 rDoc.GetEditShell()->SwViewShell::UpdateFields();
633 }
634
635 AddUndoRedoPaM(rContext);
636}
637
639{
640 SwDoc & rDoc = rContext.GetDoc();
641 SwPaM & rPam = AddUndoRedoPaM(rContext);
642
643 switch ( m_nFormatId ) {
644 case RES_CHRFMT:
645 rDoc.RstTextAttrs(rPam);
646 break;
647 case RES_TXTFMTCOLL:
648 rDoc.ResetAttrs(rPam, false, m_Ids );
649 break;
651 rDoc.ResetAttrs(rPam, true, m_Ids );
652
653 break;
655 // special treatment for TOXMarks
656 {
658 SwNodeIndex aIdx( rDoc.GetNodes(), m_nSttNode );
659 SwPosition aPos( aIdx, aIdx.GetNode().GetContentNode(), m_nSttContent );
660
661 sal_uInt16 nCnt = SwDoc::GetCurTOXMark( aPos, aArr );
662 if( nCnt ) {
663 if( 1 < nCnt ) {
664 // search for the right one
665 SwHistoryHint* pHHint = (GetHistory())[ 0 ];
666 if( pHHint && HSTRY_SETTOXMARKHNT == pHHint->Which() ) {
667 while( nCnt ) {
668 if ( static_cast<SwHistorySetTOXMark*>(pHHint)
669 ->IsEqual( *aArr[ --nCnt ] ) ) {
670 ++nCnt;
671 break;
672 }
673 }
674 } else
675 nCnt = 0;
676 }
677 // found one, thus delete it
678 if( nCnt-- ) {
679 rDoc.DeleteTOXMark( aArr[ nCnt ] );
680 }
681 }
682 }
683 break;
685 {
687 SwHistoryHint* pHistoryHint = GetHistory()[0];
688 if (pHistoryHint && HSTRY_SETREFMARKHNT == pHistoryHint->Which())
689 {
690 for (const SfxPoolItem* pItem : aRange)
691 {
692 assert(dynamic_cast<const SwFormatRefMark*>(pItem));
693 const auto pFormatRefMark = static_cast<const SwFormatRefMark*>(pItem);
694 if (static_cast<SwHistorySetRefMark*>(pHistoryHint)->GetRefName() ==
695 pFormatRefMark->GetRefName())
696 {
697 rDoc.DeleteFormatRefMark(pFormatRefMark);
698 rDoc.GetEditShell()->SwViewShell::UpdateFields();
699 break;
700 }
701 }
702 }
703 }
704 break;
705 }
706}
707
709{
711 return;
712 }
713
714 switch ( m_nFormatId ) {
715 case RES_CHRFMT:
716 rContext.GetDoc().RstTextAttrs(rContext.GetRepeatPaM());
717 break;
718 case RES_TXTFMTCOLL:
719 rContext.GetDoc().ResetAttrs(rContext.GetRepeatPaM(), false, m_Ids);
720 break;
722 rContext.GetDoc().ResetAttrs(rContext.GetRepeatPaM(), true, m_Ids);
723 break;
724 }
725}
726
728{
729 m_Ids = std::move(rAttrs);
730}
731
732SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxPoolItem& rAttr,
733 const SetAttrMode nFlags )
734 : SwUndo( SwUndoId::INSATTR, &rRange.GetDoc() ), SwUndRng( rRange )
735 , m_AttrSet( rRange.GetDoc().GetAttrPool(), rAttr.Which(), rAttr.Which() )
736 , m_pHistory( new SwHistory )
737 , m_nNodeIndex( NODE_OFFSET_MAX )
738 , m_nInsertFlags( nFlags )
739{
740 m_AttrSet.Put( rAttr );
741
742 // Save character style as a style name, not as a reference
744 if (pItem)
745 {
746 uno::Any aValue;
747 pItem->QueryValue(aValue, RES_TXTATR_CHARFMT);
748 aValue >>= m_aChrFormatName;
749 }
750}
751
753 const SetAttrMode nFlags )
754 : SwUndo( SwUndoId::INSATTR, &rRange.GetDoc() ), SwUndRng( rRange )
755 , m_AttrSet(std::move( aSet ))
756 , m_pHistory( new SwHistory )
757 , m_nNodeIndex( NODE_OFFSET_MAX )
758 , m_nInsertFlags( nFlags )
759{
760 // Save character style as a style name, not as a reference
762 if (pItem)
763 {
764 uno::Any aValue;
765 pItem->QueryValue(aValue, RES_TXTATR_CHARFMT);
766 aValue >>= m_aChrFormatName;
767 }
768}
769
771{
772}
773
774void SwUndoAttr::SaveRedlineData( const SwPaM& rPam, bool bIsContent )
775{
776 SwDoc& rDoc = rPam.GetDoc();
777 if ( rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) {
778 m_pRedlineData.reset( new SwRedlineData( bIsContent
779 ? RedlineType::Insert
780 : RedlineType::Format,
782 }
783
786 m_pRedlineSaveData.reset();
787
789 if ( bIsContent ) {
791 }
792}
793
795{
796 SwDoc *const pDoc = & rContext.GetDoc();
797
798 RemoveIdx( *pDoc );
799
801 SwPaM aPam(pDoc->GetNodes().GetEndOfContent());
802 if ( NODE_OFFSET_MAX != m_nNodeIndex ) {
803 aPam.DeleteMark();
805 aPam.SetMark();
806 aPam.GetPoint()->AdjustContent(+1);
807 pDoc->getIDocumentRedlineAccess().DeleteRedline(aPam, false, RedlineType::Any);
808 } else {
809 // remove all format redlines, will be recreated if needed
810 SetPaM(aPam);
811 pDoc->getIDocumentRedlineAccess().DeleteRedline(aPam, false, RedlineType::Format);
813 {
815 }
816 }
817 }
818
819 const bool bToLast = (1 == m_AttrSet.Count())
820 && (RES_TXTATR_FIELD <= m_AttrSet.GetRanges()[0].first)
821 && (m_AttrSet.GetRanges()[0].first <= RES_TXTATR_ANNOTATION);
822
823 // restore old values
824 m_pHistory->TmpRollback( pDoc, 0, !bToLast );
825 m_pHistory->SetTmpEnd( m_pHistory->Count() );
826
827 // set cursor onto Undo area
829 AddUndoRedoPaM(rContext);
830}
831
833{
834 // RefMarks are not repeat capable
835 if ( SfxItemState::SET != m_AttrSet.GetItemState( RES_TXTATR_REFMARK, false ) ) {
838 } else if ( 1 < m_AttrSet.Count() ) {
839 SfxItemSet aTmpSet( m_AttrSet );
840 aTmpSet.ClearItem( RES_TXTATR_REFMARK );
842 aTmpSet, m_nInsertFlags );
843 }
844}
845
847{
848 SwDoc & rDoc = rContext.GetDoc();
849
850 // Restore pointer to char format from name
851 if (!m_aChrFormatName.isEmpty())
852 {
854 if (pCharFormat)
855 {
856 SwFormatCharFormat aFormat(pCharFormat);
857 m_AttrSet.Put(aFormat);
858 }
859 }
860
861 if ( m_pRedlineData &&
866
867 if ( NODE_OFFSET_MAX != m_nNodeIndex ) {
868 rPam.SetMark();
869 if ( rPam.Move( fnMoveBackward ) ) {
871 true);
872 }
873 rPam.DeleteMark();
874 } else {
876 }
877
879 } else {
881 }
882}
883
885{
887 {
888 SwPaM aPam(rContext.GetDoc().GetNodes().GetEndOfContent());
889 SetPaM(aPam, false);
890 redoAttribute(aPam, rContext);
891 }
892 else
893 {
894 SwPaM& rPam = AddUndoRedoPaM(rContext);
895 redoAttribute(rPam, rContext);
896 }
897}
898
900{
901 if ( SfxItemState::SET != m_AttrSet.GetItemState( RES_TXTATR_FTN, false ))
902 return ;
903
904 SwNodes& rNds = rDoc.GetNodes();
905 for ( sal_uInt16 n = 0; n < m_pHistory->Count(); ++n ) {
906 sal_Int32 nContent = 0;
907 SwNodeOffset nNode(0);
908 SwHistoryHint* pHstHint = (*m_pHistory)[ n ];
909 switch ( pHstHint->Which() ) {
910 case HSTRY_RESETTXTHNT: {
911 SwHistoryResetText * pHistoryHint
912 = static_cast<SwHistoryResetText*>(pHstHint);
913 if ( RES_TXTATR_FTN == pHistoryHint->GetWhich() ) {
914 nNode = pHistoryHint->GetNode();
915 nContent = pHistoryHint->GetContent();
916 }
917 }
918 break;
919
920 default:
921 break;
922 }
923
924 if( nNode ) {
925 SwTextNode* pTextNd = rNds[ nNode ]->GetTextNode();
926 if( pTextNd ) {
927 SwTextAttr *const pTextHt =
928 pTextNd->GetTextAttrForCharAt(nContent, RES_TXTATR_FTN);
929 if( pTextHt ) {
930 // ok, so get values
931 SwTextFootnote* pFootnote = static_cast<SwTextFootnote*>(pTextHt);
932 RemoveIdxFromSection( rDoc, pFootnote->GetStartNode()->GetIndex() );
933 return ;
934 }
935 }
936 }
937 }
938}
939
941 : SwUndo( SwUndoId::SETDEFTATTR, &rDoc )
942{
943 const SvxTabStopItem* pItem = rSet.GetItemIfSet( RES_PARATR_TABSTOP, false );
944 if( pItem )
945 {
946 // store separately, because it may change!
947 m_pTabStop.reset(pItem->Clone());
948 if ( 1 != rSet.Count() ) { // are there more attributes?
949 m_oOldSet.emplace( rSet );
950 }
951 } else {
952 m_oOldSet.emplace( rSet );
953 }
954}
955
957{
958}
959
961{
962 SwDoc & rDoc = rContext.GetDoc();
963 if (m_oOldSet)
964 {
966 *rDoc.GetDfltTextFormatColl() );
967 rDoc.SetDefault( *m_oOldSet );
968 m_oOldSet.reset();
969 if ( aTmp.GetUndo() ) {
970 // transfer ownership of helper object's old set
971 if (aTmp.GetUndo()->m_oOldSet)
972 m_oOldSet.emplace(std::move(*aTmp.GetUndo()->m_oOldSet));
973 }
974 }
975 if (m_pTabStop)
976 {
977 std::unique_ptr<SvxTabStopItem> pOld(rDoc.GetDefault(RES_PARATR_TABSTOP).Clone());
978 rDoc.SetDefault( *m_pTabStop );
979 m_pTabStop = std::move( pOld );
980 }
981}
982
984{
985 UndoImpl(rContext);
986}
987
989 const SwPaM& rPam, bool bFlag, bool bMod )
990 : SwUndo( bFlag ? SwUndoId::INC_LEFTMARGIN : SwUndoId::DEC_LEFTMARGIN, &rPam.GetDoc() )
991 , SwUndRng( rPam )
992 , m_pHistory( new SwHistory )
993 , m_bModulus( bMod )
994{
995}
996
998{
999}
1000
1002{
1003 SwDoc & rDoc = rContext.GetDoc();
1004
1005 // restore old values
1006 m_pHistory->TmpRollback( & rDoc, 0 );
1007 m_pHistory->SetTmpEnd( m_pHistory->Count() );
1008
1009 AddUndoRedoPaM(rContext);
1010}
1011
1013{
1014 SwDoc & rDoc = rContext.GetDoc();
1015 SwPaM & rPam = AddUndoRedoPaM(rContext);
1016
1017 rDoc.MoveLeftMargin( rPam,
1020}
1021
1023{
1024 SwDoc & rDoc = rContext.GetDoc();
1027}
1028
1030 const SwPaM& rRange, OUString aText,
1031 bool const bIsEndNote)
1032 : SwUndo( SwUndoId::CHGFTN, &rRange.GetDoc() ), SwUndRng( rRange )
1033 , m_pHistory( new SwHistory() )
1034 , m_Text(std::move( aText ))
1035 , m_bEndNote( bIsEndNote )
1036{
1037}
1038
1040{
1041}
1042
1044{
1045 SwDoc & rDoc = rContext.GetDoc();
1046
1047 m_pHistory->TmpRollback( &rDoc, 0 );
1048 m_pHistory->SetTmpEnd( m_pHistory->Count() );
1049
1051
1052 AddUndoRedoPaM(rContext);
1053}
1054
1056{
1057 SwDoc & rDoc( rContext.GetDoc() );
1058 SwPaM & rPaM = AddUndoRedoPaM(rContext);
1059 rDoc.SetCurFootnote(rPaM, m_Text, m_bEndNote);
1060 SetPaM(rPaM);
1061}
1062
1064{
1065 SwDoc & rDoc = rContext.GetDoc();
1066 rDoc.SetCurFootnote(rContext.GetRepeatPaM(), m_Text, m_bEndNote);
1067}
1068
1070 : SwUndo( SwUndoId::FTNINFO, &rDoc )
1071 , m_pFootNoteInfo( new SwFootnoteInfo( rInfo ) )
1072{
1073}
1074
1076{
1077}
1078
1080{
1081 SwDoc & rDoc = rContext.GetDoc();
1082 SwFootnoteInfo *pInf = new SwFootnoteInfo( rDoc.GetFootnoteInfo() );
1084 m_pFootNoteInfo.reset( pInf );
1085}
1086
1088{
1089 SwDoc & rDoc = rContext.GetDoc();
1090 SwFootnoteInfo *pInf = new SwFootnoteInfo( rDoc.GetFootnoteInfo() );
1092 m_pFootNoteInfo.reset( pInf );
1093}
1094
1096 : SwUndo( SwUndoId::FTNINFO, &rDoc )
1097 , m_pEndNoteInfo( new SwEndNoteInfo( rInfo ) )
1098{
1099}
1100
1102{
1103}
1104
1106{
1107 SwDoc & rDoc = rContext.GetDoc();
1108 SwEndNoteInfo *pInf = new SwEndNoteInfo( rDoc.GetEndNoteInfo() );
1110 m_pEndNoteInfo.reset( pInf );
1111}
1112
1114{
1115 SwDoc & rDoc = rContext.GetDoc();
1116 SwEndNoteInfo *pInf = new SwEndNoteInfo( rDoc.GetEndNoteInfo() );
1118 m_pEndNoteInfo.reset( pInf );
1119}
1120
1122 : SwUndo( SwUndoId::DONTEXPAND, &rPos.GetDoc() )
1123 , m_nNodeIndex( rPos.GetNodeIndex() )
1124 , m_nContentIndex( rPos.GetContentIndex() )
1125{
1126}
1127
1129{
1130 SwCursor *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
1131 SwDoc *const pDoc = & rContext.GetDoc();
1132
1133 SwPosition& rPos = *pPam->GetPoint();
1135 pDoc->DontExpandFormat( rPos, false );
1136}
1137
1139{
1140 SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
1141 SwDoc *const pDoc = & rContext.GetDoc();
1142
1143 SwPosition& rPos = *pPam->GetPoint();
1145 pDoc->DontExpandFormat( rPos );
1146}
1147
1149{
1150 SwPaM & rPam = rContext.GetRepeatPaM();
1151 SwDoc & rDoc = rContext.GetDoc();
1152 rDoc.DontExpandFormat( *rPam.GetPoint() );
1153}
1154
1155/* 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.
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
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:228
const SwFootnoteInfo & GetFootnoteInfo() const
Definition: doc.hxx:645
static sal_uInt16 GetCurTOXMark(const SwPosition &rPos, SwTOXMarks &)
Get current table of contents Mark.
Definition: doctxm.cxx:117
void BroadcastStyleOperation(const OUString &rName, SfxStyleFamily eFamily, SfxHintId nOp)
Definition: docdesc.cxx:723
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:408
const sw::TableFrameFormats * GetTableFrameFormats() const
Definition: doc.hxx:826
void DeleteFormatRefMark(const SwFormatRefMark *pFormatRefMark)
Definition: doc.cxx:1127
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:458
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in current document.
Definition: docfmt.cxx:548
const sw::FrameFormats< SwFrameFormat * > * GetFrameFormats() const
Definition: doc.hxx:753
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: doc.hxx:786
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:649
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:672
const SwEndNoteInfo & GetEndNoteInfo() const
Definition: doc.hxx:647
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:249
const SwTextFormatColl * GetDfltTextFormatColl() const
Definition: doc.hxx:791
void SetEndNoteInfo(const SwEndNoteInfo &rInfo)
Definition: docftn.cxx:365
bool DontExpandFormat(const SwPosition &rPos, bool bFlag=true)
Definition: docfmt.cxx:1722
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: doc.hxx:814
void DeleteTOXMark(const SwTOXMark *pTOXMark)
Delete table of contents Mark.
Definition: doctxm.cxx:155
const SwGrfFormatColls * GetGrfFormatColls() const
Definition: doc.hxx:821
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1337
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
Definition: doc.hxx:759
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:1649
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
Defines the horizontal position of a fly frame.
Definition: fmtornt.hxx:73
SwTwips GetPos() const
Definition: fmtornt.hxx:99
Defines the vertical position of a fly frame.
Definition: fmtornt.hxx:37
SwTwips GetPos() const
Definition: fmtornt.hxx:62
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
const OUString & GetName() const
Definition: format.hxx:131
const SwFormatVertOrient & GetVertOrient(bool=true) const
Definition: fmtornt.hxx:113
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
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:115
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:187
bool IsSectionNode() const
Definition: node.hxx:192
bool IsTableNode() const
Definition: node.hxx:191
bool IsTextNode() const
Definition: node.hxx:190
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:3155
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:1681
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:899
void redoAttribute(SwPaM &rPam, sw::UndoRedoContext &rContext)
Definition: unattr.cxx:846
const std::unique_ptr< SwHistory > m_pHistory
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:884
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:794
SwUndoAttr(const SwPaM &, SfxItemSet, const SetAttrMode nFlags)
Definition: unattr.cxx:752
void SaveRedlineData(const SwPaM &rPam, bool bInsContent)
Definition: unattr.cxx:774
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:832
OUString m_aChrFormatName
std::unique_ptr< SwRedlineSaveDatas > m_pRedlineSaveData
virtual ~SwUndoAttr() override
Definition: unattr.cxx:770
std::unique_ptr< SwRedlineData > m_pRedlineData
const SetAttrMode m_nInsertFlags
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1043
const std::unique_ptr< SwHistory > m_pHistory
SwUndoChangeFootNote(const SwPaM &rRange, OUString aText, bool bIsEndNote)
Definition: unattr.cxx:1029
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1055
virtual ~SwUndoChangeFootNote() override
Definition: unattr.cxx:1039
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:1063
const OUString m_Text
std::optional< SfxItemSet > m_oOldSet
SwUndoDefaultAttr(const SfxItemSet &rOldSet, const SwDoc &rDoc)
Definition: unattr.cxx:940
virtual ~SwUndoDefaultAttr() override
Definition: unattr.cxx:956
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:983
std::unique_ptr< SvxTabStopItem > m_pTabStop
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:960
const sal_Int32 m_nContentIndex
const SwNodeOffset m_nNodeIndex
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1138
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1128
SwUndoDontExpandFormat(const SwPosition &rPos)
Definition: unattr.cxx:1121
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:1148
std::unique_ptr< SwEndNoteInfo > m_pEndNoteInfo
SwUndoEndNoteInfo(const SwEndNoteInfo &rInfo, const SwDoc &rDoc)
Definition: unattr.cxx:1095
virtual ~SwUndoEndNoteInfo() override
Definition: unattr.cxx:1101
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1105
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1113
std::unique_ptr< SwFootnoteInfo > m_pFootNoteInfo
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1087
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1079
virtual ~SwUndoFootNoteInfo() override
Definition: unattr.cxx:1075
SwUndoFootNoteInfo(const SwFootnoteInfo &rInfo, const SwDoc &rDoc)
Definition: unattr.cxx:1069
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:298
const sal_uInt16 m_nFormatWhich
SwUndoFormatAttr(SfxItemSet &&rOldSet, SwFormat &rFormat, bool bSaveDrawPt)
Definition: unattr.cxx:116
bool RestoreFlyAnchor(::sw::UndoRedoContext &rContext)
Definition: unattr.cxx:422
void SaveFlyAnchor(const SwFormat *pFormat, bool bSaveDrawPt=false)
Definition: unattr.cxx:384
void Init(const SwFormat &rFormat)
Definition: unattr.cxx:149
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:305
virtual SwRewriter GetRewriter() const override
Returns the rewriter for this object.
Definition: unattr.cxx:361
SwFormat * GetFormat(const SwDoc &rDoc)
Definition: unattr.cxx:241
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:370
void BroadcastStyleChange()
Definition: unattr.cxx:583
SwUndoFormatResetAttr(SwFormat &rChangedFormat, const std::vector< sal_uInt16 > &rIds)
Definition: unattr.cxx:551
virtual ~SwUndoFormatResetAttr() override
Definition: unattr.cxx:565
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:569
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:575
SwFormat *const m_pChangedFormat
virtual ~SwUndoMoveLeftMargin() override
Definition: unattr.cxx:997
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1001
const std::unique_ptr< SwHistory > m_pHistory
SwUndoMoveLeftMargin(const SwPaM &, bool bRight, bool bModulus)
Definition: unattr.cxx:988
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:1022
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:1012
void SetAttrs(o3tl::sorted_vector< sal_uInt16 > &&rAttrs)
Definition: unattr.cxx:727
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:617
const std::unique_ptr< SwHistory > m_pHistory
SwUndoResetAttr(const SwPaM &, sal_uInt16 nFormatId)
Definition: unattr.cxx:597
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unattr.cxx:708
SwHistory & GetHistory()
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unattr.cxx:638
virtual ~SwUndoResetAttr() override
Definition: unattr.cxx:613
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:1519
SwUndoId GetId() const
Definition: undobj.hxx:102
static bool FillSaveDataForFormat(const SwPaM &, SwRedlineSaveDatas &)
Definition: undobj.cxx:1489
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
std::vector< bool, std::allocator< bool > > m_aSet
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
SfxStyleFamily
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