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