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 #include <osl/diagnose.h>
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 <swcrsr.hxx>
49 #include <swtable.hxx>
50 #include <redline.hxx>
51 #include <docary.hxx>
52 #include <acorrect.hxx>
53 
54 #include <strings.hrc>
55 
56 using namespace ::com::sun::star;
57 
58 // INSERT
59 
60 std::optional<OUString> SwUndoInsert::GetTextFromDoc() const
61 {
62  std::optional<OUString> aResult;
63 
65  SwContentNode* pCNd = aNd.GetNode().GetContentNode();
66 
67  if( pCNd->IsTextNode() )
68  {
69  OUString sText = pCNd->GetTextNode()->GetText();
70 
71  sal_Int32 nStart = m_nContent-m_nLen;
72  sal_Int32 nLength = m_nLen;
73 
74  if (nStart < 0)
75  {
76  nLength += nStart;
77  nStart = 0;
78  }
79 
80  aResult = sText.copy(nStart, nLength);
81  }
82 
83  return aResult;
84 }
85 
87 {
88  // consider Redline
89  m_pDoc = &rNd.GetNode().GetDoc();
91  {
92  m_pRedlData.reset( new SwRedlineData( RedlineType::Insert,
95  }
96 
98 
99  m_bCacheComment = false;
100 }
101 
102 SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd, sal_Int32 nCnt,
103  sal_Int32 nL,
104  const SwInsertFlags nInsertFlags,
105  bool bWDelim )
106  : SwUndo(SwUndoId::TYPING, &rNd.GetNode().GetDoc()),
107  m_nNode( rNd.GetIndex() ), m_nContent(nCnt), m_nLen(nL),
108  m_bIsWordDelim( bWDelim ), m_bIsAppend( false )
109  , m_bWithRsid(false)
110  , m_nInsertFlags(nInsertFlags)
111 {
112  Init(rNd);
113 }
114 
116  : SwUndo(SwUndoId::SPLITNODE, &rNd.GetNode().GetDoc()),
117  m_nNode( rNd.GetIndex() ), m_nContent(0), m_nLen(1),
118  m_bIsWordDelim( false ), m_bIsAppend( true )
119  , m_bWithRsid(false)
120  , m_nInsertFlags(SwInsertFlags::EMPTYEXPAND)
121 {
122  Init(rNd);
123 }
124 
125 // Check if the next Insert can be combined with the current one. If so
126 // change the length and InsPos. As a result, SwDoc::Inser will not add a
127 // new object into the Undo list.
128 
130 {
131  if( !m_bIsAppend && m_bIsWordDelim ==
132  !GetAppCharClass().isLetterNumeric( OUString( cIns )) )
133  {
134  m_nLen++;
135  m_nContent++;
136 
137  if (maUndoText)
138  (*maUndoText) += OUStringChar(cIns);
139 
140  return true;
141  }
142  return false;
143 }
144 
146 {
147  bool bRet = false;
148  if( m_nNode == rPos.nNode.GetIndex() &&
149  m_nContent == rPos.nContent.GetIndex() )
150  {
151  // consider Redline
152  SwDoc& rDoc = rPos.nNode.GetNode().GetDoc();
155  {
156  bRet = true;
157 
158  // then there is or was still an active Redline:
159  // Check if there is another Redline at the InsPosition. If the
160  // same exists only once, it can be combined.
162  if( !rTable.empty() )
163  {
164  SwRedlineData aRData( RedlineType::Insert, rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() );
165  const SwIndexReg* pIReg = rPos.nContent.GetIdxReg();
166  for(SwRangeRedline* pRedl : rTable)
167  {
168  SwIndex* pIdx = &pRedl->End()->nContent;
169  if( pIReg == pIdx->GetIdxReg() &&
170  m_nContent == pIdx->GetIndex() )
171  {
172  if( !pRedl->HasMark() || !m_pRedlData ||
173  *pRedl != *m_pRedlData || *pRedl != aRData )
174  {
175  bRet = false;
176  break;
177  }
178  }
179  }
180  }
181  }
182  }
183  return bRet;
184 }
185 
187 {
188  if (m_pUndoNodeIndex) // delete the section from UndoNodes array
189  {
190  // Insert saves the content in IconSection
191  SwNodes& rUNds = m_pUndoNodeIndex->GetNodes();
192  rUNds.Delete(*m_pUndoNodeIndex,
193  rUNds.GetEndOfExtras().GetIndex() - m_pUndoNodeIndex->GetIndex());
194  m_pUndoNodeIndex.reset();
195  }
196  else // the inserted text
197  {
198  maText.reset();
199  }
200  m_pRedlData.reset();
201 }
202 
204 {
205  SwDoc *const pTmpDoc = & rContext.GetDoc();
206  SwCursor *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
207 
208  if( m_bIsAppend )
209  {
210  pPam->GetPoint()->nNode = m_nNode;
211 
213  {
214  pPam->GetPoint()->nContent.Assign( pPam->GetContentNode(), 0 );
215  pPam->SetMark();
216  pPam->Move( fnMoveBackward );
217  pPam->Exchange();
218  pTmpDoc->getIDocumentRedlineAccess().DeleteRedline( *pPam, true, RedlineType::Any );
219  }
220  pPam->DeleteMark();
221  pTmpDoc->getIDocumentContentOperations().DelFullPara( *pPam );
222  pPam->GetPoint()->nContent.Assign( pPam->GetContentNode(), 0 );
223  }
224  else
225  {
226  SwNodeOffset nNd = m_nNode;
227  sal_Int32 nCnt = m_nContent;
228  if( m_nLen )
229  {
230  SwNodeIndex aNd( pTmpDoc->GetNodes(), m_nNode);
231  SwContentNode* pCNd = aNd.GetNode().GetContentNode();
232  SwPaM aPaM( *pCNd, m_nContent );
233 
234  aPaM.SetMark();
235 
236  SwTextNode * const pTextNode( pCNd->GetTextNode() );
237  if ( pTextNode )
238  {
239  aPaM.GetPoint()->nContent -= m_nLen;
241  pTmpDoc->getIDocumentRedlineAccess().DeleteRedline( aPaM, true, RedlineType::Any );
242  if (m_bWithRsid)
243  {
244  // RSID was added: remove any CHARFMT/AUTOFMT that may be
245  // set on the deleted text; EraseText will leave empty
246  // ones behind otherwise
247  pTextNode->DeleteAttributes(RES_TXTATR_AUTOFMT,
248  aPaM.GetPoint()->nContent.GetIndex(),
249  aPaM.GetMark()->nContent.GetIndex());
250  pTextNode->DeleteAttributes(RES_TXTATR_CHARFMT,
251  aPaM.GetPoint()->nContent.GetIndex(),
252  aPaM.GetMark()->nContent.GetIndex());
253  }
254  RemoveIdxFromRange( aPaM, false );
255  maText = pTextNode->GetText().copy(m_nContent-m_nLen, m_nLen);
256  pTextNode->EraseText( aPaM.GetPoint()->nContent, m_nLen );
257  }
258  else // otherwise Graphics/OLE/Text/...
259  {
260  aPaM.Move(fnMoveBackward);
262  pTmpDoc->getIDocumentRedlineAccess().DeleteRedline( aPaM, true, RedlineType::Any );
263  RemoveIdxFromRange( aPaM, false );
264  }
265 
266  nNd = aPaM.GetPoint()->nNode.GetIndex();
267  nCnt = aPaM.GetPoint()->nContent.GetIndex();
268 
269  if (!maText)
270  {
271  m_pUndoNodeIndex.reset(
273  MoveToUndoNds(aPaM, m_pUndoNodeIndex.get());
274  }
275  m_nNode = aPaM.GetPoint()->nNode.GetIndex();
276  m_nContent = aPaM.GetPoint()->nContent.GetIndex();
277  }
278 
279  // set cursor to Undo range
280  pPam->DeleteMark();
281 
282  pPam->GetPoint()->nNode = nNd;
283  pPam->GetPoint()->nContent.Assign(
284  pPam->GetPoint()->nNode.GetNode().GetContentNode(), nCnt );
285  }
286 
287  maUndoText.reset();
288 }
289 
291 {
292  SwDoc *const pTmpDoc = & rContext.GetDoc();
293  SwCursor *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
294  pPam->DeleteMark();
295 
296  if( m_bIsAppend )
297  {
298  pPam->GetPoint()->nNode = m_nNode - 1;
299  pTmpDoc->getIDocumentContentOperations().AppendTextNode( *pPam->GetPoint() );
300 
301  pPam->SetMark();
302  pPam->Move( fnMoveBackward );
303  pPam->Exchange();
304 
306  {
309  pTmpDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *m_pRedlData, *pPam ), true);
311  }
312  else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
314  pTmpDoc->getIDocumentRedlineAccess().SplitRedline( *pPam );
315 
316  pPam->DeleteMark();
317  }
318  else
319  {
320  pPam->GetPoint()->nNode = m_nNode;
321  SwContentNode *const pCNd =
322  pPam->GetPoint()->nNode.GetNode().GetContentNode();
323  pPam->GetPoint()->nContent.Assign( pCNd, m_nContent );
324 
325  if( m_nLen )
326  {
327  const bool bMvBkwrd = MovePtBackward( *pPam );
328 
329  if (maText)
330  {
331  SwTextNode *const pTextNode = pCNd->GetTextNode();
332  OSL_ENSURE( pTextNode, "where is my textnode ?" );
333  OUString const ins(
334  pTextNode->InsertText( *maText, pPam->GetMark()->nContent,
335  m_nInsertFlags) );
336  assert(ins.getLength() == maText->getLength()); // must succeed
337  maText.reset();
338  if (m_bWithRsid) // re-insert RSID
339  {
340  SwPaM pam(*pPam->GetMark(), nullptr); // mark -> point
341  pTmpDoc->UpdateRsid(pam, ins.getLength());
342  }
343  }
344  else
345  {
346  // re-insert content again (first detach m_pUndoNodeIndex!)
347  SwNodeOffset const nMvNd = m_pUndoNodeIndex->GetIndex();
348  m_pUndoNodeIndex.reset();
349  MoveFromUndoNds(*pTmpDoc, nMvNd, *pPam->GetMark());
350  }
351  m_nNode = pPam->GetMark()->nNode.GetIndex();
352  m_nContent = pPam->GetMark()->nContent.GetIndex();
353 
354  MovePtForward( *pPam, bMvBkwrd );
355  pPam->Exchange();
357  {
361  *pPam ), true);
363  }
364  else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
366  pTmpDoc->getIDocumentRedlineAccess().SplitRedline(*pPam);
367  }
368  }
369 
371 }
372 
374 {
375  if( !m_nLen )
376  return;
377 
378  SwDoc & rDoc = rContext.GetDoc();
379  SwNodeIndex aNd( rDoc.GetNodes(), m_nNode );
380  SwContentNode* pCNd = aNd.GetNode().GetContentNode();
381 
382  if( !m_bIsAppend && 1 == m_nLen ) // >1 than always Text, otherwise Graphics/OLE/Text/...
383  {
384  SwPaM aPaM( *pCNd, m_nContent );
385  aPaM.SetMark();
386  aPaM.Move(fnMoveBackward);
387  pCNd = aPaM.GetContentNode();
388  }
389 
390 // What happens with the possible selected range ???
391 
392  switch( pCNd->GetNodeType() )
393  {
394  case SwNodeType::Text:
395  if( m_bIsAppend )
396  {
398  }
399  else
400  {
401  OUString const aText( pCNd->GetTextNode()->GetText() );
402  ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
404  aText.copy(m_nContent - m_nLen, m_nLen) );
405  }
406  break;
407  case SwNodeType::Grf:
408  {
409  SwGrfNode* pGrfNd = static_cast<SwGrfNode*>(pCNd);
410  OUString sFile;
411  OUString sFilter;
412  if( pGrfNd->IsGrfLink() )
413  pGrfNd->GetFileFilterNms( &sFile, &sFilter );
414 
416  rContext.GetRepeatPaM(), sFile, sFilter,
417  &pGrfNd->GetGrf(),
418  nullptr/* Graphics collection*/, nullptr, nullptr );
419  }
420  break;
421 
422  case SwNodeType::Ole:
423  {
424  // StarView does not yet provide an option to copy a StarOBJ
425  SwOLEObj& rSwOLE = static_cast<SwOLENode*>(pCNd)->GetOLEObj();
426 
427  // temporary storage until object is inserted
428  // TODO/MBA: seems that here a physical copy is done - not as in drawing layer! Testing!
429  // TODO/LATER: Copying through the container would copy the replacement image as well
431  OUString aName = aCnt.CreateUniqueObjectName();
432  if (aCnt.StoreEmbeddedObject(rSwOLE.GetOleRef(), aName, true, OUString(), OUString()))
433  {
434  uno::Reference < embed::XEmbeddedObject > aNew = aCnt.GetEmbeddedObject( aName );
436  rContext.GetRepeatPaM(),
438  static_cast<SwOLENode*>(pCNd)->GetAspect() ),
439  nullptr );
440  }
441 
442  break;
443  }
444 
445  default: break;
446  }
447 }
448 
450 {
451  SwRewriter aResult;
452  std::optional<OUString> aStr;
453  bool bDone = false;
454 
455  if (maText)
456  aStr = maText;
457  else if (maUndoText)
458  aStr = maUndoText;
459 
460  if (aStr)
461  {
462  OUString aString = ShortenString(DenoteSpecialCharacters(*aStr),
464  SwResId(STR_LDOTS));
465 
466  aResult.AddRule(UndoArg1, aString);
467 
468  bDone = true;
469  }
470 
471  if ( ! bDone )
472  {
473  aResult.AddRule(UndoArg1, "??");
474  }
475 
476  return aResult;
477 }
478 
479 bool SwUndoInsert::IsIndependent(const SwUndoInsert& rOther) const
480 {
481  return m_nNode != rOther.m_nNode;
482 }
483 
485  : private SwUndoSaveContent
486 {
487  OUString m_sOld;
488  OUString m_sIns;
491  bool m_bSplitNext : 1;
492  bool m_bRegExp : 1;
493  // metadata references for paragraph and following para (if m_bSplitNext)
494  std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
495  std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
496 
497 public:
498  Impl(SwPaM const& rPam, OUString const& rIns, bool const bRegExp);
499 
500  void UndoImpl( ::sw::UndoRedoContext & );
501  void RedoImpl( ::sw::UndoRedoContext & );
502 
503  void SetEnd(SwPaM const& rPam);
504 
505  OUString const& GetOld() const { return m_sOld; }
506  OUString const& GetIns() const { return m_sIns; }
507 };
508 
510  OUString const& rIns, bool const bRegExp)
511  : SwUndo( SwUndoId::REPLACE, &rPam.GetDoc() )
512  , m_pImpl(std::make_unique<Impl>(rPam, rIns, bRegExp))
513 {
514 }
515 
517 {
518 }
519 
521 {
522  m_pImpl->UndoImpl(rContext);
523 }
524 
526 {
527  m_pImpl->RedoImpl(rContext);
528 }
529 
532  OUString const& sOld, OUString const& sNew)
533 {
534  SwRewriter aResult;
535 
536  if (1 < occurrences)
537  {
538  aResult.AddRule(UndoArg1, OUString::number(occurrences));
539  aResult.AddRule(UndoArg2, SwResId(STR_OCCURRENCES_OF));
540 
541  OUString aTmpStr = SwResId(STR_START_QUOTE);
542  aTmpStr += ShortenString(sOld, nUndoStringLength,
543  SwResId(STR_LDOTS));
544  aTmpStr += SwResId(STR_END_QUOTE);
545  aResult.AddRule(UndoArg3, aTmpStr);
546  }
547  else if (1 == occurrences)
548  {
549  {
550  OUString aTmpStr = SwResId(STR_START_QUOTE);
551  // #i33488 #
552  aTmpStr += ShortenString(sOld, nUndoStringLength,
553  SwResId(STR_LDOTS));
554  aTmpStr += SwResId(STR_END_QUOTE);
555  aResult.AddRule(UndoArg1, aTmpStr);
556  }
557 
558  aResult.AddRule(UndoArg2, SwResId(STR_YIELDS));
559 
560  {
561  OUString aTmpStr = SwResId(STR_START_QUOTE);
562  // #i33488 #
563  aTmpStr += ShortenString(sNew, nUndoStringLength,
564  SwResId(STR_LDOTS));
565  aTmpStr += SwResId(STR_END_QUOTE);
566  aResult.AddRule(UndoArg3, aTmpStr);
567  }
568  }
569 
570  return aResult;
571 }
572 
574 {
575  return MakeUndoReplaceRewriter(1, m_pImpl->GetOld(), m_pImpl->GetIns());
576 }
577 
578 void SwUndoReplace::SetEnd(SwPaM const& rPam)
579 {
580  m_pImpl->SetEnd(rPam);
581 }
582 
584  SwPaM const& rPam, OUString const& rIns, bool const bRegExp)
585  : m_sIns( rIns )
586  , m_nOffset( 0 )
587  , m_bRegExp(bRegExp)
588 {
589 
590  const SwPosition * pStt( rPam.Start() );
591  const SwPosition * pEnd( rPam.End() );
592 
593  m_nSttNd = m_nEndNd = pStt->nNode.GetIndex();
594  m_nSttCnt = pStt->nContent.GetIndex();
595  m_nSelEnd = m_nEndCnt = pEnd->nContent.GetIndex();
596 
597  m_bSplitNext = m_nSttNd != pEnd->nNode.GetIndex();
598 
599  SwTextNode* pNd = pStt->nNode.GetNode().GetTextNode();
600  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
601 
602  m_pHistory.reset( new SwHistory );
604 
605  m_nSetPos = m_pHistory->Count();
606 
607  SwNodeOffset nNewPos = pStt->nNode.GetIndex();
608  m_nOffset = m_nSttNd - nNewPos;
609 
610  if ( pNd->GetpSwpHints() )
611  {
612  m_pHistory->CopyAttr( pNd->GetpSwpHints(), nNewPos, 0,
613  pNd->GetText().getLength(), true );
614  }
615 
616  if ( m_bSplitNext )
617  {
618  if( pNd->HasSwAttrSet() )
619  m_pHistory->CopyFormatAttr( *pNd->GetpSwAttrSet(), nNewPos );
620  m_pHistory->Add( pNd->GetTextColl(), nNewPos, SwNodeType::Text );
621 
622  SwTextNode* pNext = pEnd->nNode.GetNode().GetTextNode();
623  SwNodeOffset nTmp = pNext->GetIndex();
624  m_pHistory->CopyAttr( pNext->GetpSwpHints(), nTmp, 0,
625  pNext->GetText().getLength(), true );
626  if( pNext->HasSwAttrSet() )
627  m_pHistory->CopyFormatAttr( *pNext->GetpSwAttrSet(), nTmp );
628  m_pHistory->Add( pNext->GetTextColl(),nTmp, SwNodeType::Text );
629  // METADATA: store
631  m_pMetadataUndoEnd = pNext->CreateUndo();
632  }
633 
634  if( !m_pHistory->Count() )
635  {
636  m_pHistory.reset();
637  }
638 
639  const sal_Int32 nECnt = m_bSplitNext ? pNd->GetText().getLength()
640  : pEnd->nContent.GetIndex();
641  m_sOld = pNd->GetText().copy( m_nSttCnt, nECnt - m_nSttCnt );
642 }
643 
645 {
646  SwDoc *const pDoc = & rContext.GetDoc();
647  SwCursor & rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
648  rPam.DeleteMark();
649 
650  SwTextNode* pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
651  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
652 
653  SwAutoCorrExceptWord* pACEWord = pDoc->GetAutoCorrExceptWord();
654  if( pACEWord )
655  {
656  if ((1 == m_sIns.getLength()) && (1 == m_sOld.getLength()))
657  {
658  SwPosition aPos( *pNd ); aPos.nContent.Assign( pNd, m_nSttCnt );
659  pACEWord->CheckChar( aPos, m_sOld[ 0 ] );
660  }
661  pDoc->SetAutoCorrExceptWord( nullptr );
662  }
663 
664  // don't look at m_sIns for deletion, maybe it was not completely inserted
665  {
666  rPam.GetPoint()->nNode = *pNd;
667  rPam.GetPoint()->nContent.Assign( pNd, m_nSttCnt );
668  rPam.SetMark();
669  rPam.GetPoint()->nNode = m_nSttNd - m_nOffset;
670  rPam.GetPoint()->nContent.Assign(rPam.GetContentNode(), m_nSttNd == m_nEndNd ? m_nEndCnt : pNd->Len());
671 
672  // replace only in start node, without regex
673  bool const ret = pDoc->getIDocumentContentOperations().ReplaceRange(rPam, m_sOld, false);
674  assert(ret); (void)ret;
675  if (m_nSttNd != m_nEndNd)
676  { // in case of regex inserting paragraph breaks, join nodes...
677  assert(rPam.GetMark()->nContent == rPam.GetMark()->nNode.GetNode().GetTextNode()->Len());
678  rPam.GetPoint()->nNode = m_nEndNd - m_nOffset;
679  rPam.GetPoint()->nContent.Assign(rPam.GetContentNode(true), m_nEndCnt);
681  }
682  rPam.DeleteMark();
683  pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
684  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
685  }
686 
687  if( m_bSplitNext )
688  {
689  SwPosition aPos(*pNd, pNd->Len());
690  pDoc->getIDocumentContentOperations().SplitNode( aPos, false );
691  pNd->RestoreMetadata(m_pMetadataUndoEnd);
692  pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
693  // METADATA: restore
694  pNd->RestoreMetadata(m_pMetadataUndoStart);
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 = m_nSttCnt;
724 }
725 
727 {
728  SwDoc & rDoc = rContext.GetDoc();
729  SwCursor & 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(), DelContentType::AllMask | DelContentType::Replace);
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(), DelContentType::AllMask | DelContentType::Replace);
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  SwNodeOffset 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, SwNodeOffset(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:142
virtual SwCursor & CreateNewShellCursor()=0
std::unique_ptr< SwNodeIndex > m_pUndoNodeIndex
start of Content in UndoNodes for Redo
Definition: UndoInsert.hxx:44
void DeleteMark()
Definition: pam.hxx:178
std::optional< OUString > maUndoText
Definition: UndoInsert.hxx:46
SwAutoCorrExceptWord * GetAutoCorrExceptWord()
Definition: doc.hxx:1391
void SetSelections(SwFrameFormat *const pSelFormat, SdrMarkList *const pMarkList)
Definition: UndoCore.hxx:99
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2893
SwLabelType
Definition: swtypes.hxx:84
OUString const & GetIns() const
Definition: unins.cxx:506
Marks a position in the document model.
Definition: pam.hxx:36
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:821
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:822
SwNodeOffset m_nOffset
Definition: unins.cxx:489
sal_Int32 m_nSttCnt
Definition: unins.cxx:490
std::unique_ptr< SwHistory > m_pHistory
Definition: undobj.hxx:166
const OUString & GetText() const
Definition: ndtxt.hxx:218
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:226
bool m_bIsAppend
Definition: UndoInsert.hxx:51
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:38
SwRewriter MakeUndoReplaceRewriter(sal_uLong const occurrences, OUString const &sOld, OUString const &sNew)
Definition: unins.cxx:531
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:277
sal_uIntPtr sal_uLong
SwPaM & GetRepeatPaM()
Definition: UndoCore.hxx:134
const SwPosition * GetMark() const
Definition: pam.hxx:210
virtual SdrLayerID GetHeavenId() const =0
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:939
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1210
Definition: doc.hxx:187
OUString m_sCharacterStyle
Definition: UndoInsert.hxx:177
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:52
bool m_bIsWordDelim
Definition: UndoInsert.hxx:50
bool IsIndependent(const SwUndoInsert &rOther) const
Definition: unins.cxx:479
void SetEnd(const SwPaM &rPam)
Definition: unins.cxx:578
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
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:845
const SwInsertFlags m_nInsertFlags
Definition: UndoInsert.hxx:54
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:204
IShellCursorSupplier & GetCursorSupplier()
Definition: UndoCore.hxx:97
OUString m_sOld
Definition: unins.cxx:487
sal_Int32 m_nSelEnd
Definition: unins.cxx:490
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:155
SwContentNode * GetContentNode(bool bPoint=true) const
Definition: pam.hxx:230
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:164
SwNodeOffset mnPosition
Definition: UndoInsert.hxx:143
std::optional< OUString > maNm
Definition: UndoInsert.hxx:141
sal_uInt16 sal_Unicode
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unins.cxx:373
SwIndex nContent
Definition: pam.hxx:39
bool empty() const
Definition: docary.hxx:266
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unins.cxx:962
static bool IsRedlineOn(const RedlineFlags eM)
SwDoc & GetDoc() const
Definition: UndoCore.hxx:132
const SwTable & GetTable() const
Definition: node.hxx:506
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:152
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1111
bool GetFileFilterNms(OUString *pFileNm, OUString *pFilterNm) const
Definition: ndgrf.cxx:494
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:817
SwDoc & GetDoc() const
Definition: UndoCore.hxx:95
static void RemoveIdxFromRange(SwPaM &rPam, bool bMoveNext)
Definition: undobj.cxx:126
void SetDrawObj(SdrLayerID nLayerId)
Definition: unins.cxx:1040
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:162
std::unique_ptr< SwRedlineData > m_pRedlData
Definition: UndoInsert.hxx:47
virtual std::size_t GetRedlineAuthor()=0
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:290
std::optional< OUString > GetTextFromDoc() const
Definition: unins.cxx:60
OUString m_sNumberSeparator
Definition: UndoInsert.hxx:176
static void MovePtForward(SwPaM &rPam, bool bMvBkwrd)
Definition: undobj.cxx:840
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:457
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().
Typing one or more characters to a single paragraph.
Definition: UndoInsert.hxx:41
Style of a layout element.
Definition: frmfmt.hxx:59
void SetEnd(SwPaM const &rPam)
Definition: unins.cxx:770
SwUndoReplace(SwPaM const &rPam, OUString const &rInsert, bool const bRegExp)
Definition: unins.cxx:509
virtual SwRewriter GetRewriter() const override
Returns rewriter for this undo object.
Definition: unins.cxx:449
SwDoc & GetDoc()
Definition: node.hxx:213
const SwPosition * GetPoint() const
Definition: pam.hxx:208
OUString DenoteSpecialCharacters(const OUString &rStr, bool bQuoted=true)
Denotes special characters in a string.
Definition: undel.cxx:717
void DelContentIndex(const SwPosition &pMark, const SwPosition &pPoint, DelContentType nDelContentType=DelContentType::AllMask)
Definition: undobj.cxx:865
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:625
SwNodeOffset GetIndex() const
Definition: node.hxx:292
SwNodeOffset m_nNode
Definition: UndoInsert.hxx:48
Marks a character position inside a document model node.
Definition: index.hxx:33
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
sal_Int32 m_nEndCnt
Definition: unins.cxx:490
std::shared_ptr< MetadatableUndo > CreateUndo() const
Marks a node in the document model.
Definition: ndindex.hxx:30
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:827
OUString m_sSeparator
Definition: UndoInsert.hxx:175
bool HasSwAttrSet() const
Definition: node.hxx:458
void CheckChar(const SwPosition &rPos, sal_Unicode cChar)
Definition: acorrect.cxx:615
sal_Int32 m_nSetPos
Definition: unins.cxx:490
bool ReRead(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic=nullptr, bool bModify=true)
Re-read in case graphic was not OK.
Definition: ndgrf.cxx:130
void SetFlys(SwFrameFormat &rOldFly, SfxItemSet const &rChgSet, SwFrameFormat &rNewFly)
Definition: unins.cxx:1025
std::unique_ptr< SwUndoFormatAttr > ReleaseUndo()
OUString m_sIns
Definition: unins.cxx:488
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
const SwPosition * Start() const
Definition: pam.hxx:213
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:134
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
SwFlyFrameFormat * InsertLabel(const SwLabelType eType, const OUString &rText, const OUString &rSeparator, const OUString &rNumberingSeparator, const bool bBefore, const sal_uInt16 nId, const SwNodeOffset nIdx, const OUString &rCharacterStyle, const bool bCpyBrd)
Definition: doclay.cxx:960
sal_Int32 m_nLen
Definition: UndoInsert.hxx:49
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:448
css::uno::Reference< css::embed::XEmbeddedObject > GetEmbeddedObject(const OUString &, OUString const *pBaseURL=nullptr)
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:203
ignore Redlines
const SwMirrorGrf & GetMirrorGrf(bool=true) const
Definition: grfatr.hxx:282
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:2297
void SetAutoCorrExceptWord(std::unique_ptr< SwAutoCorrExceptWord > pNew)
Definition: docedt.cxx:826
void ClearSwpHintsArr(bool bDelFields)
Definition: thints.cxx:3396
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual bool SplitRedline(const SwPaM &rPam)=0
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:619
void RedoImpl(::sw::UndoRedoContext &)
Definition: unins.cxx:726
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1566
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:405
general base class for all free-flowing frames
Definition: flyfrm.hxx:78
virtual SdrLayerID GetInvisibleHeavenId() const =0
std::unique_ptr< Graphic > mpGraphic
Definition: UndoInsert.hxx:140
OUString ShortenString(const OUString &rStr, sal_Int32 nLength, const OUString &rFillStr)
Shortens a string to a maximum length.
Definition: undobj.cxx:1534
Blocks grouping undo actions together into an SfxListUndoAction.
virtual bool DelFullPara(SwPaM &)=0
Delete full paragraphs.
OUString aName
sal_Int32 GetIndex() const
Definition: index.hxx:91
virtual ~SwUndoReplace() override
Definition: unins.cxx:516
SwDoc * m_pDoc
Definition: UndoInsert.hxx:60
virtual bool IsRedlineOn() const =0
Query if redlining is on.
SwNodes & GetNodes()
Definition: doc.hxx:408
Impl(SwPaM const &rPam, OUString const &rIns, bool const bRegExp)
Definition: unins.cxx:583
const SwPosition * End() const
Definition: pam.hxx:218
virtual ~SwUndoInsert() override
Definition: unins.cxx:186
SwNodeOffset m_nSttNd
Definition: unins.cxx:489
bool IsGrfLink() const
Query link-data.
Definition: ndgrf.hxx:129
sal_uInt16 m_nFieldId
Definition: UndoInsert.hxx:179
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
delete nodes
Definition: nodes.cxx:1085
static SwRewriter CreateRewriter(const OUString &rStr)
Definition: unins.cxx:1006
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
virtual bool AppendTextNode(SwPosition &rPos)=0
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:724
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:358
MirrorGraph mnMirror
Definition: UndoInsert.hxx:144
SwUndoInsert(const SwNodeIndex &rNode, sal_Int32 nContent, sal_Int32 nLen, const SwInsertFlags nInsertFlags, bool bWDelim=true)
Definition: unins.cxx:102
std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd
Definition: unins.cxx:495
bool CanGrouping(sal_Unicode cIns)
Definition: unins.cxx:129
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:494
bool StoreEmbeddedObject(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, OUString &rName, bool bCopy, const OUString &rSrcShellID, const OUString &rDestShellID)
SwNodeOffset m_nEndNd
Definition: unins.cxx:489
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
sal_Int32 nLength
SwLabelType m_eType
Definition: UndoInsert.hxx:180
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
virtual const SwRedlineTable & GetRedlineTable() const =0
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
void Init(const SwNodeIndex &rNode)
Definition: unins.cxx:86
const SwIndexReg * GetIdxReg() const
Definition: index.hxx:97
sal_Int32 m_nContent
Definition: UndoInsert.hxx:49
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:160
struct SwUndoInsertLabel::@5::@8 NODE
SdrLayerID m_nLayerId
Definition: UndoInsert.hxx:181
void UndoImpl(::sw::UndoRedoContext &)
Definition: unins.cxx:644
virtual bool DeleteAndJoin(SwPaM &)=0
complete delete of a given PaM
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:525
static void MoveToUndoNds(SwPaM &rPam, SwNodeIndex *pNodeIdx, SwNodeOffset *pEndNdIdx=nullptr)
Definition: undobj.cxx:731
CharClass & GetAppCharClass()
Definition: init.cxx:705
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:520
void Move(sal_uInt16 nPos, SwHistory *pIns, sal_uInt16 const nStart=0)
Definition: rolbck.hxx:386
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:719
aStr
void RestoreMetadata(std::shared_ptr< MetadatableUndo > const &i_pUndo)
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:140
std::optional< OUString > maText
Definition: UndoInsert.hxx:45
const Graphic & GetGrf(bool bWait=false) const
Definition: ndgrf.cxx:373
const int nUndoStringLength
Definition: UndoCore.hxx:243
virtual ~SwUndoInsertLabel() override
Definition: unins.cxx:870
virtual SwRewriter GetRewriter() const override
Returns the rewriter of this undo object.
Definition: unins.cxx:573
OUString const & GetOld() const
Definition: unins.cxx:505
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:864
bool m_bDetectedRangeSegmentation false
EnumT GetValue() const
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:858
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:920
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
static void MoveFromUndoNds(SwDoc &rDoc, SwNodeOffset nNodeIdx, SwPosition &rInsPos, const SwNodeOffset *pEndNdIdx=nullptr, bool bForceCreateFrames=false)
Definition: undobj.cxx:768