26 #include <osl/diagnose.h>
75 #include <unordered_map>
81 #define CHECK Check(true);
82 #define CHECK_NOTMERGED Check(false);
84 #define CHECK_NOTMERGED
92 , m_bInSplitNode(false)
93 , m_bCalcHiddenParaField(false)
94 , m_bHiddenByParaField(false)
97 , m_bStartMapNeedsSorting(false)
98 , m_bEndMapNeedsSorting(false)
99 , m_bWhichMapNeedsSorting(false)
115 return (pAttr->
GetStart() < nPos) && (nPos < *pAttr->
End());
135 bool isOverlap(
const sal_Int32 nStart1,
const sal_Int32 nEnd1,
136 const sal_Int32 nStart2,
const sal_Int32 nEnd2)
139 ((nStart1 > nStart2) && (nStart1 < nEnd2) && (nEnd1 > nEnd2))
140 || ((nStart1 < nStart2) && (nStart2 < nEnd1) && (nEnd1 < nEnd2));
146 const sal_Int32 nStart2,
const sal_Int32 nEnd2)
148 return ((nStart1 == nStart2) || (nEnd1 == nEnd2))
150 ? (nStart1 != nEnd1) || (nStart2 == nEnd2)
151 : ((nStart1 < nStart2) ? (nEnd1 >= nEnd2) : (nEnd1 <= nEnd2));
180 enum Split_t { FAIL, SPLIT_NEW, SPLIT_OTHER };
189 splitPolicy(
const sal_uInt16 nWhichNew,
const sal_uInt16 nWhichOther)
215 pFormat->
Add(
this );
223 pFormat->
Add(
this );
231 const sal_Int32 nStart,
const sal_Int32 nEnd)
235 switch (pNew->
Which())
248 assert(!
"MakeTextAttrNesting: what the hell is that?");
256 static NestList_t::iterator
258 NestList_t::iterator
const iter, sal_Int32
const nSplitPos,
259 bool const bSplitAtStart,
bool const bOtherDummy)
261 const sal_Int32 nStartPos(
262 (bSplitAtStart && bOtherDummy) ? nSplitPos + 1 : nSplitPos );
264 rNode, **iter, nStartPos, *(*iter)->GetEnd() ) );
265 (*iter)->SetEnd(nSplitPos);
266 return rSplits.insert(iter + 1, pNew);
271 const sal_Int32 nNewStart,
272 const sal_Int32 nOtherStart,
const sal_Int32 nOtherEnd,
bool bOtherDummy)
274 const bool bSplitAtStart(nNewStart < nOtherStart);
275 const sal_Int32 nSplitPos( bSplitAtStart ? nOtherStart : nOtherEnd );
277 NestList_t::iterator
const iter(
278 std::find_if( rSplits.begin(), rSplits.end(),
282 if (iter != rSplits.end())
284 lcl_DoSplitImpl(rSplits, rNode, iter, nSplitPos, bSplitAtStart, bOtherDummy);
369 const sal_uInt16 nNewWhich( rNewHint.
Which() );
370 const sal_Int32 nNewStart( rNewHint.
GetStart() );
371 const sal_Int32 nNewEnd ( *rNewHint.
GetEnd() );
384 SplitNew.push_back(& rNewHint);
387 for (
size_t i = 0;
i <
Count(); ++
i )
393 const sal_uInt16 nOtherWhich( pOther->
Which() );
394 const sal_Int32 nOtherStart( pOther->
GetStart() );
395 const sal_Int32 nOtherEnd ( *pOther->
GetEnd() );
396 if (
isOverlap(nNewStart, nNewEnd, nOtherStart, nOtherEnd ))
401 SAL_INFO(
"sw.core",
"cannot insert hint: overlap");
402 for (
const auto& aSplit : SplitNew)
410 OverlappingExisting.push_back(
411 static_txtattr_cast<SwTextAttrNesting*>(pOther));
414 assert(!
"bad code monkey");
418 else if (
isNestedAny(nNewStart, nNewEnd, nOtherStart, nOtherEnd))
420 if (!bNewSelfNestable && (nNewWhich == nOtherWhich))
423 OverwrittenExisting.push_back(
424 static_txtattr_cast<SwTextAttrNesting*>(pOther));
426 else if ((nNewStart == nOtherStart) && pOther->
HasDummyChar())
430 assert(!
"ERROR: inserting duplicate CH_TXTATR hint");
432 }
else if (nNewEnd < nOtherEnd) {
438 assert(SplitNew.front()->GetStart() == nNewStart);
439 SplitNew.front()->SetStart(nNewStart + 1);
447 for (
auto iter = SplitNew.begin(); iter != SplitNew.end(); ++iter)
449 SwPaM const temp(rNode, (*iter)->GetStart(), rNode, *(*iter)->GetEnd());
450 std::vector<std::pair<sal_uLong, sal_Int32>> Breaks;
456 SAL_INFO(
"sw.core",
"cannot insert hint: fieldmark overlap");
457 assert(SplitNew.size() == 1);
463 for (
auto const& rPos : Breaks)
467 rPos.second,
true,
true);
474 "splitting the unsplittable ???");
484 for (
auto& rpOther : OverlappingExisting)
486 const sal_Int32 nOtherStart( rpOther->GetStart() );
487 const sal_Int32 nOtherEnd ( *rpOther->GetEnd() );
489 for (
const auto& rpNew : SplitNew)
491 const sal_Int32 nSplitNewStart( rpNew->GetStart() );
492 const sal_Int32 nSplitNewEnd ( *rpNew->GetEnd() );
494 const bool bRemoveOverlap(
495 !bNewSelfNestable && (nNewWhich == rpOther->Which()) );
498 nOtherStart, nOtherEnd))
503 "this one should be in OverwrittenExisting?");
509 assert(!
"existing hint inside new hint: why?");
515 rpOther->SetStart(nSplitNewEnd);
521 SAL_INFO(
"sw.core",
"hints array full :-(");
526 nOtherStart, nSplitNewEnd ) );
534 rpOther->SetEnd(nSplitNewStart);
540 SAL_INFO(
"sw.core",
"hints array full :-(");
545 nSplitNewStart, nOtherEnd ) );
558 SAL_INFO(
"sw.core",
"hints array full :-(");
563 for (
const auto& rpHint : SplitNew)
571 for (
auto& rpOther : OverwrittenExisting)
573 const sal_Int32 nOtherStart( rpOther->GetStart() );
574 const sal_Int32 nOtherEnd ( *rpOther->GetEnd() );
577 if ((nNewStart <= nOtherStart) && (nOtherEnd <= nNewEnd))
584 assert((nOtherStart < nNewStart) || (nNewEnd < nOtherEnd));
590 if (nNewEnd < nOtherEnd)
594 rNode, *rpOther, nNewEnd, nOtherEnd ) );
596 SAL_WARN_IF(!bSuccess,
"sw.core",
"recursive call 1 failed?");
598 if (nOtherStart < nNewStart)
600 rpOther->SetEnd(nNewStart);
602 SAL_WARN_IF(!bSuccess,
"sw.core",
"recursive call 2 failed?");
625 const sal_uInt16 nWhich = rNewHint.
Which();
627 const sal_Int32 nThisStart = rNewHint.
GetStart();
628 const sal_Int32 nThisEnd = *rNewHint.
GetEnd();
629 const bool bNoLengthAttribute = nThisStart == nThisEnd;
631 std::vector<SwTextAttr*> aInsDelHints;
639 if ( !bNoLengthAttribute )
641 for (
size_t i = 0;
i <
Count(); ++
i )
651 sal_Int32 nOtherStart = pOther->
GetStart();
652 const sal_Int32 nOtherEnd = *pOther->
GetEnd();
656 if ( nOtherStart < nThisStart && nThisStart < nOtherEnd )
659 pOther->
GetAttr(), nOtherStart, nThisStart );
663 static_txtattr_cast<SwTextCharFormat*>(pOther)->GetSortNumber() );
665 aInsDelHints.push_back( pNewAttr );
671 nOtherStart = nThisStart;
676 if ( nOtherStart < nThisEnd && nThisEnd < nOtherEnd )
679 pOther->
GetAttr(), nOtherStart, nThisEnd );
683 static_txtattr_cast<SwTextCharFormat*>(pOther)->GetSortNumber());
685 aInsDelHints.push_back( pNewAttr );
694 for (
const auto& rpHint : aInsDelHints )
709 aBounds.
insert( nThisStart );
710 aBounds.
insert( nThisEnd );
712 if ( !bNoLengthAttribute )
714 for (
size_t i = 0;
i <
Count(); ++
i )
722 const sal_Int32 nOtherStart = pOther->
GetStart();
723 const sal_Int32 nOtherEnd = *pOther->
End();
725 aBounds.
insert( nOtherStart );
726 aBounds.
insert( nOtherEnd );
730 auto aStartIter = aBounds.
lower_bound( nThisStart );
732 sal_Int32 nPorStart = *aStartIter;
734 bool bDestroyHint =
true;
738 while ( aStartIter != aEndIter || bNoLengthAttribute )
740 OSL_ENSURE( bNoLengthAttribute || nPorStart < *aStartIter,
"AUTOSTYLES: BuildPortion trouble" );
742 const sal_Int32 nPorEnd = bNoLengthAttribute ? nPorStart : *aStartIter;
743 aInsDelHints.clear();
746 for (
size_t i = 0;
i <
Count(); ++
i )
755 const sal_Int32 nOtherStart = pOther->
GetStart();
757 if ( nOtherStart > nPorStart )
760 if ( pOther->
GetEnd() && *pOther->
GetEnd() == nPorEnd && nOtherStart == nPorStart )
762 OSL_ENSURE( *pOther->
GetEnd() == nPorEnd,
"AUTOSTYLES: BuildPortion trouble" );
763 aInsDelHints.push_back( pOther );
773 sal_uInt16 nCharStyleCount = 0;
774 for (
const auto& rpHint : aInsDelHints )
787 bNoLengthAttribute ||
803 std::shared_ptr<SfxItemSet> pOldStyle =
static_cast<const SwFormatAutoFormat&
>(pOther->GetAttr()).GetStyleHandle();
815 aNewSet.Put( *pItem );
818 pItem = aItemIter.NextItem();
826 if ( aNewSet.Count() )
829 aNewSet, nPorStart, nPorEnd );
838 if ( nPorStart == nThisStart &&
839 nPorEnd == nThisEnd &&
842 pNewAttr = &rNewHint;
843 bDestroyHint =
false;
848 nPorStart, nPorEnd );
857 for (
const auto& rpHint : aInsDelHints )
860 pCurrentAutoStyle = rpHint;
862 pCurrentCharFormat = rpHint;
866 if ( pCurrentAutoStyle )
868 std::shared_ptr<SfxItemSet> pCurrentStyle =
static_cast<const SwFormatAutoFormat&
>(pCurrentAutoStyle->
GetAttr()).GetStyleHandle();
872 aNewSet.
Put( *pNewStyle );
885 if ( SfxItemState::SET == rWholeParaAttrSet.
GetItemState( pItem->
Which(),
false, &pTmpItem ) &&
893 while ((pItem = aIter2.
NextItem()));
897 Delete( pCurrentAutoStyle );
901 if ( aNewSet.
Count() )
903 nPorStart, nPorEnd );
908 bool bOptimizeAllowed =
true;
912 if ( !bNoLengthAttribute && rNode.
HasSwAttrSet() && pNewStyle->Count() )
914 std::unique_ptr<SfxItemSet> pNewSet;
923 if ( SfxItemState::SET == rWholeParaAttrSet.
GetItemState( pItem->
Which(),
false, &pTmpItem ) &&
930 pNewSet = pNewStyle->
Clone();
931 pNewSet->ClearItem( pItem->
Which() );
935 while ((pItem = aIter2.
NextItem()));
939 bOptimizeAllowed =
false;
940 if ( pNewSet->Count() )
950 if ( bOptimizeAllowed &&
951 nPorStart == nThisStart &&
952 nPorEnd == nThisEnd )
954 pNewAttr = &rNewHint;
955 bDestroyHint =
false;
957 else if ( pNewStyle )
960 nPorStart, nPorEnd );
972 if ( !bNoLengthAttribute )
974 nPorStart = *aStartIter;
988 switch (rAttr.
Which())
1003 assert(!
"unsupported redline attribute");
1018 sal_Int32
const nStt,
1019 sal_Int32
const nEnd,
1030 aItemSet.Put( rAttr );
1039 const std::shared_ptr<SfxItemSet> pAutoStyle =
static_cast<const SwFormatAutoFormat&
>(rAttr).GetStyleHandle();
1040 std::unique_ptr<const SfxItemSet> pNewSet(
1041 pAutoStyle->SfxItemSet::Clone(
true, &rDoc.
GetAttrPool() ));
1052 switch( rNew.
Which() )
1066 pNew =
new SwTextINetFormat( static_cast<SwFormatINetFormat&>(rNew), nStt, nEnd );
1070 pNew =
new SwTextField( static_cast<SwFormatField &>(rNew), nStt,
1089 pNew =
new SwTextInputField( static_cast<SwFormatField &>(rNew), nStt, nEnd,
1096 pNew =
new SwTextFlyCnt( static_cast<SwFormatFlyCnt&>(rNew), nStt );
1097 if ( static_cast<const SwFormatFlyCnt &>(rAttr).GetTextFlyCnt() )
1100 static_cast<SwTextFlyCnt *
>(pNew)->CopyFlyFormat( rDoc );
1105 pNew =
new SwTextFootnote( static_cast<SwFormatFootnote&>(rNew), nStt );
1107 if( static_cast<SwFormatFootnote&>(rAttr).GetTextFootnote() )
1108 static_cast<SwTextFootnote*
>(pNew)->SetSeqNo( static_cast<SwFormatFootnote&>(rAttr).GetTextFootnote()->GetSeqRefNo() );
1112 ?
new SwTextRefMark( static_cast<SwFormatRefMark&>(rNew), nStt )
1113 :
new SwTextRefMark( static_cast<SwFormatRefMark&>(rNew), nStt, &nEnd );
1123 if (pTOXType && &pTOXType->
GetDoc() != &rDoc)
1134 pNew =
new SwTextRuby( static_cast<SwFormatRuby&>(rNew), nStt, nEnd );
1151 sal_Int32 nStt, sal_Int32 nEnd )
1169 switch( pAttr->
Which() )
1193 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pAttr));
1206 switch( pFieldType->
Which() )
1221 static_cast<SwDDEFieldType*>(pFieldType)->DecRefCnt();
1247 SwFormatMeta & rFormatMeta( static_cast<SwFormatMeta &>(pTextMeta->GetAttr()) );
1248 if (::
sw::Meta* pMeta = rFormatMeta.GetMeta())
1252 static constexpr OUStringLiteral metaNS(
u"urn:bails");
1253 const css::uno::Reference<css::rdf::XResource> xSubject = pMeta->MakeUnoObject();
1254 uno::Reference<frame::XModel>
xModel = pDocSh->GetBaseModel();
1272 const sal_Int32 nStart,
1273 const sal_Int32 nEnd,
1278 "SwTextNode::InsertItem should not be called with character attributes");
1291 const bool bSuccess(
InsertHint( pNew, nMode ) );
1307 bool bHiddenPara =
false;
1321 const sal_Int32 nStart( pAttr->
GetStart() );
1326 switch( pAttr->
Which() )
1341 reinterpret_cast<const SfxPoolItem**>(&pAnchor) );
1345 OUString
const ins(
InsertText(c, aIdx, nInsertFlags) );
1357 (RndStdIds::FLY_AS_CHAR == pAnchor->
GetAnchorId()) &&
1378 bool bCheckControlLayer =
false;
1380 if( bCheckControlLayer )
1393 Update( aTmpIdx, 1,
true );
1424 Update( aTmpIdx, 1,
true );
1446 sal_uLong nEndIdx = rNodes[ nSttIdx++ ]->EndOfSectionIndex();
1447 for( ; nSttIdx < nEndIdx; ++nSttIdx )
1450 if(
nullptr != pCNd )
1454 pTable->DelFrames();
1466 OUString
const ins(
InsertText(c, aNdIdx, nInsertFlags) );
1491 if( !pTextFootnote )
1501 OSL_ENSURE( bSuccess,
"FootnoteIdx not inserted." );
1528 aIdx, nInsertFlags) );
1536 const sal_Int32 *
const pEnd(pAttr->
GetEnd());
1539 pAttr->
SetEnd(*pEnd + 1);
1545 sal_Int32 nEnd = nStart;
1546 bool bInputFieldStartCharInserted =
false;
1547 bool bInputFieldEndCharInserted =
false;
1548 const bool bHasContent( pAttr->
HasContent() );
1551 switch( pAttr->
Which() )
1556 if ( pTextInputField )
1565 const sal_Int32*
const pEnd(pAttr->
GetEnd());
1566 assert(pEnd !=
nullptr);
1567 pAttr->
SetEnd(*pEnd + aContent.getLength());
1577 bInputFieldStartCharInserted =
true;
1578 const sal_Int32*
const pEnd(pAttr->
GetEnd());
1579 assert(pEnd !=
nullptr);
1580 pAttr->
SetEnd(*pEnd + 1);
1584 const sal_Int32*
const pEnd(pAttr->
GetEnd());
1585 assert(pEnd !=
nullptr);
1590 bInputFieldEndCharInserted =
true;
1591 pAttr->
SetEnd(*pEnd + 1);
1606 bool bInsertHint =
true;
1609 if ( pTextInputField !=
nullptr )
1611 if ( pAttr->
End() == nullptr )
1613 bInsertHint =
false;
1621 if ( *(pAttr->
End()) < *(pTextInputField->
End()) )
1623 pAttr->
SetEnd(*(pTextInputField->
End()));
1629 const bool bRet = bInsertHint
1630 &&
m_pSwpHints->TryInsertHint( pAttr, *
this, nMode );
1650 && (nEnd - nStart) > 0 )
1657 if ( bInputFieldEndCharInserted
1658 && (nEnd - nStart) > 0 )
1660 SwIndex aIdx(
this, nEnd - 1 );
1664 if ( bInputFieldStartCharInserted )
1685 OSL_FAIL(
"DeleteAttribute called, but text node without hints?");
1720 const sal_uInt16 nWhich,
1721 const sal_Int32 nStart,
1722 const sal_Int32 nEnd )
1730 const sal_Int32 nHintStart = pTextHt->
GetStart();
1731 if (nStart < nHintStart)
1735 else if ( (nStart == nHintStart) && (nWhich == pTextHt->
Which()) )
1739 assert(!
"hey, that's a CHRATR! how did that get in?");
1761 sal_Int32
const *
const pEndIdx = pTextHt->
GetEnd();
1766 const SwIndex aIdx(
this, nStart );
1772 const SwIndex aIdx(
this, nStart );
1773 OSL_ENSURE( pTextHt->
End() !=
nullptr,
"<SwTextNode::DeleteAttributes(..)> - missing End() at <SwTextAttr> instance which has content" );
1776 else if( *pEndIdx == nEnd )
1797 sal_Int32 nFndPos = nStt;
1798 sal_Int32 nEndPos = nEnd;
1802 if (nFndPos<0 || nFndPos>=nEndPos )
1806 const SwIndex aIdx(
this, nFndPos );
1841 const sal_uInt16 nWhich = pItem->
Which();
1857 if (!(nLevel != -1 && pCurrNum))
1861 if (!pCurrNumFormat)
1870 if (pCurrCharFormat && pCurrCharFormat->
GetItemState(nWhich,
false) != SfxItemState::SET)
1875 pCurrNum->
Set(nLevel,aNewNumFormat);
1883 const sal_Int32 nStt,
1884 const sal_Int32 nEnd,
1896 if ( !nStt && (nEnd ==
m_Text.getLength()) &&
1901 bool bHasCharFormats =
false;
1908 bHasCharFormats =
true;
1914 if( !bHasCharFormats )
1916 aTextSet.Put( rSet );
1919 if( aTextSet.Count() != rSet.
Count() )
1921 const bool bRet =
SetAttr( rSet );
1922 if( !aTextSet.Count() )
1928 const bool bAutoStyle = SfxItemState::SET == aTextSet.GetItemState(
RES_TXTATR_AUTOFMT,
false, &pItem );
1931 std::shared_ptr<SfxItemSet> pAutoStyleSet =
static_cast<const SwFormatAutoFormat*
>(pItem)->GetStyleHandle();
1932 const bool bRet =
SetAttr( *pAutoStyleSet );
1933 if( 1 == aTextSet.Count() )
1954 const sal_uInt16 nWhich = pItem->
Which();
1956 "SwTextNode::SetAttr(): unknown attribute" );
1960 (
GetDoc().GetDfltCharFormat() ==
1961 static_cast<const SwFormatCharFormat*>(pItem)->GetCharFormat()))
1972 aCharSet.Put( *pItem );
1978 const_cast<SfxPoolItem&>(*pItem), nStt, nEnd );
1982 if (ppNewTextAttr && !*ppNewTextAttr)
1983 *ppNewTextAttr = pNew;
1984 if ( nEnd != nStt && !pNew->
GetEnd() )
1986 OSL_FAIL(
"Attribute without end, but area marked");
2001 if ( aCharSet.Count() )
2028 ( SfxItemState::SET == pCFSet->
GetItemState( nWhich ) ) )
2029 rSet.
Put( pCFSet->
Get( nWhich ) );
2053 ( SfxItemState::SET == pCFSet->
GetItemState( nWhich ) ) )
2054 rSet.
Put( pCFSet->
Get( nWhich ) );
2078 struct SwPoolItemEndPair
2084 SwPoolItemEndPair() : mpItem( nullptr ), mnEndPos( 0 ) {};
2111 const bool bOnlyTextAttr,
const bool bGetFromChrFormat,
2112 const bool bMergeIndentValuesOfNumRule,
2131 if (bMergeIndentValuesOfNumRule)
2158 for (
size_t n = 0;
n < nSize; ++
n)
2161 const sal_Int32 nAttrStart = pHt->
GetStart();
2162 if (nAttrStart > nEnd)
2165 const sal_Int32* pAttrEnd = pHt->
End();
2169 if( ( nAttrStart < nStt &&
2171 : nStt <= *pAttrEnd )) ||
2172 ( nStt == nAttrStart &&
2173 ( nAttrStart == *pAttrEnd || !nStt )))
2174 (*fnMergeAttr)( rSet, pHt->
GetAttr() );
2180 std::unique_ptr< std::vector< SwPoolItemEndPair > > pAttrArr;
2184 for (
size_t n = 0;
n < nSize; ++
n)
2187 const sal_Int32 nAttrStart = pHt->
GetStart();
2188 if (nAttrStart > nEnd)
2191 const sal_Int32* pAttrEnd = pHt->
End();
2195 bool bChkInvalid =
false;
2196 if (nAttrStart <= nStt)
2198 if (*pAttrEnd <= nStt)
2201 if (nEnd <= *pAttrEnd)
2202 (*fnMergeAttr)( aFormatSet, pHt->
GetAttr() );
2208 else if (nAttrStart < nEnd
2215 std::unique_ptr< SfxItemIter > pItemIter;
2224 pItem = pItemIter->GetCurItem();
2230 const sal_Int32 nHintEnd = *pAttrEnd;
2232 for (; pItem; pItem = pItemIter ? pItemIter->NextItem() :
nullptr)
2234 const sal_uInt16 nHintWhich = pItem->
Which();
2236 "SwTextNode::GetAttr(): unknown attribute?");
2241 new std::vector< SwPoolItemEndPair >(coArrSz));
2244 std::vector< SwPoolItemEndPair >::iterator pPrev = pAttrArr->begin();
2252 pPrev = pAttrArr->end();
2255 if( pPrev != pAttrArr->end() )
2257 if( !pPrev->mpItem )
2259 if ( bOnlyTextAttr || *pItem != aFormatSet.Get( nHintWhich ) )
2261 if( nAttrStart > nStt )
2268 pPrev->mpItem = pItem;
2269 pPrev->mnEndPos = nHintEnd;
2275 if( pPrev->mnEndPos == nAttrStart &&
2276 *pPrev->mpItem == *pItem )
2278 pPrev->mpItem = pItem;
2279 pPrev->mnEndPos = nHintEnd;
2294 for (
size_t n = 0;
n < coArrSz; ++
n)
2296 const SwPoolItemEndPair& rItemPair = (*pAttrArr)[
n ];
2299 const sal_uInt16 nWh =
2302 if (nEnd <= rItemPair.mnEndPos)
2304 if( *rItemPair.mpItem != aFormatSet.Get( nWh ) )
2305 (*fnMergeAttr)( rSet, *rItemPair.mpItem );
2314 if( aFormatSet.Count() )
2317 aFormatSet.Differentiate( rSet );
2321 if (aFormatSet.Count())
2324 rSet.
Put( aFormatSet );
2327 return rSet.
Count() != 0;
2333 typedef std::pair<sal_Int32, sal_Int32> AttrSpan_t;
2334 typedef std::multimap<AttrSpan_t, const SwTextAttr*> AttrSpanMap_t;
2339 operator()(
const AttrSpanMap_t::value_type& i_rAttrSpan)
2349 struct RemovePresentAttrs
2351 explicit RemovePresentAttrs(
SfxItemSet& io_rAttrSet)
2352 : m_rAttrSet(io_rAttrSet)
2357 operator()(
const AttrSpanMap_t::value_type& i_rAttrSpan)
2360 if (!i_rAttrSpan.second)
2365 const SwTextAttr*
const pAutoStyle(i_rAttrSpan.second);
2367 for (
const SfxPoolItem* pItem(aIter.GetCurItem()); pItem; pItem = aIter.NextItem())
2369 const sal_uInt16 nWhich(pItem->Which());
2372 m_rAttrSet.ClearItem(nWhich);
2388 lcl_CollectHintSpans(
const SwpHints& i_rHints,
const sal_Int32 nLength,
2389 AttrSpanMap_t& o_rSpanMap)
2391 sal_Int32 nLastEnd(0);
2393 for (
size_t i = 0;
i < i_rHints.
Count(); ++
i)
2396 const sal_uInt16 nWhich(pHint->
Which());
2399 const AttrSpan_t aSpan(pHint->
GetStart(), *pHint->
End());
2400 o_rSpanMap.emplace(aSpan, pHint);
2403 if (nLastEnd < aSpan.first)
2406 o_rSpanMap.emplace( AttrSpan_t(nLastEnd, aSpan.first),
nullptr );
2409 nLastEnd = aSpan.second;
2414 if (nLastEnd != nLength && nLength != 0)
2416 o_rSpanMap.emplace(AttrSpan_t(nLastEnd, nLength),
nullptr);
2421 lcl_FillWhichIds(
const SfxItemSet& i_rAttrSet, std::vector<sal_uInt16>& o_rClearIds)
2423 o_rClearIds.reserve(i_rAttrSet.
Count());
2425 for (
const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
2427 o_rClearIds.push_back(pItem->Which());
2431 struct SfxItemSetClearer
2434 explicit SfxItemSetClearer(
SfxItemSet & rItemSet) : m_rItemSet(rItemSet) { }
2435 void operator()(sal_uInt16
const nWhich) { m_rItemSet.
ClearItem(nWhich); }
2446 typedef AttrSpanMap_t::iterator AttrSpanMap_iterator_t;
2447 AttrSpanMap_t aAttrSpanMap;
2449 if (i_rAttrSet.
Count() == 0)
2460 AttrSpanMap_iterator_t aCurRange(aAttrSpanMap.begin());
2461 const AttrSpanMap_iterator_t aEnd(aAttrSpanMap.end());
2462 while (aCurRange != aEnd)
2464 typedef std::pair<AttrSpanMap_iterator_t, AttrSpanMap_iterator_t>
2466 AttrSpanMapRange_t aRange(aAttrSpanMap.equal_range(aCurRange->first));
2471 std::for_each(aRange.first, aRange.second, RemovePresentAttrs(aCurSet));
2475 if (aCurSet.Count() != 0)
2477 AttrSpanMap_iterator_t aAutoStyleIt(
2478 std::find_if(aRange.first, aRange.second, IsAutoStyle()));
2479 if (aAutoStyleIt != aRange.second)
2483 SwTextAttr*
const pAutoStyle(const_cast<SwTextAttr*>(aAutoStyleIt->second));
2484 const std::shared_ptr<SfxItemSet> pOldStyle(
2485 static_cast<const SwFormatAutoFormat&>(
2486 pAutoStyle->
GetAttr()).GetStyleHandle());
2487 aCurSet.Put(*pOldStyle);
2495 aCurRange->first.first, aCurRange->first.second));
2498 aCurRange = aRange.second;
2505 std::vector<sal_uInt16> aClearedIds;
2506 lcl_FillWhichIds(i_rAttrSet, aClearedIds);
2541 std::vector<sal_uInt16> aProcessedIds;
2543 if( aThisSet.
Count() )
2548 std::vector<sal_uInt16> aClearWhichIds;
2552 if( SfxItemState::SET == aNdSet.GetItemState( pItem->
Which(),
false, &pNdItem ) )
2554 if (*pItem == *pNdItem)
2556 aClearWhichIds.push_back( pItem->
Which() );
2560 aConvertSet.
Put(*pItem);
2562 aProcessedIds.push_back(pItem->
Which());
2566 aConvertSet.
Put(*pItem);
2580 std::for_each(aProcessedIds.begin(), aProcessedIds.end(),
2581 SfxItemSetClearer(aNdSet));
2586 if( aNdSet.Count() )
2602 const size_t nSize =
Count();
2606 switch( pAttr->
Which() )
2632 bool bNewHiddenByParaField =
false;
2633 int nNewResultWeight = 0;
2634 const size_t nSize =
Count();
2640 const sal_uInt16 nWhich = pTextHt->
Which();
2647 if (nCurWeight > nNewResultWeight)
2649 nNewResultWeight = nCurWeight;
2652 else if (nCurWeight == nNewResultWeight && bNewHiddenByParaField)
2662 return bOldHiddenByParaField != bNewHiddenByParaField;
2679 typedef std::multimap< int, std::pair<SwTextAttr*, bool> > PortionMap;
2680 PortionMap aPortionMap;
2681 std::unordered_map<int, bool> RsidOnlyAutoFormatFlagMap;
2686 for (
size_t i = 0;
i <
Count(); ++
i )
2695 bool isRsidOnlyAutoFormat(
false);
2699 std::shared_ptr<SfxItemSet>
const pSet(
2720 isRsidOnlyAutoFormat =
true;
2731 const sal_Int32 nPorStart = pHt->
GetStart();
2732 if (nPorStart != nLastPorStart)
2734 nLastPorStart = nPorStart;
2735 aPortionMap.insert(std::make_pair(nKey,
2736 std::make_pair(pHt, isRsidOnlyAutoFormat)));
2737 RsidOnlyAutoFormatFlagMap[nKey] = isRsidOnlyAutoFormat;
2747 std::pair< PortionMap::iterator, PortionMap::iterator > aRange1 = aPortionMap.equal_range( i );
2748 std::pair< PortionMap::iterator, PortionMap::iterator > aRange2 = aPortionMap.equal_range( j );
2749 PortionMap::iterator aIter1 = aRange1.first;
2750 PortionMap::iterator aIter2 = aRange2.first;
2752 enum { MATCH, DIFFER_ONLY_RSID, DIFFER } eMerge(MATCH);
2753 size_t const nAttributesInPor1 = std::distance(aRange1.first, aRange1.second);
2754 size_t const nAttributesInPor2 = std::distance(aRange2.first, aRange2.second);
2755 bool const isRsidOnlyAutoFormat1(RsidOnlyAutoFormatFlagMap[i]);
2756 bool const isRsidOnlyAutoFormat2(RsidOnlyAutoFormatFlagMap[j]);
2759 bool const bSkipRsidOnlyAutoFormat(nAttributesInPor1 != nAttributesInPor2);
2764 if ((nAttributesInPor1 - (isRsidOnlyAutoFormat1 ? 1 : 0)) ==
2765 (nAttributesInPor2 - (isRsidOnlyAutoFormat2 ? 1 : 0))
2766 && (nAttributesInPor1 != 0 || nAttributesInPor2 != 0))
2771 while (aIter1 != aRange1.second || aIter2 != aRange2.second)
2774 if (aIter1 != aRange1.second && aIter2 != aRange2.second &&
2775 *aIter1->second.first->End() < aIter2->second.first->GetStart())
2781 if (bSkipRsidOnlyAutoFormat
2782 && aIter1 != aRange1.second && aIter1->second.second)
2784 assert(DIFFER != eMerge);
2785 eMerge = DIFFER_ONLY_RSID;
2789 if (bSkipRsidOnlyAutoFormat
2790 && aIter2 != aRange2.second && aIter2->second.second)
2792 assert(DIFFER != eMerge);
2793 eMerge = DIFFER_ONLY_RSID;
2797 assert(aIter1 != aRange1.second && aIter2 != aRange2.second);
2798 SwTextAttr const*
const p1 = aIter1->second.first;
2799 SwTextAttr const*
const p2 = aIter2->second.first;
2827 if (!pItem1 && !pItem2)
2829 if (!pItem1 || !pItem2)
2834 if (pItem1 != pItem2)
2848 if (DIFFER == eMerge)
2851 eMerge = DIFFER_ONLY_RSID;
2868 if (MATCH == eMerge)
2873 sal_Int32 nNewPortionEnd = 0;
2874 for ( aIter2 = aRange2.first; aIter2 != aRange2.second; ++aIter2 )
2877 nNewPortionEnd = *p2->
GetEnd();
2879 const size_t nCountBeforeDelete =
Count();
2883 if (
Count() < nCountBeforeDelete )
2886 aPortionMap.erase( aRange2.first, aRange2.second );
2890 aRange1 = aPortionMap.equal_range( i );
2891 for ( aIter1 = aRange1.first; aIter1 != aRange1.second; ++aIter1 )
2895 p1->
SetEnd(nNewPortionEnd);
2909 bool const bSetIgnoreFlag(DIFFER_ONLY_RSID == eMerge);
2910 for (aIter1 = aRange1.first; aIter1 != aRange1.second; ++aIter1)
2912 if (!aIter1->second.second)
2914 SwTextAttr *
const pCurrent(aIter1->second.first);
2923 for (aIter2 = aRange2.first; aIter2 != aRange2.second; ++aIter2)
2925 if (!aIter2->second.second)
2927 SwTextAttr *
const pCurrent(aIter2->second.first);
2947 const sal_Int32 nHtStart = rNewCharFormat.
GetStart();
2948 const sal_Int32 nHtEnd = *rNewCharFormat.
GetEnd();
2949 sal_uInt16 nSortNumber = 0;
2951 for (
size_t i = 0;
i < rHints.
Count(); ++
i )
2955 const sal_Int32 nOtherStart = pOtherHt->
GetStart();
2957 if ( nOtherStart > nHtStart )
2962 const sal_Int32 nOtherEnd = *pOtherHt->
End();
2964 if ( nOtherStart == nHtStart && nOtherEnd == nHtEnd )
2971 if ( nSortNumber > 0 )
2989 OSL_FAIL(
"hints array full :-(");
2993 const sal_Int32 *pHtEnd = pHint->
GetEnd();
2994 const sal_uInt16 nWhich = pHint->
Which();
2995 std::vector<sal_uInt16> aWhichSublist;
3028 const sal_uInt16 *pRanges = pSet->GetRanges();
3029 while( (*pRanges) != 0 )
3031 const sal_uInt16 nBeg = *pRanges;
3033 const sal_uInt16 nEnd = *pRanges;
3035 for( sal_uInt16 nSubElem = nBeg; nSubElem <= nEnd; ++nSubElem )
3036 if( pSet->HasItem( nSubElem ) )
3037 aWhichSublist.push_back( nSubElem );
3049 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pHint));
3050 bool bDelFirst =
nullptr != pTextField->
GetpTextNode();
3075 static_cast<SwDDEFieldType*>(pField->
GetTyp())->IncRefCnt();
3084 bool bInsFieldType =
false;
3095 if( pFieldType != pField->
GetTyp() )
3101 pFieldType->
SetSeqRefNo( *const_cast<SwSetExpField*>(static_cast<const SwSetExpField*>(pField)) );
3110 static_cast<SwDDEFieldType*>(pField->
GetTyp())->IncRefCnt();
3137 for(
size_t n = 0, nEnd =
Count();
n < nEnd; ++
n )
3139 const sal_Int32 *pTmpHtEnd;
3140 const sal_Int32 *pTmpHintEnd;
3143 nullptr != ( pTmpHtEnd = pTmpHt->
GetEnd() ) &&
3144 nullptr != ( pTmpHintEnd = pHint->
GetEnd() ) )
3149 bool bDelOld =
true, bChgStart =
false, bChgEnd =
false;
3169 pHint->
SetEnd(*pTmpHtEnd);
3206 sal_Int32 nHtStart = pHint->
GetStart();
3232 if( *pHtEnd < nHtStart )
3234 assert(*pHtEnd >= nHtStart);
3243 const sal_Int32 nHintEnd = *pHtEnd;
3251 if (!bRet)
return false;
3258 else if ( !bNoHintAdjustMode &&
3265 static_cast<const SwFormatAutoFormat&>(pHint->
GetAttr()).GetStyleHandle()->GetPool() ==
3270 if ( nHtStart < nHintEnd )
3301 const SwUpdateAttr aHint(nHtStart, nHintEnd, nWhich, aWhichSublist);
3338 assert(*findIt2 == pHt);
3345 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pHint));
3351 const_cast<SwDDEFieldType*>(static_cast<const SwDDEFieldType*>(pFieldTyp))->DecRefCnt();
3362 SwTextField *
const pTextField(static_txtattr_cast<SwTextField*>(pHint));
3376 assert(SAL_MAX_SIZE != nPos);
3377 if( SAL_MAX_SIZE != nPos )
3387 while ( nPos < m_pSwpHints->
Count() )
3392 switch( pDel->
Which() )
3419 sal_uInt16 nScript )
const
3433 const sal_Int32 nEnd = nBegin + nLen;
3435 for (
size_t i = 0;
i < nSize; ++
i )
3438 const sal_Int32 nAttrStart = pHt->
GetStart();
3439 if( nEnd < nAttrStart )
3442 const sal_uInt16 nWhich = pHt->
Which();
3444 if( nWhichId == nWhich ||
3447 const sal_Int32 *pEndIdx = pHt->
End();
3453 if( nAttrStart >= nEnd || nBegin >= *pEndIdx )
3456 else if( nBegin != nAttrStart || ( nAttrStart != *pEndIdx && nBegin ))
3458 if( nAttrStart >= nBegin )
3460 if( pHt->
DontExpand() ? nBegin >= *pEndIdx : nBegin > *pEndIdx)
3467 if( nAttrStart <= nBegin && nEnd <= *pEndIdx )
3486 switch ( rAttr.
Which() )
3505 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.
static void lcl_MergeAttr_ExpandChrFormat(SfxItemSet &rSet, const SfxPoolItem &rAttr)
SwpHints(const SwTextNode &rParent)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void SetSortNumber(sal_uInt16 nSortNumber)
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.
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.
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[]
static bool IsIgnoredCharFormatForNumbering(const sal_uInt16 nWhich)
In MS Word, the font underline setting of the paragraph end position won't affect the formatting of n...
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)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(157)
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)
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