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 
494  void UndoImpl( ::sw::UndoRedoContext & );
495  void RedoImpl( ::sw::UndoRedoContext & );
496 
497  void SetEnd(SwPaM const& rPam);
498 
499  OUString const& GetOld() const { return m_sOld; }
500  OUString const& GetIns() const { return m_sIns; }
501 };
502 
504  OUString const& rIns, bool const bRegExp)
505  : SwUndo( SwUndoId::REPLACE, &rPam.GetDoc() )
506  , m_pImpl(std::make_unique<Impl>(rPam, rIns, bRegExp))
507 {
508 }
509 
511 {
512 }
513 
515 {
516  m_pImpl->UndoImpl(rContext);
517 }
518 
520 {
521  m_pImpl->RedoImpl(rContext);
522 }
523 
526  OUString const& sOld, OUString const& sNew)
527 {
528  SwRewriter aResult;
529 
530  if (1 < occurrences)
531  {
532  aResult.AddRule(UndoArg1, OUString::number(occurrences));
533  aResult.AddRule(UndoArg2, SwResId(STR_OCCURRENCES_OF));
534 
535  OUString aTmpStr = SwResId(STR_START_QUOTE);
536  aTmpStr += ShortenString(sOld, nUndoStringLength,
537  SwResId(STR_LDOTS));
538  aTmpStr += SwResId(STR_END_QUOTE);
539  aResult.AddRule(UndoArg3, aTmpStr);
540  }
541  else if (1 == occurrences)
542  {
543  {
544  OUString aTmpStr = SwResId(STR_START_QUOTE);
545  // #i33488 #
546  aTmpStr += ShortenString(sOld, nUndoStringLength,
547  SwResId(STR_LDOTS));
548  aTmpStr += SwResId(STR_END_QUOTE);
549  aResult.AddRule(UndoArg1, aTmpStr);
550  }
551 
552  aResult.AddRule(UndoArg2, SwResId(STR_YIELDS));
553 
554  {
555  OUString aTmpStr = SwResId(STR_START_QUOTE);
556  // #i33488 #
557  aTmpStr += ShortenString(sNew, nUndoStringLength,
558  SwResId(STR_LDOTS));
559  aTmpStr += SwResId(STR_END_QUOTE);
560  aResult.AddRule(UndoArg3, aTmpStr);
561  }
562  }
563 
564  return aResult;
565 }
566 
568 {
569  return MakeUndoReplaceRewriter(1, m_pImpl->GetOld(), m_pImpl->GetIns());
570 }
571 
572 void SwUndoReplace::SetEnd(SwPaM const& rPam)
573 {
574  m_pImpl->SetEnd(rPam);
575 }
576 
578  SwPaM const& rPam, OUString const& rIns, bool const bRegExp)
579  : m_sIns( rIns )
580  , m_nOffset( 0 )
581  , m_bRegExp(bRegExp)
582 {
583 
584  const SwPosition * pStt( rPam.Start() );
585  const SwPosition * pEnd( rPam.End() );
586 
587  m_nSttNd = m_nEndNd = pStt->nNode.GetIndex();
588  m_nSttCnt = pStt->nContent.GetIndex();
589  m_nSelEnd = m_nEndCnt = pEnd->nContent.GetIndex();
590 
591  m_bSplitNext = m_nSttNd != pEnd->nNode.GetIndex();
592 
593  SwTextNode* pNd = pStt->nNode.GetNode().GetTextNode();
594  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
595 
596  m_pHistory.reset( new SwHistory );
598 
599  m_nSetPos = m_pHistory->Count();
600 
601  sal_uLong nNewPos = pStt->nNode.GetIndex();
602  m_nOffset = m_nSttNd - nNewPos;
603 
604  if ( pNd->GetpSwpHints() )
605  {
606  m_pHistory->CopyAttr( pNd->GetpSwpHints(), nNewPos, 0,
607  pNd->GetText().getLength(), true );
608  }
609 
610  if ( m_bSplitNext )
611  {
612  if( pNd->HasSwAttrSet() )
613  m_pHistory->CopyFormatAttr( *pNd->GetpSwAttrSet(), nNewPos );
614  m_pHistory->Add( pNd->GetTextColl(), nNewPos, SwNodeType::Text );
615 
616  SwTextNode* pNext = pEnd->nNode.GetNode().GetTextNode();
617  sal_uLong nTmp = pNext->GetIndex();
618  m_pHistory->CopyAttr( pNext->GetpSwpHints(), nTmp, 0,
619  pNext->GetText().getLength(), true );
620  if( pNext->HasSwAttrSet() )
621  m_pHistory->CopyFormatAttr( *pNext->GetpSwAttrSet(), nTmp );
622  m_pHistory->Add( pNext->GetTextColl(),nTmp, SwNodeType::Text );
623  // METADATA: store
625  m_pMetadataUndoEnd = pNext->CreateUndo();
626  }
627 
628  if( !m_pHistory->Count() )
629  {
630  m_pHistory.reset();
631  }
632 
633  const sal_Int32 nECnt = m_bSplitNext ? pNd->GetText().getLength()
634  : pEnd->nContent.GetIndex();
635  m_sOld = pNd->GetText().copy( m_nSttCnt, nECnt - m_nSttCnt );
636 }
637 
639 {
640  SwDoc *const pDoc = & rContext.GetDoc();
641  SwPaM & rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
642  rPam.DeleteMark();
643 
644  SwTextNode* pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
645  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
646 
647  SwAutoCorrExceptWord* pACEWord = pDoc->GetAutoCorrExceptWord();
648  if( pACEWord )
649  {
650  if ((1 == m_sIns.getLength()) && (1 == m_sOld.getLength()))
651  {
652  SwPosition aPos( *pNd ); aPos.nContent.Assign( pNd, m_nSttCnt );
653  pACEWord->CheckChar( aPos, m_sOld[ 0 ] );
654  }
655  pDoc->SetAutoCorrExceptWord( nullptr );
656  }
657 
658  // don't look at m_sIns for deletion, maybe it was not completely inserted
659  {
660  rPam.GetPoint()->nNode = *pNd;
661  rPam.GetPoint()->nContent.Assign( pNd, m_nSttCnt );
662  rPam.SetMark();
663  rPam.GetPoint()->nNode = m_nSttNd - m_nOffset;
664  rPam.GetPoint()->nContent.Assign(rPam.GetContentNode(), m_nSttNd == m_nEndNd ? m_nEndCnt : pNd->Len());
665 
666  // replace only in start node, without regex
667  bool const ret = pDoc->getIDocumentContentOperations().ReplaceRange(rPam, m_sOld, false);
668  assert(ret); (void)ret;
669  if (m_nSttNd != m_nEndNd)
670  { // in case of regex inserting paragraph breaks, join nodes...
671  assert(rPam.GetMark()->nContent == rPam.GetMark()->nNode.GetNode().GetTextNode()->Len());
672  rPam.GetPoint()->nNode = m_nEndNd - m_nOffset;
673  rPam.GetPoint()->nContent.Assign(rPam.GetContentNode(true), m_nEndCnt);
675  }
676  rPam.DeleteMark();
677  pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
678  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
679  }
680 
681  if( m_bSplitNext )
682  {
683  SwPosition aPos(*pNd, pNd->Len());
684  pDoc->getIDocumentContentOperations().SplitNode( aPos, false );
685  pNd->RestoreMetadata(m_pMetadataUndoEnd);
686  pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
687  // METADATA: restore
688  pNd->RestoreMetadata(m_pMetadataUndoStart);
689  }
690 
691  if( m_pHistory )
692  {
693  if( pNd->GetpSwpHints() )
694  pNd->ClearSwpHintsArr( true );
695 
696  m_pHistory->TmpRollback( pDoc, m_nSetPos, false );
697  if ( m_nSetPos ) // there were footnotes/FlyFrames
698  {
699  // are there others than these?
700  if( m_nSetPos < m_pHistory->Count() )
701  {
702  // than save those attributes as well
703  SwHistory aHstr;
704  aHstr.Move( 0, m_pHistory.get(), m_nSetPos );
705  m_pHistory->Rollback( pDoc );
706  m_pHistory->Move( 0, &aHstr );
707  }
708  else
709  {
710  m_pHistory->Rollback( pDoc );
711  m_pHistory.reset();
712  }
713  }
714  }
715 
716  rPam.GetPoint()->nNode = m_nSttNd;
717  rPam.GetPoint()->nContent = m_nSttCnt;
718 }
719 
721 {
722  SwDoc & rDoc = rContext.GetDoc();
723  SwPaM & rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
724  rPam.DeleteMark();
725  rPam.GetPoint()->nNode = m_nSttNd;
726 
727  SwTextNode* pNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
728  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
729  rPam.GetPoint()->nContent.Assign( pNd, m_nSttCnt );
730  rPam.SetMark();
731  if( m_bSplitNext )
732  {
733  rPam.GetPoint()->nNode = m_nSttNd + 1;
734  pNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
735  }
736  rPam.GetPoint()->nContent.Assign( pNd, m_nSelEnd );
737 
738  if( m_pHistory )
739  {
740  auto xSave = std::make_unique<SwHistory>();
741  std::swap(m_pHistory, xSave);
742 
743  DelContentIndex(*rPam.GetMark(), *rPam.GetPoint(), DelContentType::AllMask | DelContentType::Replace);
744  m_nSetPos = m_pHistory->Count();
745 
746  std::swap(xSave, m_pHistory);
747  m_pHistory->Move(0, xSave.get());
748  }
749  else
750  {
751  m_pHistory.reset( new SwHistory );
752  DelContentIndex(*rPam.GetMark(), *rPam.GetPoint(), DelContentType::AllMask | DelContentType::Replace);
753  m_nSetPos = m_pHistory->Count();
754  if( !m_nSetPos )
755  {
756  m_pHistory.reset();
757  }
758  }
759 
760  rDoc.getIDocumentContentOperations().ReplaceRange( rPam, m_sIns, m_bRegExp );
761  rPam.DeleteMark();
762 }
763 
765 {
766  const SwPosition* pEnd = rPam.End();
767  m_nEndNd = m_nOffset + pEnd->nNode.GetIndex();
768  m_nEndCnt = pEnd->nContent.GetIndex();
769 }
770 
771 SwUndoReRead::SwUndoReRead( const SwPaM& rPam, const SwGrfNode& rGrfNd )
772  : SwUndo( SwUndoId::REREAD, &rPam.GetDoc() ), mnPosition( rPam.GetPoint()->nNode.GetIndex() )
773 {
774  SaveGraphicData( rGrfNd );
775 }
776 
778 {
779 }
780 
782 {
783  SwDoc & rDoc = rContext.GetDoc();
784  SwGrfNode* pGrfNd = rDoc.GetNodes()[ mnPosition ]->GetGrfNode();
785 
786  if( !pGrfNd )
787  return ;
788 
789  // cache the old values
790  std::unique_ptr<Graphic> pOldGrf( mpGraphic ? new Graphic(*mpGraphic) : nullptr);
791  std::optional<OUString> aOldNm = maNm;
792  MirrorGraph nOldMirr = mnMirror;
793  // since all of them are cleared/modified by SaveGraphicData:
794  SaveGraphicData( *pGrfNd );
795 
796  if( aOldNm )
797  {
798  pGrfNd->ReRead( *aOldNm, maFltr ? *maFltr : OUString() );
799  }
800  else
801  {
802  pGrfNd->ReRead( OUString(), OUString(), pOldGrf.get() );
803  }
804 
805  if( MirrorGraph::Dont != nOldMirr )
806  pGrfNd->SetAttr( SwMirrorGrf() );
807 
808  rContext.SetSelections(pGrfNd->GetFlyFormat(), nullptr);
809 }
810 
812 {
813  SetAndSave(rContext);
814 }
815 
817 {
818  SetAndSave(rContext);
819 }
820 
822 {
823  if( rGrfNd.IsGrfLink() )
824  {
825  maNm = OUString();
826  maFltr = OUString();
827  rGrfNd.GetFileFilterNms(&*maNm, &*maFltr);
828  mpGraphic.reset();
829  }
830  else
831  {
832  mpGraphic.reset( new Graphic( rGrfNd.GetGrf(true) ) );
833  maNm.reset();
834  maFltr.reset();
835  }
837 }
838 
840  const OUString &rText,
841  const OUString& rSeparator,
842  const OUString& rNumberSeparator,
843  const bool bBef,
844  const sal_uInt16 nInitId,
845  const OUString& rCharacterStyle,
846  const bool bCpyBorder,
847  const SwDoc* pDoc )
848  : SwUndo( SwUndoId::INSERTLABEL, pDoc ),
849  m_sText( rText ),
850  m_sSeparator( rSeparator ),
851  m_sNumberSeparator( rNumberSeparator ),//#i61007# order of captions
852  m_sCharacterStyle( rCharacterStyle ),
853  m_nFieldId( nInitId ),
854  m_eType( eTyp ),
855  m_nLayerId( 0 ),
856  m_bBefore( bBef ),
857  m_bCopyBorder( bCpyBorder )
858 {
859  m_bUndoKeep = false;
860  OBJECT.pUndoFly = nullptr;
861  OBJECT.pUndoAttr = nullptr;
862 }
863 
865 {
867  {
868  delete OBJECT.pUndoFly;
869  delete OBJECT.pUndoAttr;
870  }
871  else
872  delete NODE.pUndoInsNd;
873 }
874 
876 {
877  SwDoc & rDoc = rContext.GetDoc();
878 
880  {
881  OSL_ENSURE( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer not initialized" );
882  SwFrameFormat* pFormat;
883  SdrObject *pSdrObj = nullptr;
884  if( OBJECT.pUndoAttr &&
885  nullptr != (pFormat = static_cast<SwFrameFormat*>(OBJECT.pUndoAttr->GetFormat( rDoc ))) &&
886  ( SwLabelType::Draw != m_eType ||
887  nullptr != (pSdrObj = pFormat->FindSdrObject()) ) )
888  {
889  OBJECT.pUndoAttr->UndoImpl(rContext);
890  OBJECT.pUndoFly->UndoImpl(rContext);
891  if( SwLabelType::Draw == m_eType )
892  {
893  pSdrObj->SetLayer( m_nLayerId );
894  }
895  }
896  }
897  else if( NODE.nNode )
898  {
900  {
901  SwTableNode *pNd = rDoc.GetNodes()[
902  rDoc.GetNodes()[NODE.nNode-1]->StartOfSectionIndex()]->GetTableNode();
903  if ( pNd )
905  }
906  SwPaM aPam( rDoc.GetNodes().GetEndOfContent() );
907  aPam.GetPoint()->nNode = NODE.nNode;
908  aPam.SetMark();
909  aPam.GetPoint()->nNode = NODE.nNode + 1;
910  NODE.pUndoInsNd = new SwUndoDelete( aPam, true );
911  }
912 }
913 
915 {
916  SwDoc & rDoc = rContext.GetDoc();
917 
919  {
920  OSL_ENSURE( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer not initialized" );
921  SwFrameFormat* pFormat;
922  SdrObject *pSdrObj = nullptr;
923  if( OBJECT.pUndoAttr &&
924  nullptr != (pFormat = static_cast<SwFrameFormat*>(OBJECT.pUndoAttr->GetFormat( rDoc ))) &&
925  ( SwLabelType::Draw != m_eType ||
926  nullptr != (pSdrObj = pFormat->FindSdrObject()) ) )
927  {
928  OBJECT.pUndoFly->RedoImpl(rContext);
929  OBJECT.pUndoAttr->RedoImpl(rContext);
930  if( SwLabelType::Draw == m_eType )
931  {
932  pSdrObj->SetLayer( m_nLayerId );
933  if( pSdrObj->GetLayer() == rDoc.getIDocumentDrawModelAccess().GetHellId() )
934  pSdrObj->SetLayer( rDoc.getIDocumentDrawModelAccess().GetHeavenId() );
935  // OD 02.07.2003 #108784#
936  else if( pSdrObj->GetLayer() == rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId() )
938  }
939  }
940  }
941  else if( NODE.pUndoInsNd )
942  {
944  {
945  SwTableNode *pNd = rDoc.GetNodes()[
946  rDoc.GetNodes()[NODE.nNode-1]->StartOfSectionIndex()]->GetTableNode();
947  if ( pNd )
949  }
950  NODE.pUndoInsNd->UndoImpl(rContext);
951  delete NODE.pUndoInsNd;
952  NODE.pUndoInsNd = nullptr;
953  }
954 }
955 
957 {
958  SwDoc & rDoc = rContext.GetDoc();
959  const SwPosition& rPos = *rContext.GetRepeatPaM().GetPoint();
960 
961  sal_uLong nIdx = 0;
962 
963  SwContentNode* pCNd = rPos.nNode.GetNode().GetContentNode();
964  if( pCNd )
965  switch( m_eType )
966  {
967  case SwLabelType::Table:
968  {
969  const SwTableNode* pTNd = pCNd->FindTableNode();
970  if( pTNd )
971  nIdx = pTNd->GetIndex();
972  }
973  break;
974 
975  case SwLabelType::Fly:
976  case SwLabelType::Object:
977  {
978  SwFlyFrame* pFly;
980  if( pCnt && nullptr != ( pFly = pCnt->FindFlyFrame() ) )
981  nIdx = pFly->GetFormat()->GetContent().GetContentIdx()->GetIndex();
982  }
983  break;
984  case SwLabelType::Draw:
985  break;
986  }
987 
988  if( nIdx )
989  {
992  }
993 }
994 
996 {
997  return CreateRewriter(m_sText);
998 }
999 
1001 {
1002  SwRewriter aRewriter;
1003 
1004  OUString aTmpStr;
1005 
1006  if (!rStr.isEmpty())
1007  {
1008  aTmpStr += SwResId(STR_START_QUOTE);
1009  aTmpStr += ShortenString(rStr, nUndoStringLength,
1010  SwResId(STR_LDOTS));
1011  aTmpStr += SwResId(STR_END_QUOTE);
1012  }
1013 
1014  aRewriter.AddRule(UndoArg1, aTmpStr);
1015 
1016  return aRewriter;
1017 }
1018 
1019 void SwUndoInsertLabel::SetFlys( SwFrameFormat& rOldFly, SfxItemSet const & rChgSet,
1020  SwFrameFormat& rNewFly )
1021 {
1023  {
1024  SwUndoFormatAttrHelper aTmp( rOldFly, false );
1025  rOldFly.SetFormatAttr( rChgSet );
1026  if ( aTmp.GetUndo() )
1027  {
1028  OBJECT.pUndoAttr = aTmp.ReleaseUndo().release();
1029  }
1030  OBJECT.pUndoFly = new SwUndoInsLayFormat( &rNewFly,0,0 );
1031  }
1032 }
1033 
1035 {
1036  if( SwLabelType::Draw == m_eType )
1037  {
1038  m_nLayerId = nLId;
1039  }
1040 }
1041 
1042 /* 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:1388
void SetSelections(SwFrameFormat *const pSelFormat, SdrMarkList *const pMarkList)
Definition: UndoCore.hxx:98
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2852
SwLabelType
Definition: swtypes.hxx:87
OUString const & GetIns() const
Definition: unins.cxx:500
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:816
sal_Int32 m_nSttCnt
Definition: unins.cxx:484
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:525
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:275
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:913
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1192
Definition: doc.hxx:184
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:572
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:839
const SwInsertFlags m_nInsertFlags
Definition: UndoInsert.hxx:53
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:202
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: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:372
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:956
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:505
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1089
bool GetFileFilterNms(OUString *pFileNm, OUString *pFilterNm) const
Definition: ndgrf.cxx:484
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:811
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:1034
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: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: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: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:764
SwUndoReplace(SwPaM const &rPam, OUString const &rInsert, bool const bRegExp)
Definition: unins.cxx:503
virtual SwRewriter GetRewriter() const override
Returns rewriter for this undo object.
Definition: unins.cxx:448
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:717
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:623
Marks a character position inside a document model node.
Definition: index.hxx:33
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: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:165
void CheckChar(const SwPosition &rPos, sal_Unicode cChar)
Definition: acorrect.cxx:602
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:126
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:1019
std::unique_ptr< SwUndoFormatAttr > ReleaseUndo()
OUString m_sIns
Definition: unins.cxx:482
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:995
const sal_uInt64 mnPosition
SwUndoReRead(const SwPaM &rPam, const SwGrfNode &pGrfNd)
Definition: unins.cxx:771
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:821
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:460
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:875
OUString InsertText(const OUString &rStr, const SwIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2249
void SetAutoCorrExceptWord(std::unique_ptr< SwAutoCorrExceptWord > pNew)
Definition: docedt.cxx:834
void ClearSwpHintsArr(bool bDelFields)
Definition: thints.cxx:3367
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:652
void RedoImpl(::sw::UndoRedoContext &)
Definition: unins.cxx:720
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1542
void SetAndSave(::sw::UndoRedoContext &)
Definition: unins.cxx:781
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: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:1523
virtual bool DelFullPara(SwPaM &)=0
Delete full paragraphs.
OUString aName
sal_Int32 GetIndex() const
Definition: index.hxx:91
virtual ~SwUndoReplace() override
Definition: unins.cxx:510
SwDoc * m_pDoc
Definition: UndoInsert.hxx:59
virtual bool IsRedlineOn() const =0
Query if redlining is on.
SwNodes & GetNodes()
Definition: doc.hxx:403
Impl(SwPaM const &rPam, OUString const &rIns, bool const bRegExp)
Definition: unins.cxx:577
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:1000
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:722
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
virtual ~SwUndoReRead() override
Definition: unins.cxx:777
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:352
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
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: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:638
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:519
CharClass & GetAppCharClass()
Definition: init.cxx:708
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:514
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:714
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:363
const int nUndoStringLength
Definition: UndoCore.hxx:224
virtual ~SwUndoInsertLabel() override
Definition: unins.cxx:864
virtual SwRewriter GetRewriter() const override
Returns the rewriter of this undo object.
Definition: unins.cxx:567
OUString const & GetOld() const
Definition: unins.cxx:499
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:844
sal_uLong m_nOffset
Definition: unins.cxx:483
EnumT GetValue() const
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:838
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:914
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo