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