LibreOffice Module sw (master)  1
docedt.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 <fmtanchr.hxx>
21 #include <fmtcntnt.hxx>
22 #include <txtftn.hxx>
23 #include <acorrect.hxx>
24 #include <UndoManager.hxx>
26 #include <IDocumentState.hxx>
28 #include <docsh.hxx>
29 #include <docary.hxx>
30 #include <doctxm.hxx>
31 #include <ftnidx.hxx>
32 #include <mdiexp.hxx>
33 #include <mvsave.hxx>
34 #include <redline.hxx>
35 #include <rootfrm.hxx>
36 #include <splargs.hxx>
37 #include <txtfrm.hxx>
38 #include <breakit.hxx>
39 #include <vcl/layout.hxx>
40 #include <editsh.hxx>
41 #include <fmtfld.hxx>
42 #include <docufld.hxx>
43 #include <unoflatpara.hxx>
44 #include <SwGrammarMarkUp.hxx>
45 #include <docedt.hxx>
46 #include <frmfmt.hxx>
47 #include <ndtxt.hxx>
48 #include <undobj.hxx>
49 
50 #include <vector>
51 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
52 
53 using namespace ::com::sun::star;
54 using namespace ::com::sun::star::linguistic2;
55 using namespace ::com::sun::star::i18n;
56 
57 
58 void RestFlyInRange( SaveFlyArr & rArr, const SwPosition& rStartPos,
59  const SwNodeIndex* pInsertPos )
60 {
61  SwPosition aPos(rStartPos);
62  for(const SaveFly & rSave : rArr)
63  {
64  // create new anchor
65  SwFrameFormat* pFormat = rSave.pFrameFormat;
66  SwFormatAnchor aAnchor( pFormat->GetAnchor() );
67 
68  if (rSave.isAtInsertNode)
69  {
70  if( pInsertPos != nullptr )
71  {
72  if (aAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA)
73  {
74  aPos.nNode = *pInsertPos;
75  aPos.nContent.Assign(dynamic_cast<SwIndexReg*>(&aPos.nNode.GetNode()),
76  rSave.nContentIndex);
77  }
78  else
79  {
80  assert(aAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR);
81  aPos = rStartPos;
82  }
83  }
84  else
85  {
86  aPos.nNode = rStartPos.nNode;
87  aPos.nContent.Assign(dynamic_cast<SwIndexReg*>(&aPos.nNode.GetNode()), 0);
88  }
89  }
90  else
91  {
92  aPos.nNode = rStartPos.nNode.GetIndex() + rSave.nNdDiff;
93  aPos.nContent.Assign(dynamic_cast<SwIndexReg*>(&aPos.nNode.GetNode()),
94  rSave.nNdDiff == 0
95  ? rStartPos.nContent.GetIndex() + rSave.nContentIndex
96  : rSave.nContentIndex);
97  }
98 
99  aAnchor.SetAnchor( &aPos );
100  pFormat->GetDoc()->GetSpzFrameFormats()->push_back( pFormat );
101  // SetFormatAttr should call Modify() and add it to the node
102  pFormat->SetFormatAttr( aAnchor );
103  SwContentNode* pCNd = aPos.nNode.GetNode().GetContentNode();
104  if (pCNd && pCNd->getLayoutFrame(pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr))
105  pFormat->MakeFrames();
106  }
108 }
109 
110 void SaveFlyInRange( const SwNodeRange& rRg, SaveFlyArr& rArr )
111 {
112  SwFrameFormats& rFormats = *rRg.aStart.GetNode().GetDoc()->GetSpzFrameFormats();
113  for( SwFrameFormats::size_type n = 0; n < rFormats.size(); ++n )
114  {
115  SwFrameFormat *const pFormat = rFormats[n];
116  SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor();
117  SwPosition const*const pAPos = pAnchor->GetContentAnchor();
118  if (pAPos &&
119  ((RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()) ||
120  (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
121  rRg.aStart <= pAPos->nNode && pAPos->nNode < rRg.aEnd )
122  {
123  SaveFly aSave( pAPos->nNode.GetIndex() - rRg.aStart.GetIndex(),
124  (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())
125  ? pAPos->nContent.GetIndex()
126  : 0,
127  pFormat, false );
128  rArr.push_back( aSave );
129  pFormat->DelFrames();
130  // set a dummy anchor position to maintain anchoring invariants
131  SwFormatAnchor aAnchor( pFormat->GetAnchor() );
132  aAnchor.SetAnchor(nullptr);
133  pFormat->SetFormatAttr(aAnchor);
134  rFormats.erase( rFormats.begin() + n-- );
135  }
136  }
138 }
139 
140 void SaveFlyInRange( const SwPaM& rPam, const SwPosition& rInsPos,
141  SaveFlyArr& rArr, bool bMoveAllFlys )
142 {
143  SwFrameFormats& rFormats = *rPam.GetPoint()->nNode.GetNode().GetDoc()->GetSpzFrameFormats();
144  SwFrameFormat* pFormat;
145  const SwFormatAnchor* pAnchor;
146 
147  const SwPosition* pPos = rPam.Start();
148  const SwNodeIndex& rSttNdIdx = pPos->nNode;
149  short nSttOff = (!bMoveAllFlys && rSttNdIdx.GetNode().IsContentNode() &&
150  pPos->nContent.GetIndex()) ? 1 : 0;
151 
152  pPos = rPam.GetPoint() == pPos ? rPam.GetMark() : rPam.GetPoint();
153  const SwNodeIndex& rEndNdIdx = pPos->nNode;
154  short nOff = ( bMoveAllFlys || ( rEndNdIdx.GetNode().IsContentNode() &&
155  pPos->nContent == rEndNdIdx.GetNode().GetContentNode()->Len() ))
156  ? 0 : 1;
157 
158  for( SwFrameFormats::size_type n = 0; n < rFormats.size(); ++n )
159  {
160  pFormat = rFormats[n];
161  pAnchor = &pFormat->GetAnchor();
162  const SwPosition* pAPos = pAnchor->GetContentAnchor();
163  const SwNodeIndex* pContentIdx;
164  if (pAPos &&
165  ((RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()) ||
166  (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
167  // do not move if the InsPos is in the ContentArea of the Fly
168  ( nullptr == ( pContentIdx = pFormat->GetContent().GetContentIdx() ) ||
169  !(*pContentIdx < rInsPos.nNode &&
170  rInsPos.nNode < pContentIdx->GetNode().EndOfSectionIndex())))
171  {
172  bool bInsPos = false;
173 
174  if (!bMoveAllFlys
175  && RndStdIds::FLY_AT_CHAR != pAnchor->GetAnchorId()
176  && rEndNdIdx == pAPos->nNode)
177  {
178  // Do not touch Anchor, if only a part of the EndNode
179  // or the whole EndNode is identical with the SttNode
180  if( rSttNdIdx != pAPos->nNode )
181  {
182  // Only attach an anchor to the beginning or end
183  SwPosition aPos( rSttNdIdx );
184  SwFormatAnchor aAnchor( *pAnchor );
185  aAnchor.SetAnchor( &aPos );
186  pFormat->SetFormatAttr( aAnchor );
187  }
188  }
189  else if ( (//bMoveAllFlys ... no do not check - all callers are actually from redline code, from the MoveToSection case; so check bMoveAllFlys only for AT_PARA!
190  (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())
191  && IsDestroyFrameAnchoredAtChar(*pAPos, *rPam.Start(), *rPam.End()))
192  || (RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()
193  && rSttNdIdx.GetIndex() + nSttOff <= pAPos->nNode.GetIndex()
194  && pAPos->nNode.GetIndex() <= rEndNdIdx.GetIndex() - nOff)
195  || (RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()
196  && (bInsPos = (rInsPos.nNode == pAPos->nNode)))
197  || (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId()
198  && (bInsPos = (rInsPos == *pAPos))))
199  {
200  SaveFly aSave( pAPos->nNode.GetIndex() - rSttNdIdx.GetIndex(),
201  (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())
202  ? (pAPos->nNode == rSttNdIdx)
203  ? pAPos->nContent.GetIndex() - rPam.Start()->nContent.GetIndex()
204  : pAPos->nContent.GetIndex()
205  : 0,
206  pFormat, bInsPos );
207  rArr.push_back( aSave );
208  pFormat->DelFrames();
209  // set a dummy anchor position to maintain anchoring invariants
210  SwFormatAnchor aAnchor( pFormat->GetAnchor() );
211  aAnchor.SetAnchor(nullptr);
212  pFormat->SetFormatAttr(aAnchor);
213  rFormats.erase( rFormats.begin() + n-- );
214  }
215  }
216  }
218 }
219 
222 void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
223  const SwNodeIndex& rPtNdIdx,
224  SwIndex const*const pMkIdx, SwIndex const*const pPtIdx)
225 {
226  assert((pMkIdx == nullptr) == (pPtIdx == nullptr));
227  SwPosition const point(pPtIdx
228  ? SwPosition(rPtNdIdx, *pPtIdx)
229  : SwPosition(rPtNdIdx));
230  SwPosition const mark(pPtIdx
231  ? SwPosition(rMkNdIdx, *pMkIdx)
232  : SwPosition(rMkNdIdx));
233  SwPosition const& rStart = mark <= point ? mark : point;
234  SwPosition const& rEnd = mark <= point ? point : mark;
235  const bool bDelFwrd = rMkNdIdx.GetIndex() <= rPtNdIdx.GetIndex();
236 
237  SwDoc* pDoc = rMkNdIdx.GetNode().GetDoc();
238  SwFrameFormats& rTable = *pDoc->GetSpzFrameFormats();
239  for ( auto i = rTable.size(); i; )
240  {
241  SwFrameFormat *pFormat = rTable[--i];
242  const SwFormatAnchor &rAnch = pFormat->GetAnchor();
243  SwPosition const*const pAPos = rAnch.GetContentAnchor();
244  if (pAPos &&
245  (((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA)
246  && (bDelFwrd
247  ? rMkNdIdx < pAPos->nNode && pAPos->nNode <= rPtNdIdx
248  : rPtNdIdx <= pAPos->nNode && pAPos->nNode < rMkNdIdx))
249  || ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
250  && IsDestroyFrameAnchoredAtChar(*pAPos, rStart, rEnd, pPtIdx
253  {
254  // Only move the Anchor??
255  if ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA)
256  && rPtNdIdx == pAPos->nNode )
257  {
258  SwFormatAnchor aAnch( pFormat->GetAnchor() );
259  SwPosition aPos( rMkNdIdx );
260  aAnch.SetAnchor( &aPos );
261  pFormat->SetFormatAttr( aAnch );
262  }
263  else
264  {
265  // If the Fly is deleted, all Flys in its content have to be deleted too.
266  const SwFormatContent &rContent = pFormat->GetContent();
267  // But only fly formats own their content, not draw formats.
268  if (rContent.GetContentIdx() && pFormat->Which() == RES_FLYFRMFMT)
269  {
270  DelFlyInRange( *rContent.GetContentIdx(),
271  SwNodeIndex( *rContent.GetContentIdx()->
272  GetNode().EndOfSectionNode() ));
273  // Position could have been moved!
274  if( i > rTable.size() )
275  i = rTable.size();
276  else if( pFormat != rTable[i] )
277  i = std::distance(rTable.begin(), rTable.find( pFormat ));
278  }
279 
280  pDoc->getIDocumentLayoutAccess().DelLayoutFormat( pFormat );
281 
282  // DelLayoutFormat can also trigger the deletion of objects.
283  if( i > rTable.size() )
284  i = rTable.size();
285  }
286  }
287  }
288 }
289 
290 // #i59534: Redo of insertion of multiple text nodes runs into trouble
291 // because of unnecessary expanded redlines
292 // From now on this class saves the redline positions of all redlines which ends exact at the
293 // insert position (node _and_ content index)
295  : nSavContent( nCnt )
296 {
297  SwNode& rNd = rInsIdx.GetNode();
298  SwDoc* pDest = rNd.GetDoc();
300  {
302  const SwPosition* pEnd;
303  SwPosition aSrcPos( rInsIdx, SwIndex( rNd.GetContentNode(), nCnt ));
304  pDest->getIDocumentRedlineAccess().GetRedline( aSrcPos, &nFndPos );
305  const SwRangeRedline* pRedl;
306  while( nFndPos--
307  && *( pEnd = ( pRedl = pDest->getIDocumentRedlineAccess().GetRedlineTable()[ nFndPos ] )->End() ) == aSrcPos
308  && *pRedl->Start() < aSrcPos )
309  {
310  if( !pSavIdx )
311  {
312  pSavIdx.reset(new SwNodeIndex( rInsIdx, -1 ));
313  }
314  mvSavArr.push_back( const_cast<SwPosition*>(pEnd) );
315  }
316  }
317 }
318 
320 {
321  pSavIdx.reset();
322 }
323 
325 {
326  if (mvSavArr.empty())
327  return;
328  ++(*pSavIdx);
329  SwContentNode* pNode = pSavIdx->GetNode().GetContentNode();
330  // If there's no content node at the remembered position, we will not restore the old position
331  // This may happen if a table (or section?) will be inserted.
332  if( pNode )
333  {
334  SwPosition aPos( *pSavIdx, SwIndex( pNode, nSavContent ));
335  for( auto n = mvSavArr.size(); n; )
336  *mvSavArr[ --n ] = aPos;
337  }
338 }
339 
341 static std::vector<sal_uInt16> lcl_RangesToVector(const sal_uInt16 * pRanges)
342 {
343  std::vector<sal_uInt16> aResult;
344 
345  int i = 0;
346  while (pRanges[i] != 0)
347  {
348  OSL_ENSURE(pRanges[i+1] != 0, "malformed ranges");
349 
350  for (sal_uInt16 j = pRanges[i]; j < pRanges[i+1]; j++)
351  aResult.push_back(j);
352 
353  i += 2;
354  }
355 
356  return aResult;
357 }
358 
359 void sw_GetJoinFlags( SwPaM& rPam, bool& rJoinText, bool& rJoinPrev )
360 {
361  rJoinText = false;
362  rJoinPrev = false;
363  if( rPam.GetPoint()->nNode != rPam.GetMark()->nNode )
364  {
365  const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
366  SwTextNode *pSttNd = pStt->nNode.GetNode().GetTextNode();
367  if( pSttNd )
368  {
369  SwTextNode *pEndNd = pEnd->nNode.GetNode().GetTextNode();
370  rJoinText = nullptr != pEndNd;
371  if( rJoinText )
372  {
373  bool bExchange = pStt == rPam.GetPoint();
374  if( !pStt->nContent.GetIndex() &&
375  pEndNd->GetText().getLength() != pEnd->nContent.GetIndex())
376  bExchange = !bExchange;
377  if( bExchange )
378  rPam.Exchange();
379  rJoinPrev = rPam.GetPoint() == pStt;
380  OSL_ENSURE( !pStt->nContent.GetIndex() &&
381  pEndNd->GetText().getLength() != pEnd->nContent.GetIndex()
382  ? (rPam.GetPoint()->nNode < rPam.GetMark()->nNode)
383  : (rPam.GetPoint()->nNode > rPam.GetMark()->nNode),
384  "sw_GetJoinFlags");
385  }
386  }
387  }
388 }
389 
390 bool sw_JoinText( SwPaM& rPam, bool bJoinPrev )
391 {
392  SwNodeIndex aIdx( rPam.GetPoint()->nNode );
393  SwTextNode *pTextNd = aIdx.GetNode().GetTextNode();
394  SwNodeIndex aOldIdx( aIdx );
395  SwTextNode *pOldTextNd = pTextNd;
396 
397  if( pTextNd && pTextNd->CanJoinNext( &aIdx ) )
398  {
399  SwDoc* pDoc = rPam.GetDoc();
400  if( bJoinPrev )
401  {
402  // We do not need to handle xmlids in this case, because
403  // it is only invoked if one paragraph is/becomes completely empty
404  // (see sw_GetJoinFlags)
405  {
406  // If PageBreaks are deleted/set, it must not be added to the Undo history!
407  // Also, deleting the Node is not added to the Undo history!
408  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
409 
410  /* PageBreaks, PageDesc, ColumnBreaks */
411  // If we need to change something about the logic to copy the PageBreaks,
412  // PageDesc, etc. we also have to change SwUndoDelete.
413  // There, we copy the AUTO PageBreak from the GetMarkNode!
414 
415  /* The MarkNode */
416  pTextNd = aIdx.GetNode().GetTextNode();
417  if (pTextNd->HasSwAttrSet())
418  {
419  const SfxPoolItem* pItem;
420  if( SfxItemState::SET == pTextNd->GetpSwAttrSet()->GetItemState(
421  RES_BREAK, false, &pItem ) )
422  pTextNd->ResetAttr( RES_BREAK );
423  if( pTextNd->HasSwAttrSet() &&
424  SfxItemState::SET == pTextNd->GetpSwAttrSet()->GetItemState(
425  RES_PAGEDESC, false, &pItem ) )
426  pTextNd->ResetAttr( RES_PAGEDESC );
427  }
428 
429  /* The PointNode */
430  if( pOldTextNd->HasSwAttrSet() )
431  {
432  const SfxPoolItem* pItem;
433  SfxItemSet aSet( pDoc->GetAttrPool(), aBreakSetRange );
434  const SfxItemSet* pSet = pOldTextNd->GetpSwAttrSet();
435  if( SfxItemState::SET == pSet->GetItemState( RES_BREAK,
436  false, &pItem ) )
437  aSet.Put( *pItem );
438  if( SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC,
439  false, &pItem ) )
440  aSet.Put( *pItem );
441  if( aSet.Count() )
442  pTextNd->SetAttr( aSet );
443  }
444  pOldTextNd->FormatToTextAttr( pTextNd );
445 
446  const std::shared_ptr< sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
447  pContentStore->Save( pDoc, aOldIdx.GetIndex(), pOldTextNd->Len() );
448 
449  SwIndex aAlphaIdx(pTextNd);
450  pOldTextNd->CutText( pTextNd, aAlphaIdx, SwIndex(pOldTextNd),
451  pOldTextNd->Len() );
452  SwPosition aAlphaPos( aIdx, aAlphaIdx );
453  pDoc->CorrRel( rPam.GetPoint()->nNode, aAlphaPos, 0, true );
454 
455  // move all Bookmarks/TOXMarks
456  if( !pContentStore->Empty() )
457  pContentStore->Restore( pDoc, aIdx.GetIndex() );
458 
459  // If the passed PaM is not in the Cursor ring,
460  // treat it separately (e.g. when it's being called from AutoFormat)
461  if( pOldTextNd == rPam.GetBound().nContent.GetIdxReg() )
462  rPam.GetBound() = aAlphaPos;
463  if( pOldTextNd == rPam.GetBound( false ).nContent.GetIdxReg() )
464  rPam.GetBound( false ) = aAlphaPos;
465  }
466  // delete the Node, at last!
467  SwNode::Merge const eOldMergeFlag(pOldTextNd->GetRedlineMergeFlag());
468  if (eOldMergeFlag == SwNode::Merge::First
469  && !pTextNd->IsCreateFrameWhenHidingRedlines())
470  {
471  sw::MoveDeletedPrevFrames(*pOldTextNd, *pTextNd);
472  }
473  pDoc->GetNodes().Delete( aOldIdx );
475  eOldMergeFlag == SwNode::Merge::NonFirst
477  : sw::Recreate::No);
478  }
479  else
480  {
481  SwTextNode* pDelNd = aIdx.GetNode().GetTextNode();
482  if( pTextNd->Len() )
483  pDelNd->FormatToTextAttr( pTextNd );
484  else
485  {
486  /* This case was missed:
487 
488  <something></something> <-- pTextNd
489  <other>ccc</other> <-- pDelNd
490 
491  <something> and <other> are paragraph
492  attributes. The attribute <something> stayed if not
493  overwritten by an attribute in "ccc". Fixed by
494  first resetting all character attributes in first
495  paragraph (pTextNd).
496  */
497  std::vector<sal_uInt16> aShorts =
499  pTextNd->ResetAttr(aShorts);
500 
501  if( pDelNd->HasSwAttrSet() )
502  {
503  // only copy the character attributes
504  SfxItemSet aTmpSet( pDoc->GetAttrPool(), aCharFormatSetRange );
505  aTmpSet.Put( *pDelNd->GetpSwAttrSet() );
506  pTextNd->SetAttr( aTmpSet );
507  }
508  }
509 
510  pDoc->CorrRel( aIdx, *rPam.GetPoint(), 0, true );
511  // #i100466# adjust given <rPam>, if it does not belong to the cursors
512  if ( pDelNd == rPam.GetBound().nContent.GetIdxReg() )
513  {
514  rPam.GetBound() = SwPosition( SwNodeIndex( *pTextNd ), SwIndex( pTextNd ) );
515  }
516  if( pDelNd == rPam.GetBound( false ).nContent.GetIdxReg() )
517  {
518  rPam.GetBound( false ) = SwPosition( SwNodeIndex( *pTextNd ), SwIndex( pTextNd ) );
519  }
520  pTextNd->JoinNext();
521  }
522  return true;
523  }
524  else return false;
525 }
526 
527 static void lcl_syncGrammarError( SwTextNode &rTextNode, linguistic2::ProofreadingResult& rResult,
528  const ModelToViewHelper &rConversionMap )
529 {
530  if( rTextNode.IsGrammarCheckDirty() )
531  return;
532  SwGrammarMarkUp* pWrong = rTextNode.GetGrammarCheck();
533  linguistic2::SingleProofreadingError* pArray = rResult.aErrors.getArray();
534  sal_uInt16 j = 0;
535  if( pWrong )
536  {
537  for( sal_Int32 i = 0; i < rResult.aErrors.getLength(); ++i )
538  {
539  const linguistic2::SingleProofreadingError &rError = rResult.aErrors[i];
540  const sal_Int32 nStart = rConversionMap.ConvertToModelPosition( rError.nErrorStart ).mnPos;
541  const sal_Int32 nEnd = rConversionMap.ConvertToModelPosition( rError.nErrorStart + rError.nErrorLength ).mnPos;
542  if( i != j )
543  pArray[j] = pArray[i];
544  if( pWrong->LookForEntry( nStart, nEnd ) )
545  ++j;
546  }
547  }
548  if( rResult.aErrors.getLength() > j )
549  rResult.aErrors.realloc( j );
550 }
551 
553  uno::Reference< XSpellChecker1 > const &xSpeller,
554  sal_uInt16* pPageCnt, sal_uInt16* pPageSt,
555  bool bGrammarCheck,
556  SwRootFrame const*const pLayout,
557  SwConversionArgs *pConvArgs ) const
558 {
559  SwPosition* pSttPos = rPaM.Start(), *pEndPos = rPaM.End();
560 
561  std::unique_ptr<SwSpellArgs> pSpellArgs;
562  if (pConvArgs)
563  {
564  pConvArgs->SetStart(pSttPos->nNode.GetNode().GetTextNode(), pSttPos->nContent);
565  pConvArgs->SetEnd( pEndPos->nNode.GetNode().GetTextNode(), pEndPos->nContent );
566  }
567  else
568  pSpellArgs.reset(new SwSpellArgs( xSpeller,
569  pSttPos->nNode.GetNode().GetTextNode(), pSttPos->nContent,
570  pEndPos->nNode.GetNode().GetTextNode(), pEndPos->nContent,
571  bGrammarCheck ));
572 
573  sal_uLong nCurrNd = pSttPos->nNode.GetIndex();
574  sal_uLong nEndNd = pEndPos->nNode.GetIndex();
575 
576  uno::Any aRet;
577  if( nCurrNd <= nEndNd )
578  {
579  SwContentFrame* pContentFrame;
580  bool bGoOn = true;
581  while( bGoOn )
582  {
583  SwNode* pNd = GetNodes()[ nCurrNd ];
584  switch( pNd->GetNodeType() )
585  {
586  case SwNodeType::Text:
587  if( nullptr != ( pContentFrame = pNd->GetTextNode()->getLayoutFrame( getIDocumentLayoutAccess().GetCurrentLayout() )) )
588  {
589  // skip protected and hidden Cells and Flys
590  if( pContentFrame->IsProtected() )
591  {
592  nCurrNd = pNd->EndOfSectionIndex();
593  }
594  else if( !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
595  {
596  if( pPageCnt && *pPageCnt && pPageSt )
597  {
598  sal_uInt16 nPageNr = pContentFrame->GetPhyPageNum();
599  if( !*pPageSt )
600  {
601  *pPageSt = nPageNr;
602  if( *pPageCnt < *pPageSt )
603  *pPageCnt = *pPageSt;
604  }
605  long nStat;
606  if( nPageNr >= *pPageSt )
607  nStat = nPageNr - *pPageSt + 1;
608  else
609  nStat = nPageNr + *pPageCnt - *pPageSt + 1;
610  ::SetProgressState( nStat, GetDocShell() );
611  }
612  //Spell() changes the pSpellArgs in case an error is found
613  sal_Int32 nBeginGrammarCheck = 0;
614  sal_Int32 nEndGrammarCheck = 0;
615  if( pSpellArgs && pSpellArgs->bIsGrammarCheck)
616  {
617  nBeginGrammarCheck = pSpellArgs->pStartNode == pNd ? pSpellArgs->pStartIdx->GetIndex() : 0;
618  // if grammar checking starts inside of a sentence the start position has to be adjusted
619  if( nBeginGrammarCheck )
620  {
621  SwIndex aStartIndex( dynamic_cast< SwTextNode* >( pNd ), nBeginGrammarCheck );
622  SwPosition aStart( *pNd, aStartIndex );
623  SwCursor aCursor(aStart, nullptr);
624  SwPosition aOrigPos = *aCursor.GetPoint();
625  aCursor.GoSentence( SwCursor::START_SENT );
626  if( aOrigPos != *aCursor.GetPoint() )
627  {
628  nBeginGrammarCheck = aCursor.GetPoint()->nContent.GetIndex();
629  }
630  }
631  nEndGrammarCheck = (pSpellArgs->pEndNode == pNd)
632  ? pSpellArgs->pEndIdx->GetIndex()
633  : pNd->GetTextNode()
634  ->GetText().getLength();
635  }
636 
637  sal_Int32 nSpellErrorPosition = pNd->GetTextNode()->GetText().getLength();
638  if( (!pConvArgs && pNd->GetTextNode()->Spell( pSpellArgs.get() )) ||
639  ( pConvArgs && pNd->GetTextNode()->Convert( *pConvArgs )))
640  {
641  // Cancel and remember position
642  pSttPos->nNode = nCurrNd;
643  pEndPos->nNode = nCurrNd;
644  nCurrNd = nEndNd;
645  if( pSpellArgs )
646  nSpellErrorPosition = pSpellArgs->pStartIdx->GetIndex() > pSpellArgs->pEndIdx->GetIndex() ?
647  pSpellArgs->pEndIdx->GetIndex() :
648  pSpellArgs->pStartIdx->GetIndex();
649  }
650 
651  if( pSpellArgs && pSpellArgs->bIsGrammarCheck )
652  {
653  uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( GetGCIterator() );
654  if (xGCIterator.is())
655  {
656  uno::Reference< lang::XComponent > xDoc( GetDocShell()->GetBaseModel(), uno::UNO_QUERY );
657  // Expand the string:
658  const ModelToViewHelper aConversionMap(*pNd->GetTextNode(), pLayout);
659  const OUString& aExpandText = aConversionMap.getViewText();
660 
661  // get XFlatParagraph to use...
662  uno::Reference< text::XFlatParagraph > xFlatPara = new SwXFlatParagraph( *pNd->GetTextNode(), aExpandText, aConversionMap );
663 
664  // get error position of cursor in XFlatParagraph
665  linguistic2::ProofreadingResult aResult;
666  bool bGrammarErrors;
667  do
668  {
669  aConversionMap.ConvertToViewPosition( nBeginGrammarCheck );
670  aResult = xGCIterator->checkSentenceAtPosition(
671  xDoc, xFlatPara, aExpandText, lang::Locale(), nBeginGrammarCheck, -1, -1 );
672 
673  lcl_syncGrammarError( *pNd->GetTextNode(), aResult, aConversionMap );
674 
675  // get suggestions to use for the specific error position
676  bGrammarErrors = aResult.aErrors.hasElements();
677  // if grammar checking doesn't have any progress then quit
678  if( aResult.nStartOfNextSentencePosition <= nBeginGrammarCheck )
679  break;
680  // prepare next iteration
681  nBeginGrammarCheck = aResult.nStartOfNextSentencePosition;
682  }
683  while( nSpellErrorPosition > aResult.nBehindEndOfSentencePosition && !bGrammarErrors && aResult.nBehindEndOfSentencePosition < nEndGrammarCheck );
684 
685  if( bGrammarErrors && nSpellErrorPosition >= aResult.nBehindEndOfSentencePosition )
686  {
687  aRet <<= aResult;
688  //put the cursor to the current error
689  const linguistic2::SingleProofreadingError &rError = aResult.aErrors[0];
690  nCurrNd = pNd->GetIndex();
691  pSttPos->nNode = nCurrNd;
692  pEndPos->nNode = nCurrNd;
693  pSpellArgs->pStartNode = pNd->GetTextNode();
694  pSpellArgs->pEndNode = pNd->GetTextNode();
695  pSpellArgs->pStartIdx->Assign(pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart ).mnPos );
696  pSpellArgs->pEndIdx->Assign(pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart + rError.nErrorLength ).mnPos );
697  nCurrNd = nEndNd;
698  }
699  }
700  }
701  }
702  }
703  break;
704  case SwNodeType::Section:
705  if( static_cast<SwSectionNode*>(pNd)->GetSection().IsProtect() ||
706  static_cast<SwSectionNode*>(pNd)->GetSection().IsHidden() )
707  nCurrNd = pNd->EndOfSectionIndex();
708  break;
709  case SwNodeType::End:
710  {
711  break;
712  }
713  default: break;
714  }
715 
716  bGoOn = nCurrNd < nEndNd;
717  ++nCurrNd;
718  }
719  }
720 
721  if( !aRet.hasValue() )
722  {
723  if (pConvArgs)
724  aRet <<= pConvArgs->aConvText;
725  else
726  aRet <<= pSpellArgs->xSpellAlt;
727  }
728 
729  return aRet;
730 }
731 
733 {
734  const SwNode *pStart;
735  const SwNode *pEnd;
737  sal_uInt16 * const pPageCnt;
738  sal_uInt16 * const pPageSt;
739 
740  sal_uInt32 nNode;
741  sal_Int32 nPamStart;
742  sal_Int32 nPamLen;
743 
744 public:
745  SwHyphArgs( const SwPaM *pPam, const Point &rPoint,
746  sal_uInt16* pPageCount, sal_uInt16* pPageStart );
747  void SetPam( SwPaM *pPam ) const;
748  void SetNode( SwNode *pNew ) { pNode = pNew; }
749  inline void SetRange( const SwNode *pNew );
750  void NextNode() { ++nNode; }
751  sal_uInt16 *GetPageCnt() { return pPageCnt; }
752  sal_uInt16 *GetPageSt() { return pPageSt; }
753 };
754 
755 SwHyphArgs::SwHyphArgs( const SwPaM *pPam, const Point &rCursorPos,
756  sal_uInt16* pPageCount, sal_uInt16* pPageStart )
757  : SwInterHyphInfo( rCursorPos ), pNode(nullptr),
758  pPageCnt( pPageCount ), pPageSt( pPageStart )
759 {
760  // The following constraints have to be met:
761  // 1) there is at least one Selection
762  // 2) SPoint() == Start()
763  OSL_ENSURE( pPam->HasMark(), "SwDoc::Hyphenate: blowing in the wind");
764  OSL_ENSURE( *pPam->GetPoint() <= *pPam->GetMark(),
765  "SwDoc::Hyphenate: New York, New York");
766 
767  const SwPosition *pPoint = pPam->GetPoint();
768  nNode = pPoint->nNode.GetIndex();
769 
770  // Set start
771  pStart = pPoint->nNode.GetNode().GetTextNode();
772  nPamStart = pPoint->nContent.GetIndex();
773 
774  // Set End and Length
775  const SwPosition *pMark = pPam->GetMark();
776  pEnd = pMark->nNode.GetNode().GetTextNode();
777  nPamLen = pMark->nContent.GetIndex();
778  if( pPoint->nNode == pMark->nNode )
779  nPamLen = nPamLen - pPoint->nContent.GetIndex();
780 }
781 
782 inline void SwHyphArgs::SetRange( const SwNode *pNew )
783 {
784  nStart = pStart == pNew ? nPamStart : 0;
785  nEnd = pEnd == pNew ? nPamStart + nPamLen : SAL_MAX_INT32;
786 }
787 
788 void SwHyphArgs::SetPam( SwPaM *pPam ) const
789 {
790  if( !pNode )
791  *pPam->GetPoint() = *pPam->GetMark();
792  else
793  {
794  pPam->GetPoint()->nNode = nNode;
796  pPam->GetMark()->nNode = nNode;
798  nWordStart + nWordLen );
799  OSL_ENSURE( nNode == pNode->GetIndex(),
800  "SwHyphArgs::SetPam: Pam disaster" );
801  }
802 }
803 
804 // Returns true if we can proceed.
805 static bool lcl_HyphenateNode( const SwNodePtr& rpNd, void* pArgs )
806 {
807  // Hyphenate returns true if there is a hyphenation point and sets pPam
808  SwTextNode *pNode = rpNd->GetTextNode();
809  SwHyphArgs *pHyphArgs = static_cast<SwHyphArgs*>(pArgs);
810  if( pNode )
811  {
812  // sw_redlinehide: this will be called once per node for merged nodes;
813  // the fully deleted ones won't have frames so are skipped.
814  SwContentFrame* pContentFrame = pNode->getLayoutFrame( pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() );
815  if( pContentFrame && !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
816  {
817  sal_uInt16 *pPageSt = pHyphArgs->GetPageSt();
818  sal_uInt16 *pPageCnt = pHyphArgs->GetPageCnt();
819  if( pPageCnt && *pPageCnt && pPageSt )
820  {
821  sal_uInt16 nPageNr = pContentFrame->GetPhyPageNum();
822  if( !*pPageSt )
823  {
824  *pPageSt = nPageNr;
825  if( *pPageCnt < *pPageSt )
826  *pPageCnt = *pPageSt;
827  }
828  long nStat = nPageNr >= *pPageSt ? nPageNr - *pPageSt + 1
829  : nPageNr + *pPageCnt - *pPageSt + 1;
830  ::SetProgressState( nStat, pNode->GetDoc()->GetDocShell() );
831  }
832  pHyphArgs->SetRange( rpNd );
833  if( pNode->Hyphenate( *pHyphArgs ) )
834  {
835  pHyphArgs->SetNode( rpNd );
836  return false;
837  }
838  }
839  }
840  pHyphArgs->NextNode();
841  return true;
842 }
843 
844 uno::Reference< XHyphenatedWord > SwDoc::Hyphenate(
845  SwPaM *pPam, const Point &rCursorPos,
846  sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
847 {
848  OSL_ENSURE(this == pPam->GetDoc(), "SwDoc::Hyphenate: strangers in the night");
849 
850  if( *pPam->GetPoint() > *pPam->GetMark() )
851  pPam->Exchange();
852 
853  SwHyphArgs aHyphArg( pPam, rCursorPos, pPageCnt, pPageSt );
854  SwNodeIndex aTmpIdx( pPam->GetMark()->nNode, 1 );
855  GetNodes().ForEach( pPam->GetPoint()->nNode, aTmpIdx,
856  lcl_HyphenateNode, &aHyphArg );
857  aHyphArg.SetPam( pPam );
858  return aHyphArg.GetHyphWord(); // will be set by lcl_HyphenateNode
859 }
860 
861 // Save the current values to add them as automatic entries to AutoCorrect.
862 void SwDoc::SetAutoCorrExceptWord( std::unique_ptr<SwAutoCorrExceptWord> pNew )
863 {
864  mpACEWord = std::move(pNew);
865 }
866 
868 {
869  mpACEWord.reset();
870 }
871 
872 void SwDoc::CountWords( const SwPaM& rPaM, SwDocStat& rStat )
873 {
874  // This is a modified version of SwDoc::TransliterateText
875  const SwPosition* pStt = rPaM.Start();
876  const SwPosition* pEnd = pStt == rPaM.GetPoint() ? rPaM.GetMark()
877  : rPaM.GetPoint();
878 
879  const sal_uLong nSttNd = pStt->nNode.GetIndex();
880  const sal_uLong nEndNd = pEnd->nNode.GetIndex();
881 
882  const sal_Int32 nSttCnt = pStt->nContent.GetIndex();
883  const sal_Int32 nEndCnt = pEnd->nContent.GetIndex();
884 
885  const SwTextNode* pTNd = pStt->nNode.GetNode().GetTextNode();
886  if( pStt == pEnd && pTNd ) // no region ?
887  {
888  // do nothing
889  return;
890  }
891 
892  if( nSttNd != nEndNd )
893  {
894  SwNodeIndex aIdx( pStt->nNode );
895  if( nSttCnt )
896  {
897  ++aIdx;
898  if( pTNd )
899  pTNd->CountWords( rStat, nSttCnt, pTNd->GetText().getLength() );
900  }
901 
902  for( ; aIdx.GetIndex() < nEndNd; ++aIdx )
903  if( nullptr != ( pTNd = aIdx.GetNode().GetTextNode() ))
904  pTNd->CountWords( rStat, 0, pTNd->GetText().getLength() );
905 
906  if( nEndCnt && nullptr != ( pTNd = pEnd->nNode.GetNode().GetTextNode() ))
907  pTNd->CountWords( rStat, 0, nEndCnt );
908  }
909  else if( pTNd && nSttCnt < nEndCnt )
910  pTNd->CountWords( rStat, nSttCnt, nEndCnt );
911 }
912 
913 
914 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool GoSentence(SentenceMoveType eMoveType, SwRootFrame const *pLayout=nullptr)
Definition: swcrsr.cxx:1529
void CheckResetRedlineMergeFlag(SwTextNode &rNode, Recreate eRecreateMerged)
if first node is First, its frames may need to be moved, never deleted.
Definition: ndtxt.cxx:878
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:682
std::vector< SwPosition * > mvSavArr
Definition: mvsave.hxx:194
virtual sal_Int32 Len() const
Definition: node.cxx:1181
bool erase(const value_type &x)
Definition: docfmt.cxx:2107
SwNode * pNode
Definition: docedt.cxx:736
sal_uLong GetIndex() const
Definition: node.hxx:282
bool hasValue()
Marks a position in the document model.
Definition: pam.hxx:35
void MoveDeletedPrevFrames(const SwTextNode &rDeletedPrev, SwTextNode &rNode)
if first node is deleted & second survives, then the first node's frame will be deleted too; prevent this...
Definition: ndtxt.cxx:838
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:754
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2099
const OUString & GetText() const
Definition: ndtxt.hxx:211
virtual const SwRootFrame * GetCurrentLayout() const =0
SwDocShell * GetDocShell()
Definition: doc.hxx:1341
void SetNode(SwNode *pNew)
Definition: docedt.cxx:748
css::uno::Any Spell(SwPaM &, css::uno::Reference< css::linguistic2::XSpellChecker1 > const &, sal_uInt16 *pPageCnt, sal_uInt16 *pPageSt, bool bGrammarCheck, SwRootFrame const *pLayout, SwConversionArgs *pConvArgs=nullptr) const
Operations on the content of the document e.g.
Definition: docedt.cxx:552
const_iterator find(const value_type &x) const
Definition: docfmt.cxx:2067
SwNodeIndex nNode
Definition: pam.hxx:37
const_iterator begin() const
Definition: docary.hxx:257
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:284
sal_uIntPtr sal_uLong
bool Spell(SwSpellArgs *)
Definition: txtedt.cxx:951
const SwPosition * GetMark() const
Definition: pam.hxx:209
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1148
Definition: doc.hxx:185
void CutText(SwTextNode *const pDest, const SwIndex &rStart, const sal_Int32 nLen)
Definition: ndtxt.cxx:2403
SwSectionNode is derived from SwStartNode.
def point()
SwNode & GetNode() const
Definition: ndindex.hxx:118
sal_uInt32 nNode
Definition: docedt.cxx:740
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
SwPosition & GetBound(bool bOne=true)
Definition: pam.hxx:245
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:176
bool IsDestroyFrameAnchoredAtChar(SwPosition const &rAnchorPos, SwPosition const &rStart, SwPosition const &rEnd, DelContentType const nDelContentType)
will DelContentIndex destroy a frame anchored at character at rAnchorPos?
Definition: undobj.cxx:1546
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:737
void Delete(const SwNodeIndex &rPos, sal_uLong nNodes=1)
delete nodes
Definition: nodes.cxx:1063
void SetEnd(SwTextNode *pEnd, SwIndex &rEnd)
Definition: splargs.hxx:55
SwNodeType GetNodeType() const
Definition: node.hxx:144
SwIndex nContent
Definition: pam.hxx:38
bool empty() const
Definition: docary.hxx:367
SwNodeIndex aStart
Definition: ndindex.hxx:131
sal_uLong GetIndex() const
Definition: ndindex.hxx:151
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
void SetRange(const SwNode *pNew)
Definition: docedt.cxx:782
static std::vector< sal_uInt16 > lcl_RangesToVector(const sal_uInt16 *pRanges)
Convert list of ranges of whichIds to a corresponding list of whichIds.
Definition: docedt.cxx:341
static bool lcl_HyphenateNode(const SwNodePtr &rpNd, void *pArgs)
Definition: docedt.cxx:805
bool sw_JoinText(SwPaM &rPam, bool bJoinPrev)
Definition: docedt.cxx:390
void SetProgressState(long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:78
Specific frame formats (frames, DrawObjects).
Definition: docary.hxx:201
const css::uno::Reference< css::linguistic2::XHyphenatedWord > & GetHyphWord()
Definition: splargs.hxx:139
#define RES_FLYFRMFMT
Definition: hintids.hxx:275
bool IsContentNode() const
Definition: node.hxx:628
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
static void lcl_syncGrammarError(SwTextNode &rTextNode, linguistic2::ProofreadingResult &rResult, const ModelToViewHelper &rConversionMap)
Definition: docedt.cxx:527
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:443
Merge
sw_redlinehide: redline node merge state
Definition: node.hxx:92
Style of a layout element.
Definition: frmfmt.hxx:57
const OUString & getViewText() const
#define SAL_MAX_INT32
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
void ForEach(FnForEach_SwNodes fnForEach, void *pArgs=nullptr)
Definition: ndarr.hxx:144
const SwPosition * GetPoint() const
Definition: pam.hxx:207
void SaveFlyInRange(const SwNodeRange &rRg, SaveFlyArr &rArr)
Definition: docedt.cxx:110
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:198
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
sal_Int32 nPamLen
Definition: docedt.cxx:742
void RestFlyInRange(SaveFlyArr &rArr, const SwPosition &rStartPos, const SwNodeIndex *pInsertPos)
Definition: docedt.cxx:58
void Exchange()
Definition: pam.cxx:469
int i
SwContentNode * GetContentNode()
Definition: node.hxx:615
vector_type::size_type size_type
Definition: docary.hxx:330
sal_Int32 nStart
input: requested range to hyphenate
Definition: splargs.hxx:118
FlyAnchors.
Definition: fmtanchr.hxx:34
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:205
SwDoc * GetDoc()
Definition: node.hxx:702
SwDoc * GetDoc() const
Definition: pam.hxx:243
bool LookForEntry(sal_Int32 nBegin, sal_Int32 nEnd)
Definition: wrong.cxx:613
virtual void DelFrames()
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: atrfrm.cxx:2617
Marks a character position inside a document model node.
Definition: index.hxx:37
SwGrammarMarkUp * GetGrammarCheck()
Definition: txtedt.cxx:2190
bool Hyphenate(SwInterHyphInfo &rHyphInf)
Interactive hyphenation: we find TextFrame and call its CalcHyph.
Definition: txtedt.cxx:1620
std::unique_ptr< SwNodeIndex > pSavIdx
Definition: mvsave.hxx:195
Marks a node in the document model.
Definition: ndindex.hxx:31
bool HasSwAttrSet() const
Definition: node.hxx:444
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
sal_Int32 nEnd
Definition: splargs.hxx:119
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:437
const SwPosition * Start() const
Definition: pam.hxx:212
std::deque< SaveFly > SaveFlyArr
Definition: mvsave.hxx:114
css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const
Definition: docnew.cxx:131
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
void CorrRel(const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:300
OUString aConvText
Definition: splargs.hxx:64
void SetAutoCorrExceptWord(std::unique_ptr< SwAutoCorrExceptWord > pNew)
Definition: docedt.cxx:862
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:677
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:367
const SwNode * pStart
Definition: docedt.cxx:734
std::unique_ptr< SwAutoCorrExceptWord > mpACEWord
For the automated takeover of auto-corrected words that are "re-corrected".
Definition: doc.hxx:260
data structure to temporarily hold fly anchor positions relative to some location.
Definition: mvsave.hxx:99
void SetPam(SwPaM *pPam) const
Definition: docedt.cxx:788
sal_uInt16 GetPhyPageNum() const
Definition: trvlfrm.cxx:1689
void DeleteAutoCorrExceptWord()
Definition: docedt.cxx:867
static std::shared_ptr< ContentIdxStore > Create()
sal_Int32 GetIndex() const
Definition: index.hxx:95
virtual void MakeFrames()
Creates the views.
Definition: atrfrm.cxx:2628
SwNodes & GetNodes()
Definition: doc.hxx:402
const SwNode * pEnd
Definition: docedt.cxx:735
sal_Int32 nPamStart
Definition: docedt.cxx:741
const SwPosition * End() const
Definition: pam.hxx:217
sal_uInt16 const aCharFormatSetRange[]
Definition: init.cxx:245
SwNodeIndex aEnd
Definition: ndindex.hxx:132
SaveRedlEndPosForRestore(const SwNodeIndex &rInsIdx, sal_Int32 nContent)
Definition: docedt.cxx:294
ModelPosition ConvertToModelPosition(sal_Int32 nViewPos) const
Converts a view position into a model position.
bool CountWords(SwDocStat &rStat, sal_Int32 nStart, sal_Int32 nEnd) const
count words in given range - returns true if we refreshed out count
Definition: txtedt.cxx:1980
sal_Int32 const nSavContent
Definition: mvsave.hxx:196
sal_uInt16 *const pPageSt
Definition: docedt.cxx:738
sal_Int32 nWordLen
Definition: splargs.hxx:122
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
SwHyphArgs(const SwPaM *pPam, const Point &rPoint, sal_uInt16 *pPageCount, sal_uInt16 *pPageStart)
Definition: docedt.cxx:755
void DelFlyInRange(const SwNodeIndex &rMkNdIdx, const SwNodeIndex &rPtNdIdx, SwIndex const *const pMkIdx, SwIndex const *const pPtIdx)
Delete and move all Flys at the paragraph, that are within the selection.
Definition: docedt.cxx:222
size_t size() const
Definition: docary.hxx:225
void sw_GetJoinFlags(SwPaM &rPam, bool &rJoinText, bool &rJoinPrev)
Definition: docedt.cxx:359
SwFrameFormatsBase::size_type size_type
Definition: docary.hxx:217
sal_Int32 nWordStart
output: found word
Definition: splargs.hxx:121
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
Definition: thints.cxx:2479
virtual const SwRedlineTable & GetRedlineTable() const =0
const SwIndexReg * GetIdxReg() const
Definition: index.hxx:101
void NextNode()
Definition: docedt.cxx:750
#define RES_PAGEDESC
Definition: hintids.hxx:199
#define RES_BREAK
Definition: hintids.hxx:200
sal_uInt16 const aBreakSetRange[]
Definition: init.cxx:142
bool Convert(SwConversionArgs &)
Definition: txtedt.cxx:1111
void SetStart(SwTextNode *pStart, SwIndex &rStart)
Definition: splargs.hxx:50
Merge GetRedlineMergeFlag() const
Definition: node.hxx:97
sal_uInt16 * GetPageCnt()
Definition: docedt.cxx:751
css::uno::Reference< css::linguistic2::XHyphenatedWord > Hyphenate(SwPaM *pPam, const Point &rCursorPos, sal_uInt16 *pPageCnt, sal_uInt16 *pPageSt)
Definition: docedt.cxx:844
sal_uInt16 * GetPageSt()
Definition: docedt.cxx:752
static void CountWords(const SwPaM &rPaM, SwDocStat &rStat)
Definition: docedt.cxx:872
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1308
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:843
bool IsGrammarCheckDirty() const
Definition: txtedt.cxx:2264
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1486
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1622
sal_uInt16 *const pPageCnt
Definition: docedt.cxx:737
void CheckAnchoredFlyConsistency(SwDoc const &rDoc)
Definition: atrfrm.cxx:3541
Base class of the Writer document model elements.
Definition: node.hxx:79