30#include <osl/diagnose.h>
88typedef std::vector<SwTextAttr*>
SwpHts;
110#define CHECK_SWPHINTS(pNd) { if( pNd->GetpSwpHints() && \
111 !pNd->GetDoc().IsInReading() ) \
112 pNd->GetpSwpHints()->Check(true); }
113#define CHECK_SWPHINTS_IF_FRM(pNd) { if( pNd->GetpSwpHints() && \
114 !pNd->GetDoc().IsInReading() ) \
115 pNd->GetpSwpHints()->Check(getLayoutFrame(nullptr, nullptr, nullptr) != nullptr); }
117#define CHECK_SWPHINTS(pNd)
118#define CHECK_SWPHINTS_IF_FRM(pNd)
124 OSL_ENSURE( pColl,
"Collection pointer is 0." );
133 !
GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell() ||
148 static_cast<SwTableNode*
>(pNd)->MakeFramesForAdjacentContentNode(aIdx);
161 static_cast<SwSectionNode*
>(pNd)->MakeFramesForAdjacentContentNode(aIdx);
167 static_cast<SwContentNode*
>(pNd)->MakeFramesForAdjacentContentNode(*pNode);
194 if( &rWhere == &aTmp.
GetNode() )
205 m_bContainsHiddenChars(false),
206 m_bHiddenCharsHidePara(false),
207 m_bRecalcHiddenCharFlags(false),
208 m_bLastOutlineState( false ),
209 m_bNotifiable( true ),
210 mbEmptyListStyleSetDueToSetOutlineLevelAttr( false ),
211 mbInSetOrResetAttr( false ),
248 std::unique_ptr<SwpHints> pTmpHints(std::move(
m_pSwpHints));
250 for(
size_t j = pTmpHints->Count(); j; )
259#if OSL_DEBUG_LEVEL > 0 && !defined NDEBUG
261 assert(!
GetNodes().GetOutLineNds().Seek_Entry(
this, &
foo));
268#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
293 return m_Text.getLength();
308 for(
size_t j = pSwpHints->
Count(); j; )
320 OSL_ENSURE( pAttr->
GetStartNode(),
"FootnoteAtr without StartNode." );
325 GetNodes().GoNextSection( &aIdx,
true,
false );
334 "lcl_ChangeFootnoteRef: Layout double?" );
336 if( pFootnote && pFootnote->
GetAttr() == pAttr )
341 pFirstFootnoteOfNode = pFootnote;
344 pFootnote->
SetRef( pFrame );
346 static_cast<SwTextFrame*
>(pFrame)->SetFootnote(
true );
349#if OSL_DEBUG_LEVEL > 0
350 while(
nullptr != (pContent = aIter.
Next()) )
353 OSL_ENSURE( !pDbgFootnote || pDbgFootnote->
GetRef() == pFrame,
354 "lcl_ChangeFootnoteRef: Who's that guy?" );
361 if ( pFirstFootnoteOfNode )
404 std::vector<SwAnchoredObject*> objs;
405 objs.reserve(pObjs->size());
408 objs.push_back(pObj);
419 assert(!pFrame->GetDrawObjs() || !pObjs->Contains(*pObj));
437 const sal_Int32 nTextLen =
m_Text.getLength();
443 if (nSplitPos != 0) {
444 pNode->RegisterAsCopyOf(*
this,
true);
445 if (nSplitPos == nTextLen)
447 RemoveMetadataReference();
462 if ( HasWriterListeners() && !
m_Text.isEmpty() && (nTextLen / 2) < nSplitPos )
478 CutText( pNode, aIdx, nSplitPos );
530 const sal_Int32*
const pEnd = pHt->
GetEnd();
531 if (pEnd && pHt->
GetStart() == *pEnd )
543 if (pContentIndexRestore)
552 std::vector<SwTextFrame*> frames;
556 if (pFrame->getRootFrame()->HasMergedParas())
560 frames.push_back(pFrame);
564 pFrame->RegisterToNode( *pNode );
565 if (!pFrame->IsFollow() && pFrame->GetOffset())
580 if (pContentIndexRestore)
603 CutText( pNode, aIdx, nSplitPos );
611 const sal_Int32*
const pEnd = pHt->
GetEnd();
624 pNode->
SetWrong( pList->SplitList( nSplitPos ) );
643 if (pContentIndexRestore)
648 std::vector<SwTextFrame*> frames;
652 frames.push_back(pFrame);
653 if (pFrame->getRootFrame()->HasMergedParas())
658 bool bNonMerged(
false);
659 bool bRecreateThis(
false);
667 if (pFrame->GetMergedPara())
674 pFrame->RegisterToNode(*pNode);
682 if (!pFrame->GetMergedPara() ||
683 !pFrame->GetMergedPara()->listener.IsListeningTo(
this))
688 bRecreateThis =
true;
696 assert(!(bNonMerged && bRecreateThis));
697 if (!frames.empty() && bNonMerged)
703 else if (bRecreateThis)
705 assert(pNode->HasWriterListeners());
710 if (pContentIndexRestore)
734 const sal_Int32* pEnd = pHt->
GetEnd();
735 if (!pEnd || pHt->
GetStart() != *pEnd)
773 switch (eOldMergeFlag)
816 OSL_ENSURE(
m_pSwpHints,
"MoveTextAttr_To_AttrSet without SwpHints?" );
824 const sal_Int32* pHtEndIdx = pHt->
GetEnd();
850 std::vector<SwTextFrame*> frames;
854 if (pFrame->getRootFrame()->HasMergedParas())
856 frames.push_back(pFrame);
860 auto frames2(frames);
864 if (pFrame->getRootFrame()->HasMergedParas())
866 auto const it(std::find(frames2.begin(), frames2.end(), pFrame));
867 assert(it != frames2.end());
871 assert(frames2.empty());
875 pFrame->RegisterToNode(rNode,
true);
913 std::vector<SwTextFrame*> frames;
917 if (pFrame->getRootFrame()->HasMergedParas())
919 frames.push_back(pFrame);
925 SwTextNode & rFirstNode(pFrame->GetMergedPara()
926 ? *pFrame->GetMergedPara()->pFirstNode
930 *pFrame, rFirstNode,
eMode));
933 if (pFrame->GetMergedPara())
935 assert(pFrame->GetMergedPara()->listener.IsListeningTo(&rNode));
936 assert(rNode.
GetIndex() <= pFrame->GetMergedPara()->pLastNode->GetIndex());
951 if (
auto const pMergedPara = pFrame->GetMergedPara())
953 if (pMergedPara->pFirstNode == pMergedPara->pLastNode)
955 assert(pMergedPara->pFirstNode == &rNode);
960 else if (pFrame->getRootFrame()->HasMergedParas())
1012 sal_Int32 nOldLen =
m_Text.getLength();
1015 JoinMetadatable(*pTextNode, !
Len(), !pTextNode->
Len());
1020 pList->JoinList( pTextNode->
GetWrong(), nOldLen );
1028 pList->Move( 0, nOldLen );
1044 pList3->MoveGrammar( 0, nOldLen );
1052 pList2->JoinList( pTextNode->
GetSmartTags(), nOldLen );
1060 pList2->Move( 0, nOldLen );
1069 if( !pContentStore->Empty())
1070 pContentStore->Restore( rDoc,
GetIndex(), nOldLen );
1072 if( pTextNode->HasAnyIndex() )
1087 if (pFrame->GetMergedPara())
1113 OSL_FAIL(
"No TextNode." );
1129 const sal_Int32 nLen = pTextNode->
Len();
1131 std::unique_ptr<SwWrongList> pList = pTextNode->
ReleaseWrong();
1143 pList->Move( 0, nLen );
1160 pList3->MoveGrammar( 0, nLen );
1177 pList2->Move( 0, nLen );
1186 if( !pContentStore->Empty() )
1187 pContentStore->Restore( rDoc,
GetIndex() );
1189 if( pTextNode->HasAnyIndex() )
1212 OSL_FAIL(
"No TextNode." );
1219 OSL_ENSURE( !
mpAttrSet,
"AttrSet is set after all" );
1228 if ( pFormatColl != pAnyFormatColl )
1231 aNewAttrSet.
Put( aAnyFormatColl );
1232 aNewAttrSet.
Put( aFormatColl );
1253 const sal_Int32 nChangeLen,
1254 UpdateMode
const eMode)
1259 std::unique_ptr<SwpHts> pCollector;
1260 const sal_Int32 nChangePos = rPos.
GetIndex();
1264 if (
eMode & UpdateMode::Negative)
1266 std::vector<SwTextInputField*> aTextInputFields;
1268 const sal_Int32 nChangeEnd = nChangePos + nChangeLen;
1271 bool bTextAttrChanged =
false;
1272 bool bStartOfTextAttrChanged =
false;
1274 if ( pHint->
GetStart() > nChangePos )
1276 if ( pHint->
GetStart() > nChangeEnd )
1284 bStartOfTextAttrChanged =
true;
1287 const sal_Int32 *
const pEnd = pHint->
GetEnd();
1288 if (pEnd && *pEnd > nChangePos )
1290 if( *pEnd > nChangeEnd )
1292 pHint->
SetEnd(*pEnd - nChangeLen);
1296 pHint->
SetEnd(nChangePos);
1298 bTextAttrChanged = !bStartOfTextAttrChanged;
1301 if ( bTextAttrChanged
1305 if ( pTextInputField )
1306 aTextInputFields.push_back(pTextInputField);
1321 bool bNoExp =
false;
1322 bool bResort =
false;
1323 bool bMergePortionsNeeded =
false;
1325 std::vector<SwTextInputField*> aTextInputFields;
1327 bool aDontExp[ coArrSz ] = {};
1331 bool bTextAttrChanged =
false;
1333 const sal_Int32 *
const pEnd = pHint->
GetEnd();
1334 if ( pHint->
GetStart() >= nChangePos )
1339 pHint->
SetEnd(*pEnd + nChangeLen);
1342 else if ( pEnd && (*pEnd >= nChangePos) )
1346 pHint->
SetEnd(*pEnd + nChangeLen);
1347 bTextAttrChanged =
true;
1351 const sal_uInt16 nWhich = pHint->
Which();
1353 OSL_ENSURE(!
isCHRATR(nWhich),
"Update: char attr hint?");
1359 if( aDontExp[ nWhPos ] )
1369 bMergePortionsNeeded =
true;
1378 aDontExp[ nWhPos ] =
true;
1384 pCollector.reset(
new SwpHts );
1386 auto it = std::find_if(pCollector->begin(), pCollector->end(),
1387 [nWhich](
const SwTextAttr *pTmp) { return nWhich == pTmp->Which(); });
1388 if (it != pCollector->end())
1391 pCollector->erase( it );
1396 pHint->
GetAttr(), nChangePos, nChangePos + nChangeLen);
1397 pCollector->push_back( pTmp );
1401 pHint->
SetEnd(*pEnd + nChangeLen);
1402 bTextAttrChanged =
true;
1407 if ( bTextAttrChanged
1411 if ( pTextInputField )
1412 aTextInputFields.push_back(pTextInputField);
1423 if (bMergePortionsNeeded)
1434 bool bSortMarks =
false;
1435 SwContentNodeTmp aTmpIdxReg;
1436 if (!(
eMode & UpdateMode::Negative) && !(
eMode & UpdateMode::Delete))
1438 std::vector<SwRangeRedline*> vMyRedlines;
1441 while (pContentNodeIndex)
1445 vMyRedlines.push_back(pRedl);
1446 pContentNodeIndex = pContentNodeIndex->
GetNext();
1448 std::sort(vMyRedlines.begin(), vMyRedlines.end());
1449 vMyRedlines.erase( std::unique( vMyRedlines.begin(), vMyRedlines.end() ), vMyRedlines.end() );
1452 if ( pRedl->HasMark() )
1455 if ( *
this == pEnd->
GetNode() &&
1456 *pRedl->GetPoint() != *pRedl->GetMark() )
1465 else if (
this == &pRedl->GetPoint()->GetNode() )
1473 bool const isOneUsed(&pRedl->GetBound() == pRedl->GetPoint());
1474 assert(!pRedl->GetBound(!isOneUsed).GetNode().IsTextNode());
1475 assert(!pRedl->GetBound(!isOneUsed).GetContentNode()); (void)isOneUsed;
1482 if (!(
eMode & UpdateMode::Replace))
1484 bool bAtLeastOneBookmarkMoved =
false;
1485 bool bAtLeastOneExpandedBookmarkAtInsertionPosition =
false;
1489 for (
const SwContentIndex* pIndex = GetFirstIndex(); pIndex; pIndex = next )
1496 if (!aSeenMarks.
insert(pMark).second)
1500 if( *
this == pEnd->
GetNode() &&
1503 if (&rEndIdx == next)
1510 bAtLeastOneBookmarkMoved =
true;
1512 else if ( !bAtLeastOneExpandedBookmarkAtInsertionPosition )
1517 if (
this == &pStart->
GetNode()
1520 bAtLeastOneExpandedBookmarkAtInsertionPosition =
true;
1526 bSortMarks = bAtLeastOneBookmarkMoved && bAtLeastOneExpandedBookmarkAtInsertionPosition;
1533 for (
size_t i = 0;
i != rFlys.size(); ++
i)
1538 if (rAnchor.
GetAnchorId() == RndStdIds::FLY_AT_CHAR && pAnchorNode)
1554 if (pDocShell->GetWrtShell())
1558 auto pWrtShell =
dynamic_cast<SwWrtShell*
>(&rShell);
1559 if (!pWrtShell || pWrtShell == pDocShell->GetWrtShell())
1578 SwContentIndexReg::Update(rPos, nChangeLen,
eMode);
1582 const size_t nCount = pCollector->size();
1585 m_pSwpHints->TryInsertHint( (*pCollector)[
i ], *
this );
1589 aTmpIdxReg.MoveTo( *
this );
1607 pSortedObjs = pPage->GetSortedObjs();
1618 pEditShell->ValidateParagraphSignatures(
this,
true);
1636 if (nChangePos <= pRedln->
Start()->GetContentIndex())
1657 if (
MAXLEVEL != nNewLevel && -1 != nNewLevel )
1682 bool bFormatToTextAttributes )
1684 if (bFormatToTextAttributes && nIdx ==
m_Text.getLength())
1697 const sal_Int32 *pEnd = pTmp->
GetEnd();
1700 assert( *pEnd <= nIdx );
1717 return ((nHintStart <=
nIndex) && (
nIndex < nHintEnd));
1721 return ((nHintStart <
nIndex) && (
nIndex <= nHintEnd));
1730 std::vector<SwTextAttr *> *
const pVector,
1733 sal_Int32
const nIndex, sal_uInt16
const nWhich,
1739 size_t const nSize = pSwpHints->
Count();
1740 sal_Int32 nPreviousIndex(0);
1741 bool (*pMatchFunc)(sal_Int32, sal_Int32, sal_Int32)=
nullptr;
1750 default: assert(
false);
1756 if (pHint->
Which() != nWhich)
1759 sal_Int32
const nHintStart = pHint->
GetStart();
1763 sal_Int32
const*
const pEndIdx = pHint->
GetEnd();
1768 bool const bContained( pEndIdx
1769 ? (*pMatchFunc)(
nIndex, nHintStart, *pEndIdx)
1770 : (nHintStart ==
nIndex) );
1775 if (nPreviousIndex < nHintStart)
1778 nPreviousIndex = nHintStart;
1780 pVector->push_back(pHint);
1784 *ppTextAttr = pHint;
1794std::vector<SwTextAttr *>
1798 std::vector<SwTextAttr *> ret;
1826 if ( pTextInputField ==
nullptr && rTextAttr.
End() != nullptr )
1831 return pTextInputField;
1850 const sal_Int32 nIndex,
1854 if ( pTextField ==
nullptr )
1858 if ( pTextField ==
nullptr )
1872 if( !rName.empty() )
1874 const size_t nArrLen = pCharFormats->
size();
1875 for(
size_t i = 1;
i < nArrLen;
i++ )
1878 if( pFormat->
GetName()==rName )
1886 const sal_uInt16 nWhich,
1889 SwDoc *
const pOtherDoc,
1892 assert(nWhich == pHt->
Which());
1906 if( pOtherDoc !=
nullptr )
1908 static_txtattr_cast<const SwTextField*>(pHt)->CopyTextField(
1909 static_txtattr_cast<SwTextField*>(pNewHt));
1933 if( pOtherDoc !=
nullptr )
1935 static_txtattr_cast<const SwTextField*>(pHt)->CopyTextField(
1936 static_txtattr_cast<SwTextField*>(pNewHt));
1946 static_txtattr_cast<SwTextTOXMark*>(pNewHt)->CopyTOXMark(*pOtherDoc);
1985 SwTextINetFormat *
const pINetHt = static_txtattr_cast<SwTextINetFormat*>(pNewHt);
1997 OSL_ENSURE( pNewHt,
"copying Meta should not fail!" );
2000 "missing CH_TXTATR?");
2010 const sal_Int32 nOldPos )
2015 &pDest->
GetDoc() :
nullptr;
2020 sal_Int32
const nAttrStartIdx = pHt->
GetStart();
2021 if ( nTextStartIdx < nAttrStartIdx )
2024 const sal_Int32 *
const pEndIdx = pHt->
GetEnd();
2027 sal_uInt16
const nWhich = pHt->
Which();
2029 && ( *pEndIdx > nTextStartIdx
2030 || (*pEndIdx == nTextStartIdx
2031 && nAttrStartIdx == nTextStartIdx)))
2045 ?
GetDoc().IsCopyIsMove()
2071 const sal_Int32 nLen,
2072 const bool bForceCopyOfAllAttrs )
2075 CopyText( pDest, aIdx, rStart, nLen, bForceCopyOfAllAttrs );
2082 const bool bForceCopyOfAllAttrs )
2084 CopyText( pDest, rDestStart, rStart.
nContent, nLen, bForceCopyOfAllAttrs );
2091 const bool bForceCopyOfAllAttrs )
2097 sal_Int32 nTextStartIdx = rStart.
GetIndex();
2098 sal_Int32 nDestStart = rDestStart.
GetIndex();
2111 CopyAttr( pDest, nTextStartIdx, nDestStart );
2117 if ( !bForceCopyOfAllAttrs &&
2120 nLen != pDest->
GetText().getLength()))
2128 if( aCharSet.Count() )
2130 pDest->
SetAttr( aCharSet, nDestStart, nDestStart );
2142 const sal_Int32 oldLen = pDest->
m_Text.getLength();
2149 nLen = pDest->
m_Text.getLength() - oldLen;
2159 if ( !bForceCopyOfAllAttrs &&
2162 nLen != pDest->
GetText().getLength()))
2170 if( aCharSet.Count() )
2172 pDest->
SetAttr( aCharSet, nDestStart, nDestStart + nLen );
2181 bool const bUndoNodes = !pOtherDoc
2187 const sal_Int32 nEnd = nTextStartIdx + nLen;
2201 std::vector<std::pair<sal_Int32, sal_Int32>> metaFieldRanges;
2202 sal_Int32 nDeletedDummyChars(0);
2203 for (
size_t n = 0;
n < nSize; ++
n)
2207 const sal_Int32 nAttrStartIdx = pHt->
GetStart();
2208 if ( nAttrStartIdx >= nEnd )
2211 const sal_Int32 *
const pEndIdx = pHt->
GetEnd();
2212 const sal_uInt16 nWhich = pHt->
Which();
2236 assert(pEndIdx !=
nullptr &&
2237 "<SwTextNode::CopyText(..)> - RES_TXTATR_INPUTFIELD without EndIndex!" );
2238 if ( nAttrStartIdx < nTextStartIdx
2239 || ( pEndIdx !=
nullptr
2240 && *pEndIdx > nEnd ) )
2249 metaFieldRanges.emplace_back(nAttrStartIdx, pEndIdx ? *pEndIdx : nEnd);
2253 sal_Int32 nAttrStt = 0;
2254 sal_Int32 nAttrEnd = 0;
2256 if( nAttrStartIdx < nTextStartIdx )
2260 if ( pEndIdx && (*pEndIdx > nTextStartIdx) && !pHt->
HasDummyChar() )
2263 nAttrStt = nDestStart;
2264 nAttrEnd = (*pEndIdx > nEnd)
2266 : nDestStart + (*pEndIdx) - nTextStartIdx;
2276 nAttrStt = nDestStart + ( nAttrStartIdx - nTextStartIdx );
2279 nAttrEnd = *pEndIdx > nEnd
2281 : nDestStart + ( *pEndIdx - nTextStartIdx );
2285 nAttrEnd = nAttrStt;
2298 aArr.push_back( pNewHt );
2304 nAttrStt - nDeletedDummyChars,
2305 nAttrEnd - nDeletedDummyChars,
2316 ++nDeletedDummyChars;
2322 aRefMrkArr.push_back( pNewHt );
2328 if (!metaFieldRanges.empty())
2331 std::reverse(metaFieldRanges.begin(), metaFieldRanges.end());
2332 for (
const auto& pair : metaFieldRanges)
2335 pDest->
EraseText(aIdx, pair.second - pair.first);
2349 if( pNewHt->GetEnd() )
2376 assert(rIdx <=
m_Text.getLength());
2378 const sal_Int32 aPos = rIdx.
GetIndex();
2379 sal_Int32 nLen =
m_Text.getLength() - aPos;
2380 sal_Int32
const nOverflow(rStr.getLength() -
GetSpaceLeft());
2382 "SwTextNode::InsertText: node text with insertion > capacity.");
2383 OUString
const sInserted(
2384 (nOverflow > 0) ? rStr.copy(0, rStr.getLength() - nOverflow) : rStr);
2385 if (sInserted.isEmpty())
2389 if (aPos == 0 &&
m_Text.isEmpty())
2394 nLen =
m_Text.getLength() - aPos - nLen;
2403 Update(rIdx, nLen, UpdateMode::Default);
2410 if ( HasWriterListeners() )
2413 CallSwClientNotify(aInsHint);
2419 bool const bHadHints(!
m_pSwpHints->CanBeDeleted());
2420 bool bMergePortionsNeeded(
false);
2422 rIdx >=
m_pSwpHints->GetWithoutResorting(
i)->GetStart(); ++
i )
2425 const sal_Int32 *
const pEndIdx = pHt->
GetEnd();
2429 if( rIdx == *pEndIdx )
2439 pHt->
SetEnd(*pEndIdx - nLen);
2446 bMergePortionsNeeded =
true;
2480 if (bMergePortionsNeeded)
2485 "SwTextNode::InsertText: unexpected loss of hints");
2501 CutImpl( pDest, aDestStt, rStart, nLen,
false );
2505 const SwContentIndex & rStart, sal_Int32 nLen,
const bool bUpdate )
2511 assert(pDest !=
this);
2523 sal_Int32 nTextStartIdx = rStart.
GetIndex();
2524 sal_Int32 nDestStart = rDestStart.
GetIndex();
2525 const sal_Int32 nInitSize = pDest->
m_Text.getLength();
2533 m_Text.subView(nTextStartIdx, nLen));
2534 OUString
const newText =
m_Text.replaceAt(nTextStartIdx, nLen,
u"");
2535 nLen = pDest->
m_Text.getLength() - nInitSize;
2542 pDest->
Update(rDestStart, nLen, UpdateMode::Default);
2547 const sal_Int32 nEnd = rStart.
GetIndex() + nLen;
2548 bool const bUndoNodes =
2559 hasSwAttrSet =
false;
2582 hasSwAttrSet = (rParentItem != *pItem);
2596 if( nInitSize || hasSwAttrSet ||
2597 nLen != pDest->
GetText().getLength())
2605 if( aCharSet.Count() )
2606 pDest->
SetAttr( aCharSet, nDestStart, nDestStart + nLen );
2616 if (aCharSet.Count())
2617 pDest->
SetAttr(aCharSet, nDestStart, nDestStart + nLen);
2626 const sw::MoveText aMoveHint(pDest, nDestStart, nTextStartIdx, nLen);
2627 CallSwClientNotify(aMoveHint);
2634 bool bMergePortionsNeeded(
false);
2635 size_t nAttrCnt = 0;
2639 const sal_Int32 nAttrStartIdx = pHt->
GetStart();
2640 if ( nAttrStartIdx >= nEnd )
2642 const sal_Int32 *
const pEndIdx = pHt->
GetEnd();
2643 const sal_uInt16 nWhich = pHt->
Which();
2647 if(nAttrStartIdx < nTextStartIdx)
2651 || bUndoNodes ) && pEndIdx && *pEndIdx > nTextStartIdx)
2659 : *pEndIdx - nTextStartIdx ) );
2665 if (!pEndIdx || *pEndIdx < nEnd ||
2670 if (
GetDoc().GetDocShell())
2679 bMergePortionsNeeded =
true;
2681 pHt->
SetStart(nDestStart + (nAttrStartIdx - nTextStartIdx));
2684 pHt->
SetEnd( nDestStart + (
2687 : *pEndIdx - nTextStartIdx ) );
2692 if (
GetDoc().GetDocShell())
2702 nDestStart + (nAttrStartIdx - nTextStartIdx),
2703 nDestStart + (*pEndIdx > nEnd
2705 : *pEndIdx - nTextStartIdx));
2710 const bool bSuccess( pDest->
InsertHint( pNewHt,
2728 while (nAttrCnt < m_pSwpHints->
Count())
2733 const sal_Int32 *
const pEndIdx = pHt->
GetEnd();
2734 if (pEndIdx && *pEndIdx == nEnd)
2736 aArr.push_back( pHt );
2744 Update(rStart, nLen, UpdateMode::Negative|UpdateMode::Delete);
2748 pHt->SetStart( rStart.
GetIndex() );
2755 Update(rStart, nLen, UpdateMode::Negative|UpdateMode::Delete);
2761 if (bMergePortionsNeeded)
2781 assert(rIdx <=
m_Text.getLength());
2783 const sal_Int32 nStartIdx = rIdx.
GetIndex();
2786 const sal_Int32 nEndIdx = nStartIdx + nCnt;
2787 if (nEndIdx <=
m_Text.getLength())
2797 const sal_Int32 nHintStart = pHt->
GetStart();
2799 if ( nHintStart < nStartIdx )
2802 if ( nHintStart > nEndIdx )
2805 const sal_Int32* pHtEndIdx = pHt->
GetEnd();
2806 const sal_uInt16 nWhich = pHt->
Which();
2812 if (
isTXTATR(nWhich) && (nHintStart < nEndIdx))
2821 assert(!( (nHintStart < nEndIdx) && (*pHtEndIdx > nEndIdx)
2824 || ((nHintStart == nStartIdx) && (nHintStart + 1 == nEndIdx)));
2834 if ( (*pHtEndIdx < nEndIdx)
2835 || ( (*pHtEndIdx == nEndIdx) &&
2841 || ( (nHintStart < nEndIdx) &&
2851 OSL_ENSURE(rIdx.
GetIndex() == nStartIdx,
"huh? start index has changed?");
2855 Update(rIdx, nCnt, UpdateMode::Negative);
2860 CallSwClientNotify(aHint);
2863 CallSwClientNotify(aHint);
2866 OSL_ENSURE(rIdx.
GetIndex() == nStartIdx,
"huh? start index has changed?");
2880 bool bChanged =
false;
2881 sal_Int32 nMin =
m_Text.getLength();
2883 const bool bAll = nMin != 0;
2890 const sal_Int32 *
const pEndIdx = pHt->
GetEnd();
2896 nMax = std::max( nMax, *pHt->
GetEnd() );
2926 bool bNoNumRule =
false;
2929 OUString sNumRuleName =
2931 if (!sNumRuleName.isEmpty())
2941 if ( pRet && pRet ==
GetDoc().GetOutlineNumRule() &&
2943 SfxItemState::SET !=
2950 if ( rDirectItem.
GetValue().isEmpty() )
2997 bool bResult =
false;
3013 std::optional<SwAttrSet> oNewAttrSet;
3015 bool bClearHardSetNumRuleWhenFormatCollChanges(
false );
3022 pTmpSet = &*oNewAttrSet;
3025 bool bRemoveFromCache =
false;
3026 std::vector<sal_uInt16> aClearWhichIds;
3028 bRemoveFromCache = ( 0 != oNewAttrSet->ClearItem(
RES_PAGEDESC ) );
3038 bRemoveFromCache =
true;
3043 oNewAttrSet->ClearItem(
RES_KEEP );
3045 aClearWhichIds.push_back(
RES_KEEP );
3046 bRemoveFromCache =
true;
3054 bRemoveFromCache =
true;
3069 bClearHardSetNumRuleWhenFormatCollChanges =
true;
3071 bRemoveFromCache =
true;
3075 if ( !aClearWhichIds.empty() )
3078 if( !bNext && bRemoveFromCache )
3089 oNewAttrSet.reset();
3108 if( bNext || !bChgFollow )
3114 if (pNextColl != pColl)
3117 if ( bClearHardSetNumRuleWhenFormatCollChanges )
3150 if( HasWriterListeners() )
3156 const sal_Int32 nIndex,
3157 const sal_uInt16 nWhich )
const
3165 const sal_Int32 nStartPos = pHint->
GetStart();
3166 if (
nIndex < nStartPos )
3205sal_uInt16 lcl_BoundListLevel(
const int nActualLevel)
3207 return o3tl::narrowing<sal_uInt16>( std::clamp( nActualLevel, 0,
MAXLEVEL-1 ) );
3215 bool bResult =
false;
3231 bool bResult =
false;
3248 const unsigned int _nRestrictToThisLevel,
3267 _bInclPrefixAndSuffixStrings,
3268 _nRestrictToThisLevel,
3316 : - leftMargin.
GetLeft(firstLine);
3321 if (indents & ::sw::ListLevelIndents::FirstLine)
3327 : leftMargin.
GetLeft(firstLine);
3379 SwTwips nAdditionalIndent = 0;
3392 nAdditionalIndent = nAdditionalIndent -
3403 indents & ::sw::ListLevelIndents::FirstLine
3410 nAdditionalIndent = rLeft.
GetLeft(rFirst);
3411 if (!(indents & ::sw::ListLevelIndents::FirstLine))
3426 return nAdditionalIndent;
3434 bool bLeftMarginForTabCalcSetToListLevelIndent(
false );
3444 bLeftMarginForTabCalcSetToListLevelIndent =
true;
3448 if ( !bLeftMarginForTabCalcSetToListLevelIndent )
3453 return nLeftMarginForTabCalc;
3458 OUStringBuffer & rText,
3459 sal_Int32 & rTextStt,
3466 for(
int nSrchIter = 0; 2 > nSrchIter; ++nSrchIter, cSrchChr =
CH_TXTATR_INWORD )
3468 sal_Int32
nPos = rText.indexOf(cSrchChr);
3469 while (-1 !=
nPos &&
nPos < nEndPos)
3475 switch( pAttr->
Which() )
3479 rText.remove(
nPos, 1);
3484 rText.remove(
nPos, 1);
3489 rText.remove(
nPos, 1);
3498 nPos = rText.indexOf(cSrchChr,
nPos);
3506 const sal_Int32 nIdx,
3507 const sal_Int32 nLen,
3508 const bool bWithNum,
3509 const bool bAddSpaceAfterListLabelStr,
3510 const bool bWithSpacesForLevel,
3521 const OUString aExpandText = aConversionMap.
getViewText();
3523 sal_Int32 nEnd = nLen == -1 ?
GetText().getLength() : nIdx + nLen;
3525 OUStringBuffer aText(aExpandText.subView(nExpandBegin, nExpandEnd-nExpandBegin));
3536 if ( bAddSpaceAfterListLabelStr )
3539 aText.insert(0, aSpace);
3545 if (bWithSpacesForLevel)
3550 aText.insert(0, aSpace);
3551 aText.insert(0, aSpace);
3555 return aText.makeStringAndClear();
3559 sal_Int32 nIdx, sal_Int32 nLen,
3561 bool bWithFootnote,
bool bReplaceTabsWithSpaces )
const
3563 if( &rDestNd ==
this )
3569 aDestIdx = *pDestIdx;
3570 const sal_Int32 nDestStt = aDestIdx.
GetIndex();
3573 OUStringBuffer buf(
GetText());
3574 if( bReplaceTabsWithSpaces )
3575 buf.replace(
'\t',
' ');
3581 buf.remove(0, nIdx);
3591 rDestNd.
InsertText(buf.makeStringAndClear(), aDestIdx);
3592 nLen = aDestIdx.
GetIndex() - nDestStt;
3597 sal_Int32 nInsPos = nDestStt - nIdx;
3601 const sal_Int32 nAttrStartIdx = pHt->
GetStart();
3602 const sal_uInt16 nWhich = pHt->
Which();
3603 if (nIdx + nLen <= nAttrStartIdx)
3606 const sal_Int32 *pEndIdx = pHt->
End();
3607 if( pEndIdx && *pEndIdx > nIdx &&
3614 if ( pFont && RTL_TEXTENCODING_SYMBOL == pFont->
GetCharSet() )
3618 nInsPos + nAttrStartIdx, nInsPos + *pEndIdx );
3621 else if ( pHt->
HasDummyChar() && (nAttrStartIdx >= nIdx) )
3623 aDestIdx = nInsPos + nAttrStartIdx;
3629 OUString
const aExpand(
3630 static_txtattr_cast<SwTextField const*>(pHt)->GetFormatField().GetField()->ExpandField(
true, pLayout));
3631 if (!aExpand.isEmpty())
3636 SAL_INFO_IF(ins.getLength() != aExpand.getLength(),
3637 "sw.core",
"GetExpandText lossage");
3638 aDestIdx = nInsPos + nAttrStartIdx;
3639 nInsPos += ins.getLength();
3648 if ( bWithFootnote )
3663 if( !sExpand.isEmpty() )
3672 SAL_INFO_IF(ins.getLength() != sExpand.getLength(),
3673 "sw.core",
"GetExpandText lossage");
3674 aDestIdx = nInsPos + nAttrStartIdx;
3675 nInsPos += ins.getLength();
3693 aDestIdx = nDestStt;
3698 sal_Int32 nStartDelete(-1);
3699 while (aDestIdx < rDestNd.
GetText().getLength())
3708 if (-1 == nStartDelete)
3710 nStartDelete = aDestIdx.
GetIndex();
3713 if (aDestIdx < rDestNd.
GetText().getLength())
3720 if (-1 == nStartDelete)
3726 assert(-1 != nStartDelete);
3729 aDestIdx.
GetIndex() - nStartDelete);
3730 assert(aDestIdx.
GetIndex() == nStartDelete);
3739 std::vector<sal_Int32> aRedlArr;
3749 if( RedlineType::Delete == pTmp->
GetType() )
3754 if( pREnd->GetNodeIndex() > nNdIdx )
3757 else if( pREnd->GetNodeIndex() == nNdIdx )
3760 aRedlArr.push_back( 0 );
3761 aRedlArr.push_back( pREnd->GetContentIndex() );
3768 if( pREnd->GetNodeIndex() == nNdIdx )
3769 aRedlArr.push_back( pREnd->GetContentIndex() );
3782 OUStringBuffer aText(
GetText());
3784 sal_Int32 nTextStt = 0;
3785 sal_Int32 nIdxEnd = aText.getLength();
3786 for(
size_t n = 0;
n < aRedlArr.size();
n += 2 )
3788 sal_Int32 nStt = aRedlArr[
n ];
3789 sal_Int32 nEnd = aRedlArr[
n+1 ];
3790 if( ( 0 <= nStt && nStt <= nIdxEnd ) ||
3791 ( 0 <= nEnd && nEnd <= nIdxEnd ))
3793 if( nStt < 0 ) nStt = 0;
3794 if( nIdxEnd < nEnd ) nEnd = nIdxEnd;
3795 const sal_Int32 nDelCnt = nEnd - nStt;
3796 aText.remove(nStt - nTextStt, nDelCnt);
3797 Replace0xFF(*
this, aText, nTextStt, nStt - nTextStt);
3798 nTextStt += nDelCnt;
3800 else if( nStt >= nIdxEnd )
3803 Replace0xFF(*
this, aText, nTextStt, aText.getLength());
3805 return aText.makeStringAndClear();
3809 const OUString & rStr)
3815 sal_Int32
const nOverflow(rStr.getLength() - nDelLen -
GetSpaceLeft());
3817 "SwTextNode::ReplaceText: node text with insertion > node capacity.");
3818 OUString
const sInserted(
3819 (nOverflow > 0) ? rStr.copy(0, rStr.getLength() - nOverflow) : rStr);
3820 if (sInserted.isEmpty() && 0 == nDelLen)
3825 const sal_Int32 nStartPos = rStart.
GetIndex();
3826 sal_Int32 nEndPos = nStartPos + nDelLen;
3827 sal_Int32 nLen = nDelLen;
3828 for( sal_Int32
nPos = nStartPos;
nPos < nEndPos; ++
nPos )
3838 && (*pHint->
GetEnd() > nEndPos) ));
3850 if (nLen && sInserted.getLength())
3854 m_Text =
m_Text.replaceAt(nStartPos, 1, sInserted.subView(0, 1));
3858 Update(rStart, nLen - 1, UpdateMode::Negative);
3860 std::u16string_view aTmpText( sInserted.subView(1) );
3862 Update(rStart, aTmpText.size(), UpdateMode::Replace);
3867 Update(rStart, nLen, UpdateMode::Negative);
3870 Update(rStart, sInserted.getLength(), UpdateMode::Replace);
3875 CallSwClientNotify(aDelHint);
3877 if (sInserted.getLength())
3880 CallSwClientNotify(aInsHint);
3885 const OUString & rStr)
3891 void lcl_ResetParAttrs(
SwTextNode &rTextNode )
3897 SwPaM aPam( rTextNode );
3912 void HandleModifyAtTextNode(
SwTextNode& rTextNode,
3916 const sal_uInt16 nWhich = pOldValue ? pOldValue->
Which() :
3917 pNewValue ? pNewValue->
Which() : 0 ;
3918 bool bNumRuleSet =
false;
3919 bool bParagraphStyleChanged =
false;
3921 OUString sOldNumRule;
3926 bParagraphStyleChanged =
true;
3929 const SwNumRule* pFormerNumRuleAtTextNode =
3931 if ( pFormerNumRuleAtTextNode )
3933 sOldNumRule = pFormerNumRuleAtTextNode->
GetName();
3938 if ( !rNumRuleItem.
GetValue().isEmpty() )
3944 if ( pNumRuleAtTextNode )
3947 sNumRule = pNumRuleAtTextNode->
GetName();
3954 const SwNumRule* pFormerNumRuleAtTextNode =
3956 if ( pFormerNumRuleAtTextNode )
3958 sOldNumRule = pFormerNumRuleAtTextNode->
GetName();
3972 if ( pNumRuleAtTextNode )
3974 sNumRule = pNumRuleAtTextNode->
GetName();
3982 const SwNumRule* pFormerNumRuleAtTextNode =
3984 if ( pFormerNumRuleAtTextNode )
3986 sOldNumRule = pFormerNumRuleAtTextNode->
GetName();
3998 if ( pNumRuleAtTextNode )
4000 sNumRule = pNumRuleAtTextNode->
GetName();
4006 if ( sNumRule != sOldNumRule )
4010 if (sNumRule.isEmpty())
4013 if ( bParagraphStyleChanged )
4015 lcl_ResetParAttrs(rTextNode);
4027 "<HandleModifyAtTextNode()> - text node with outline style, but its paragraph style is not assigned to outline style." );
4028 const int nNewListLevel =
4030 if ( 0 <= nNewListLevel && nNewListLevel <
MAXLEVEL )
4041 if ( bParagraphStyleChanged )
4043 lcl_ResetParAttrs(rTextNode);
4052 else if (!sNumRule.isEmpty() && !rTextNode.
IsInList())
4062 OSL_ENSURE( pNewColl,
"ChgFormatColl: Collectionpointer has value 0." );
4063 assert(
dynamic_cast<const SwTextFormatColl *
>(pNewColl) &&
"ChgFormatColl: is not a Text Collection pointer." );
4066 if( pNewColl != pOldColl )
4071 "DEBUG OSL_ENSURE(ON - <SwTextNode::ChgFormatColl(..)> called during <Set/ResetAttr(..)>" );
4076 HandleModifyAtTextNode( *
this, &aTmp1, &aTmp2 );
4109 std::unique_ptr<SwNodeNum> pBackup2 = std::move(
mpNodeNumOrig);
4129 return pNum->GetNumberVector();
4140 bool bResult =
false;
4175 assert(0 <= nLevel && nLevel <=
MAXLEVEL);
4176 if ( 0 <= nLevel && nLevel <=
MAXLEVEL )
4179 o3tl::narrowing<sal_uInt16>(nLevel) ) );
4186 auto it = rGrabBagItem.
GetGrabBag().find(
"OutlineContentVisibleAttr");
4188 it->second >>= bOutlineContentVisibleAttr;
4220 if ( nLevel < 0 || nLevel >=
MAXLEVEL )
4227 static_cast<sal_Int16
>(nLevel) );
4239 int nAttrListLevel = 0;
4243 nAttrListLevel =
static_cast<int>(aListLevelItem.
GetValue());
4245 return nAttrListLevel;
4310 : nNumber != USHRT_MAX );
4315 if ( nNumber == USHRT_MAX )
4322 static_cast<sal_Int16
>(nNumber) );
4323 SetAttr( aNewListRestartValueItem );
4335 "<SwTextNode::GetAttrListRestartValue()> - only ask for list restart value, if attribute is set at text node." );
4359 nListRestartValue = pFormat->
GetStart();
4364 return nListRestartValue;
4389 SetAttr( aIsCountedInListItem );
4397 return aIsCountedInListItem.
GetValue();
4402 const OUString sListId = pNode->
GetListId();
4403 if (!sListId.isEmpty())
4406 SwList* pList = rIDLA.getListByName( sListId );
4407 if ( pList ==
nullptr )
4416 OSL_ENSURE( pList !=
nullptr,
4417 "<SwTextNode::AddToList()> - no list for given list id. Serious defect" );
4427 OSL_FAIL(
"<SwTextNode::AddToList()> - the text node is already added to a list. Serious defect" );
4432 if (!(pList &&
GetNodes().IsDocNodes()))
4444 if (!bRecordChanges ||
GetDoc().IsInXMLImport() ||
GetDoc().IsInWriterfilterImport() )
4462 else if ( bRecordChanges )
4469 if (pFrame->getRootFrame()->IsHideRedlines())
4471 if (pFrame->GetTextNodeForParaProps() ==
this)
4553 bool bResult =
false;
4566 if (rListIdItem.
GetValue() != rListId)
4568 if (rListId.isEmpty())
4584 const OUString& sListId {rListIdItem.
GetValue()};
4588 if (sListId.isEmpty())
4619 ret |= ::sw::ListLevelIndents::FirstLine;
4630 bool bAreListLevelIndentsApplicable(
true );
4635 bAreListLevelIndentsApplicable =
false;
4638 GetpSwAttrSet()->GetItemState(nWhich,
false) == SfxItemState::SET)
4641 bAreListLevelIndentsApplicable =
false;
4648 bAreListLevelIndentsApplicable =
true;
4662 bAreListLevelIndentsApplicable =
false;
4670 bAreListLevelIndentsApplicable =
true;
4676 "<SwTextNode::AreListLevelIndentsApplicable()> - something wrong in paragraph's style hierarchy. The applied list style is not found." );
4680 return bAreListLevelIndentsApplicable;
4693 bool bListTabStopPositionProvided(
false);
4702 bListTabStopPositionProvided =
true;
4722 return bListTabStopPositionProvided;
4742 sal_Int32 nStartPos;
4786 class HandleSetAttrAtTextNode
4789 HandleSetAttrAtTextNode(
SwTextNode& rTextNode,
4791 HandleSetAttrAtTextNode(
SwTextNode& rTextNode,
4793 ~HandleSetAttrAtTextNode() COVERITY_NOEXCEPT_FALSE;
4797 bool mbAddTextNodeToList;
4798 bool mbUpdateListLevel;
4799 bool mbUpdateListRestart;
4800 bool mbUpdateListCount;
4802 bool mbOutlineLevelSet;
4805 HandleSetAttrAtTextNode::HandleSetAttrAtTextNode(
SwTextNode& rTextNode,
4807 : mrTextNode( rTextNode ),
4808 mbAddTextNodeToList( false ),
4809 mbUpdateListLevel( false ),
4810 mbUpdateListRestart( false ),
4811 mbUpdateListCount( false ),
4813 mbOutlineLevelSet( false )
4815 switch ( pItem.Which() )
4820 mrTextNode.RemoveFromList();
4824 if ( !rNumRuleItem.
GetValue().isEmpty() )
4826 mbAddTextNodeToList =
true;
4829 mrTextNode.ResetEmptyListStyleDueToResetOutlineLevelAttr();
4839 OSL_ENSURE( rListIdItem.
GetValue().getLength() > 0,
4840 "<HandleSetAttrAtTextNode(..)> - empty list id attribute not expected. Serious defect." );
4841 const OUString sListIdOfTextNode = rTextNode.GetListId();
4842 if ( rListIdItem.
GetValue() != sListIdOfTextNode )
4844 mbAddTextNodeToList =
true;
4845 if ( mrTextNode.IsInList() )
4847 mrTextNode.RemoveFromList();
4858 if ( aListLevelItem.
GetValue() != mrTextNode.GetAttrListLevel() )
4860 mbUpdateListLevel =
true;
4870 if ( aListIsRestartItem.
GetValue() !=
4871 mrTextNode.IsListRestart() )
4873 mbUpdateListRestart =
true;
4883 if ( !mrTextNode.HasAttrListRestartValue() ||
4884 aListRestartValueItem.
GetValue() != mrTextNode.GetAttrListRestartValue() )
4886 mbUpdateListRestart =
true;
4896 if ( aIsCountedInListItem.
GetValue() !=
4897 mrTextNode.IsCountedInList() )
4899 mbUpdateListCount =
true;
4910 if ( aOutlineLevelItem.
GetValue() != mrTextNode.GetAttrOutlineLevel() )
4912 mbOutlineLevelSet =
true;
4920 HandleSetAttrAtTextNode::HandleSetAttrAtTextNode(
SwTextNode& rTextNode,
4922 : mrTextNode( rTextNode ),
4923 mbAddTextNodeToList( false ),
4924 mbUpdateListLevel( false ),
4925 mbUpdateListRestart( false ),
4926 mbUpdateListCount( false ),
4928 mbOutlineLevelSet( false )
4933 mrTextNode.RemoveFromList();
4935 if ( !pNumRuleItem->GetValue().isEmpty() )
4937 mbAddTextNodeToList =
true;
4939 mrTextNode.ResetEmptyListStyleDueToResetOutlineLevelAttr();
4946 const OUString sListIdOfTextNode = mrTextNode.GetListId();
4947 if ( pListIdItem->GetValue() != sListIdOfTextNode )
4949 mbAddTextNodeToList =
true;
4950 if ( mrTextNode.IsInList() )
4952 mrTextNode.RemoveFromList();
4960 if (pListLevelItem->GetValue() != mrTextNode.GetAttrListLevel())
4962 mbUpdateListLevel =
true;
4969 if (pListIsRestartItem->GetValue() != mrTextNode.IsListRestart())
4971 mbUpdateListRestart =
true;
4978 if ( !mrTextNode.HasAttrListRestartValue() ||
4979 pListRestartValueItem->GetValue() != mrTextNode.GetAttrListRestartValue() )
4981 mbUpdateListRestart =
true;
4988 if (pIsCountedInListItem->GetValue() != mrTextNode.IsCountedInList())
4990 mbUpdateListCount =
true;
4998 if (pOutlineLevelItem->GetValue() != mrTextNode.GetAttrOutlineLevel())
5000 mbOutlineLevelSet =
true;
5005 HandleSetAttrAtTextNode::~HandleSetAttrAtTextNode() COVERITY_NOEXCEPT_FALSE
5007 if ( mbAddTextNodeToList )
5009 SwNumRule* pNumRuleAtTextNode = mrTextNode.GetNumRule();
5010 if ( pNumRuleAtTextNode )
5012 mrTextNode.AddToList();
5017 if ( mbUpdateListLevel && mrTextNode.IsInList() )
5019 auto const nLevel(mrTextNode.GetAttrListLevel());
5020 const SwDoc& rDoc(mrTextNode.GetDoc());
5025 if ( mbUpdateListRestart && mrTextNode.IsInList() )
5027 const SwDoc& rDoc(mrTextNode.GetDoc());
5039 const SwDoc& rDoc(mrTextNode.GetDoc());
5046 if (!mbOutlineLevelSet)
5049 mrTextNode.GetNodes().UpdateOutlineNode(mrTextNode);
5050 if (mrTextNode.GetAttrOutlineLevel() == 0)
5052 mrTextNode.ResetEmptyListStyleDueToResetOutlineLevelAttr();
5057 != SfxItemState::SET )
5059 mrTextNode.SetEmptyListStyleDueToSetOutlineLevelAttr();
5071 HandleSetAttrAtTextNode aHandleSetAttr( *
this, pItem );
5085 HandleSetAttrAtTextNode aHandleSetAttr( *
this,
rSet );
5116 class HandleResetAttrAtTextNode
5119 HandleResetAttrAtTextNode(
SwTextNode& rTextNode,
5120 const sal_uInt16 nWhich1,
5121 sal_uInt16 nWhich2 );
5122 HandleResetAttrAtTextNode(
SwTextNode& rTextNode,
5123 const std::vector<sal_uInt16>& rWhichArr );
5124 explicit HandleResetAttrAtTextNode(
SwTextNode& rTextNode );
5126 ~HandleResetAttrAtTextNode() COVERITY_NOEXCEPT_FALSE;
5130 bool mbListStyleOrIdReset;
5131 bool mbUpdateListLevel;
5132 bool mbUpdateListRestart;
5133 bool mbUpdateListCount;
5135 void init( sal_uInt16 nWhich,
bool& rbRemoveFromList );
5138 HandleResetAttrAtTextNode::HandleResetAttrAtTextNode(
SwTextNode& rTextNode,
5139 const sal_uInt16 nWhich1,
5140 sal_uInt16 nWhich2 )
5141 : mrTextNode( rTextNode ),
5142 mbListStyleOrIdReset( false ),
5143 mbUpdateListLevel( false ),
5144 mbUpdateListRestart( false ),
5145 mbUpdateListCount( false )
5147 if ( nWhich2 < nWhich1 )
5149 bool bRemoveFromList(
false );
5150 for ( sal_uInt16 nWhich = nWhich1; nWhich <= nWhich2; ++nWhich )
5151 init( nWhich, bRemoveFromList );
5152 if ( bRemoveFromList && mrTextNode.IsInList() )
5153 mrTextNode.RemoveFromList();
5156 HandleResetAttrAtTextNode::HandleResetAttrAtTextNode(
SwTextNode& rTextNode,
5157 const std::vector<sal_uInt16>& rWhichArr )
5158 : mrTextNode( rTextNode ),
5159 mbListStyleOrIdReset( false ),
5160 mbUpdateListLevel( false ),
5161 mbUpdateListRestart( false ),
5162 mbUpdateListCount( false )
5164 bool bRemoveFromList(
false );
5165 for ( sal_uInt16 nWhich : rWhichArr )
5166 init( nWhich, bRemoveFromList );
5167 if ( bRemoveFromList && mrTextNode.IsInList() )
5168 mrTextNode.RemoveFromList();
5171 HandleResetAttrAtTextNode::HandleResetAttrAtTextNode(
SwTextNode& rTextNode )
5172 : mrTextNode( rTextNode ),
5173 mbListStyleOrIdReset( true ),
5174 mbUpdateListLevel( false ),
5175 mbUpdateListRestart( false ),
5176 mbUpdateListCount( false )
5183 mrTextNode.ResetEmptyListStyleDueToResetOutlineLevelAttr();
5186 void HandleResetAttrAtTextNode::init( sal_uInt16 rWhich,
bool& rbRemoveFromList )
5190 rbRemoveFromList = rbRemoveFromList ||
5191 mrTextNode.GetNumRule() !=
nullptr;
5192 mbListStyleOrIdReset =
true;
5196 rbRemoveFromList = rbRemoveFromList ||
5197 ( mrTextNode.GetpSwAttrSet() &&
5198 mrTextNode.GetpSwAttrSet()->GetItemState(
RES_PARATR_LIST_ID,
false ) == SfxItemState::SET );
5199 mbListStyleOrIdReset =
true;
5202 mrTextNode.ResetEmptyListStyleDueToResetOutlineLevelAttr();
5204 mrTextNode.ResetAttr( XATTR_FILL_FIRST, XATTR_FILL_LAST );
5206 if ( !rbRemoveFromList )
5209 mbUpdateListLevel = mbUpdateListLevel ||
5211 mrTextNode.HasAttrListLevel() );
5214 mbUpdateListRestart = mbUpdateListRestart ||
5216 mrTextNode.IsListRestart() ) ||
5218 mrTextNode.HasAttrListRestartValue() );
5221 mbUpdateListCount = mbUpdateListCount ||
5223 !mrTextNode.IsCountedInList() );
5227 HandleResetAttrAtTextNode::~HandleResetAttrAtTextNode() COVERITY_NOEXCEPT_FALSE
5229 if ( mbListStyleOrIdReset && !mrTextNode.IsInList() )
5233 if (mrTextNode.GetNumRule() && !mrTextNode.GetListId().isEmpty())
5238 if ( !mrTextNode.HasAttrListLevel() &&
5240 mrTextNode.GetTextColl()->IsAssignedToListLevelOfOutlineStyle() )
5242 int nNewListLevel = mrTextNode.GetTextColl()->GetAssignedOutlineStyleLevel();
5243 if ( 0 <= nNewListLevel && nNewListLevel <
MAXLEVEL )
5245 mrTextNode.SetAttrListLevel( nNewListLevel );
5248 mrTextNode.AddToList();
5254 if (mrTextNode.GetpSwAttrSet()
5257 mrTextNode.SetEmptyListStyleDueToSetOutlineLevelAttr();
5262 if ( !mrTextNode.IsInList() )
5265 if ( mbUpdateListLevel )
5267 auto const nLevel(mrTextNode.GetAttrListLevel());
5268 const SwDoc& rDoc(mrTextNode.GetDoc());
5273 if ( mbUpdateListRestart )
5275 const SwDoc& rDoc(mrTextNode.GetDoc());
5283 if ( mbUpdateListCount )
5285 const SwDoc& rDoc(mrTextNode.GetDoc());
5298 HandleResetAttrAtTextNode aHandleResetAttr( *
this, nWhich1, nWhich2 );
5312 HandleResetAttrAtTextNode aHandleResetAttr( *
this, rWhichArr );
5326 HandleResetAttrAtTextNode aHandleResetAttr( *
this );
5337 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwTextNode"));
5338 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
this);
5339 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"index"), BAD_CAST(OString::number(sal_Int32(
GetIndex())).getStr()));
5342 for (
int i = 0;
i < 32; ++
i)
5343 sText = sText.replace(
i,
'*');
5344 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"m_Text"));
5345 (void)xmlTextWriterWriteString(pWriter, BAD_CAST(sText.toUtf8().getStr()));
5346 (void)xmlTextWriterEndElement(pWriter);
5350 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwTextFormatColl"));
5351 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"name"), BAD_CAST(
GetFormatColl()->
GetName().toUtf8().getStr()));
5352 (void)xmlTextWriterEndElement(pWriter);
5357 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwAttrSet"));
5359 (void)xmlTextWriterEndElement(pWriter);
5364 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwpHints"));
5366 for (
size_t i = 0;
i < rHints.
Count(); ++
i)
5368 (void)xmlTextWriterEndElement(pWriter);
5371 (void)xmlTextWriterEndElement(pWriter);
5381 return pRsid->GetValue();
5397 return nThisRsid == nRsid;
5402 sal_uInt32 nThisRsid =
GetRsid( nStt1, nStt1 );
5403 sal_uInt32 nRsid = rTextNode.
GetRsid( nStt2, nStt2 );
5405 return nThisRsid == nRsid;
5433 CallSwClientNotify(rHint);
5446 CallSwClientNotify(aHint);
5451 const auto pOldValue = rHint.
m_pOld;
5452 const auto pNewValue = rHint.
m_pNew;
5462 && GetRegisteredIn() ==
static_cast<const SwFormatChg*
>(pNewValue)->pChangedFormat
5475 const sal_uInt16 nWhich = pNewValue->
Which();
5496 HandleModifyAtTextNode( *
this, pOldValue, pNewValue );
5517 if (rHint.
GetId() == SfxHintId::SwLegacyModify)
5522 else if (
dynamic_cast<const SwAttrHint*
>(&rHint))
5524 if (&rModify == GetRegisteredIn())
5529uno::Reference< rdf::XMetadatable >
5532 const uno::Reference<rdf::XMetadatable> xMeta(
@ IGNORE_FIRST_LINE_INDENT_IN_NUMBERING
@ TABS_RELATIVE_TO_INDENT
@ NO_NUMBERING_SHOW_FOLLOWBY
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
FILE * init(int, char **)
sal_uInt16 GetValue() const
const OUString & GetValue() const
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
virtual SwList * getListByName(const OUString &rListId) const =0
virtual void assureSortedMarkContainers() const =0
virtual SwRedlineTable::size_type GetRedlinePos(const SwNode &rNode, RedlineType nType) const =0
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual std::shared_ptr< SfxItemSet > getAutomaticStyle(const SfxItemSet &rSet, SwAutoStyleFamily eFamily, const OUString *pParentName=nullptr)=0
const OUString & getViewText() const
sal_Int32 ConvertToViewPosition(sal_Int32 nModelPos) const
Converts a model position into a view position.
const std::map< OUString, css::uno::Any > & GetGrabBag() const
sal_Int16 GetValue() const
const SfxPoolItem * GetCurItem() const
sal_uInt16 GetCurPos() const
const SfxPoolItem * NextItem()
void SetParent(const SfxItemSet *pNew)
void dumpAsXml(xmlTextWriterPtr pWriter) const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxItemSet * GetParent() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhichByPos(sal_uInt16 nPos) const
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
short GetTextFirstLineOffset() const
rtl_TextEncoding GetCharSet() const
bool IsTextFormat() const
SvxNumType GetNumberingType() const
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
tools::Long GetLeft(SvxFirstLineIndentItem const &rFirstLine) const
tools::Long GetTextLeft() const
wrapper class for the positioning of Writer fly frames and drawing objects
const SwAttrSet * GetChgSet() const
What has changed.
const SvxFirstLineIndentItem & GetFirstLineIndent(bool=true) const
const SwDoc * GetDoc() const
void CopyToModify(sw::BroadcastingModify &rMod) const
const SvxTextLeftMarginItem & GetTextLeftMargin(bool=true) const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Marks a character position inside a document model content node (SwContentNode)
const SwContentIndex * GetNext() const
sal_Int32 GetIndex() const
const SwContentNode * GetContentNode() const
SwRangeRedline * GetRedline() const
SwContentIndex & Assign(const SwContentNode *, sal_Int32)
void MakeFramesForAdjacentContentNode(SwContentNode &rNode)
Method creates all views of document for given node.
SwFormatColl * GetFormatColl() const
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
bool InvalidateNumRule()
Invalidates NumRule at the node.
bool HasSwAttrSet() const
virtual SwContentFrame * MakeFrame(SwFrame *pSib)=0
MakeFrame will be called for a certain layout pSib is another SwFrame of the same layout (e....
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
bool CanJoinNext(SwNodeIndex *pIdx=nullptr) const
Is it possible to join two nodes? In pIdx the second position can be returned.
void DelFrames(SwRootFrame const *pLayout)
Method deletes all views of document for the node.
sal_uInt16 ClearItemsFromAttrSet(const std::vector< sal_uInt16 > &rWhichIds)
There some functions that like to remove items from the internal SwAttrSet (handle):
std::shared_ptr< const SfxItemSet > mpAttrSet
Attribute-set for all auto attributes of a ContentNode.
virtual bool SetAttr(const SfxPoolItem &)
made virtual
void ChkCondColl(const SwTextFormatColl *pColl=nullptr)
bool CanJoinPrev(SwNodeIndex *pIdx=nullptr) const
Can we join two Nodes? We can return the 2nd position in pIdx.
const SwAttrSet * GetpSwAttrSet() const
virtual SwContentNode * MakeCopy(SwDoc &, SwNode &rWhere, bool bNewFrames) const =0
virtual SwFormatColl * ChgFormatColl(SwFormatColl *)
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
const SfxPoolItem * GetNoCondAttr(sal_uInt16 nWhich, bool bInParents) const
Obtains attribute that is not delivered via conditional style!
virtual sal_uInt16 ResetAllAttr()
SwFormatColl & GetAnyFormatColl() const
virtual void NewAttrSet(SwAttrPool &)=0
Make respective nodes create the specific AttrSets.
virtual bool IsChangeRecording() const override
passwword protection for Writer (derived from SfxObjectShell) see also: FN_REDLINE_ON,...
bool IsCopyIsMove() const
const SwFootnoteInfo & GetFootnoteInfo() const
void CorrAbs(const SwNode &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
SwNumRule * FindNumRulePtr(const OUString &rName) const
const SwCharFormats * GetCharFormats() const
IDocumentUndoRedo & GetIDocumentUndoRedo()
IStyleAccess & GetIStyleAccess()
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
::sfx2::IXmlIdRegistry & GetXmlIdRegistry()
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
SwFootnoteIdxs & GetFootnoteIdxs()
SwCharFormat * CopyCharFormat(const SwCharFormat &)
copy the char format
const SwEndNoteInfo & GetEndNoteInfo() const
void ResetAttrs(const SwPaM &rRg, bool bTextAttr=true, const o3tl::sorted_vector< sal_uInt16 > &rAttrs=o3tl::sorted_vector< sal_uInt16 >(), const bool bSendDataChangedEvents=true, SwRootFrame const *pLayout=nullptr)
Reset attributes.
const SwFormatRefMark * GetRefMark(std::u16string_view rName) const
const SwAttrPool & GetAttrPool() const
SwDocShell * GetDocShell()
IDocumentListsAccess const & getIDocumentListsAccess() const
bool IsInHeaderFooter(const SwNode &) const
SwFieldType * GetTyp() const
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Base class of the Writer layout elements.
const SwAttrSet * GetAttrSet() const
WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for SwTextFrame,...
SwRootFrame * getRootFrame()
SwPageFrame * FindPageFrame()
SwFootnoteFrame * FindFootnoteFrame()
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
void InsertListItem(SwNodeNum &rNodeNum, SwListRedlineType eRedlines, const int nLevel, const SwDoc &rDoc)
static void RemoveListItem(SwNodeNum &rNodeNum, const SwDoc &rDoc)
bool IsListLevelMarked(const int nListLevel) const
Marks a node in the document model.
SwNodeOffset GetIndex() const
SwNumRule * GetNumRule() const
Base class of the Writer document model elements.
bool IsIgnoreDontExpand() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwSectionNode * GetSectionNode()
void SetIgnoreDontExpand(bool bNew)
SwNodeOffset GetIndex() const
void resetAndQueueAccessibilityCheck()
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Merge
sw_redlinehide: redline node merge state
bool IsInRedlines() const
Checks if this node is in redlines.
SwNodeOffset StartOfSectionIndex() const
void SetRedlineMergeFlag(Merge const eMerge)
bool IsSectionNode() const
SwTableNode * FindTableNode()
Search table node, in which it is.
SwSectionNode * FindSectionNode()
Search section node, in which it is.
const SwStartNode * StartOfSectionNode() const
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Merge GetRedlineMergeFlag() const
SwNodeOffset EndOfSectionIndex() const
bool IsCreateFrameWhenHidingRedlines() const
SwContentNode * GetContentNode()
SwNodeType GetNodeType() const
std::vector< SwFrameFormat * > const & GetAnchoredFlys() const
const IDocumentSettingAccess * getIDocumentSettingAccess() const
Provides access to the document setting interface.
SwTextNode * MakeTextNode(SwNode &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc....
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
void UpdateOutlineNode(SwNode &rNd)
Update all Nodes - Rule/Format-Change.
SwDoc & GetDoc()
Which Doc contains the nodes-array?
SwNode * FindPrvNxtFrameNode(const SwNode &rFrameNd, const SwNode *pEnd, SwRootFrame const *pLayout=nullptr) const
Search previous / next content node or table node with frames.
static SwContentNode * GoPrevSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true)
bool IsOutlineRule() const
const SwNumFormat * GetNumFormat(sal_uInt16 i) const
const OUString & GetDefaultListId() const
const SwNumFormat & Get(sal_uInt16 i) const
const OUString & GetName() const
static OUString GetOutlineRuleName()
OUString MakeNumString(const SwNodeNum &, bool bInclStrings=true) const
int GetLevelInListTree() const
Return level of this node.
bool IsFirst(const SwNumberTreeNode *pNode) const
Return if a node is first non-phantom child of this node.
void SetLevelInListTree(const int nLevel, const SwDoc &rDoc)
set level of this node
void NotifyInvalidSiblings(const SwDoc &rDoc)
Notifies all invalid siblings of this node.
SwNumberTreeNode * GetParent() const
Returns the parent of this node.
void InvalidateMe()
Notifies the node.
void InvalidateAndNotifyTree(const SwDoc &rDoc)
Invalidation and notification of complete numbering tree.
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
const SwPosition * End() const
const SwPosition * GetPoint() const
const SwPosition * Start() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
A page of the document layout.
RedlineType GetType(sal_uInt16 nPos=0) const
static void LOKRedlineNotification(RedlineNotification eType, SwRangeRedline *pRedline)
Emits LOK notification about one addition / removal of a redline item.
static constexpr size_type npos
vector_type::size_type size_type
The root element of a Writer document layout.
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
static bool GetBoundsOfHiddenRange(const SwTextNode &rNode, sal_Int32 nPos, sal_Int32 &rnStartPos, sal_Int32 &rnEndPos, std::vector< sal_Int32 > *pList=nullptr)
Hidden text range information - static and non-version.
static sal_Int32 MaskHiddenRanges(const SwTextNode &rNode, OUStringBuffer &rText, const sal_Int32 nStt, const sal_Int32 nEnd, const sal_Unicode cChar)
Hidden text attribute handling.
A section node represents the start of a section on the UI, i.e.
const SwSection & GetSection() const
bool IsHiddenFlag() const
Represents the current text cursor of one opened edit window.
class for collecting anchored objects
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
const SwTable & GetTable() const
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
static void Destroy(SwTextAttr *pToDestroy, SfxItemPool &rPool)
destroy instance
const SfxPoolItem & GetAttr() const
virtual const sal_Int32 * GetEnd() const
end position
const SwFormatRefMark & GetRefMark() const
bool IsFormatIgnoreStart() const
const sal_Int32 * End() const
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
const SwFormatFlyCnt & GetFlyCnt() const
const SwFormatFootnote & GetFootnote() const
sal_Int32 GetStart() const
const SwFormatINetFormat & GetINetFormat() const
const SwFormatCharFormat & GetCharFormat() const
virtual void SetEnd(sal_Int32)
void SetStart(sal_Int32 n)
start position
bool IsDontMoveAttr() const
bool IsCharFormatAttr() const
const SwFormatAutoFormat & GetAutoFormat() const
void SetDontExpand(bool bDontExpand)
bool HasDummyChar() const
bool IsDontExpandStartAttr() const
bool IsLockExpandFlag() const
bool IsFormatIgnoreEnd() const
const SwFormatField & GetFormatField() const
Represents the style of a paragraph.
bool IsAssignedToListLevelOfOutlineStyle() const
SwTextFormatColl & GetNextTextFormatColl() const
int GetAssignedOutlineStyleLevel() const
Represents the visualization of a paragraph.
SwTextAttr subclass that tracks the location of the wrapped SwFormatURL.
void ChgTextNode(SwTextNode *pNew)
SwCharFormat * GetCharFormat()
const SwTextNode * GetpTextNode() const
void UpdateFieldContent()
SwTextNode is a paragraph in the document model.
bool HasBullet() const
Returns if this text node has a bullet.
OUString GetExpandText(SwRootFrame const *pLayout, const sal_Int32 nIdx=0, const sal_Int32 nLen=-1, const bool bWithNum=false, const bool bAddSpaceAfterListLabelStr=false, const bool bWithSpacesForLevel=false, const ExpandMode eAdditionalMode=ExpandMode::ExpandFootnote|ExpandMode::HideFieldmarkCommands) const
add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating, when <bWithNum = true> that a spa...
SwTextAttr * GetTextAttrForEndCharAt(sal_Int32 nIndex, sal_uInt16 nWhich) const
Get the text attribute of an end dummy character at nIndex.
bool IsEmptyListStyleDueToSetOutlineLevelAttr() const
void SetAttrListLevel(int nLevel)
Sets the list level of this text node.
SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const
const SwTextInputField * GetOverlappingInputField(const SwTextAttr &rTextAttr) const
void SetWrongDirty(sw::WrongState eNew) const
void DoNum(std::function< void(SwNodeNum &)> const &)
virtual sal_Int32 Len() const override
sal_Int32 GetSpaceLeft() const
SwNumberTree::tSwNumTreeNumber GetActualListStartValue() const
tools::Long GetLeftMarginWithNum(bool bTextLeft=false) const
Returns the additional indents of this text node and its numbering.
void SetAttrOutlineLevel(int nLevel)
Sets the out line level at a text node.
SAL_DLLPRIVATE void CopyAttr(SwTextNode *pDest, const sal_Int32 nStart, const sal_Int32 nOldPos)
Copies the attributes at nStart to pDest.
SwNumberTree::tNumberVector GetNumberVector(SwRootFrame const *pLayout=nullptr, SwListRedlineType eRedline=SwListRedlineType::SHOW) const
SwWrongList * GetSmartTags()
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
bool m_bRecalcHiddenCharFlags
The last two flags have to be recalculated if this flag is set:
SAL_DLLPRIVATE void MoveTextAttr_To_AttrSet()
Move all comprising hard attributes to the AttrSet of the paragraph.
SwpHints & GetOrCreateSwpHints()
virtual SwContentNode * JoinNext() override
void ResetEmptyListStyleDueToResetOutlineLevelAttr()
bool GetParaAttr(SfxItemSet &rSet, sal_Int32 nStt, sal_Int32 nEnd, const bool bOnlyTextAttr=false, const bool bGetFromChrFormat=true, const bool bMergeIndentValuesOfNumRule=false, SwRootFrame const *pLayout=nullptr) const
Query the attributes of textnode over the range.
virtual SwContentFrame * MakeFrame(SwFrame *) override
Virtual methods from ContentNode.
void FileLoadedInitHints()
initialize the hints after file loading (which takes shortcuts)
void UpdateDocPos(const SwTwips nDocPos, const sal_uInt32 nIndex)
bool IsFirstOfNumRule(SwRootFrame const &rLayout) const
void CutText(SwTextNode *const pDest, const SwContentIndex &rStart, const sal_Int32 nLen)
bool GetListTabStopPosition(tools::Long &nListTabStopPosition) const
Retrieves the list tab stop position, if the paragraph's list level defines one and this list tab sto...
void DeleteAttribute(SwTextAttr *const pTextAttr)
delete the attribute pTextAttr
SwContentNode * AppendNode(const SwPosition &)
bool HasVisibleNumberingOrBullet() const
Returns if the paragraph has a visible numbering or bullet.
std::unique_ptr< SwNodeNum > mpNodeNum
Numbering for this paragraph.
void DestroyAttr(SwTextAttr *pAttr)
OUString GetListId() const
virtual SAL_DLLPRIVATE void NewAttrSet(SwAttrPool &) override
Create the specific AttrSet.
bool IsHiddenByParaField() const
is the paragraph visible?
sal_uInt32 GetParRsid() const
SwTextAttr * InsertItem(SfxPoolItem &rAttr, const sal_Int32 nStart, const sal_Int32 nEnd, const SetAttrMode nMode=SetAttrMode::DEFAULT)
create new text attribute from rAttr and insert it
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
bool AreListLevelIndentsApplicableImpl(sal_uInt16 nWhich) const
::sw::ListLevelIndents AreListLevelIndentsApplicable() const
Determines, if the list level indent attributes can be applied to the paragraph.
SwTextField * GetFieldTextAttrAt(const sal_Int32 nIndex, ::sw::GetTextAttrMode const eMode=::sw::GetTextAttrMode::Expand) const
virtual bool IsInUndo() const override
Is this node in the undo array?
void SetListRestart(bool bRestart)
void CopyText(SwTextNode *const pDest, const SwContentIndex &rStart, const sal_Int32 nLen, const bool bForceCopyOfAllAttrs)
Actions on text and attributes.
void HandleNonLegacyHint(const SfxHint &)
sal_uInt32 GetRsid(sal_Int32 nStt, sal_Int32 nEnd) const
OUString GetLabelFollowedBy() const
Retrieves the character following the list label, if the paragraph's list level defines one.
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
End: Data collected during idle time.
int GetAttrListLevel() const
bool IsOutline() const
Returns if this text node is an outline.
void SetWordCountDirty(bool bNew) const
void SetGrammarCheckDirty(bool bNew) const
std::optional< OUString > m_oNumStringCache
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
virtual bool IsInClipboard() const override
void SetSmartTags(std::unique_ptr< SwWrongList > pNew)
void SetSmartTagDirty(bool bNew) const
const SwNodeNum * GetNum(SwRootFrame const *pLayout=nullptr, SwListRedlineType eRedline=SwListRedlineType::SHOW) const
std::unique_ptr< SwpHints > m_pSwpHints
May be 0.
bool HasAttrListLevel() const
void EraseText(const SwContentIndex &rIdx, const sal_Int32 nCount=SAL_MAX_INT32, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
delete text content ATTENTION: must not be called with a range that overlaps the start of an attribut...
virtual SwFormatColl * ChgFormatColl(SwFormatColl *) override
void SetAutoCompleteWordDirty(bool bNew) const
bool m_bContainsHiddenChars
Some of the chars this para are hidden.
virtual ~SwTextNode() override
SAL_DLLPRIVATE SwTextNode(SwNode &rWhere, SwTextFormatColl *pTextColl, const SfxItemSet *pAutoAttr=nullptr)
void GetAttrOutlineContentVisible(bool &bOutlineContentVisibleAttr)
GetAttrOutlineContentVisible.
unotools::WeakReference< SwXParagraph > m_wXParagraph
std::unique_ptr< SwWrongList > ReleaseSmartTags()
bool IsCountedInList() const
virtual ::sfx2::IXmlIdRegistry & GetRegistry() override
sfx2::Metadatable
void SetCountedInList(bool bCounted)
OUString InsertText(const OUString &rStr, const SwContentIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
bool CompareParRsid(const SwTextNode &rTextNode) const
void SetCalcHiddenCharFlags() const
void SetListId(OUString const &rListId)
void ReplaceText(const SwContentIndex &rStart, const sal_Int32 nDelLen, const OUString &rText)
replace nDelLen characters at rStart with rText in case the replacement does not fit,...
SwpHints & GetSwpHints()
getters for SwpHints
void UpdateOutlineState()
bool m_bHiddenCharsHidePara
The whole paragraph is hidden because of the hidden text attribute.
SwTwips GetAdditionalIndentForStartingNewList() const
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
bool m_bInUndo
Is an undo operation in progress?
bool HasNumber(SwRootFrame const *pLayout=nullptr) const
Returns if this text node has a number.
int GetActualListLevel(SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Returns the actual list level of this text node, when it is a list item.
bool HasAttrListRestartValue() const
bool IsListRestart() const
virtual bool IsInContent() const override
drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes
bool IsNumbered(SwRootFrame const *pLayout=nullptr) const
Returns is this text node is numbered.
bool IsNotificationEnabled() const
Checks some global conditions like loading or destruction of document to economize notifications.
std::unique_ptr< SwGrammarMarkUp > ReleaseGrammarCheck()
SwGrammarMarkUp * GetGrammarCheck()
bool mbEmptyListStyleSetDueToSetOutlineLevelAttr
bool IsOutlineStateChanged() const
int GetAttrOutlineLevel() const
Returns outline level of this text node.
void DelFrames_TextNodePart()
void SetAttrListRestartValue(SwNumberTree::tSwNumTreeNumber nNum)
bool GetFirstLineOfsWithNum(short &rFirstOffset) const
Returns the combined first line indent of this text node and its numbering.
void RemoveFromListOrig()
virtual css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() override
virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const override
tools::Long GetLeftMarginForTabCalculation() const
return left margin for tab stop position calculation
SAL_DLLPRIVATE void CutImpl(SwTextNode *const pDest, const SwContentIndex &rDestStart, const SwContentIndex &rStart, sal_Int32 nLen, const bool bUpdate=true)
virtual void Update(SwContentIndex const &rPos, const sal_Int32 nChangeLen, UpdateMode eMode) override
override SwContentIndexReg
bool CopyExpandText(SwTextNode &rDestNd, const SwContentIndex *pDestIdx, sal_Int32 nIdx, sal_Int32 nLen, SwRootFrame const *pLayout, bool bWithNum=false, bool bWithFootnote=true, bool bReplaceTabsWithSpaces=false) const
bool CompareRsid(const SwTextNode &rTextNode, sal_Int32 nStt1, sal_Int32 nStt2) const
OUString GetNumString(const bool _bInclPrefixAndSuffixStrings=true, const unsigned int _nRestrictToThisLevel=MAXLEVEL, SwRootFrame const *pLayout=nullptr, SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Returns outline of numbering string.
std::vector< SwTextAttr * > GetTextAttrsAt(sal_Int32 const nIndex, sal_uInt16 const nWhich) const
get the innermost text attributes covering position nIndex.
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Dumps the node structure to the given destination (file nodes.xml in the current directory by default...
bool HasMarkedLabel() const
Returns if this text node has a marked label.
SwTextNode * SplitContentNode(const SwPosition &, std::function< void(SwTextNode *, sw::mark::RestoreMode, bool AtStart)> const *pContentIndexRestore)
SwTextAttr * GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, ::sw::GetTextAttrMode const eMode=::sw::GetTextAttrMode::Default) const
get the innermost text attribute covering position nIndex.
SwpHints * GetpSwpHints()
void SetWrong(std::unique_ptr< SwWrongList > pNew)
const OUString & GetText() const
bool mbInSetOrResetAttr
boolean, indicating that a <SetAttr(..)> or <ResetAttr(..)> or <ResetAllAttr(..)> method is running.
void TriggerNodeUpdate(const sw::LegacyModifyHint &)
for hanging TextFormatCollections somewhere else (Outline-Numbering!)
SAL_DLLPRIVATE void CalcHiddenCharFlags() const
SAL_DLLPRIVATE SwTextNode * MakeNewTextNode(SwNode &, bool bNext=true, bool bChgFollow=true)
void SetEmptyListStyleDueToSetOutlineLevelAttr()
void RemoveFromListRLHidden()
bool InsertHint(SwTextAttr *const pAttr, const SetAttrMode nMode=SetAttrMode::DEFAULT)
Insert pAttr into hints array.
bool HasHiddenCharAttribute(bool bWholePara) const
Hidden Paragraph Field:
SAL_DLLPRIVATE void SetXParagraph(rtl::Reference< SwXParagraph > const &xParagraph)
void SetAttrOutlineContentVisible(bool bVisible)
bool IsNotifiable() const
Checks a temporary notification blocker and the global conditions of IsNotificationEnabled()
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
void SetGrammarCheck(std::unique_ptr< SwGrammarMarkUp > pNew)
OUString GetRedlineText() const
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
bool DontExpandFormat(sal_Int32 nContentIdx, bool bFlag=true, bool bFormatToTextAttributes=true)
When appropriate set DontExpand-flag at INet or character styles respectively.
std::unique_ptr< SwNodeNum > mpNodeNumOrig
Numbering for this paragraph (before changes)
void ChgTextCollUpdateNum(const SwTextFormatColl *pOld, const SwTextFormatColl *pNew)
std::unique_ptr< SwWrongList > ReleaseWrong()
void NumRuleChgd()
Notify this textnode that its numbering rule has changed.
SwTextFormatColl * GetTextColl() const
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
virtual sal_uInt16 ResetAllAttr() override
std::unique_ptr< SwNodeNum > mpNodeNumRLHidden
Numbering for this paragraph (hidden redlines)
void SetInSwUndo(bool bInUndo)
Used by the UI to modify the document model.
static rtl::Reference< SwXParagraph > CreateXParagraph(SwDoc &rDoc, SwTextNode *pTextNode, css::uno::Reference< css::text::XText > const &xParentText=nullptr, const sal_Int32 nSelStart=-1, const sal_Int32 nSelEnd=- 1)
An SwTextAttr container, stores all directly formatted text portions for a text node.
SwTextAttr * Get(size_t nPos) const
size_t GetFirstPosSortedByWhichAndStart(sal_uInt16 nWhich) const
bool Contains(const SwTextAttr *pHt) const
void Delete(SwTextAttr const *pTextHt)
Delete the given Hint. The Hint must actually be in the array!
void SetInSplitNode(bool bInSplit)
SwTextAttr * GetSortedByWhichAndStart(size_t nPos) const
std::vector< Value >::size_type size_type
std::pair< const_iterator, bool > insert(Value &&x)
void InvalidateInSwCache(const sal_uInt16)
text is moved into pDestNode
ring_container GetRingContainer()
TextNodeNotificationSuppressor(SwTextNode &rNode)
~TextNodeNotificationSuppressor()
static std::shared_ptr< ContentIdxStore > Create()
virtual bool IsExpanded() const =0
virtual const SwPosition & GetMarkEnd() const =0
virtual const SwPosition & GetMarkStart() const =0
struct _xmlTextWriter * xmlTextWriterPtr
virtual OUString GetName() const override
constexpr TypedWhichId< SfxStringItem > RES_FRMATR_STYLE_NAME(134)
#define CH_TXT_ATR_FIELDSEP
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(181)
#define CH_TXT_ATR_INPUTFIELDSTART
constexpr TypedWhichId< SvxFormatKeepItem > RES_KEEP(116)
#define CH_TXT_ATR_FORMELEMENT
constexpr TypedWhichId< SfxStringItem > RES_PARATR_LIST_ID(RES_PARATR_LIST_BEGIN)
bool isTXTATR_WITHEND(const sal_uInt16 nWhich)
bool isTXTATR(const sal_uInt16 nWhich)
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(59)
bool isCHRATR(const sal_uInt16 nWhich)
constexpr sal_uInt16 RES_CHRATR_END(46)
constexpr TypedWhichId< SvxFirstLineIndentItem > RES_MARGIN_FIRSTLINE(91)
constexpr sal_uInt16 RES_UNKNOWNATR_END(160)
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(166)
constexpr sal_uInt16 RES_TXTATR_WITHEND_END(57)
constexpr TypedWhichId< SfxInt16Item > RES_PARATR_LIST_LEVEL(83)
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
constexpr TypedWhichId< SfxStringItem > RES_FRMATR_CONDITIONAL_STYLE_NAME(135)
constexpr TypedWhichId< SfxInt16Item > RES_PARATR_LIST_RESTARTVALUE(85)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SvxEscapementItem > RES_CHRATR_ESCAPEMENT(6)
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(169)
constexpr sal_uInt16 RES_TXTATR_BEGIN(RES_CHRATR_END)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SfxStringItem > HINT_END(RES_TBX_DUMMY)
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
constexpr TypedWhichId< SwFormatContentControl > RES_TXTATR_CONTENTCONTROL(56)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END)
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(58)
constexpr TypedWhichId< SvxRsidItem > RES_CHRATR_RSID(39)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
constexpr TypedWhichId< SvxTextLeftMarginItem > RES_MARGIN_TEXTLEFT(92)
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_METAFIELD(49)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_TXTATR_UNKNOWN_CONTAINER(54)
constexpr TypedWhichId< SfxGrabBagItem > RES_PARATR_GRABBAG(81)
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_META(48)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
constexpr TypedWhichId< SfxUInt16Item > RES_PARATR_OUTLINELEVEL(79)
#define CH_TXT_ATR_INPUTFIELDEND
constexpr TypedWhichId< SfxBoolItem > RES_PARATR_LIST_ISCOUNTED(86)
constexpr TypedWhichId< SvxFormatSplitItem > RES_PARATR_SPLIT(65)
constexpr TypedWhichId< SfxBoolItem > RES_PARATR_LIST_ISRESTART(84)
constexpr TypedWhichId< SvxRsidItem > RES_PARATR_RSID(80)
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
constexpr TypedWhichId< SwFormatRuby > RES_TXTATR_CJK_RUBY(53)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
#define CH_TXT_ATR_FIELDEND
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_OBJECTDYING(RES_FORMAT_MSG_BEGIN)
constexpr sal_uInt16 RES_TXTATR_END(RES_TXTATR_NOEND_END)
#define CH_TXT_ATR_FIELDSTART
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(168)
#define CH_TXTATR_BREAKWORD
WhichRangesContainer const aTextNodeSetRange(svl::Items< RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_PARATR_BEGIN, RES_PARATR_END-1, RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1, RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, XATTR_FILL_FIRST, XATTR_FILL_LAST >)
#define SAL_INFO_IF(condition, area, stream)
#define SAL_WARN_IF(condition, area, stream)
ExpandMode
Some helpers for converting model strings to view strings.
tools::Long tSwNumTreeNumber
std::vector< tSwNumTreeNumber > tNumberVector
double getLength(const B2DPolygon &rCandidate)
OUStringBuffer & remove(OUStringBuffer &rIn, sal_Unicode c)
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Dialog to specify the properties of date form field.
void CheckResetRedlineMergeFlag(SwTextNode &rNode, Recreate eRecreateMerged)
if first node is First, its frames may need to be moved, never deleted.
bool HasNumberingWhichNeedsLayoutUpdate(const SwTextNode &rTextNode)
Decides if rTextNode has a numbering which has layout-level values (e.g.
void MoveMergedFlysAndFootnotes(std::vector< SwTextFrame * > const &rFrames, SwTextNode const &rFirstNode, SwTextNode &rSecondNode, bool)
SwTextFrame * MakeTextFrame(SwTextNode &rNode, SwFrame *, sw::FrameMode eMode)
InsertText MakeInsertText(SwTextNode &rNode, const sal_Int32 nPos, const sal_Int32 nLen)
void AddRemoveFlysAnchoredToFrameStartingAtNode(SwTextFrame &rFrame, SwTextNode &rTextNode, std::set< SwNodeOffset > *pSkipped)
rTextNode is the first one of the "new" merge - if rTextNode isn't the same as MergedPara::pFirstNode...
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 ...
std::unique_ptr< sw::MergedPara > CheckParaRedlineMerge(SwTextFrame &rFrame, SwTextNode &rTextNode, FrameMode eMode)
@ Parent
EXPAND : (Start < nIndex <= End)
@ Expand
DEFAULT: (Start <= nIndex < End)
static bool lcl_GetTextAttrExpand(sal_Int32 nIndex, sal_Int32 nHintStart, sal_Int32 nHintEnd)
static bool lcl_GetTextAttrParent(sal_Int32 nIndex, sal_Int32 nHintStart, sal_Int32 nHintEnd)
static void Replace0xFF(SwTextNode const &rNode, OUStringBuffer &rText, sal_Int32 &rTextStt, sal_Int32 nEndPos)
static SwCharFormat * lcl_FindCharFormat(const SwCharFormats *pCharFormats, std::u16string_view rName)
#define CHECK_SWPHINTS(pNd)
static bool lcl_GetTextAttrDefault(sal_Int32 nIndex, sal_Int32 nHintStart, sal_Int32 nHintEnd)
static SwList * FindList(SwTextNode *const pNode)
static void lcl_CopyHint(const sal_uInt16 nWhich, const SwTextAttr *const pHt, SwTextAttr *const pNewHt, SwDoc *const pOtherDoc, SwTextNode *const pDest)
#define CHECK_SWPHINTS_IF_FRM(pNd)
static void lcl_GetTextAttrs(std::vector< SwTextAttr * > *const pVector, SwTextAttr **const ppTextAttr, SwpHints const *const pSwpHints, sal_Int32 const nIndex, sal_uInt16 const nWhich, ::sw::GetTextAttrMode const eMode)
static void lcl_ChangeFootnoteRef(SwTextNode &rNode)
std::vector< SwTextAttr * > SwpHts
@ Table
SwTableNode is derived from SwStartNode.
@ Section
SwSectionNode is derived from SwStartNode.
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
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.
bool IsInvalidItem(const SfxPoolItem *pItem)
Marks a position in the document model.
SwNodeOffset GetNodeIndex() const
const SwNodes & GetNodes() const
sal_Int32 GetContentIndex() const
const SfxPoolItem * m_pOld
const SfxPoolItem * m_pNew
@ IS_COPY
The inserted item is a copy – intended for use in ndtxt.cxx.
@ NOHINTADJUST
attention: NOHINTADJUST prevents MergePortions! when using this need to pay attention to ignore start...
constexpr sal_uInt8 MAXLEVEL
SwTextAttr * MakeTextAttr(SwDoc &rDoc, SfxPoolItem &rAttr, sal_Int32 const nStt, sal_Int32 const nEnd, CopyOrNewType const bIsCopy, SwTextNode *const pTextNode)
if COPY then pTextNode must be given!
T static_txtattr_cast(S *s)
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)