26 #include <osl/diagnose.h>
76 #include <unordered_map>
82 #define CHECK Check(true);
83 #define CHECK_NOTMERGED Check(false);
85 #define CHECK_NOTMERGED
93 , m_bInSplitNode(false)
94 , m_bCalcHiddenParaField(false)
95 , m_bHiddenByParaField(false)
98 , m_bStartMapNeedsSorting(false)
99 , m_bEndMapNeedsSorting(false)
100 , m_bWhichMapNeedsSorting(false)
116 return (pAttr->
GetStart() < nPos) && (nPos < *pAttr->
End());
136 bool isOverlap(
const sal_Int32 nStart1,
const sal_Int32 nEnd1,
137 const sal_Int32 nStart2,
const sal_Int32 nEnd2)
140 ((nStart1 > nStart2) && (nStart1 < nEnd2) && (nEnd1 > nEnd2))
141 || ((nStart1 < nStart2) && (nStart2 < nEnd1) && (nEnd1 < nEnd2));
147 const sal_Int32 nStart2,
const sal_Int32 nEnd2)
149 return ((nStart1 == nStart2) || (nEnd1 == nEnd2))
151 ? (nStart1 != nEnd1) || (nStart2 == nEnd2)
152 : ((nStart1 < nStart2) ? (nEnd1 >= nEnd2) : (nEnd1 <= nEnd2));
181 enum Split_t { FAIL, SPLIT_NEW, SPLIT_OTHER };
190 splitPolicy(
const sal_uInt16 nWhichNew,
const sal_uInt16 nWhichOther)
216 pFormat->
Add(
this );
224 pFormat->
Add(
this );
232 const sal_Int32 nStart,
const sal_Int32 nEnd)
236 switch (pNew->
Which())
249 assert(!
"MakeTextAttrNesting: what the hell is that?");
257 static NestList_t::iterator
259 NestList_t::iterator
const iter, sal_Int32
const nSplitPos,
260 bool const bSplitAtStart,
bool const bOtherDummy)
262 const sal_Int32 nStartPos(
263 (bSplitAtStart && bOtherDummy) ? nSplitPos + 1 : nSplitPos );
265 rNode, **iter, nStartPos, *(*iter)->GetEnd() ) );
266 (*iter)->SetEnd(nSplitPos);
267 return rSplits.insert(iter + 1, pNew);
272 const sal_Int32 nNewStart,
273 const sal_Int32 nOtherStart,
const sal_Int32 nOtherEnd,
bool bOtherDummy)
275 const bool bSplitAtStart(nNewStart < nOtherStart);
276 const sal_Int32 nSplitPos( bSplitAtStart ? nOtherStart : nOtherEnd );
278 NestList_t::iterator
const iter(
279 std::find_if( rSplits.begin(), rSplits.end(),
283 if (iter != rSplits.end())
285 lcl_DoSplitImpl(rSplits, rNode, iter, nSplitPos, bSplitAtStart, bOtherDummy);
370 const sal_uInt16 nNewWhich( rNewHint.
Which() );
371 const sal_Int32 nNewStart( rNewHint.
GetStart() );
372 const sal_Int32 nNewEnd ( *rNewHint.
GetEnd() );
385 SplitNew.push_back(& rNewHint);
388 for (
size_t i = 0;
i <
Count(); ++
i )
394 const sal_uInt16 nOtherWhich( pOther->
Which() );
395 const sal_Int32 nOtherStart( pOther->
GetStart() );
396 const sal_Int32 nOtherEnd ( *pOther->
GetEnd() );
397 if (
isOverlap(nNewStart, nNewEnd, nOtherStart, nOtherEnd ))
402 SAL_INFO(
"sw.core",
"cannot insert hint: overlap");
403 for (
const auto& aSplit : SplitNew)
411 OverlappingExisting.push_back(
412 static_txtattr_cast<SwTextAttrNesting*>(pOther));
415 assert(!
"bad code monkey");
419 else if (
isNestedAny(nNewStart, nNewEnd, nOtherStart, nOtherEnd))
421 if (!bNewSelfNestable && (nNewWhich == nOtherWhich))
424 OverwrittenExisting.push_back(
425 static_txtattr_cast<SwTextAttrNesting*>(pOther));
427 else if ((nNewStart == nOtherStart) && pOther->
HasDummyChar())
431 assert(!
"ERROR: inserting duplicate CH_TXTATR hint");
433 }
else if (nNewEnd < nOtherEnd) {
439 assert(SplitNew.front()->GetStart() == nNewStart);
440 SplitNew.front()->SetStart(nNewStart + 1);
448 for (
auto iter = SplitNew.begin(); iter != SplitNew.end(); ++iter)
450 SwPaM const temp(rNode, (*iter)->GetStart(), rNode, *(*iter)->GetEnd());
451 std::vector<std::pair<sal_uLong, sal_Int32>> Breaks;
457 SAL_INFO(
"sw.core",
"cannot insert hint: fieldmark overlap");
458 assert(SplitNew.size() == 1);
464 for (
auto const& rPos : Breaks)
468 rPos.second,
true,
true);
475 "splitting the unsplittable ???");
485 for (
auto& rpOther : OverlappingExisting)
487 const sal_Int32 nOtherStart( rpOther->GetStart() );
488 const sal_Int32 nOtherEnd ( *rpOther->GetEnd() );
490 for (
const auto& rpNew : SplitNew)
492 const sal_Int32 nSplitNewStart( rpNew->GetStart() );
493 const sal_Int32 nSplitNewEnd ( *rpNew->GetEnd() );
495 const bool bRemoveOverlap(
496 !bNewSelfNestable && (nNewWhich == rpOther->Which()) );
499 nOtherStart, nOtherEnd))
504 "this one should be in OverwrittenExisting?");
510 assert(!
"existing hint inside new hint: why?");
516 rpOther->SetStart(nSplitNewEnd);
522 SAL_INFO(
"sw.core",
"hints array full :-(");
527 nOtherStart, nSplitNewEnd ) );
535 rpOther->SetEnd(nSplitNewStart);
541 SAL_INFO(
"sw.core",
"hints array full :-(");
546 nSplitNewStart, nOtherEnd ) );
559 SAL_INFO(
"sw.core",
"hints array full :-(");
564 for (
const auto& rpHint : SplitNew)
572 for (
auto& rpOther : OverwrittenExisting)
574 const sal_Int32 nOtherStart( rpOther->GetStart() );
575 const sal_Int32 nOtherEnd ( *rpOther->GetEnd() );
578 if ((nNewStart <= nOtherStart) && (nOtherEnd <= nNewEnd))
585 assert((nOtherStart < nNewStart) || (nNewEnd < nOtherEnd));
591 if (nNewEnd < nOtherEnd)
595 rNode, *rpOther, nNewEnd, nOtherEnd ) );
597 SAL_WARN_IF(!bSuccess,
"sw.core",
"recursive call 1 failed?");
599 if (nOtherStart < nNewStart)
601 rpOther->SetEnd(nNewStart);
603 SAL_WARN_IF(!bSuccess,
"sw.core",
"recursive call 2 failed?");
626 const sal_uInt16 nWhich = rNewHint.
Which();
628 const sal_Int32 nThisStart = rNewHint.
GetStart();
629 const sal_Int32 nThisEnd = *rNewHint.
GetEnd();
630 const bool bNoLengthAttribute = nThisStart == nThisEnd;
632 std::vector<SwTextAttr*> aInsDelHints;
640 if ( !bNoLengthAttribute )
642 for (
size_t i = 0;
i <
Count(); ++
i )
652 sal_Int32 nOtherStart = pOther->
GetStart();
653 const sal_Int32 nOtherEnd = *pOther->
GetEnd();
657 if ( nOtherStart < nThisStart && nThisStart < nOtherEnd )
660 pOther->
GetAttr(), nOtherStart, nThisStart );
664 static_txtattr_cast<SwTextCharFormat*>(pOther)->GetSortNumber() );
666 aInsDelHints.push_back( pNewAttr );
672 nOtherStart = nThisStart;
677 if ( nOtherStart < nThisEnd && nThisEnd < nOtherEnd )
680 pOther->
GetAttr(), nOtherStart, nThisEnd );
684 static_txtattr_cast<SwTextCharFormat*>(pOther)->GetSortNumber());
686 aInsDelHints.push_back( pNewAttr );
695 for (
const auto& rpHint : aInsDelHints )
710 aBounds.
insert( nThisStart );
711 aBounds.
insert( nThisEnd );
713 if ( !bNoLengthAttribute )
715 for (
size_t i = 0;
i <
Count(); ++
i )
723 const sal_Int32 nOtherStart = pOther->
GetStart();
724 const sal_Int32 nOtherEnd = *pOther->
End();
726 aBounds.
insert( nOtherStart );
727 aBounds.
insert( nOtherEnd );
731 auto aStartIter = aBounds.
lower_bound( nThisStart );
733 sal_Int32 nPorStart = *aStartIter;
735 bool bDestroyHint =
true;
739 while ( aStartIter != aEndIter || bNoLengthAttribute )
741 OSL_ENSURE( bNoLengthAttribute || nPorStart < *aStartIter,
"AUTOSTYLES: BuildPortion trouble" );
743 const sal_Int32 nPorEnd = bNoLengthAttribute ? nPorStart : *aStartIter;
744 aInsDelHints.clear();
747 for (
size_t i = 0;
i <
Count(); ++
i )
756 const sal_Int32 nOtherStart = pOther->
GetStart();
758 if ( nOtherStart > nPorStart )
761 if ( pOther->
GetEnd() && *pOther->
GetEnd() == nPorEnd && nOtherStart == nPorStart )
763 OSL_ENSURE( *pOther->
GetEnd() == nPorEnd,
"AUTOSTYLES: BuildPortion trouble" );
764 aInsDelHints.push_back( pOther );
774 sal_uInt16 nCharStyleCount = 0;
775 for (
const auto& rpHint : aInsDelHints )
788 bNoLengthAttribute ||
804 std::shared_ptr<SfxItemSet> pOldStyle =
static_cast<const SwFormatAutoFormat&
>(pOther->GetAttr()).GetStyleHandle();
816 aNewSet.Put( *pItem );
819 pItem = aItemIter.NextItem();
827 if ( aNewSet.Count() )
830 aNewSet, nPorStart, nPorEnd );
839 if ( nPorStart == nThisStart &&
840 nPorEnd == nThisEnd &&
843 pNewAttr = &rNewHint;
844 bDestroyHint =
false;
849 nPorStart, nPorEnd );
858 for (
const auto& rpHint : aInsDelHints )
861 pCurrentAutoStyle = rpHint;
863 pCurrentCharFormat = rpHint;
867 if ( pCurrentAutoStyle )
869 std::shared_ptr<SfxItemSet> pCurrentStyle =
static_cast<const SwFormatAutoFormat&
>(pCurrentAutoStyle->
GetAttr()).GetStyleHandle();
873 aNewSet.
Put( *pNewStyle );
886 if ( SfxItemState::SET == rWholeParaAttrSet.
GetItemState( pItem->
Which(),
false, &pTmpItem ) &&
894 while ((pItem = aIter2.
NextItem()));
898 Delete( pCurrentAutoStyle );
902 if ( aNewSet.
Count() )
904 nPorStart, nPorEnd );
909 bool bOptimizeAllowed =
true;
913 if ( !bNoLengthAttribute && rNode.
HasSwAttrSet() && pNewStyle->Count() )
915 std::unique_ptr<SfxItemSet> pNewSet;
924 if ( SfxItemState::SET == rWholeParaAttrSet.
GetItemState( pItem->
Which(),
false, &pTmpItem ) &&
931 pNewSet = pNewStyle->
Clone();
932 pNewSet->ClearItem( pItem->
Which() );
936 while ((pItem = aIter2.
NextItem()));
940 bOptimizeAllowed =
false;
941 if ( pNewSet->Count() )
951 if ( bOptimizeAllowed &&
952 nPorStart == nThisStart &&
953 nPorEnd == nThisEnd )
955 pNewAttr = &rNewHint;
956 bDestroyHint =
false;
958 else if ( pNewStyle )
961 nPorStart, nPorEnd );
973 if ( !bNoLengthAttribute )
975 nPorStart = *aStartIter;
989 switch (rAttr.
Which())
1004 assert(!
"unsupported redline attribute");
1019 sal_Int32
const nStt,
1020 sal_Int32
const nEnd,
1031 aItemSet.Put( rAttr );
1040 const std::shared_ptr<SfxItemSet> pAutoStyle =
static_cast<const SwFormatAutoFormat&
>(rAttr).GetStyleHandle();
1041 std::unique_ptr<const SfxItemSet> pNewSet(
1042 pAutoStyle->SfxItemSet::Clone(
true, &rDoc.
GetAttrPool() ));
1053 switch( rNew.
Which() )
1067 pNew =
new SwTextINetFormat( static_cast<SwFormatINetFormat&>(rNew), nStt, nEnd );
1071 pNew =
new SwTextField( static_cast<SwFormatField &>(rNew), nStt,
1090 pNew =
new SwTextInputField( static_cast<SwFormatField &>(rNew), nStt, nEnd,
1097 pNew =
new SwTextFlyCnt( static_cast<SwFormatFlyCnt&>(rNew), nStt );
1098 if ( static_cast<const SwFormatFlyCnt &>(rAttr).GetTextFlyCnt() )
1101 static_cast<SwTextFlyCnt *
>(pNew)->CopyFlyFormat( rDoc );
1106 pNew =
new SwTextFootnote( static_cast<SwFormatFootnote&>(rNew), nStt );
1108 if( static_cast<SwFormatFootnote&>(rAttr).GetTextFootnote() )
1109 static_cast<SwTextFootnote*
>(pNew)->SetSeqNo( static_cast<SwFormatFootnote&>(rAttr).GetTextFootnote()->GetSeqRefNo() );
1113 ?
new SwTextRefMark( static_cast<SwFormatRefMark&>(rNew), nStt )
1114 :
new SwTextRefMark( static_cast<SwFormatRefMark&>(rNew), nStt, &nEnd );
1124 if (pTOXType && &pTOXType->
GetDoc() != &rDoc)
1135 pNew =
new SwTextRuby( static_cast<SwFormatRuby&>(rNew), nStt, nEnd );
1152 sal_Int32 nStt, sal_Int32 nEnd )
1170 switch( pAttr->
Which() )
1194 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pAttr));
1207 switch( pFieldType->
Which() )
1222 static_cast<SwDDEFieldType*>(pFieldType)->DecRefCnt();
1248 SwFormatMeta & rFormatMeta( static_cast<SwFormatMeta &>(pTextMeta->GetAttr()) );
1249 if (::
sw::Meta* pMeta = rFormatMeta.GetMeta())
1253 static constexpr OUStringLiteral metaNS(
u"urn:bails");
1254 const css::uno::Reference<css::rdf::XResource> xSubject = pMeta->MakeUnoObject();
1255 uno::Reference<frame::XModel>
xModel = pDocSh->GetBaseModel();
1273 const sal_Int32 nStart,
1274 const sal_Int32 nEnd,
1279 "SwTextNode::InsertItem should not be called with character attributes");
1292 const bool bSuccess(
InsertHint( pNew, nMode ) );
1308 bool bHiddenPara =
false;
1322 const sal_Int32 nStart( pAttr->
GetStart() );
1327 switch( pAttr->
Which() )
1342 reinterpret_cast<const SfxPoolItem**>(&pAnchor) );
1346 OUString
const ins(
InsertText(c, aIdx, nInsertFlags) );
1358 (RndStdIds::FLY_AS_CHAR == pAnchor->
GetAnchorId()) &&
1379 bool bCheckControlLayer =
false;
1381 if( bCheckControlLayer )
1394 Update( aTmpIdx, 1,
true );
1425 Update( aTmpIdx, 1,
true );
1447 sal_uLong nEndIdx = rNodes[ nSttIdx++ ]->EndOfSectionIndex();
1448 for( ; nSttIdx < nEndIdx; ++nSttIdx )
1451 if(
nullptr != pCNd )
1455 pTable->DelFrames();
1467 OUString
const ins(
InsertText(c, aNdIdx, nInsertFlags) );
1492 if( !pTextFootnote )
1502 OSL_ENSURE( bSuccess,
"FootnoteIdx not inserted." );
1529 aIdx, nInsertFlags) );
1537 const sal_Int32 *
const pEnd(pAttr->
GetEnd());
1540 pAttr->
SetEnd(*pEnd + 1);
1546 sal_Int32 nEnd = nStart;
1547 bool bInputFieldStartCharInserted =
false;
1548 bool bInputFieldEndCharInserted =
false;
1549 const bool bHasContent( pAttr->
HasContent() );
1552 switch( pAttr->
Which() )
1557 if ( pTextInputField )
1566 const sal_Int32*
const pEnd(pAttr->
GetEnd());
1567 assert(pEnd !=
nullptr);
1568 pAttr->
SetEnd(*pEnd + aContent.getLength());
1578 bInputFieldStartCharInserted =
true;
1579 const sal_Int32*
const pEnd(pAttr->
GetEnd());
1580 assert(pEnd !=
nullptr);
1581 pAttr->
SetEnd(*pEnd + 1);
1585 const sal_Int32*
const pEnd(pAttr->
GetEnd());
1586 assert(pEnd !=
nullptr);
1591 bInputFieldEndCharInserted =
true;
1592 pAttr->
SetEnd(*pEnd + 1);
1607 bool bInsertHint =
true;
1610 if ( pTextInputField !=
nullptr )
1612 if ( pAttr->
End() == nullptr )
1614 bInsertHint =
false;
1622 if ( *(pAttr->
End()) < *(pTextInputField->
End()) )
1624 pAttr->
SetEnd(*(pTextInputField->
End()));
1630 const bool bRet = bInsertHint
1631 &&
m_pSwpHints->TryInsertHint( pAttr, *
this, nMode );
1651 && (nEnd - nStart) > 0 )
1658 if ( bInputFieldEndCharInserted
1659 && (nEnd - nStart) > 0 )
1661 SwIndex aIdx(
this, nEnd - 1 );
1665 if ( bInputFieldStartCharInserted )
1686 OSL_FAIL(
"DeleteAttribute called, but text node without hints?");
1721 const sal_uInt16 nWhich,
1722 const sal_Int32 nStart,
1723 const sal_Int32 nEnd )
1731 const sal_Int32 nHintStart = pTextHt->
GetStart();
1732 if (nStart < nHintStart)
1736 else if ( (nStart == nHintStart) && (nWhich == pTextHt->
Which()) )
1740 assert(!
"hey, that's a CHRATR! how did that get in?");
1762 sal_Int32
const *
const pEndIdx = pTextHt->
GetEnd();
1767 const SwIndex aIdx(
this, nStart );
1773 const SwIndex aIdx(
this, nStart );
1774 OSL_ENSURE( pTextHt->
End() !=
nullptr,
"<SwTextNode::DeleteAttributes(..)> - missing End() at <SwTextAttr> instance which has content" );
1777 else if( *pEndIdx == nEnd )
1798 sal_Int32 nFndPos = nStt;
1799 sal_Int32 nEndPos = nEnd;
1803 if (nFndPos<0 || nFndPos>=nEndPos )
1807 const SwIndex aIdx(
this, nFndPos );
1847 const sal_uInt16 nWhich = pItem->
Which();
1863 if (!(nLevel != -1 && pCurrNum))
1867 if (!pCurrNumFormat)
1876 if (pCurrCharFormat && pCurrCharFormat->
GetItemState(nWhich,
false) != SfxItemState::SET)
1881 pCurrNum->
Set(nLevel,aNewNumFormat);
1889 const sal_Int32 nStt,
1890 const sal_Int32 nEnd,
1902 if ( !nStt && (nEnd ==
m_Text.getLength()) &&
1907 bool bHasCharFormats =
false;
1914 bHasCharFormats =
true;
1920 if( !bHasCharFormats )
1922 aTextSet.Put( rSet );
1925 if( aTextSet.Count() != rSet.
Count() )
1927 const bool bRet =
SetAttr( rSet );
1928 if( !aTextSet.Count() )
1934 const bool bAutoStyle = SfxItemState::SET == aTextSet.GetItemState(
RES_TXTATR_AUTOFMT,
false, &pItem );
1937 std::shared_ptr<SfxItemSet> pAutoStyleSet =
static_cast<const SwFormatAutoFormat*
>(pItem)->GetStyleHandle();
1938 const bool bRet =
SetAttr( *pAutoStyleSet );
1939 if( 1 == aTextSet.Count() )
1960 const sal_uInt16 nWhich = pItem->
Which();
1962 "SwTextNode::SetAttr(): unknown attribute" );
1966 (
GetDoc().GetDfltCharFormat() ==
1967 static_cast<const SwFormatCharFormat*>(pItem)->GetCharFormat()))
1978 aCharSet.Put( *pItem );
1984 const_cast<SfxPoolItem&>(*pItem), nStt, nEnd );
1988 if (ppNewTextAttr && !*ppNewTextAttr)
1989 *ppNewTextAttr = pNew;
1990 if ( nEnd != nStt && !pNew->
GetEnd() )
1992 OSL_FAIL(
"Attribute without end, but area marked");
2007 if ( aCharSet.Count() )
2034 ( SfxItemState::SET == pCFSet->
GetItemState( nWhich ) ) )
2035 rSet.
Put( pCFSet->
Get( nWhich ) );
2059 ( SfxItemState::SET == pCFSet->
GetItemState( nWhich ) ) )
2060 rSet.
Put( pCFSet->
Get( nWhich ) );
2084 struct SwPoolItemEndPair
2090 SwPoolItemEndPair() : mpItem( nullptr ), mnEndPos( 0 ) {};
2117 const bool bOnlyTextAttr,
const bool bGetFromChrFormat,
2118 const bool bMergeIndentValuesOfNumRule,
2137 if (bMergeIndentValuesOfNumRule)
2164 for (
size_t n = 0;
n < nSize; ++
n)
2167 const sal_Int32 nAttrStart = pHt->
GetStart();
2168 if (nAttrStart > nEnd)
2171 const sal_Int32* pAttrEnd = pHt->
End();
2175 if( ( nAttrStart < nStt &&
2177 : nStt <= *pAttrEnd )) ||
2178 ( nStt == nAttrStart &&
2179 ( nAttrStart == *pAttrEnd || !nStt )))
2180 (*fnMergeAttr)( rSet, pHt->
GetAttr() );
2186 std::unique_ptr< std::vector< SwPoolItemEndPair > > pAttrArr;
2190 for (
size_t n = 0;
n < nSize; ++
n)
2193 const sal_Int32 nAttrStart = pHt->
GetStart();
2194 if (nAttrStart > nEnd)
2197 const sal_Int32* pAttrEnd = pHt->
End();
2201 bool bChkInvalid =
false;
2202 if (nAttrStart <= nStt)
2204 if (*pAttrEnd <= nStt)
2207 if (nEnd <= *pAttrEnd)
2208 (*fnMergeAttr)( aFormatSet, pHt->
GetAttr() );
2214 else if (nAttrStart < nEnd
2221 std::unique_ptr< SfxItemIter > pItemIter;
2230 pItem = pItemIter->GetCurItem();
2236 const sal_Int32 nHintEnd = *pAttrEnd;
2238 for (; pItem; pItem = pItemIter ? pItemIter->NextItem() :
nullptr)
2240 const sal_uInt16 nHintWhich = pItem->
Which();
2242 "SwTextNode::GetAttr(): unknown attribute?");
2247 new std::vector< SwPoolItemEndPair >(coArrSz));
2250 std::vector< SwPoolItemEndPair >::iterator pPrev = pAttrArr->begin();
2258 pPrev = pAttrArr->end();
2261 if( pPrev != pAttrArr->end() )
2263 if( !pPrev->mpItem )
2265 if ( bOnlyTextAttr || *pItem != aFormatSet.Get( nHintWhich ) )
2267 if( nAttrStart > nStt )
2274 pPrev->mpItem = pItem;
2275 pPrev->mnEndPos = nHintEnd;
2281 if( pPrev->mnEndPos == nAttrStart &&
2282 *pPrev->mpItem == *pItem )
2284 pPrev->mpItem = pItem;
2285 pPrev->mnEndPos = nHintEnd;
2300 for (
size_t n = 0;
n < coArrSz; ++
n)
2302 const SwPoolItemEndPair& rItemPair = (*pAttrArr)[
n ];
2305 const sal_uInt16 nWh =
2308 if (nEnd <= rItemPair.mnEndPos)
2310 if( *rItemPair.mpItem != aFormatSet.Get( nWh ) )
2311 (*fnMergeAttr)( rSet, *rItemPair.mpItem );
2320 if( aFormatSet.Count() )
2323 aFormatSet.Differentiate( rSet );
2327 if (aFormatSet.Count())
2330 rSet.
Put( aFormatSet );
2333 return rSet.
Count() != 0;
2339 typedef std::pair<sal_Int32, sal_Int32> AttrSpan_t;
2340 typedef std::multimap<AttrSpan_t, const SwTextAttr*> AttrSpanMap_t;
2345 operator()(
const AttrSpanMap_t::value_type& i_rAttrSpan)
2355 struct RemovePresentAttrs
2357 explicit RemovePresentAttrs(
SfxItemSet& io_rAttrSet)
2358 : m_rAttrSet(io_rAttrSet)
2363 operator()(
const AttrSpanMap_t::value_type& i_rAttrSpan)
2366 if (!i_rAttrSpan.second)
2371 const SwTextAttr*
const pAutoStyle(i_rAttrSpan.second);
2373 for (
const SfxPoolItem* pItem(aIter.GetCurItem()); pItem; pItem = aIter.NextItem())
2375 const sal_uInt16 nWhich(pItem->Which());
2378 m_rAttrSet.ClearItem(nWhich);
2394 lcl_CollectHintSpans(
const SwpHints& i_rHints,
const sal_Int32 nLength,
2395 AttrSpanMap_t& o_rSpanMap)
2397 sal_Int32 nLastEnd(0);
2399 for (
size_t i = 0;
i < i_rHints.
Count(); ++
i)
2402 const sal_uInt16 nWhich(pHint->
Which());
2405 const AttrSpan_t aSpan(pHint->
GetStart(), *pHint->
End());
2406 o_rSpanMap.emplace(aSpan, pHint);
2409 if (nLastEnd < aSpan.first)
2412 o_rSpanMap.emplace( AttrSpan_t(nLastEnd, aSpan.first),
nullptr );
2415 nLastEnd = aSpan.second;
2420 if (nLastEnd != nLength && nLength != 0)
2422 o_rSpanMap.emplace(AttrSpan_t(nLastEnd, nLength),
nullptr);
2427 lcl_FillWhichIds(
const SfxItemSet& i_rAttrSet, std::vector<sal_uInt16>& o_rClearIds)
2429 o_rClearIds.reserve(i_rAttrSet.
Count());
2431 for (
const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
2433 o_rClearIds.push_back(pItem->Which());
2437 struct SfxItemSetClearer
2440 explicit SfxItemSetClearer(
SfxItemSet & rItemSet) : m_rItemSet(rItemSet) { }
2441 void operator()(sal_uInt16
const nWhich) { m_rItemSet.
ClearItem(nWhich); }
2452 typedef AttrSpanMap_t::iterator AttrSpanMap_iterator_t;
2453 AttrSpanMap_t aAttrSpanMap;
2455 if (i_rAttrSet.
Count() == 0)
2466 AttrSpanMap_iterator_t aCurRange(aAttrSpanMap.begin());
2467 const AttrSpanMap_iterator_t aEnd(aAttrSpanMap.end());
2468 while (aCurRange != aEnd)
2470 typedef std::pair<AttrSpanMap_iterator_t, AttrSpanMap_iterator_t>
2472 AttrSpanMapRange_t aRange(aAttrSpanMap.equal_range(aCurRange->first));
2477 std::for_each(aRange.first, aRange.second, RemovePresentAttrs(aCurSet));
2481 if (aCurSet.Count() != 0)
2483 AttrSpanMap_iterator_t aAutoStyleIt(
2484 std::find_if(aRange.first, aRange.second, IsAutoStyle()));
2485 if (aAutoStyleIt != aRange.second)
2489 SwTextAttr*
const pAutoStyle(const_cast<SwTextAttr*>(aAutoStyleIt->second));
2490 const std::shared_ptr<SfxItemSet> pOldStyle(
2491 static_cast<const SwFormatAutoFormat&>(
2492 pAutoStyle->
GetAttr()).GetStyleHandle());
2493 aCurSet.Put(*pOldStyle);
2501 aCurRange->first.first, aCurRange->first.second));
2504 aCurRange = aRange.second;
2511 std::vector<sal_uInt16> aClearedIds;
2512 lcl_FillWhichIds(i_rAttrSet, aClearedIds);
2547 std::vector<sal_uInt16> aProcessedIds;
2549 if( aThisSet.
Count() )
2554 std::vector<sal_uInt16> aClearWhichIds;
2558 if( SfxItemState::SET == aNdSet.GetItemState( pItem->
Which(),
false, &pNdItem ) )
2560 if (*pItem == *pNdItem)
2562 aClearWhichIds.push_back( pItem->
Which() );
2566 aConvertSet.
Put(*pItem);
2568 aProcessedIds.push_back(pItem->
Which());
2572 aConvertSet.
Put(*pItem);
2586 std::for_each(aProcessedIds.begin(), aProcessedIds.end(),
2587 SfxItemSetClearer(aNdSet));
2592 if( aNdSet.Count() )
2608 const size_t nSize =
Count();
2612 switch( pAttr->
Which() )
2638 bool bNewHiddenByParaField =
false;
2639 int nNewResultWeight = 0;
2640 const size_t nSize =
Count();
2646 const sal_uInt16 nWhich = pTextHt->
Which();
2653 if (nCurWeight > nNewResultWeight)
2655 nNewResultWeight = nCurWeight;
2658 else if (nCurWeight == nNewResultWeight && bNewHiddenByParaField)
2668 return bOldHiddenByParaField != bNewHiddenByParaField;
2685 typedef std::multimap< int, std::pair<SwTextAttr*, bool> > PortionMap;
2686 PortionMap aPortionMap;
2687 std::unordered_map<int, bool> RsidOnlyAutoFormatFlagMap;
2692 for (
size_t i = 0;
i <
Count(); ++
i )
2701 bool isRsidOnlyAutoFormat(
false);
2705 std::shared_ptr<SfxItemSet>
const pSet(
2726 isRsidOnlyAutoFormat =
true;
2737 const sal_Int32 nPorStart = pHt->
GetStart();
2738 if (nPorStart != nLastPorStart)
2740 nLastPorStart = nPorStart;
2741 aPortionMap.insert(std::make_pair(nKey,
2742 std::make_pair(pHt, isRsidOnlyAutoFormat)));
2743 RsidOnlyAutoFormatFlagMap[nKey] = isRsidOnlyAutoFormat;
2753 std::pair< PortionMap::iterator, PortionMap::iterator > aRange1 = aPortionMap.equal_range( i );
2754 std::pair< PortionMap::iterator, PortionMap::iterator > aRange2 = aPortionMap.equal_range( j );
2755 PortionMap::iterator aIter1 = aRange1.first;
2756 PortionMap::iterator aIter2 = aRange2.first;
2758 enum { MATCH, DIFFER_ONLY_RSID, DIFFER } eMerge(MATCH);
2759 size_t const nAttributesInPor1 = std::distance(aRange1.first, aRange1.second);
2760 size_t const nAttributesInPor2 = std::distance(aRange2.first, aRange2.second);
2761 bool const isRsidOnlyAutoFormat1(RsidOnlyAutoFormatFlagMap[i]);
2762 bool const isRsidOnlyAutoFormat2(RsidOnlyAutoFormatFlagMap[j]);
2765 bool const bSkipRsidOnlyAutoFormat(nAttributesInPor1 != nAttributesInPor2);
2770 if ((nAttributesInPor1 - (isRsidOnlyAutoFormat1 ? 1 : 0)) ==
2771 (nAttributesInPor2 - (isRsidOnlyAutoFormat2 ? 1 : 0))
2772 && (nAttributesInPor1 != 0 || nAttributesInPor2 != 0))
2777 while (aIter1 != aRange1.second || aIter2 != aRange2.second)
2780 if (aIter1 != aRange1.second && aIter2 != aRange2.second &&
2781 *aIter1->second.first->End() < aIter2->second.first->GetStart())
2787 if (bSkipRsidOnlyAutoFormat
2788 && aIter1 != aRange1.second && aIter1->second.second)
2790 assert(DIFFER != eMerge);
2791 eMerge = DIFFER_ONLY_RSID;
2795 if (bSkipRsidOnlyAutoFormat
2796 && aIter2 != aRange2.second && aIter2->second.second)
2798 assert(DIFFER != eMerge);
2799 eMerge = DIFFER_ONLY_RSID;
2803 assert(aIter1 != aRange1.second && aIter2 != aRange2.second);
2804 SwTextAttr const*
const p1 = aIter1->second.first;
2805 SwTextAttr const*
const p2 = aIter2->second.first;
2833 if (!pItem1 && !pItem2)
2835 if (!pItem1 || !pItem2)
2840 if (pItem1 != pItem2)
2854 if (DIFFER == eMerge)
2857 eMerge = DIFFER_ONLY_RSID;
2874 if (MATCH == eMerge)
2879 sal_Int32 nNewPortionEnd = 0;
2880 for ( aIter2 = aRange2.first; aIter2 != aRange2.second; ++aIter2 )
2883 nNewPortionEnd = *p2->
GetEnd();
2885 const size_t nCountBeforeDelete =
Count();
2889 if (
Count() < nCountBeforeDelete )
2892 aPortionMap.erase( aRange2.first, aRange2.second );
2896 aRange1 = aPortionMap.equal_range( i );
2897 for ( aIter1 = aRange1.first; aIter1 != aRange1.second; ++aIter1 )
2901 p1->
SetEnd(nNewPortionEnd);
2915 bool const bSetIgnoreFlag(DIFFER_ONLY_RSID == eMerge);
2916 for (aIter1 = aRange1.first; aIter1 != aRange1.second; ++aIter1)
2918 if (!aIter1->second.second)
2920 SwTextAttr *
const pCurrent(aIter1->second.first);
2929 for (aIter2 = aRange2.first; aIter2 != aRange2.second; ++aIter2)
2931 if (!aIter2->second.second)
2933 SwTextAttr *
const pCurrent(aIter2->second.first);
2953 const sal_Int32 nHtStart = rNewCharFormat.
GetStart();
2954 const sal_Int32 nHtEnd = *rNewCharFormat.
GetEnd();
2955 sal_uInt16 nSortNumber = 0;
2957 for (
size_t i = 0;
i < rHints.
Count(); ++
i )
2961 const sal_Int32 nOtherStart = pOtherHt->
GetStart();
2963 if ( nOtherStart > nHtStart )
2968 const sal_Int32 nOtherEnd = *pOtherHt->
End();
2970 if ( nOtherStart == nHtStart && nOtherEnd == nHtEnd )
2977 if ( nSortNumber > 0 )
2995 OSL_FAIL(
"hints array full :-(");
2999 const sal_Int32 *pHtEnd = pHint->
GetEnd();
3000 const sal_uInt16 nWhich = pHint->
Which();
3001 std::vector<sal_uInt16> aWhichSublist;
3034 const sal_uInt16 *pRanges = pSet->GetRanges();
3035 while( (*pRanges) != 0 )
3037 const sal_uInt16 nBeg = *pRanges;
3039 const sal_uInt16 nEnd = *pRanges;
3041 for( sal_uInt16 nSubElem = nBeg; nSubElem <= nEnd; ++nSubElem )
3042 if( pSet->HasItem( nSubElem ) )
3043 aWhichSublist.push_back( nSubElem );
3055 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pHint));
3056 bool bDelFirst =
nullptr != pTextField->
GetpTextNode();
3081 static_cast<SwDDEFieldType*>(pField->
GetTyp())->IncRefCnt();
3090 bool bInsFieldType =
false;
3101 if( pFieldType != pField->
GetTyp() )
3107 pFieldType->
SetSeqRefNo( *const_cast<SwSetExpField*>(static_cast<const SwSetExpField*>(pField)) );
3116 static_cast<SwDDEFieldType*>(pField->
GetTyp())->IncRefCnt();
3143 for(
size_t n = 0, nEnd =
Count();
n < nEnd; ++
n )
3145 const sal_Int32 *pTmpHtEnd;
3146 const sal_Int32 *pTmpHintEnd;
3149 nullptr != ( pTmpHtEnd = pTmpHt->
GetEnd() ) &&
3150 nullptr != ( pTmpHintEnd = pHint->
GetEnd() ) )
3155 bool bDelOld =
true, bChgStart =
false, bChgEnd =
false;
3175 pHint->
SetEnd(*pTmpHtEnd);
3212 sal_Int32 nHtStart = pHint->
GetStart();
3238 if( *pHtEnd < nHtStart )
3240 assert(*pHtEnd >= nHtStart);
3249 const sal_Int32 nHintEnd = *pHtEnd;
3257 if (!bRet)
return false;
3264 else if ( !bNoHintAdjustMode &&
3271 static_cast<const SwFormatAutoFormat&>(pHint->
GetAttr()).GetStyleHandle()->GetPool() ==
3276 if ( nHtStart < nHintEnd )
3307 const SwUpdateAttr aHint(nHtStart, nHintEnd, nWhich, aWhichSublist);
3344 assert(*findIt2 == pHt);
3351 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pHint));
3357 const_cast<SwDDEFieldType*>(static_cast<const SwDDEFieldType*>(pFieldTyp))->DecRefCnt();
3368 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pHint));
3382 assert(SAL_MAX_SIZE != nPos);
3383 if( SAL_MAX_SIZE != nPos )
3393 while ( nPos < m_pSwpHints->
Count() )
3398 switch( pDel->
Which() )
3425 sal_uInt16 nScript )
const
3439 const sal_Int32 nEnd = nBegin + nLen;
3441 for (
size_t i = 0;
i < nSize; ++
i )
3444 const sal_Int32 nAttrStart = pHt->
GetStart();
3445 if( nEnd < nAttrStart )
3448 const sal_uInt16 nWhich = pHt->
Which();
3450 if( nWhichId == nWhich ||
3453 const sal_Int32 *pEndIdx = pHt->
End();
3459 if( nAttrStart >= nEnd || nBegin >= *pEndIdx )
3462 else if( nBegin != nAttrStart || ( nAttrStart != *pEndIdx && nBegin ))
3464 if( nAttrStart >= nBegin )
3466 if( pHt->
DontExpand() ? nBegin >= *pEndIdx : nBegin > *pEndIdx)
3473 if( nAttrStart <= nBegin && nEnd <= *pEndIdx )
3492 switch ( rAttr.
Which() )
3511 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)
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)
void CalcBreaks(std::vector< std::pair< sal_uLong, sal_Int32 >> &rBreaks, SwPaM const &rPam, bool const isOnlyFieldmarks)
std::vector< SwTextAttr * > m_HintsByEnd
SW_DLLPUBLIC void Resort() const
const_iterator lower_bound(const Value &x) const
sal_uLong GetIndex() 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 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.
constexpr TypedWhichId< SvxEscapementItem > RES_CHRATR_ESCAPEMENT(6)
size_t GetIndexOf(const SwTextAttr *pHt) const
bool m_bFootnote
footnotes
sal_uLong StartOfSectionIndex() const
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!)
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
const SwNumFormat * GetNumFormat(sal_uInt16 i) const
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.
Pos1 completely contained in Pos2.
OUString GetListId() 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< SwFormatFlyCnt > RES_TXTATR_FLYCNT(57)
static bool lcl_IsIgnoredCharFormatForBullets(const sal_uInt16 nWhich)
constexpr TypedWhichId< SvxUnderlineItem > RES_CHRATR_UNDERLINE(14)
bool HasDummyChar() const
SwTextNode * GetpTextNode() const
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
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(59)
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)
SwpHints(const SwTextNode &rParent)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
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)
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(58)
void SetCalcHiddenCharFlags() const
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
::cppu::OWeakObject & m_rParent
sal_Unicode GetCharOfTextAttr(const SwTextAttr &rAttr)
const_iterator upper_bound(const Value &x) const
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!
constexpr sal_uInt16 RES_TXTATR_WITHEND_END(56)
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 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
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)
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
sal_uInt16 const aCharAutoFormatSetRange[]
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
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)
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 ChangeNodeIndex(sal_uLong nNew)
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
void Set(sal_uInt16 i, const SwNumFormat *)
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)
void TryCharSetExpandToNum(const SfxItemSet &pCharSet)
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)
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)
sal_uInt16 const aCharFormatSetRange[]
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.
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.
const sal_uInt16 * GetRanges() const
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)
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
SS for PoolItems: hard attributation.
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.
const sal_Int32 COMPLETE_STRING
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 IsDefaultItem(const SfxPoolItem *pItem)
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