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