24#include <bookmark.hxx>
40#include <rtl/ustring.hxx>
48#include <libxml/xmlstring.h>
49#include <libxml/xmlwriter.h>
57std::vector<::sw::mark::MarkBase*>::const_iterator
const&
69 : m_pIter(rOther.m_pIter)
80 : m_pIter(std::move(rOther.m_pIter))
86 m_pIter = std::move(rOther.m_pIter);
111 return *m_pIter == *rOther.
m_pIter;
116 return *m_pIter != *rOther.
m_pIter;
120 : m_pIter(
std::in_place)
161 return *m_pIter - *rOther.
m_pIter;
171 return *m_pIter < *rOther.
m_pIter;
175 return *m_pIter > *rOther.
m_pIter;
179 return *m_pIter <= *rOther.
m_pIter;
183 return *m_pIter >= *rOther.
m_pIter;
189 bool lcl_GreaterThan(
const SwPosition& rPos,
const SwNode& rNdIdx, std::optional<sal_Int32> oContentIdx )
191 return oContentIdx.has_value()
198 bool lcl_Lower(
const SwPosition& rPos,
const SwNode& rNdIdx, std::optional<sal_Int32> oContentIdx )
203 if (rPos.
GetNode() != rNdIdx || !oContentIdx)
213 bool lcl_MarkOrderingByStart(const ::sw::mark::MarkBase *
const pFirst,
214 const ::sw::mark::MarkBase *
const pSecond)
216 SwPosition const& rFirstStart(pFirst->GetMarkStart());
217 SwPosition const& rSecondStart(pSecond->GetMarkStart());
218 if (rFirstStart.GetNode() != rSecondStart.GetNode())
220 return rFirstStart.GetNode() < rSecondStart.GetNode();
222 const sal_Int32 nFirstContent = rFirstStart.GetContentIndex();
223 const sal_Int32 nSecondContent = rSecondStart.GetContentIndex();
224 if (nFirstContent != 0 || nSecondContent != 0)
226 return nFirstContent < nSecondContent;
228 SwContentNode const*
const pFirstNode(rFirstStart.nContent.GetContentNode());
229 SwContentNode const*
const pSecondNode(rSecondStart.nContent.GetContentNode());
230 if ((pFirstNode !=
nullptr) != (pSecondNode !=
nullptr))
232 return pSecondNode !=
nullptr;
236 if ((pCRFirst ==
nullptr) == (pCRSecond ==
nullptr))
240 return pCRFirst !=
nullptr;
243 bool lcl_MarkOrderingByEnd(const ::sw::mark::MarkBase *
const pFirst,
244 const ::sw::mark::MarkBase *
const pSecond)
246 return pFirst->GetMarkEnd() < pSecond->GetMarkEnd();
249 void lcl_InsertMarkSorted(MarkManager::container_t& io_vMarks,
257 &lcl_MarkOrderingByStart),
261 void lcl_PositionFromContentNode(
262 std::optional<SwPosition>& rFoundPos,
266 rFoundPos.emplace(*pContentNode, bAtEnd ? pContentNode->
Len() : 0);
273 void lcl_FindExpelPosition(
274 std::optional<SwPosition>& rFoundPos,
280 bool bPosAtEndOfNode =
false;
281 if ( pNode ==
nullptr)
285 bPosAtEndOfNode =
false;
287 if ( pNode ==
nullptr )
291 bPosAtEndOfNode =
true;
293 if ( pNode !=
nullptr )
295 lcl_PositionFromContentNode( rFoundPos, pNode, bPosAtEndOfNode );
299 rFoundPos = rOtherPosition;
302 struct CompareIMarkStartsBefore
318 struct CompareIMarkStartsAfter
328 IMark* lcl_getMarkAfter(
const MarkManager::container_t& rMarks,
const SwPosition& rPos,
331 auto const pMarkAfter = upper_bound(
335 CompareIMarkStartsAfter());
336 if(pMarkAfter == rMarks.end())
338 if (bLoop && rMarks.begin() != rMarks.end())
339 return *rMarks.begin();
346 IMark* lcl_getMarkBefore(
const MarkManager::container_t& rMarks,
const SwPosition& rPos,
350 MarkManager::container_t vCandidates;
352 auto const pCandidatesEnd = upper_bound(
356 CompareIMarkStartsAfter());
357 vCandidates.reserve(pCandidatesEnd - rMarks.begin());
362 back_inserter(vCandidates),
363 [&rPos] (const ::sw::mark::MarkBase *
const pMark) {
return !(pMark->GetMarkEnd() < rPos); } );
365 if(vCandidates.empty())
367 if (bLoop && rMarks.begin() != rMarks.end())
368 return *(rMarks.end() - 1);
373 return *max_element(vCandidates.begin(), vCandidates.end(), &lcl_MarkOrderingByEnd);
376 bool lcl_FixCorrectedMark(
377 const bool bChangedPos,
378 const bool bChangedOPos,
388 if ( ( bChangedPos || bChangedOPos )
389 && io_pMark->IsExpanded()
390 && io_pMark->GetOtherMarkPos().GetNode().FindTableBoxStartNode() !=
391 io_pMark->GetMarkPos().GetNode().FindTableBoxStartNode() )
395 io_pMark->SetMarkPos( io_pMark->GetOtherMarkPos() );
397 io_pMark->ClearOtherMarkPos();
398 DdeBookmark *
const pDdeBkmk =
dynamic_cast< DdeBookmark*
>(io_pMark);
399 if ( pDdeBkmk !=
nullptr
400 && pDdeBkmk->IsServer() )
402 pDdeBkmk->SetRefObject(
nullptr);
409 bool lcl_MarkEqualByStart(const ::sw::mark::MarkBase *
const pFirst,
410 const ::sw::mark::MarkBase *
const pSecond)
412 return !lcl_MarkOrderingByStart(pFirst, pSecond) &&
413 !lcl_MarkOrderingByStart(pSecond, pFirst);
416 MarkManager::container_t::const_iterator lcl_FindMark(
417 MarkManager::container_t& rMarks,
418 const ::sw::mark::MarkBase *
const pMarkToFind)
420 auto ppCurrentMark = lower_bound(
421 rMarks.begin(), rMarks.end(),
422 pMarkToFind, &lcl_MarkOrderingByStart);
426 while (ppCurrentMark != rMarks.end() && lcl_MarkEqualByStart(*ppCurrentMark, pMarkToFind))
428 if(*ppCurrentMark == pMarkToFind)
430 return MarkManager::container_t::const_iterator(std::move(ppCurrentMark));
439 MarkManager::container_t::const_iterator lcl_FindMarkAtPos(
440 MarkManager::container_t& rMarks,
444 for (
auto ppCurrentMark = lower_bound(
445 rMarks.begin(), rMarks.end(),
447 CompareIMarkStartsBefore());
448 ppCurrentMark != rMarks.end();
453 if((*ppCurrentMark)->GetMarkStart() > rPos)
457 return MarkManager::container_t::const_iterator(std::move(ppCurrentMark));
465 MarkManager::container_t::const_iterator lcl_FindMarkByName(
466 const OUString& rName,
467 const MarkManager::container_t::const_iterator& ppMarksBegin,
468 const MarkManager::container_t::const_iterator& ppMarksEnd)
476 void lcl_DebugMarks(MarkManager::container_t
const& rMarks)
478#if OSL_DEBUG_LEVEL > 0
479 SAL_INFO(
"sw.core", rMarks.size() <<
" Marks");
480 for (
auto ppMark = rMarks.begin();
481 ppMark != rMarks.end();
484 IMark* pMark = *ppMark;
485 const SwPosition*
const pStPos = &pMark->GetMarkStart();
486 const SwPosition*
const pEndPos = &pMark->GetMarkEnd();
492 typeid(*pMark).name() <<
" " <<
498 assert(std::is_sorted(rMarks.begin(), rMarks.end(), lcl_MarkOrderingByStart));
504 const std::type_info*
const pMarkTypeInfo = &
typeid(rBkmk);
506 if(*pMarkTypeInfo ==
typeid(UnoMark))
508 else if(*pMarkTypeInfo ==
typeid(DdeBookmark))
510 else if(*pMarkTypeInfo ==
typeid(
Bookmark))
512 else if(*pMarkTypeInfo ==
typeid(CrossRefHeadingBookmark))
514 else if(*pMarkTypeInfo ==
typeid(CrossRefNumItemBookmark))
516 else if(*pMarkTypeInfo ==
typeid(AnnotationMark))
518 else if(*pMarkTypeInfo ==
typeid(TextFieldmark))
520 else if(*pMarkTypeInfo ==
typeid(CheckboxFieldmark))
522 else if(*pMarkTypeInfo ==
typeid(DropDownFieldmark))
524 else if(*pMarkTypeInfo ==
typeid(DateFieldmark))
526 else if(*pMarkTypeInfo ==
typeid(NavigatorReminder))
530 assert(
false &&
"IDocumentMarkAccess::GetType(..)"
531 " - unknown MarkType. This needs to be fixed!");
538 return "__RefHeading__";
563 MarkManager::MarkManager(
SwDoc& rDoc)
565 , m_pLastActiveFieldmark(nullptr)
569 const OUString& rName,
574#if OSL_DEBUG_LEVEL > 0
596 SAL_WARN(
"sw.core",
"MarkManager::makeMark(..)"
597 " - refusing to create mark on non-textnode");
604 SAL_WARN(
"sw.core",
"MarkManager::makeMark(..)"
605 " - refusing to create duplicate CrossRefBookmark");
616 SAL_WARN(
"sw.core",
"MarkManager::makeMark(..)"
617 " - invalid range on point fieldmark");
625 SAL_WARN(
"sw.core",
"MarkManager::makeMark(..)"
626 " - invalid range on fieldmark, different nodes array sections");
635 SAL_WARN(
"sw.core",
"MarkManager::makeMark(..)"
636 " - invalid range on fieldmark, overlaps existing fieldmark or meta-field");
641 std::unique_ptr<::sw::mark::MarkBase> pMark;
645 pMark = std::make_unique<TextFieldmark>(rPaM, rName);
648 pMark = std::make_unique<CheckboxFieldmark>(rPaM, rName);
651 pMark = std::make_unique<DropDownFieldmark>(rPaM, rName);
654 pMark = std::make_unique<DateFieldmark>(rPaM);
657 pMark = std::make_unique<NavigatorReminder>(rPaM);
660 pMark = std::make_unique<Bookmark>(rPaM,
vcl::KeyCode(), rName);
663 pMark = std::make_unique<DdeBookmark>(rPaM);
666 pMark = std::make_unique<CrossRefHeadingBookmark>(rPaM,
vcl::KeyCode(), rName);
669 pMark = std::make_unique<CrossRefNumItemBookmark>(rPaM,
vcl::KeyCode(), rName);
672 pMark = std::make_unique<UnoMark>(rPaM);
675 pMark = std::make_unique<AnnotationMark>( rPaM, rName );
678 assert(pMark &&
"MarkManager::makeMark(..) - Mark was not created.");
680 if(pMark->GetMarkPos() != pMark->GetMarkStart())
725 SwPaM const tmp(pMark->GetMarkPos(), pMark->GetOtherMarkPos());
729 SAL_INFO(
"sw.core",
"--- makeType ---");
737 return pMark.release();
742 const OUString& rName,
743 const OUString& rType,
766 sw::mark::IFieldmark* pFieldMark =
dynamic_cast<sw::mark::IFieldmark*
>( pMark );
768 pFieldMark->SetFieldname( rType );
782 const OUString& rName,
783 const OUString& rType)
812 sw::mark::IFieldmark* pFieldMark =
dynamic_cast<sw::mark::IFieldmark*
>( pMark );
814 pFieldMark->SetFieldname( rType );
836 return *ppExistingMark;
837 const SwPaM aPaM(aPos);
843 const OUString& rName )
854 "<MarkManager::repositionMark(..)>"
855 " - Mark is not in my doc.");
878 const OUString& rNewName )
881 "<MarkManager::renameMark(..)>"
882 " - Mark is not in my doc.");
883 if ( io_pMark->
GetName() == rNewName )
889 const OUString sOldName(pMarkBase->GetName());
890 pMarkBase->SetName(rNewName);
897 std::make_unique<SwUndoRenameBookmark>(sOldName, rNewName,
m_rDoc));
908 const sal_Int32 nOffset)
910 const SwNode*
const pOldNode = &rOldNode;
913 bool isSortingNeeded =
false;
923 bool bChangedPos =
false;
928 isSortingNeeded =
true;
930 bool bChangedOPos =
false;
937 isSortingNeeded =
true;
940 isSortingNeeded |= lcl_FixCorrectedMark(bChangedPos, bChangedOPos, pMark);
947 SAL_INFO(
"sw.core",
"correctMarksAbsolute");
953 const SwNode*
const pOldNode = &rOldNode;
956 bool isSortingNeeded =
false;
963 bool bChangedPos =
false, bChangedOPos =
false;
974 isSortingNeeded =
true;
989 isSortingNeeded |= lcl_FixCorrectedMark(bChangedPos, bChangedOPos, pMark);
996 SAL_INFO(
"sw.core",
"correctMarksRelative");
1002 bool const isReplace,
1005 std::optional<sal_Int32> oStartContentIdx,
1006 std::optional<sal_Int32> oEndContentIdx,
1007 bool & rbIsPosInRange,
1008 bool & rbIsOtherPosInRange)
1019 rbIsPosInRange = lcl_GreaterThan(pMark->
GetMarkPos(), rStt, oStartContentIdx)
1020 && lcl_Lower(pMark->
GetMarkPos(), rEnd, oEndContentIdx);
1025 if ( oEndContentIdx.has_value()
1028 && ( ( rbIsOtherPosInRange
1036 rbIsPosInRange =
true;
1037 rbIsOtherPosInRange =
true;
1041 && (rbIsOtherPosInRange
1046 bool bDeleteMark =
true;
1053 bDeleteMark = &rStt != &rEnd;
1057 bDeleteMark = rbIsOtherPosInRange
1059 || !oStartContentIdx.has_value()
1081 bool bIsPosInRange(
false);
1082 bool bIsOtherPosInRange(
false);
1083 bool const bDeleteMark =
isDeleteMark(*ppMark, isReplace,
1085 bIsPosInRange, bIsOtherPosInRange);
1098 std::vector<SaveBookmark>* pSaveBkmk,
1099 std::optional<sal_Int32> oStartContentIdx,
1100 std::optional<sal_Int32> oEndContentIdx )
1102 std::vector<const_iterator_t> vMarksToDelete;
1103 bool bIsSortingNeeded =
false;
1106 bool bMarksMoved =
false;
1108 bool bMarksSkipDeletion =
false;
1117 bool bIsPosInRange(
false);
1118 bool bIsOtherPosInRange(
false);
1119 bool const bDeleteMark =
isDeleteMark(pMark,
false, rStt, rEnd, oStartContentIdx, oEndContentIdx, bIsPosInRange, bIsOtherPosInRange);
1122 && ( bIsOtherPosInRange
1129 pSaveBkmk->push_back(
SaveBookmark( *pMark, rStt, oStartContentIdx ) );
1131 vMarksToDelete.emplace_back(ppMark);
1135 bMarksSkipDeletion =
true;
1138 else if ( bIsPosInRange != bIsOtherPosInRange )
1143 std::optional< SwPosition > oNewPos;
1144 if ( oEndContentIdx )
1153 bool bMoveMark =
true;
1164 bMoveMark = pSaveBkmk ==
nullptr;
1173 if ( bIsPosInRange )
1180 bIsSortingNeeded |= lcl_FixCorrectedMark( bIsPosInRange, bIsOtherPosInRange, pMark );
1189 std::vector< std::unique_ptr<ILazyDeleter> > vDelay;
1190 vDelay.reserve(vMarksToDelete.size());
1196 if ( !vMarksToDelete.empty() && bMarksMoved )
1204 for ( std::vector< const_iterator_t >::reverse_iterator pppMark = vMarksToDelete.rbegin();
1205 pppMark != vMarksToDelete.rend();
1208 vDelay.push_back(
deleteMark(*pppMark, pSaveBkmk !=
nullptr));
1214 if (bIsSortingNeeded || (bMarksMoved && bMarksSkipDeletion))
1219 SAL_INFO(
"sw.core",
"deleteMarks");
1230 LazyFieldmarkDeleter(Fieldmark *
const pMark,
SwDoc& rDoc,
bool const isMoveNodes)
1235 virtual ~LazyFieldmarkDeleter()
override
1254 LazyDdeBookmarkDeleter(DdeBookmark *
const pDdeBookmark,
SwDoc& rDoc)
1257 assert(pDdeBookmark);
1259 virtual ~LazyDdeBookmarkDeleter()
override
1267 std::unique_ptr<IDocumentMarkAccess::ILazyDeleter>
1270 std::unique_ptr<ILazyDeleter> ret;
1273 IMark* pMark = *ppMark;
1292 "<MarkManager::deleteMark(..)> - Bookmark not found in Bookmark container.");
1307 "<MarkManager::deleteMark(..)> - Bookmark not found in Bookmark container.");
1324 ret.reset(
new LazyFieldmarkDeleter(
dynamic_cast<Fieldmark*
>(pMark),
m_rDoc, isMoveNodes));
1329 "<MarkManager::deleteMark(..)> - Fieldmark not found in Fieldmark container.");
1338 "<MarkManager::deleteMark(..)> - Annotation Mark not found in Annotation Mark container.");
1352 std::advance(aI, std::distance<container_t::const_iterator>(aI, ppMark.
get()));
1356 ret.reset(
new LazyDdeBookmarkDeleter(pDdeBookmark,
m_rDoc));
1371 "<MarkManager::deleteMark(..)>"
1372 " - Mark is not in my doc.");
1375 auto [it, endIt] = equal_range(
1379 CompareIMarkStartsBefore());
1380 for ( ; it != endIt; ++it)
1441 return std::upper_bound(
1445 CompareIMarkStartsAfter());
1450 auto const pFieldmark = find_if(
1454 return pMark->GetMarkStart() == rPos
1456 || (pMark->GetMarkEnd().GetContentIndex() == rPos.GetContentIndex() + 1
1457 && pMark->GetMarkEnd().GetNode() == rPos.GetNode());
1461 :
dynamic_cast<IFieldmark*
>(*pFieldmark);
1466 auto itFieldmark = find_if(
1469 [&rPos] (const ::sw::mark::MarkBase *
const pMark) { return pMark->IsCoveringPosition(rPos); } );
1472 auto pFieldmark(*itFieldmark);
1477 && (**itFieldmark).GetMarkStart() <= rPos; ++itFieldmark)
1479 if (rPos < (**itFieldmark).GetMarkEnd()
1480 && (pFieldmark->GetMarkStart() < (**itFieldmark).GetMarkStart()
1481 || (**itFieldmark).GetMarkEnd() < pFieldmark->GetMarkEnd()))
1483 pFieldmark = *itFieldmark;
1486 return dynamic_cast<IFieldmark*
>(pFieldmark);
1493 { return pMark->IsCoveringPosition(rPos); });
1503 for (; it !=
m_vBookmarks.end() && (*it)->GetMarkStart() <= rPos; ++it)
1506 if (rPos < (*it)->GetMarkEnd()
1508 || (*it)->GetMarkEnd() < pBookmark->
GetMarkEnd()))
1526 bool bActualChange =
false;
1530 bActualChange =
true;
1537 bActualChange =
true;
1544 bActualChange =
true;
1553 OUString
sName = pFieldmark->GetName();
1554 SwPaM const aPaM(pFieldmark->GetMarkStart());
1566 SwPaM aNewPaM(pFieldmark->GetMarkStart(), pFieldmark->GetMarkEnd());
1599 pNewActiveFieldmark = &rFormField;
1611 if(pNewActiveFieldmark)
1637 pDrowDown->SendLOKShowMessage(pViewShell);
1643 bool bDropDownFieldExist =
false;
1646 IFieldmark *pMark =
dynamic_cast<IFieldmark*
>(*aIter);
1649 bDropDownFieldExist =
true;
1654 if (bDropDownFieldExist)
1669 std::vector<IFieldmark*> aRet;
1679 IFieldmark *pMark =
dynamic_cast<IFieldmark*
>(pI);
1686 aRet.push_back(pMark);
1693 {
return dynamic_cast<IFieldmark*
>(lcl_getMarkAfter(
m_vFieldmarks, rPos, bLoop)); }
1696 {
return dynamic_cast<IFieldmark*
>(lcl_getMarkBefore(
m_vFieldmarks, rPos, bLoop)); }
1721 auto const pAnnotationMark = find_if(
1724 [&rPos] (const ::sw::mark::MarkBase *
const pMark) { return pMark->IsCoveringPosition(rPos); } );
1727 return *pAnnotationMark;
1733 return std::upper_bound(
1737 CompareIMarkStartsAfter());
1742 const OUString& rName,
1765 const OUString & rBookmarkName = (**iter).GetName();
1767 if ( rBookmarkName.startsWith(
"__Annotation__") &&
1774 const SwPaM aPam((**iter).GetMarkStart(), (**pMark).GetMarkEnd());
1793 OSL_ENSURE(rName.getLength(),
1794 "<MarkManager::getUniqueMarkName(..)> - a name should be proposed");
1797 OUString
newName = rName +
"MailMergeMark"
1816 OUString aPrefix =
SwResId(STR_MARK_COPY).replaceFirst(
"%1", rName);
1819 sTmp = aPrefix + OUString::number(nCnt);
1864 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"MarkManager"));
1865 for (
const auto & rContainer : aContainers)
1867 if (!rContainer.pContainer->empty())
1869 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(rContainer.pName));
1870 for (
auto it = rContainer.pContainer->begin(); it != rContainer.pContainer->end(); ++it)
1871 (*it)->dumpAsXml(pWriter);
1872 (void)xmlTextWriterEndElement(pWriter);
1875 (void)xmlTextWriterEndElement(pWriter);
1882 bool lcl_Greater(
const SwPosition& rPos,
const SwNode& rNdIdx, std::optional<sal_Int32> oContentIdx )
1884 return rPos.
GetNode() > rNdIdx ||
1896SaveBookmark::SaveBookmark(
1899 std::optional<sal_Int32> oContentIdx)
1912 ::sfx2::Metadatable
const*
const pMetadatable(
1913 dynamic_cast< ::sfx2::Metadatable const*
>(pBookmark));
1945 std::optional<sal_Int32> oContentIdx)
1947 SwPaM aPam(rNewPos);
1953 SAL_WARN(
"sw",
"trying to sent content index, but point node is not a content node");
1969 SAL_WARN(
"sw",
"trying to sent content index, but mark node is not a content node");
1999 ::sfx2::Metadatable *
const pMeta(
2000 dynamic_cast< ::sfx2::Metadatable*
>(pBookmark));
2001 assert(pMeta &&
"metadata undo, but not metadatable?");
2014 std::vector<SaveBookmark> * pSaveBkmk,
2015 std::optional<sal_Int32> oStartContentIdx,
2016 std::optional<sal_Int32> oEndContentIdx)
2020 || (&rStt == &rEnd && (!oStartContentIdx || !oEndContentIdx || *oStartContentIdx >= *oEndContentIdx)))
2035 auto [pRStt, pREnd] = pRedl->StartEnd();
2037 if( lcl_Greater( *pRStt, rStt, oStartContentIdx ) && lcl_Lower( *pRStt, rEnd, oEndContentIdx ))
2039 pRStt->Assign( rEnd );
2040 if( oEndContentIdx )
2041 pRStt->SetContent( *oEndContentIdx );
2051 pRStt->Assign(rStt);
2060 pRStt->AssignEndIndex( *pCNd );
2063 if( lcl_Greater( *pREnd, rStt, oStartContentIdx ) && lcl_Lower( *pREnd, rEnd, oEndContentIdx ))
2065 pREnd->Assign( rStt );
2067 pREnd->SetContent( *oStartContentIdx );
2077 pREnd->Assign(rEnd);
2086 pREnd->AssignEndIndex( *pCNd );
2097 bool isInsideFieldmarkCommand(
false);
2098 bool isInsideFieldmarkResult(
false);
2103 isInsideFieldmarkResult =
true;
2107 isInsideFieldmarkCommand =
true;
2110 if (!cursor.
Left(1))
2115 return InsertText(
nPos, nLen, isInsideFieldmarkCommand, isInsideFieldmarkResult);
virtual bool DeleteAndJoin(SwPaM &, SwDeleteFlags flags=SwDeleteFlags::Default)=0
complete delete of a given PaM
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
bool operator>=(iterator const &rOther) const
iterator & operator+=(difference_type)
iterator & operator=(iterator const &rOther)
::sw::mark::IMark * operator*() const
std::ptrdiff_t difference_type
bool operator!=(iterator const &rOther) const
value_type operator[](difference_type) const
iterator operator+(difference_type) const
bool operator==(iterator const &rOther) const
bool operator<(iterator const &rOther) const
std::vector<::sw::mark::MarkBase * >::const_iterator const & get() const
bool operator>(iterator const &rOther) const
bool operator<=(iterator const &rOther) const
iterator operator-(difference_type) const
iterator & operator-=(difference_type)
std::optional< std::vector<::sw::mark::MarkBase * >::const_iterator > m_pIter
Provides access to the marks of a document.
virtual sw::mark::IFieldmark * getInnerFieldmarkFor(const SwPosition &pos) const =0
static SW_DLLPUBLIC OUString GetCrossRefHeadingBookmarkNamePrefix()
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 void deleteMarks(const SwNode &rStt, const SwNode &rEnd, std::vector< ::sw::mark::SaveBookmark > *pSaveBkmk, std::optional< sal_Int32 > oStartContentIdx, std::optional< sal_Int32 > oEndContentIdx)=0
Deletes marks in a range.
static void DeleteFieldmarkCommand(::sw::mark::IFieldmark const &rMark)
@ CROSSREF_NUMITEM_BOOKMARK
@ CROSSREF_HEADING_BOOKMARK
static SW_DLLPUBLIC bool IsLegalPaMForCrossRefHeadingBookmark(const SwPaM &rPaM)
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual void SetEnableSetModified(bool bEnableSetModified)=0
virtual void SetModified()=0
Must be called manually at changes of format.
virtual bool IsEnableSetModified() const =0
virtual sal_Int32 Len() const
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
bool Left(sal_uInt16 nCnt)
IDocumentState const & getIDocumentState() const
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentUndoRedo & GetIDocumentUndoRedo()
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
IDocumentMarkAccess * getIDocumentMarkAccess()
bool IsInMailMerge() const
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Marks a node in the document model.
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodeOffset GetIndex() const
SwNodes & GetNodes()
Node is in which nodes-array/doc?
bool IsContentNode() const
const SwStartNode * StartOfSectionNode() const
SwContentNode * GetContentNode()
static SwContentNode * GoPrevious(SwNodeIndex *)
SwContentNode * GoNext(SwNodeIndex *) const
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
bool ContainsPosition(const SwPosition &rPos) const
const SwPosition * End() const
const SwPosition * GetPoint() const
const SwPosition * Start() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
SwTextNode is a paragraph in the document model.
virtual sal_Int32 Len() const override
SfxViewShell * GetSfxViewShell() const
void sendLOKDeleteCallback()
Fieldmark representing a checkbox form field.
Fieldmark representing a date form field.
Fieldmark representing a drop-down form field.
static void SendLOKHideMessage(const SfxViewShell *pViewShell)
OUString GetFieldname() const override
virtual void Hide(bool hide)=0
virtual const vcl::KeyCode & GetKeyCode() const =0
virtual void SetHideCondition(const OUString &)=0
virtual void SetShortName(const OUString &)=0
virtual void SetKeyCode(const vcl::KeyCode &)=0
virtual const OUString & GetHideCondition() const =0
virtual const OUString & GetShortName() const =0
virtual bool IsHidden() const =0
virtual const SwPosition & GetOtherMarkPos() const =0
virtual bool IsExpanded() const =0
virtual const SwPosition & GetMarkEnd() const =0
virtual const SwPosition & GetMarkStart() const =0
virtual const OUString & GetName() const =0
virtual const SwPosition & GetMarkPos() const =0
virtual void SetOtherMarkPos(const SwPosition &rNewPos)
const OUString & GetName() const override
virtual auto InvalidateFrames() -> void
bool IsExpanded() const override
virtual void SetMarkPos(const SwPosition &rNewPos)
virtual void ClearOtherMarkPos()
SwPosition & GetMarkPos() const override
SwPosition & GetMarkStart() const override
SwPosition & GetOtherMarkPos() const override
virtual sw::mark::IMark * getAnnotationMarkFor(const SwPosition &rPos) const override
virtual ::sw::mark::IMark * getOneInnermostBookmarkFor(const SwPosition &rPos) const override
Get the innermost bookmark that contains rPos.
virtual sal_Int32 getAllMarksCount() const override
returns the number of marks.
virtual const_iterator_t getFieldmarksBegin() const override
returns a STL-like random access iterator to the begin of the sequence of fieldmarks.
virtual bool renameMark(::sw::mark::IMark *io_pMark, const OUString &rNewName) override
Renames an existing Mark, if possible.
virtual void restoreAnnotationMarks(bool bDelete=true) override
virtual const_iterator_t findAnnotationBookmark(const OUString &rName) const override
std::vector< sw::mark::MarkBase * > container_t
virtual void ClearFieldActivation() override
virtual ::sw::mark::IFieldmark * getFieldmarkAt(const SwPosition &rPos) const override
get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos
virtual ::sw::mark::IMark * makeAnnotationBookmark(const SwPaM &rPaM, const OUString &rName, IDocumentMarkAccess::MarkType eMark, sw::mark::InsertMode eMode, SwPosition const *pSepPos=nullptr) override
virtual void correctMarksAbsolute(const SwNode &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset) override
Corrects marks (absolute) This method ignores the previous position of the mark in the paragraph.
virtual void NotifyCursorUpdate(const SwCursorShell &rCursorShell) override
virtual void clearAllMarks() override
Clear (deletes) all marks.
virtual const_iterator_t getAllMarksBegin() const override
returns a STL-like random access iterator to the begin of the sequence of marks.
OUString getUniqueMarkName(const OUString &rName) const
virtual const_iterator_t getAnnotationMarksBegin() const override
virtual void assureSortedMarkContainers() const override
virtual sw::mark::IFieldmark * makeNoTextFieldBookmark(const SwPaM &rPaM, const OUString &rName, const OUString &rType) override
void LOKUpdateActiveField(const SfxViewShell *pViewShell)
sw::mark::FieldmarkWithDropDownButton * m_pLastActiveFieldmark
virtual std::vector<::sw::mark::IFieldmark * > getNoTextFieldmarksIn(const SwPaM &rPaM) const override
virtual const_iterator_t getFieldmarksEnd() const override
returns a STL-like random access iterator to the end of the sequence of fieldmarks.
virtual const_iterator_t findFirstAnnotationStartsAfter(const SwPosition &rPos) const override
Finds the first mark that is starting after.
virtual sw::mark::IFieldmark * getFieldmarkAfter(const SwPosition &rPos, bool bLoop) const override
container_t m_vFieldmarks
virtual const_iterator_t getAnnotationMarksEnd() const override
MarkBasenameMapUniqueOffset_t m_aMarkBasenameMapUniqueOffset
virtual ::sw::mark::IFieldmark * changeFormFieldmarkType(::sw::mark::IFieldmark *pFieldmark, const OUString &rNewType) override
virtual void correctMarksRelative(const SwNode &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset) override
Corrects marks (relative) This method uses the previous position of the mark in the paragraph as offs...
virtual void repositionMark(::sw::mark::IMark *io_pMark, const SwPaM &rPaM) override
Moves an existing mark to a new selection and performs needed updates.
virtual sw::mark::IFieldmark * getInnerFieldmarkFor(const SwPosition &rPos) const override
virtual void deleteMarks(const SwNode &rStt, const SwNode &rEnd, std::vector< ::sw::mark::SaveBookmark > *pSaveBkmk, std::optional< sal_Int32 > oStartContentIdx, std::optional< sal_Int32 > oEndContentIdx) override
Deletes marks in a range.
virtual sw::mark::IFieldmark * makeFieldBookmark(const SwPaM &rPaM, const OUString &rName, const OUString &rType, SwPosition const *pSepPos=nullptr) override
virtual ::sw::mark::IMark * getMarkForTextNode(const SwTextNode &rTextNode, IDocumentMarkAccess::MarkType eMark) override
Returns a mark in the document for a paragraph.
virtual sal_Int32 getFieldmarksCount() const override
returns the number of IFieldmarks.
void dumpAsXml(xmlTextWriterPtr pWriter) const
virtual sw::mark::IMark * makeAnnotationMark(const SwPaM &rPaM, const OUString &rName) override
virtual const_iterator_t findFirstBookmarkStartsAfter(const SwPosition &rPos) const override
Finds the first mark that is starting after.
virtual ::sw::mark::IMark * makeMark(const SwPaM &rPaM, const OUString &rName, IDocumentMarkAccess::MarkType eMark, sw::mark::InsertMode eMode, SwPosition const *pSepPos=nullptr) override
virtual const_iterator_t findAnnotationMark(const OUString &rName) const override
virtual ::sw::mark::IFieldmark * getDropDownFor(const SwPosition &rPos) const override
virtual sw::mark::IFieldmark * getFieldmarkBefore(const SwPosition &rPos, bool bLoop) const override
virtual void deleteFieldmarkAt(const SwPosition &rPos) override
virtual const_iterator_t findBookmark(const OUString &rName) const override
Finds a bookmark by name.
virtual sal_Int32 getAnnotationMarksCount() const override
virtual bool isBookmarkDeleted(SwPaM const &rPaM, bool isReplace) const override
check if the selection would delete a BOOKMARK
virtual const_iterator_t getBookmarksEnd() const override
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
virtual std::unique_ptr< ILazyDeleter > deleteMark(const const_iterator_t &ppMark, bool isMoveNodes) override
Deletes a mark.
virtual const_iterator_t getAllMarksEnd() const override
returns a STL-like random access iterator to the end of the sequence of marks.
virtual sal_Int32 getBookmarksCount() const override
returns the number of IBookmarks.
container_t m_vAnnotationMarks
virtual const_iterator_t getBookmarksBegin() const override
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
virtual const_iterator_t findMark(const OUString &rName) const override
Finds a mark by name.
void SetInDoc(SwDoc *pDoc, const SwNode &, std::optional< sal_Int32 > oContentIdx=std::nullopt)
IDocumentMarkAccess::MarkType m_eOrigBkmType
OUString m_aHideCondition
std::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo
TOOLS_DLLPUBLIC OString DateTimeToOString(const DateTime &rDateTime)
struct _xmlTextWriter * xmlTextWriterPtr
virtual OUString GetName() const override
constexpr OUStringLiteral S_ANNOTATION_BOOKMARK
std::unique_ptr< Fieldmark > m_pFieldmark
void DelBookmarks(SwNode &rStt, const SwNode &rEnd, std::vector< SaveBookmark > *pSaveBkmk, std::optional< sal_Int32 > oStartContentIdx, std::optional< sal_Int32 > oEndContentIdx)
std::unique_ptr< DdeBookmark > m_pDdeBookmark
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
OUString newName(std::u16string_view aNewPrefix, std::u16string_view aOldPrefix, std::u16string_view old_Name)
bool IsFieldmarkOverlap(SwPaM const &rPaM)
check if rPaM is valid range of new fieldmark
SwPosition FindFieldSep(IFieldmark const &rMark)
return position of the CH_TXT_ATR_FIELDSEP for rMark
static bool isDeleteMark(::sw::mark::MarkBase const *const pMark, bool const isReplace, SwNode const &rStt, SwNode const &rEnd, std::optional< sal_Int32 > oStartContentIdx, std::optional< sal_Int32 > oEndContentIdx, bool &rbIsPosInRange, bool &rbIsOtherPosInRange)
Dialog to specify the properties of date form field.
void UpdateFramesForAddDeleteRedline(SwDoc &rDoc, SwPaM const &rPam)
InsertText MakeInsertText(SwTextNode &rNode, const sal_Int32 nPos, const sal_Int32 nLen)
constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32)
constexpr OUStringLiteral ODF_FORMCHECKBOX
constexpr OUStringLiteral ODF_FORMDATE
constexpr OUStringLiteral ODF_FORMDROPDOWN
bool CheckNodesRange(const SwNode &rStt, const SwNode &rEnd, bool bChkSection)
Check if the given range is inside one of the defined top-level sections.
To avoid recursive calls of deleteMark, the removal of dummy characters of fieldmarks has to be delay...
Marks a position in the document model.
void Adjust(SwNodeOffset nDelta)
Adjust node position, and resets content position to zero.
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
SwNodeOffset GetNodeIndex() const
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.
OUString SwResId(TranslateId aId)