LibreOffice Module sw (master)  1
acorrect.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 <hintids.hxx>
21 
22 #include <svx/svxids.hrc>
23 #include <editeng/langitem.hxx>
24 #include <fmtinfmt.hxx>
25 #include <txtatr.hxx>
26 #include <txtinet.hxx>
27 #include <editsh.hxx>
28 #include <doc.hxx>
29 #include <pam.hxx>
30 #include <unocrsr.hxx>
31 #include <txtfrm.hxx>
32 #include <ndtxt.hxx>
33 #include <acorrect.hxx>
34 #include <shellio.hxx>
35 #include <swundo.hxx>
36 #include <viscrs.hxx>
37 
38 #include <editeng/acorrcfg.hxx>
39 
40 using namespace ::com::sun::star;
41 
43 {
48 
49  static void RemoveFromRing( SwPaM& rPam, SwPaM const * pPrev );
50 public:
51  PaMIntoCursorShellRing( SwCursorShell& rSh, SwPaM& rCursor, SwPaM& rPam );
53 };
54 
56  SwPaM& rShCursor, SwPaM& rPam )
57  : rSh( rCSh ), rDelPam( rPam ), rCursor( rShCursor )
58 {
59  SwPaM* pShCursor = rSh.GetCursor_();
60 
63 
66 }
67 
69 {
70  // and take out the Pam again:
73 }
74 
76 {
77  SwPaM* p;
78  SwPaM* pNext = &rPam;
79  do {
80  p = pNext;
81  pNext = p->GetNext();
82  p->MoveTo( &rPam );
83  } while( p != pPrev );
84 }
85 
87  sal_Unicode cIns )
88  : rEditSh( rEditShell ), rCursor( rPam )
89  , m_nEndUndoCounter(0)
90  , bUndoIdInitialized( cIns == 0 )
91 {
92 }
93 
95 {
96  for (int i = 0; i < m_nEndUndoCounter; ++i)
97  {
98  rEditSh.EndUndo();
99  }
100 }
101 
103 {
104  // this should work with plain SwPaM as well because start and end
105  // are always in same node, but since there is GetRanges already...
106  std::vector<std::shared_ptr<SwUnoCursor>> ranges;
107  if (sw::GetRanges(ranges, *rEditSh.GetDoc(), rDelPam))
108  {
109  DeleteSelImpl(rDelPam);
110  }
111  else
112  {
113  for (auto const& pCursor : ranges)
114  {
115  DeleteSelImpl(*pCursor);
116  }
117  }
118 }
119 
121 {
122  SwDoc* pDoc = rEditSh.GetDoc();
123  if( pDoc->IsAutoFormatRedline() )
124  {
125  // so that also the DelPam be moved, include it in the
126  // Shell-Cursr-Ring !!
127  // ??? is that really necessary - this should never join nodes, so Update should be enough?
128 // PaMIntoCursorShellRing aTmp( rEditSh, rCursor, rDelPam );
129  assert(rDelPam.GetPoint()->nNode == rDelPam.GetMark()->nNode);
130  pDoc->getIDocumentContentOperations().DeleteAndJoin( rDelPam );
131  }
132  else
133  {
134  pDoc->getIDocumentContentOperations().DeleteRange( rDelPam );
135  }
136 }
137 
138 bool SwAutoCorrDoc::Delete( sal_Int32 nStt, sal_Int32 nEnd )
139 {
140  SwTextNode const*const pTextNd = rCursor.GetNode().GetTextNode();
141  SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(
142  pTextNd->getLayoutFrame(rEditSh.GetLayout())));
143  assert(pFrame);
144  SwPaM aSel(pFrame->MapViewToModelPos(TextFrameIndex(nStt)),
145  pFrame->MapViewToModelPos(TextFrameIndex(nEnd)));
146  DeleteSel( aSel );
147 
148  if( bUndoIdInitialized )
149  bUndoIdInitialized = true;
150  return true;
151 }
152 
153 bool SwAutoCorrDoc::Insert( sal_Int32 nPos, const OUString& rText )
154 {
155  SwTextNode const*const pTextNd = rCursor.GetNode().GetTextNode();
156  SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(
157  pTextNd->getLayoutFrame(rEditSh.GetLayout())));
158  assert(pFrame);
159  SwPaM aPam(pFrame->MapViewToModelPos(TextFrameIndex(nPos)));
161  if( !bUndoIdInitialized )
162  {
163  bUndoIdInitialized = true;
164  if( 1 == rText.getLength() )
165  {
168  }
169  }
170  return true;
171 }
172 
173 bool SwAutoCorrDoc::Replace( sal_Int32 nPos, const OUString& rText )
174 {
175  return ReplaceRange( nPos, rText.getLength(), rText );
176 }
177 
178 bool SwAutoCorrDoc::ReplaceRange( sal_Int32 nPos, sal_Int32 nSourceLength, const OUString& rText )
179 {
180  assert(nSourceLength == 1); // sw_redlinehide: this is currently the case,
181  // and ensures that the replace range cannot *contain* delete redlines,
182  // so we don't need something along the lines of:
183  // if (sw::GetRanges(ranges, *rEditSh.GetDoc(), aPam))
184  // ReplaceImpl(...)
185  // else
186  // ReplaceImpl(ranges.begin())
187  // for (ranges.begin() + 1; ranges.end(); )
188  // DeleteImpl(*it)
189 
190  SwTextNode * const pNd = rCursor.GetNode().GetTextNode();
191  if ( !pNd )
192  {
193  return false;
194  }
195 
196  SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(
197  pNd->getLayoutFrame(rEditSh.GetLayout())));
198  assert(pFrame);
199  std::pair<SwTextNode *, sal_Int32> const pos(pFrame->MapViewToModel(TextFrameIndex(nPos)));
200 
201  SwPaM* pPam = &rCursor;
202  if (pPam->GetPoint()->nNode != *pos.first
203  || pPam->GetPoint()->nContent != pos.second)
204  {
205  pPam = new SwPaM(*pos.first, pos.second);
206  }
207 
208  // text attributes with dummy characters must not be replaced!
209  bool bDoReplace = true;
210  sal_Int32 const nLen = rText.getLength();
211  for (sal_Int32 n = 0; n < nLen && n + nPos < pFrame->GetText().getLength(); ++n)
212  {
213  sal_Unicode const Char = pFrame->GetText()[n + nPos];
214  if (CH_TXTATR_BREAKWORD == Char || CH_TXTATR_INWORD == Char)
215  {
216  assert(pFrame->MapViewToModel(TextFrameIndex(n+nPos)).first->GetTextAttrForCharAt(pFrame->MapViewToModel(TextFrameIndex(n+nPos)).second));
217  bDoReplace = false;
218  break;
219  }
220  }
221 
222  if ( bDoReplace )
223  {
224  SwDoc* pDoc = rEditSh.GetDoc();
225 
226  if( pDoc->IsAutoFormatRedline() )
227  {
228  if (nPos == pFrame->GetText().getLength()) // at the End do an Insert
229  {
230  pDoc->getIDocumentContentOperations().InsertString( *pPam, rText );
231  }
232  else
233  {
234  assert(pos.second != pos.first->Len()); // must be _before_ char
235  PaMIntoCursorShellRing aTmp( rEditSh, rCursor, *pPam );
236 
237  pPam->SetMark();
238  pPam->GetPoint()->nContent = std::min<sal_Int32>(
239  pos.first->GetText().getLength(), pos.second + nSourceLength);
240  pDoc->getIDocumentContentOperations().ReplaceRange( *pPam, rText, false );
241  pPam->Exchange();
242  pPam->DeleteMark();
243  }
244  }
245  else
246  {
247  if( nSourceLength != rText.getLength() )
248  {
249  pPam->SetMark();
250  pPam->GetPoint()->nContent = std::min<sal_Int32>(
251  pos.first->GetText().getLength(), pos.second + nSourceLength);
252  pDoc->getIDocumentContentOperations().ReplaceRange( *pPam, rText, false );
253  pPam->Exchange();
254  pPam->DeleteMark();
255  }
256  else
257  pDoc->getIDocumentContentOperations().Overwrite( *pPam, rText );
258  }
259 
260  if( bUndoIdInitialized )
261  {
262  bUndoIdInitialized = true;
263  if( 1 == rText.getLength() )
264  {
267  }
268  }
269  }
270 
271  if( pPam != &rCursor )
272  delete pPam;
273 
274  return true;
275 }
276 
277 void SwAutoCorrDoc::SetAttr( sal_Int32 nStt, sal_Int32 nEnd, sal_uInt16 nSlotId,
278  SfxPoolItem& rItem )
279 {
280  SwTextNode const*const pTextNd = rCursor.GetNode().GetTextNode();
281  SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(
282  pTextNd->getLayoutFrame(rEditSh.GetLayout())));
283  assert(pFrame);
284  SwPaM aPam(pFrame->MapViewToModelPos(TextFrameIndex(nStt)),
285  pFrame->MapViewToModelPos(TextFrameIndex(nEnd)));
286 
287  SfxItemPool& rPool = rEditSh.GetDoc()->GetAttrPool();
288  sal_uInt16 nWhich = rPool.GetWhich( nSlotId, false );
289  if( nWhich )
290  {
291  rItem.SetWhich( nWhich );
292 
293  SfxItemSet aSet( rPool, aCharFormatSetRange );
294  SetAllScriptItem( aSet, rItem );
295 
296  rEditSh.GetDoc()->SetFormatItemByAutoFormat( aPam, aSet );
297 
298  if( bUndoIdInitialized )
299  bUndoIdInitialized = true;
300  }
301 }
302 
303 bool SwAutoCorrDoc::SetINetAttr( sal_Int32 nStt, sal_Int32 nEnd, const OUString& rURL )
304 {
305  SwTextNode const*const pTextNd = rCursor.GetNode().GetTextNode();
306  SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(
307  pTextNd->getLayoutFrame(rEditSh.GetLayout())));
308  assert(pFrame);
309  SwPaM aPam(pFrame->MapViewToModelPos(TextFrameIndex(nStt)),
310  pFrame->MapViewToModelPos(TextFrameIndex(nEnd)));
311 
314  aSet.Put( SwFormatINetFormat( rURL, OUString() ));
315  rEditSh.GetDoc()->SetFormatItemByAutoFormat( aPam, aSet );
316  if( bUndoIdInitialized )
317  bUndoIdInitialized = true;
318  return true;
319 }
320 
327 OUString const* SwAutoCorrDoc::GetPrevPara(bool const bAtNormalPos)
328 {
329  OUString const* pStr(nullptr);
330 
331  if( bAtNormalPos || !pIdx )
332  {
333  pIdx.reset(new SwNodeIndex(rCursor.GetPoint()->nNode));
334  }
336 
337  SwTextFrame const* pFrame(nullptr);
338  for (SwTextNode * pTextNd = pIdx->GetNode().GetTextNode();
339  pTextNd; pTextNd = pIdx->GetNode().GetTextNode())
340  {
341  pFrame = static_cast<SwTextFrame const*>(
342  pTextNd->getLayoutFrame(rEditSh.GetLayout()));
343  if (pFrame && !pFrame->GetText().isEmpty())
344  {
345  break;
346  }
348  }
349  if (pFrame && 0 == pFrame->GetTextNodeForParaProps()->GetAttrOutlineLevel())
350  pStr = & pFrame->GetText();
351 
352  if( bUndoIdInitialized )
353  bUndoIdInitialized = true;
354 
355  return pStr;
356 }
357 
358 bool SwAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
359  SvxAutoCorrect& rACorrect,
360  OUString* pPara )
361 {
362  if( bUndoIdInitialized )
363  bUndoIdInitialized = true;
364 
365  // Found a beginning of a paragraph or a Blank,
366  // search for the word Kuerzel (Shortcut) in the Auto
367  SwTextNode* pTextNd = rCursor.GetNode().GetTextNode();
368  OSL_ENSURE( pTextNd, "where is the TextNode?" );
369 
370  bool bRet = false;
371  if( nEndPos == rSttPos )
372  return bRet;
373 
374  LanguageType eLang = GetLanguage(nEndPos);
375  if(LANGUAGE_SYSTEM == eLang)
376  eLang = GetAppLanguage();
377  LanguageTag aLanguageTag( eLang);
378 
379  SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(
380  pTextNd->getLayoutFrame(rEditSh.GetLayout())));
381  assert(pFrame);
382 
383  const OUString sFrameText = pFrame->GetText();
384  const SvxAutocorrWord* pFnd = rACorrect.SearchWordsInList(
385  sFrameText, rSttPos, nEndPos, *this, aLanguageTag);
386  SwDoc* pDoc = rEditSh.GetDoc();
387  if( pFnd )
388  {
389  // replace also last colon of keywords surrounded by colons (for example, ":name:")
390  const bool replaceLastChar = sFrameText.getLength() > nEndPos && pFnd->GetShort()[0] == ':'
391  && pFnd->GetShort().endsWith(":");
392 
393  SwPaM aPam(pFrame->MapViewToModelPos(TextFrameIndex(rSttPos)),
394  pFrame->MapViewToModelPos(TextFrameIndex(nEndPos + (replaceLastChar ? 1 : 0))));
395 
396  if( pFnd->IsTextOnly() )
397  {
398  //JP 22.04.99: Bug 63883 - Special treatment for dots.
399  const bool bLastCharIsPoint
400  = nEndPos < sFrameText.getLength() && ('.' == sFrameText[nEndPos]);
401  if( !bLastCharIsPoint || pFnd->GetLong().isEmpty() ||
402  '.' != pFnd->GetLong()[ pFnd->GetLong().getLength() - 1 ] )
403  {
404  // replace the selection
405  std::vector<std::shared_ptr<SwUnoCursor>> ranges;
406  if (sw::GetRanges(ranges, *rEditSh.GetDoc(), aPam))
407  {
408  pDoc->getIDocumentContentOperations().ReplaceRange(aPam, pFnd->GetLong(), false);
409  }
410  else
411  {
412  assert(!ranges.empty());
413  assert(ranges.front()->GetPoint()->nNode == ranges.front()->GetMark()->nNode);
415  *ranges.front(), pFnd->GetLong(), false);
416  for (auto it = ranges.begin() + 1; it != ranges.end(); ++it)
417  {
418  DeleteSelImpl(**it);
419  }
420  }
421 
422  // tdf#83260 After calling sw::DocumentContentOperationsManager::ReplaceRange
423  // pTextNd may become invalid when change tracking is on and Edit -> Track Changes -> Show == OFF.
424  // ReplaceRange shows changes, this moves deleted nodes from special section to document.
425  // Then Show mode is disabled again. As a result pTextNd may be invalidated.
426  pTextNd = rCursor.GetNode().GetTextNode();
427 
428  bRet = true;
429  }
430  }
431  else
432  {
433  SwTextBlocks aTBlks( rACorrect.GetAutoCorrFileName( aLanguageTag, false, true ));
434  sal_uInt16 nPos = aTBlks.GetIndex( pFnd->GetShort() );
435  if( USHRT_MAX != nPos && aTBlks.BeginGetDoc( nPos ) )
436  {
437  DeleteSel( aPam );
438  pDoc->DontExpandFormat( *aPam.GetPoint() );
439 
440  if( pPara )
441  {
442  OSL_ENSURE( !pIdx, "who has not deleted his Index?" );
443  pIdx.reset(new SwNodeIndex( rCursor.GetPoint()->nNode ));
445  }
446 
447  SwDoc* pAutoDoc = aTBlks.GetDoc();
448  SwNodeIndex aSttIdx( pAutoDoc->GetNodes().GetEndOfExtras(), 1 );
449  SwContentNode* pContentNd = pAutoDoc->GetNodes().GoNext( &aSttIdx );
450  SwPaM aCpyPam( aSttIdx );
451 
452  const SwTableNode* pTableNd = pContentNd->FindTableNode();
453  if( pTableNd )
454  {
455  aCpyPam.GetPoint()->nContent.Assign( nullptr, 0 );
456  aCpyPam.GetPoint()->nNode = *pTableNd;
457  }
458  aCpyPam.SetMark();
459 
460  // then until the end of the Nodes Array
461  aCpyPam.GetPoint()->nNode.Assign( pAutoDoc->GetNodes().GetEndOfContent(), -1 );
462  pContentNd = aCpyPam.GetContentNode();
463  aCpyPam.GetPoint()->nContent.Assign(
464  pContentNd, pContentNd ? pContentNd->Len() : 0);
465 
466  SwDontExpandItem aExpItem;
467  aExpItem.SaveDontExpandItems( *aPam.GetPoint() );
468 
469  pAutoDoc->getIDocumentContentOperations().CopyRange( aCpyPam, *aPam.GetPoint(), /*bCopyAll=*/false, /*bCheckPos=*/true );
470 
471  aExpItem.RestoreDontExpandItems( *aPam.GetPoint() );
472 
473  if( pPara )
474  {
476  pTextNd = pIdx->GetNode().GetTextNode();
477  }
478  bRet = true;
479  }
480  aTBlks.EndGetDoc();
481  }
482  }
483 
484  if( bRet && pPara && pTextNd )
485  {
486  SwTextFrame const*const pNewFrame(static_cast<SwTextFrame const*>(
487  pTextNd->getLayoutFrame(rEditSh.GetLayout())));
488  *pPara = pNewFrame->GetText();
489  }
490 
491  return bRet;
492 }
493 
494 // Called by the functions:
495 // - FnCapitalStartWord
496 // - FnCapitalStartSentence
497 // after the exchange of characters. Then the words, if necessary, can be inserted
498 // into the exception list.
499 void SwAutoCorrDoc::SaveCpltSttWord( ACFlags nFlag, sal_Int32 nPos,
500  const OUString& rExceptWord,
501  sal_Unicode cChar )
502 {
503  sal_uLong nNode = pIdx ? pIdx->GetIndex() : rCursor.GetPoint()->nNode.GetIndex();
504  LanguageType eLang = GetLanguage(nPos);
505  rEditSh.GetDoc()->SetAutoCorrExceptWord( std::make_unique<SwAutoCorrExceptWord>( nFlag,
506  nNode, nPos, rExceptWord, cChar, eLang ));
507 }
508 
510 {
512 
514 
515  if( pNd )
516  {
517  SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(
518  pNd->getLayoutFrame(rEditSh.GetLayout())));
519  assert(pFrame);
520  eRet = pFrame->GetLangOfChar(TextFrameIndex(nPos), 0, true);
521  }
522  if(LANGUAGE_SYSTEM == eRet)
523  eRet = GetAppLanguage();
524  return eRet;
525 }
526 
528 {
529  // test only if this is an improvement.
530  // If yes, then add the word to the list.
531  if (m_cChar == cChr && rPos.nNode.GetIndex() == m_nNode && rPos.nContent.GetIndex() == m_nContent)
532  {
533  // get the current autocorrection:
535 
536  // then add to the list:
537  if (ACFlags::CapitalStartWord & m_nFlags)
539  else if (ACFlags::CapitalStartSentence & m_nFlags)
541  }
542 }
543 
545 {
546  bool bRet = false;
547  if (!m_bDeleted && rPos.nNode.GetIndex() == m_nNode && rPos.nContent.GetIndex() == m_nContent)
548  m_bDeleted = bRet = true;
549  return bRet;
550 }
551 
553 {
554 }
555 
557 {
558  const SwTextNode* pTextNd = rPos.nNode.GetNode().GetTextNode();
559  if( pTextNd )
560  {
561  pDontExpItems.reset( new SfxItemSet( const_cast<SwDoc*>(pTextNd->GetDoc())->GetAttrPool(),
563  const sal_Int32 n = rPos.nContent.GetIndex();
564  if (!pTextNd->GetParaAttr( *pDontExpItems, n, n,
565  n != pTextNd->GetText().getLength() ))
566  {
567  pDontExpItems.reset();
568  }
569  }
570 }
571 
573 {
574  SwTextNode* pTextNd = rPos.nNode.GetNode().GetTextNode();
575  if( pTextNd )
576  {
577  const sal_Int32 nStart = rPos.nContent.GetIndex();
578  if( nStart == pTextNd->GetText().getLength() )
579  pTextNd->FormatToTextAttr( pTextNd );
580 
581  if( pTextNd->GetpSwpHints() && pTextNd->GetpSwpHints()->Count() )
582  {
583  const size_t nSize = pTextNd->GetpSwpHints()->Count();
584  sal_Int32 nAttrStart;
585 
586  for( size_t n = 0; n < nSize; ++n )
587  {
588  SwTextAttr* pHt = pTextNd->GetpSwpHints()->Get( n );
589  nAttrStart = pHt->GetStart();
590  if( nAttrStart > nStart ) // beyond the area
591  break;
592 
593  const sal_Int32* pAttrEnd;
594  if( nullptr != ( pAttrEnd = pHt->End() ) &&
595  ( ( nAttrStart < nStart &&
596  ( pHt->DontExpand() ? nStart < *pAttrEnd
597  : nStart <= *pAttrEnd )) ||
598  ( nStart == nAttrStart &&
599  ( nAttrStart == *pAttrEnd || !nStart ))) )
600  {
601  const SfxPoolItem* pItem;
602  if( !pDontExpItems || SfxItemState::SET != pDontExpItems->
603  GetItemState( pHt->Which(), false, &pItem ) ||
604  *pItem != pHt->GetAttr() )
605  {
606  // The attribute was not previously set in this form in the
607  // paragraph, so it can only be created through insert/copy
608  // Because of that it is a candidate for DontExpand
609  pHt->SetDontExpand( true );
610  }
611  }
612  }
613  }
614  }
615 }
616 
617 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool ReplaceRange(sal_Int32 nPos, sal_Int32 nLen, const OUString &rText) override
Definition: acorrect.cxx:178
void merge(RingContainer< value_type > aDestRing)
Merges two ring containers.
Definition: ring.hxx:182
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
void SetDontExpand(bool bDontExpand)
Definition: txatbase.hxx:171
static SvxAutoCorrCfg & Get()
bool GetRanges(std::vector< std::shared_ptr< SwUnoCursor >> &rRanges, SwDoc &rDoc, SwPaM const &rDelPam)
Definition: autofmt.cxx:1125
Marks a position in the document model.
Definition: pam.hxx:35
const OUString & GetText() const
Definition: ndtxt.hxx:211
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:219
SwNodeIndex nNode
Definition: pam.hxx:37
sal_uIntPtr sal_uLong
virtual bool SetINetAttr(sal_Int32 nStt, sal_Int32 nEnd, const OUString &rURL) override
Definition: acorrect.cxx:303
const SwPosition * GetMark() const
Definition: pam.hxx:209
OUString const m_sWord
Definition: acorrect.hxx:95
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1148
Definition: doc.hxx:185
const SvxAutocorrWord * SearchWordsInList(const OUString &rTxt, sal_Int32 &rStt, sal_Int32 nEndPos, SvxAutoCorrDoc &rDoc, LanguageTag &rLang)
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:233
virtual void DeleteRange(SwPaM &)=0
Delete a range SwFlyFrameFormat.
SwNode & GetNode() const
Definition: ndindex.hxx:118
LanguageType const m_eLanguage
Definition: acorrect.hxx:100
sal_uInt16 Which() const
Definition: txatbase.hxx:110
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
Definition: txtfrm.cxx:1290
virtual bool DeleteAndJoin(SwPaM &, const bool bForceJoinNext=false)=0
complete delete of a given PaM
bool AddCplSttException(const OUString &rNew, LanguageType eLang)
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:347
const OUString & GetShort() const
virtual ~SwAutoCorrDoc() override
Definition: acorrect.cxx:94
void MoveTo(value_type *pDestRing)
Removes this item from its current ring container and adds it to another ring container.
Definition: ring.hxx:135
virtual void SaveCpltSttWord(ACFlags nFlag, sal_Int32 nPos, const OUString &rExceptWord, sal_Unicode cChar) override
Definition: acorrect.cxx:499
bool IsTextOnly() const
OUString GetAutoCorrFileName(const LanguageTag &rLanguageTag, bool bNewFile=false, bool bTstUserExist=false, bool bUnlocalized=false) const
SwContentNode * GetContentNode(bool bPoint=true) const
Definition: pam.hxx:229
#define CH_TXTATR_BREAKWORD
Definition: hintids.hxx:43
void DeleteSel(SwPaM &rDelPam)
Definition: acorrect.cxx:102
sal_uInt16 sal_Unicode
ACFlags const m_nFlags
Definition: acorrect.hxx:96
#define CH_TXTATR_INWORD
Definition: hintids.hxx:44
ACFlags
int m_nEndUndoCounter
Definition: acorrect.hxx:53
SwIndex nContent
Definition: pam.hxx:38
void RestoreDontExpandItems(const SwPosition &rPos)
Definition: acorrect.cxx:572
void SetAllScriptItem(SfxItemSet &rSet, const SfxPoolItem &rItem)
Definition: poolfmt.cxx:77
sal_uLong GetIndex() const
Definition: ndindex.hxx:151
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
void SetFormatItemByAutoFormat(const SwPaM &rPam, const SfxItemSet &)
Definition: docfmt.cxx:1821
void SaveDontExpandItems(const SwPosition &rPos)
Definition: acorrect.cxx:556
SwDoc * GetDoc() const
Definition: viewsh.hxx:284
sal_Unicode const m_cChar
Definition: acorrect.hxx:99
void GotoNextLayoutTextFrame(SwNodeIndex &rIndex, SwRootFrame const *const pLayout)
Definition: docnum.cxx:1481
sal_Int32 const m_nContent
Definition: acorrect.hxx:98
SwPaM * GetNext()
Definition: pam.hxx:264
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:164
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:331
virtual bool Insert(sal_Int32 nPos, const OUString &rText) override
Definition: acorrect.cxx:153
PaMIntoCursorShellRing(SwCursorShell &rSh, SwPaM &rCursor, SwPaM &rPam)
Definition: acorrect.cxx:55
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
virtual bool Overwrite(const SwPaM &rRg, const OUString &rStr)=0
Overwrite string in an existing text node.
bool bUndoIdInitialized
Definition: acorrect.hxx:54
size_t Count() const
Definition: ndhints.hxx:142
SwTextAttr * Get(size_t nPos) const
Definition: ndhints.hxx:144
std::unique_ptr< SfxItemSet > pDontExpItems
Definition: acorrect.hxx:37
const SwPosition * GetPoint() const
Definition: pam.hxx:207
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:198
#define LANGUAGE_SYSTEM
bool GetParaAttr(SfxItemSet &rSet, sal_Int32 nStt, sal_Int32 nEnd, const bool bOnlyTextAttr=false, const bool bGetFromChrFormat=true, const bool bMergeIndentValuesOfNumRule=false, SwRootFrame const *pLayout=nullptr) const
Query the attributes of textnode over the range.
Definition: thints.cxx:2062
SvxAutoCorrect * GetAutoCorrect()
int i
SwDoc * GetDoc()
Definition: node.hxx:702
void DeleteSelImpl(SwPaM &rDelPam)
Definition: acorrect.cxx:120
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:222
sal_uLong const m_nNode
Definition: acorrect.hxx:97
SwPaM & rCursor
Definition: acorrect.hxx:51
Marks a node in the document model.
Definition: ndindex.hxx:31
virtual bool ReplaceRange(SwPaM &rPam, const OUString &rNewStr, const bool bRegExReplace)=0
Replace selected range in a TextNode with string.
ring_container GetRingContainer()
Definition: ring.hxx:240
void CheckChar(const SwPosition &rPos, sal_Unicode cChar)
Definition: acorrect.cxx:527
SwCursorShell & rSh
Definition: acorrect.cxx:44
static void RemoveFromRing(SwPaM &rPam, SwPaM const *pPrev)
Definition: acorrect.cxx:75
SwPaM * GetPrev()
Definition: pam.hxx:268
bool AddWrtSttException(const OUString &rNew, LanguageType eLang)
void SetAutoCorrExceptWord(std::unique_ptr< SwAutoCorrExceptWord > pNew)
Definition: docedt.cxx:862
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual OUString const * GetPrevPara(bool bAtNormalPos) override
Return the text of a previous paragraph.
Definition: acorrect.cxx:327
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
virtual LanguageType GetLanguage(sal_Int32 nPos) const override
Definition: acorrect.cxx:509
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
bool CheckDelChar(const SwPosition &rPos)
Definition: acorrect.cxx:544
bool DontExpandFormat(const SwPosition &rPos, bool bFlag=true)
Definition: docfmt.cxx:1709
void SetWhich(sal_uInt16 nId)
sal_Int32 GetIndex() const
Definition: index.hxx:95
LanguageType GetAppLanguage()
Definition: init.cxx:765
SwNodes & GetNodes()
Definition: doc.hxx:402
sal_uInt16 const aCharFormatSetRange[]
Definition: init.cxx:245
const sal_Int32 * End() const
Definition: txatbase.hxx:148
virtual bool ChgAutoCorrWord(sal_Int32 &rSttPos, sal_Int32 nEndPos, SvxAutoCorrect &rACorrect, OUString *pPara) override
Definition: acorrect.cxx:358
SwEditShell & rEditSh
Definition: acorrect.hxx:50
std::unique_ptr< SwNodeIndex > pIdx
Definition: acorrect.hxx:52
bool IsAutoFormatRedline() const
Definition: doc.hxx:1435
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:351
void GotoPrevLayoutTextFrame(SwNodeIndex &rIndex, SwRootFrame const *const pLayout)
Definition: docnum.cxx:1453
const SfxPoolItem & GetAttr() const
Definition: txatbase.hxx:159
bool DontExpand() const
Definition: txatbase.hxx:92
virtual void SetAttr(sal_Int32 nStt, sal_Int32 nEnd, sal_uInt16 nSlotId, SfxPoolItem &) override
Definition: acorrect.cxx:277
virtual bool Delete(sal_Int32 nStt, sal_Int32 nEnd) override
Definition: acorrect.cxx:138
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:455
const OUString & GetLong() const
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
Definition: thints.cxx:2479
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:162
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2071
sal_Int32 nPos
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
SwAutoCorrDoc(SwEditShell &rEditShell, SwPaM &rPam, sal_Unicode cIns=0)
Definition: acorrect.cxx:86
virtual bool Replace(sal_Int32 nPos, const OUString &rText) override
Definition: acorrect.cxx:173
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1273
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1308
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:843
SwNodeIndex & Assign(SwNodes const &rNds, sal_uLong)
Definition: ndindex.hxx:271
virtual bool CopyRange(SwPaM &rPam, SwPosition &rPos, const bool bCopyAll, bool bCheckPos) const =0
Copy a selected content range to a position.