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 o3tl::optional<OUString> SwUndoInsert::GetTextFromDoc() const
60 {
61  o3tl::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  tools::SvRef<SotStorage> aRef = new SotStorage( OUString() );
425  SwOLEObj& rSwOLE = static_cast<SwOLENode*>(pCNd)->GetOLEObj();
426 
427  // temporary storage until object is inserted
428  // TODO/MBA: seems that here a physical copy is done - not as in drawing layer! Testing!
429  // TODO/LATER: Copying through the container would copy the replacement image as well
431  OUString aName = aCnt.CreateUniqueObjectName();
432  if (aCnt.StoreEmbeddedObject(rSwOLE.GetOleRef(), aName, true, OUString(), OUString()))
433  {
434  uno::Reference < embed::XEmbeddedObject > aNew = aCnt.GetEmbeddedObject( aName );
436  rContext.GetRepeatPaM(),
438  static_cast<SwOLENode*>(pCNd)->GetAspect() ),
439  nullptr );
440  }
441 
442  break;
443  }
444 
445  default: break;
446  }
447 }
448 
450 {
451  SwRewriter aResult;
452  o3tl::optional<OUString> aStr;
453  bool bDone = false;
454 
455  if (maText)
456  aStr = maText;
457  else if (maUndoText)
458  aStr = maUndoText;
459 
460  if (aStr)
461  {
462  OUString aString = ShortenString(DenoteSpecialCharacters(*aStr),
464  SwResId(STR_LDOTS));
465 
466  aResult.AddRule(UndoArg1, aString);
467 
468  bDone = true;
469  }
470 
471  if ( ! bDone )
472  {
473  aResult.AddRule(UndoArg1, "??");
474  }
475 
476  return aResult;
477 }
478 
480  : private SwUndoSaveContent
481 {
482  OUString m_sOld;
483  OUString const m_sIns;
486  bool m_bSplitNext : 1;
487  bool const m_bRegExp : 1;
488  // metadata references for paragraph and following para (if m_bSplitNext)
489  std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
490  std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
491 
492 public:
493  Impl(SwPaM const& rPam, OUString const& rIns, bool const bRegExp);
494  virtual ~Impl()
495  {
496  }
497 
498  void UndoImpl( ::sw::UndoRedoContext & );
499  void RedoImpl( ::sw::UndoRedoContext & );
500 
501  void SetEnd(SwPaM const& rPam);
502 
503  OUString const& GetOld() const { return m_sOld; }
504  OUString const& GetIns() const { return m_sIns; }
505 };
506 
508  OUString const& rIns, bool const bRegExp)
509  : SwUndo( SwUndoId::REPLACE, rPam.GetDoc() )
510  , m_pImpl(std::make_unique<Impl>(rPam, rIns, bRegExp))
511 {
512 }
513 
515 {
516 }
517 
519 {
520  m_pImpl->UndoImpl(rContext);
521 }
522 
524 {
525  m_pImpl->RedoImpl(rContext);
526 }
527 
530  OUString const& sOld, OUString const& sNew)
531 {
532  SwRewriter aResult;
533 
534  if (1 < occurrences)
535  {
536  aResult.AddRule(UndoArg1, OUString::number(occurrences));
537  aResult.AddRule(UndoArg2, SwResId(STR_OCCURRENCES_OF));
538 
539  OUString aTmpStr = SwResId(STR_START_QUOTE);
540  aTmpStr += ShortenString(sOld, nUndoStringLength,
541  SwResId(STR_LDOTS));
542  aTmpStr += SwResId(STR_END_QUOTE);
543  aResult.AddRule(UndoArg3, aTmpStr);
544  }
545  else if (1 == occurrences)
546  {
547  {
548  OUString aTmpStr = SwResId(STR_START_QUOTE);
549  // #i33488 #
550  aTmpStr += ShortenString(sOld, nUndoStringLength,
551  SwResId(STR_LDOTS));
552  aTmpStr += SwResId(STR_END_QUOTE);
553  aResult.AddRule(UndoArg1, aTmpStr);
554  }
555 
556  aResult.AddRule(UndoArg2, SwResId(STR_YIELDS));
557 
558  {
559  OUString aTmpStr = SwResId(STR_START_QUOTE);
560  // #i33488 #
561  aTmpStr += ShortenString(sNew, nUndoStringLength,
562  SwResId(STR_LDOTS));
563  aTmpStr += SwResId(STR_END_QUOTE);
564  aResult.AddRule(UndoArg3, aTmpStr);
565  }
566  }
567 
568  return aResult;
569 }
570 
572 {
573  return MakeUndoReplaceRewriter(1, m_pImpl->GetOld(), m_pImpl->GetIns());
574 }
575 
576 void SwUndoReplace::SetEnd(SwPaM const& rPam)
577 {
578  m_pImpl->SetEnd(rPam);
579 }
580 
582  SwPaM const& rPam, OUString const& rIns, bool const bRegExp)
583  : m_sIns( rIns )
584  , m_nOffset( 0 )
585  , m_bRegExp(bRegExp)
586 {
587 
588  const SwPosition * pStt( rPam.Start() );
589  const SwPosition * pEnd( rPam.End() );
590 
591  m_nSttNd = m_nEndNd = pStt->nNode.GetIndex();
592  m_nSttCnt = pStt->nContent.GetIndex();
593  m_nSelEnd = m_nEndCnt = pEnd->nContent.GetIndex();
594 
595  m_bSplitNext = m_nSttNd != pEnd->nNode.GetIndex();
596 
597  SwTextNode* pNd = pStt->nNode.GetNode().GetTextNode();
598  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
599 
600  m_pHistory.reset( new SwHistory );
601  DelContentIndex( *rPam.GetMark(), *rPam.GetPoint() );
602 
603  m_nSetPos = m_pHistory->Count();
604 
605  sal_uLong nNewPos = pStt->nNode.GetIndex();
606  m_nOffset = m_nSttNd - nNewPos;
607 
608  if ( pNd->GetpSwpHints() )
609  {
610  m_pHistory->CopyAttr( pNd->GetpSwpHints(), nNewPos, 0,
611  pNd->GetText().getLength(), true );
612  }
613 
614  if ( m_bSplitNext )
615  {
616  if( pNd->HasSwAttrSet() )
617  m_pHistory->CopyFormatAttr( *pNd->GetpSwAttrSet(), nNewPos );
618  m_pHistory->Add( pNd->GetTextColl(), nNewPos, SwNodeType::Text );
619 
620  SwTextNode* pNext = pEnd->nNode.GetNode().GetTextNode();
621  sal_uLong nTmp = pNext->GetIndex();
622  m_pHistory->CopyAttr( pNext->GetpSwpHints(), nTmp, 0,
623  pNext->GetText().getLength(), true );
624  if( pNext->HasSwAttrSet() )
625  m_pHistory->CopyFormatAttr( *pNext->GetpSwAttrSet(), nTmp );
626  m_pHistory->Add( pNext->GetTextColl(),nTmp, SwNodeType::Text );
627  // METADATA: store
629  m_pMetadataUndoEnd = pNext->CreateUndo();
630  }
631 
632  if( !m_pHistory->Count() )
633  {
634  m_pHistory.reset();
635  }
636 
637  const sal_Int32 nECnt = m_bSplitNext ? pNd->GetText().getLength()
638  : pEnd->nContent.GetIndex();
639  m_sOld = pNd->GetText().copy( m_nSttCnt, nECnt - m_nSttCnt );
640 }
641 
643 {
644  SwDoc *const pDoc = & rContext.GetDoc();
645  SwPaM & rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
646  rPam.DeleteMark();
647 
648  SwTextNode* pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
649  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
650 
651  SwAutoCorrExceptWord* pACEWord = pDoc->GetAutoCorrExceptWord();
652  if( pACEWord )
653  {
654  if ((1 == m_sIns.getLength()) && (1 == m_sOld.getLength()))
655  {
656  SwPosition aPos( *pNd ); aPos.nContent.Assign( pNd, m_nSttCnt );
657  pACEWord->CheckChar( aPos, m_sOld[ 0 ] );
658  }
659  pDoc->SetAutoCorrExceptWord( nullptr );
660  }
661 
662  SwIndex aIdx( pNd, m_nSttCnt );
663  // don't look at m_sIns for deletion, maybe it was not completely inserted
664  {
665  rPam.GetPoint()->nNode = *pNd;
666  rPam.GetPoint()->nContent.Assign( pNd, m_nSttCnt );
667  rPam.SetMark();
668  rPam.GetPoint()->nNode = m_nEndNd - m_nOffset;
669  rPam.GetPoint()->nContent.Assign( rPam.GetContentNode(), m_nEndCnt );
670  // move it out of the way so it is not registered at deleted node
671  aIdx.Assign(nullptr, 0);
672 
674  rPam.DeleteMark();
675  pNd = rPam.GetNode().GetTextNode();
676  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
677  aIdx.Assign( pNd, m_nSttCnt );
678  }
679 
680  if( m_bSplitNext )
681  {
682  SwPosition aPos( *pNd, aIdx );
683  pDoc->getIDocumentContentOperations().SplitNode( aPos, false );
684  pNd->RestoreMetadata(m_pMetadataUndoEnd);
685  pNd = pDoc->GetNodes()[ m_nSttNd - m_nOffset ]->GetTextNode();
686  aIdx.Assign( pNd, m_nSttCnt );
687  // METADATA: restore
688  pNd->RestoreMetadata(m_pMetadataUndoStart);
689  }
690 
691  if (!m_sOld.isEmpty())
692  {
693  OUString const ins( pNd->InsertText( m_sOld, aIdx ) );
694  assert(ins.getLength() == m_sOld.getLength()); // must succeed
695  (void) ins;
696  }
697 
698  if( m_pHistory )
699  {
700  if( pNd->GetpSwpHints() )
701  pNd->ClearSwpHintsArr( true );
702 
703  m_pHistory->TmpRollback( pDoc, m_nSetPos, false );
704  if ( m_nSetPos ) // there were footnotes/FlyFrames
705  {
706  // are there others than these?
707  if( m_nSetPos < m_pHistory->Count() )
708  {
709  // than save those attributes as well
710  SwHistory aHstr;
711  aHstr.Move( 0, m_pHistory.get(), m_nSetPos );
712  m_pHistory->Rollback( pDoc );
713  m_pHistory->Move( 0, &aHstr );
714  }
715  else
716  {
717  m_pHistory->Rollback( pDoc );
718  m_pHistory.reset();
719  }
720  }
721  }
722 
723  rPam.GetPoint()->nNode = m_nSttNd;
724  rPam.GetPoint()->nContent = aIdx;
725 }
726 
728 {
729  SwDoc & rDoc = rContext.GetDoc();
730  SwPaM & rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
731  rPam.DeleteMark();
732  rPam.GetPoint()->nNode = m_nSttNd;
733 
734  SwTextNode* pNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
735  OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
736  rPam.GetPoint()->nContent.Assign( pNd, m_nSttCnt );
737  rPam.SetMark();
738  if( m_bSplitNext )
739  {
740  rPam.GetPoint()->nNode = m_nSttNd + 1;
741  pNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
742  }
743  rPam.GetPoint()->nContent.Assign( pNd, m_nSelEnd );
744 
745  if( m_pHistory )
746  {
747  auto xSave = std::make_unique<SwHistory>();
748  std::swap(m_pHistory, xSave);
749 
750  DelContentIndex( *rPam.GetMark(), *rPam.GetPoint() );
751  m_nSetPos = m_pHistory->Count();
752 
753  std::swap(xSave, m_pHistory);
754  m_pHistory->Move(0, xSave.get());
755  }
756  else
757  {
758  m_pHistory.reset( new SwHistory );
759  DelContentIndex( *rPam.GetMark(), *rPam.GetPoint() );
760  m_nSetPos = m_pHistory->Count();
761  if( !m_nSetPos )
762  {
763  m_pHistory.reset();
764  }
765  }
766 
767  rDoc.getIDocumentContentOperations().ReplaceRange( rPam, m_sIns, m_bRegExp );
768  rPam.DeleteMark();
769 }
770 
772 {
773  const SwPosition* pEnd = rPam.End();
774  m_nEndNd = m_nOffset + pEnd->nNode.GetIndex();
775  m_nEndCnt = pEnd->nContent.GetIndex();
776 }
777 
778 SwUndoReRead::SwUndoReRead( const SwPaM& rPam, const SwGrfNode& rGrfNd )
779  : SwUndo( SwUndoId::REREAD, rPam.GetDoc() ), mnPosition( rPam.GetPoint()->nNode.GetIndex() )
780 {
781  SaveGraphicData( rGrfNd );
782 }
783 
785 {
786 }
787 
789 {
790  SwDoc & rDoc = rContext.GetDoc();
791  SwGrfNode* pGrfNd = rDoc.GetNodes()[ mnPosition ]->GetGrfNode();
792 
793  if( !pGrfNd )
794  return ;
795 
796  // cache the old values
797  std::unique_ptr<Graphic> pOldGrf( mpGraphic ? new Graphic(*mpGraphic) : nullptr);
798  o3tl::optional<OUString> aOldNm = maNm;
799  o3tl::optional<OUString> aOldFltr = maFltr;
800  MirrorGraph nOldMirr = mnMirror;
801  // since all of them are cleared/modified by SaveGraphicData:
802  SaveGraphicData( *pGrfNd );
803 
804  if( aOldNm )
805  {
806  pGrfNd->ReRead( *aOldNm, maFltr ? *maFltr : OUString() );
807  }
808  else
809  {
810  pGrfNd->ReRead( OUString(), OUString(), pOldGrf.get() );
811  }
812 
813  if( MirrorGraph::Dont != nOldMirr )
814  pGrfNd->SetAttr( SwMirrorGrf() );
815 
816  rContext.SetSelections(pGrfNd->GetFlyFormat(), nullptr);
817 }
818 
820 {
821  SetAndSave(rContext);
822 }
823 
825 {
826  SetAndSave(rContext);
827 }
828 
830 {
831  if( rGrfNd.IsGrfLink() )
832  {
833  maNm = OUString();
834  maFltr = OUString();
835  rGrfNd.GetFileFilterNms(&*maNm, &*maFltr);
836  mpGraphic.reset();
837  }
838  else
839  {
840  mpGraphic.reset( new Graphic( rGrfNd.GetGrf(true) ) );
841  maNm.reset();
842  maFltr.reset();
843  }
845 }
846 
848  const OUString &rText,
849  const OUString& rSeparator,
850  const OUString& rNumberSeparator,
851  const bool bBef,
852  const sal_uInt16 nInitId,
853  const OUString& rCharacterStyle,
854  const bool bCpyBorder,
855  const SwDoc* pDoc )
856  : SwUndo( SwUndoId::INSERTLABEL, pDoc ),
857  m_sText( rText ),
858  m_sSeparator( rSeparator ),
859  m_sNumberSeparator( rNumberSeparator ),//#i61007# order of captions
860  m_sCharacterStyle( rCharacterStyle ),
861  m_nFieldId( nInitId ),
862  m_eType( eTyp ),
863  m_nLayerId( 0 ),
864  m_bBefore( bBef ),
865  m_bCopyBorder( bCpyBorder )
866 {
867  m_bUndoKeep = false;
868  OBJECT.pUndoFly = nullptr;
869  OBJECT.pUndoAttr = nullptr;
870 }
871 
873 {
875  {
876  delete OBJECT.pUndoFly;
877  delete OBJECT.pUndoAttr;
878  }
879  else
880  delete NODE.pUndoInsNd;
881 }
882 
884 {
885  SwDoc & rDoc = rContext.GetDoc();
886 
888  {
889  OSL_ENSURE( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer not initialized" );
890  SwFrameFormat* pFormat;
891  SdrObject *pSdrObj = nullptr;
892  if( OBJECT.pUndoAttr &&
893  nullptr != (pFormat = static_cast<SwFrameFormat*>(OBJECT.pUndoAttr->GetFormat( rDoc ))) &&
894  ( SwLabelType::Draw != m_eType ||
895  nullptr != (pSdrObj = pFormat->FindSdrObject()) ) )
896  {
897  OBJECT.pUndoAttr->UndoImpl(rContext);
898  OBJECT.pUndoFly->UndoImpl(rContext);
899  if( SwLabelType::Draw == m_eType )
900  {
901  pSdrObj->SetLayer( m_nLayerId );
902  }
903  }
904  }
905  else if( NODE.nNode )
906  {
908  {
909  SwTableNode *pNd = rDoc.GetNodes()[
910  rDoc.GetNodes()[NODE.nNode-1]->StartOfSectionIndex()]->GetTableNode();
911  if ( pNd )
913  }
914  SwPaM aPam( rDoc.GetNodes().GetEndOfContent() );
915  aPam.GetPoint()->nNode = NODE.nNode;
916  aPam.SetMark();
917  aPam.GetPoint()->nNode = NODE.nNode + 1;
918  NODE.pUndoInsNd = new SwUndoDelete( aPam, true );
919  }
920 }
921 
923 {
924  SwDoc & rDoc = rContext.GetDoc();
925 
927  {
928  OSL_ENSURE( OBJECT.pUndoAttr && OBJECT.pUndoFly, "Pointer not initialized" );
929  SwFrameFormat* pFormat;
930  SdrObject *pSdrObj = nullptr;
931  if( OBJECT.pUndoAttr &&
932  nullptr != (pFormat = static_cast<SwFrameFormat*>(OBJECT.pUndoAttr->GetFormat( rDoc ))) &&
933  ( SwLabelType::Draw != m_eType ||
934  nullptr != (pSdrObj = pFormat->FindSdrObject()) ) )
935  {
936  OBJECT.pUndoFly->RedoImpl(rContext);
937  OBJECT.pUndoAttr->RedoImpl(rContext);
938  if( SwLabelType::Draw == m_eType )
939  {
940  pSdrObj->SetLayer( m_nLayerId );
941  if( pSdrObj->GetLayer() == rDoc.getIDocumentDrawModelAccess().GetHellId() )
942  pSdrObj->SetLayer( rDoc.getIDocumentDrawModelAccess().GetHeavenId() );
943  // OD 02.07.2003 #108784#
944  else if( pSdrObj->GetLayer() == rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId() )
946  }
947  }
948  }
949  else if( NODE.pUndoInsNd )
950  {
952  {
953  SwTableNode *pNd = rDoc.GetNodes()[
954  rDoc.GetNodes()[NODE.nNode-1]->StartOfSectionIndex()]->GetTableNode();
955  if ( pNd )
957  }
958  NODE.pUndoInsNd->UndoImpl(rContext);
959  delete NODE.pUndoInsNd;
960  NODE.pUndoInsNd = nullptr;
961  }
962 }
963 
965 {
966  SwDoc & rDoc = rContext.GetDoc();
967  const SwPosition& rPos = *rContext.GetRepeatPaM().GetPoint();
968 
969  sal_uLong nIdx = 0;
970 
971  SwContentNode* pCNd = rPos.nNode.GetNode().GetContentNode();
972  if( pCNd )
973  switch( m_eType )
974  {
975  case SwLabelType::Table:
976  {
977  const SwTableNode* pTNd = pCNd->FindTableNode();
978  if( pTNd )
979  nIdx = pTNd->GetIndex();
980  }
981  break;
982 
983  case SwLabelType::Fly:
984  case SwLabelType::Object:
985  {
986  SwFlyFrame* pFly;
988  if( pCnt && nullptr != ( pFly = pCnt->FindFlyFrame() ) )
989  nIdx = pFly->GetFormat()->GetContent().GetContentIdx()->GetIndex();
990  }
991  break;
992  case SwLabelType::Draw:
993  break;
994  }
995 
996  if( nIdx )
997  {
1000  }
1001 }
1002 
1004 {
1005  return CreateRewriter(m_sText);
1006 }
1007 
1009 {
1010  SwRewriter aRewriter;
1011 
1012  OUString aTmpStr;
1013 
1014  if (!rStr.isEmpty())
1015  {
1016  aTmpStr += SwResId(STR_START_QUOTE);
1017  aTmpStr += ShortenString(rStr, nUndoStringLength,
1018  SwResId(STR_LDOTS));
1019  aTmpStr += SwResId(STR_END_QUOTE);
1020  }
1021 
1022  aRewriter.AddRule(UndoArg1, aTmpStr);
1023 
1024  return aRewriter;
1025 }
1026 
1027 void SwUndoInsertLabel::SetFlys( SwFrameFormat& rOldFly, SfxItemSet const & rChgSet,
1028  SwFrameFormat& rNewFly )
1029 {
1031  {
1032  SwUndoFormatAttrHelper aTmp( rOldFly, false );
1033  rOldFly.SetFormatAttr( rChgSet );
1034  if ( aTmp.GetUndo() )
1035  {
1036  OBJECT.pUndoAttr = aTmp.ReleaseUndo().release();
1037  }
1038  OBJECT.pUndoFly = new SwUndoInsLayFormat( &rNewFly,0,0 );
1039  }
1040 }
1041 
1043 {
1044  if( SwLabelType::Draw == m_eType )
1045  {
1046  m_nLayerId = nLId;
1047  }
1048 }
1049 
1050 /* 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
SwAutoCorrExceptWord * GetAutoCorrExceptWord()
Definition: doc.hxx:1386
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:504
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:768
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:824
sal_Int32 m_nSttCnt
Definition: unins.cxx:485
std::unique_ptr< SwHistory > m_pHistory
Definition: undobj.hxx:161
sal_uLong m_nNode
Definition: UndoInsert.hxx:47
const OUString & GetText() const
Definition: ndtxt.hxx: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
bool const m_bIsAppend
Definition: UndoInsert.hxx:50
SwRewriter MakeUndoReplaceRewriter(sal_uLong const occurrences, OUString const &sOld, OUString const &sNew)
Definition: unins.cxx:529
sal_uIntPtr sal_uLong
SwPaM & GetRepeatPaM()
Definition: UndoCore.hxx:128
const SwPosition * GetMark() const
Definition: pam.hxx:209
virtual SdrLayerID GetHeavenId() const =0
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:912
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1147
Definition: doc.hxx:185
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:576
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
#define RES_TXTATR_CHARFMT
Definition: hintids.hxx:236
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:847
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:482
sal_Int32 m_nSelEnd
Definition: unins.cxx:485
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:154
SwContentNode * GetContentNode(bool bPoint=true) const
Definition: pam.hxx:229
void Delete(const SwNodeIndex &rPos, sal_uLong nNodes=1)
delete nodes
Definition: nodes.cxx:1065
sal_uInt16 sal_Unicode
virtual ~Impl()
Definition: unins.cxx:494
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unins.cxx:372
SwIndex nContent
Definition: pam.hxx:38
bool empty() const
Definition: docary.hxx:367
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unins.cxx:964
static bool IsRedlineOn(const RedlineFlags eM)
SwDoc & GetDoc() const
Definition: UndoCore.hxx:126
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
o3tl::optional< OUString > GetTextFromDoc() const
Definition: unins.cxx:59
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:712
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:819
SwDoc & GetDoc() const
Definition: UndoCore.hxx:94
static void RemoveIdxFromRange(SwPaM &rPam, bool bMoveNext)
Definition: undobj.cxx:123
void SetDrawObj(SdrLayerID nLayerId)
Definition: unins.cxx:1042
RedlineFlags GetRedlineFlags() const
Definition: undobj.hxx:118
SwUndoFormatAttr * GetUndo() const
virtual SdrLayerID GetInvisibleHellId() const =0
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:163
std::unique_ptr< SwRedlineData > m_pRedlData
Definition: UndoInsert.hxx:46
virtual std::size_t GetRedlineAuthor()=0
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:289
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:495
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().
Style of a layout element.
Definition: frmfmt.hxx:57
SwLabelType const m_eType
Definition: UndoInsert.hxx:177
o3tl::optional< OUString > maText
Definition: UndoInsert.hxx:44
void SetEnd(SwPaM const &rPam)
Definition: unins.cxx:771
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:507
virtual SwRewriter GetRewriter() const override
Returns rewriter for this undo object.
Definition: unins.cxx:449
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
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
SwContentNode * GetContentNode()
Definition: node.hxx:615
bool const m_bRegExp
Definition: unins.cxx:487
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:485
bool const m_bBefore
Definition: UndoInsert.hxx:179
o3tl::optional< OUString > maFltr
Definition: UndoInsert.hxx:139
std::shared_ptr< MetadatableUndo > CreateUndo() const
Marks a node in the document model.
Definition: ndindex.hxx:31
sal_uLong m_nEndNd
Definition: unins.cxx:484
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:808
bool HasSwAttrSet() const
Definition: node.hxx:444
OUString SwResId(const char *pId)
Definition: swmodule.cxx:178
void CheckChar(const SwPosition &rPos, sal_Unicode cChar)
Definition: acorrect.cxx:528
OUString const m_sCharacterStyle
Definition: UndoInsert.hxx:174
sal_Int32 m_nSetPos
Definition: unins.cxx:485
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: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:1027
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:1003
const sal_uInt64 mnPosition
SwUndoReRead(const SwPaM &rPam, const SwGrfNode &pGrfNd)
Definition: unins.cxx:778
std::unique_ptr< Impl > m_pImpl
Definition: UndoInsert.hxx:131
void SaveGraphicData(const SwGrfNode &)
Definition: unins.cxx:829
virtual SdrLayerID GetHellId() const =0
virtual SdrLayerID GetLayer() const
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
sal_Int32 m_nLen
Definition: UndoInsert.hxx:48
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
css::uno::Reference< css::embed::XEmbeddedObject > GetEmbeddedObject(const OUString &, OUString const *pBaseURL=nullptr)
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:202
ignore Redlines
const SwMirrorGrf & GetMirrorGrf(bool=true) const
Definition: grfatr.hxx:280
OUString const m_sIns
Definition: unins.cxx:483
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:883
bool const m_bIsWordDelim
Definition: UndoInsert.hxx:49
OUString InsertText(const OUString &rStr, const SwIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
Definition: ndtxt.cxx:2276
o3tl::optional< OUString > maNm
Definition: UndoInsert.hxx:138
void SetAutoCorrExceptWord(std::unique_ptr< SwAutoCorrExceptWord > pNew)
Definition: docedt.cxx:831
void ClearSwpHintsArr(bool bDelFields)
Definition: thints.cxx:3365
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:727
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:334
#define RES_TXTATR_AUTOFMT
Definition: hintids.hxx:234
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1484
void SetAndSave(::sw::UndoRedoContext &)
Definition: unins.cxx:788
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:749
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:1498
OUString const m_sNumberSeparator
Definition: UndoInsert.hxx:173
virtual bool DelFullPara(SwPaM &)=0
Delete full paragraphs.
OUString aName
sal_Int32 GetIndex() const
Definition: index.hxx:95
bool const m_bCopyBorder
Definition: UndoInsert.hxx:181
virtual ~SwUndoReplace() override
Definition: unins.cxx:514
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:581
const SwPosition * End() const
Definition: pam.hxx:217
virtual ~SwUndoInsert() override
Definition: unins.cxx:185
#define RES_KEEP
Definition: hintids.hxx:310
bool IsGrfLink() const
Query link-data.
Definition: ndgrf.hxx:127
static SwRewriter CreateRewriter(const OUString &rStr)
Definition: unins.cxx:1008
o3tl::optional< OUString > maUndoText
Definition: UndoInsert.hxx:45
sal_uLong m_nSttNd
Definition: unins.cxx:484
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:784
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:349
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:490
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:489
OUString DenoteSpecialCharacters(const OUString &rStr)
Denotes special characters in a string.
Definition: undel.cxx:702
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.
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:469
sal_uLong mnPosition
Definition: UndoInsert.hxx:140
sal_Int32 const nLength
virtual const SwRedlineTable & GetRedlineTable() const =0
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
void Init(const SwNodeIndex &rNode)
Definition: unins.cxx:85
const SwIndexReg * GetIdxReg() const
Definition: index.hxx:101
sal_Int32 m_nContent
Definition: UndoInsert.hxx:48
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:161
struct SwUndoInsertLabel::@5::@8 NODE
SdrLayerID m_nLayerId
Definition: UndoInsert.hxx:178
void UndoImpl(::sw::UndoRedoContext &)
Definition: unins.cxx:642
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:523
CharClass & GetAppCharClass()
Definition: init.cxx:709
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:518
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:872
virtual SwRewriter GetRewriter() const override
Returns the rewriter of this undo object.
Definition: unins.cxx:571
OUString const & GetOld() const
Definition: unins.cxx:503
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:484
EnumT GetValue() const
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:836
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unins.cxx:922
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo