LibreOffice Module sw (master) 1
unins.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 <UndoInsert.hxx>
21
22#include <hintids.hxx>
24#include <editeng/keepitem.hxx>
25#include <svx/svdobj.hxx>
26#include <osl/diagnose.h>
27
28#include <fmtcntnt.hxx>
29#include <frmfmt.hxx>
30#include <doc.hxx>
31#include <IDocumentUndoRedo.hxx>
36#include <swundo.hxx>
37#include <pam.hxx>
38#include <ndtxt.hxx>
39#include <UndoCore.hxx>
40#include <UndoDelete.hxx>
41#include <UndoAttribute.hxx>
42#include <rolbck.hxx>
43#include <ndgrf.hxx>
44#include <ndole.hxx>
45#include <grfatr.hxx>
46#include <cntfrm.hxx>
47#include <flyfrm.hxx>
48#include <swcrsr.hxx>
49#include <swtable.hxx>
50#include <redline.hxx>
51#include <docary.hxx>
52#include <acorrect.hxx>
53
54#include <strings.hrc>
55#include <utility>
56
57using namespace ::com::sun::star;
58
59// INSERT
60
61std::optional<OUString> SwUndoInsert::GetTextFromDoc() const
62{
63 std::optional<OUString> aResult;
64
66 SwContentNode* pCNd = aNd.GetNode().GetContentNode();
67
68 if( pCNd->IsTextNode() )
69 {
70 OUString sText = pCNd->GetTextNode()->GetText();
71
72 sal_Int32 nStart = m_nContent-m_nLen;
73 sal_Int32 nLength = m_nLen;
74
75 if (nStart < 0)
76 {
77 nLength += nStart;
78 nStart = 0;
79 }
80
81 aResult = sText.copy(nStart, nLength);
82 }
83
84 return aResult;
85}
86
87void SwUndoInsert::Init(const SwNode & rNd)
88{
89 // consider Redline
90 m_pDoc = const_cast<SwDoc*>(&rNd.GetDoc());
92 {
93 m_pRedlData.reset( new SwRedlineData( RedlineType::Insert,
96 }
97
99
100 m_bCacheComment = false;
101}
102
103SwUndoInsert::SwUndoInsert( const SwNode& rNd, sal_Int32 nCnt,
104 sal_Int32 nL,
105 const SwInsertFlags nInsertFlags,
106 bool bWDelim )
107 : SwUndo(SwUndoId::TYPING, &rNd.GetDoc()),
108 m_nNode( rNd.GetIndex() ), m_nContent(nCnt), m_nLen(nL),
109 m_bIsWordDelim( bWDelim ), m_bIsAppend( false )
110 , m_bWithRsid(false)
111 , m_nInsertFlags(nInsertFlags)
112{
113 Init(rNd);
114}
115
117 : SwUndo(SwUndoId::SPLITNODE, &rNd.GetDoc()),
118 m_nNode( rNd.GetIndex() ), m_nContent(0), m_nLen(1),
119 m_bIsWordDelim( false ), m_bIsAppend( true )
120 , m_bWithRsid(false)
121 , m_nInsertFlags(SwInsertFlags::EMPTYEXPAND)
122{
123 Init(rNd);
124}
125
126// Check if the next Insert can be combined with the current one. If so
127// change the length and InsPos. As a result, SwDoc::Inser will not add a
128// new object into the Undo list.
129
131{
132 if( !m_bIsAppend && m_bIsWordDelim ==
133 !GetAppCharClass().isLetterNumeric( OUString( cIns )) )
134 {
135 m_nLen++;
136 m_nContent++;
137
138 if (maUndoText)
139 (*maUndoText) += OUStringChar(cIns);
140
141 return true;
142 }
143 return false;
144}
145
147{
148 bool bRet = false;
149 if( m_nNode == rPos.GetNodeIndex() &&
150 m_nContent == rPos.GetContentIndex() )
151 {
152 // consider Redline
153 SwDoc& rDoc = rPos.GetNode().GetDoc();
156 {
157 bRet = true;
158
159 // then there is or was still an active Redline:
160 // Check if there is another Redline at the InsPosition. If the
161 // same exists only once, it can be combined.
163 if( !rTable.empty() )
164 {
165 SwRedlineData aRData( RedlineType::Insert, rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() );
166 const SwContentNode* pIReg = rPos.GetContentNode();
167 for(SwRangeRedline* pRedl : rTable)
168 {
169 const SwPosition& rIdx = *pRedl->End();
170 if( pIReg == rIdx.GetContentNode() &&
171 m_nContent == rIdx.GetContentIndex() )
172 {
173 if( !pRedl->HasMark() || !m_pRedlData ||
174 *pRedl != *m_pRedlData || *pRedl != aRData )
175 {
176 bRet = false;
177 break;
178 }
179 }
180 }
181 }
182 }
183 }
184 return bRet;
185}
186
188{
189 if (m_oUndoNodeIndex) // delete the section from UndoNodes array
190 {
191 // Insert saves the content in IconSection
192 SwNodes& rUNds = m_oUndoNodeIndex->GetNodes();
194 rUNds.GetEndOfExtras().GetIndex() - m_oUndoNodeIndex->GetIndex());
195 m_oUndoNodeIndex.reset();
196 }
197 else // the inserted text
198 {
199 maText.reset();
200 }
201 m_pRedlData.reset();
202}
203
205{
206 SwDoc *const pTmpDoc = & rContext.GetDoc();
207 SwCursor *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
208
209 if( m_bIsAppend )
210 {
211 pPam->GetPoint()->Assign(m_nNode);
212
214 {
215 pPam->SetMark();
216 pPam->Move( fnMoveBackward );
217 pPam->Exchange();
218 pTmpDoc->getIDocumentRedlineAccess().DeleteRedline( *pPam, true, RedlineType::Any );
219 }
220 pPam->DeleteMark();
221 pTmpDoc->getIDocumentContentOperations().DelFullPara( *pPam );
222 pPam->GetPoint()->SetContent( 0 );
223 }
224 else
225 {
226 SwNodeOffset nNd = m_nNode;
227 sal_Int32 nCnt = m_nContent;
228 if( m_nLen )
229 {
230 SwNodeIndex aNd( pTmpDoc->GetNodes(), m_nNode);
231 SwContentNode* pCNd = aNd.GetNode().GetContentNode();
232 SwPaM aPaM( *pCNd, m_nContent );
233
234 aPaM.SetMark();
235
236 SwTextNode * const pTextNode( pCNd->GetTextNode() );
237 if ( pTextNode )
238 {
239 aPaM.GetPoint()->AdjustContent( - m_nLen );
241 pTmpDoc->getIDocumentRedlineAccess().DeleteRedline( aPaM, true, RedlineType::Any );
242 if (m_bWithRsid)
243 {
244 // RSID was added: remove any CHARFMT/AUTOFMT that may be
245 // set on the deleted text; EraseText will leave empty
246 // ones behind otherwise
248 aPaM.GetPoint()->GetContentIndex(),
249 aPaM.GetMark()->GetContentIndex());
251 aPaM.GetPoint()->GetContentIndex(),
252 aPaM.GetMark()->GetContentIndex());
253 }
254 RemoveIdxFromRange( aPaM, false );
255 maText = pTextNode->GetText().copy(m_nContent-m_nLen, m_nLen);
256 pTextNode->EraseText( *aPaM.GetPoint(), m_nLen );
257 }
258 else // otherwise Graphics/OLE/Text/...
259 {
260 aPaM.Move(fnMoveBackward);
262 pTmpDoc->getIDocumentRedlineAccess().DeleteRedline( aPaM, true, RedlineType::Any );
263 RemoveIdxFromRange( aPaM, false );
264 }
265
266 nNd = aPaM.GetPoint()->GetNodeIndex();
267 nCnt = aPaM.GetPoint()->GetContentIndex();
268
269 if (!maText)
270 {
273 }
274 m_nNode = aPaM.GetPoint()->GetNodeIndex();
276 }
277
278 // set cursor to Undo range
279 pPam->DeleteMark();
280
281 pPam->GetPoint()->Assign( nNd, nCnt );
282 }
283
284 maUndoText.reset();
285}
286
288{
289 SwDoc *const pTmpDoc = & rContext.GetDoc();
290 SwCursor *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
291 pPam->DeleteMark();
292
293 if( m_bIsAppend )
294 {
295 pPam->GetPoint()->Assign( m_nNode - 1 );
297
298 pPam->SetMark();
299 pPam->Move( fnMoveBackward );
300 pPam->Exchange();
301
303 {
306 pTmpDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *m_pRedlData, *pPam ), true);
308 }
309 else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
311 pTmpDoc->getIDocumentRedlineAccess().SplitRedline( *pPam );
312
313 pPam->DeleteMark();
314 }
315 else
316 {
317 pPam->GetPoint()->Assign( m_nNode );
318 SwContentNode *const pCNd =
319 pPam->GetPoint()->GetNode().GetContentNode();
320 pPam->GetPoint()->SetContent( m_nContent );
321
322 if( m_nLen )
323 {
324 const bool bMvBkwrd = MovePtBackward( *pPam );
325
326 if (maText)
327 {
328 SwTextNode *const pTextNode = pCNd->GetTextNode();
329 OSL_ENSURE( pTextNode, "where is my textnode ?" );
330 OUString const ins(
331 pTextNode->InsertText( *maText, *pPam->GetMark(),
333 assert(ins.getLength() == maText->getLength()); // must succeed
334 maText.reset();
335 if (m_bWithRsid) // re-insert RSID
336 {
337 SwPaM pam(*pPam->GetMark(), nullptr); // mark -> point
338 pTmpDoc->UpdateRsid(pam, ins.getLength());
339 }
340 }
341 else
342 {
343 // re-insert content again (first detach m_oUndoNodeIndex!)
344 SwNodeOffset const nMvNd = m_oUndoNodeIndex->GetIndex();
345 m_oUndoNodeIndex.reset();
346 MoveFromUndoNds(*pTmpDoc, nMvNd, *pPam->GetMark());
347 }
348 m_nNode = pPam->GetMark()->GetNodeIndex();
350
351 MovePtForward( *pPam, bMvBkwrd );
352 pPam->Exchange();
354 {
358 *pPam ), true);
360 }
361 else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
363 pTmpDoc->getIDocumentRedlineAccess().SplitRedline(*pPam);
364 }
365 }
366
368}
369
371{
372 if( !m_nLen )
373 return;
374
375 SwDoc & rDoc = rContext.GetDoc();
376 SwNodeIndex aNd( rDoc.GetNodes(), m_nNode );
377 SwContentNode* pCNd = aNd.GetNode().GetContentNode();
378
379 if( !m_bIsAppend && 1 == m_nLen ) // >1 than always Text, otherwise Graphics/OLE/Text/...
380 {
381 SwPaM aPaM( *pCNd, m_nContent );
382 aPaM.SetMark();
383 aPaM.Move(fnMoveBackward);
384 pCNd = aPaM.GetPointContentNode();
385 }
386
387// What happens with the possible selected range ???
388
389 switch( pCNd->GetNodeType() )
390 {
391 case SwNodeType::Text:
392 if( m_bIsAppend )
393 {
395 }
396 else
397 {
398 OUString const aText( pCNd->GetTextNode()->GetText() );
399 ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
401 aText.copy(m_nContent - m_nLen, m_nLen) );
402 }
403 break;
404 case SwNodeType::Grf:
405 {
406 SwGrfNode* pGrfNd = static_cast<SwGrfNode*>(pCNd);
407 OUString sFile;
408 OUString sFilter;
409 if( pGrfNd->IsGrfLink() )
410 pGrfNd->GetFileFilterNms( &sFile, &sFilter );
411
413 rContext.GetRepeatPaM(), sFile, sFilter,
414 &pGrfNd->GetGrf(),
415 nullptr/* Graphics collection*/, nullptr, nullptr );
416 }
417 break;
418
419 case SwNodeType::Ole:
420 {
421 // StarView does not yet provide an option to copy a StarOBJ
422 SwOLEObj& rSwOLE = static_cast<SwOLENode*>(pCNd)->GetOLEObj();
423
424 // temporary storage until object is inserted
425 // TODO/MBA: seems that here a physical copy is done - not as in drawing layer! Testing!
426 // TODO/LATER: Copying through the container would copy the replacement image as well
428 OUString aName = aCnt.CreateUniqueObjectName();
429 if (aCnt.StoreEmbeddedObject(rSwOLE.GetOleRef(), aName, true, OUString(), OUString()))
430 {
431 uno::Reference < embed::XEmbeddedObject > aNew = aCnt.GetEmbeddedObject( aName );
433 rContext.GetRepeatPaM(),
435 static_cast<SwOLENode*>(pCNd)->GetAspect() ),
436 nullptr );
437 }
438
439 break;
440 }
441
442 default: break;
443 }
444}
445
447{
448 SwRewriter aResult;
449 std::optional<OUString> aStr;
450 bool bDone = false;
451
452 if (maText)
453 aStr = maText;
454 else if (maUndoText)
456
457 if (aStr)
458 {
459 OUString aString = ShortenString(DenoteSpecialCharacters(*aStr),
461 SwResId(STR_LDOTS));
462
463 aResult.AddRule(UndoArg1, aString);
464
465 bDone = true;
466 }
467
468 if ( ! bDone )
469 {
470 aResult.AddRule(UndoArg1, "??");
471 }
472
473 return aResult;
474}
475
477{
478 return m_nNode != rOther.m_nNode;
479}
480
482 : private SwUndoSaveContent
483{
484 OUString m_sOld;
485 OUString m_sIns;
488 bool m_bSplitNext : 1;
489 bool m_bRegExp : 1;
490 // metadata references for paragraph and following para (if m_bSplitNext)
491 std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
492 std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
493
494public:
495 Impl(SwPaM const& rPam, OUString aIns, bool const bRegExp);
496
499
500 void SetEnd(SwPaM const& rPam);
501
502 OUString const& GetOld() const { return m_sOld; }
503 OUString const& GetIns() const { return m_sIns; }
504};
505
507 OUString const& rIns, bool const bRegExp)
508 : SwUndo( SwUndoId::REPLACE, &rPam.GetDoc() )
509 , m_pImpl(std::make_unique<Impl>(rPam, rIns, bRegExp))
510{
511}
512
514{
515}
516
518{
519 m_pImpl->UndoImpl(rContext);
520}
521
523{
524 m_pImpl->RedoImpl(rContext);
525}
526
529 OUString const& sOld, OUString const& sNew)
530{
531 SwRewriter aResult;
532
533 if (1 < occurrences)
534 {
535 aResult.AddRule(UndoArg1, OUString::number(occurrences));
536 aResult.AddRule(UndoArg2, SwResId(STR_OCCURRENCES_OF));
537
538 OUString aTmpStr = SwResId(STR_START_QUOTE);
539 aTmpStr += ShortenString(sOld, nUndoStringLength,
540 SwResId(STR_LDOTS));
541 aTmpStr += SwResId(STR_END_QUOTE);
542 aResult.AddRule(UndoArg3, aTmpStr);
543 }
544 else if (1 == occurrences)
545 {
546 {
547 OUString aTmpStr = SwResId(STR_START_QUOTE);
548 // #i33488 #
549 aTmpStr += ShortenString(sOld, nUndoStringLength,
550 SwResId(STR_LDOTS));
551 aTmpStr += SwResId(STR_END_QUOTE);
552 aResult.AddRule(UndoArg1, aTmpStr);
553 }
554
555 aResult.AddRule(UndoArg2, SwResId(STR_YIELDS));
556
557 {
558 OUString aTmpStr = SwResId(STR_START_QUOTE);
559 // #i33488 #
560 aTmpStr += ShortenString(sNew, nUndoStringLength,
561 SwResId(STR_LDOTS));
562 aTmpStr += SwResId(STR_END_QUOTE);
563 aResult.AddRule(UndoArg3, aTmpStr);
564 }
565 }
566
567 return aResult;
568}
569
571{
572 return MakeUndoReplaceRewriter(1, m_pImpl->GetOld(), m_pImpl->GetIns());
573}
574
576{
577 m_pImpl->SetEnd(rPam);
578}
579
581 SwPaM const& rPam, OUString aIns, bool const bRegExp)
582 : m_sIns(std::move( aIns ))
583 , m_nOffset( 0 )
584 , m_bRegExp(bRegExp)
585{
586
587 auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
588
589 m_nSttNd = m_nEndNd = pStt->GetNodeIndex();
590 m_nSttCnt = pStt->GetContentIndex();
591 m_nSelEnd = m_nEndCnt = pEnd->GetContentIndex();
592
593 m_bSplitNext = m_nSttNd != pEnd->GetNodeIndex();
594
595 SwTextNode* pNd = pStt->GetNode().GetTextNode();
596 OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
597
598 m_pHistory.reset( new SwHistory );
600
601 m_nSetPos = m_pHistory->Count();
602
603 SwNodeOffset nNewPos = pStt->GetNodeIndex();
604 m_nOffset = m_nSttNd - nNewPos;
605
606 if ( pNd->GetpSwpHints() )
607 {
608 m_pHistory->CopyAttr( pNd->GetpSwpHints(), nNewPos, 0,
609 pNd->GetText().getLength(), true );
610 }
611
612 if ( m_bSplitNext )
613 {
614 if( pNd->HasSwAttrSet() )
615 m_pHistory->CopyFormatAttr( *pNd->GetpSwAttrSet(), nNewPos );
616 m_pHistory->Add( pNd->GetTextColl(), nNewPos, SwNodeType::Text );
617
618 SwTextNode* pNext = pEnd->GetNode().GetTextNode();
619 SwNodeOffset nTmp = pNext->GetIndex();
620 m_pHistory->CopyAttr( pNext->GetpSwpHints(), nTmp, 0,
621 pNext->GetText().getLength(), true );
622 if( pNext->HasSwAttrSet() )
623 m_pHistory->CopyFormatAttr( *pNext->GetpSwAttrSet(), nTmp );
624 m_pHistory->Add( pNext->GetTextColl(),nTmp, SwNodeType::Text );
625 // METADATA: store
628 }
629
630 if( !m_pHistory->Count() )
631 {
632 m_pHistory.reset();
633 }
634
635 const sal_Int32 nECnt = m_bSplitNext ? pNd->GetText().getLength()
636 : pEnd->GetContentIndex();
637 m_sOld = pNd->GetText().copy( m_nSttCnt, nECnt - m_nSttCnt );
638}
639
641{
642 SwDoc *const pDoc = & rContext.GetDoc();
644 rPam.DeleteMark();
645
646 SwTextNode* pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
647 OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
648
650 if( pACEWord )
651 {
652 if ((1 == m_sIns.getLength()) && (1 == m_sOld.getLength()))
653 {
654 SwPosition aPos( *pNd, m_nSttCnt );
655 pACEWord->CheckChar( aPos, m_sOld[ 0 ] );
656 }
657 pDoc->SetAutoCorrExceptWord( nullptr );
658 }
659
660 // don't look at m_sIns for deletion, maybe it was not completely inserted
661 {
662 rPam.GetPoint()->Assign(*pNd, m_nSttCnt );
663 rPam.SetMark();
664 rPam.GetPoint()->Assign( m_nSttNd - m_nOffset, m_nSttNd == m_nEndNd ? m_nEndCnt : pNd->Len());
665
666 // replace only in start node, without regex
667 bool const ret = pDoc->getIDocumentContentOperations().ReplaceRange(rPam, m_sOld, false);
668 assert(ret); (void)ret;
669 if (m_nSttNd != m_nEndNd)
670 { // in case of regex inserting paragraph breaks, join nodes...
671 assert(rPam.GetMark()->GetContentIndex() == rPam.GetMark()->GetNode().GetTextNode()->Len());
672 rPam.GetPoint()->Assign( m_nEndNd - m_nOffset, m_nEndCnt );
674 }
675 rPam.DeleteMark();
676 pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
677 OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
678 }
679
680 if( m_bSplitNext )
681 {
682 assert(m_nSttCnt + m_sOld.getLength() <= pNd->Len());
683 SwPosition aPos(*pNd, m_nSttCnt + m_sOld.getLength());
684 pDoc->getIDocumentContentOperations().SplitNode( aPos, false );
685 pNd->RestoreMetadata(m_pMetadataUndoEnd);
686 pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
687 // METADATA: restore
688 pNd->RestoreMetadata(m_pMetadataUndoStart);
689 }
690
691 if( m_pHistory )
692 {
693 if( pNd->GetpSwpHints() )
694 pNd->ClearSwpHintsArr( true );
695
696 m_pHistory->TmpRollback( pDoc, m_nSetPos, false );
697 if ( m_nSetPos ) // there were footnotes/FlyFrames
698 {
699 // are there others than these?
700 if( m_nSetPos < m_pHistory->Count() )
701 {
702 // than save those attributes as well
703 SwHistory aHstr;
704 aHstr.Move( 0, m_pHistory.get(), m_nSetPos );
705 m_pHistory->Rollback( pDoc );
706 m_pHistory->Move( 0, &aHstr );
707 }
708 else
709 {
710 m_pHistory->Rollback( pDoc );
711 m_pHistory.reset();
712 }
713 }
714 }
715
716 rPam.GetPoint()->Assign( m_nSttNd, m_nSttCnt );
717}
718
720{
721 SwDoc & rDoc = rContext.GetDoc();
723 rPam.DeleteMark();
724 rPam.GetPoint()->Assign( m_nSttNd, m_nSttCnt );
725
726 rPam.SetMark();
727 if( m_bSplitNext )
728 rPam.GetPoint()->Assign( m_nSttNd + 1 );
729 rPam.GetPoint()->SetContent( m_nSelEnd );
730
731 if( m_pHistory )
732 {
733 auto xSave = std::make_unique<SwHistory>();
734 std::swap(m_pHistory, xSave);
735
736 DelContentIndex(*rPam.GetMark(), *rPam.GetPoint(), DelContentType::AllMask | DelContentType::Replace);
737 m_nSetPos = m_pHistory->Count();
738
739 std::swap(xSave, m_pHistory);
740 m_pHistory->Move(0, xSave.get());
741 }
742 else
743 {
744 m_pHistory.reset( new SwHistory );
745 DelContentIndex(*rPam.GetMark(), *rPam.GetPoint(), DelContentType::AllMask | DelContentType::Replace);
746 m_nSetPos = m_pHistory->Count();
747 if( !m_nSetPos )
748 {
749 m_pHistory.reset();
750 }
751 }
752
753 rDoc.getIDocumentContentOperations().ReplaceRange( rPam, m_sIns, m_bRegExp );
754 rPam.DeleteMark();
755}
756
758{
759 const SwPosition* pEnd = rPam.End();
760 m_nEndNd = m_nOffset + pEnd->GetNodeIndex();
761 m_nEndCnt = pEnd->GetContentIndex();
762}
763
764SwUndoReRead::SwUndoReRead( const SwPaM& rPam, const SwGrfNode& rGrfNd )
765 : SwUndo( SwUndoId::REREAD, &rPam.GetDoc() ), mnPosition( rPam.GetPoint()->GetNodeIndex() )
766{
767 SaveGraphicData( rGrfNd );
768}
769
771{
772}
773
775{
776 SwDoc & rDoc = rContext.GetDoc();
777 SwGrfNode* pGrfNd = rDoc.GetNodes()[ mnPosition ]->GetGrfNode();
778
779 if( !pGrfNd )
780 return ;
781
782 // cache the old values
783 std::optional<Graphic> oOldGrf(moGraphic);
784 std::optional<OUString> aOldNm = maNm;
785 MirrorGraph nOldMirr = mnMirror;
786 // since all of them are cleared/modified by SaveGraphicData:
787 SaveGraphicData( *pGrfNd );
788
789 if( aOldNm )
790 {
791 pGrfNd->ReRead( *aOldNm, maFltr ? *maFltr : OUString() );
792 }
793 else
794 {
795 pGrfNd->ReRead( OUString(), OUString(), oOldGrf ? &*oOldGrf : nullptr );
796 }
797
798 if( MirrorGraph::Dont != nOldMirr )
799 pGrfNd->SetAttr( SwMirrorGrf() );
800
801 rContext.SetSelections(pGrfNd->GetFlyFormat(), nullptr);
802}
803
805{
806 SetAndSave(rContext);
807}
808
810{
811 SetAndSave(rContext);
812}
813
815{
816 if( rGrfNd.IsGrfLink() )
817 {
818 maNm = OUString();
819 maFltr = OUString();
820 rGrfNd.GetFileFilterNms(&*maNm, &*maFltr);
821 moGraphic.reset();
822 }
823 else
824 {
825 moGraphic.emplace( rGrfNd.GetGrf(true) );
826 maNm.reset();
827 maFltr.reset();
828 }
830}
831
833 OUString aText,
834 OUString aSeparator,
835 OUString aNumberSeparator,
836 const bool bBef,
837 const sal_uInt16 nInitId,
838 OUString aCharacterStyle,
839 const bool bCpyBorder,
840 const SwDoc* pDoc )
841 : SwUndo( SwUndoId::INSERTLABEL, pDoc ),
842 m_sText(std::move( aText )),
843 m_sSeparator(std::move( aSeparator )),
844 m_sNumberSeparator(std::move( aNumberSeparator )),//#i61007# order of captions
845 m_sCharacterStyle(std::move( aCharacterStyle )),
846 m_nFieldId( nInitId ),
847 m_eType( eTyp ),
848 m_nLayerId( 0 ),
849 m_bBefore( bBef ),
850 m_bCopyBorder( bCpyBorder )
851{
852 m_bUndoKeep = false;
853 OBJECT.pUndoFly = nullptr;
854 OBJECT.pUndoAttr = nullptr;
855}
856
858{
860 {
861 delete OBJECT.pUndoFly;
862 delete OBJECT.pUndoAttr;
863 }
864 else
865 delete NODE.pUndoInsNd;
866}
867
869{
870 SwDoc & rDoc = rContext.GetDoc();
871
873 {
874 OSL_ENSURE( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer not initialized" );
875 SwFrameFormat* pFormat;
876 SdrObject *pSdrObj = nullptr;
877 if( OBJECT.pUndoAttr &&
878 nullptr != (pFormat = static_cast<SwFrameFormat*>(OBJECT.pUndoAttr->GetFormat( rDoc ))) &&
880 nullptr != (pSdrObj = pFormat->FindSdrObject()) ) )
881 {
882 OBJECT.pUndoAttr->UndoImpl(rContext);
883 OBJECT.pUndoFly->UndoImpl(rContext);
885 {
886 pSdrObj->SetLayer( m_nLayerId );
887 }
888 }
889 }
890 else if( NODE.nNode )
891 {
893 {
894 SwTableNode *pNd = rDoc.GetNodes()[
895 rDoc.GetNodes()[NODE.nNode-1]->StartOfSectionIndex()]->GetTableNode();
896 if ( pNd )
898 }
899 SwPaM aPam( rDoc.GetNodes().GetEndOfContent() );
900 aPam.GetPoint()->Assign( NODE.nNode );
901 aPam.SetMark();
902 aPam.GetPoint()->Assign( NODE.nNode + 1 );
903 NODE.pUndoInsNd = new SwUndoDelete(aPam, SwDeleteFlags::Default, true);
904 }
905}
906
908{
909 SwDoc & rDoc = rContext.GetDoc();
910
912 {
913 OSL_ENSURE( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer not initialized" );
914 SwFrameFormat* pFormat;
915 SdrObject *pSdrObj = nullptr;
916 if( OBJECT.pUndoAttr &&
917 nullptr != (pFormat = static_cast<SwFrameFormat*>(OBJECT.pUndoAttr->GetFormat( rDoc ))) &&
919 nullptr != (pSdrObj = pFormat->FindSdrObject()) ) )
920 {
921 OBJECT.pUndoFly->RedoImpl(rContext);
922 OBJECT.pUndoAttr->RedoImpl(rContext);
924 {
925 pSdrObj->SetLayer( m_nLayerId );
926 if( pSdrObj->GetLayer() == rDoc.getIDocumentDrawModelAccess().GetHellId() )
928 // OD 02.07.2003 #108784#
929 else if( pSdrObj->GetLayer() == rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId() )
931 }
932 }
933 }
934 else if( NODE.pUndoInsNd )
935 {
937 {
938 SwTableNode *pNd = rDoc.GetNodes()[
939 rDoc.GetNodes()[NODE.nNode-1]->StartOfSectionIndex()]->GetTableNode();
940 if ( pNd )
942 }
943 NODE.pUndoInsNd->UndoImpl(rContext);
944 delete NODE.pUndoInsNd;
945 NODE.pUndoInsNd = nullptr;
946 }
947}
948
950{
951 SwDoc & rDoc = rContext.GetDoc();
952 const SwPosition& rPos = *rContext.GetRepeatPaM().GetPoint();
953
954 SwNodeOffset nIdx(0);
955
956 SwContentNode* pCNd = rPos.GetNode().GetContentNode();
957 if( pCNd )
958 switch( m_eType )
959 {
961 {
962 const SwTableNode* pTNd = pCNd->FindTableNode();
963 if( pTNd )
964 nIdx = pTNd->GetIndex();
965 }
966 break;
967
968 case SwLabelType::Fly:
970 {
971 SwFlyFrame* pFly;
973 if( pCnt && nullptr != ( pFly = pCnt->FindFlyFrame() ) )
974 nIdx = pFly->GetFormat()->GetContent().GetContentIdx()->GetIndex();
975 }
976 break;
978 break;
979 }
980
981 if( nIdx )
982 {
985 }
986}
987
989{
990 return CreateRewriter(m_sText);
991}
992
994{
995 SwRewriter aRewriter;
996
997 OUString aTmpStr;
998
999 if (!rStr.isEmpty())
1000 {
1001 aTmpStr += SwResId(STR_START_QUOTE);
1002 aTmpStr += ShortenString(rStr, nUndoStringLength,
1003 SwResId(STR_LDOTS));
1004 aTmpStr += SwResId(STR_END_QUOTE);
1005 }
1006
1007 aRewriter.AddRule(UndoArg1, aTmpStr);
1008
1009 return aRewriter;
1010}
1011
1013 SwFrameFormat& rNewFly )
1014{
1016 {
1017 SwUndoFormatAttrHelper aTmp( rOldFly, false );
1018 rOldFly.SetFormatAttr( rChgSet );
1019 if ( aTmp.GetUndo() )
1020 {
1021 OBJECT.pUndoAttr = aTmp.ReleaseUndo().release();
1022 }
1023 OBJECT.pUndoFly = new SwUndoInsLayFormat( &rNewFly, SwNodeOffset(0), 0 );
1024 }
1025}
1026
1028{
1029 if( SwLabelType::Draw == m_eType )
1030 {
1031 m_nLayerId = nLId;
1032 }
1033}
1034
1035/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ Ignore
ignore Redlines
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
@ UndoArg1
Definition: SwRewriter.hxx:29
@ UndoArg3
Definition: SwRewriter.hxx:31
@ UndoArg2
Definition: SwRewriter.hxx:30
OUString DenoteSpecialCharacters(const OUString &rStr, bool bQuoted=true)
Denotes special characters in a string.
Definition: undel.cxx:719
const int nUndoStringLength
Definition: UndoCore.hxx:243
OUString ShortenString(const OUString &rStr, sal_Int32 nLength, const OUString &rFillStr)
Shortens a string to a maximum length.
Definition: undobj.cxx:1538
const sal_uInt64 mnPosition
virtual bool AppendTextNode(SwPosition &rPos)=0
virtual bool DeleteAndJoin(SwPaM &, SwDeleteFlags flags=SwDeleteFlags::Default)=0
complete delete of a given PaM
virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart)=0
Split a node at rPos (implemented only for TextNode).
virtual SwFlyFrameFormat * InsertGraphic(const SwPaM &rRg, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet, SwFrameFormat *)=0
Insert graphic or formula.
virtual bool DelFullPara(SwPaM &)=0
Delete full paragraphs.
virtual bool ReplaceRange(SwPaM &rPam, const OUString &rNewStr, const bool bRegExReplace)=0
Replace selected range in a TextNode with string.
virtual SwFlyFrameFormat * InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef &xObj, SfxItemSet *pFlyAttrSet)=0
Insert OLE-objects.
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
virtual SdrLayerID GetHellId() const =0
virtual SdrLayerID GetInvisibleHellId() const =0
virtual SdrLayerID GetHeavenId() const =0
virtual SdrLayerID GetInvisibleHeavenId() const =0
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual bool IsRedlineOn() const =0
Query if redlining is on.
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
static bool IsRedlineOn(const RedlineFlags eM)
virtual std::size_t GetRedlineAuthor()=0
virtual bool SplitRedline(const SwPaM &rPam)=0
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual SdrLayerID GetLayer() const
virtual void SetLayer(SdrLayerID nLayer)
EnumT GetValue() const
const SwMirrorGrf & GetMirrorGrf(bool=true) const
Definition: grfatr.hxx:282
void CheckChar(const SwPosition &rPos, sal_Unicode cChar)
Definition: acorrect.cxx:614
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:58
bool HasSwAttrSet() const
Definition: node.hxx:473
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1224
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:742
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1586
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:472
Definition: doc.hxx:192
SwAutoCorrExceptWord * GetAutoCorrExceptWord()
Definition: doc.hxx:1395
SwFlyFrameFormat * InsertLabel(const SwLabelType eType, const OUString &rText, const OUString &rSeparator, const OUString &rNumberingSeparator, const bool bBefore, const sal_uInt16 nId, const SwNodeOffset nIdx, const OUString &rCharacterStyle, const bool bCpyBrd)
Definition: doclay.cxx:956
void UpdateRsid(const SwPaM &rRg, sal_Int32 nLen)
Set the rsid of the next nLen symbols of rRg to the current session number.
Definition: docfmt.cxx:404
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:316
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:145
void SetAutoCorrExceptWord(std::unique_ptr< SwAutoCorrExceptWord > pNew)
Definition: docedt.cxx:813
SwNodes & GetNodes()
Definition: doc.hxx:413
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:336
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:406
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:156
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2897
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:620
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:449
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
Style of a layout element.
Definition: frmfmt.hxx:62
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:141
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1111
const Graphic & GetGrf(bool bWait=false) const
Definition: ndgrf.cxx:373
bool GetFileFilterNms(OUString *pFileNm, OUString *pFilterNm) const
Definition: ndgrf.cxx:494
bool IsGrfLink() const
Query link-data.
Definition: ndgrf.hxx:129
bool ReRead(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic=nullptr, bool bModify=true)
Re-read in case graphic was not OK.
Definition: ndgrf.cxx:130
void Move(sal_uInt16 nPos, SwHistory *pIns, sal_uInt16 const nStart=0)
Definition: rolbck.hxx:386
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:84
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:731
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:876
SwNodeOffset GetIndex() const
Definition: node.hxx:296
SwDoc & GetDoc()
Definition: node.hxx:217
bool IsTextNode() const
Definition: node.hxx:664
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:370
SwContentNode * GetContentNode()
Definition: node.hxx:643
SwNodeType GetNodeType() const
Definition: node.hxx:150
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:163
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:165
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
Definition: nodes.cxx:1071
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:940
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
const SwPosition * GetMark() const
Definition: pam.hxx:263
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:612
void Exchange()
Definition: pam.cxx:626
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
Definition: pam.hxx:277
SwContentNode * GetPointContentNode() const
Definition: pam.hxx:287
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:638
const SwPosition * End() const
Definition: pam.hxx:271
void DeleteMark()
Definition: pam.hxx:231
const SwPosition * GetPoint() const
Definition: pam.hxx:261
bool empty() const
Definition: docary.hxx:266
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
const SwTable & GetTable() const
Definition: node.hxx:521
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:204
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:86
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:1802
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:275
void ClearSwpHintsArr(bool bDelFields)
Definition: thints.cxx:3427
void EraseText(const SwContentIndex &rIdx, const sal_Int32 nCount=SAL_MAX_INT32, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
delete text content ATTENTION: must not be called with a range that overlaps the start of an attribut...
Definition: ndtxt.cxx:2724
OUString InsertText(const OUString &rStr, const SwContentIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2322
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:230
const OUString & GetText() const
Definition: ndtxt.hxx:222
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:870
SwUndoFormatAttr * GetUndo() const
std::unique_ptr< SwUndoFormatAttr > ReleaseUndo()
struct SwUndoInsertLabel::@5::@8 NODE
SwLabelType m_eType
Definition: UndoInsert.hxx:181
OUString m_sNumberSeparator
Definition: UndoInsert.hxx:177
virtual ~SwUndoInsertLabel() override
Definition: unins.cxx:857
sal_uInt16 m_nFieldId
Definition: UndoInsert.hxx:180
void SetFlys(SwFrameFormat &rOldFly, SfxItemSet const &rChgSet, SwFrameFormat &rNewFly)
Definition: unins.cxx:1012
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:907
static SwRewriter CreateRewriter(const OUString &rStr)
Definition: unins.cxx:993
virtual SwRewriter GetRewriter() const override
Returns the rewriter of this undo object.
Definition: unins.cxx:988
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:868
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unins.cxx:949
SdrLayerID m_nLayerId
Definition: UndoInsert.hxx:182
SwUndoInsertLabel(const SwLabelType eTyp, OUString rText, OUString aSeparator, OUString aNumberSeparator, const bool bBefore, const sal_uInt16 nId, OUString aCharacterStyle, const bool bCpyBrd, const SwDoc *pDoc)
Definition: unins.cxx:832
void SetDrawObj(SdrLayerID nLayerId)
Definition: unins.cxx:1027
struct SwUndoInsertLabel::@5::@7 OBJECT
OUString m_sCharacterStyle
Definition: UndoInsert.hxx:178
OUString m_sSeparator
Definition: UndoInsert.hxx:176
Typing one or more characters to a single paragraph.
Definition: UndoInsert.hxx:43
bool m_bWithRsid
Definition: UndoInsert.hxx:53
std::optional< OUString > maText
Definition: UndoInsert.hxx:46
const SwInsertFlags m_nInsertFlags
Definition: UndoInsert.hxx:55
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:287
virtual SwRewriter GetRewriter() const override
Returns rewriter for this undo object.
Definition: unins.cxx:446
virtual ~SwUndoInsert() override
Definition: unins.cxx:187
bool m_bIsWordDelim
Definition: UndoInsert.hxx:51
std::optional< OUString > maUndoText
Definition: UndoInsert.hxx:47
SwNodeOffset m_nNode
Definition: UndoInsert.hxx:49
std::optional< SwNodeIndex > m_oUndoNodeIndex
start of Content in UndoNodes for Redo
Definition: UndoInsert.hxx:45
sal_Int32 m_nContent
Definition: UndoInsert.hxx:50
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:204
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unins.cxx:370
sal_Int32 m_nLen
Definition: UndoInsert.hxx:50
bool IsIndependent(const SwUndoInsert &rOther) const
Definition: unins.cxx:476
SwDoc * m_pDoc
Definition: UndoInsert.hxx:61
bool CanGrouping(sal_Unicode cIns)
Definition: unins.cxx:130
void Init(const SwNode &rNode)
Definition: unins.cxx:87
bool m_bIsAppend
Definition: UndoInsert.hxx:52
SwUndoInsert(const SwNode &rNode, sal_Int32 nContent, sal_Int32 nLen, const SwInsertFlags nInsertFlags, bool bWDelim=true)
Definition: unins.cxx:103
std::optional< OUString > GetTextFromDoc() const
Definition: unins.cxx:61
std::unique_ptr< SwRedlineData > m_pRedlData
Definition: UndoInsert.hxx:48
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:804
void SaveGraphicData(const SwGrfNode &)
Definition: unins.cxx:814
std::optional< Graphic > moGraphic
Definition: UndoInsert.hxx:141
virtual ~SwUndoReRead() override
Definition: unins.cxx:770
SwNodeOffset mnPosition
Definition: UndoInsert.hxx:144
std::optional< OUString > maFltr
Definition: UndoInsert.hxx:143
void SetAndSave(::sw::UndoRedoContext &)
Definition: unins.cxx:774
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:809
MirrorGraph mnMirror
Definition: UndoInsert.hxx:145
std::optional< OUString > maNm
Definition: UndoInsert.hxx:142
SwUndoReRead(const SwPaM &rPam, const SwGrfNode &pGrfNd)
Definition: unins.cxx:764
std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart
Definition: unins.cxx:491
sal_Int32 m_nSelEnd
Definition: unins.cxx:487
sal_Int32 m_nEndCnt
Definition: unins.cxx:487
std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd
Definition: unins.cxx:492
SwNodeOffset m_nEndNd
Definition: unins.cxx:486
void SetEnd(SwPaM const &rPam)
Definition: unins.cxx:757
OUString m_sIns
Definition: unins.cxx:485
OUString m_sOld
Definition: unins.cxx:484
void RedoImpl(::sw::UndoRedoContext &)
Definition: unins.cxx:719
OUString const & GetIns() const
Definition: unins.cxx:503
OUString const & GetOld() const
Definition: unins.cxx:502
SwNodeOffset m_nSttNd
Definition: unins.cxx:486
void UndoImpl(::sw::UndoRedoContext &)
Definition: unins.cxx:640
SwNodeOffset m_nOffset
Definition: unins.cxx:486
sal_Int32 m_nSttCnt
Definition: unins.cxx:487
sal_Int32 m_nSetPos
Definition: unins.cxx:487
Impl(SwPaM const &rPam, OUString aIns, bool const bRegExp)
Definition: unins.cxx:580
virtual SwRewriter GetRewriter() const override
Returns the rewriter of this undo object.
Definition: unins.cxx:570
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:522
SwUndoReplace(SwPaM const &rPam, OUString const &rInsert, bool const bRegExp)
Definition: unins.cxx:506
std::unique_ptr< Impl > m_pImpl
Definition: UndoInsert.hxx:135
virtual ~SwUndoReplace() override
Definition: unins.cxx:513
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:517
void SetEnd(const SwPaM &rPam)
Definition: unins.cxx:575
static void MoveFromUndoNds(SwDoc &rDoc, SwNodeOffset nNodeIdx, SwPosition &rInsPos, const SwNodeOffset *pEndNdIdx=nullptr, bool bForceCreateFrames=false)
Definition: undobj.cxx:757
void DelContentIndex(const SwPosition &pMark, const SwPosition &pPoint, DelContentType nDelContentType=DelContentType::AllMask)
Definition: undobj.cxx:861
static void MoveToUndoNds(SwPaM &rPam, SwNodeIndex *pNodeIdx, SwNodeOffset *pEndNdIdx=nullptr)
Definition: undobj.cxx:721
std::unique_ptr< SwHistory > m_pHistory
Definition: undobj.hxx:167
static bool MovePtBackward(SwPaM &rPam)
Definition: undobj.cxx:825
static void MovePtForward(SwPaM &rPam, bool bMvBkwrd)
Definition: undobj.cxx:838
void SetRedlineFlags(RedlineFlags eMode)
Definition: undobj.hxx:121
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:120
static void RemoveIdxFromRange(SwPaM &rPam, bool bMoveNext)
Definition: undobj.cxx:118
bool m_bCacheComment
Definition: undobj.hxx:62
bool StoreEmbeddedObject(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, OUString &rName, bool bCopy, const OUString &rSrcShellID, const OUString &rDestShellID)
css::uno::Reference< css::embed::XEmbeddedObject > GetEmbeddedObject(const OUString &, OUString const *pBaseURL=nullptr)
void RestoreMetadata(std::shared_ptr< MetadatableUndo > const &i_pUndo)
std::shared_ptr< MetadatableUndo > CreateUndo() const
Blocks grouping undo actions together into an SfxListUndoAction.
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
const EnumerationType m_eType
MirrorGraph
Definition: grfatr.hxx:32
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
constexpr TypedWhichId< SvxFormatKeepItem > RES_KEEP(110)
CharClass & GetAppCharClass()
Definition: init.cxx:705
OUString aName
aStr
Count
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
sal_uIntPtr sal_uLong
Marks a position in the document model.
Definition: pam.hxx:37
SwNode & GetNode() const
Definition: pam.hxx:80
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:230
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:266
const SwContentNode * GetContentNode() const
Definition: pam.hxx:83
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
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:164
SwLabelType
Definition: swtypes.hxx:85
SwUndoId
Definition: swundo.hxx:30
sal_uInt16 sal_Unicode
SwRewriter MakeUndoReplaceRewriter(sal_uLong const occurrences, OUString const &sOld, OUString const &sNew)
Definition: unins.cxx:528
sal_Int32 nLength