28#include <UndoManager.hxx>
66#include <bookmark.hxx>
87#include <com/sun/star/i18n/Boundary.hpp>
88#include <com/sun/star/i18n/WordType.hpp>
89#include <com/sun/star/i18n/XBreakIterator.hpp>
90#include <com/sun/star/embed/XEmbeddedObject.hpp>
110 ((RndStdIds::FLY_AS_CHAR == pAnchor->
GetAnchorId()) ||
111 (RndStdIds::FLY_AT_CHAR == pAnchor->
GetAnchorId()) ||
112 (RndStdIds::FLY_AT_FLY == pAnchor->
GetAnchorId()) ||
113 (RndStdIds::FLY_AT_PARA == pAnchor->
GetAnchorId())) &&
114 nSttNd <= pAnchorNode->GetIndex() &&
124 nInsNd < pSNd->EndOfSectionIndex() )
128 if( lcl_ChkFlyFly( rDoc, pSNd->
GetIndex(),
143 == rStart.GetNodeIndex())
183 while( rLastIdx.
GetIndex() < nNewIdx );
188 while( rLastIdx.
GetIndex() > nNewIdx )
201 void lcl_SetCpyPos(
const SwPosition& rOrigPos,
243 std::vector< const ::sw::mark::IMark* > vMarksToCopy;
248 const ::sw::mark::IMark*
const pMark = *ppMark;
250 const SwPosition& rMarkStart = pMark->GetMarkStart();
251 const SwPosition& rMarkEnd = pMark->GetMarkEnd();
254 bool const isIncludeStart(
260 || rMarkStart != rStt);
261 bool const isIncludeEnd(
262 (rEnd.GetNode().IsTextNode()
263 && rEnd.GetContentIndex() == rEnd.GetNode().GetTextNode()->Len())
264 || rMarkEnd != rEnd);
265 const bool bIsNotOnBoundary =
267 ? (isIncludeStart || isIncludeEnd)
268 : (isIncludeStart && isIncludeEnd);
270 if ( rMarkStart >= rStt && rMarkEnd <= rEnd
271 && ( bIsNotOnBoundary
278 vMarksToCopy.push_back(pMark);
283 SwNodeIndex aCorrIdx(InitDelCount(rPam, nDelCount));
286 SwPaM aTmpPam(*pCpyStt);
287 lcl_NonCopyCount(rPam, aCorrIdx, pMark->GetMarkPos().GetNodeIndex(), nDelCount);
288 lcl_SetCpyPos( pMark->GetMarkPos(), rStt, *pCpyStt, *aTmpPam.
GetPoint(), nDelCount);
289 if(pMark->IsExpanded())
292 lcl_NonCopyCount(rPam, aCorrIdx, pMark->GetOtherMarkPos().GetNodeIndex(), nDelCount);
293 lcl_SetCpyPos(pMark->GetOtherMarkPos(), rStt, *pCpyStt, *aTmpPam.
GetMark(), nDelCount);
296 OUString sRequestedName = pMark->GetName();
299 assert(&rSrcDoc == &rDestDoc);
303 sRequestedName +
"COPY_IS_MOVE");
313 if (pNewMark ==
nullptr)
324 const ::sw::mark::IBookmark*
const pOldBookmark =
326 if (pNewBookmark && pOldBookmark)
328 pNewBookmark->
SetKeyCode(pOldBookmark->GetKeyCode());
329 pNewBookmark->
SetShortName(pOldBookmark->GetShortName());
330 pNewBookmark->
Hide(pOldBookmark->IsHidden());
333 ::sw::mark::IFieldmark*
const pNewFieldmark =
334 dynamic_cast< ::sw::mark::IFieldmark*
const >(pNewMark);
335 const ::sw::mark::IFieldmark*
const pOldFieldmark =
336 dynamic_cast< const ::sw::mark::IFieldmark*
>(pMark);
337 if (pNewFieldmark && pOldFieldmark)
339 pNewFieldmark->SetFieldname(pOldFieldmark->GetFieldname());
340 pNewFieldmark->SetFieldHelptext(pOldFieldmark->GetFieldHelptext());
341 ::sw::mark::IFieldmark::parameter_map_t* pNewParams = pNewFieldmark->GetParameters();
342 const ::sw::mark::IFieldmark::parameter_map_t* pOldParams = pOldFieldmark->GetParameters();
343 for (
const auto& rEntry : *pOldParams )
345 pNewParams->insert( rEntry );
349 ::sfx2::Metadatable
const*
const pMetadatable(
350 dynamic_cast< ::sfx2::Metadatable const*
>(pMark));
351 ::sfx2::Metadatable *
const pNewMetadatable(
352 dynamic_cast< ::sfx2::Metadatable *
>(pNewMark));
353 if (pMetadatable && pNewMetadatable)
355 pNewMetadatable->RegisterAsCopyOf(*pMetadatable);
363 void lcl_DeleteRedlines(
const SwPaM& rPam,
SwPaM& rCpyPam )
372 std::unique_ptr<SwPaM> pDelPam;
373 auto [pStt, pEnd] = rPam.
StartEnd();
376 SwNodeIndex aCorrIdx(InitDelCount(rPam, nDelCount));
380 for( ;
n < rTable.
size(); ++
n )
385 auto [pRStt, pREnd] = pRedl->
StartEnd();
403 pDelPam.reset(
new SwPaM( *pCpyStt, pDelPam.release() ));
406 lcl_NonCopyCount( rPam, aCorrIdx, pRStt->GetNodeIndex(), nDelCount );
407 lcl_SetCpyPos( *pRStt, *pStt, *pCpyStt,
408 *pDelPam->GetPoint(), nDelCount );
413 *pDelPam->GetPoint() = *pCpyEnd;
416 lcl_NonCopyCount( rPam, aCorrIdx, pREnd->GetNodeIndex(), nDelCount );
417 lcl_SetCpyPos( *pREnd, *pStt, *pCpyStt,
418 *pDelPam->GetPoint(), nDelCount );
421 if (pDelPam->GetNext() != pDelPam.get()
422 && *pDelPam->GetNext()->End() == *pDelPam->Start())
424 *pDelPam->GetNext()->End() = *pDelPam->End();
425 pDelPam.reset(pDelPam->GetNext());
442 if( !pDelPam->IsMultiSelection() )
444 delete pDelPam->GetNext();
457 lcl_DeleteRedlines( aRgTmp, aCpyTmp );
464 if ( !aSrc.GetNext() )
466 aSrc.SetNext( pDest );
470 if ( !aDest.GetPrev() )
472 aDest.SetPrev( pSrc );
478 bool lcl_ContainsOnlyParagraphsInList(
const SwPaM& rPam )
484 if ( pTextNd && pTextNd->
IsInList() &&
485 pEndTextNd && pEndTextNd->
IsInList() )
495 if ( !pTextNd || !pTextNd->
IsInList() )
500 }
while (pTextNd != pEndTextNd);
506 bool lcl_MarksWholeNode(
const SwPaM & rPam)
508 bool bResult =
false;
509 auto [pStt, pEnd] = rPam.
StartEnd();
511 if (
nullptr != pStt &&
nullptr != pEnd)
516 if (
nullptr != pSttNd &&
nullptr != pEndNd &&
517 pStt->GetContentIndex() == 0 &&
518 pEnd->GetContentIndex() == pEndNd->
Len())
531 void CalcBreaks(std::vector<std::pair<SwNodeOffset, sal_Int32>> & rBreaks,
532 SwPaM const & rPam,
bool const isOnlyFieldmarks)
539 std::stack<std::tuple<sw::mark::IFieldmark const*, bool, SwNodeOffset, sal_Int32>> startedFields;
543 SwNode *
const pNode(rNodes[
n]);
547 sal_Int32
const nStart(
n == nStartNode
550 sal_Int32
const nEnd(
n == nEndNode
553 for (sal_Int32
i = nStart;
i < nEnd; ++
i)
565 if (
n == nEndNode && !isOnlyFieldmarks)
568 if (pAttr && pAttr->
End() && (nEnd < *pAttr->
End()))
571 rBreaks.emplace_back(
n,
i);
578 if (pAttr && (nStart > pAttr->
GetStart()))
580 rBreaks.emplace_back(
n,
i);
589 startedFields.emplace(pFieldMark,
false, 0, 0);
594 if (startedFields.empty())
596 rBreaks.emplace_back(
n,
i);
600 assert(std::get<0>(startedFields.top())->IsCoveringPosition(
SwPosition(rTextNode,
i)));
601 std::get<1>(startedFields.top()) =
true;
602 std::get<2>(startedFields.top()) =
n;
603 std::get<3>(startedFields.top()) =
i;
609 if (startedFields.empty())
611 rBreaks.emplace_back(
n,
i);
635 while (!startedFields.empty())
637 if (
const sw::mark::IFieldmark* pMark = std::get<0>(startedFields.top()))
639 SwPosition const& rStart(pMark->GetMarkStart());
640 std::pair<SwNodeOffset, sal_Int32>
const pos(
642 auto it = std::lower_bound(rBreaks.begin(), rBreaks.end(),
pos);
643 assert(it == rBreaks.end() || *it !=
pos);
644 rBreaks.insert(it,
pos);
646 if (std::get<1>(startedFields.top()))
648 std::pair<SwNodeOffset, sal_Int32>
const posSep(
649 std::get<2>(startedFields.top()),
650 std::get<3>(startedFields.top()));
651 auto it = std::lower_bound(rBreaks.begin(), rBreaks.end(), posSep);
652 assert(it == rBreaks.end() || *it != posSep);
653 rBreaks.insert(it, posSep);
667 std::vector<std::pair<SwNodeOffset, sal_Int32>> Breaks;
673 return (rDocumentContentOperations.*pFunc)(rPam, flags);
685 auto iter( Breaks.rbegin() );
688 SwPaM aPam( rSelectionEnd, rSelectionEnd );
692 while (iter != Breaks.rend())
694 rStart.Assign(*rNodes[iter->first - nOffset]->GetTextNode(), iter->second + 1);
697 bRet &= (rDocumentContentOperations.*pFunc)(aPam, flags);
698 nOffset = iter->first - rStart.GetNodeIndex();
700 rEnd.Assign(*rNodes[iter->first - nOffset]->GetTextNode(), iter->second);
704 rStart = *rPam.
Start();
707 bRet &= (rDocumentContentOperations.*pFunc)(aPam, flags);
713 bool lcl_StrLenOverflow(
const SwPaM& rPam )
719 auto [pStt, pEnd] = rPam.
StartEnd();
721 if( (
nullptr != pEndNd) && pStt->GetNode().IsTextNode() )
723 const sal_uInt64 nSum = pStt->GetContentIndex() +
724 pEndNd->
GetText().getLength() - pEnd->GetContentIndex();
745 nStt = pStt->GetNodeIndex() - nSttIdx;
746 nSttCnt = pStt->GetContentIndex();
749 nEnd = pEnd->GetNodeIndex() - nSttIdx;
750 nEndCnt = pEnd->GetContentIndex();
764 nStt = pStt->GetNodeIndex() - nSttIdx;
765 nSttCnt = pStt->GetContentIndex();
770 nEnd = pEnd->GetNodeIndex() - nSttIdx;
771 nEndCnt = pEnd->GetContentIndex();
801 typedef std::vector< SaveRedline > SaveRedlines_t;
803 void lcl_SaveRedlines(
const SwPaM& aPam, SaveRedlines_t& rArr)
807 auto [pStart, pEnd] = aPam.
StartEnd();
812 if( nCurrentRedline > 0)
822 for( ; nCurrentRedline < rRedlineTable.
size(); nCurrentRedline++ )
837 rRedlineTable.
Remove( nCurrentRedline-- );
844 *pNewRedline->
End() = *pStart;
845 *pCurrent->
Start() = *pStart;
854 *pNewRedline->
Start() = *pEnd;
855 *pCurrent->
End() = *pEnd;
860 rArr.emplace_back( pCurrent, *pStart );
868 void lcl_RestoreRedlines(
SwDoc& rDoc,
const SwPosition& rPos, SaveRedlines_t& rArr)
873 for(SaveRedline & rSvRedLine : rArr)
875 rSvRedLine.SetPos( rPos );
882 void lcl_SaveRedlines(
const SwNodeRange& rRg, SaveRedlines_t& rArr)
900 auto [pRStt, pREnd] = pTmp->
StartEnd();
912 rArr.emplace_back(pNewRedl, rRg.
aStart);
914 pTmpPos = pTmp->
End();
925 rRedlTable.
Remove( nRedlPos-- );
927 ( pREnd->GetNode() == rRg.
aEnd.
GetNode() && !pREnd->GetContentIndex()) )
930 rArr.emplace_back( pTmp, rRg.
aStart );
939 rArr.emplace_back( pNewRedl, rRg.
aStart );
941 pTmpPos = pTmp->
Start();
953 void lcl_RestoreRedlines(
SwDoc& rDoc,
SwNodeOffset const nInsPos, SaveRedlines_t& rArr)
958 for(SaveRedline & rSvRedLine : rArr)
960 rSvRedLine.SetPos( nInsPos );
964 rSvRedLine.pRedl->GetType() == RedlineType::Delete )
973 bool lcl_SaveFootnote(
const SwNode& rSttNd,
const SwNode& rEndNd,
976 std::optional<sal_Int32> oSttCnt = std::nullopt, std::optional<sal_Int32> oEndCnt = std::nullopt )
978 bool bUpdateFootnote =
false;
982 const bool bSaveFootnote = !bDelFootnote &&
984 if( !rFootnoteArr.
empty() )
990 const SwNode* pFootnoteNd;
993 while( nPos < rFootnoteArr.
size() && ( pFootnoteNd =
994 &( pSrch = rFootnoteArr[ nPos ] )->GetTextNode())->GetIndex()
997 const sal_Int32 nFootnoteSttIdx = pSrch->
GetStart();
998 if( ( oEndCnt && oSttCnt )
999 ? (( &rSttNd == pFootnoteNd &&
1000 *oSttCnt > nFootnoteSttIdx) ||
1001 ( &rEndNd == pFootnoteNd &&
1002 nFootnoteSttIdx >= *oEndCnt ))
1003 : ( &rEndNd == pFootnoteNd ))
1019 rFootnoteArr.
erase( rFootnoteArr.
begin() + nPos );
1021 rSaveArr.
insert( pSrch );
1023 bUpdateFootnote =
true;
1027 while( nPos-- && ( pFootnoteNd = &( pSrch = rFootnoteArr[ nPos ] )->
1028 GetTextNode())->GetIndex() >= rSttNd.
GetIndex() )
1030 const sal_Int32 nFootnoteSttIdx = pSrch->
GetStart();
1031 if( !oEndCnt || !oSttCnt ||
1032 ! (( &rSttNd == pFootnoteNd &&
1033 *oSttCnt > nFootnoteSttIdx ) ||
1034 ( &rEndNd == pFootnoteNd &&
1035 nFootnoteSttIdx >= *oEndCnt )) )
1047 rFootnoteArr.
erase( rFootnoteArr.
begin() + nPos );
1049 rSaveArr.
insert( pSrch );
1051 bUpdateFootnote =
true;
1061 while( aIdx < rEndNd )
1063 SwNode* pNode = &aIdx.GetNode();
1069 bUpdateFootnote =
true;
1071 for(
size_t i = 0;
i <
nCount; ++
i )
1084 return bUpdateFootnote;
1087 bool lcl_MayOverwrite(
const SwTextNode *pNode,
const sal_Int32 nPos )
1109 if( !lcl_MayOverwrite( pNode, rStart ) )
1115 }
while (rStart < pNode->GetText().
getLength()
1116 && !lcl_MayOverwrite(pNode, rStart) );
1120 bool lcl_GetTokenToParaBreak( OUString& rStr, OUString& rRet,
bool bRegExpRplc )
1125 static constexpr OUStringLiteral sPara(u
"\\n");
1128 nPos = rStr.indexOf( sPara, nPos );
1134 if( nPos &&
'\\' == rStr[nPos-1])
1137 if( nPos >= rStr.getLength() )
1144 rRet = rStr.copy( 0, nPos );
1145 rStr = rStr.copy( nPos + sPara.getLength() );
1159 bool lcl_ApplyOtherSet(
1168 assert(rOtherSet.
Count());
1179 pMerged = pTextFrame->GetMergedPara();
1183 if (rFirstSet.
Count())
1187 SwRegHistory aRegH(pMerged->pFirstNode, *pMerged->pFirstNode, pHistory);
1188 ret = pMerged->pFirstNode->SetAttr(rFirstSet);
1192 ret = pMerged->pFirstNode->SetAttr(rFirstSet);
1195 if (rPropsSet.
Count())
1199 SwRegHistory aRegH(pMerged->pParaPropsNode, *pMerged->pParaPropsNode, pHistory);
1200 ret = pMerged->pParaPropsNode->SetAttr(rPropsSet) || ret;
1204 ret = pMerged->pParaPropsNode->SetAttr(rPropsSet) || ret;
1209 *o_pIndex = *pMerged->pLastNode;
1223 ret = rNode.
SetAttr( rOtherSet );
1227 ret = rNode.
SetAttr( rOtherSet );
1233 #define DELETECHARSETS if ( bDelete ) { delete pCharSet; delete pOtherSet; }
1236 void lcl_SetRedline(
1240 std::unique_ptr<SwRedlineExtraData_FormatColl> xExtra;
1250 pRStt = pTmp->
Start();
1251 pREnd = pTmp->
End();
1261 if (pFormattingChanges)
1298 aSet.ClearInvalidItems();
1313 void lcl_SetRedlines(
1319 while( aIdx <= aEndNd )
1324 const sal_Int32 nStart = aIdx == rRg.
Start()->
GetNode()
1327 const sal_Int32 nEnd = aIdx < aEndNd
1328 ? pNode->
GetText().getLength()
1334 sal_Int32 nRedEnd = nStart;
1335 for(
size_t i = 0;
i <
nCount; ++
i )
1350 if ( nRedEnd < pAttr->GetStart() )
1353 lcl_SetRedline(rDoc, aPam);
1357 sal_Int32 nRedStart = std::max(pAttr->
GetStart(), nStart);
1359 SwPaM aPam2( *pNode, nRedStart, *pNode, nRedEnd );
1360 lcl_SetRedline(rDoc, aPam2);
1364 if ( nRedEnd < nEnd )
1366 SwPaM aPam( *pNode, nRedEnd, *pNode, nEnd );
1367 lcl_SetRedline(rDoc, aPam);
1372 SwPaM aPam( *pNode, nStart, *pNode, nEnd );
1373 lcl_SetRedline(rDoc, aPam);
1395 bool bDelete =
false;
1396 bool bCharAttr =
false;
1397 bool bOtherAttr =
false;
1400 if ( 1 == rChgSet.
Count() )
1406 const sal_uInt16 nWhich = pItem->
Which();
1414 pCharSet = &rChgSet;
1425 pOtherSet = &rChgSet;
1434 if ( !bCharAttr && !bOtherAttr )
1448 pTmpCharItemSet->
Put( rChgSet );
1449 pTmpOtherItemSet->Put( rChgSet );
1451 pCharSet = pTmpCharItemSet;
1452 pOtherSet = pTmpOtherItemSet;
1470 auto nStartIndex = pNode->
GetIndex();
1471 auto nEndIndex = pEndNode->
GetIndex();
1473 while ( pCurrentNode !=
nullptr && nStartIndex <= pCurrentNode->GetIndex() )
1477 (nStartIndex < pCurrentNode->GetIndex() || pStt->
GetContentIndex() == 0) &&
1478 (pCurrentNode->
GetIndex() < nEndIndex || pEnd->GetContentIndex() == pEndNode->
Len()))
1499 OSL_FAIL(
"<InsAttr(..)> - PaM in front of label, but text node has no numbering rule set. This is a serious defect." );
1512 SwNumFormat aNumFormat = pNumRule->
Get(o3tl::narrowing<sal_uInt16>(nLevel));
1530 if ( !bCharAttr && !bOtherAttr )
1534 aTextSet.Put( rChgSet );
1535 if( aTextSet.Count() )
1538 bRet = history.InsertItems(
1559 if ( !bCharAttr && !bOtherAttr )
1569 aTextSet.Put( rChgSet );
1570 if( aTextSet.Count() )
1573 const sal_Int32 nEnd = pStt->
GetNode() == pEnd->GetNode()
1574 ? pEnd->GetContentIndex()
1577 bRet = history.InsertItems( aTextSet, nInsCnt, nEnd, nFlags, ppNewTextAttr )
1586 SwPaM aPam( pStt->
GetNode(), bTextIns ? nInsCnt + 1 : nEnd,
1594 bTextIns ? RedlineType::Insert : RedlineType::Format, aPam ),
1604 if( pOtherSet && pOtherSet->
Count() )
1621 pTableNd = pCurTableNd;
1636 SwRegHistory aRegH( pFirstNode, *pFirstNode, pHistory );
1637 bRet = pFirstNode->SetAttr( aNew ) || bRet;
1648 if( !pOtherSet->
Count() )
1663 pTableNd = pCurTableNd;
1678 if( !pOtherSet->
Count() )
1687 sal_uInt16 nPoolId=0;
1698 if (pOtherSet && pOtherSet->
Count())
1700 firstSet.Put(*pOtherSet);
1706 if (pOtherSet && pOtherSet->
Count())
1708 propsSet.Put(*pOtherSet);
1723 const OUString& rStr = pTextNd->
GetText();
1728 if (pURLAttr && !pURLAttr->GetINetFormat().GetValue().isEmpty())
1730 nMkPos = pURLAttr->GetStart();
1731 nPtPos = *pURLAttr->End();
1739 WordType::ANY_WORD ,
1742 if( aBndry.startPos < nPtPos && nPtPos < aBndry.endPos )
1744 nMkPos = aBndry.startPos;
1745 nPtPos = aBndry.endPos;
1756 pTextNd->
HasHints() && !nMkPos && nPtPos == rStr.getLength())
1773 SwPaM aPam( *pNode, nMkPos, *pNode, nPtPos );
1778 lcl_SetRedlines(rDoc, aPam);
1784 bRet = history.InsertItems( *pCharSet, nMkPos, nPtPos, nFlags,
nullptr )
1788 if( pOtherSet && pOtherSet->
Count() )
1796 bRet = lcl_ApplyOtherSet(*pNode, pHistory, aTempLocalCopy, firstSet, propsSet, pLayout) || bRet;
1808 lcl_SetRedlines(rDoc, rRg);
1816 SwContentIndex aCntEnd( pEnd->GetContentNode(), pEnd->GetContentIndex() );
1820 const sal_Int32 nLen = pNode->
Len();
1821 if( pStt->
GetNode() != pEnd->GetNode() )
1822 aCntEnd.Assign( pNode, nLen );
1830 bRet = history.InsertItems(*pCharSet,
1835 if( pOtherSet && pOtherSet->
Count() )
1837 bRet = lcl_ApplyOtherSet(*pNode, pHistory, *pOtherSet, firstSet, propsSet, pLayout) || bRet;
1841 if( pStt->
GetNode() == pEnd->GetNode() )
1847 aSt.Assign( pStt->
GetNode(), +1 );
1851 aCntEnd.Assign(pEnd->GetContentNode(), pEnd->GetContentIndex());
1854 aSt.Assign( pStt->
GetNode(), +1 );
1861 if( pStt->
GetNode() < pEnd->GetNode() )
1866 if( aCntEnd.GetIndex() != pNode->
Len() )
1872 (void)history.InsertItems(*pCharSet,
1873 0, aCntEnd.GetIndex(), nFlags,
nullptr);
1876 if( pOtherSet && pOtherSet->
Count() )
1878 lcl_ApplyOtherSet(*pNode, pHistory, *pOtherSet, firstSet, propsSet, pLayout);
1882 aEnd = pEnd->GetNode();
1885 aEnd.Assign( pEnd->GetNode(), +1 );
1888 aEnd = pEnd->GetNode();
1891 aEnd.Assign( pEnd->GetNode(), +1 );
1900 pStt, pEnd, pHistory, pCharSet, pLayout);
1904 bool bCreateSwpHints = pCharSet && (
1908 for (
SwNodeIndex current = aSt; current < aEnd; ++current)
1924 if (pCharSet && pCharSet->
Count())
1929 pSwpHints->Register( &aRegH );
1932 pTNd->
SetAttr(*pCharSet, 0, pTNd->
GetText().getLength(), nFlags);
1936 pSwpHints->DeRegister();
1941 if (pCharSet && pCharSet->
Count())
1942 pTNd->
SetAttr(*pCharSet, 0, pTNd->
GetText().getLength(), nFlags);
1947 if (pOtherSet && pOtherSet->
Count())
1949 for (; aSt < aEnd; ++aSt)
1955 lcl_ApplyOtherSet(*pNode, pHistory, *pOtherSet, firstSet, propsSet, pLayout, &aSt);
1961 return (nNodes != 0) || bRet;
1972 std::vector<std::pair<SwNodeOffset, sal_Int32>> Breaks;
1974 return !Breaks.empty();
2000 return rEnd < rStart;
2023 nEnd = pEnd->GetNodeIndex(),
2024 nDiff = nEnd - nStt +1;
2038 lcl_ChkFlyFly( rDoc, nStt, nEnd, rPos.
GetNodeIndex() ) )
2044 SwPaM* pRedlineRange =
nullptr;
2047 pRedlineRange =
new SwPaM( rPos );
2057 else if( ! ( *pStt <= rPos && rPos < *pEnd &&
2058 ( pStt->
GetNode() != pEnd->GetNode() ||
2068 assert(!
"mst: this is assumed to be dead code");
2078 delete pRedlineRange;
2100 assert(pNode &&
"Didn't pass a Node.");
2113 SwPaM const range(aSttIdx, aEndIdx);
2124 SwPaM aPam(rPos, rPos);
2126 assert(aPam.
GetText().getLength() == 1 && aPam.
GetText()[0] == cDummy);
2165 SwPaM temp(rPam,
nullptr);
2186 bool bSavePageBreak =
false, bSavePageDesc =
false;
2203 bSavePageDesc =
true;
2210 bSavePageBreak =
true;
2220 else if( rPam.
GetPoint() == &rStt )
2225 bool bGoNext = (
nullptr == pTmpNode);
2245 pUndo->SetPgBrkFlags( bSavePageBreak, bSavePageDesc );
2261 SAL_WARN(
"sw.core",
"DelFullPara: no more Nodes");
2271 ::std::set<::sw::mark::IFieldmark*> fieldmarks;
2274 if (
SwTextNode *
const pTextNode =
i.GetNode().GetTextNode())
2276 for (sal_Int32 j = 0; j < pTextNode->GetText().
getLength(); ++j)
2278 switch (pTextNode->GetText()[j])
2291 for (
auto const pFieldMark : fieldmarks)
2315 ((RndStdIds::FLY_AT_PARA == pAnchor->
GetAnchorId()) ||
2316 (RndStdIds::FLY_AT_CHAR == pAnchor->
GetAnchorId())) &&
2345 if ( lcl_StrLenOverflow( rPam ) )
2362 if( !rPaM.
HasMark() || *pStt >= *pEnd || (*pStt <= rPos && rPos < *pEnd))
2372 SaveRedlines_t aSaveRedl;
2375 lcl_SaveRedlines( rPaM, aSaveRedl );
2387 pEnd->GetContentIndex());
2390 bool bUpdateFootnote =
false;
2393 std::unique_ptr<SwUndoMove> pUndoMove;
2397 pUndoMove.reset(
new SwUndoMove( rPaM, rPos ));
2402 bUpdateFootnote = lcl_SaveFootnote( pStt->
GetNode(), pEnd->GetNode(), rPos.
GetNode(),
2407 bool bSplit =
false;
2408 SwPaM aSavePam( rPos, rPos );
2416 bool bCorrSavePam = pSrcNd && pStt->
GetNode() != pEnd->GetNode();
2441 if (!pContentStore->Empty())
2443 pContentStore->Restore(m_rDoc, pOrigNode->GetIndex()-SwNodeOffset(1), 0, true, false, eMode);
2493 std::vector< ::sw::mark::SaveBookmark> aSaveBkmks;
2499 pEnd->GetContentIndex());
2517 OSL_ENSURE( *aSavePam.
GetMark() == rPos ||
2519 "PaM was not moved. Aren't there ContentNodes at the beginning/end?" );
2525 bool bRemove =
true;
2548 for(
auto& rBkmk : aSaveBkmks)
2562 if( !aSaveRedl.empty() )
2564 lcl_RestoreRedlines(
m_rDoc, *aSavePam.
Start(), aSaveRedl );
2567 if( bUpdateFootnote )
2569 if( !aTmpFntIdx.
empty() )
2593 bool bUpdateFootnote =
false;
2596 std::unique_ptr<SwUndoMove> pUndo;
2607 SaveRedlines_t aSaveRedl;
2608 std::vector<SwRangeRedline*> aSavRedlInsPosArr;
2611 lcl_SaveRedlines( rRange, aSaveRedl );
2621 pRStt = pTmp->
Start();
2622 pREnd = pTmp->
End();
2625 aSavRedlInsPosArr.push_back( pTmp );
2634 std::vector< ::sw::mark::SaveBookmark> aSaveBkmks;
2645 std::optional<SwNodeIndex> oSaveInsPos;
2647 oSaveInsPos.emplace(rRange.
aStart, -1 );
2664 if( !aSaveFlyArr.empty() )
2671 for(
auto& rBkmk : aSaveBkmks)
2674 if( !aSavRedlInsPosArr.empty() )
2686 if( !aSaveRedl.empty() )
2691 pUndo->SetDestRange( aIdx.
GetNode(), rDestNd, *oSaveInsPos );
2695 oSaveInsPos.reset();
2697 if( bUpdateFootnote )
2699 if( !aTmpFntIdx.
empty() )
2720 if( !bRet || bOneNode )
2743 assert(rStr.getLength());
2747 if( 1 == rStr.getLength() )
2753 if (!pNode || rStr.getLength() > pNode->
GetSpaceLeft())
2767 sal_Int32 nStart = 0;
2772 for( sal_Int32 nCnt = 0; nCnt < rStr.getLength(); ++nCnt )
2776 if (nStart < pNode->GetText().
getLength())
2778 lcl_SkipAttr( pNode, rPt, nStart );
2783 bool bMerged(
false);
2798 std::make_unique<SwUndoOverwrite>(
m_rDoc, rPt, c) );
2804 if (nStart < pNode->GetText().
getLength())
2819 if( nOldAttrCnt != nNewAttrCnt )
2879 OUString
const ins(pNode->
InsertText(rStr, rPos, nInsertMode));
2883 std::make_unique<SwUndoInsert>(rPos.
GetNode(),
2897 if (pUndoInsert && pUndoInsert->
CanGrouping(rPos))
2899 pUndo = pUndoInsert;
2913 OUString
const ins(pNode->
InsertText(rStr, rPos, nInsertMode));
2915 for (sal_Int32
i = 0;
i < ins.getLength(); ++
i)
2962 std::unique_ptr<SwUndoTransliterate> pUndo;
2966 auto [pStt, pEnd] = rPaM.
StartEnd();
2968 nEndNd = pEnd->GetNodeIndex();
2970 sal_Int32 nEndCnt = pEnd->GetContentIndex();
2973 if( (pStt == pEnd) && pTNd )
2980 WordType::ANY_WORD ,
2983 if( aBndry.startPos < nSttCnt && nSttCnt < aBndry.endPos )
2986 if (rTrans.
getType() == TransliterationFlags::SENTENCE_CASE) {
2996 nSttCnt = aBndry.startPos;
2997 nEndCnt = aBndry.endPos;
3008 if ( bUseRedlining )
3011 const bool bIsTitleCase = rTrans.
getType() == TransliterationFlags::TITLE_CASE;
3015 for( ; aIdx.
GetIndex() <= nEndNd; ++aIdx )
3020 if( !pAffectedNode || pAffectedNode->
GetText().isEmpty() )
3028 nAffectedChars += pAffectedNode->
GetText().getLength();
3032 if( nAffectedNodes > nMaxRedlines ||
3035 ( bIsTitleCase && (nAffectedChars - nSttCnt)/6 > nMaxRedlines ) )
3037 bUseRedlining =
false;
3043 if( nSttNd != nEndNd )
3055 rTrans, nSttCnt, pTNd->
GetText().getLength(), pUndo.get(), bUseRedlining);
3059 for( ; aIdx.
GetIndex() < nEndNd; ++aIdx )
3065 rTrans, 0, pTNd->
GetText().getLength(), pUndo.get(), bUseRedlining);
3069 if( nEndCnt &&
nullptr != ( pTNd = pEnd->GetNode().
GetTextNode() ))
3074 else if( pTNd && nSttCnt < nEndCnt )
3076 pTNd->
TransliterateText( rTrans, nSttCnt, nEndCnt, pUndo.get(), bUseRedlining );
3078 if( pUndo && pUndo->HasData() )
3087 const OUString& rGrfName,
3088 const OUString& rFltName,
3098 rGrfName, rFltName, pGraphic,
3101 pFlyAttrSet, pGrfAttrSet, pFrameFormat );
3102 return pSwFlyFrameFormat;
3125 pFlyAttrSet,
nullptr,
3143 pFlyAttrSet, pGrfAttrSet,
3148 const OUString& rFltName,
const Graphic* pGraphic )
3166 pGrfNd->
ReRead( rGrfName, rFltName, pGraphic );
3184 const bool bIsAtContent = (RndStdIds::FLY_AT_PAGE != eAnchorId);
3187 if ( pAnchor ==
nullptr )
3191 else if ( bIsAtContent )
3198 if( pChkPos !=
nullptr
3203 eAnchorId = RndStdIds::FLY_AT_PAGE;
3206 else if( pAnchor ==
nullptr
3213 if ( eAnchorId == RndStdIds::FLY_AT_FLY )
3223 if ( eAnchorId == RndStdIds::FLY_AT_PAGE )
3225 eAnchorId =
dynamic_cast<const SdrUnoObj*
>( &rDrawObj) !=
nullptr ? RndStdIds::FLY_AS_CHAR : RndStdIds::FLY_AT_PARA;
3233 if ( eAnchorId == RndStdIds::FLY_AS_CHAR )
3235 bool bAnchorAtPageAsFallback =
true;
3241 if ( pAnchorTextNode !=
nullptr )
3245 pAnchorTextNode->
InsertItem( aFormat, nStt, nStt );
3246 bAnchorAtPageAsFallback =
false;
3250 if ( bAnchorAtPageAsFallback )
3252 OSL_ENSURE(
false,
"DocumentContentOperationsManager::InsertDrawObj(..) - missing content anchor for as-character anchored drawing object --> anchor at-page" );
3285 if(
nullptr == pNode)
3310 if( pTextNode &&
nPos &&
nPos != pTextNode->
Len() )
3325 nullptr != ( pTableNd =
m_rDoc.
GetNodes()[ --nPrevPos ]->GetTableNode() ) &&
3391 if (!pContentStore->Empty())
3393 pContentStore->Restore(m_rDoc, rPos.GetNodeIndex()-SwNodeOffset(1), 0, true, bAtStart && (eMode & sw::mark::RestoreMode::Flys), eMode);
3404 aPam.Move( fnMoveBackward );
3405 if (m_rDoc.getIDocumentRedlineAccess().IsRedlineOn())
3407 m_rDoc.getIDocumentRedlineAccess().AppendRedline(
3408 new SwRangeRedline(RedlineType::Insert, aPam), true);
3412 m_rDoc.getIDocumentRedlineAccess().SplitRedline(aPam);
3423bool DocumentContentOperationsManager::AppendTextNode(
SwPosition& rPos )
3460bool DocumentContentOperationsManager::ReplaceRange(
SwPaM& rPam,
const OUString& rStr,
3461 const bool bRegExReplace )
3466 std::vector<std::pair<SwNodeOffset, sal_Int32>> Breaks;
3478 while (!Breaks.empty()
3484 Breaks.erase(Breaks.begin());
3493 return ReplaceRangeImpl(rPam, rStr, bRegExReplace);
3503 auto iter( Breaks.rbegin() );
3506 OSL_ENSURE(aPam.
GetPoint() == aPam.
End(),
"wrong!");
3514 while (iter != Breaks.rend())
3516 rStart.
Assign(*rNodes[iter->first - nOffset]->GetTextNode(), iter->second + 1);
3524 rEnd.
Assign(*rNodes[iter->first - nOffset]->GetTextNode(), iter->second);
3528 rStart = *rPam.
Start();
3529 assert(rStart < rEnd &&
"replace part empty!");
3532 bRet &= ReplaceRangeImpl(aPam, rStr, bRegExReplace);
3540bool DocumentContentOperationsManager::InsertPoolItem(
3548 std::unique_ptr<SwUndoAttr> pUndoAttr;
3552 pUndoAttr.reset(
new SwUndoAttr( rRg, rHt, nFlags ));
3557 const bool bRet = lcl_InsAttr(
m_rDoc, rRg, aSet, nFlags, pUndoAttr.get(), pLayout, ppNewTextAttr);
3571void DocumentContentOperationsManager::InsertItemSet (
const SwPaM &rRg,
const SfxItemSet &rSet,
3575 std::unique_ptr<SwUndoAttr> pUndoAttr;
3582 bool bRet = lcl_InsAttr(
m_rDoc, rRg,
rSet, nFlags, pUndoAttr.get(), pLayout,
nullptr );
3593void DocumentContentOperationsManager::RemoveLeadingWhiteSpace(
const SwPosition & rPos )
3599 const OUString& rText = pTNd->
GetText();
3601 while (nIdx < rText.getLength())
3604 if ((
'\t' != cCh) && (
' ' != cCh))
3617 DeleteRange( aPam );
3621void DocumentContentOperationsManager::RemoveLeadingWhiteSpace(
SwPaM& rPaM )
3628 RemoveLeadingWhiteSpace(
SwPosition(rSel.GetBound().GetNodes(),
nPos));
3635void DocumentContentOperationsManager::CopyWithFlyInFly(
3638 const std::pair<const SwPaM&, const SwPosition&>* pCopiedPaM ,
3639 const bool bMakeNewFrames,
3640 const bool bDelRedlines,
3641 const bool bCopyFlyAtFly,
3644 assert(!pCopiedPaM || pCopiedPaM->first.End()->GetNode() == rRg.
aEnd.
GetNode());
3645 assert(!pCopiedPaM || pCopiedPaM->second.GetNode() <= rInsPos);
3652 bool bEndIsEqualEndPos = rInsPos == rRg.
aEnd.
GetNode();
3660 if (bEndIsEqualEndPos)
3674 if (pCopiedPaM && rRg.
aStart != pCopiedPaM->first.Start()->
GetNode())
3682 targetPos = pCopiedPaM->second;
3690 bool isRecreateEndNode(
false);
3701 if (pFrame->getRootFrame()->HasMergedParas())
3705 if (pNode ==
nullptr && pFrame->GetMergedPara()
3708 pNode = pFrame->GetMergedPara()->pFirstNode;
3713 if (pNode !=
nullptr)
3716 if (!frames.
empty())
3721 if (pFrame->getRootFrame()->HasMergedParas())
3723 auto const it = frames.
find(pFrame);
3724 if (it != frames.
end())
3730 if (!frames.
empty())
3733 isRecreateEndNode =
true;
3747 SwNodeOffset((!isRecreateEndNode || isAtStartOfSection)
3753#if OSL_DEBUG_LEVEL > 0
3761 if( pSSectNd == pESectNd &&
3769 "An insufficient number of nodes were copied!" );
3776 CopyFlyInFlyImpl(rRg, pCopiedPaM ? &pCopiedPaM->first :
nullptr,
3778 (pCopiedPaM && rRg.
aStart != pCopiedPaM->first.Start()->
GetNode())
3779 ? pCopiedPaM->second.GetNode()
3788 lcl_DeleteRedlines( rRg, aCpyRange );
3795void DocumentContentOperationsManager::CopyFlyInFlyImpl(
3797 SwPaM const*
const pCopiedPaM,
3799 const bool bCopyFlyAtFly,
3808 std::set< ZSortFly > aSet;
3814 for (
size_t n = 0;
n < nArrLen; ++
n )
3826 case RndStdIds::FLY_AT_FLY:
3832 case RndStdIds::FLY_AT_PARA:
3842 case RndStdIds::FLY_AT_CHAR:
3855 if (RndStdIds::FLY_AT_FLY == pAnchor->
GetAnchorId())
3857 if (nStart > nSkipAfter)
3879 aSet.insert(
ZSortFly( pFormat, pAnchor, nArrLen + aSet.size() ));
3886 std::vector< SwFrameFormat* > aVecSwFrameFormat;
3887 std::set< ZSortFly >::const_iterator it=aSet.begin();
3889 while (it != aSet.end())
3903 if ((aAnchor.
GetAnchorId() == RndStdIds::FLY_AT_PARA) ||
3904 (aAnchor.
GetAnchorId() == RndStdIds::FLY_AT_CHAR) )
3909 bool bAnchorTextNdFound(
false );
3912 while ( !bAnchorTextNdFound && aIdx <= rRg.
aEnd )
3916 ++nAnchorTextNdNumInRange;
3923 if ( !bAnchorTextNdFound )
3927 OSL_FAIL(
"<SwDoc::_CopyFlyInFly(..)> - anchor text node in copied range not found" );
3928 nAnchorTextNdNumInRange = 1;
3935 const SwNode& aEndOfContentNd =
3937 while ( nAnchorTextNdNumInRange > 0 &&
3938 aIdx.
GetNode() != aEndOfContentNd )
3942 --nAnchorTextNdNumInRange;
3943 aAnchorNdIdx = aIdx;
3952 OSL_FAIL(
"<SwDoc::_CopyFlyInFly(..)> - found anchor node index isn't a text node" );
3953 aAnchorNdIdx = rStartIdx;
3960 newPos.
Assign( aAnchorNdIdx );
3965 newPos.
Assign( rStartIdx, nOffset );
3968 if ((RndStdIds::FLY_AT_CHAR == aAnchor.
GetAnchorId()) &&
3989 it = aSet.erase(it);
3998 it = aSet.erase(it);
4004 aAnchor,
false,
true ) );
4009 OSL_ENSURE( aSet.size() == aVecSwFrameFormat.size(),
"Missing new Flys" );
4010 if ( aSet.size() != aVecSwFrameFormat.size() )
4014 for (
const auto& rFlyN : aSet)
4019 for (
const auto& rFlyK : aSet)
4022 if ( rChain.
GetPrev() == pFormatK )
4024 ::lcl_ChainFormats(
static_cast< SwFlyFrameFormat*
>(aVecSwFrameFormat[k]),
4027 else if ( rChain.
GetNext() == pFormatK )
4049bool DocumentContentOperationsManager::lcl_RstTextAttr(
SwNode* pNd,
void* pArgs )
4061 sal_Int32 nEnd = pTextNode->
Len();
4087DocumentContentOperationsManager::~DocumentContentOperationsManager()
4092bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl(
SwPaM & rPam,
SwDeleteFlags const flags)
4103 std::vector<std::unique_ptr<SwRangeRedline>> redlines;
4105 auto pRedline(std::make_unique<SwRangeRedline>(RedlineType::Delete, rPam));
4106 if (pRedline->HasValidRange())
4108 redlines.push_back(std::move(pRedline));
4116 if (redlines.empty())
4127 std::vector<std::unique_ptr<SwUndo>> MarkUndos;
4128 for (
auto iter = rDMA.getAnnotationMarksBegin();
4129 iter != rDMA.getAnnotationMarksEnd(); )
4133 SwPosition const& rEndPos((**iter).GetMarkEnd());
4134 if (*rPam.
Start() < rEndPos && rEndPos <= *rPam.
End())
4138 MarkUndos.emplace_back(std::make_unique<SwUndoDeleteBookmark>(**iter));
4141 rDMA.deleteMark(&**iter);
4143 iter = rDMA.getAnnotationMarksBegin();
4147 if (*rPam.
End() < (**iter).GetMarkStart())
4159 std::vector<std::unique_ptr<SwUndoRedlineDelete>> undos;
4165 "sw.core",
"redlines will be moved in DeleteAndJoin");
4169 for (std::unique_ptr<SwRangeRedline> & pRedline : redlines)
4171 assert(pRedline->HasValidRange());
4172 undos.emplace_back(std::make_unique<SwUndoRedlineDelete>(
4175 const SwRewriter aRewriter = undos.front()->GetRewriter();
4177 if (MarkUndos.empty() && undos.size() == 1
4182 bool const bMerged = pUndoRedlineDel
4193 for (
auto& it : MarkUndos)
4197 for (
auto & it : undos)
4204 for (std::unique_ptr<SwRangeRedline> & pRedline : redlines)
4210 *pCursor->GetPoint() = *pRedline->GetPoint();
4236 bool bJoinText, bJoinPrev;
4239 bool const bSuccess( DeleteRangeImpl(rPam, flags) );
4267 bool const bSuccess( DeleteRangeImplImpl(aDelPam, flags) );
4278 auto [pStt, pEnd] = rPam.
StartEnd();
4302 for(
size_t n = pHts->
Count();
n; )
4305 if( nMkCntPos > pAttr->
GetStart() )
4308 const sal_Int32 *pEndIdx;
4309 if( nMkCntPos == pAttr->
GetStart() &&
4310 nullptr != (pEndIdx = pAttr->
End()) &&
4327 bool bMerged(
false);
4363 pEnd->GetContentIndex());
4372 if ( pStartTextNode )
4375 bool bOneNd = pStt->
GetNode() == pEnd->GetNode();
4376 const sal_Int32 nLen = ( bOneNd ? pEnd->GetContentIndex()
4383 pStartTextNode->
EraseText( *pStt, nLen );
4385 if( !pStartTextNode->
Len() )
4388 pStartTextNode->RemoveMetadataReference();
4412 if( pEnd->GetContentIndex() )
4415 pEndTextNode->
EraseText( aIdx, pEnd->GetContentIndex() );
4417 if( !pEndTextNode->
Len() )
4420 pEndTextNode->RemoveMetadataReference();
4428 pEnd->nContent.Assign(
nullptr, 0 );
4434 if( pCNd ==
nullptr )
4437 if( aSttIdx != nEnd )
4445 && aSttIdx <= pTmpNd->StartOfSectionNode()->GetIndex())
4476bool DocumentContentOperationsManager::ReplaceRangeImpl(
SwPaM& rPam,
const OUString& rStr,
4477 const bool bRegExReplace )
4482 bool bJoinText, bJoinPrev;
4492 auto [pStt, pEnd] = aDelPam.
StartEnd();
4493 bool bOneNode = pStt->
GetNode() == pEnd->GetNode();
4496 OUString sRepl( rStr );
4510 "sw.core",
"redlines will be moved in ReplaceRange");
4515 const ::sw::mark::IMark* pBkmk =
4518 ::sw::mark::InsertMode::New);
4523 *aDelPam.
GetPoint() = pBkmk->GetMarkPos();
4524 if(pBkmk->IsExpanded())
4525 *aDelPam.
GetMark() = pBkmk->GetOtherMarkPos();
4527 pStt = aDelPam.
Start();
4532 if( !sRepl.isEmpty() )
4556 while ( lcl_GetTokenToParaBreak( sRepl, sIns, bRegExReplace ) )
4558 InsertString( aDelPam, sIns );
4564 SplitNode( *aDelPam.
GetPoint(),
false );
4571 SplitNode( *aDelPam.
GetPoint(),
false );
4573 if( !sIns.isEmpty() )
4575 InsertString( aDelPam, sIns );
4586 InsertItemSet( aTmpRange, aSet );
4605 *pCursor->GetPoint() = *aDelPam.
GetPoint();
4617 const ::sw::mark::IMark* pBkmk =
4620 ::sw::mark::InsertMode::New);
4628 *rPam.
GetPoint() = pBkmk->GetMarkPos();
4629 *rPam.
GetMark() = pBkmk->IsExpanded() ? pBkmk->GetOtherMarkPos() : pBkmk->GetMarkPos();
4637 assert((pStt->
GetNode() == pEnd->GetNode() ||
4639 !pEnd->GetContentIndex() )) &&
4640 "invalid range: Point and Mark on different nodes" );
4649 pUndoRpl =
new SwUndoReplace(aDelPam, sRepl, bRegExReplace);
4662 nEnd = bOneNode ? pEnd->GetContentIndex()
4663 : pTextNd->
GetText().getLength();
4667 while ( lcl_GetTokenToParaBreak( sRepl, sIns, bRegExReplace ) )
4669 if (!bFirst || nStt == pTextNd->
GetText().getLength())
4671 InsertString( aDelPam, sIns );
4673 else if( nStt < nEnd || !sIns.isEmpty() )
4677 SplitNode( *pStt,
false);
4681 if( bFirst || !sIns.isEmpty() )
4683 if (!bFirst || nStt == pTextNd->
GetText().getLength())
4685 InsertString( aDelPam, sIns );
4687 else if( nStt < nEnd || !sIns.isEmpty() )
4703 else if (aDelPam.
GetPoint() == pStt)
4735 pFlyAttrSet, pFrameFormat );
4737 pNode->
SetAttr( *pGrfAttrSet );
4742#define NUMRULE_STATE \
4743 std::shared_ptr<SwNumRuleItem> aNumRuleItemHolderIfSet; \
4744 std::shared_ptr<SfxStringItem> aListIdItemHolderIfSet; \
4746#define PUSH_NUMRULE_STATE \
4747 lcl_PushNumruleState( aNumRuleItemHolderIfSet, aListIdItemHolderIfSet, pDestTextNd );
4749#define POP_NUMRULE_STATE \
4750 lcl_PopNumruleState( aNumRuleItemHolderIfSet, aListIdItemHolderIfSet, pDestTextNd, rPam );
4753 std::shared_ptr<SwNumRuleItem>& aNumRuleItemHolderIfSet,
4754 std::shared_ptr<SfxStringItem>& aListIdItemHolderIfSet,
4760 if (pAttrSet ==
nullptr)
4765 aNumRuleItemHolderIfSet.reset(pItem->
Clone());
4770 aListIdItemHolderIfSet.reset(pItem->
Clone());
4775 const std::shared_ptr<SwNumRuleItem>& aNumRuleItemHolderIfSet,
4776 const std::shared_ptr<SfxStringItem>& aListIdItemHolderIfSet,
4782 if ( lcl_MarksWholeNode(rPam) )
4785 if (aNumRuleItemHolderIfSet)
4787 pDestTextNd->
SetAttr(*aNumRuleItemHolderIfSet);
4794 if (aListIdItemHolderIfSet)
4796 pDestTextNd->
SetAttr(*aListIdItemHolderIfSet);
4806 SwPaM *
const pCopyRange)
const
4808 std::vector<std::pair<SwNodeOffset, sal_Int32>> Breaks;
4814 return CopyImplImpl(rPam, rPos, flags, pCopyRange);
4822 auto iter( Breaks.rbegin() );
4825 SwPaM aPam( rSelectionEnd, rSelectionEnd );
4828 SwPaM copyRange(rPos, rPos);
4830 while (iter != Breaks.rend())
4832 rStart.
Assign(*rNodes[iter->first - nOffset]->GetTextNode(), iter->second + 1);
4849 rEnd.
Assign(*rNodes[iter->first - nOffset]->GetTextNode(), iter->second);
4853 rStart = *rPam.
Start();
4873 SwPaM *
const pCpyRange)
const
4878 auto [pStt, pEnd] = rPam.
StartEnd();
4884 ( &rDoc == &
m_rDoc && *pStt <= rPos && rPos < *pEnd ))
4889 const bool bEndEqualIns = &rDoc == &
m_rDoc && rPos == *pEnd;
4895 std::shared_ptr<SwUnoCursor>
const pCopyPam(rDoc.
CreateUnoCursor(rPos));
4898 std::optional<std::vector<SwFrameFormat*>> pFlys;
4899 std::vector<SwFrameFormat*>
const* pFlysAtInsPos;
4909 pFlysAtInsPos = pFlys ? &*pFlys :
nullptr;
4917 pCopyPam->SetMark();
4920 bool bAfterTable =
false;
4924 *(pCopyPam->GetPoint()) = rPos;
4926 bCanMoveBack =
false;
4932 assert(pCopyPam->GetPoint()->GetContentIndex() == 0);
4937 const bool bOneNode = pStt->
GetNode() == pEnd->GetNode();
4942 ( (pDestTextNd && !pDestTextNd->
GetText().getLength()) ||
4944 bool bCopyBookmarks =
true;
4945 bool bCopyPageSource =
false;
4959 OUString aListIdToPropagate;
4961 rDoc.
SearchNumRule( rPos,
false,
true,
false, 0, aListIdToPropagate,
nullptr,
true );
4962 if ( !pNumRuleToPropagate )
4964 pNumRuleToPropagate =
4965 rDoc.
SearchNumRule( rPos,
false,
false,
false, 0, aListIdToPropagate,
nullptr,
true );
4973 if ( pNumRuleToPropagate &&
4974 ((pDestTextNd && !pDestTextNd->
GetText().getLength() &&
4976 !lcl_ContainsOnlyParagraphsInList(rPam)) ||
4979 pNumRuleToPropagate =
nullptr;
4991 bool bCopyOk =
false;
5002 aDestIdx.
Assign( pDestTextNd, 0 );
5003 bCopyCollFormat =
true;
5005 else if( !bOneNode || bColumnSel )
5007 const sal_Int32 nContentEnd = pEnd->GetContentIndex();
5013 if (bCanMoveBack && rPos == *pCopyPam->GetPoint())
5022 pDestTextNd, pDestTextNd->
GetText().getLength());
5027 bool bChg = pEnd != rPam.
GetPoint();
5034 else if( rPos == *pEnd )
5038 pEnd->SetContent( nContentEnd );
5046 if( bCopyCollFormat && bOneNode )
5053 const sal_Int32 nCpyLen = ( bOneNode
5054 ? pEnd->GetContentIndex()
5055 : pSttTextNd->
GetText().getLength())
5057 pSttTextNd->
CopyText( pDestTextNd, aDestIdx, *pStt, nCpyLen );
5059 pEnd->AdjustContent( -nCpyLen );
5066 if (bCopyCollFormat)
5077 CopyFlyInFlyImpl(aRg, &rPam, *pDestTextNd,
false);
5083 else if( pDestTextNd )
5098 const sal_Int32 nContentEnd = pEnd->GetContentIndex();
5104 if (bCanMoveBack && rPos == *pCopyPam->GetPoint())
5115 else if( rPos == *pEnd )
5122 else if( bCanMoveBack )
5129 bCanMoveBack =
false;
5142 aDestIdx.
Assign( pDestTextNd, 0 );
5152 const bool bEmptyDestNd = pDestTextNd->
GetText().isEmpty();
5155 if( bCopyCollFormat && ( bOneNode || bEmptyDestNd ))
5161 pEnd->GetContentIndex() );
5164 if( bCopyCollFormat && ( bOneNode || bEmptyDestNd ))
5178 if (pSttTextNd && bCopyCollFormat && pDestTextNd->
HasSwAttrSet())
5192 SwPaM temp(*pCopyPam->GetPoint());
5197 std::pair<SwPaM const&, SwPosition const&> tmp(rPam, startPos);
5198 if( aInsPos == pEnd->
GetNode() )
5201 assert(pStt->
GetNode() != pEnd->GetNode());
5202 pEnd->SetContent(0);
5203 CopyWithFlyInFly(aRg, aInsPos.
GetNode(), &tmp,
true,
false,
false, flags);
5208 CopyWithFlyInFly(aRg, aInsPos.
GetNode(), &tmp,
true,
false,
false, flags);
5210 bCopyBookmarks =
false;
5223 SwPaM temp(*pCopyPam->GetPoint());
5234 if (pAnchor->
GetAnchorId() == RndStdIds::FLY_AT_CHAR)
5237 anchor.SetAnchor( &startPos );
5238 pFly->SetFormatAttr(
anchor);
5240 else if (pAnchor->
GetAnchorId() == RndStdIds::FLY_AT_PARA)
5243 anchor.SetAnchor( &startPosAtPara );
5244 pFly->SetFormatAttr(
anchor);
5252 if( aBrkSet.
Count() &&
nullptr != ( pDestTextNd = rDoc.
GetNodes()[
5253 pCopyPam->GetPoint()->GetNodeIndex()+1 ]->GetTextNode()))
5255 pDestTextNd->
SetAttr( aBrkSet );
5256 bCopyPageSource =
true;
5289 pCopyPam->GetMark()->Assign(aInsPos);
5291 rPos = *pCopyPam->GetMark();
5294 *pCopyPam->GetMark() = rPos;
5305 if (pCopyPam->GetPoint()->GetNode().IsStartNode())
5309 pCopyPam->Exchange();
5319 assert(*pCopyPam->GetPoint() == rPos);
5322 lcl_DeleteRedlines(rPam, *pCopyPam);
5323 rPos = *pCopyPam->GetPoint();
5337 *pCpyRange->
GetPoint() = *pCopyPam->GetPoint();
5338 *pCpyRange->
GetMark() = *pCopyPam->GetMark();
5341 if ( pNumRuleToPropagate !=
nullptr )
5346 rDoc.
SetNumRule( *pCopyPam, *pNumRuleToPropagate,
false,
nullptr,
5347 aListIdToPropagate,
true,
false );
#define PUSH_NUMRULE_STATE
#define POP_NUMRULE_STATE
@ IsMoveToFly
MakeFlyAndMove.
@ CopyAll
copy break attributes even when source is single node
@ CheckPosInFly
check if target position is in fly anchored at source range
@ ArtificialSelection
keyboard delete, artificial selection, avoid deleting flys
@ ShowDelete
show all deletes
@ ShowInsert
show all inserts
@ APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
const OUString & GetValue() const
virtual bool DeleteAndJoin(SwPaM &, SwDeleteFlags flags=SwDeleteFlags::Default)=0
complete delete of a given PaM
virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart)=0
Split a node at rPos (implemented only for TextNode).
virtual SwFrameFormat * CopyLayoutFormat(const SwFrameFormat &rSrc, const SwFormatAnchor &rNewAnchor, bool bSetTextFlyAtt, bool bMakeFrames)=0
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
Provides access to the marks of a document.
virtual bool renameMark(::sw::mark::IMark *io_pMark, const OUString &rNewName)=0
Renames an existing Mark, if possible.
virtual ::sw::mark::IFieldmark * getFieldmarkAt(const SwPosition &rPos) const =0
get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos
virtual const_iterator_t getAllMarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of marks.
virtual sw::mark::IFieldmark * getInnerFieldmarkFor(const SwPosition &pos) const =0
virtual sal_Int32 getAllMarksCount() const =0
returns the number of marks.
virtual ::sw::mark::IMark * makeMark(const SwPaM &rPaM, const OUString &rProposedName, MarkType eMark, ::sw::mark::InsertMode eMode, SwPosition const *pSepPos=nullptr)=0
Generates a new mark in the document for a certain selection.
virtual std::unique_ptr< ILazyDeleter > deleteMark(const IDocumentMarkAccess::const_iterator_t &ppMark, bool isMoveNodes)=0
Deletes a mark.
virtual const_iterator_t getAllMarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence of marks.
@ CROSSREF_NUMITEM_BOOKMARK
@ CROSSREF_HEADING_BOOKMARK
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
virtual bool IsIgnoreRedline() const =0
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
static bool IsRedlineOn(const RedlineFlags eM)
virtual bool IsRedlineMove() const =0
virtual bool SplitRedline(const SwPaM &rPam)=0
virtual SwRedlineTable::size_type GetRedlinePos(const SwNode &rNode, RedlineType nType) const =0
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
virtual void AcceptRedlineParagraphFormatting(const SwPaM &rPam)=0
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual void CompressRedlines(size_t nStartIndex=0)=0
virtual void SetModified()=0
Must be called manually at changes of format.
virtual SwFrameFormat * GetFrameFormatFromPool(sal_uInt16 nId)=0
Return required automatic format.
virtual SwNumRule * GetNumRuleFromPool(sal_uInt16 nId)=0
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
static sal_uInt16 IsMath(const SvGlobalName &rName)
bool CheckDelChar(const SwPosition &rPos)
void CheckChar(const SwPosition &rPos, sal_Unicode cChar)
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
const css::lang::Locale & GetLocale(const LanguageType aLang)
Marks a character position inside a document model content node (SwContentNode)
const sw::mark::IMark * GetMark() const
sal_Int32 GetIndex() const
SwContentIndex & Assign(const SwContentNode *, sal_Int32)
bool HasSwAttrSet() const
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
bool CanJoinNext(SwNodeIndex *pIdx=nullptr) const
Is it possible to join two nodes? In pIdx the second position can be returned.
void DelFrames(SwRootFrame const *pLayout)
Method deletes all views of document for the node.
virtual bool SetAttr(const SfxPoolItem &)
made virtual
virtual sal_Int32 Len() const
const SwAttrSet * GetpSwAttrSet() const
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
sal_Int32 GetContent() const
void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark=false, bool bExactRange=false, SwRootFrame const *pLayout=nullptr)
void CorrRel(const SwNode &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
IDocumentState const & getIDocumentState() const
SwAutoCorrExceptWord * GetAutoCorrExceptWord()
void CorrAbs(const SwNode &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet &rSet)
SwNumRule * FindNumRulePtr(const OUString &rName) const
const SwGrfFormatColl * GetDfltGrfFormatColl() const
SwNumRule * GetOutlineNumRule() const
SwCharFormat * FindCharFormatByName(const OUString &rName) const
bool IsColumnSelection() const
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentUndoRedo & GetIDocumentUndoRedo()
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
SwFlyFrameFormat * MakeFlySection_(const SwPosition &rAnchPos, const SwContentNode &rNode, RndStdIds eRequestId, const SfxItemSet *pFlyAttrSet, SwFrameFormat *)
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
SwFootnoteIdxs & GetFootnoteIdxs()
OUString SetNumRule(const SwPaM &, const SwNumRule &, bool bCreateNewList, SwRootFrame const *pLayout=nullptr, const OUString &sContinuedListId=OUString(), bool bSetItem=true, const bool bResetIndentAttrs=false)
Accept changes of outline styles for OutlineRule.
IDocumentMarkAccess * getIDocumentMarkAccess()
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
const SwNumRule * SearchNumRule(const SwPosition &rPos, const bool bForward, const bool bNum, const bool bOutline, int nNonEmptyAllowed, OUString &sListId, SwRootFrame const *pLayout, const bool bInvestigateStartNode=false)
Searches for a text node with a numbering rule.
void DeleteAutoCorrExceptWord()
std::shared_ptr< SwUnoCursor > CreateUnoCursor(const SwPosition &rPos, bool bTableCursor=false)
bool UpdateParRsid(SwTextNode *pTextNode, sal_uInt32 nVal=0)
const SwAttrPool & GetAttrPool() const
const SwFrameFormat * GetDfltFrameFormat() const
SwDrawFrameFormat * MakeDrawFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
bool IsInsOnlyTextGlossary() const
::sw::UndoManager & GetUndoManager()
bool IsInHeaderFooter(const SwNode &) const
void SetOutlineNumRule(const SwNumRule &rRule)
Content, content of frame (header, footer, fly).
const SwNodeIndex * GetContentIdx() const
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
bool ReRead(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic=nullptr, bool bModify=true)
Re-read in case graphic was not OK.
void Add(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, SwNodeOffset nNodeIdx)
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Marks a node in the document model.
SwNodeOffset GetIndex() const
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset nIdx)
Base class of the Writer document model elements.
SwStartNode * GetStartNode()
bool IsIgnoreDontExpand() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
void SetIgnoreDontExpand(bool bNew)
SwNodeOffset GetIndex() const
bool IsNoTextNode() const
SwNodes & GetNodes()
Node is in which nodes-array/doc?
bool IsContentNode() const
SwNodeOffset StartOfSectionIndex() const
const SwStartNode * FindFlyStartNode() const
bool IsSectionNode() const
SwTableNode * FindTableNode()
Search table node, in which it is.
SwSectionNode * FindSectionNode()
Search section node, in which it is.
const SwStartNode * StartOfSectionNode() const
Merge GetRedlineMergeFlag() const
SwNodeOffset EndOfSectionIndex() const
SwContentNode * GetContentNode()
SwNodeType GetNodeType() const
const IDocumentSettingAccess * getIDocumentSettingAccess() const
Provides access to the document setting interface.
const SwEndNode * EndOfSectionNode() const
void ForEach(FnForEach_SwNodes fnForEach, void *pArgs=nullptr)
void MoveRange(SwPaM &, SwPosition &, SwNodes &rNodes)
move a range
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
SwTextNode * MakeTextNode(SwNode &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
SwNode & GetEndOfAutotext() const
Section for all Flys/Header/Footers.
void SectionUp(SwNodeRange *)
increase level of the given range
void DelDummyNodes(const SwNodeRange &rRg)
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
SwOLENode * MakeOLENode(SwNode &rWhere, const svt::EmbeddedObjectRef &, SwGrfFormatColl *pColl)
in ndole.cxx
bool MoveNodes(const SwNodeRange &, SwNodes &rNodes, SwNode &rPos, bool bNewFrames=true)
move the node pointer
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
static SwContentNode * GoPrevious(SwNodeIndex *)
void CopyNodes(const SwNodeRange &, SwNode &rPos, bool bNewFrames, bool bTableInsDummyNode=false) const
SwContentNode * GoNext(SwNodeIndex *) const
void DelNodes(const SwNodeIndex &rStart, SwNodeOffset nCnt=SwNodeOffset(1))
Delete a number of nodes.
static SwGrfNode * MakeGrfNode(SwNode &rWhere, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, SwGrfFormatColl *pColl, SwAttrSet const *pAutoAttr=nullptr)
in ndgrf.cxx
SwNodeOffset Count() const
const SwNumFormat & Get(sal_uInt16 i) const
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
SwNode & GetPointNode() const
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
bool IsInFrontOfLabel() const
void Normalize(bool bPointFirst=true)
Normalizes PaM, i.e.
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
const SwPosition * End() const
sal_uInt16 GetPageNum(bool bAtPoint=true, const Point *pLayPos=nullptr)
Get number of page which contains cursor.
SwPosition & GetBound(bool bOne=true)
const SwPosition * GetPoint() const
const SwPosition * Start() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
void SetExtraData(const SwRedlineExtraData *pData)
ExtraData gets copied, the pointer is therefore not taken over by the RedLineObject.
const SwRedlineExtraData * GetExtraData() const
RedlineType GetType(sal_uInt16 nPos=0) const
bool Contains(const SwRangeRedline *p) const
static constexpr size_type npos
void Remove(size_type nPos)
vector_type::size_type size_type
The root element of a Writer document layout.
bool HasMergedParas() const
A section node represents the start of a section on the UI, i.e.
Starts a section of nodes in the document model.
SwStartNodeType GetStartNodeType() const
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
const SwTable & GetTable() const
SwTableFormat * GetFrameFormat()
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
virtual const sal_Int32 * GetEnd() const
end position
const sal_Int32 * End() const
sal_Int32 GetStart() const
bool HasDummyChar() const
static void saveLinks(const sw::FrameFormats< sw::SpzFrameFormat * > &rFormats, std::map< const SwFrameFormat *, const SwFrameFormat * > &rLinks)
Saves the current shape -> textbox links in a map, so they can be restored later.
static void restoreLinks(std::set< ZSortFly > &rOld, std::vector< SwFrameFormat * > &rNew, SavedLink &rSavedLinks)
Undo the effect of saveLinks() + individual resetLink() calls.
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
Is the frame format a text box?
std::map< const SwFrameFormat *, const SwFrameFormat * > SavedLink
Maps a draw format to a fly format.
Represents the visualization of a paragraph.
SwTextNode is a paragraph in the document model.
SwTextAttr * GetTextAttrForEndCharAt(sal_Int32 nIndex, sal_uInt16 nWhich) const
Get the text attribute of an end dummy character at nIndex.
virtual SwContentNode * MakeCopy(SwDoc &, SwNode &rWhere, bool bNewFrames) const override
virtual sal_Int32 Len() const override
sal_Int32 GetSpaceLeft() const
void RstTextAttr(const sal_Int32 nContentStart, const sal_Int32 nLen, const sal_uInt16 nWhich=0, const SfxItemSet *pSet=nullptr, const bool bInclRefToxMark=false, const bool bExactRange=false)
delete all attributes.
SwpHints & GetOrCreateSwpHints()
virtual SwContentNode * JoinNext() override
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.
SwContentNode * AppendNode(const SwPosition &)
void DestroyAttr(SwTextAttr *pAttr)
SwTextAttr * InsertItem(SfxPoolItem &rAttr, const sal_Int32 nStart, const sal_Int32 nEnd, const SetAttrMode nMode=SetAttrMode::DEFAULT)
create new text attribute from rAttr and insert it
void CopyText(SwTextNode *const pDest, const SwContentIndex &rStart, const sal_Int32 nLen, const bool bForceCopyOfAllAttrs)
Actions on text and attributes.
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
void EraseText(const SwContentIndex &rIdx, const sal_Int32 nCount=SAL_MAX_INT32, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
delete text content ATTENTION: must not be called with a range that overlaps the start of an attribut...
OUString InsertText(const OUString &rStr, const SwContentIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
void ReplaceText(const SwContentIndex &rStart, const sal_Int32 nDelLen, const OUString &rText)
replace nDelLen characters at rStart with rText in case the replacement does not fit,...
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
int GetActualListLevel(SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Returns the actual list level of this text node, when it is a list item.
SwTextNode * SplitContentNode(const SwPosition &, std::function< void(SwTextNode *, sw::mark::RestoreMode, bool AtStart)> const *pContentIndexRestore)
SwTextAttr * GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, ::sw::GetTextAttrMode const eMode=::sw::GetTextAttrMode::Default) const
get the innermost text attribute covering position nIndex.
SwpHints * GetpSwpHints()
void CopyCollFormat(SwTextNode &rDestNd, bool bUndoForChgFormatColl=true)
Copy collection with all auto formats to dest-node.
const OUString & GetText() const
void TriggerNodeUpdate(const sw::LegacyModifyHint &)
for hanging TextFormatCollections somewhere else (Outline-Numbering!)
void TransliterateText(utl::TransliterationWrapper &rTrans, sal_Int32 nStart, sal_Int32 nEnd, SwUndoTransliterate *pUndo, bool bUseRedlining=false)
change text to Upper/Lower/Hiragana/Katakana/...
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
void SaveRedlineData(const SwPaM &rPam, bool bInsContent)
bool CanGrouping(SwDoc &, const SwPaM &)
Typing one or more characters to a single paragraph.
bool CanGrouping(sal_Unicode cIns)
void SetInsertRange(const SwPaM &, bool bScanFlys=true, SwNodeOffset nDeleteTextNodes=SwNodeOffset(1))
std::vector< SwFrameFormat * > * GetFlysAnchoredAt()
bool CanGrouping(SwDoc &, SwPosition &, sal_Unicode cIns)
bool CanGrouping(const SwUndoRedlineDelete &rPrev)
void SetEnd(const SwPaM &rPam)
An SwTextAttr container, stores all directly formatted text portions for a text node.
void DeRegister()
deregister the currently registered History
SwTextAttr * Get(size_t nPos) const
void Register(SwRegHistory *pHist)
register a History, which receives all attribute changes (for Undo)
SwTextAttr * Cut(const size_t nPosInStart)
Helper to copy paragraph-bound Flys.
const_iterator begin() const
const_iterator find(const Value &x) const
size_type erase(const Value &x)
const_iterator end() const
std::pair< const_iterator, bool > insert(Value &&x)
bool CopyRange(SwPaM &, SwPosition &, SwCopyFlags) const override
Copy a selected content range to a position.
bool MoveNodeRange(SwNodeRange &, SwNode &, SwMoveFlags) override
bool DeleteAndJoinWithRedlineImpl(SwPaM &, SwDeleteFlags)
void SetIME(bool bIME) override
States that the last inserted string came from IME.
bool Overwrite(const SwPaM &rRg, const OUString &rStr) override
Overwrite string in an existing text node.
SwFlyFrameFormat * InsertOLE(const SwPaM &rRg, const OUString &rObjName, sal_Int64 nAspect, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet) override
void ReRead(SwPaM &, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic) override
Transpose graphic (with undo)
SwFlyFrameFormat * InsertGraphic(const SwPaM &rRg, const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet, SwFrameFormat *) override
Insert graphic or formula.
static bool lcl_RstTextAttr(SwNode *pNd, void *pArgs)
@params pArgs contains the document's ChrFormatTable Is need for selections at the beginning/end and ...
void MoveAndJoin(SwPaM &, SwPosition &) override
Move a range.
bool MoveRange(SwPaM &, SwPosition &, SwMoveFlags) override
bool GetIME() const override
Did the last inserted string come from IME?
bool CopyImpl(SwPaM &, SwPosition &, SwCopyFlags flags, SwPaM *const pCpyRng) const
SwFlyFrameFormat * InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef &xObj, SfxItemSet *pFlyAttrSet) override
Insert OLE-objects.
SwDrawFrameFormat * InsertDrawObj(const SwPaM &rRg, SdrObject &rDrawObj, const SfxItemSet &rFlyAttrSet) override
Insert a DrawObject.
bool DelFullPara(SwPaM &) override
Delete full paragraphs.
bool SplitNode(const SwPosition &rPos, bool bChkTableStart) override
Split a node at rPos (implemented only for TextNode).
void DeleteSection(SwNode *pNode) override
Delete a full Section of the NodeArray.
void TransliterateText(const SwPaM &rPaM, utl::TransliterationWrapper &) override
change text to Upper/Lower/Hiragana/Katakana/...
bool DeleteAndJoin(SwPaM &, SwDeleteFlags flags=SwDeleteFlags::Default) override
complete delete of a given PaM
DocumentContentOperationsManager(SwDoc &i_rSwdoc)
bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND) override
Insert string into existing text node at position rRg.Point().
void DeleteRange(SwPaM &) override
Delete a range SwFlyFrameFormat.
SwFlyFrameFormat * InsNoTextNode(const SwPosition &rPos, SwNoTextNode *, const SfxItemSet *pFlyAttrSet, const SfxItemSet *pGrfAttrSet, SwFrameFormat *)
bool DeleteAndJoinImpl(SwPaM &, SwDeleteFlags)
bool DeleteRangeImpl(SwPaM &, SwDeleteFlags)
void DeleteDummyChar(SwPosition const &rPos, sal_Unicode cDummy)
ring_container GetRingContainer()
static std::shared_ptr< ContentIdxStore > Create()
virtual void Hide(bool hide)=0
virtual void SetHideCondition(const OUString &)=0
virtual void SetShortName(const OUString &)=0
virtual void SetKeyCode(const vcl::KeyCode &)=0
TransliterationFlags getType() const
void DelBookmarks(SwNode &rStt, const SwNode &rEnd, std::vector< SaveBookmark > *pSaveBkmk, std::optional< sal_Int32 > oStartContentIdx, std::optional< sal_Int32 > oEndContentIdx)
void PaMCorrAbs(const SwPaM &rRange, const SwPosition &rNewPos)
Function declarations so that everything below the CursorShell can move the Cursor once in a while.
bool sw_JoinText(SwPaM &rPam, bool bJoinPrev)
void sw_GetJoinFlags(SwPaM &rPam, bool &rJoinText, bool &rJoinPrev)
void SaveFlyInRange(const SwNodeRange &rRg, SaveFlyArr &rArr)
void DelFlyInRange(SwNode &rMkNd, SwNode &rPtNd, std::optional< sal_Int32 > oMkContentIdx, std::optional< sal_Int32 > oPtContentIdx)
Delete and move all Flys at the paragraph, that are within the selection.
void RestFlyInRange(SaveFlyArr &rArr, const SwPosition &rStartPos, const SwNode *pInsertPos, bool const isForceToStartPos)
#define CH_TXT_ATR_FIELDSEP
#define CH_TXT_ATR_INPUTFIELDSTART
#define CH_TXT_ATR_FORMELEMENT
constexpr TypedWhichId< SfxStringItem > RES_PARATR_LIST_ID(RES_PARATR_LIST_BEGIN)
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(59)
bool isUNKNOWNATR(const sal_uInt16 nWhich)
bool isCHRATR(const sal_uInt16 nWhich)
constexpr sal_uInt16 RES_CHRATR_END(46)
constexpr sal_uInt16 RES_TXTATR_NOEND_END(63)
bool isPARATR_LIST(const sal_uInt16 nWhich)
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
constexpr sal_uInt16 RES_UNKNOWNATR_END(160)
bool isDrawingLayerAttribute(const sal_uInt16 nWhich)
constexpr sal_uInt16 RES_TXTATR_WITHEND_END(57)
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
constexpr TypedWhichId< SwFormatContentControl > RES_TXTATR_CONTENTCONTROL(56)
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END)
constexpr sal_uInt16 RES_TXTATR_NOEND_BEGIN(RES_TXTATR_WITHEND_END)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
constexpr TypedWhichId< SwFormatAutoFormat > RES_PARATR_LIST_AUTOFMT(87)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
bool isFRMATR(const sal_uInt16 nWhich)
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_METAFIELD(49)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_TXTATR_UNKNOWN_CONTAINER(54)
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_META(48)
#define CH_TXT_ATR_INPUTFIELDEND
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
bool isPARATR(const sal_uInt16 nWhich)
constexpr TypedWhichId< SwFormatRuby > RES_TXTATR_CJK_RUBY(53)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
constexpr sal_uInt16 RES_GRFATR_END(156)
#define CH_TXT_ATR_FIELDEND
#define CH_TXT_ATR_FIELDSTART
#define CH_TXTATR_BREAKWORD
bool isGRFATR(const sal_uInt16 nWhich)
CharClass & GetAppCharClass()
WhichRangesContainer const aBreakSetRange(svl::Items< RES_PAGEDESC, RES_BREAK >)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
std::deque< SaveFly > SaveFlyArr
double getLength(const B2DPolygon &rCandidate)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
bool IsFieldmarkOverlap(SwPaM const &rPaM)
check if rPaM is valid range of new fieldmark
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Dialog to specify the properties of date form field.
std::optional< std::vector< SwFrameFormat * > > GetFlysAnchoredAt(SwDoc &rDoc, SwNodeOffset const nSttNode)
static bool IsEmptyRange(const SwPosition &rStart, const SwPosition &rEnd, SwCopyFlags const flags)
Checks if rStart..rEnd mark a range that makes sense to copy.
std::vector< std::unique_ptr< SwRangeRedline > > GetAllValidRanges(std::unique_ptr< SwRangeRedline > p)
std::pair< SwTextNode *, SwTextNode * > GetFirstAndLastNode(SwRootFrame const &rLayout, SwNode const &rPos)
void CopyBookmarks(const SwPaM &rPam, const SwPosition &rCpyPam, SwCopyFlags flags)
static void lcl_PushNumruleState(std::shared_ptr< SwNumRuleItem > &aNumRuleItemHolderIfSet, std::shared_ptr< SfxStringItem > &aListIdItemHolderIfSet, const SwTextNode *pDestTextNd)
void UpdateFramesForAddDeleteRedline(SwDoc &rDoc, SwPaM const &rPam)
void RecreateStartTextFrames(SwTextNode &rNode)
static auto GetCorrPosition(SwPaM const &rPam) -> SwPosition
static void lcl_PopNumruleState(const std::shared_ptr< SwNumRuleItem > &aNumRuleItemHolderIfSet, const std::shared_ptr< SfxStringItem > &aListIdItemHolderIfSet, SwTextNode *pDestTextNd, const SwPaM &rPam)
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNode const &rNode)
void CalcBreaks(std::vector< std::pair< SwNodeOffset, sal_Int32 > > &rBreaks, SwPaM const &rPam, bool const isOnlyFieldmarks)
@ Table
SwTableNode is derived from SwStartNode.
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
bool GoInContent(SwPaM &rPam, SwMoveFnCollection const &fnMove)
SwComparePosition ComparePosition(const T &rStt1, const T &rEnd1, const T &rStt2, const T &rEnd2)
@ OverlapBehind
Pos1 overlaps Pos2 at the end.
@ CollideEnd
Pos1 end touches at Pos2 start.
@ Behind
Pos1 behind Pos2.
@ OverlapBefore
Pos1 overlaps Pos2 at the beginning.
@ Outside
Pos2 completely contained in Pos1.
@ Before
Pos1 before Pos2.
@ Inside
Pos1 completely contained in Pos2.
@ CollideStart
Pos1 start touches at Pos2 end.
@ Equal
Pos1 is as large as Pos2.
SwMoveFnCollection const & fnMoveBackward
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
@ RES_POOLCOLL_TEXT
Text body.
@ RES_POOLCOLL_STANDARD
Standard.
@ RES_POOLFRM_FORMEL
Formula.
@ RES_POOLFRM_GRAPHIC
Graphics.
bool IsInvalidItem(const SfxPoolItem *pItem)
Marks a position in the document model.
void Adjust(SwNodeOffset nDelta)
Adjust node position, and resets content position to zero.
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
void AssignEndIndex(const SwContentNode &rNd)
Set nNode to rNd, and nContent to the end of rNd.
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
const SwContentNode * GetContentNode() const
SwNodeOffset GetNodeIndex() const
const SwNodes & GetNodes() const
void AssignStartIndex(const SwContentNode &rNd)
Set nNode to rNd, and nContent to the beginning of rNd.
sal_Int32 GetContentIndex() const
void AdjustContent(sal_Int32 nDelta)
Adjust content index, only valid to call this if the position points to a SwContentNode subclass.
SwDoc & GetDoc() const
Returns the document this position is in.
Parameters for _Rst and lcl_SetTextFormatColl.
SwRootFrame const *const pLayout
const SwPosition * pEndNd
const SwPosition * pSttNd
bool bExactRange
From the attributes included in the range, delete only the ones which have exactly same range....
const SfxItemSet * pDelSet
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
constexpr sal_uInt8 MAXLEVEL
bool IsSelectFrameAnchoredAtPara(SwPosition const &rAnchorPos, SwPosition const &rStart, SwPosition const &rEnd, DelContentType const nDelContentType)
is a fly anchored at paragraph at rAnchorPos selected?
bool IsFlySelectedByCursor(SwDoc const &rDoc, SwPosition const &rStart, SwPosition const &rEnd)
check at-char and at-para flys in rDoc
bool IsDestroyFrameAnchoredAtChar(SwPosition const &rAnchorPos, SwPosition const &rStart, SwPosition const &rEnd, DelContentType const nDelContentType)
will DelContentIndex destroy a frame anchored at character at rAnchorPos?
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)