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