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  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) += OUStringLiteral1(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  // than 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, USHRT_MAX );
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, USHRT_MAX );
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, USHRT_MAX );
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;
545  aTmpStr += SwResId(STR_START_QUOTE);
546  aTmpStr += ShortenString(sOld, nUndoStringLength,
547  SwResId(STR_LDOTS));
548  aTmpStr += SwResId(STR_END_QUOTE);
549  aResult.AddRule(UndoArg3, aTmpStr);
550  }
551  else if (1 == occurrences)
552  {
553  {
554  OUString aTmpStr;
555 
556  aTmpStr += SwResId(STR_START_QUOTE);
557  // #i33488 #
558  aTmpStr += ShortenString(sOld, nUndoStringLength,
559  SwResId(STR_LDOTS));
560  aTmpStr += SwResId(STR_END_QUOTE);
561  aResult.AddRule(UndoArg1, aTmpStr);
562  }
563 
564  aResult.AddRule(UndoArg2, SwResId(STR_YIELDS));
565 
566  {
567  OUString aTmpStr;
568 
569  aTmpStr += SwResId(STR_START_QUOTE);
570  // #i33488 #
571  aTmpStr += ShortenString(sNew, nUndoStringLength,
572  SwResId(STR_LDOTS));
573  aTmpStr += SwResId(STR_END_QUOTE);
574  aResult.AddRule(UndoArg3, aTmpStr);
575  }
576  }
577 
578  return aResult;
579 }
580 
582 {
583  return MakeUndoReplaceRewriter(1, m_pImpl->GetOld(), m_pImpl->GetIns());
584 }
585 
586 void SwUndoReplace::SetEnd(SwPaM const& rPam)
587 {
588  m_pImpl->SetEnd(rPam);
589 }
590 
592  SwPaM const& rPam, OUString const& rIns, bool const bRegExp)
593  : m_sIns( rIns )
594  , m_nOffset( 0 )
595  , m_bRegExp(bRegExp)
596 {
597 
598  const SwPosition * pStt( rPam.Start() );
599  const SwPosition * pEnd( rPam.End() );
600 
601  m_nSttNd = m_nEndNd = pStt->nNode.GetIndex();
602  m_nSttCnt = pStt->nContent.GetIndex();
603  m_nSelEnd = m_nEndCnt = pEnd->nContent.GetIndex();
604 
605  m_bSplitNext = m_nSttNd != pEnd->nNode.GetIndex();
606 
607  SwTextNode* pNd = pStt->nNode.GetNode().GetTextNode();
608  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
609 
610  pHistory.reset( new SwHistory );
611  DelContentIndex( *rPam.GetMark(), *rPam.GetPoint() );
612 
613  m_nSetPos = pHistory->Count();
614 
615  sal_uLong nNewPos = pStt->nNode.GetIndex();
616  m_nOffset = m_nSttNd - nNewPos;
617 
618  if ( pNd->GetpSwpHints() )
619  {
620  pHistory->CopyAttr( pNd->GetpSwpHints(), nNewPos, 0,
621  pNd->GetText().getLength(), true );
622  }
623 
624  if ( m_bSplitNext )
625  {
626  if( pNd->HasSwAttrSet() )
627  pHistory->CopyFormatAttr( *pNd->GetpSwAttrSet(), nNewPos );
628  pHistory->Add( pNd->GetTextColl(), nNewPos, SwNodeType::Text );
629 
630  SwTextNode* pNext = pEnd->nNode.GetNode().GetTextNode();
631  sal_uLong nTmp = pNext->GetIndex();
632  pHistory->CopyAttr( pNext->GetpSwpHints(), nTmp, 0,
633  pNext->GetText().getLength(), true );
634  if( pNext->HasSwAttrSet() )
635  pHistory->CopyFormatAttr( *pNext->GetpSwAttrSet(), nTmp );
636  pHistory->Add( pNext->GetTextColl(),nTmp, SwNodeType::Text );
637  // METADATA: store
639  m_pMetadataUndoEnd = pNext->CreateUndo();
640  }
641 
642  if( !pHistory->Count() )
643  {
644  pHistory.reset();
645  }
646 
647  const sal_Int32 nECnt = m_bSplitNext ? pNd->GetText().getLength()
648  : pEnd->nContent.GetIndex();
649  m_sOld = pNd->GetText().copy( m_nSttCnt, nECnt - m_nSttCnt );
650 }
651 
653 {
654  SwDoc *const pDoc = & rContext.GetDoc();
655  SwPaM & rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
656  rPam.DeleteMark();
657 
658  SwTextNode* pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
659  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
660 
661  SwAutoCorrExceptWord* pACEWord = pDoc->GetAutoCorrExceptWord();
662  if( pACEWord )
663  {
664  if ((1 == m_sIns.getLength()) && (1 == m_sOld.getLength()))
665  {
666  SwPosition aPos( *pNd ); aPos.nContent.Assign( pNd, m_nSttCnt );
667  pACEWord->CheckChar( aPos, m_sOld[ 0 ] );
668  }
669  pDoc->SetAutoCorrExceptWord( nullptr );
670  }
671 
672  SwIndex aIdx( pNd, m_nSttCnt );
673  // don't look at m_sIns for deletion, maybe it was not completely inserted
674  {
675  rPam.GetPoint()->nNode = *pNd;
676  rPam.GetPoint()->nContent.Assign( pNd, m_nSttCnt );
677  rPam.SetMark();
678  rPam.GetPoint()->nNode = m_nEndNd - m_nOffset;
679  rPam.GetPoint()->nContent.Assign( rPam.GetContentNode(), m_nEndCnt );
680  // move it out of the way so it is not registered at deleted node
681  aIdx.Assign(nullptr, 0);
682 
684  rPam.DeleteMark();
685  pNd = rPam.GetNode().GetTextNode();
686  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
687  aIdx.Assign( pNd, m_nSttCnt );
688  }
689 
690  if( m_bSplitNext )
691  {
692  SwPosition aPos( *pNd, aIdx );
693  pDoc->getIDocumentContentOperations().SplitNode( aPos, false );
694  pNd->RestoreMetadata(m_pMetadataUndoEnd);
695  pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
696  aIdx.Assign( pNd, m_nSttCnt );
697  // METADATA: restore
698  pNd->RestoreMetadata(m_pMetadataUndoStart);
699  }
700 
701  if (!m_sOld.isEmpty())
702  {
703  OUString const ins( pNd->InsertText( m_sOld, aIdx ) );
704  assert(ins.getLength() == m_sOld.getLength()); // must succeed
705  (void) ins;
706  }
707 
708  if( pHistory )
709  {
710  if( pNd->GetpSwpHints() )
711  pNd->ClearSwpHintsArr( true );
712 
713  pHistory->TmpRollback( pDoc, m_nSetPos, false );
714  if ( m_nSetPos ) // there were footnotes/FlyFrames
715  {
716  // are there others than these?
717  if( m_nSetPos < pHistory->Count() )
718  {
719  // than save those attributes as well
720  SwHistory aHstr;
721  aHstr.Move( 0, pHistory.get(), m_nSetPos );
722  pHistory->Rollback( pDoc );
723  pHistory->Move( 0, &aHstr );
724  }
725  else
726  {
727  pHistory->Rollback( pDoc );
728  pHistory.reset();
729  }
730  }
731  }
732 
733  rPam.GetPoint()->nNode = m_nSttNd;
734  rPam.GetPoint()->nContent = aIdx;
735 }
736 
738 {
739  SwDoc & rDoc = rContext.GetDoc();
740  SwPaM & rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
741  rPam.DeleteMark();
742  rPam.GetPoint()->nNode = m_nSttNd;
743 
744  SwTextNode* pNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
745  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
746  rPam.GetPoint()->nContent.Assign( pNd, m_nSttCnt );
747  rPam.SetMark();
748  if( m_bSplitNext )
749  {
750  rPam.GetPoint()->nNode = m_nSttNd + 1;
751  pNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
752  }
753  rPam.GetPoint()->nContent.Assign( pNd, m_nSelEnd );
754 
755  if( pHistory )
756  {
757  auto xSave = std::make_unique<SwHistory>();
758  std::swap(pHistory, xSave);
759 
760  DelContentIndex( *rPam.GetMark(), *rPam.GetPoint() );
761  m_nSetPos = pHistory->Count();
762 
763  std::swap(xSave, pHistory);
764  pHistory->Move(0, xSave.get());
765  }
766  else
767  {
768  pHistory.reset( new SwHistory );
769  DelContentIndex( *rPam.GetMark(), *rPam.GetPoint() );
770  m_nSetPos = pHistory->Count();
771  if( !m_nSetPos )
772  {
773  pHistory.reset();
774  }
775  }
776 
777  rDoc.getIDocumentContentOperations().ReplaceRange( rPam, m_sIns, m_bRegExp );
778  rPam.DeleteMark();
779 }
780 
782 {
783  const SwPosition* pEnd = rPam.End();
784  m_nEndNd = m_nOffset + pEnd->nNode.GetIndex();
785  m_nEndCnt = pEnd->nContent.GetIndex();
786 }
787 
788 SwUndoReRead::SwUndoReRead( const SwPaM& rPam, const SwGrfNode& rGrfNd )
789  : SwUndo( SwUndoId::REREAD, rPam.GetDoc() ), nPos( rPam.GetPoint()->nNode.GetIndex() )
790 {
791  SaveGraphicData( rGrfNd );
792 }
793 
795 {
796 }
797 
799 {
800  SwDoc & rDoc = rContext.GetDoc();
801  SwGrfNode* pGrfNd = rDoc.GetNodes()[ nPos ]->GetGrfNode();
802 
803  if( !pGrfNd )
804  return ;
805 
806  // cache the old values
807  std::unique_ptr<Graphic> pOldGrf( pGrf ? new Graphic(*pGrf) : nullptr);
810  MirrorGraph nOldMirr = nMirr;
811  // since all of them are cleared/modified by SaveGraphicData:
812  SaveGraphicData( *pGrfNd );
813 
814  if( aOldNm )
815  {
816  pGrfNd->ReRead( *aOldNm, maFltr ? *maFltr : OUString() );
817  }
818  else
819  {
820  pGrfNd->ReRead( OUString(), OUString(), pOldGrf.get() );
821  }
822 
823  if( MirrorGraph::Dont != nOldMirr )
824  pGrfNd->SetAttr( SwMirrorGrf() );
825 
826  rContext.SetSelections(pGrfNd->GetFlyFormat(), nullptr);
827 }
828 
830 {
831  SetAndSave(rContext);
832 }
833 
835 {
836  SetAndSave(rContext);
837 }
838 
840 {
841  if( rGrfNd.IsGrfLink() )
842  {
843  maNm = OUString();
844  maFltr = OUString();
845  rGrfNd.GetFileFilterNms(&*maNm, &*maFltr);
846  pGrf.reset();
847  }
848  else
849  {
850  pGrf.reset( new Graphic( rGrfNd.GetGrf(true) ) );
851  maNm.reset();
852  maFltr.reset();
853  }
854  nMirr = rGrfNd.GetSwAttrSet().GetMirrorGrf().GetValue();
855 }
856 
858  const OUString &rText,
859  const OUString& rSeparator,
860  const OUString& rNumberSeparator,
861  const bool bBef,
862  const sal_uInt16 nInitId,
863  const OUString& rCharacterStyle,
864  const bool bCpyBorder,
865  const SwDoc* pDoc )
866  : SwUndo( SwUndoId::INSERTLABEL, pDoc ),
867  sText( rText ),
868  sSeparator( rSeparator ),
869  sNumberSeparator( rNumberSeparator ),//#i61007# order of captions
870  sCharacterStyle( rCharacterStyle ),
871  nFieldId( nInitId ),
872  eType( eTyp ),
873  nLayerId( 0 ),
874  bBefore( bBef ),
875  bCpyBrd( bCpyBorder )
876 {
877  bUndoKeep = false;
878  OBJECT.pUndoFly = nullptr;
879  OBJECT.pUndoAttr = nullptr;
880 }
881 
883 {
884  if( LTYPE_OBJECT == eType || LTYPE_DRAW == eType )
885  {
886  delete OBJECT.pUndoFly;
887  delete OBJECT.pUndoAttr;
888  }
889  else
890  delete NODE.pUndoInsNd;
891 }
892 
894 {
895  SwDoc & rDoc = rContext.GetDoc();
896 
897  if( LTYPE_OBJECT == eType || LTYPE_DRAW == eType )
898  {
899  OSL_ENSURE( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer not initialized" );
900  SwFrameFormat* pFormat;
901  SdrObject *pSdrObj = nullptr;
902  if( OBJECT.pUndoAttr &&
903  nullptr != (pFormat = static_cast<SwFrameFormat*>(OBJECT.pUndoAttr->GetFormat( rDoc ))) &&
904  ( LTYPE_DRAW != eType ||
905  nullptr != (pSdrObj = pFormat->FindSdrObject()) ) )
906  {
907  OBJECT.pUndoAttr->UndoImpl(rContext);
908  OBJECT.pUndoFly->UndoImpl(rContext);
909  if( LTYPE_DRAW == eType )
910  {
911  pSdrObj->SetLayer( nLayerId );
912  }
913  }
914  }
915  else if( NODE.nNode )
916  {
917  if ( eType == LTYPE_TABLE && bUndoKeep )
918  {
919  SwTableNode *pNd = rDoc.GetNodes()[
920  rDoc.GetNodes()[NODE.nNode-1]->StartOfSectionIndex()]->GetTableNode();
921  if ( pNd )
923  }
924  SwPaM aPam( rDoc.GetNodes().GetEndOfContent() );
925  aPam.GetPoint()->nNode = NODE.nNode;
926  aPam.SetMark();
927  aPam.GetPoint()->nNode = NODE.nNode + 1;
928  NODE.pUndoInsNd = new SwUndoDelete( aPam, true );
929  }
930 }
931 
933 {
934  SwDoc & rDoc = rContext.GetDoc();
935 
936  if( LTYPE_OBJECT == eType || LTYPE_DRAW == eType )
937  {
938  OSL_ENSURE( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer not initialized" );
939  SwFrameFormat* pFormat;
940  SdrObject *pSdrObj = nullptr;
941  if( OBJECT.pUndoAttr &&
942  nullptr != (pFormat = static_cast<SwFrameFormat*>(OBJECT.pUndoAttr->GetFormat( rDoc ))) &&
943  ( LTYPE_DRAW != eType ||
944  nullptr != (pSdrObj = pFormat->FindSdrObject()) ) )
945  {
946  OBJECT.pUndoFly->RedoImpl(rContext);
947  OBJECT.pUndoAttr->RedoImpl(rContext);
948  if( LTYPE_DRAW == eType )
949  {
950  pSdrObj->SetLayer( nLayerId );
951  if( pSdrObj->GetLayer() == rDoc.getIDocumentDrawModelAccess().GetHellId() )
952  pSdrObj->SetLayer( rDoc.getIDocumentDrawModelAccess().GetHeavenId() );
953  // OD 02.07.2003 #108784#
954  else if( pSdrObj->GetLayer() == rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId() )
956  }
957  }
958  }
959  else if( NODE.pUndoInsNd )
960  {
961  if ( eType == LTYPE_TABLE && bUndoKeep )
962  {
963  SwTableNode *pNd = rDoc.GetNodes()[
964  rDoc.GetNodes()[NODE.nNode-1]->StartOfSectionIndex()]->GetTableNode();
965  if ( pNd )
967  }
968  NODE.pUndoInsNd->UndoImpl(rContext);
969  delete NODE.pUndoInsNd;
970  NODE.pUndoInsNd = nullptr;
971  }
972 }
973 
975 {
976  SwDoc & rDoc = rContext.GetDoc();
977  const SwPosition& rPos = *rContext.GetRepeatPaM().GetPoint();
978 
979  sal_uLong nIdx = 0;
980 
981  SwContentNode* pCNd = rPos.nNode.GetNode().GetContentNode();
982  if( pCNd )
983  switch( eType )
984  {
985  case LTYPE_TABLE:
986  {
987  const SwTableNode* pTNd = pCNd->FindTableNode();
988  if( pTNd )
989  nIdx = pTNd->GetIndex();
990  }
991  break;
992 
993  case LTYPE_FLY:
994  case LTYPE_OBJECT:
995  {
996  SwFlyFrame* pFly;
998  if( pCnt && nullptr != ( pFly = pCnt->FindFlyFrame() ) )
999  nIdx = pFly->GetFormat()->GetContent().GetContentIdx()->GetIndex();
1000  }
1001  break;
1002  case LTYPE_DRAW:
1003  break;
1004  }
1005 
1006  if( nIdx )
1007  {
1009  nFieldId, nIdx, sCharacterStyle, bCpyBrd );
1010  }
1011 }
1012 
1014 {
1015  return CreateRewriter(sText);
1016 }
1017 
1019 {
1020  SwRewriter aRewriter;
1021 
1022  OUString aTmpStr;
1023 
1024  if (!rStr.isEmpty())
1025  {
1026  aTmpStr += SwResId(STR_START_QUOTE);
1027  aTmpStr += ShortenString(rStr, nUndoStringLength,
1028  SwResId(STR_LDOTS));
1029  aTmpStr += SwResId(STR_END_QUOTE);
1030  }
1031 
1032  aRewriter.AddRule(UndoArg1, aTmpStr);
1033 
1034  return aRewriter;
1035 }
1036 
1037 void SwUndoInsertLabel::SetFlys( SwFrameFormat& rOldFly, SfxItemSet const & rChgSet,
1038  SwFrameFormat& rNewFly )
1039 {
1040  if( LTYPE_OBJECT == eType || LTYPE_DRAW == eType )
1041  {
1042  SwUndoFormatAttrHelper aTmp( rOldFly, false );
1043  rOldFly.SetFormatAttr( rChgSet );
1044  if ( aTmp.GetUndo() )
1045  {
1046  OBJECT.pUndoAttr = aTmp.ReleaseUndo().release();
1047  }
1048  OBJECT.pUndoFly = new SwUndoInsLayFormat( &rNewFly,0,0 );
1049  }
1050 }
1051 
1053 {
1054  if( LTYPE_DRAW == eType )
1055  {
1056  nLayerId = nLId;
1057  }
1058 }
1059 
1060 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< SwNodeIndex > m_pUndoNodeIndex
start of Content in UndoNodes for Redo
Definition: UndoInsert.hxx:43
bool const bCpyBrd
Definition: UndoInsert.hxx:181
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:1380
void SetSelections(SwFrameFormat *const pSelFormat, SdrMarkList *const pMarkList)
Definition: UndoCore.hxx:98
std::unique_ptr< SwHistory > pHistory
Definition: undobj.hxx:154
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2814
SwLabelType
Definition: swtypes.hxx:87
OUString const & GetIns() const
Definition: unins.cxx:509
Marks a position in the document model.
Definition: pam.hxx:35
OUString const sText
Definition: UndoInsert.hxx:170
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:756
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:834
sal_Int32 m_nSttCnt
Definition: unins.cxx:490
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
virtual SwPaM & CreateNewShellCursor()=0
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
OUString const sCharacterStyle
Definition: UndoInsert.hxx:174
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:900
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1150
Definition: doc.hxx:185
std::unique_ptr< SwRedlineData > pRedlData
Definition: UndoInsert.hxx:46
bool bCacheComment
Definition: undobj.hxx:59
void SetRedlineFlags(RedlineFlags eMode)
Definition: undobj.hxx:118
SwNode & GetNode() const
Definition: ndindex.hxx:118
MirrorGraph
Definition: grfatr.hxx:31
bool m_bWithRsid
Definition: UndoInsert.hxx:51
OUString const sSeparator
Definition: UndoInsert.hxx:172
void SetEnd(const SwPaM &rPam)
Definition: unins.cxx:586
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:176
#define RES_TXTATR_CHARFMT
Definition: hintids.hxx:142
virtual bool DeleteAndJoin(SwPaM &, const bool bForceJoinNext=false)=0
complete delete of a given PaM
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, sal_uInt16 nDelType)=0
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:347
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:857
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:187
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:1063
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:369
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unins.cxx:974
static bool IsRedlineOn(const RedlineFlags eM)
SwDoc & GetDoc() const
Definition: UndoCore.hxx:126
sal_uLong GetIndex() const
Definition: ndindex.hxx:151
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:488
sal_uInt16 const nFieldId
Definition: UndoInsert.hxx:176
static void MoveToUndoNds(SwPaM &rPam, SwNodeIndex *pNodeIdx, sal_uLong *pEndNdIdx=nullptr)
Definition: undobj.cxx:709
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:829
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:1052
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:117
SwUndoFormatAttr * GetUndo() const
virtual SdrLayerID GetInvisibleHellId() const =0
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:164
SdrLayerID nLayerId
Definition: UndoInsert.hxx:178
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:821
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:483
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
void SetEnd(SwPaM const &rPam)
Definition: unins.cxx:781
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:846
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:198
Count
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
std::shared_ptr< MetadatableUndo > CreateUndo() const
OUString const sNumberSeparator
Definition: UndoInsert.hxx:173
Marks a node in the document model.
Definition: ndindex.hxx:31
sal_uLong m_nEndNd
Definition: unins.cxx:489
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:808
bool HasSwAttrSet() const
Definition: node.hxx:444
OUString SwResId(const char *pId)
Definition: swmodule.cxx:191
void CheckChar(const SwPosition &rPos, sal_Unicode cChar)
Definition: acorrect.cxx:527
sal_Int32 m_nSetPos
Definition: unins.cxx:490
DocumentType const eType
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:131
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:973
void SetFlys(SwFrameFormat &rOldFly, SfxItemSet const &rChgSet, SwFrameFormat &rNewFly)
Definition: unins.cxx:1037
std::unique_ptr< SwUndoFormatAttr > ReleaseUndo()
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:437
const SwPosition * Start() const
Definition: pam.hxx:212
virtual SwRewriter GetRewriter() const override
Returns the rewriter of this undo object.
Definition: unins.cxx:1013
SwUndoReRead(const SwPaM &rPam, const SwGrfNode &pGrfNd)
Definition: unins.cxx:788
std::unique_ptr< Impl > m_pImpl
Definition: UndoInsert.hxx:131
void SaveGraphicData(const SwGrfNode &)
Definition: unins.cxx:839
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:460
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:893
const RedlineType_t REDLINE_INSERT
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:810
void ClearSwpHintsArr(bool bDelFields)
Definition: thints.cxx:3324
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:652
void RedoImpl(::sw::UndoRedoContext &)
Definition: unins.cxx:737
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:367
sal_uLong nNode
Definition: UndoInsert.hxx:47
#define RES_TXTATR_AUTOFMT
Definition: hintids.hxx:140
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1471
void SetAndSave(::sw::UndoRedoContext &)
Definition: unins.cxx:798
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:431
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:1505
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:259
virtual bool DelFullPara(SwPaM &)=0
Delete full paragraphs.
sal_Int32 GetIndex() const
Definition: index.hxx:95
virtual ~SwUndoReplace() override
Definition: unins.cxx:519
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:591
const SwPosition * End() const
Definition: pam.hxx:217
virtual ~SwUndoInsert() override
Definition: unins.cxx:190
#define RES_KEEP
Definition: hintids.hxx:215
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:1018
SwLabelType const eType
Definition: UndoInsert.hxx:177
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:794
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:351
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:706
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:457
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
void UndoImpl(::sw::UndoRedoContext &)
Definition: unins.cxx:652
sal_Int32 nPos
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:528
CharClass & GetAppCharClass()
Definition: init.cxx:740
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:376
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:710
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:368
const int nUndoStringLength
Definition: UndoCore.hxx:225
virtual ~SwUndoInsertLabel() override
Definition: unins.cxx:882
virtual SwRewriter GetRewriter() const override
Returns the rewriter of this undo object.
Definition: unins.cxx:581
OUString const & GetOld() const
Definition: unins.cxx:508
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
bool const bBefore
Definition: UndoInsert.hxx:179
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:932
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo