26#include <osl/diagnose.h>
84#define CHECK Check(true);
85#define CHECK_NOTMERGED Check(false);
87#define CHECK_NOTMERGED
95 , m_bInSplitNode(false)
96 , m_bCalcHiddenParaField(false)
97 , m_bHiddenByParaField(false)
100 , m_bStartMapNeedsSorting(false)
101 , m_bEndMapNeedsSorting(false)
102 , m_bWhichMapNeedsSorting(false)
111 static_txtattr_cast<SwTextMeta *>(pAttr)->ChgTextNode(
nullptr);
115 static_txtattr_cast<SwTextContentControl*>(pAttr)->ChgTextNode(
nullptr);
142bool isOverlap(
const sal_Int32 nStart1,
const sal_Int32 nEnd1,
143 const sal_Int32 nStart2,
const sal_Int32 nEnd2)
146 ((nStart1 > nStart2) && (nStart1 < nEnd2) && (nEnd1 > nEnd2))
147 || ((nStart1 < nStart2) && (nStart2 < nEnd1) && (nEnd1 < nEnd2));
153 const sal_Int32 nStart2,
const sal_Int32 nEnd2)
155 return ((nStart1 == nStart2) || (nEnd1 == nEnd2))
157 ? (nStart1 != nEnd1) || (nStart2 == nEnd2)
158 : ((nStart1 < nStart2) ? (nEnd1 >= nEnd2) : (nEnd1 <= nEnd2));
189enum Split_t { FAIL, SPLIT_NEW, SPLIT_OTHER };
198splitPolicy(
const sal_uInt16 nWhichNew,
const sal_uInt16 nWhichOther)
224 pFormat->Add(
this );
232 pFormat->Add(
this );
240 const sal_Int32 nStart,
const sal_Int32 nEnd)
244 switch (pNew->
Which())
248 static_txtattr_cast<SwTextINetFormat*>(pNew)->InitINetFormat(rNode);
253 static_txtattr_cast<SwTextRuby*>(pNew)->InitRuby(rNode);
257 assert(!
"MakeTextAttrNesting: what the hell is that?");
260 return static_txtattr_cast<SwTextAttrNesting*>(pNew);
265static NestList_t::iterator
267 NestList_t::iterator
const iter, sal_Int32
const nSplitPos,
268 bool const bSplitAtStart,
bool const bOtherDummy)
270 const sal_Int32 nStartPos(
271 (bSplitAtStart && bOtherDummy) ? nSplitPos + 1 : nSplitPos );
273 rNode, **iter, nStartPos, *(*iter)->GetEnd() ) );
274 (*iter)->SetEnd(nSplitPos);
275 return rSplits.insert(iter + 1, pNew);
280 const sal_Int32 nNewStart,
281 const sal_Int32 nOtherStart,
const sal_Int32 nOtherEnd,
bool bOtherDummy)
283 const bool bSplitAtStart(nNewStart < nOtherStart);
284 const sal_Int32 nSplitPos( bSplitAtStart ? nOtherStart : nOtherEnd );
286 NestList_t::iterator
const iter(
287 std::find_if( rSplits.begin(), rSplits.end(),
289 return TextAttrContains(nSplitPos, pAttr);
291 if (iter != rSplits.end())
293 lcl_DoSplitImpl(rSplits, rNode, iter, nSplitPos, bSplitAtStart, bOtherDummy);
381 const sal_uInt16 nNewWhich( rNewHint.
Which() );
382 const sal_Int32 nNewStart( rNewHint.
GetStart() );
383 const sal_Int32 nNewEnd ( *rNewHint.
GetEnd() );
397 SplitNew.push_back(& rNewHint);
400 for (
size_t i = 0;
i <
Count(); ++
i )
406 const sal_uInt16 nOtherWhich( pOther->
Which() );
407 const sal_Int32 nOtherStart( pOther->
GetStart() );
408 const sal_Int32 nOtherEnd ( *pOther->
GetEnd() );
409 if (
isOverlap(nNewStart, nNewEnd, nOtherStart, nOtherEnd ))
414 SAL_INFO(
"sw.core",
"cannot insert hint: overlap");
415 for (
const auto& aSplit : SplitNew)
423 OverlappingExisting.push_back(
424 static_txtattr_cast<SwTextAttrNesting*>(pOther));
427 assert(!
"bad code monkey");
431 else if (
isNestedAny(nNewStart, nNewEnd, nOtherStart, nOtherEnd))
433 if (!bNewSelfNestable && (nNewWhich == nOtherWhich))
436 OverwrittenExisting.push_back(
437 static_txtattr_cast<SwTextAttrNesting*>(pOther));
439 else if ((nNewStart == nOtherStart) && pOther->
HasDummyChar())
443 assert(!
"ERROR: inserting duplicate CH_TXTATR hint");
445 }
else if (nNewEnd < nOtherEnd) {
451 assert(SplitNew.front()->GetStart() == nNewStart);
452 SplitNew.front()->SetStart(nNewStart + 1);
460 for (
auto iter = SplitNew.begin(); iter != SplitNew.end(); ++iter)
462 SwPaM const temp(rNode, (*iter)->GetStart(), rNode, *(*iter)->GetEnd());
463 std::vector<std::pair<SwNodeOffset, sal_Int32>> Breaks;
469 SAL_INFO(
"sw.core",
"cannot insert hint: fieldmark overlap");
470 assert(SplitNew.size() == 1);
476 for (
auto const& rPos : Breaks)
478 assert(rPos.first == rNode.
GetIndex());
480 rPos.second,
true,
true);
486 assert((
isSplittable(nNewWhich) || SplitNew.size() == 1) &&
487 "splitting the unsplittable ???");
497 for (
auto& rpOther : OverlappingExisting)
499 const sal_Int32 nOtherStart( rpOther->GetStart() );
500 const sal_Int32 nOtherEnd ( *rpOther->GetEnd() );
502 for (
const auto& rpNew : SplitNew)
504 const sal_Int32 nSplitNewStart( rpNew->GetStart() );
505 const sal_Int32 nSplitNewEnd ( *rpNew->GetEnd() );
507 const bool bRemoveOverlap(
508 !bNewSelfNestable && (nNewWhich == rpOther->Which()) );
511 nOtherStart, nOtherEnd))
515 assert(!bRemoveOverlap &&
516 "this one should be in OverwrittenExisting?");
522 assert(!
"existing hint inside new hint: why?");
528 rpOther->SetStart(nSplitNewEnd);
534 SAL_INFO(
"sw.core",
"hints array full :-(");
539 nOtherStart, nSplitNewEnd ) );
547 rpOther->SetEnd(nSplitNewStart);
553 SAL_INFO(
"sw.core",
"hints array full :-(");
558 nSplitNewStart, nOtherEnd ) );
571 SAL_INFO(
"sw.core",
"hints array full :-(");
576 for (
const auto& rpHint : SplitNew)
584 for (
auto& rpOther : OverwrittenExisting)
586 const sal_Int32 nOtherStart( rpOther->GetStart() );
587 const sal_Int32 nOtherEnd ( *rpOther->GetEnd() );
590 if ((nNewStart <= nOtherStart) && (nOtherEnd <= nNewEnd))
597 assert((nOtherStart < nNewStart) || (nNewEnd < nOtherEnd));
603 if (nNewEnd < nOtherEnd)
607 rNode, *rpOther, nNewEnd, nOtherEnd ) );
609 SAL_WARN_IF(!bSuccess,
"sw.core",
"recursive call 1 failed?");
611 if (nOtherStart < nNewStart)
613 rpOther->SetEnd(nNewStart);
615 SAL_WARN_IF(!bSuccess,
"sw.core",
"recursive call 2 failed?");
638 const sal_uInt16 nWhich = rNewHint.
Which();
640 const sal_Int32 nThisStart = rNewHint.
GetStart();
641 const sal_Int32 nThisEnd = *rNewHint.
GetEnd();
642 const bool bNoLengthAttribute = nThisStart == nThisEnd;
644 std::vector<SwTextAttr*> aInsDelHints;
652 if ( !bNoLengthAttribute )
654 for (
size_t i = 0;
i <
Count(); ++
i )
664 sal_Int32 nOtherStart = pOther->
GetStart();
665 const sal_Int32 nOtherEnd = *pOther->
GetEnd();
669 if ( nOtherStart < nThisStart && nThisStart < nOtherEnd )
672 pOther->
GetAttr(), nOtherStart, nThisStart );
675 static_txtattr_cast<SwTextCharFormat*>(pNewAttr)->SetSortNumber(
676 static_txtattr_cast<SwTextCharFormat*>(pOther)->GetSortNumber() );
678 aInsDelHints.push_back( pNewAttr );
684 nOtherStart = nThisStart;
689 if ( nOtherStart < nThisEnd && nThisEnd < nOtherEnd )
692 pOther->
GetAttr(), nOtherStart, nThisEnd );
695 static_txtattr_cast<SwTextCharFormat*>(pNewAttr)->SetSortNumber(
696 static_txtattr_cast<SwTextCharFormat*>(pOther)->GetSortNumber());
698 aInsDelHints.push_back( pNewAttr );
707 for (
const auto& rpHint : aInsDelHints )
722 aBounds.
insert( nThisStart );
723 aBounds.
insert( nThisEnd );
725 if ( !bNoLengthAttribute )
727 for (
size_t i = 0;
i <
Count(); ++
i )
735 const sal_Int32 nOtherStart = pOther->
GetStart();
736 const sal_Int32 nOtherEnd = *pOther->
End();
738 if (nThisStart <= nOtherStart && nOtherStart <= nThisEnd)
739 aBounds.
insert( nOtherStart );
740 if (nThisStart <= nOtherEnd && nOtherEnd <= nThisEnd)
741 aBounds.
insert( nOtherEnd );
745 auto aStartIter = aBounds.
lower_bound( nThisStart );
747 sal_Int32 nPorStart = *aStartIter;
749 bool bDestroyHint =
true;
753 while ( aStartIter != aEndIter || bNoLengthAttribute )
755 OSL_ENSURE( bNoLengthAttribute || nPorStart < *aStartIter,
"AUTOSTYLES: BuildPortion trouble" );
757 const sal_Int32 nPorEnd = bNoLengthAttribute ? nPorStart : *aStartIter;
758 aInsDelHints.clear();
761 for (
size_t i = 0;
i <
Count(); ++
i )
770 const sal_Int32 nOtherStart = pOther->
GetStart();
772 if ( nOtherStart > nPorStart )
775 if ( pOther->
GetEnd() && *pOther->
GetEnd() == nPorEnd && nOtherStart == nPorStart )
777 OSL_ENSURE( *pOther->
GetEnd() == nPorEnd,
"AUTOSTYLES: BuildPortion trouble" );
778 aInsDelHints.push_back( pOther );
788 sal_uInt16 nCharStyleCount = 0;
789 for (
const auto& rpHint : aInsDelHints )
802 bNoLengthAttribute ||
818 const std::shared_ptr<SfxItemSet> & pOldStyle =
static_cast<const SwFormatAutoFormat&
>(pOther->
GetAttr()).GetStyleHandle();
830 aNewSet.
Put( *pItem );
841 if ( aNewSet.
Count() )
844 aNewSet, nPorStart, nPorEnd );
853 if ( nPorStart == nThisStart &&
854 nPorEnd == nThisEnd &&
857 pNewAttr = &rNewHint;
858 bDestroyHint =
false;
863 nPorStart, nPorEnd );
864 static_txtattr_cast<SwTextCharFormat*>(pNewAttr)->SetSortNumber(nCharStyleCount);
872 for (
const auto& rpHint : aInsDelHints )
875 pCurrentAutoStyle = rpHint;
877 pCurrentCharFormat = rpHint;
881 if ( pCurrentAutoStyle )
883 const std::shared_ptr<SfxItemSet> & pCurrentStyle =
static_cast<const SwFormatAutoFormat&
>(pCurrentAutoStyle->
GetAttr()).GetStyleHandle();
887 aNewSet.
Put( *pNewStyle );
900 if ( SfxItemState::SET == rWholeParaAttrSet.
GetItemState( pItem->
Which(),
false, &pTmpItem ) &&
908 while ((pItem = aIter2.
NextItem()));
912 Delete( pCurrentAutoStyle );
916 if ( aNewSet.
Count() )
918 nPorStart, nPorEnd );
923 bool bOptimizeAllowed =
true;
927 if ( !bNoLengthAttribute && rNode.
HasSwAttrSet() && pNewStyle->Count() )
929 std::unique_ptr<SfxItemSet> pNewSet;
938 if ( SfxItemState::SET == rWholeParaAttrSet.
GetItemState( pItem->
Which(),
false, &pTmpItem ) &&
945 pNewSet = pNewStyle->
Clone();
946 pNewSet->ClearItem( pItem->
Which() );
950 while ((pItem = aIter2.
NextItem()));
954 bOptimizeAllowed =
false;
955 if ( pNewSet->Count() )
965 if ( bOptimizeAllowed &&
966 nPorStart == nThisStart &&
967 nPorEnd == nThisEnd )
969 pNewAttr = &rNewHint;
970 bDestroyHint =
false;
972 else if ( pNewStyle )
975 nPorStart, nPorEnd );
987 if ( !bNoLengthAttribute )
989 nPorStart = *aStartIter;
1003 switch (rAttr.
Which())
1018 assert(!
"unsupported redline attribute");
1033 sal_Int32
const nStt,
1034 sal_Int32
const nEnd,
1044 aItemSet.
Put( rAttr );
1053 const std::shared_ptr<SfxItemSet> & pAutoStyle =
static_cast<const SwFormatAutoFormat&
>(rAttr).GetStyleHandle();
1054 std::unique_ptr<const SfxItemSet> pNewSet(
1055 pAutoStyle->SfxItemSet::Clone(
true, &rDoc.
GetAttrPool() ));
1066 switch( rNew.
Which() )
1099 pField.SetPostItId();
1113 if (
static_cast<const SwFormatFlyCnt &
>(rAttr).GetTextFlyCnt() )
1116 static_cast<SwTextFlyCnt *
>(pNew)->CopyFlyFormat( rDoc );
1139 if (pTOXType && &pTOXType->
GetDoc() != &rDoc)
1175 sal_Int32 nStt, sal_Int32 nEnd )
1193 switch( pAttr->
Which() )
1217 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pAttr));
1233 if (
GetDoc().FieldCanHideParaWeight(pFieldType->
Which()))
1236 switch( pFieldType->
Which() )
1276 auto pTextMeta = static_txtattr_cast<SwTextMeta*>(pAttr);
1282 static constexpr OUStringLiteral metaNS(
u"urn:bails");
1283 const css::uno::Reference<css::rdf::XResource> xSubject = pMeta->MakeUnoObject();
1284 uno::Reference<frame::XModel>
xModel = pDocSh->GetBaseModel();
1289 static_txtattr_cast<SwTextMeta*>(pAttr)->ChgTextNode(
nullptr);
1294 static_txtattr_cast<SwTextContentControl*>(pAttr)->ChgTextNode(
nullptr);
1307 const sal_Int32 nStart,
1308 const sal_Int32 nEnd,
1313 "SwTextNode::InsertItem should not be called with character attributes");
1326 const bool bSuccess(
InsertHint( pNew, nMode ) );
1342 bool bHiddenPara =
false;
1356 const sal_Int32 nStart( pAttr->
GetStart() );
1361 switch( pAttr->
Which() )
1378 OUString
const ins(
InsertText(c, aIdx, nInsertFlags) );
1390 (RndStdIds::FLY_AS_CHAR == pAnchor->
GetAnchorId()) &&
1410 bool bCheckControlLayer =
false;
1412 if( bCheckControlLayer )
1425 Update(aTmpIdx, 1, UpdateMode::Negative);
1456 Update(aTmpIdx, 1, UpdateMode::Negative);
1478 SwNodeOffset nEndIdx = rNodes[ nSttIdx++ ]->EndOfSectionIndex();
1479 for( ; nSttIdx < nEndIdx; ++nSttIdx )
1482 if(
nullptr != pCNd )
1486 pTable->DelFrames();
1498 OUString
const ins(
InsertText(c, aNdIdx, nInsertFlags) );
1523 if( !pTextFootnote )
1533 OSL_ENSURE( bSuccess,
"FootnoteIdx not inserted." );
1564 aIdx, nInsertFlags) );
1572 const sal_Int32* pEnd(pAttr->
GetEnd());
1575 pAttr->
SetEnd(*pEnd + 1);
1593 pAttr->
SetEnd(*pEnd + 1);
1600 sal_Int32 nEnd = nStart;
1601 bool bInputFieldStartCharInserted =
false;
1602 bool bInputFieldEndCharInserted =
false;
1603 const bool bHasContent( pAttr->
HasContent() );
1606 switch( pAttr->
Which() )
1611 if ( pTextInputField )
1620 const sal_Int32*
const pEnd(pAttr->
GetEnd());
1621 assert(pEnd !=
nullptr);
1622 pAttr->
SetEnd(*pEnd + aContent.getLength());
1632 bInputFieldStartCharInserted =
true;
1633 const sal_Int32*
const pEnd(pAttr->
GetEnd());
1634 assert(pEnd !=
nullptr);
1635 pAttr->
SetEnd(*pEnd + 1);
1639 const sal_Int32*
const pEnd(pAttr->
GetEnd());
1640 assert(pEnd !=
nullptr);
1645 bInputFieldEndCharInserted =
true;
1646 pAttr->
SetEnd(*pEnd + 1);
1661 bool bInsertHint =
true;
1664 if ( pTextInputField !=
nullptr )
1666 if ( pAttr->
End() ==
nullptr )
1668 bInsertHint =
false;
1677 if ( *(pAttr->
End()) < *(pTextInputField->
End()) )
1679 pAttr->
SetEnd(*(pTextInputField->
End()));
1689 auto* pTextContentControl = static_txtattr_cast<SwTextContentControl*>(
1691 if (pTextContentControl)
1693 auto& rFormatContentControl
1695 std::shared_ptr<SwContentControl> pContentControl
1697 if (pAttr->
End() !=
nullptr && pContentControl->GetPlainText())
1699 if (pAttr->
GetStart() > pTextContentControl->GetStart())
1701 pAttr->
SetStart(pTextContentControl->GetStart());
1703 if (*pAttr->
End() < *pTextContentControl->End())
1705 pAttr->
SetEnd(*pTextContentControl->End());
1711 const bool bRet = bInsertHint
1712 &&
m_pSwpHints->TryInsertHint( pAttr, *
this, nMode );
1732 && (nEnd - nStart) > 0 )
1739 if ( bInputFieldEndCharInserted
1740 && (nEnd - nStart) > 0 )
1746 if ( bInputFieldStartCharInserted )
1767 OSL_FAIL(
"DeleteAttribute called, but text node without hints?");
1781 assert(pAttr->
End() !=
nullptr);
1802 const sal_uInt16 nWhich,
1803 const sal_Int32 nStart,
1804 const sal_Int32 nEnd )
1812 const sal_Int32 nHintStart = pTextHt->
GetStart();
1813 if (nStart < nHintStart)
1817 else if ( (nStart == nHintStart) && (nWhich == pTextHt->
Which()) )
1821 assert(!
"hey, that's a CHRATR! how did that get in?");
1842 sal_Int32
const *
const pEndIdx = pTextHt->
GetEnd();
1854 OSL_ENSURE( pTextHt->
End() !=
nullptr,
"<SwTextNode::DeleteAttributes(..)> - missing End() at <SwTextAttr> instance which has content" );
1857 else if( *pEndIdx == nEnd )
1878 sal_Int32 nFndPos = nStt;
1879 sal_Int32 nEndPos = nEnd;
1883 if (nFndPos<0 || nFndPos>=nEndPos )
1908 const sal_Int32 nStt,
1909 const sal_Int32 nEnd,
1921 if ( !nStt && (nEnd ==
m_Text.getLength()) &&
1926 bool bHasCharFormats =
false;
1933 bHasCharFormats =
true;
1939 if( !bHasCharFormats )
1941 aTextSet.Put(
rSet );
1947 if( !aTextSet.Count() )
1954 const bool bRet =
SetAttr( *pItem->GetStyleHandle() );
1955 if( 1 == aTextSet.Count() )
1976 const sal_uInt16 nWhich = pItem->
Which();
1978 "SwTextNode::SetAttr(): unknown attribute" );
1982 (
GetDoc().GetDfltCharFormat() ==
1993 aCharSet.
Put( *pItem );
2003 if (ppNewTextAttr && !*ppNewTextAttr)
2004 *ppNewTextAttr = pNew;
2005 if ( nEnd != nStt && !pNew->
GetEnd() )
2007 OSL_FAIL(
"Attribute without end, but area marked");
2022 if ( aCharSet.
Count() )
2050 ( SfxItemState::SET == aIter.
GetItemState(
true, &pItem ) ) )
2076 ( SfxItemState::SET == aIter.
GetItemState(
true, &pItem ) ) )
2101struct SwPoolItemEndPair
2107 SwPoolItemEndPair() : mpItem( nullptr ), mnEndPos( 0 ) {};
2125 if (indents & ::sw::ListLevelIndents::FirstLine)
2141 const bool bOnlyTextAttr,
const bool bGetFromChrFormat,
2142 const bool bMergeIndentValuesOfNumRule,
2161 if (bMergeIndentValuesOfNumRule)
2188 for (
size_t n = 0;
n < nSize; ++
n)
2191 const sal_Int32 nAttrStart = pHt->
GetStart();
2192 if (nAttrStart > nEnd)
2195 const sal_Int32* pAttrEnd = pHt->
End();
2199 if( ( nAttrStart < nStt &&
2201 : nStt <= *pAttrEnd )) ||
2202 ( nStt == nAttrStart &&
2203 ( nAttrStart == *pAttrEnd || !nStt )))
2210 std::optional< std::vector< SwPoolItemEndPair > > pAttrArr;
2214 for (
size_t n = 0;
n < nSize; ++
n)
2217 const sal_Int32 nAttrStart = pHt->
GetStart();
2218 if (nAttrStart > nEnd)
2221 const sal_Int32* pAttrEnd = pHt->
End();
2225 bool bChkInvalid =
false;
2226 if (nAttrStart <= nStt)
2228 if (*pAttrEnd <= nStt)
2231 if (nEnd <= *pAttrEnd)
2232 (*fnMergeAttr)( aFormatSet, pHt->
GetAttr() );
2238 else if (nAttrStart < nEnd
2245 std::optional< SfxItemIter > oItemIter;
2253 oItemIter.emplace( *pAutoSet );
2254 pItem = oItemIter->GetCurItem();
2260 const sal_Int32 nHintEnd = *pAttrEnd;
2262 for (; pItem; pItem = oItemIter ? oItemIter->NextItem() :
nullptr)
2264 const sal_uInt16 nHintWhich = pItem->
Which();
2266 "SwTextNode::GetAttr(): unknown attribute?");
2270 pAttrArr = std::vector< SwPoolItemEndPair >(coArrSz);
2273 std::vector< SwPoolItemEndPair >::iterator pPrev = pAttrArr->begin();
2281 pPrev = pAttrArr->end();
2284 if( pPrev != pAttrArr->end() )
2286 if( !pPrev->mpItem )
2288 if ( bOnlyTextAttr || *pItem != aFormatSet.
Get( nHintWhich ) )
2290 if( nAttrStart > nStt )
2297 pPrev->mpItem = pItem;
2298 pPrev->mnEndPos = nHintEnd;
2304 if( pPrev->mnEndPos == nAttrStart &&
2305 *pPrev->mpItem == *pItem )
2307 pPrev->mpItem = pItem;
2308 pPrev->mnEndPos = nHintEnd;
2323 for (
size_t n = 0;
n < coArrSz; ++
n)
2325 const SwPoolItemEndPair& rItemPair = (*pAttrArr)[
n ];
2328 const sal_uInt16 nWh =
2331 if (nEnd <= rItemPair.mnEndPos)
2333 if( *rItemPair.mpItem != aFormatSet.
Get( nWh ) )
2334 (*fnMergeAttr)(
rSet, *rItemPair.mpItem );
2343 if( aFormatSet.
Count() )
2350 if (aFormatSet.
Count())
2362typedef std::pair<sal_Int32, sal_Int32> AttrSpan_t;
2363typedef std::multimap<AttrSpan_t, const SwTextAttr*> AttrSpanMap_t;
2368 operator()(
const AttrSpanMap_t::value_type& i_rAttrSpan)
2378struct RemovePresentAttrs
2380 explicit RemovePresentAttrs(
SfxItemSet& io_rAttrSet)
2381 : m_rAttrSet(io_rAttrSet)
2386 operator()(
const AttrSpanMap_t::value_type& i_rAttrSpan)
2389 if (!i_rAttrSpan.second)
2394 const SwTextAttr*
const pAutoStyle(i_rAttrSpan.second);
2396 for (
const SfxPoolItem* pItem(aIter.GetCurItem()); pItem; pItem = aIter.NextItem())
2398 const sal_uInt16 nWhich(pItem->Which());
2417lcl_CollectHintSpans(
const SwpHints& i_rHints,
const sal_Int32 nLength,
2418 AttrSpanMap_t& o_rSpanMap)
2420 sal_Int32 nLastEnd(0);
2422 for (
size_t i = 0;
i < i_rHints.
Count(); ++
i)
2425 const sal_uInt16 nWhich(pHint->
Which());
2428 const AttrSpan_t aSpan(pHint->
GetStart(), *pHint->
End());
2429 o_rSpanMap.emplace(aSpan, pHint);
2432 if (nLastEnd < aSpan.first)
2435 o_rSpanMap.emplace( AttrSpan_t(nLastEnd, aSpan.first),
nullptr );
2438 nLastEnd = aSpan.second;
2443 if (nLastEnd != nLength && nLength != 0)
2445 o_rSpanMap.emplace(AttrSpan_t(nLastEnd, nLength),
nullptr);
2450lcl_FillWhichIds(
const SfxItemSet& i_rAttrSet, std::vector<sal_uInt16>& o_rClearIds)
2452 o_rClearIds.reserve(i_rAttrSet.
Count());
2454 for (
const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
2456 o_rClearIds.push_back(pItem->Which());
2460struct SfxItemSetClearer
2463 explicit SfxItemSetClearer(
SfxItemSet & rItemSet) : m_rItemSet(rItemSet) { }
2464 void operator()(sal_uInt16
const nWhich) { m_rItemSet.
ClearItem(nWhich); }
2475 typedef AttrSpanMap_t::iterator AttrSpanMap_iterator_t;
2476 AttrSpanMap_t aAttrSpanMap;
2478 if (i_rAttrSet.
Count() == 0)
2489 AttrSpanMap_iterator_t aCurRange(aAttrSpanMap.begin());
2490 const AttrSpanMap_iterator_t aEnd(aAttrSpanMap.end());
2491 while (aCurRange != aEnd)
2493 typedef std::pair<AttrSpanMap_iterator_t, AttrSpanMap_iterator_t>
2495 AttrSpanMapRange_t aRange(aAttrSpanMap.equal_range(aCurRange->first));
2500 std::for_each(aRange.first, aRange.second, RemovePresentAttrs(aCurSet));
2504 if (aCurSet.
Count() != 0)
2506 AttrSpanMap_iterator_t aAutoStyleIt(
2507 std::find_if(aRange.first, aRange.second, IsAutoStyle()));
2508 if (aAutoStyleIt != aRange.second)
2513 const std::shared_ptr<SfxItemSet> pOldStyle(
2516 aCurSet.
Put(*pOldStyle);
2524 aCurRange->first.first, aCurRange->first.second));
2527 aCurRange = aRange.second;
2534 std::vector<sal_uInt16> aClearedIds;
2535 lcl_FillWhichIds(i_rAttrSet, aClearedIds);
2570 std::vector<sal_uInt16> aProcessedIds;
2572 if( aThisSet.
Count() )
2577 std::vector<sal_uInt16> aClearWhichIds;
2581 if( SfxItemState::SET == aNdSet.
GetItemState( pItem->
Which(),
false, &pNdItem ) )
2583 if (*pItem == *pNdItem)
2585 aClearWhichIds.push_back( pItem->
Which() );
2589 aConvertSet.
Put(*pItem);
2591 aProcessedIds.push_back(pItem->
Which());
2595 aConvertSet.
Put(*pItem);
2609 std::for_each(aProcessedIds.begin(), aProcessedIds.end(),
2610 SfxItemSetClearer(aNdSet));
2615 if( aNdSet.
Count() )
2631 const size_t nSize =
Count();
2635 switch( pAttr->
Which() )
2661 bool bNewHiddenByParaField =
false;
2662 int nNewResultWeight = 0;
2663 const size_t nSize =
Count();
2669 const sal_uInt16 nWhich = pTextHt->
Which();
2676 if (nCurWeight > nNewResultWeight)
2678 nNewResultWeight = nCurWeight;
2681 else if (nCurWeight == nNewResultWeight && bNewHiddenByParaField)
2691 return bOldHiddenByParaField != bNewHiddenByParaField;
2703 bool isRsidOnlyAutoFormat;
2705typedef std::vector< Portion > PortionMap;
2706enum MergeResult { MATCH, DIFFER_ONLY_RSID, DIFFER };
2711 const std::pair< PortionMap::const_iterator, PortionMap::const_iterator >& aRange1,
2712 const std::pair< PortionMap::const_iterator, PortionMap::const_iterator >& aRange2,
2713 std::vector<bool>& RsidOnlyAutoFormatFlagMap);
2724 PortionMap aPortionMap;
2725 aPortionMap.reserve(
Count() + 1);
2726 std::vector<bool> RsidOnlyAutoFormatFlagMap;
2727 RsidOnlyAutoFormatFlagMap.resize(
Count() + 1);
2732 for (
size_t i = 0;
i <
Count(); ++
i )
2741 bool isRsidOnlyAutoFormat(
false);
2745 std::shared_ptr<SfxItemSet>
const & pSet(
2766 isRsidOnlyAutoFormat =
true;
2777 const sal_Int32 nPorStart = pHt->
GetStart();
2778 if (nPorStart != nLastPorStart)
2780 nLastPorStart = nPorStart;
2781 aPortionMap.push_back(Portion {pHt, nKey, isRsidOnlyAutoFormat});
2782 RsidOnlyAutoFormatFlagMap[nKey] = isRsidOnlyAutoFormat;
2786 auto equal_range = [](PortionMap::const_iterator startIt, PortionMap::const_iterator endIt,
int i)
2789 while (it1 != endIt && it1->nKey <
i)
2792 while (it2 != endIt && it2->nKey ==
i)
2794 return std::pair<PortionMap::const_iterator, PortionMap::const_iterator>{ it1, it2 };
2803 std::pair< PortionMap::const_iterator, PortionMap::const_iterator > aRange1 { aPortionMap.begin(), aPortionMap.begin() + aPortionMap.size() };
2806 aRange1 = equal_range( aRange1.first, aPortionMap.begin() + aPortionMap.size(),
i );
2808 std::pair< PortionMap::const_iterator, PortionMap::const_iterator > aRange2
2809 = equal_range( aRange1.second, aPortionMap.begin() + aPortionMap.size(), j );
2813 if (MATCH == eMerge)
2818 sal_Int32 nNewPortionEnd = 0;
2819 for (
auto aIter2 = aRange2.first; aIter2 != aRange2.second; ++aIter2 )
2822 nNewPortionEnd = *p2->
GetEnd();
2824 const size_t nCountBeforeDelete =
Count();
2828 if (
Count() < nCountBeforeDelete )
2831 aPortionMap.erase( aRange2.first, aRange2.second );
2835 aRange1 = equal_range( aRange1.first, aPortionMap.begin() + aPortionMap.size(),
i );
2836 for (
auto aIter1 = aRange1.first; aIter1 != aRange1.second; ++aIter1 )
2840 p1->
SetEnd(nNewPortionEnd);
2854 bool const bSetIgnoreFlag(DIFFER_ONLY_RSID == eMerge);
2855 for (
auto aIter1 = aRange1.first; aIter1 != aRange1.second; ++aIter1)
2857 if (!aIter1->isRsidOnlyAutoFormat)
2859 SwTextAttr *
const pCurrent(aIter1->pTextAttr);
2868 for (
auto aIter2 = aRange2.first; aIter2 != aRange2.second; ++aIter2)
2870 if (!aIter2->isRsidOnlyAutoFormat)
2872 SwTextAttr *
const pCurrent(aIter2->pTextAttr);
2892 const std::pair< PortionMap::const_iterator, PortionMap::const_iterator >& aRange1,
2893 const std::pair< PortionMap::const_iterator, PortionMap::const_iterator >& aRange2,
2894 std::vector<bool>& RsidOnlyAutoFormatFlagMap)
2896 PortionMap::const_iterator aIter1 = aRange1.first;
2897 PortionMap::const_iterator aIter2 = aRange2.first;
2899 size_t const nAttributesInPor1 = std::distance(aRange1.first, aRange1.second);
2900 size_t const nAttributesInPor2 = std::distance(aRange2.first, aRange2.second);
2901 bool const isRsidOnlyAutoFormat1 =
i < sal_Int32(RsidOnlyAutoFormatFlagMap.size()) && RsidOnlyAutoFormatFlagMap[
i];
2902 bool const isRsidOnlyAutoFormat2 = j < sal_Int32(RsidOnlyAutoFormatFlagMap.size()) && RsidOnlyAutoFormatFlagMap[j];
2905 bool const bSkipRsidOnlyAutoFormat(nAttributesInPor1 != nAttributesInPor2);
2910 if (!((nAttributesInPor1 - (isRsidOnlyAutoFormat1 ? 1 : 0)) ==
2911 (nAttributesInPor2 - (isRsidOnlyAutoFormat2 ? 1 : 0))
2912 && (nAttributesInPor1 != 0 || nAttributesInPor2 != 0)))
2917 MergeResult eMerge(MATCH);
2922 while (aIter1 != aRange1.second || aIter2 != aRange2.second)
2925 if (aIter1 != aRange1.second && aIter2 != aRange2.second &&
2926 *aIter1->pTextAttr->End() < aIter2->pTextAttr->GetStart())
2931 if (bSkipRsidOnlyAutoFormat
2932 && aIter1 != aRange1.second && aIter1->isRsidOnlyAutoFormat)
2934 assert(DIFFER != eMerge);
2935 eMerge = DIFFER_ONLY_RSID;
2939 if (bSkipRsidOnlyAutoFormat
2940 && aIter2 != aRange2.second && aIter2->isRsidOnlyAutoFormat)
2942 assert(DIFFER != eMerge);
2943 eMerge = DIFFER_ONLY_RSID;
2947 assert(aIter1 != aRange1.second && aIter2 != aRange2.second);
2948 SwTextAttr const*
const p1 = aIter1->pTextAttr;
2949 SwTextAttr const*
const p2 = aIter2->pTextAttr;
2974 if (!pItem1 && !pItem2)
2976 eMerge = DIFFER_ONLY_RSID;
2979 if (!pItem1 || !pItem2)
2983 if (pItem1 != pItem2)
3002 const sal_Int32 nHtStart = rNewCharFormat.
GetStart();
3003 const sal_Int32 nHtEnd = *rNewCharFormat.
GetEnd();
3004 sal_uInt16 nSortNumber = 0;
3006 for (
size_t i = 0;
i < rHints.
Count(); ++
i )
3010 const sal_Int32 nOtherStart = pOtherHt->
GetStart();
3012 if ( nOtherStart > nHtStart )
3017 const sal_Int32 nOtherEnd = *pOtherHt->
End();
3019 if ( nOtherStart == nHtStart && nOtherEnd == nHtEnd )
3021 nSortNumber = static_txtattr_cast<const SwTextCharFormat*>(pOtherHt)->GetSortNumber() + 1;
3026 if ( nSortNumber > 0 )
3044 OSL_FAIL(
"hints array full :-(");
3049 const sal_Int32 *pHtEnd = pHint->
GetEnd();
3050 const sal_uInt16 nWhich = pHint->
Which();
3051 std::vector<sal_uInt16> aWhichSublist;
3062 static_txtattr_cast<SwTextCharFormat*>(pHint)->ChgTextNode( &rNode );
3084 for(
auto const & rPair : pRanges)
3086 const sal_uInt16 nBeg = rPair.first;
3087 const sal_uInt16 nEnd = rPair.second;
3088 for( sal_uInt16 nSubElem = nBeg; nSubElem <= nEnd; ++nSubElem )
3089 if( pSet->HasItem( nSubElem ) )
3090 aWhichSublist.push_back( nSubElem );
3095 static_txtattr_cast<SwTextINetFormat*>(pHint)->InitINetFormat(rNode);
3102 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pHint));
3103 bool bDelFirst =
nullptr != pTextField->
GetpTextNode();
3137 bool bInsFieldType =
false;
3148 if( pFieldType != pField->
GetTyp() )
3185 static_txtattr_cast<SwTextRefMark*>(pHint)->ChgTextNode( &rNode );
3190 for(
size_t n = 0, nEnd =
Count();
n < nEnd; ++
n )
3192 const sal_Int32 *pTmpHtEnd;
3193 const sal_Int32 *pTmpHintEnd;
3196 nullptr != ( pTmpHtEnd = pTmpHt->
GetEnd() ) &&
3197 nullptr != ( pTmpHintEnd = pHint->
GetEnd() ) )
3202 bool bDelOld =
true, bChgStart =
false, bChgEnd =
false;
3222 pHint->
SetEnd(*pTmpHtEnd);
3235 static_txtattr_cast<SwTextTOXMark*>(pHint)->ChgTextNode( &rNode );
3239 static_txtattr_cast<SwTextRuby*>(pHint)->InitRuby(rNode);
3244 static_txtattr_cast<SwTextMeta *>(pHint)->ChgTextNode( &rNode );
3248 static_txtattr_cast<SwTextContentControl*>(pHint)->ChgTextNode( &rNode );
3263 sal_Int32 nHtStart = pHint->
GetStart();
3274 if(rNode.HasWriterListeners())
3289 if( *pHtEnd < nHtStart )
3291 assert(*pHtEnd >= nHtStart);
3300 const sal_Int32 nHintEnd = *pHtEnd;
3308 if (!bRet)
return false;
3315 else if ( !bNoHintAdjustMode &&
3327 if ( nHtStart < nHintEnd )
3336 if (!bNoHintAdjustMode
3355 if ( rNode.HasWriterListeners() )
3357 const SwUpdateAttr aHint(nHtStart, nHintEnd, nWhich, std::move(aWhichSublist));
3390 assert(*findIt == pHt);
3394 assert(*findIt2 == pHt);
3401 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pHint));
3418 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pHint));
3432 assert(SAL_MAX_SIZE !=
nPos);
3433 if( SAL_MAX_SIZE !=
nPos )
3443 while ( nPos < m_pSwpHints->
Count() )
3448 switch( pDel->
Which() )
3475 sal_uInt16 nScript )
const
3489 const sal_Int32 nEnd = nBegin + nLen;
3491 for (
size_t i = 0;
i < nSize; ++
i )
3494 const sal_Int32 nAttrStart = pHt->
GetStart();
3495 if( nEnd < nAttrStart )
3498 const sal_uInt16 nWhich = pHt->
Which();
3500 if( nWhichId == nWhich ||
3503 const sal_Int32 *pEndIdx = pHt->
End();
3509 if( nAttrStart >= nEnd || nBegin >= *pEndIdx )
3512 else if( nBegin != nAttrStart || ( nAttrStart != *pEndIdx && nBegin ))
3514 if( nAttrStart >= nBegin )
3516 if( pHt->
DontExpand() ? nBegin >= *pEndIdx : nBegin > *pEndIdx)
3523 if( nAttrStart <= nBegin && nEnd <= *pEndIdx )
3542 switch ( rAttr.
Which() )
3567 assert(!
"GetCharOfTextAttr: unknown attr");
virtual void InsDeletedFieldType(SwFieldType &)=0
virtual void InsDelFieldInFieldLst(bool bIns, const SwTextField &rField)=0
virtual bool IsNewFieldLst() const =0
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
virtual std::shared_ptr< SfxItemSet > getAutomaticStyle(const SfxItemSet &rSet, SwAutoStyleFamily eFamily, const OUString *pParentName=nullptr)=0
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
const WhichRangesContainer & GetRanges() const
SfxItemPool * GetPool() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void Differentiate(const SfxItemSet &rSet)
void InvalidateItem(sal_uInt16 nWhich)
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
SfxItemState GetItemState(bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
bool IsCharBackground2Shading() const
static SvtFilterOptions & Get()
sal_uInt16 GetRealScriptOfText(const OUString &rText, sal_Int32 nPos) const
Marks a character position inside a document model content node (SwContentNode)
sal_Int32 GetIndex() const
SwFormatColl * GetFormatColl() const
bool HasSwAttrSet() const
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
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):
const SwAttrSet * GetpSwAttrSet() const
bool FieldHidesPara(const SwField &rField) const
const SwCharFormat * GetDfltCharFormat() const
IDocumentUndoRedo & GetIDocumentUndoRedo()
IStyleAccess & GetIStyleAccess()
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
bool IsInXMLImport() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
SwFootnoteIdxs & GetFootnoteIdxs()
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
int FieldCanHideParaWeight(SwFieldIds eFieldId) const
const SwAttrPool & GetAttrPool() const
::sw::MetaFieldManager & GetMetaFieldManager()
SwDocShell * GetDocShell()
bool IsInHeaderFooter(const SwNode &) const
Instances of SwFields and those derived from it occur 0 to n times.
Base class of all fields.
virtual SwFieldType * ChgTyp(SwFieldType *)
Set new type (used for copying among documents).
SwFieldType * GetTyp() const
SfxPoolItem subclass that wraps an SwContentControl.
const std::shared_ptr< SwContentControl > & GetContentControl() const
static SwTOXType * GetSwTOXType(SwDoc &rDoc, TOXTypes eTOXTypes, const OUString &rTOXName)
SwStartNode * GetStartNode()
SwNodeOffset GetIndex() const
SwNodes & GetNodes()
Node is in which nodes-array/doc?
SwNodeOffset StartOfSectionIndex() const
Merge GetRedlineMergeFlag() const
IStyleAccess & getIDocumentStyleAccess()
Provides access to the document automatic styles interface.
SwTableNode * GetTableNode()
SwNode & GetEndOfAutotext() const
Section for all Flys/Header/Footers.
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc....
SwNode & GetEndOfRedlines() const
Section for all Redlines.
const SwNumFormat & Get(sal_uInt16 i) const
PaM is Point and Mark: a selection of the document model.
void SetName(const OUString &rStr)
static void clearStatements(const css::uno::Reference< css::frame::XModel > &xModel, const OUString &rType, const css::uno::Reference< css::rdf::XResource > &xSubject)
Remove all statements in the graph of type rType, if any exists.
void ChangeNodeIndex(SwNodeOffset nNew)
void AddHint(SwTextAttr *pHt, const bool bNew)
The root element of a Writer document layout.
bool HasMergedParas() const
void SetSeqRefNo(SwSetExpField &rField)
void RegisterToTOXType(SwTOXType &rMark)
const SwTOXType * GetTOXType() const
const OUString & GetTypeName() const
virtual const sal_Int32 * GetEnd() const override
end position
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
void SetFormatIgnoreStart(bool bFlag)
bool IsOverlapAllowedAttr() const
virtual const sal_Int32 * GetEnd() const
end position
bool IsFormatIgnoreStart() const
const sal_Int32 * End() const
const SwFormatFlyCnt & GetFlyCnt() const
sal_Int32 GetStart() const
const SwFormatCharFormat & GetCharFormat() const
virtual void SetEnd(sal_Int32)
void SetFormatIgnoreEnd(bool bFlag)
void SetStart(sal_Int32 n)
start position
bool IsCharFormatAttr() const
const SwFormatAutoFormat & GetAutoFormat() const
void SetDontExpand(bool bDontExpand)
bool HasDummyChar() const
bool IsFormatIgnoreEnd() const
const SwFormatField & GetFormatField() const
void SetSortNumber(sal_uInt16 nSortNumber)
static SwTextContentControl * CreateTextContentControl(SwDoc &rDoc, SwTextNode *pTargetTextNode, SwFormatContentControl &rAttr, sal_Int32 nStart, sal_Int32 nEnd, bool bIsCopy)
void ChgTextNode(SwTextNode *pNew)
SwTextNode * GetpTextNode() const
void SetAnchor(const SwTextNode *pNode)
SetAnchor() is called by SwTextNode::InsertHint() and sets the anchor position in the SwFlyFrameForma...
SwTextAttr subclass that tracks the location of the wrapped SwFormatURL.
SAL_DLLPRIVATE void InitINetFormat(SwTextNode &rNode)
void ChgTextNode(SwTextNode *pNew)
OUString GetFieldContent() const
SwTextAttr subclass that tracks the location of the wrapped SwFormatLineBreak.
static SwTextMeta * CreateTextMeta(::sw::MetaFieldManager &i_rTargetDocManager, SwTextNode *const i_pTargetTextNode, SwFormatMeta &i_rAttr, sal_Int32 const i_nStart, sal_Int32 const i_nEnd, bool const i_bIsCopy)
SwTextNode is a paragraph in the document model.
void DeleteAttributes(const sal_uInt16 nWhich, const sal_Int32 nStart, const sal_Int32 nEnd=0)
delete all attributes of type nWhich at nStart (opt. end nEnd)
const SwTextInputField * GetOverlappingInputField(const SwTextAttr &rTextAttr) const
virtual sal_Int32 Len() const override
void RstTextAttr(const sal_Int32 nContentStart, const sal_Int32 nLen, const sal_uInt16 nWhich=0, const SfxItemSet *pSet=nullptr, const bool bInclRefToxMark=false, const bool bExactRange=false)
delete all attributes.
SwpHints & GetOrCreateSwpHints()
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.
void DeleteAttribute(SwTextAttr *const pTextAttr)
delete the attribute pTextAttr
void DestroyAttr(SwTextAttr *pAttr)
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.
::sw::ListLevelIndents AreListLevelIndentsApplicable() const
Determines, if the list level indent attributes can be applied to the paragraph.
void DelSoftHyph(const sal_Int32 nStart, const sal_Int32 nEnd)
void ClearSwpHintsArr(bool bDelFields)
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
std::unique_ptr< SwpHints > m_pSwpHints
May be 0.
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...
OUString InsertText(const OUString &rStr, const SwContentIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
void SetCalcHiddenCharFlags() const
static bool IsIgnoredCharFormatForNumbering(const sal_uInt16 nWhich, bool bIsCharStyle=false)
In MS Word, the font underline setting of the paragraph end position won't affect the formatting of n...
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
int GetActualListLevel(SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Returns the actual list level of this text node, when it is a list item.
void SetCalcHiddenParaField()
set CalcVisible flags
virtual void Update(SwContentIndex const &rPos, const sal_Int32 nChangeLen, UpdateMode eMode) override
override SwContentIndexReg
SAL_DLLPRIVATE void impl_FormatToTextAttr(const SfxItemSet &i_rAttrSet)
Does the hard work of SwTextNode::FormatToTextAttr: the real conversion of items to automatic styles.
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 TriggerNodeUpdate(const sw::LegacyModifyHint &)
for hanging TextFormatCollections somewhere else (Outline-Numbering!)
bool InsertHint(SwTextAttr *const pAttr, const SetAttrMode nMode=SetAttrMode::DEFAULT)
Insert pAttr into hints array.
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
bool DontExpandFormat(sal_Int32 nContentIdx, bool bFlag=true, bool bFormatToTextAttributes=true)
When appropriate set DontExpand-flag at INet or character styles respectively.
SAL_DLLPRIVATE void InitRuby(SwTextNode &rNode)
void ChgTextNode(SwTextNode *pNew)
The shared part of a user field.
An SwTextAttr container, stores all directly formatted text portions for a text node.
SW_DLLPUBLIC void ResortWhichMap() const
bool m_bFootnote
footnotes
std::vector< SwTextAttr * > m_HintsByWhichAndStart
std::vector< SwTextAttr * > m_HintsByEnd
SwTextAttr * Get(size_t nPos) const
bool m_bEndMapNeedsSorting
SwTextAttr * GetWithoutResorting(size_t nPos) const
bool CalcHiddenParaField() const
void Delete(SwTextAttr const *pTextHt)
Delete the given Hint. The Hint must actually be in the array!
bool m_bDDEFields
the TextNode has DDE fields
size_t GetIndexOf(const SwTextAttr *pHt) const
SwTextAttr * Cut(const size_t nPosInStart)
void SetHiddenByParaField(const bool bNew) const
bool m_bHiddenByParaField
void InsertNesting(SwTextAttrNesting &rNewHint)
Insert nesting hint into the hints array.
SW_DLLPUBLIC void Resort() const
static const size_t MAX_HINTS
SwpHints(const SwTextNode &rParent)
SwTextAttr * GetSortedByEnd(size_t nPos) const
bool m_bCalcHiddenParaField
bool TryInsertNesting(SwTextNode &rNode, SwTextAttrNesting &rNewHint)
The following hints correspond to well-formed XML elements in ODF: RES_TXTATR_INETFMT,...
const SwTextNode & m_rParent
void Insert(SwTextAttr *pHt)
bool m_bWhichMapNeedsSorting
std::vector< SwTextAttr * > m_HintsByStart
SwRegHistory * m_pHistory
for Undo
bool MergePortions(SwTextNode &rNode)
void NoteInHistory(SwTextAttr *pAttr, const bool bNew=false)
records a new attribute in m_pHistory.
void DeleteAtPos(size_t nPos)
bool m_bStartMapNeedsSorting
bool TryInsertHint(SwTextAttr *const pHint, SwTextNode &rNode, const SetAttrMode nMode=SetAttrMode::DEFAULT)
try to insert the hint
SW_DLLPUBLIC void ResortStartMap() const
SW_DLLPUBLIC void ResortEndMap() const
SwRegHistory * GetHistory() const
void BuildPortions(SwTextNode &rNode, SwTextAttr &rNewHint, const SetAttrMode nMode)
const_iterator upper_bound(const Value &x) const
const_iterator begin() const
size_type erase(const Value &x)
std::pair< const_iterator, bool > insert(Value &&x)
const_iterator lower_bound(const Value &x) const
@ Database
For old documents the Field-Which IDs must be preserved !!!
#define CH_TXT_ATR_INPUTFIELDSTART
constexpr TypedWhichId< SvxCrossedOutItem > RES_CHRATR_CROSSEDOUT(5)
bool isTXTATR_WITHEND(const sal_uInt16 nWhich)
bool isTXTATR(const sal_uInt16 nWhich)
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(59)
constexpr TypedWhichId< SvxUnderlineItem > RES_CHRATR_UNDERLINE(14)
bool isUNKNOWNATR(const sal_uInt16 nWhich)
bool isCHRATR(const sal_uInt16 nWhich)
constexpr sal_uInt16 RES_CHRATR_END(46)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SvxFirstLineIndentItem > RES_MARGIN_FIRSTLINE(91)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
constexpr sal_uInt16 RES_TXTATR_WITHEND_END(57)
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CTL_WEIGHT(31)
constexpr TypedWhichId< SvxCharHiddenItem > RES_CHRATR_HIDDEN(37)
constexpr TypedWhichId< SvxEscapementItem > RES_CHRATR_ESCAPEMENT(6)
constexpr sal_uInt16 RES_TXTATR_BEGIN(RES_CHRATR_END)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_BACKGROUND(21)
constexpr TypedWhichId< SvxCaseMapItem > RES_CHRATR_CASEMAP(RES_CHRATR_BEGIN)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CTL_POSTURE(30)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
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 TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(165)
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(58)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
constexpr TypedWhichId< SwFormatLineBreak > RES_TXTATR_LINEBREAK(61)
constexpr TypedWhichId< SvxRsidItem > RES_CHRATR_RSID(39)
constexpr TypedWhichId< SvxTextLeftMarginItem > RES_MARGIN_TEXTLEFT(92)
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_METAFIELD(49)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_TXTATR_UNKNOWN_CONTAINER(54)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CJK_WEIGHT(26)
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_META(48)
#define CH_TXT_ATR_INPUTFIELDEND
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CJK_POSTURE(25)
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
constexpr TypedWhichId< SwFormatRuby > RES_TXTATR_CJK_RUBY(53)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
constexpr sal_uInt16 RES_TXTATR_END(RES_TXTATR_NOEND_END)
#define CH_TXTATR_NEWLINE
#define CH_TXTATR_BREAKWORD
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
WhichRangesContainer const aCharFormatSetRange(svl::Items< RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1 >)
LanguageType GetAppLanguage()
WhichRangesContainer const aCharAutoFormatSetRange(svl::Items< RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1 >)
#define LANGUAGE_DONTKNOW
#define SAL_WARN_IF(condition, area, stream)
#define SAL_INFO(area, stream)
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
const SwGetSetExpType GSE_SEQ
Sequence.
SwTextNode const & GetAttrMerged(SfxItemSet &rFormatSet, SwTextNode const &rNode, SwRootFrame const *pLayout)
void CalcBreaks(std::vector< std::pair< SwNodeOffset, sal_Int32 > > &rBreaks, SwPaM const &rPam, bool const isOnlyFieldmarks)
@ Parent
EXPAND : (Start < nIndex <= End)
SwComparePosition ComparePosition(const T &rStt1, const T &rEnd1, const T &rStt2, const T &rEnd2)
@ OverlapBehind
Pos1 overlaps Pos2 at the end.
@ CollideEnd
Pos1 end touches at Pos2 start.
@ Behind
Pos1 behind Pos2.
@ OverlapBefore
Pos1 overlaps Pos2 at the beginning.
@ Outside
Pos2 completely contained in Pos1.
@ Before
Pos1 before Pos2.
@ Inside
Pos1 completely contained in Pos2.
@ CollideStart
Pos1 start touches at Pos2 end.
@ Equal
Pos1 is as large as Pos2.
@ RES_POOLCHR_INET_NORMAL
Internet normal.
@ RES_POOLCHR_RUBYTEXT
Rubytext.
#define INVALID_POOL_ITEM
bool IsInvalidItem(const SfxPoolItem *pItem)
Marks a position in the document model.
Reference< XModel > xModel
@ NOHINTEXPAND
for Undo, translated to SwInsertFlags::NOHINTEXPAND
@ FORCEHINTEXPAND
Force hint expand (only matters for hints with CH_TXTATR).
@ 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_Int32 COMPLETE_STRING
static bool isNestedAny(const sal_Int32 nStart1, const sal_Int32 nEnd1, const sal_Int32 nStart2, const sal_Int32 nEnd2)
#i106930#: now asymmetric: empty hint1 is not nested, but empty hint2 is
static bool TextAttrContains(const sal_Int32 nPos, const SwTextAttrEnd *const pAttr)
static void lcl_MergeAttr_ExpandChrFormat(SfxItemSet &rSet, const SfxPoolItem &rAttr)
static void TextAttrDelete(SwDoc &rDoc, SwTextAttr *const pAttr)
sal_Unicode GetCharOfTextAttr(const SwTextAttr &rAttr)
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!
static bool isSplittable(const sal_uInt16 nWhich)
static bool isOverlap(const sal_Int32 nStart1, const sal_Int32 nEnd1, const sal_Int32 nStart2, const sal_Int32 nEnd2)
static void lcl_MergeListLevelIndentAsLRSpaceItem(const SwTextNode &rTextNode, SfxItemSet &rSet)
static MergeResult lcl_Compare_Attributes(int i, int j, const std::pair< PortionMap::const_iterator, PortionMap::const_iterator > &aRange1, const std::pair< PortionMap::const_iterator, PortionMap::const_iterator > &aRange2, std::vector< bool > &RsidOnlyAutoFormatFlagMap)
static void lcl_MergeAttr(SfxItemSet &rSet, const SfxPoolItem &rAttr)
static void lcl_DoSplitNew(NestList_t &rSplits, SwTextNode &rNode, const sal_Int32 nNewStart, const sal_Int32 nOtherStart, const sal_Int32 nOtherEnd, bool bOtherDummy)
SwTextAttr * MakeRedlineTextAttr(SwDoc &rDoc, SfxPoolItem const &rAttr)
create redline dummy text hint that must not be inserted into hints array
std::vector< SwTextAttrNesting * > NestList_t
static void lcl_CheckSortNumber(const SwpHints &rHints, SwTextCharFormat &rNewCharFormat)
static NestList_t::iterator lcl_DoSplitImpl(NestList_t &rSplits, SwTextNode &rNode, NestList_t::iterator const iter, sal_Int32 const nSplitPos, bool const bSplitAtStart, bool const bOtherDummy)
static Split_t splitPolicy(const sal_uInt16 nWhichNew, const sal_uInt16 nWhichOther)
Calculate splitting policy for overlapping hints, based on what kind of hint is inserted,...
static bool isSelfNestable(const sal_uInt16 nWhich)
static SwTextAttrNesting * MakeTextAttrNesting(SwTextNode &rNode, SwTextAttrNesting &rNesting, const sal_Int32 nStart, const sal_Int32 nEnd)
Create a new nesting text hint.