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 <rolbck.hxx>
32#include <rootfrm.hxx>
33#include <splargs.hxx>
34#include <swcrsr.hxx>
35#include <txtfrm.hxx>
36#include <unoflatpara.hxx>
37#include <SwGrammarMarkUp.hxx>
38#include <docedt.hxx>
39#include <frmfmt.hxx>
40#include <ndtxt.hxx>
41#include <undobj.hxx>
42#include <frameformats.hxx>
43
44#include <vector>
45#include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
46#include <osl/diagnose.h>
47
48using namespace ::com::sun::star;
49using namespace ::com::sun::star::linguistic2;
50using namespace ::com::sun::star::i18n;
51
52
53void RestFlyInRange( SaveFlyArr & rArr, const SwPosition& rStartPos,
54 const SwNode* pInsertPos, bool const isForceToStartPos)
55{
56 SwPosition aPos(rStartPos);
57 for(const SaveFly & rSave : rArr)
58 {
59 // create new anchor
60 SwFrameFormat* pFormat = rSave.pFrameFormat;
61 SwFormatAnchor aAnchor( pFormat->GetAnchor() );
62
63 if (rSave.isAtInsertNode || isForceToStartPos)
64 {
65 if( pInsertPos != nullptr )
66 {
67 if (aAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA)
68 {
69 assert(pInsertPos->GetContentNode());
70 aPos.Assign( *pInsertPos->GetContentNode(),
71 rSave.nContentIndex);
72 }
73 else
74 {
75 assert(aAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR);
76 aPos = rStartPos;
77 }
78 }
79 else
80 {
81 aPos.Assign(rStartPos.GetNode());
82 assert(aPos.GetNode().GetContentNode());
83 }
84 }
85 else
86 {
87 aPos.Assign(rStartPos.GetNodeIndex() + rSave.nNdDiff);
88 assert(aPos.GetNode().GetContentNode());
89 aPos.SetContent(
90 rSave.nNdDiff == SwNodeOffset(0)
91 ? rStartPos.GetContentIndex() + rSave.nContentIndex
92 : rSave.nContentIndex);
93 }
94
95 aAnchor.SetAnchor( &aPos );
96 pFormat->GetDoc()->GetSpzFrameFormats()->push_back( pFormat );
97 // SetFormatAttr should call Modify() and add it to the node
98 pFormat->SetFormatAttr( aAnchor );
99 SwContentNode* pCNd = aPos.GetNode().GetContentNode();
100 if (pCNd && pCNd->getLayoutFrame(pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr))
101 pFormat->MakeFrames();
102 }
104}
105
106void SaveFlyInRange( const SwNodeRange& rRg, SaveFlyArr& rArr )
107{
109 for( SwFrameFormats::size_type n = 0; n < rFormats.size(); ++n )
110 {
111 SwFrameFormat *const pFormat = rFormats[n];
112 SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor();
113 SwPosition const*const pAPos = pAnchor->GetContentAnchor();
114 if (pAPos &&
115 ((RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()) ||
116 (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
117 rRg.aStart <= pAPos->GetNode() && pAPos->GetNode() < rRg.aEnd.GetNode() )
118 {
119 SaveFly aSave( pAPos->GetNodeIndex() - rRg.aStart.GetIndex(),
120 (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())
121 ? pAPos->GetContentIndex()
122 : 0,
123 pFormat, false );
124 rArr.push_back( aSave );
125 pFormat->DelFrames();
126 // set a dummy anchor position to maintain anchoring invariants
127 SwFormatAnchor aAnchor( pFormat->GetAnchor() );
128 aAnchor.SetAnchor(nullptr);
129 pFormat->SetFormatAttr(aAnchor);
130 rFormats.erase( rFormats.begin() + n-- );
131 }
132 }
134}
135
136void SaveFlyInRange( const SwPaM& rPam, const SwPosition& rInsPos,
137 SaveFlyArr& rArr, bool bMoveAllFlys, SwHistory *const pHistory)
138{
139 SwFrameFormats& rFormats = *rPam.GetPoint()->GetNode().GetDoc().GetSpzFrameFormats();
140 SwFrameFormat* pFormat;
141 const SwFormatAnchor* pAnchor;
142
143 const SwPosition* pPos = rPam.Start();
144 const SwNode& rSttNd = pPos->GetNode();
145
146 SwPosition atParaEnd(*rPam.End());
147 if (bMoveAllFlys)
148 {
149 assert(!rPam.End()->GetNode().IsTextNode() // can be table end-node
150 || rPam.End()->GetContentIndex() == rPam.End()->GetNode().GetTextNode()->Len());
151 atParaEnd.Adjust(SwNodeOffset(1));
152 }
153
154 for( SwFrameFormats::size_type n = 0; n < rFormats.size(); ++n )
155 {
156 pFormat = rFormats[n];
157 pAnchor = &pFormat->GetAnchor();
158 const SwPosition* pAPos = pAnchor->GetContentAnchor();
159 const SwNodeIndex* pContentIdx;
160 if (pAPos &&
161 ((RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()) ||
162 (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
163 // do not move if the InsPos is in the ContentArea of the Fly
164 ( nullptr == ( pContentIdx = pFormat->GetContent().GetContentIdx() ) ||
165 (*pContentIdx >= rInsPos.GetNode() ||
166 rInsPos.GetNode() >= *pContentIdx->GetNode().EndOfSectionNode())))
167 {
168 bool bInsPos = false;
169
170 if ( (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId()
171 && IsDestroyFrameAnchoredAtChar(*pAPos, *rPam.Start(), *rPam.End()))
172 || (RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()
173 && IsSelectFrameAnchoredAtPara(*pAPos, *rPam.Start(), atParaEnd,
174 bMoveAllFlys
177 || (RndStdIds::FLY_AT_PARA == pAnchor->GetAnchorId()
178 && (bInsPos = (rInsPos.GetNode() == pAPos->GetNode())))
179 || (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId()
180 && (bInsPos = (rInsPos == *pAPos))))
181 {
182 if (pHistory)
183 {
184 pHistory->AddChangeFlyAnchor(*pFormat);
185 }
186 SaveFly aSave( pAPos->GetNodeIndex() - rSttNd.GetIndex(),
187 (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())
188 ? (pAPos->GetNode() == rSttNd)
189 ? pAPos->GetContentIndex() - rPam.Start()->GetContentIndex()
190 : pAPos->GetContentIndex()
191 : 0,
192 pFormat, bInsPos );
193 rArr.push_back( aSave );
194 pFormat->DelFrames();
195 // set a dummy anchor position to maintain anchoring invariants
196 SwFormatAnchor aAnchor( pFormat->GetAnchor() );
197 aAnchor.SetAnchor(nullptr);
198 pFormat->SetFormatAttr(aAnchor);
199 rFormats.erase( rFormats.begin() + n-- );
200 }
201 }
202 }
204}
205
209 SwNode& rPtNd,
210 std::optional<sal_Int32> oMkContentIdx, std::optional<sal_Int32> oPtContentIdx)
211{
212 assert(oMkContentIdx.has_value() == oPtContentIdx.has_value());
213 SwPosition const point(oPtContentIdx
214 ? SwPosition(rPtNd, rPtNd.GetContentNode(), *oPtContentIdx)
215 : SwPosition(rPtNd));
216 SwPosition const mark(oPtContentIdx
217 ? SwPosition(rMkNd, rMkNd.GetContentNode(), *oMkContentIdx)
218 : SwPosition(rMkNd));
219 SwPosition const& rStart = mark <= point ? mark : point;
220 SwPosition const& rEnd = mark <= point ? point : mark;
221
222 SwDoc& rDoc = rMkNd.GetDoc();
223 SwFrameFormats& rTable = *rDoc.GetSpzFrameFormats();
224 for ( auto i = rTable.size(); i; )
225 {
226 SwFrameFormat *pFormat = rTable[--i];
227 const SwFormatAnchor &rAnch = pFormat->GetAnchor();
228 SwPosition const*const pAPos = rAnch.GetContentAnchor();
229 if (pAPos &&
230 (((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA)
231 && IsSelectFrameAnchoredAtPara(*pAPos, rStart, rEnd, oPtContentIdx
234 || ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
235 && IsDestroyFrameAnchoredAtChar(*pAPos, rStart, rEnd, oPtContentIdx
238 {
239 // If the Fly is deleted, all Flys in its content have to be deleted too.
240 const SwFormatContent &rContent = pFormat->GetContent();
241 // But only fly formats own their content, not draw formats.
242 if (rContent.GetContentIdx() && pFormat->Which() == RES_FLYFRMFMT)
243 {
244 DelFlyInRange( rContent.GetContentIdx()->GetNode(),
245 *rContent.GetContentIdx()->
246 GetNode().EndOfSectionNode() );
247 // Position could have been moved!
248 if (i > rTable.size())
249 i = rTable.size();
250 else if (i == rTable.size() || pFormat != rTable[i])
251 i = std::distance(rTable.begin(), rTable.find( pFormat ));
252 }
253
255
256 // DelLayoutFormat can also trigger the deletion of objects.
257 if (i > rTable.size())
258 i = rTable.size();
259 }
260 }
261}
262
263// #i59534: Redo of insertion of multiple text nodes runs into trouble
264// because of unnecessary expanded redlines
265// From now on this class saves the redline positions of all redlines which ends exact at the
266// insert position (node _and_ content index)
268 : mnSaveContent( nCnt )
269{
270 const SwDoc& rDest = rInsIdx.GetDoc();
272 return;
273
275 const SwPosition* pEnd;
276 SwPosition aSrcPos( rInsIdx, rInsIdx.GetContentNode(), nCnt );
277 rDest.getIDocumentRedlineAccess().GetRedline( aSrcPos, &nFndPos );
278 const SwRangeRedline* pRedl;
279 while( nFndPos--
280 && *( pEnd = ( pRedl = rDest.getIDocumentRedlineAccess().GetRedlineTable()[ nFndPos ] )->End() ) == aSrcPos
281 && *pRedl->Start() < aSrcPos )
282 {
283 if( !moSaveIndex )
284 {
285 moSaveIndex.emplace( rInsIdx, -1 );
286 }
287 mvSavArr.push_back( const_cast<SwPosition*>(pEnd) );
288 }
289}
290
292{
293 moSaveIndex.reset();
294}
295
297{
298 if (mvSavArr.empty())
299 return;
300 ++(*moSaveIndex);
301 SwContentNode* pNode = moSaveIndex->GetNode().GetContentNode();
302 // If there's no content node at the remembered position, we will not restore the old position
303 // This may happen if a table (or section?) will be inserted.
304 if( pNode )
305 {
306 SwPosition aPos( *moSaveIndex, pNode, mnSaveContent );
307 for( auto n = mvSavArr.size(); n; )
308 *mvSavArr[ --n ] = aPos;
309 }
310}
311
313static std::vector<sal_uInt16> lcl_RangesToVector(const WhichRangesContainer& pRanges)
314{
315 std::vector<sal_uInt16> aResult;
316
317 for(const WhichPair& rPair : pRanges)
318 {
319 for (sal_uInt16 j = rPair.first; j <= rPair.second; j++)
320 aResult.push_back(j);
321 }
322
323 return aResult;
324}
325
326void sw_GetJoinFlags( SwPaM& rPam, bool& rJoinText, bool& rJoinPrev )
327{
328 rJoinText = false;
329 rJoinPrev = false;
330 if( rPam.GetPoint()->GetNode() == rPam.GetMark()->GetNode() )
331 return;
332
333 auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
334 SwTextNode *pSttNd = pStt->GetNode().GetTextNode();
335 if( !pSttNd )
336 return;
337
338 SwTextNode *pEndNd = pEnd->GetNode().GetTextNode();
339 rJoinText = nullptr != pEndNd;
340 if( !rJoinText )
341 return;
342
343 bool bExchange = pStt == rPam.GetPoint();
344 if( !pStt->GetContentIndex() &&
345 pEndNd->GetText().getLength() != pEnd->GetContentIndex())
346 bExchange = !bExchange;
347 if( bExchange )
348 rPam.Exchange();
349 rJoinPrev = rPam.GetPoint() == pStt;
350 OSL_ENSURE( !pStt->GetContentIndex() &&
351 pEndNd->GetText().getLength() != pEnd->GetContentIndex()
352 ? (rPam.GetPoint()->GetNode() < rPam.GetMark()->GetNode())
353 : (rPam.GetPoint()->GetNode() > rPam.GetMark()->GetNode()),
354 "sw_GetJoinFlags");
355}
356
357bool sw_JoinText( SwPaM& rPam, bool bJoinPrev )
358{
359 SwNodeIndex aIdx( rPam.GetPoint()->GetNode() );
360 SwTextNode *pTextNd = aIdx.GetNode().GetTextNode();
361 SwNodeIndex aOldIdx( aIdx );
362 SwTextNode *pOldTextNd = pTextNd;
363
364 if( pTextNd && pTextNd->CanJoinNext( &aIdx ) )
365 {
366 SwDoc& rDoc = rPam.GetDoc();
367 if( bJoinPrev )
368 {
369 // We do not need to handle xmlids in this case, because
370 // it is only invoked if one paragraph is/becomes completely empty
371 // (see sw_GetJoinFlags)
372 {
373 // If PageBreaks are deleted/set, it must not be added to the Undo history!
374 // Also, deleting the Node is not added to the Undo history!
375 ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
376
377 /* PageBreaks, PageDesc, ColumnBreaks */
378 // If we need to change something about the logic to copy the PageBreaks,
379 // PageDesc, etc. we also have to change SwUndoDelete.
380 // There, we copy the AUTO PageBreak from the GetMarkNode!
381
382 /* The MarkNode */
383 pTextNd = aIdx.GetNode().GetTextNode();
384 if (pTextNd->HasSwAttrSet())
385 {
386 if( SfxItemState::SET == pTextNd->GetpSwAttrSet()->GetItemState( RES_BREAK, false) )
387 pTextNd->ResetAttr( RES_BREAK );
388 if( pTextNd->HasSwAttrSet() &&
389 SfxItemState::SET == pTextNd->GetpSwAttrSet()->GetItemState( RES_PAGEDESC, false ) )
390 pTextNd->ResetAttr( RES_PAGEDESC );
391 }
392
393 /* The PointNode */
394 if( pOldTextNd->HasSwAttrSet() )
395 {
396 const SfxPoolItem* pItem;
397 SfxItemSet aSet( rDoc.GetAttrPool(), aBreakSetRange );
398 const SfxItemSet* pSet = pOldTextNd->GetpSwAttrSet();
399 if( SfxItemState::SET == pSet->GetItemState( RES_BREAK,
400 false, &pItem ) )
401 aSet.Put( *pItem );
402 if( SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC,
403 false, &pItem ) )
404 aSet.Put( *pItem );
405 if( aSet.Count() )
406 pTextNd->SetAttr( aSet );
407 }
408 pOldTextNd->FormatToTextAttr( pTextNd );
409
410 const std::shared_ptr< sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
411 pContentStore->Save(rDoc, aOldIdx.GetIndex(), SAL_MAX_INT32);
412
413 SwContentIndex aAlphaIdx(pTextNd);
414 pOldTextNd->CutText( pTextNd, aAlphaIdx, SwContentIndex(pOldTextNd),
415 pOldTextNd->Len() );
416 SwPosition aAlphaPos( aIdx, aAlphaIdx );
417 rDoc.CorrRel( rPam.GetPoint()->GetNode(), aAlphaPos, 0, true );
418
419 // move all Bookmarks/TOXMarks
420 if( !pContentStore->Empty() )
421 pContentStore->Restore( rDoc, aIdx.GetIndex() );
422
423 // If the passed PaM is not in the Cursor ring,
424 // treat it separately (e.g. when it's being called from AutoFormat)
425 if( pOldTextNd == rPam.GetBound().GetContentNode() )
426 rPam.GetBound() = aAlphaPos;
427 if( pOldTextNd == rPam.GetBound( false ).GetContentNode() )
428 rPam.GetBound( false ) = aAlphaPos;
429 }
430 // delete the Node, at last!
431 SwNode::Merge const eOldMergeFlag(pOldTextNd->GetRedlineMergeFlag());
432 if (eOldMergeFlag == SwNode::Merge::First
433 && !pTextNd->IsCreateFrameWhenHidingRedlines())
434 {
435 sw::MoveDeletedPrevFrames(*pOldTextNd, *pTextNd);
436 }
437 rDoc.GetNodes().Delete( aOldIdx );
439 eOldMergeFlag == SwNode::Merge::NonFirst
442 }
443 else
444 {
445 SwTextNode* pDelNd = aIdx.GetNode().GetTextNode();
446 if( pTextNd->Len() )
447 pDelNd->FormatToTextAttr( pTextNd );
448 else
449 {
450 /* This case was missed:
451
452 <something></something> <-- pTextNd
453 <other>ccc</other> <-- pDelNd
454
455 <something> and <other> are paragraph
456 attributes. The attribute <something> stayed if not
457 overwritten by an attribute in "ccc". Fixed by
458 first resetting all character attributes in first
459 paragraph (pTextNd).
460 */
461 std::vector<sal_uInt16> aShorts =
463 pTextNd->ResetAttr(aShorts);
464
465 if( pDelNd->HasSwAttrSet() )
466 {
467 // only copy the character attributes
468 SfxItemSet aTmpSet( rDoc.GetAttrPool(), aCharFormatSetRange );
469 aTmpSet.Put( *pDelNd->GetpSwAttrSet() );
470 pTextNd->SetAttr( aTmpSet );
471 }
472 }
473
474 rDoc.CorrRel( aIdx.GetNode(), *rPam.GetPoint(), 0, true );
475 // #i100466# adjust given <rPam>, if it does not belong to the cursors
476 if ( pDelNd == rPam.GetBound().GetContentNode() )
477 {
478 rPam.GetBound().Assign( *pTextNd );
479 }
480 if( pDelNd == rPam.GetBound( false ).GetContentNode() )
481 {
482 rPam.GetBound( false ).Assign( *pTextNd );
483 }
484 pTextNd->JoinNext();
485 }
486 return true;
487 }
488 else return false;
489}
490
491static void lcl_syncGrammarError( SwTextNode &rTextNode, linguistic2::ProofreadingResult& rResult,
492 const ModelToViewHelper &rConversionMap )
493{
494 if( rTextNode.IsGrammarCheckDirty() )
495 return;
496 SwGrammarMarkUp* pWrong = rTextNode.GetGrammarCheck();
497 linguistic2::SingleProofreadingError* pArray = rResult.aErrors.getArray();
498 sal_uInt16 j = 0;
499 if( pWrong )
500 {
501 for( sal_Int32 i = 0; i < rResult.aErrors.getLength(); ++i )
502 {
503 const linguistic2::SingleProofreadingError &rError = rResult.aErrors[i];
504 const sal_Int32 nStart = rConversionMap.ConvertToModelPosition( rError.nErrorStart ).mnPos;
505 const sal_Int32 nEnd = rConversionMap.ConvertToModelPosition( rError.nErrorStart + rError.nErrorLength ).mnPos;
506 if( i != j )
507 pArray[j] = pArray[i];
508 if( pWrong->LookForEntry( nStart, nEnd ) )
509 ++j;
510 }
511 }
512 if( rResult.aErrors.getLength() > j )
513 rResult.aErrors.realloc( j );
514}
515
517 uno::Reference< XSpellChecker1 > const &xSpeller,
518 sal_uInt16* pPageCnt, sal_uInt16* pPageSt,
519 bool bGrammarCheck,
520 SwRootFrame const*const pLayout,
521 SwConversionArgs *pConvArgs ) const
522{
523 SwPosition* const pSttPos = rPaM.Start();
524 SwPosition* const pEndPos = rPaM.End();
525
526 std::unique_ptr<SwSpellArgs> pSpellArgs;
527 if (pConvArgs)
528 {
529 pConvArgs->SetStart(*pSttPos);
530 pConvArgs->SetEnd(*pEndPos);
531 }
532 else
533 pSpellArgs.reset(new SwSpellArgs( xSpeller, *pSttPos, *pEndPos, bGrammarCheck ));
534
535 SwNodeOffset nCurrNd = pSttPos->GetNodeIndex();
536 SwNodeOffset nEndNd = pEndPos->GetNodeIndex();
537
538 uno::Any aRet;
539 if( nCurrNd <= nEndNd )
540 {
541 SwContentFrame* pContentFrame;
542 bool bGoOn = true;
543 while( bGoOn )
544 {
545 SwNode* pNd = GetNodes()[ nCurrNd ];
546 switch( pNd->GetNodeType() )
547 {
548 case SwNodeType::Text:
549 if( nullptr != ( pContentFrame = pNd->GetTextNode()->getLayoutFrame( getIDocumentLayoutAccess().GetCurrentLayout() )) )
550 {
551 // skip protected and hidden Cells and Flys
552 if( pContentFrame->IsProtected() )
553 {
554 nCurrNd = pNd->EndOfSectionIndex();
555 }
556 else if( !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
557 {
558 if( pPageCnt && *pPageCnt && pPageSt )
559 {
560 sal_uInt16 nPageNr = pContentFrame->GetPhyPageNum();
561 if( !*pPageSt )
562 {
563 *pPageSt = nPageNr;
564 if( *pPageCnt < *pPageSt )
565 *pPageCnt = *pPageSt;
566 }
567 tools::Long nStat;
568 if( nPageNr >= *pPageSt )
569 nStat = nPageNr - *pPageSt + 1;
570 else
571 nStat = nPageNr + *pPageCnt - *pPageSt + 1;
573 }
574 //Spell() changes the pSpellArgs in case an error is found
575 sal_Int32 nBeginGrammarCheck = 0;
576 sal_Int32 nEndGrammarCheck = 0;
577 if( pSpellArgs && pSpellArgs->bIsGrammarCheck)
578 {
579 nBeginGrammarCheck = &pSpellArgs->pStartPos->GetNode() == pNd ? pSpellArgs->pStartPos->GetContentIndex() : 0;
580 // if grammar checking starts inside of a sentence the start position has to be adjusted
581 if( nBeginGrammarCheck )
582 {
583 SwContentIndex aStartIndex( pNd->GetTextNode(), nBeginGrammarCheck );
584 SwPosition aStart( *pNd, aStartIndex );
585 SwCursor aCursor(aStart, nullptr);
586 SwPosition aOrigPos = *aCursor.GetPoint();
588 if( aOrigPos != *aCursor.GetPoint() )
589 {
590 nBeginGrammarCheck = aCursor.GetPoint()->GetContentIndex();
591 }
592 }
593 nEndGrammarCheck = (&pSpellArgs->pEndPos->GetNode() == pNd)
594 ? pSpellArgs->pEndPos->GetContentIndex()
595 : pNd->GetTextNode()
596 ->GetText().getLength();
597 }
598
599 sal_Int32 nSpellErrorPosition = pNd->GetTextNode()->GetText().getLength();
600 if( (!pConvArgs && pNd->GetTextNode()->Spell( pSpellArgs.get() )) ||
601 ( pConvArgs && pNd->GetTextNode()->Convert( *pConvArgs )))
602 {
603 // Cancel and remember position
604 if( pSpellArgs )
605 nSpellErrorPosition = pSpellArgs->pStartPos->GetContentIndex() > pSpellArgs->pEndPos->GetContentIndex() ?
606 pSpellArgs->pEndPos->GetContentIndex() :
607 pSpellArgs->pStartPos->GetContentIndex();
608 if( nCurrNd != nEndNd )
609 {
610 pSttPos->Assign(nCurrNd);
611 pEndPos->Assign(nCurrNd);
612 nCurrNd = nEndNd;
613 }
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();
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 pSttPos->Assign(*pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart ).mnPos );
656 pEndPos->Assign(*pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart + rError.nErrorLength ).mnPos );
657 nCurrNd = nEndNd;
658 }
659 }
660 }
661 }
662 }
663 break;
665 if( static_cast<SwSectionNode*>(pNd)->GetSection().IsProtect() ||
666 static_cast<SwSectionNode*>(pNd)->GetSection().IsHidden() )
667 nCurrNd = pNd->EndOfSectionIndex();
668 break;
669 case SwNodeType::End:
670 {
671 break;
672 }
673 default: break;
674 }
675
676 bGoOn = nCurrNd < nEndNd;
677 ++nCurrNd;
678 }
679 }
680
681 if( !aRet.hasValue() )
682 {
683 if (pConvArgs)
684 aRet <<= pConvArgs->aConvText;
685 else
686 aRet <<= pSpellArgs->xSpellAlt;
687 }
688
689 return aRet;
690}
691
692namespace {
693
694class SwHyphArgs : public SwInterHyphInfo
695{
696 SwNodeIndex m_aNodeIdx;
697 const SwNode *m_pStart;
698 const SwNode *m_pEnd;
699 sal_uInt16 *m_pPageCnt;
700 sal_uInt16 *m_pPageSt;
701
702 sal_Int32 m_nPamStart;
703 sal_Int32 m_nPamLen;
704
705public:
706 SwHyphArgs( const SwPaM *pPam, const Point &rPoint,
707 sal_uInt16* pPageCount, sal_uInt16* pPageStart );
708 void SetPam( SwPaM *pPam ) const;
709 void SetNode( SwNode& rNew ) { m_aNodeIdx.Assign(rNew); }
710 inline void SetRange( const SwNode *pNew );
711 void NextNode() { ++m_aNodeIdx; }
712 sal_uInt16 *GetPageCnt() { return m_pPageCnt; }
713 sal_uInt16 *GetPageSt() { return m_pPageSt; }
714};
715
716}
717
718SwHyphArgs::SwHyphArgs( const SwPaM *pPam, const Point &rCursorPos,
719 sal_uInt16* pPageCount, sal_uInt16* pPageStart )
720 : SwInterHyphInfo( rCursorPos ), m_aNodeIdx(pPam->GetPoint()->GetNode()),
721 m_pPageCnt( pPageCount ), m_pPageSt( pPageStart )
722{
723 // The following constraints have to be met:
724 // 1) there is at least one Selection
725 // 2) SPoint() == Start()
726 OSL_ENSURE( pPam->HasMark(), "SwDoc::Hyphenate: blowing in the wind");
727 OSL_ENSURE( *pPam->GetPoint() <= *pPam->GetMark(),
728 "SwDoc::Hyphenate: New York, New York");
729
730 const SwPosition *pPoint = pPam->GetPoint();
731
732 // Set start
733 m_pStart = pPoint->GetNode().GetTextNode();
734 m_nPamStart = pPoint->GetContentIndex();
735
736 // Set End and Length
737 const SwPosition *pMark = pPam->GetMark();
738 m_pEnd = pMark->GetNode().GetTextNode();
739 m_nPamLen = pMark->GetContentIndex();
740 if( pPoint->GetNode() == pMark->GetNode() )
741 m_nPamLen = m_nPamLen - pPoint->GetContentIndex();
742}
743
744inline void SwHyphArgs::SetRange( const SwNode *pNew )
745{
746 m_nStart = m_pStart == pNew ? m_nPamStart : 0;
747 m_nEnd = m_pEnd == pNew ? m_nPamStart + m_nPamLen : SAL_MAX_INT32;
748}
749
750void SwHyphArgs::SetPam( SwPaM *pPam ) const
751{
752 pPam->GetPoint()->Assign( m_aNodeIdx, m_nWordStart );
753 pPam->GetMark()->Assign( m_aNodeIdx, m_nWordStart + m_nWordLen );
754}
755
756// Returns true if we can proceed.
757static bool lcl_HyphenateNode( SwNode* pNd, void* pArgs )
758{
759 // Hyphenate returns true if there is a hyphenation point and sets pPam
760 SwTextNode *pNode = pNd->GetTextNode();
761 SwHyphArgs *pHyphArgs = static_cast<SwHyphArgs*>(pArgs);
762 if( pNode )
763 {
764 // sw_redlinehide: this will be called once per node for merged nodes;
765 // the fully deleted ones won't have frames so are skipped.
766 SwContentFrame* pContentFrame = pNode->getLayoutFrame( pNode->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() );
767 if( pContentFrame && !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
768 {
769 sal_uInt16 *pPageSt = pHyphArgs->GetPageSt();
770 sal_uInt16 *pPageCnt = pHyphArgs->GetPageCnt();
771 if( pPageCnt && *pPageCnt && pPageSt )
772 {
773 sal_uInt16 nPageNr = pContentFrame->GetPhyPageNum();
774 if( !*pPageSt )
775 {
776 *pPageSt = nPageNr;
777 if( *pPageCnt < *pPageSt )
778 *pPageCnt = *pPageSt;
779 }
780 tools::Long nStat = nPageNr >= *pPageSt ? nPageNr - *pPageSt + 1
781 : nPageNr + *pPageCnt - *pPageSt + 1;
782 ::SetProgressState( nStat, pNode->GetDoc().GetDocShell() );
783 }
784 pHyphArgs->SetRange( pNd );
785 if( pNode->Hyphenate( *pHyphArgs ) )
786 {
787 pHyphArgs->SetNode( *pNd );
788 return false;
789 }
790 }
791 }
792 pHyphArgs->NextNode();
793 return true;
794}
795
796uno::Reference< XHyphenatedWord > SwDoc::Hyphenate(
797 SwPaM *pPam, const Point &rCursorPos,
798 sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
799{
800 OSL_ENSURE(this == &pPam->GetDoc(), "SwDoc::Hyphenate: strangers in the night");
801
802 if( *pPam->GetPoint() > *pPam->GetMark() )
803 pPam->Exchange();
804
805 SwHyphArgs aHyphArg( pPam, rCursorPos, pPageCnt, pPageSt );
806 SwNodeIndex aTmpIdx( pPam->GetMark()->GetNode(), 1 );
807 GetNodes().ForEach( pPam->GetPoint()->GetNode(), aTmpIdx.GetNode(),
808 lcl_HyphenateNode, &aHyphArg );
809 aHyphArg.SetPam( pPam );
810 return aHyphArg.GetHyphWord(); // will be set by lcl_HyphenateNode
811}
812
813// Save the current values to add them as automatic entries to AutoCorrect.
814void SwDoc::SetAutoCorrExceptWord( std::unique_ptr<SwAutoCorrExceptWord> pNew )
815{
816 mpACEWord = std::move(pNew);
817}
818
820{
821 mpACEWord.reset();
822}
823
824void SwDoc::CountWords( const SwPaM& rPaM, SwDocStat& rStat )
825{
826 // This is a modified version of SwDoc::TransliterateText
827 auto [pStt, pEnd] = rPaM.StartEnd(); // SwPosition*
828
829 const SwNodeOffset nSttNd = pStt->GetNodeIndex();
830 const SwNodeOffset nEndNd = pEnd->GetNodeIndex();
831
832 const sal_Int32 nSttCnt = pStt->GetContentIndex();
833 const sal_Int32 nEndCnt = pEnd->GetContentIndex();
834
835 const SwTextNode* pTNd = pStt->GetNode().GetTextNode();
836 if( pStt == pEnd && pTNd ) // no region ?
837 {
838 // do nothing
839 return;
840 }
841
842 if( nSttNd != nEndNd )
843 {
844 SwNodeIndex aIdx( pStt->GetNode() );
845 if( nSttCnt )
846 {
847 ++aIdx;
848 if( pTNd )
849 pTNd->CountWords( rStat, nSttCnt, pTNd->GetText().getLength() );
850 }
851
852 for( ; aIdx.GetIndex() < nEndNd; ++aIdx )
853 if( nullptr != ( pTNd = aIdx.GetNode().GetTextNode() ))
854 pTNd->CountWords( rStat, 0, pTNd->GetText().getLength() );
855
856 if( nEndCnt && nullptr != ( pTNd = pEnd->GetNode().GetTextNode() ))
857 pTNd->CountWords( rStat, 0, nEndCnt );
858 }
859 else if( pTNd && nSttCnt < nEndCnt )
860 pTNd->CountWords( rStat, nSttCnt, nEndCnt );
861}
862
863
864/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
ModelPosition ConvertToModelPosition(sal_Int32 nViewPos) const
Converts a view position into a model position.
const OUString & getViewText() const
sal_Int32 ConvertToViewPosition(sal_Int32 nModelPos) const
Converts a model position into a view position.
std::optional< SwNodeIndex > moSaveIndex
Definition: mvsave.hxx:191
SaveRedlEndPosForRestore(const SwNode &rInsIdx, sal_Int32 nContent)
Definition: docedt.cxx:267
std::vector< SwPosition * > mvSavArr
Definition: mvsave.hxx:190
sal_uInt16 Count() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:58
Marks a character position inside a document model content node (SwContentNode)
bool HasSwAttrSet() const
Definition: node.hxx:494
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1230
bool CanJoinNext(SwNodeIndex *pIdx=nullptr) const
Is it possible to join two nodes? In pIdx the second position can be returned.
Definition: node.cxx:1859
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:493
@ START_SENT
Definition: swcrsr.hxx:157
bool GoSentence(SentenceMoveType eMoveType, SwRootFrame const *pLayout=nullptr)
Definition: swcrsr.cxx:1547
Definition: doc.hxx:194
void CorrRel(const SwNode &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:306
static void CountWords(const SwPaM &rPaM, SwDocStat &rStat)
Definition: docedt.cxx:824
std::unique_ptr< SwAutoCorrExceptWord > mpACEWord
For the automated takeover of auto-corrected words that are "re-corrected".
Definition: doc.hxx:269
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:150
void SetAutoCorrExceptWord(std::unique_ptr< SwAutoCorrExceptWord > pNew)
Definition: docedt.cxx:814
SwNodes & GetNodes()
Definition: doc.hxx:417
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:341
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:411
css::uno::Reference< css::linguistic2::XHyphenatedWord > Hyphenate(SwPaM *pPam, const Point &rCursorPos, sal_uInt16 *pPageCnt, sal_uInt16 *pPageSt)
Definition: docedt.cxx:796
void DeleteAutoCorrExceptWord()
Definition: docedt.cxx:819
css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const
Definition: docnew.cxx:123
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1326
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:752
SwDocShell * GetDocShell()
Definition: doc.hxx:1359
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:516
FlyAnchors.
Definition: fmtanchr.hxx:37
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1586
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:74
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:32
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:88
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
Style of a layout element.
Definition: frmfmt.hxx:62
virtual void DelFrames()
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: atrfrm.cxx:2726
virtual void MakeFrames()
Creates the views.
Definition: atrfrm.cxx:2737
Specific frame formats (frames, DrawObjects).
const_iterator find(const value_type &x) const
Definition: docfmt.cxx:2069
SwFrameFormatsBase::size_type size_type
bool erase(const value_type &x)
Definition: docfmt.cxx:2119
size_t size() const
const_iterator begin() const
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2111
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1639
sal_uInt16 GetPhyPageNum() const
Definition: trvlfrm.cxx:1706
void AddChangeFlyAnchor(SwFrameFormat &rFormat)
Definition: rolbck.cxx:1143
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset)
Definition: ndindex.hxx:291
SwNode & GetNode() const
Definition: ndindex.hxx:136
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:171
SwNodeIndex aStart
Definition: ndindex.hxx:149
SwNodeIndex aEnd
Definition: ndindex.hxx:150
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:897
SwNodeOffset GetIndex() const
Definition: node.hxx:312
SwDoc & GetDoc()
Definition: node.hxx:233
Merge
sw_redlinehide: redline node merge state
Definition: node.hxx:111
bool IsTextNode() const
Definition: node.hxx:685
Merge GetRedlineMergeFlag() const
Definition: node.hxx:116
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:726
bool IsCreateFrameWhenHidingRedlines() const
Definition: node.hxx:112
SwContentNode * GetContentNode()
Definition: node.hxx:664
SwNodeType GetNodeType() const
Definition: node.hxx:166
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:731
void ForEach(FnForEach_SwNodes fnForEach, void *pArgs=nullptr)
Definition: ndarr.hxx:143
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
Definition: nodes.cxx:1065
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
const SwPosition * GetMark() const
Definition: pam.hxx:263
void Exchange()
Definition: pam.cxx:656
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
Definition: pam.hxx:277
const SwPosition * End() const
Definition: pam.hxx:271
SwDoc & GetDoc() const
Definition: pam.hxx:299
SwPosition & GetBound(bool bOne=true)
Definition: pam.hxx:301
const SwPosition * GetPoint() const
Definition: pam.hxx:261
const SwPosition * Start() const
Definition: pam.hxx:266
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:259
bool empty() const
Definition: docary.hxx:266
vector_type::size_type size_type
Definition: docary.hxx:222
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:165
bool IsHiddenNow() const
Hidden.
Definition: txtfrm.cxx:1360
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:111
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:290
virtual SwContentNode * JoinNext() override
Definition: ndtxt.cxx:1001
bool IsGrammarCheckDirty() const
Definition: txtedt.cxx:2266
void CutText(SwTextNode *const pDest, const SwContentIndex &rStart, const sal_Int32 nLen)
Definition: ndtxt.cxx:2482
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
Definition: thints.cxx:2532
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:5032
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:1997
bool Convert(SwConversionArgs &)
Definition: txtedt.cxx:1082
SwGrammarMarkUp * GetGrammarCheck()
Definition: txtedt.cxx:2198
bool Spell(SwSpellArgs *)
Definition: txtedt.cxx:923
const OUString & GetText() const
Definition: ndtxt.hxx:242
bool Hyphenate(SwInterHyphInfo &rHyphInf)
Interactive hyphenation: we find TextFrame and call its CalcHyph.
Definition: txtedt.cxx:1600
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
Definition: ndtxt.cxx:5259
bool LookForEntry(sal_Int32 nBegin, sal_Int32 nEnd)
Definition: wrong.cxx:614
static std::shared_ptr< ContentIdxStore > Create()
bool sw_JoinText(SwPaM &rPam, bool bJoinPrev)
Definition: docedt.cxx:357
void sw_GetJoinFlags(SwPaM &rPam, bool &rJoinText, bool &rJoinPrev)
Definition: docedt.cxx:326
static bool lcl_HyphenateNode(SwNode *pNd, void *pArgs)
Definition: docedt.cxx:757
void SaveFlyInRange(const SwNodeRange &rRg, SaveFlyArr &rArr)
Definition: docedt.cxx:106
void DelFlyInRange(SwNode &rMkNd, SwNode &rPtNd, std::optional< sal_Int32 > oMkContentIdx, std::optional< sal_Int32 > oPtContentIdx)
Delete and move all Flys at the paragraph, that are within the selection.
Definition: docedt.cxx:208
static std::vector< sal_uInt16 > lcl_RangesToVector(const WhichRangesContainer &pRanges)
Convert list of ranges of whichIds to a corresponding list of whichIds.
Definition: docedt.cxx:313
void RestFlyInRange(SaveFlyArr &rArr, const SwPosition &rStartPos, const SwNode *pInsertPos, bool const isForceToStartPos)
Definition: docedt.cxx:53
static void lcl_syncGrammarError(SwTextNode &rTextNode, linguistic2::ProofreadingResult &rResult, const ModelToViewHelper &rConversionMap)
Definition: docedt.cxx:491
constexpr OUStringLiteral IsHidden(u"IsHidden")
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
WhichRangesContainer const aCharFormatSetRange(svl::Items< RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1 >)
WhichRangesContainer const aBreakSetRange(svl::Items< RES_PAGEDESC, RES_BREAK >)
sal_Int64 n
void SetProgressState(tools::Long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:82
std::deque< SaveFly > SaveFlyArr
Definition: mvsave.hxx:117
def point()
int i
void CheckResetRedlineMergeFlag(SwTextNode &rNode, Recreate eRecreateMerged)
if first node is First, its frames may need to be moved, never deleted.
Definition: ndtxt.cxx:887
void CheckAnchoredFlyConsistency(SwDoc const &rDoc)
Definition: atrfrm.cxx:3670
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 ...
Definition: ndtxt.cxx:847
long Long
@ Section
SwSectionNode is derived from SwStartNode.
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
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:1019
data structure to temporarily hold fly anchor positions relative to some location.
Definition: mvsave.hxx:103
void SetEnd(SwPosition &rEnd)
Definition: splargs.hxx:52
void SetStart(SwPosition &rStart)
Definition: splargs.hxx:47
OUString aConvText
Definition: splargs.hxx:61
Marks a position in the document model.
Definition: pam.hxx:37
void Adjust(SwNodeOffset nDelta)
Adjust node position, and resets content position to zero.
Definition: pam.cxx:256
SwNode & GetNode() const
Definition: pam.hxx:80
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:230
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:266
const SwContentNode * GetContentNode() const
Definition: pam.hxx:83
SwNodeOffset GetNodeIndex() const
Definition: pam.hxx:77
sal_Int32 GetContentIndex() const
Definition: pam.hxx:84
bool hasValue()
#define SAL_MAX_INT32
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:1646
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:1605
std::pair< sal_uInt16, sal_uInt16 > WhichPair