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 <UndoRedline.hxx>
21 #include <hintids.hxx>
22 #include <unotools/charclass.hxx>
23 #include <doc.hxx>
24 #include <IDocumentRedlineAccess.hxx>
25 #include <swundo.hxx>
26 #include <pam.hxx>
27 #include <ndtxt.hxx>
28 #include <txtfrm.hxx>
29 #include <UndoCore.hxx>
30 #include <UndoDelete.hxx>
31 #include <strings.hrc>
32 #include <rolbck.hxx>
33 #include <redline.hxx>
34 #include <docary.hxx>
35 #include <sortopt.hxx>
36 #include <docedt.hxx>
37 
SwUndoRedline(SwUndoId nUsrId,const SwPaM & rRange)38 SwUndoRedline::SwUndoRedline( SwUndoId nUsrId, const SwPaM& rRange )
39     : SwUndo( SwUndoId::REDLINE, rRange.GetDoc() ), SwUndRng( rRange ),
40     mnUserId( nUsrId ),
41     mbHiddenRedlines( false )
42 {
43     // consider Redline
44     SwDoc& rDoc = *rRange.GetDoc();
45     if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
46     {
47         switch( mnUserId )
48         {
49         case SwUndoId::DELETE:
50         case SwUndoId::REPLACE:
51             mpRedlData.reset( new SwRedlineData( RedlineType::Delete, rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() ) );
52             break;
53         default:
54             ;
55         }
56         SetRedlineFlags( rDoc.getIDocumentRedlineAccess().GetRedlineFlags() );
57     }
58 
59     sal_uLong nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex();
60 
61     mpRedlSaveData.reset( new SwRedlineSaveDatas );
62     if( !FillSaveData( rRange, *mpRedlSaveData, false, SwUndoId::REJECT_REDLINE != mnUserId ))
63     {
64         mpRedlSaveData.reset();
65     }
66     else
67     {
68         mbHiddenRedlines = HasHiddenRedlines( *mpRedlSaveData );
69         if( mbHiddenRedlines )           // then the NodeIndices of SwUndRng need to be corrected
70         {
71             nEndExtra -= rDoc.GetNodes().GetEndOfExtras().GetIndex();
72             m_nSttNode -= nEndExtra;
73             m_nEndNode -= nEndExtra;
74         }
75     }
76 }
77 
~SwUndoRedline()78 SwUndoRedline::~SwUndoRedline()
79 {
80     mpRedlData.reset();
81     mpRedlSaveData.reset();
82 }
83 
GetRedlSaveCount() const84 sal_uInt16 SwUndoRedline::GetRedlSaveCount() const
85 {
86     return mpRedlSaveData ? mpRedlSaveData->size() : 0;
87 }
88 
UndoImpl(::sw::UndoRedoContext & rContext)89 void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext)
90 {
91     SwDoc& rDoc = rContext.GetDoc();
92     SwPaM& rPam(AddUndoRedoPaM(rContext));
93 
94     UndoRedlineImpl(rDoc, rPam);
95 
96     if( mpRedlSaveData )
97     {
98         sal_uLong nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex();
99         SetSaveData(rDoc, *mpRedlSaveData);
100         if( mbHiddenRedlines )
101         {
102             mpRedlSaveData->clear();
103 
104             nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex() - nEndExtra;
105             m_nSttNode += nEndExtra;
106             m_nEndNode += nEndExtra;
107         }
108         SetPaM(rPam, true);
109     }
110 
111     // update frames after calling SetSaveData
112     if (dynamic_cast<SwUndoRedlineDelete*>(this))
113     {
114         sw::UpdateFramesForRemoveDeleteRedline(rDoc, rPam);
115     }
116     else if (dynamic_cast<SwUndoAcceptRedline*>(this)
117           || dynamic_cast<SwUndoRejectRedline*>(this))
118     {   // (can't check here if there's a delete redline being accepted)
119         sw::UpdateFramesForAddDeleteRedline(rDoc, rPam);
120     }
121 }
122 
RedoImpl(::sw::UndoRedoContext & rContext)123 void SwUndoRedline::RedoImpl(::sw::UndoRedoContext & rContext)
124 {
125     SwDoc& rDoc = rContext.GetDoc();
126     RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
127     rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern(( eOld & ~RedlineFlags::Ignore) | RedlineFlags::On );
128 
129     SwPaM & rPam( AddUndoRedoPaM(rContext) );
130     if( mpRedlSaveData && mbHiddenRedlines )
131     {
132         sal_uLong nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex();
133         FillSaveData(rPam, *mpRedlSaveData, false, SwUndoId::REJECT_REDLINE != mnUserId );
134 
135         nEndExtra -= rDoc.GetNodes().GetEndOfExtras().GetIndex();
136         m_nSttNode -= nEndExtra;
137         m_nEndNode -= nEndExtra;
138     }
139 
140     RedoRedlineImpl(rDoc, rPam);
141 
142     SetPaM(rPam, true);
143     rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
144 }
145 
UndoRedlineImpl(SwDoc &,SwPaM &)146 void SwUndoRedline::UndoRedlineImpl(SwDoc &, SwPaM &)
147 {
148 }
149 
150 // default: remove redlines
RedoRedlineImpl(SwDoc & rDoc,SwPaM & rPam)151 void SwUndoRedline::RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
152 {
153     rDoc.getIDocumentRedlineAccess().DeleteRedline(rPam, true, RedlineType::Any);
154 }
155 
SwUndoRedlineDelete(const SwPaM & rRange,SwUndoId nUsrId)156 SwUndoRedlineDelete::SwUndoRedlineDelete( const SwPaM& rRange, SwUndoId nUsrId )
157     : SwUndoRedline( nUsrId != SwUndoId::EMPTY ? nUsrId : SwUndoId::DELETE, rRange ),
158     bCanGroup( false ), bIsDelim( false ), bIsBackspace( false )
159 {
160     const SwTextNode* pTNd;
161     SetRedlineText(rRange.GetText());
162     if( SwUndoId::DELETE == mnUserId &&
163         m_nSttNode == m_nEndNode && m_nSttContent + 1 == m_nEndContent &&
164         nullptr != (pTNd = rRange.GetNode().GetTextNode()) )
165     {
166         sal_Unicode const cCh = pTNd->GetText()[m_nSttContent];
167         if( CH_TXTATR_BREAKWORD != cCh && CH_TXTATR_INWORD != cCh )
168         {
169             bCanGroup = true;
170             bIsDelim = !GetAppCharClass().isLetterNumeric( pTNd->GetText(),
171                                                             m_nSttContent );
172             bIsBackspace = m_nSttContent == rRange.GetPoint()->nContent.GetIndex();
173         }
174     }
175 
176     m_bCacheComment = false;
177 }
178 
179 // bit of a hack, replace everything...
GetRewriter() const180 SwRewriter SwUndoRedlineDelete::GetRewriter() const
181 {
182     SwRewriter aResult;
183     OUString aStr = DenoteSpecialCharacters(m_sRedlineText);
184     aStr = ShortenString(aStr, nUndoStringLength, SwResId(STR_LDOTS));
185     SwRewriter aRewriter;
186     aRewriter.AddRule(UndoArg1, aStr);
187     OUString ret = aRewriter.Apply(SwResId(STR_UNDO_REDLINE_DELETE));
188     aResult.AddRule(UndoArg1, ret);
189     return aResult;
190 }
191 
SetRedlineText(const OUString & rText)192 void SwUndoRedlineDelete::SetRedlineText(const OUString & rText)
193 {
194     m_sRedlineText = rText;
195 }
196 
UndoRedlineImpl(SwDoc & rDoc,SwPaM & rPam)197 void SwUndoRedlineDelete::UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
198 {
199     rDoc.getIDocumentRedlineAccess().DeleteRedline(rPam, true, RedlineType::Any);
200 }
201 
RedoRedlineImpl(SwDoc & rDoc,SwPaM & rPam)202 void SwUndoRedlineDelete::RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
203 {
204     if (rPam.GetPoint() != rPam.GetMark())
205     {
206         rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline(*mpRedlData, rPam), false );
207     }
208     sw::UpdateFramesForAddDeleteRedline(rDoc, rPam);
209 }
210 
CanGrouping(const SwUndoRedlineDelete & rNext)211 bool SwUndoRedlineDelete::CanGrouping( const SwUndoRedlineDelete& rNext )
212 {
213     bool bRet = false;
214     if( SwUndoId::DELETE == mnUserId && mnUserId == rNext.mnUserId &&
215         bCanGroup == rNext.bCanGroup &&
216         bIsDelim == rNext.bIsDelim &&
217         bIsBackspace == rNext.bIsBackspace &&
218         m_nSttNode == m_nEndNode &&
219         rNext.m_nSttNode == m_nSttNode &&
220         rNext.m_nEndNode == m_nEndNode )
221     {
222         int bIsEnd = 0;
223         if( rNext.m_nSttContent == m_nEndContent )
224             bIsEnd = 1;
225         else if( rNext.m_nEndContent == m_nSttContent )
226             bIsEnd = -1;
227 
228         if( bIsEnd &&
229             (( !mpRedlSaveData && !rNext.mpRedlSaveData ) ||
230              ( mpRedlSaveData && rNext.mpRedlSaveData &&
231                 SwUndo::CanRedlineGroup( *mpRedlSaveData,
232                             *rNext.mpRedlSaveData, 1 != bIsEnd )
233              )))
234         {
235             if( 1 == bIsEnd )
236                 m_nEndContent = rNext.m_nEndContent;
237             else
238                 m_nSttContent = rNext.m_nSttContent;
239             bRet = true;
240         }
241     }
242     return bRet;
243 }
244 
SwUndoRedlineSort(const SwPaM & rRange,const SwSortOptions & rOpt)245 SwUndoRedlineSort::SwUndoRedlineSort( const SwPaM& rRange,
246                                     const SwSortOptions& rOpt )
247     : SwUndoRedline( SwUndoId::SORT_TXT, rRange ),
248     pOpt( new SwSortOptions( rOpt ) ),
249     nSaveEndNode( m_nEndNode ), nSaveEndContent( m_nEndContent )
250 {
251 }
252 
~SwUndoRedlineSort()253 SwUndoRedlineSort::~SwUndoRedlineSort()
254 {
255 }
256 
UndoRedlineImpl(SwDoc & rDoc,SwPaM & rPam)257 void SwUndoRedlineSort::UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
258 {
259     // rPam contains the sorted range
260     // aSaveRange contains copied (i.e. original) range
261 
262     SwPosition *const pStart = rPam.Start();
263     SwPosition *const pEnd   = rPam.End();
264 
265     SwNodeIndex aPrevIdx( pStart->nNode, -1 );
266     sal_uLong nOffsetTemp = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex();
267 
268     if( !( RedlineFlags::ShowDelete & rDoc.getIDocumentRedlineAccess().GetRedlineFlags()) )
269     {
270         // Search both Redline objects and make them visible to make the nodes
271         // consistent again. The 'delete' one is hidden, thus search for the
272         // 'insert' Redline object. The former is located directly after the latter.
273         SwRedlineTable::size_type nFnd = rDoc.getIDocumentRedlineAccess().GetRedlinePos(
274                             *rDoc.GetNodes()[ m_nSttNode + 1 ],
275                             RedlineType::Insert );
276         OSL_ENSURE( SwRedlineTable::npos != nFnd && nFnd+1 < rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(),
277                     "could not find an Insert object" );
278         ++nFnd;
279         rDoc.getIDocumentRedlineAccess().GetRedlineTable()[nFnd]->Show(1, nFnd);
280     }
281 
282     {
283         SwPaM aTmp( *rPam.GetMark() );
284         aTmp.GetMark()->nContent = 0;
285         aTmp.SetMark();
286         aTmp.GetPoint()->nNode = nSaveEndNode;
287         aTmp.GetPoint()->nContent.Assign( aTmp.GetContentNode(), nSaveEndContent );
288         rDoc.getIDocumentRedlineAccess().DeleteRedline( aTmp, true, RedlineType::Any );
289     }
290 
291     rDoc.getIDocumentContentOperations().DelFullPara(rPam);
292 
293     SwPaM *const pPam = & rPam;
294     pPam->DeleteMark();
295     pPam->GetPoint()->nNode.Assign( aPrevIdx.GetNode(), +1 );
296     SwContentNode* pCNd = pPam->GetContentNode();
297     pPam->GetPoint()->nContent.Assign(pCNd, 0 );
298     pPam->SetMark();
299 
300     pPam->GetPoint()->nNode += nOffsetTemp;
301     pCNd = pPam->GetContentNode();
302     pPam->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
303 
304     SetValues( *pPam );
305 
306     SetPaM(rPam);
307 }
308 
RedoRedlineImpl(SwDoc & rDoc,SwPaM & rPam)309 void SwUndoRedlineSort::RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
310 {
311     SwPaM* pPam = &rPam;
312     SwPosition* pStart = pPam->Start();
313     SwPosition* pEnd   = pPam->End();
314 
315     SwNodeIndex aPrevIdx( pStart->nNode, -1 );
316     sal_uLong nOffsetTemp = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex();
317     const sal_Int32 nCntStt  = pStart->nContent.GetIndex();
318 
319     rDoc.SortText(rPam, *pOpt);
320 
321     pPam->DeleteMark();
322     pPam->GetPoint()->nNode.Assign( aPrevIdx.GetNode(), +1 );
323     SwContentNode* pCNd = pPam->GetContentNode();
324     sal_Int32 nLen = pCNd->Len();
325     if( nLen > nCntStt )
326         nLen = nCntStt;
327     pPam->GetPoint()->nContent.Assign(pCNd, nLen );
328     pPam->SetMark();
329 
330     pPam->GetPoint()->nNode += nOffsetTemp;
331     pCNd = pPam->GetContentNode();
332     pPam->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
333 
334     SetValues( rPam );
335 
336     SetPaM( rPam );
337     rPam.GetPoint()->nNode = nSaveEndNode;
338     rPam.GetPoint()->nContent.Assign( rPam.GetContentNode(), nSaveEndContent );
339 }
340 
RepeatImpl(::sw::RepeatContext & rContext)341 void SwUndoRedlineSort::RepeatImpl(::sw::RepeatContext & rContext)
342 {
343     rContext.GetDoc().SortText( rContext.GetRepeatPaM(), *pOpt );
344 }
345 
SetSaveRange(const SwPaM & rRange)346 void SwUndoRedlineSort::SetSaveRange( const SwPaM& rRange )
347 {
348     const SwPosition& rPos = *rRange.End();
349     nSaveEndNode = rPos.nNode.GetIndex();
350     nSaveEndContent = rPos.nContent.GetIndex();
351 }
352 
SwUndoAcceptRedline(const SwPaM & rRange)353 SwUndoAcceptRedline::SwUndoAcceptRedline( const SwPaM& rRange )
354     : SwUndoRedline( SwUndoId::ACCEPT_REDLINE, rRange )
355 {
356 }
357 
RedoRedlineImpl(SwDoc & rDoc,SwPaM & rPam)358 void SwUndoAcceptRedline::RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
359 {
360     rDoc.getIDocumentRedlineAccess().AcceptRedline(rPam, false);
361 }
362 
RepeatImpl(::sw::RepeatContext & rContext)363 void SwUndoAcceptRedline::RepeatImpl(::sw::RepeatContext & rContext)
364 {
365     rContext.GetDoc().getIDocumentRedlineAccess().AcceptRedline(rContext.GetRepeatPaM(), true);
366 }
367 
SwUndoRejectRedline(const SwPaM & rRange)368 SwUndoRejectRedline::SwUndoRejectRedline( const SwPaM& rRange )
369     : SwUndoRedline( SwUndoId::REJECT_REDLINE, rRange )
370 {
371 }
372 
RedoRedlineImpl(SwDoc & rDoc,SwPaM & rPam)373 void SwUndoRejectRedline::RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
374 {
375     rDoc.getIDocumentRedlineAccess().RejectRedline(rPam, false);
376 }
377 
RepeatImpl(::sw::RepeatContext & rContext)378 void SwUndoRejectRedline::RepeatImpl(::sw::RepeatContext & rContext)
379 {
380     rContext.GetDoc().getIDocumentRedlineAccess().RejectRedline(rContext.GetRepeatPaM(), true);
381 }
382 
SwUndoCompDoc(const SwPaM & rRg,bool bIns)383 SwUndoCompDoc::SwUndoCompDoc( const SwPaM& rRg, bool bIns )
384     : SwUndo( SwUndoId::COMPAREDOC, rRg.GetDoc() ), SwUndRng( rRg ),
385     bInsert( bIns )
386 {
387     SwDoc* pDoc = rRg.GetDoc();
388     if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
389     {
390         RedlineType eTyp = bInsert ? RedlineType::Insert : RedlineType::Delete;
391         pRedlData.reset( new SwRedlineData( eTyp, pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() ) );
392         SetRedlineFlags( pDoc->getIDocumentRedlineAccess().GetRedlineFlags() );
393     }
394 }
395 
SwUndoCompDoc(const SwRangeRedline & rRedl)396 SwUndoCompDoc::SwUndoCompDoc( const SwRangeRedline& rRedl )
397     : SwUndo( SwUndoId::COMPAREDOC, rRedl.GetDoc() ), SwUndRng( rRedl ),
398     // for MergeDoc the corresponding inverse is needed
399     bInsert( RedlineType::Delete == rRedl.GetType() )
400 {
401     SwDoc* pDoc = rRedl.GetDoc();
402     if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
403     {
404         pRedlData.reset( new SwRedlineData( rRedl.GetRedlineData() ) );
405         SetRedlineFlags( pDoc->getIDocumentRedlineAccess().GetRedlineFlags() );
406     }
407 
408     pRedlSaveData.reset( new SwRedlineSaveDatas );
409     if( !FillSaveData( rRedl, *pRedlSaveData, false ))
410     {
411         pRedlSaveData.reset();
412     }
413 }
414 
~SwUndoCompDoc()415 SwUndoCompDoc::~SwUndoCompDoc()
416 {
417     pRedlData.reset();
418     pUnDel.reset();
419     pUnDel2.reset();
420     pRedlSaveData.reset();
421 }
422 
UndoImpl(::sw::UndoRedoContext & rContext)423 void SwUndoCompDoc::UndoImpl(::sw::UndoRedoContext & rContext)
424 {
425     SwDoc& rDoc = rContext.GetDoc();
426     SwPaM& rPam(AddUndoRedoPaM(rContext));
427 
428     if( !bInsert )
429     {
430         // delete Redlines
431         RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
432         rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern(( eOld & ~RedlineFlags::Ignore) | RedlineFlags::On);
433 
434         rDoc.getIDocumentRedlineAccess().DeleteRedline(rPam, true, RedlineType::Any);
435 
436         rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
437 
438         // per definition Point is end (in SwUndRng!)
439         SwContentNode* pCSttNd = rPam.GetContentNode(false);
440         SwContentNode* pCEndNd = rPam.GetContentNode();
441 
442         // if start- and end-content is zero, then the doc-compare moves
443         // complete nodes into the current doc. And then the selection
444         // must be from end to start, so the delete join into the right
445         // direction.
446         if( !m_nSttContent && !m_nEndContent )
447             rPam.Exchange();
448 
449         bool bJoinText, bJoinPrev;
450         sw_GetJoinFlags(rPam, bJoinText, bJoinPrev);
451 
452         pUnDel.reset( new SwUndoDelete(rPam, false) );
453 
454         if( bJoinText )
455             sw_JoinText(rPam, bJoinPrev);
456 
457         if( pCSttNd && !pCEndNd)
458         {
459             // #112139# Do not step behind the end of content.
460             SwNode & rTmp = rPam.GetNode();
461             SwNode * pEnd = rDoc.GetNodes().DocumentSectionEndNode(&rTmp);
462 
463             if (&rTmp != pEnd)
464             {
465                 rPam.SetMark();
466                 ++rPam.GetPoint()->nNode;
467                 rPam.GetBound().nContent.Assign( nullptr, 0 );
468                 rPam.GetBound( false ).nContent.Assign( nullptr, 0 );
469                 pUnDel2.reset( new SwUndoDelete(rPam, true) );
470             }
471         }
472         rPam.DeleteMark();
473     }
474     else
475     {
476         if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ))
477         {
478             rDoc.getIDocumentRedlineAccess().DeleteRedline(rPam, true, RedlineType::Any);
479 
480             if( pRedlSaveData )
481                 SetSaveData(rDoc, *pRedlSaveData);
482         }
483         SetPaM(rPam, true);
484     }
485 }
486 
RedoImpl(::sw::UndoRedoContext & rContext)487 void SwUndoCompDoc::RedoImpl(::sw::UndoRedoContext & rContext)
488 {
489     SwDoc& rDoc = rContext.GetDoc();
490 
491     if( bInsert )
492     {
493         SwPaM& rPam(AddUndoRedoPaM(rContext));
494         if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ))
495         {
496             SwRangeRedline* pTmp = new SwRangeRedline(*pRedlData, rPam);
497             rDoc.getIDocumentRedlineAccess().GetRedlineTable().Insert( pTmp );
498             pTmp->InvalidateRange(SwRangeRedline::Invalidation::Add);
499         }
500         else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
501                 !rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() )
502         {
503             rDoc.getIDocumentRedlineAccess().SplitRedline(rPam);
504         }
505         SetPaM(rPam, true);
506     }
507     else
508     {
509         if( pUnDel2 )
510         {
511             pUnDel2->UndoImpl(rContext);
512             pUnDel2.reset();
513         }
514         pUnDel->UndoImpl(rContext);
515         pUnDel.reset();
516 
517         // note: don't call SetPaM before executing Undo of members
518         SwPaM& rPam(AddUndoRedoPaM(rContext));
519 
520         SwRangeRedline* pTmp = new SwRangeRedline(*pRedlData, rPam);
521         rDoc.getIDocumentRedlineAccess().GetRedlineTable().Insert( pTmp );
522         pTmp->InvalidateRange(SwRangeRedline::Invalidation::Add);
523 
524         SetPaM(rPam, true);
525     }
526 }
527 
528 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
529