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