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)
119 return (pAttr->
GetStart() < nPos) && (nPos < *pAttr->
End());
139 bool isOverlap(
const sal_Int32 nStart1,
const sal_Int32 nEnd1,
140 const sal_Int32 nStart2,
const sal_Int32 nEnd2)
143 ((nStart1 > nStart2) && (nStart1 < nEnd2) && (nEnd1 > nEnd2))
144 || ((nStart1 < nStart2) && (nStart2 < nEnd1) && (nEnd1 < nEnd2));
150 const sal_Int32 nStart2,
const sal_Int32 nEnd2)
152 return ((nStart1 == nStart2) || (nEnd1 == nEnd2))
154 ? (nStart1 != nEnd1) || (nStart2 == nEnd2)
155 : ((nStart1 < nStart2) ? (nEnd1 >= nEnd2) : (nEnd1 <= nEnd2));
186 enum Split_t { FAIL, SPLIT_NEW, SPLIT_OTHER };
195 splitPolicy(
const sal_uInt16 nWhichNew,
const sal_uInt16 nWhichOther)
221 pFormat->
Add(
this );
229 pFormat->
Add(
this );
237 const sal_Int32 nStart,
const sal_Int32 nEnd)
241 switch (pNew->
Which())
254 assert(!
"MakeTextAttrNesting: what the hell is that?");
262 static NestList_t::iterator
264 NestList_t::iterator
const iter, sal_Int32
const nSplitPos,
265 bool const bSplitAtStart,
bool const bOtherDummy)
267 const sal_Int32 nStartPos(
268 (bSplitAtStart && bOtherDummy) ? nSplitPos + 1 : nSplitPos );
270 rNode, **iter, nStartPos, *(*iter)->GetEnd() ) );
271 (*iter)->SetEnd(nSplitPos);
272 return rSplits.insert(iter + 1, pNew);
277 const sal_Int32 nNewStart,
278 const sal_Int32 nOtherStart,
const sal_Int32 nOtherEnd,
bool bOtherDummy)
280 const bool bSplitAtStart(nNewStart < nOtherStart);
281 const sal_Int32 nSplitPos( bSplitAtStart ? nOtherStart : nOtherEnd );
283 NestList_t::iterator
const iter(
284 std::find_if( rSplits.begin(), rSplits.end(),
288 if (iter != rSplits.end())
290 lcl_DoSplitImpl(rSplits, rNode, iter, nSplitPos, bSplitAtStart, bOtherDummy);
378 const sal_uInt16 nNewWhich( rNewHint.
Which() );
379 const sal_Int32 nNewStart( rNewHint.
GetStart() );
380 const sal_Int32 nNewEnd ( *rNewHint.
GetEnd() );
394 SplitNew.push_back(& rNewHint);
397 for (
size_t i = 0;
i <
Count(); ++
i )
403 const sal_uInt16 nOtherWhich( pOther->
Which() );
404 const sal_Int32 nOtherStart( pOther->
GetStart() );
405 const sal_Int32 nOtherEnd ( *pOther->
GetEnd() );
406 if (
isOverlap(nNewStart, nNewEnd, nOtherStart, nOtherEnd ))
411 SAL_INFO(
"sw.core",
"cannot insert hint: overlap");
412 for (
const auto& aSplit : SplitNew)
420 OverlappingExisting.push_back(
421 static_txtattr_cast<SwTextAttrNesting*>(pOther));
424 assert(!
"bad code monkey");
428 else if (
isNestedAny(nNewStart, nNewEnd, nOtherStart, nOtherEnd))
430 if (!bNewSelfNestable && (nNewWhich == nOtherWhich))
433 OverwrittenExisting.push_back(
434 static_txtattr_cast<SwTextAttrNesting*>(pOther));
436 else if ((nNewStart == nOtherStart) && pOther->
HasDummyChar())
440 assert(!
"ERROR: inserting duplicate CH_TXTATR hint");
442 }
else if (nNewEnd < nOtherEnd) {
448 assert(SplitNew.front()->GetStart() == nNewStart);
449 SplitNew.front()->SetStart(nNewStart + 1);
457 for (
auto iter = SplitNew.begin(); iter != SplitNew.end(); ++iter)
459 SwPaM const temp(rNode, (*iter)->GetStart(), rNode, *(*iter)->GetEnd());
460 std::vector<std::pair<SwNodeOffset, sal_Int32>> Breaks;
466 SAL_INFO(
"sw.core",
"cannot insert hint: fieldmark overlap");
467 assert(SplitNew.size() == 1);
473 for (
auto const& rPos : Breaks)
475 assert(rPos.first == rNode.
GetIndex());
477 rPos.second,
true,
true);
483 assert((
isSplittable(nNewWhich) || SplitNew.size() == 1) &&
484 "splitting the unsplittable ???");
494 for (
auto& rpOther : OverlappingExisting)
496 const sal_Int32 nOtherStart( rpOther->GetStart() );
497 const sal_Int32 nOtherEnd ( *rpOther->GetEnd() );
499 for (
const auto& rpNew : SplitNew)
501 const sal_Int32 nSplitNewStart( rpNew->GetStart() );
502 const sal_Int32 nSplitNewEnd ( *rpNew->GetEnd() );
504 const bool bRemoveOverlap(
505 !bNewSelfNestable && (nNewWhich == rpOther->Which()) );
508 nOtherStart, nOtherEnd))
512 assert(!bRemoveOverlap &&
513 "this one should be in OverwrittenExisting?");
519 assert(!
"existing hint inside new hint: why?");
525 rpOther->SetStart(nSplitNewEnd);
531 SAL_INFO(
"sw.core",
"hints array full :-(");
536 nOtherStart, nSplitNewEnd ) );
544 rpOther->SetEnd(nSplitNewStart);
550 SAL_INFO(
"sw.core",
"hints array full :-(");
555 nSplitNewStart, nOtherEnd ) );
568 SAL_INFO(
"sw.core",
"hints array full :-(");
573 for (
const auto& rpHint : SplitNew)
581 for (
auto& rpOther : OverwrittenExisting)
583 const sal_Int32 nOtherStart( rpOther->GetStart() );
584 const sal_Int32 nOtherEnd ( *rpOther->GetEnd() );
587 if ((nNewStart <= nOtherStart) && (nOtherEnd <= nNewEnd))
594 assert((nOtherStart < nNewStart) || (nNewEnd < nOtherEnd));
600 if (nNewEnd < nOtherEnd)
604 rNode, *rpOther, nNewEnd, nOtherEnd ) );
606 SAL_WARN_IF(!bSuccess,
"sw.core",
"recursive call 1 failed?");
608 if (nOtherStart < nNewStart)
610 rpOther->SetEnd(nNewStart);
612 SAL_WARN_IF(!bSuccess,
"sw.core",
"recursive call 2 failed?");
635 const sal_uInt16 nWhich = rNewHint.
Which();
637 const sal_Int32 nThisStart = rNewHint.
GetStart();
638 const sal_Int32 nThisEnd = *rNewHint.
GetEnd();
639 const bool bNoLengthAttribute = nThisStart == nThisEnd;
641 std::vector<SwTextAttr*> aInsDelHints;
649 if ( !bNoLengthAttribute )
651 for (
size_t i = 0;
i <
Count(); ++
i )
661 sal_Int32 nOtherStart = pOther->
GetStart();
662 const sal_Int32 nOtherEnd = *pOther->
GetEnd();
666 if ( nOtherStart < nThisStart && nThisStart < nOtherEnd )
669 pOther->
GetAttr(), nOtherStart, nThisStart );
673 static_txtattr_cast<SwTextCharFormat*>(pOther)->GetSortNumber() );
675 aInsDelHints.push_back( pNewAttr );
681 nOtherStart = nThisStart;
686 if ( nOtherStart < nThisEnd && nThisEnd < nOtherEnd )
689 pOther->
GetAttr(), nOtherStart, nThisEnd );
693 static_txtattr_cast<SwTextCharFormat*>(pOther)->GetSortNumber());
695 aInsDelHints.push_back( pNewAttr );
704 for (
const auto& rpHint : aInsDelHints )
719 aBounds.
insert( nThisStart );
720 aBounds.
insert( nThisEnd );
722 if ( !bNoLengthAttribute )
724 for (
size_t i = 0;
i <
Count(); ++
i )
732 const sal_Int32 nOtherStart = pOther->
GetStart();
733 const sal_Int32 nOtherEnd = *pOther->
End();
735 if (nThisStart <= nOtherStart && nOtherStart <= nThisEnd)
736 aBounds.
insert( nOtherStart );
737 if (nThisStart <= nOtherEnd && nOtherEnd <= nThisEnd)
738 aBounds.
insert( nOtherEnd );
742 auto aStartIter = aBounds.
lower_bound( nThisStart );
744 sal_Int32 nPorStart = *aStartIter;
746 bool bDestroyHint =
true;
750 while ( aStartIter != aEndIter || bNoLengthAttribute )
752 OSL_ENSURE( bNoLengthAttribute || nPorStart < *aStartIter,
"AUTOSTYLES: BuildPortion trouble" );
754 const sal_Int32 nPorEnd = bNoLengthAttribute ? nPorStart : *aStartIter;
755 aInsDelHints.clear();
758 for (
size_t i = 0;
i <
Count(); ++
i )
767 const sal_Int32 nOtherStart = pOther->
GetStart();
769 if ( nOtherStart > nPorStart )
772 if ( pOther->
GetEnd() && *pOther->
GetEnd() == nPorEnd && nOtherStart == nPorStart )
774 OSL_ENSURE( *pOther->
GetEnd() == nPorEnd,
"AUTOSTYLES: BuildPortion trouble" );
775 aInsDelHints.push_back( pOther );
785 sal_uInt16 nCharStyleCount = 0;
786 for (
const auto& rpHint : aInsDelHints )
799 bNoLengthAttribute ||
815 const std::shared_ptr<SfxItemSet> & pOldStyle =
static_cast<const SwFormatAutoFormat&
>(pOther->GetAttr()).GetStyleHandle();
827 aNewSet.Put( *pItem );
830 pItem = aItemIter.NextItem();
838 if ( aNewSet.Count() )
841 aNewSet, nPorStart, nPorEnd );
850 if ( nPorStart == nThisStart &&
851 nPorEnd == nThisEnd &&
854 pNewAttr = &rNewHint;
855 bDestroyHint =
false;
860 nPorStart, nPorEnd );
869 for (
const auto& rpHint : aInsDelHints )
872 pCurrentAutoStyle = rpHint;
874 pCurrentCharFormat = rpHint;
878 if ( pCurrentAutoStyle )
880 const std::shared_ptr<SfxItemSet> & pCurrentStyle =
static_cast<const SwFormatAutoFormat&
>(pCurrentAutoStyle->
GetAttr()).GetStyleHandle();
884 aNewSet.
Put( *pNewStyle );
897 if ( SfxItemState::SET == rWholeParaAttrSet.
GetItemState( pItem->
Which(),
false, &pTmpItem ) &&
905 while ((pItem = aIter2.
NextItem()));
909 Delete( pCurrentAutoStyle );
913 if ( aNewSet.
Count() )
915 nPorStart, nPorEnd );
920 bool bOptimizeAllowed =
true;
924 if ( !bNoLengthAttribute && rNode.
HasSwAttrSet() && pNewStyle->Count() )
926 std::unique_ptr<SfxItemSet> pNewSet;
935 if ( SfxItemState::SET == rWholeParaAttrSet.
GetItemState( pItem->
Which(),
false, &pTmpItem ) &&
942 pNewSet = pNewStyle->
Clone();
943 pNewSet->ClearItem( pItem->
Which() );
947 while ((pItem = aIter2.
NextItem()));
951 bOptimizeAllowed =
false;
952 if ( pNewSet->Count() )
962 if ( bOptimizeAllowed &&
963 nPorStart == nThisStart &&
964 nPorEnd == nThisEnd )
966 pNewAttr = &rNewHint;
967 bDestroyHint =
false;
969 else if ( pNewStyle )
972 nPorStart, nPorEnd );
984 if ( !bNoLengthAttribute )
986 nPorStart = *aStartIter;
1000 switch (rAttr.
Which())
1015 assert(!
"unsupported redline attribute");
1030 sal_Int32
const nStt,
1031 sal_Int32
const nEnd,
1041 aItemSet.
Put( rAttr );
1050 const std::shared_ptr<SfxItemSet> & pAutoStyle =
static_cast<const SwFormatAutoFormat&
>(rAttr).GetStyleHandle();
1051 std::unique_ptr<const SfxItemSet> pNewSet(
1052 pAutoStyle->SfxItemSet::Clone(
true, &rDoc.
GetAttrPool() ));
1063 switch( rNew.
Which() )
1077 pNew =
new SwTextINetFormat( static_cast<SwFormatINetFormat&>(rNew), nStt, nEnd );
1081 pNew =
new SwTextField( static_cast<SwFormatField &>(rNew), nStt,
1100 pNew =
new SwTextInputField( static_cast<SwFormatField &>(rNew), nStt, nEnd,
1107 pNew =
new SwTextFlyCnt( static_cast<SwFormatFlyCnt&>(rNew), nStt );
1108 if ( static_cast<const SwFormatFlyCnt &>(rAttr).GetTextFlyCnt() )
1111 static_cast<SwTextFlyCnt *
>(pNew)->CopyFlyFormat( rDoc );
1116 pNew =
new SwTextFootnote( static_cast<SwFormatFootnote&>(rNew), nStt );
1118 if( static_cast<SwFormatFootnote&>(rAttr).GetTextFootnote() )
1119 static_cast<SwTextFootnote*
>(pNew)->SetSeqNo( static_cast<SwFormatFootnote&>(rAttr).GetTextFootnote()->GetSeqRefNo() );
1123 ?
new SwTextRefMark( static_cast<SwFormatRefMark&>(rNew), nStt )
1124 :
new SwTextRefMark( static_cast<SwFormatRefMark&>(rNew), nStt, &nEnd );
1134 if (pTOXType && &pTOXType->
GetDoc() != &rDoc)
1145 pNew =
new SwTextRuby( static_cast<SwFormatRuby&>(rNew), nStt, nEnd );
1153 pNew =
new SwTextLineBreak(static_cast<SwFormatLineBreak&>(rNew), nStt);
1157 pTextNode, static_cast<SwFormatContentControl&>(rNew), nStt, nEnd,
1170 sal_Int32 nStt, sal_Int32 nEnd )
1188 switch( pAttr->
Which() )
1212 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pAttr));
1231 switch( pFieldType->
Which() )
1246 static_cast<SwDDEFieldType*>(pFieldType)->DecRefCnt();
1272 SwFormatMeta & rFormatMeta( static_cast<SwFormatMeta &>(pTextMeta->GetAttr()) );
1273 if (::
sw::Meta* pMeta = rFormatMeta.GetMeta())
1277 static constexpr OUStringLiteral metaNS(
u"urn:bails");
1278 const css::uno::Reference<css::rdf::XResource> xSubject = pMeta->MakeUnoObject();
1279 uno::Reference<frame::XModel>
xModel = pDocSh->GetBaseModel();
1302 const sal_Int32 nStart,
1303 const sal_Int32 nEnd,
1308 "SwTextNode::InsertItem should not be called with character attributes");
1321 const bool bSuccess(
InsertHint( pNew, nMode ) );
1337 bool bHiddenPara =
false;
1351 const sal_Int32 nStart( pAttr->
GetStart() );
1356 switch( pAttr->
Which() )
1373 OUString
const ins(
InsertText(c, aIdx, nInsertFlags) );
1385 (RndStdIds::FLY_AS_CHAR == pAnchor->
GetAnchorId()) &&
1406 bool bCheckControlLayer =
false;
1408 if( bCheckControlLayer )
1421 Update( aTmpIdx, 1,
true );
1452 Update( aTmpIdx, 1,
true );
1474 SwNodeOffset nEndIdx = rNodes[ nSttIdx++ ]->EndOfSectionIndex();
1475 for( ; nSttIdx < nEndIdx; ++nSttIdx )
1478 if(
nullptr != pCNd )
1482 pTable->DelFrames();
1494 OUString
const ins(
InsertText(c, aNdIdx, nInsertFlags) );
1519 if( !pTextFootnote )
1529 OSL_ENSURE( bSuccess,
"FootnoteIdx not inserted." );
1561 aIdx, nInsertFlags) );
1569 const sal_Int32* pEnd(pAttr->
GetEnd());
1572 pAttr->
SetEnd(*pEnd + 1);
1590 pAttr->
SetEnd(*pEnd + 1);
1597 sal_Int32 nEnd = nStart;
1598 bool bInputFieldStartCharInserted =
false;
1599 bool bInputFieldEndCharInserted =
false;
1600 const bool bHasContent( pAttr->
HasContent() );
1603 switch( pAttr->
Which() )
1608 if ( pTextInputField )
1617 const sal_Int32*
const pEnd(pAttr->
GetEnd());
1618 assert(pEnd !=
nullptr);
1619 pAttr->
SetEnd(*pEnd + aContent.getLength());
1629 bInputFieldStartCharInserted =
true;
1630 const sal_Int32*
const pEnd(pAttr->
GetEnd());
1631 assert(pEnd !=
nullptr);
1632 pAttr->
SetEnd(*pEnd + 1);
1636 const sal_Int32*
const pEnd(pAttr->
GetEnd());
1637 assert(pEnd !=
nullptr);
1642 bInputFieldEndCharInserted =
true;
1643 pAttr->
SetEnd(*pEnd + 1);
1658 bool bInsertHint =
true;
1661 if ( pTextInputField !=
nullptr )
1663 if ( pAttr->
End() == nullptr )
1665 bInsertHint =
false;
1674 if ( *(pAttr->
End()) < *(pTextInputField->
End()) )
1676 pAttr->
SetEnd(*(pTextInputField->
End()));
1682 const bool bRet = bInsertHint
1683 &&
m_pSwpHints->TryInsertHint( pAttr, *
this, nMode );
1703 && (nEnd - nStart) > 0 )
1710 if ( bInputFieldEndCharInserted
1711 && (nEnd - nStart) > 0 )
1713 SwIndex aIdx(
this, nEnd - 1 );
1717 if ( bInputFieldStartCharInserted )
1738 OSL_FAIL(
"DeleteAttribute called, but text node without hints?");
1752 assert(pAttr->
End() !=
nullptr);
1773 const sal_uInt16 nWhich,
1774 const sal_Int32 nStart,
1775 const sal_Int32 nEnd )
1783 const sal_Int32 nHintStart = pTextHt->
GetStart();
1784 if (nStart < nHintStart)
1788 else if ( (nStart == nHintStart) && (nWhich == pTextHt->
Which()) )
1792 assert(!
"hey, that's a CHRATR! how did that get in?");
1813 sal_Int32
const *
const pEndIdx = pTextHt->
GetEnd();
1818 const SwIndex aIdx(
this, nStart );
1824 const SwIndex aIdx(
this, nStart );
1825 OSL_ENSURE( pTextHt->
End() !=
nullptr,
"<SwTextNode::DeleteAttributes(..)> - missing End() at <SwTextAttr> instance which has content" );
1828 else if( *pEndIdx == nEnd )
1849 sal_Int32 nFndPos = nStt;
1850 sal_Int32 nEndPos = nEnd;
1854 if (nFndPos<0 || nFndPos>=nEndPos )
1858 const SwIndex aIdx(
this, nFndPos );
1879 const sal_Int32 nStt,
1880 const sal_Int32 nEnd,
1892 if ( !nStt && (nEnd ==
m_Text.getLength()) &&
1897 bool bHasCharFormats =
false;
1904 bHasCharFormats =
true;
1910 if( !bHasCharFormats )
1912 aTextSet.Put( rSet );
1915 if( aTextSet.Count() != rSet.
Count() )
1917 const bool bRet =
SetAttr( rSet );
1918 if( !aTextSet.Count() )
1925 const bool bRet =
SetAttr( *pItem->GetStyleHandle() );
1926 if( 1 == aTextSet.Count() )
1947 const sal_uInt16 nWhich = pItem->
Which();
1949 "SwTextNode::SetAttr(): unknown attribute" );
1953 (
GetDoc().GetDfltCharFormat() ==
1954 static_cast<const SwFormatCharFormat*>(pItem)->GetCharFormat()))
1965 aCharSet.Put( *pItem );
1971 const_cast<SfxPoolItem&>(*pItem), nStt, nEnd );
1975 if (ppNewTextAttr && !*ppNewTextAttr)
1976 *ppNewTextAttr = pNew;
1977 if ( nEnd != nStt && !pNew->
GetEnd() )
1979 OSL_FAIL(
"Attribute without end, but area marked");
1994 if ( aCharSet.Count() )
2021 ( SfxItemState::SET == pCFSet->
GetItemState( nWhich ) ) )
2022 rSet.
Put( pCFSet->
Get( nWhich ) );
2046 ( SfxItemState::SET == pCFSet->
GetItemState( nWhich ) ) )
2047 rSet.
Put( pCFSet->
Get( nWhich ) );
2071 struct SwPoolItemEndPair
2077 SwPoolItemEndPair() : mpItem( nullptr ), mnEndPos( 0 ) {};
2104 const bool bOnlyTextAttr,
const bool bGetFromChrFormat,
2105 const bool bMergeIndentValuesOfNumRule,
2108 assert(!rSet.
Count());
2124 if (bMergeIndentValuesOfNumRule)
2151 for (
size_t n = 0;
n < nSize; ++
n)
2154 const sal_Int32 nAttrStart = pHt->
GetStart();
2155 if (nAttrStart > nEnd)
2158 const sal_Int32* pAttrEnd = pHt->
End();
2162 if( ( nAttrStart < nStt &&
2164 : nStt <= *pAttrEnd )) ||
2165 ( nStt == nAttrStart &&
2166 ( nAttrStart == *pAttrEnd || !nStt )))
2167 (*fnMergeAttr)( rSet, pHt->
GetAttr() );
2173 std::optional< std::vector< SwPoolItemEndPair > > pAttrArr;
2177 for (
size_t n = 0;
n < nSize; ++
n)
2180 const sal_Int32 nAttrStart = pHt->
GetStart();
2181 if (nAttrStart > nEnd)
2184 const sal_Int32* pAttrEnd = pHt->
End();
2188 bool bChkInvalid =
false;
2189 if (nAttrStart <= nStt)
2191 if (*pAttrEnd <= nStt)
2194 if (nEnd <= *pAttrEnd)
2195 (*fnMergeAttr)( aFormatSet, pHt->
GetAttr() );
2201 else if (nAttrStart < nEnd
2208 std::unique_ptr< SfxItemIter > pItemIter;
2217 pItem = pItemIter->GetCurItem();
2223 const sal_Int32 nHintEnd = *pAttrEnd;
2225 for (; pItem; pItem = pItemIter ? pItemIter->NextItem() :
nullptr)
2227 const sal_uInt16 nHintWhich = pItem->
Which();
2229 "SwTextNode::GetAttr(): unknown attribute?");
2233 pAttrArr = std::vector< SwPoolItemEndPair >(coArrSz);
2236 std::vector< SwPoolItemEndPair >::iterator pPrev = pAttrArr->begin();
2244 pPrev = pAttrArr->end();
2247 if( pPrev != pAttrArr->end() )
2249 if( !pPrev->mpItem )
2251 if ( bOnlyTextAttr || *pItem != aFormatSet.Get( nHintWhich ) )
2253 if( nAttrStart > nStt )
2260 pPrev->mpItem = pItem;
2261 pPrev->mnEndPos = nHintEnd;
2267 if( pPrev->mnEndPos == nAttrStart &&
2268 *pPrev->mpItem == *pItem )
2270 pPrev->mpItem = pItem;
2271 pPrev->mnEndPos = nHintEnd;
2286 for (
size_t n = 0;
n < coArrSz; ++
n)
2288 const SwPoolItemEndPair& rItemPair = (*pAttrArr)[
n ];
2291 const sal_uInt16 nWh =
2294 if (nEnd <= rItemPair.mnEndPos)
2296 if( *rItemPair.mpItem != aFormatSet.Get( nWh ) )
2297 (*fnMergeAttr)( rSet, *rItemPair.mpItem );
2306 if( aFormatSet.Count() )
2309 aFormatSet.Differentiate( rSet );
2313 if (aFormatSet.Count())
2316 rSet.
Put( aFormatSet );
2319 return rSet.
Count() != 0;
2325 typedef std::pair<sal_Int32, sal_Int32> AttrSpan_t;
2326 typedef std::multimap<AttrSpan_t, const SwTextAttr*> AttrSpanMap_t;
2331 operator()(
const AttrSpanMap_t::value_type& i_rAttrSpan)
2341 struct RemovePresentAttrs
2343 explicit RemovePresentAttrs(
SfxItemSet& io_rAttrSet)
2344 : m_rAttrSet(io_rAttrSet)
2349 operator()(
const AttrSpanMap_t::value_type& i_rAttrSpan)
2352 if (!i_rAttrSpan.second)
2357 const SwTextAttr*
const pAutoStyle(i_rAttrSpan.second);
2359 for (
const SfxPoolItem* pItem(aIter.GetCurItem()); pItem; pItem = aIter.NextItem())
2361 const sal_uInt16 nWhich(pItem->Which());
2364 m_rAttrSet.ClearItem(nWhich);
2380 lcl_CollectHintSpans(
const SwpHints& i_rHints,
const sal_Int32 nLength,
2381 AttrSpanMap_t& o_rSpanMap)
2383 sal_Int32 nLastEnd(0);
2385 for (
size_t i = 0;
i < i_rHints.
Count(); ++
i)
2388 const sal_uInt16 nWhich(pHint->
Which());
2391 const AttrSpan_t aSpan(pHint->
GetStart(), *pHint->
End());
2392 o_rSpanMap.emplace(aSpan, pHint);
2395 if (nLastEnd < aSpan.first)
2398 o_rSpanMap.emplace( AttrSpan_t(nLastEnd, aSpan.first),
nullptr );
2401 nLastEnd = aSpan.second;
2406 if (nLastEnd != nLength && nLength != 0)
2408 o_rSpanMap.emplace(AttrSpan_t(nLastEnd, nLength),
nullptr);
2413 lcl_FillWhichIds(
const SfxItemSet& i_rAttrSet, std::vector<sal_uInt16>& o_rClearIds)
2415 o_rClearIds.reserve(i_rAttrSet.
Count());
2417 for (
const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
2419 o_rClearIds.push_back(pItem->Which());
2423 struct SfxItemSetClearer
2426 explicit SfxItemSetClearer(
SfxItemSet & rItemSet) : m_rItemSet(rItemSet) { }
2427 void operator()(sal_uInt16
const nWhich) { m_rItemSet.
ClearItem(nWhich); }
2438 typedef AttrSpanMap_t::iterator AttrSpanMap_iterator_t;
2439 AttrSpanMap_t aAttrSpanMap;
2441 if (i_rAttrSet.
Count() == 0)
2452 AttrSpanMap_iterator_t aCurRange(aAttrSpanMap.begin());
2453 const AttrSpanMap_iterator_t aEnd(aAttrSpanMap.end());
2454 while (aCurRange != aEnd)
2456 typedef std::pair<AttrSpanMap_iterator_t, AttrSpanMap_iterator_t>
2458 AttrSpanMapRange_t aRange(aAttrSpanMap.equal_range(aCurRange->first));
2463 std::for_each(aRange.first, aRange.second, RemovePresentAttrs(aCurSet));
2467 if (aCurSet.Count() != 0)
2469 AttrSpanMap_iterator_t aAutoStyleIt(
2470 std::find_if(aRange.first, aRange.second, IsAutoStyle()));
2471 if (aAutoStyleIt != aRange.second)
2475 SwTextAttr*
const pAutoStyle(const_cast<SwTextAttr*>(aAutoStyleIt->second));
2476 const std::shared_ptr<SfxItemSet> pOldStyle(
2477 static_cast<const SwFormatAutoFormat&>(
2478 pAutoStyle->
GetAttr()).GetStyleHandle());
2479 aCurSet.Put(*pOldStyle);
2487 aCurRange->first.first, aCurRange->first.second));
2490 aCurRange = aRange.second;
2497 std::vector<sal_uInt16> aClearedIds;
2498 lcl_FillWhichIds(i_rAttrSet, aClearedIds);
2533 std::vector<sal_uInt16> aProcessedIds;
2535 if( aThisSet.
Count() )
2540 std::vector<sal_uInt16> aClearWhichIds;
2544 if( SfxItemState::SET == aNdSet.GetItemState( pItem->
Which(),
false, &pNdItem ) )
2546 if (*pItem == *pNdItem)
2548 aClearWhichIds.push_back( pItem->
Which() );
2552 aConvertSet.
Put(*pItem);
2554 aProcessedIds.push_back(pItem->
Which());
2558 aConvertSet.
Put(*pItem);
2572 std::for_each(aProcessedIds.begin(), aProcessedIds.end(),
2573 SfxItemSetClearer(aNdSet));
2578 if( aNdSet.Count() )
2594 const size_t nSize =
Count();
2598 switch( pAttr->
Which() )
2624 bool bNewHiddenByParaField =
false;
2625 int nNewResultWeight = 0;
2626 const size_t nSize =
Count();
2632 const sal_uInt16 nWhich = pTextHt->
Which();
2639 if (nCurWeight > nNewResultWeight)
2641 nNewResultWeight = nCurWeight;
2644 else if (nCurWeight == nNewResultWeight && bNewHiddenByParaField)
2654 return bOldHiddenByParaField != bNewHiddenByParaField;
2666 bool isRsidOnlyAutoFormat;
2668 typedef std::vector< Portion > PortionMap;
2674 const std::pair< PortionMap::const_iterator, PortionMap::const_iterator >& aRange1,
2675 const std::pair< PortionMap::const_iterator, PortionMap::const_iterator >& aRange2,
2676 std::vector<bool>& RsidOnlyAutoFormatFlagMap);
2687 PortionMap aPortionMap;
2688 aPortionMap.reserve(
Count() + 1);
2689 std::vector<bool> RsidOnlyAutoFormatFlagMap;
2690 RsidOnlyAutoFormatFlagMap.resize(
Count() + 1);
2695 for (
size_t i = 0;
i <
Count(); ++
i )
2704 bool isRsidOnlyAutoFormat(
false);
2708 std::shared_ptr<SfxItemSet>
const & pSet(
2729 isRsidOnlyAutoFormat =
true;
2740 const sal_Int32 nPorStart = pHt->
GetStart();
2741 if (nPorStart != nLastPorStart)
2743 nLastPorStart = nPorStart;
2744 aPortionMap.push_back(Portion {pHt, nKey, isRsidOnlyAutoFormat});
2745 RsidOnlyAutoFormatFlagMap[nKey] = isRsidOnlyAutoFormat;
2749 auto equal_range = [&aPortionMap](
int i)
2751 Portion key {
nullptr,
i,
false };
2752 return std::equal_range(aPortionMap.begin(), aPortionMap.end(), key,
2753 [] (
const Portion& lhs,
const Portion& rhs) ->
bool
2755 return lhs.nKey < rhs.nKey;
2766 std::pair< PortionMap::const_iterator, PortionMap::const_iterator > aRange1 = equal_range( i );
2767 std::pair< PortionMap::const_iterator, PortionMap::const_iterator > aRange2 = equal_range( j );
2771 if (MATCH == eMerge)
2776 sal_Int32 nNewPortionEnd = 0;
2777 for (
auto aIter2 = aRange2.first; aIter2 != aRange2.second; ++aIter2 )
2780 nNewPortionEnd = *p2->
GetEnd();
2782 const size_t nCountBeforeDelete =
Count();
2786 if (
Count() < nCountBeforeDelete )
2789 aPortionMap.erase( aRange2.first, aRange2.second );
2793 aRange1 = equal_range( i );
2794 for (
auto aIter1 = aRange1.first; aIter1 != aRange1.second; ++aIter1 )
2798 p1->
SetEnd(nNewPortionEnd);
2812 bool const bSetIgnoreFlag(DIFFER_ONLY_RSID == eMerge);
2813 for (
auto aIter1 = aRange1.first; aIter1 != aRange1.second; ++aIter1)
2815 if (!aIter1->isRsidOnlyAutoFormat)
2817 SwTextAttr *
const pCurrent(aIter1->pTextAttr);
2826 for (
auto aIter2 = aRange2.first; aIter2 != aRange2.second; ++aIter2)
2828 if (!aIter2->isRsidOnlyAutoFormat)
2830 SwTextAttr *
const pCurrent(aIter2->pTextAttr);
2850 const std::pair< PortionMap::const_iterator, PortionMap::const_iterator >& aRange1,
2851 const std::pair< PortionMap::const_iterator, PortionMap::const_iterator >& aRange2,
2852 std::vector<bool>& RsidOnlyAutoFormatFlagMap)
2854 PortionMap::const_iterator aIter1 = aRange1.first;
2855 PortionMap::const_iterator aIter2 = aRange2.first;
2857 size_t const nAttributesInPor1 = std::distance(aRange1.first, aRange1.second);
2858 size_t const nAttributesInPor2 = std::distance(aRange2.first, aRange2.second);
2859 bool const isRsidOnlyAutoFormat1 = i < sal_Int32(RsidOnlyAutoFormatFlagMap.size()) && RsidOnlyAutoFormatFlagMap[i];
2860 bool const isRsidOnlyAutoFormat2 = j < sal_Int32(RsidOnlyAutoFormatFlagMap.size()) && RsidOnlyAutoFormatFlagMap[j];
2863 bool const bSkipRsidOnlyAutoFormat(nAttributesInPor1 != nAttributesInPor2);
2868 if (!((nAttributesInPor1 - (isRsidOnlyAutoFormat1 ? 1 : 0)) ==
2869 (nAttributesInPor2 - (isRsidOnlyAutoFormat2 ? 1 : 0))
2870 && (nAttributesInPor1 != 0 || nAttributesInPor2 != 0)))
2880 while (aIter1 != aRange1.second || aIter2 != aRange2.second)
2883 if (aIter1 != aRange1.second && aIter2 != aRange2.second &&
2884 *aIter1->pTextAttr->End() < aIter2->pTextAttr->GetStart())
2889 if (bSkipRsidOnlyAutoFormat
2890 && aIter1 != aRange1.second && aIter1->isRsidOnlyAutoFormat)
2892 assert(DIFFER != eMerge);
2893 eMerge = DIFFER_ONLY_RSID;
2897 if (bSkipRsidOnlyAutoFormat
2898 && aIter2 != aRange2.second && aIter2->isRsidOnlyAutoFormat)
2900 assert(DIFFER != eMerge);
2901 eMerge = DIFFER_ONLY_RSID;
2905 assert(aIter1 != aRange1.second && aIter2 != aRange2.second);
2906 SwTextAttr const*
const p1 = aIter1->pTextAttr;
2907 SwTextAttr const*
const p2 = aIter2->pTextAttr;
2932 if (!pItem1 && !pItem2)
2934 eMerge = DIFFER_ONLY_RSID;
2937 if (!pItem1 || !pItem2)
2941 if (pItem1 != pItem2)
2960 const sal_Int32 nHtStart = rNewCharFormat.
GetStart();
2961 const sal_Int32 nHtEnd = *rNewCharFormat.
GetEnd();
2962 sal_uInt16 nSortNumber = 0;
2964 for (
size_t i = 0;
i < rHints.
Count(); ++
i )
2968 const sal_Int32 nOtherStart = pOtherHt->
GetStart();
2970 if ( nOtherStart > nHtStart )
2975 const sal_Int32 nOtherEnd = *pOtherHt->
End();
2977 if ( nOtherStart == nHtStart && nOtherEnd == nHtEnd )
2984 if ( nSortNumber > 0 )
3002 OSL_FAIL(
"hints array full :-(");
3007 const sal_Int32 *pHtEnd = pHint->
GetEnd();
3008 const sal_uInt16 nWhich = pHint->
Which();
3009 std::vector<sal_uInt16> aWhichSublist;
3042 for(
auto const & rPair : pRanges)
3044 const sal_uInt16 nBeg = rPair.first;
3045 const sal_uInt16 nEnd = rPair.second;
3046 for( sal_uInt16 nSubElem = nBeg; nSubElem <= nEnd; ++nSubElem )
3047 if( pSet->HasItem( nSubElem ) )
3048 aWhichSublist.push_back( nSubElem );
3060 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pHint));
3061 bool bDelFirst =
nullptr != pTextField->
GetpTextNode();
3086 static_cast<SwDDEFieldType*>(pField->
GetTyp())->IncRefCnt();
3095 bool bInsFieldType =
false;
3106 if( pFieldType != pField->
GetTyp() )
3112 pFieldType->
SetSeqRefNo( *const_cast<SwSetExpField*>(static_cast<const SwSetExpField*>(pField)) );
3121 static_cast<SwDDEFieldType*>(pField->
GetTyp())->IncRefCnt();
3148 for(
size_t n = 0, nEnd =
Count();
n < nEnd; ++
n )
3150 const sal_Int32 *pTmpHtEnd;
3151 const sal_Int32 *pTmpHintEnd;
3154 nullptr != ( pTmpHtEnd = pTmpHt->
GetEnd() ) &&
3155 nullptr != ( pTmpHintEnd = pHint->
GetEnd() ) )
3160 bool bDelOld =
true, bChgStart =
false, bChgEnd =
false;
3180 pHint->
SetEnd(*pTmpHtEnd);
3221 sal_Int32 nHtStart = pHint->
GetStart();
3247 if( *pHtEnd < nHtStart )
3249 assert(*pHtEnd >= nHtStart);
3258 const sal_Int32 nHintEnd = *pHtEnd;
3266 if (!bRet)
return false;
3273 else if ( !bNoHintAdjustMode &&
3280 static_cast<const SwFormatAutoFormat&>(pHint->
GetAttr()).GetStyleHandle()->GetPool() ==
3285 if ( nHtStart < nHintEnd )
3316 const SwUpdateAttr aHint(nHtStart, nHintEnd, nWhich, aWhichSublist);
3349 assert(*findIt == pHt);
3353 assert(*findIt2 == pHt);
3360 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pHint));
3366 const_cast<SwDDEFieldType*>(static_cast<const SwDDEFieldType*>(pFieldTyp))->DecRefCnt();
3377 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pHint));
3391 assert(SAL_MAX_SIZE != nPos);
3392 if( SAL_MAX_SIZE != nPos )
3402 while ( nPos < m_pSwpHints->
Count() )
3407 switch( pDel->
Which() )
3434 sal_uInt16 nScript )
const
3448 const sal_Int32 nEnd = nBegin + nLen;
3450 for (
size_t i = 0;
i < nSize; ++
i )
3453 const sal_Int32 nAttrStart = pHt->
GetStart();
3454 if( nEnd < nAttrStart )
3457 const sal_uInt16 nWhich = pHt->
Which();
3459 if( nWhichId == nWhich ||
3462 const sal_Int32 *pEndIdx = pHt->
End();
3468 if( nAttrStart >= nEnd || nBegin >= *pEndIdx )
3471 else if( nBegin != nAttrStart || ( nAttrStart != *pEndIdx && nBegin ))
3473 if( nAttrStart >= nBegin )
3475 if( pHt->
DontExpand() ? nBegin >= *pEndIdx : nBegin > *pEndIdx)
3482 if( nAttrStart <= nBegin && nEnd <= *pEndIdx )
3501 switch ( rAttr.
Which() )
3526 assert(!
"GetCharOfTextAttr: unknown attr");
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
void SetAnchor(const SwTextNode *pNode)
SetAnchor() is called by SwTextNode::InsertHint() and sets the anchor position in the SwFlyFrameForma...
Instances of SwFields and those derived from it occur 0 to n times.
bool isUNKNOWNATR(const sal_uInt16 nWhich)
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 >)
void BuildPortions(SwTextNode &rNode, SwTextAttr &rNewHint, const SetAttrMode nMode)
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)
void DeleteAtPos(size_t nPos)
virtual std::shared_ptr< SfxItemSet > getAutomaticStyle(const SfxItemSet &rSet, SwAutoStyleFamily eFamily, const OUString *pParentName=nullptr)=0
constexpr TypedWhichId< SvxCrossedOutItem > RES_CHRATR_CROSSEDOUT(5)
std::vector< SwTextAttr * > m_HintsByEnd
SW_DLLPUBLIC void Resort() const
const_iterator lower_bound(const Value &x) const
bool IsFormatIgnoreEnd() const
SwNode & GetEndOfAutotext() const
Section for all Flys/Header/Footers.
void Add(SwClient *pDepend)
void SetDontExpand(bool bDontExpand)
The shared part of a user field.
void DelSoftHyph(const sal_Int32 nStart, const sal_Int32 nEnd)
SwTextNode const & GetAttrMerged(SfxItemSet &rFormatSet, SwTextNode const &rNode, SwRootFrame const *pLayout)
static SwTextContentControl * CreateTextContentControl(SwTextNode *pTargetTextNode, SwFormatContentControl &rAttr, sal_Int32 nStart, sal_Int32 nEnd, bool bIsCopy)
static bool isOverlap(const sal_Int32 nStart1, const sal_Int32 nEnd1, const sal_Int32 nStart2, const sal_Int32 nEnd2)
bool TryInsertNesting(SwTextNode &rNode, SwTextAttrNesting &rNewHint)
The following hints correspond to well-formed XML elements in ODF: RES_TXTATR_INETFMT, RES_TXTATR_CJK_RUBY, RES_TXTATR_META, RES_TXTATR_METAFIELD, RES_TXTATR_CONTENTCONTROL.
constexpr TypedWhichId< SvxEscapementItem > RES_CHRATR_ESCAPEMENT(6)
size_t GetIndexOf(const SwTextAttr *pHt) const
bool m_bFootnote
footnotes
The inserted item is a copy – intended for use in ndtxt.cxx.
bool isCHRATR(const sal_uInt16 nWhich)
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_METAFIELD(49)
SwComparePosition ComparePosition(const T &rStt1, const T &rEnd1, const T &rStt2, const T &rEnd2)
SwDocShell * GetDocShell()
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
SwpHints * GetpSwpHints()
bool isTXTATR_WITHEND(const sal_uInt16 nWhich)
bool isTXTATR(const sal_uInt16 nWhich)
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_META(48)
void TriggerNodeUpdate(const sw::LegacyModifyHint &)
for hanging TextFormatCollections somewhere else (Outline-Numbering!)
SwNodeOffset StartOfSectionIndex() const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
virtual const sal_Int32 * GetEnd() const
end position
virtual sal_Int32 Len() const override
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
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)
Pos1 is as large as Pos2.
void SetStart(sal_Int32 n)
start position
Base class of all fields.
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
bool DontExpandFormat(const SwIndex &rIdx, bool bFlag=true, bool bFormatToTextAttributes=true)
When appropriate set DontExpand-flag at INet or character styles respectively.
constexpr sal_uInt16 RES_TXTATR_WITHEND_END(57)
Pos1 completely contained in Pos2.
const WhichRangesContainer & GetRanges() const
sal_uInt16 ClearItemsFromAttrSet(const std::vector< sal_uInt16 > &rWhichIds)
There some functions that like to remove items from the internal SwAttrSet (handle): ...
void InvalidateItem(sal_uInt16 nWhich)
void SetFormatIgnoreStart(bool bFlag)
constexpr TypedWhichId< SvxUnderlineItem > RES_CHRATR_UNDERLINE(14)
bool HasDummyChar() const
void ChangeNodeIndex(SwNodeOffset nNew)
SwTextNode * GetpTextNode() const
#define CH_TXTATR_NEWLINE
SW_DLLPUBLIC void ResortWhichMap() const
SwTextAttr * GetSortedByEnd(size_t nPos) const
bool AreListLevelIndentsApplicable() const
Determines, if the list level indent attributes can be applied to the paragraph.
std::vector< SwTextAttrNesting * > NestList_t
IDocumentUndoRedo & GetIDocumentUndoRedo()
const SwTOXType * GetTOXType() const
void SetFormatIgnoreEnd(bool bFlag)
virtual const sal_Int32 * GetEnd() const override
end position
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
void SetSeqRefNo(SwSetExpField &rField)
bool HasWriterListeners() const
The root element of a Writer document layout.
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CJK_POSTURE(25)
For old documents the Field-Which IDs must be preserved !!!
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
sal_uInt16 GetRealScriptOfText(const OUString &rText, sal_Int32 nPos) const
bool IsInHeaderFooter(const SwNodeIndex &rIdx) const
constexpr sal_uInt16 RES_TXTATR_BEGIN(RES_CHRATR_END)
bool TryInsertHint(SwTextAttr *const pHint, SwTextNode &rNode, const SetAttrMode nMode=SetAttrMode::DEFAULT)
try to insert the hint
constexpr TypedWhichId< SvxCaseMapItem > RES_CHRATR_CASEMAP(RES_CHRATR_BEGIN)
Pos1 end touches at Pos2 start.
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
#define CH_TXTATR_BREAKWORD
static bool TextAttrContains(const sal_Int32 nPos, const SwTextAttrEnd *const pAttr)
const SfxPoolItem * NextItem()
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
const SwCharFormat * GetDfltCharFormat() const
SwTableNode * GetTableNode()
void NoteInHistory(SwTextAttr *pAttr, const bool bNew=false)
records a new attribute in m_pHistory.
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(159)
static void lcl_MergeAttr_ExpandChrFormat(SfxItemSet &rSet, const SfxPoolItem &rAttr)
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(59)
SwpHints(const SwTextNode &rParent)
void SetSortNumber(sal_uInt16 nSortNumber)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
virtual void InsDelFieldInFieldLst(bool bIns, const SwTextField &rField)=0
void DestroyAttr(SwTextAttr *pAttr)
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
#define CH_TXT_ATR_INPUTFIELDSTART
for Undo, translated to SwInsertFlags::NOHINTEXPAND
const SwTextNode & m_rParent
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
static void TextAttrDelete(SwDoc &rDoc, SwTextAttr *const pAttr)
sal_Int32 GetStart() const
bool IsOverlapAllowedAttr() const
void SetCalcHiddenParaField()
set CalcVisible flags
Pos2 completely contained in Pos1.
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
constexpr TypedWhichId< SwFormatRuby > RES_TXTATR_CJK_RUBY(53)
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
const SwFormatField & GetFormatField() const
SwRegHistory * m_pHistory
for Undo
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
void ChgTextNode(SwTextNode *pNew)
void SetCalcHiddenCharFlags() const
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
sal_Unicode GetCharOfTextAttr(const SwTextAttr &rAttr)
const_iterator upper_bound(const Value &x) const
void CalcBreaks(std::vector< std::pair< SwNodeOffset, sal_Int32 >> &rBreaks, SwPaM const &rPam, bool const isOnlyFieldmarks)
virtual SwFieldType * ChgTyp(SwFieldType *)
Set new type (used for copying among documents).
PaM is Point and Mark: a selection of the document model.
const SwAttrSet * GetpSwAttrSet() const
OUString GetFieldContent() const
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
bool IsCharFormatAttr() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
void RstTextAttr(const SwIndex &rIdx, const sal_Int32 nLen, const sal_uInt16 nWhich=0, const SfxItemSet *pSet=nullptr, const bool bInclRefToxMark=false, const bool bExactRange=false)
delete all attributes.
static SvtFilterOptions & Get()
SwTextAttr * Get(size_t nPos) const
static SwTextAttrNesting * MakeTextAttrNesting(SwTextNode &rNode, SwTextAttrNesting &rNesting, const sal_Int32 nStart, const sal_Int32 nEnd)
Create a new nesting text hint.
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
bool MergePortions(SwTextNode &rNode)
bool m_bHiddenByParaField
Pos1 start touches at Pos2 end.
bool m_bCalcHiddenParaField
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 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)
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(58)
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.
WhichRangesContainer const aCharFormatSetRange(svl::Items< RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1 >)
void Delete(SwTextAttr const *pTextHt)
Delete the given Hint. The Hint must actually be in the array!
SW_DLLPUBLIC void ResortEndMap() const
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, and what kind of existing hint overlaps.
const SwTextInputField * GetOverlappingInputField(const SwTextAttr &rTextAttr) const
SwNodeOffset GetIndex() const
void Insert(SwTextAttr *pHt)
void DelFrames(SwRootFrame const *pLayout)
Method deletes all views of document for the node.
void RegisterToTOXType(SwTOXType &rMark)
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
constexpr TypedWhichId< SwFormatLineBreak > RES_TXTATR_LINEBREAK(61)
Force hint expand (only matters for hints with CH_TXTATR).
Marks a character position inside a document model node.
SW_DLLPUBLIC void ResortStartMap() const
virtual void InsDeletedFieldType(SwFieldType &)=0
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
SAL_DLLPRIVATE void impl_FormatToTextAttr(const SfxItemSet &i_rAttrSet)
Does the hard work of SwTextNode::FormatToTextAttr: the real conversion of items to automatic styles...
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
const OUString & GetTypeName() const
#define LANGUAGE_DONTKNOW
Marks a node in the document model.
SwNodes & GetNodes()
Node is in which nodes-array/doc?
T static_txtattr_cast(S *s)
bool HasSwAttrSet() const
std::vector< SwTextAttr * > m_HintsByStart
SwTextAttr subclass that tracks the location of the wrapped SwFormatLineBreak.
int FieldCanHideParaWeight(SwFieldIds eFieldId) const
SwStartNode * GetStartNode()
bool m_bEndMapNeedsSorting
attention: NOHINTADJUST prevents MergePortions! when using this need to pay attention to ignore start...
SfxItemPool * GetPool() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
void ChgTextNode(SwTextNode *pNew)
SwFieldType * GetTyp() const
constexpr TypedWhichId< SvxCharHiddenItem > RES_CHRATR_HIDDEN(37)
void DeleteAttribute(SwTextAttr *const pTextAttr)
delete the attribute pTextAttr
const_iterator begin() const
constexpr TypedWhichId< SvxRsidItem > RES_CHRATR_RSID(39)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
virtual void SetEnd(sal_Int32)
bool m_bStartMapNeedsSorting
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
SwRegHistory * GetHistory() const
const SwNumFormat & Get(sal_uInt16 i) const
void EraseText(const SwIndex &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 SwIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
void ClearSwpHintsArr(bool bDelFields)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_BACKGROUND(21)
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)
void AddHint(SwTextAttr *pHt, const bool bNew)
#define CH_TXT_ATR_INPUTFIELDEND
constexpr TypedWhichId< SwFormatContentControl > RES_TXTATR_CONTENTCONTROL(56)
void SetHiddenByParaField(const bool bNew) const
const SwGetSetExpType GSE_SEQ
Sequence.
constexpr sal_uInt16 RES_TXTATR_END(RES_TXTATR_NOEND_END)
An SwTextAttr container, stores all directly formatted text portions for a text node.
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
SAL_DLLPRIVATE void InitINetFormat(SwTextNode &rNode)
std::deque< AttacherIndex_Impl > aIndex
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CJK_WEIGHT(26)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void InsertNesting(SwTextAttrNesting &rNewHint)
Insert nesting hint into the hints array.
#define SAL_WARN_IF(condition, area, stream)
Pos1 overlaps Pos2 at the end.
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...
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CTL_WEIGHT(31)
static bool isSelfNestable(const sal_uInt16 nWhich)
SwTextAttr subclass that tracks the location of the wrapped SwFormatContentControl.
static void lcl_DoSplitNew(NestList_t &rSplits, SwTextNode &rNode, const sal_Int32 nNewStart, const sal_Int32 nOtherStart, const sal_Int32 nOtherEnd, bool bOtherDummy)
#define SAL_INFO(area, stream)
SAL_DLLPRIVATE void InitRuby(SwTextNode &rNode)
LanguageType GetAppLanguage()
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CTL_POSTURE(30)
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
static void lcl_MergeListLevelIndentAsLRSpaceItem(const SwTextNode &rTextNode, SfxItemSet &rSet)
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
static void Destroy(SwTextAttr *pToDestroy, SfxItemPool &rPool)
destroy instance
bool FieldHidesPara(const SwField &rField) const
const sal_Int32 * End() const
::sw::MetaFieldManager & GetMetaFieldManager()
static const size_t MAX_HINTS
static void lcl_MergeAttr(SfxItemSet &rSet, const SfxPoolItem &rAttr)
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
void ChgTextNode(SwTextNode *pNew)
bool CalcHiddenParaField() const
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
constexpr sal_uInt16 RES_CHRATR_END(46)
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
virtual void CallSwClientNotify(const SfxHint &rHint) const override
bool InsertHint(SwTextAttr *const pAttr, const SetAttrMode nMode=SetAttrMode::DEFAULT)
Insert pAttr into hints array.
constexpr sal_Int32 COMPLETE_STRING
const SfxPoolItem & GetAttr() const
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.
SwFootnoteIdxs & GetFootnoteIdxs()
Reference< XModel > xModel
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
#define INVALID_POOL_ITEM
SwFormatColl * GetFormatColl() const
const SwFormatAutoFormat & GetAutoFormat() const
std::unique_ptr< SwpHints > m_pSwpHints
May be 0.
bool HasMergedParas() const
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
bool m_bDDEFields
the TextNode has DDE fields
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
SwNode & GetEndOfRedlines() const
Section for all Redlines.
const SwFormatCharFormat & GetCharFormat() const
std::pair< const_iterator, bool > insert(Value &&x)
bool IsInvalidItem(const SfxPoolItem *pItem)
static void lcl_CheckSortNumber(const SwpHints &rHints, SwTextCharFormat &rNewCharFormat)
bool IsCharBackground2Shading() const
IStyleAccess & GetIStyleAccess()
virtual bool IsNewFieldLst() const =0
Merge GetRedlineMergeFlag() const
bool IsFormatIgnoreStart() const
static SwTOXType * GetSwTOXType(SwDoc &rDoc, TOXTypes eTOXTypes, const OUString &rTOXName)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
std::vector< SwTextAttr * > m_HintsByWhichAndStart
IStyleAccess & getIDocumentStyleAccess()
Provides access to the document automatic styles interface.
SwTextAttr * GetWithoutResorting(size_t nPos) const
virtual void Update(SwIndex const &rPos, const sal_Int32 nChangeLen, const bool bNegative=false, const bool bDelete=false) override
override SwIndexReg
Pos1 overlaps Pos2 at the beginning.
SwTextAttr * Cut(const size_t nPosInStart)
static bool isSplittable(const sal_uInt16 nWhich)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_TXTATR_UNKNOWN_CONTAINER(54)
bool IsInXMLImport() const
const SfxPoolItem * GetCurItem() const
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(104)
const SwAttrPool & GetAttrPool() const
size_type erase(const Value &x)
SwpHints & GetOrCreateSwpHints()
bool m_bDetectedRangeSegmentation false
bool m_bWhichMapNeedsSorting
const SwFormatFlyCnt & GetFlyCnt() const
SwTextAttr * MakeRedlineTextAttr(SwDoc &rDoc, SfxPoolItem const &rAttr)
create redline dummy text hint that must not be inserted into hints array