31 struct CursorStateHelper
34 : m_pCursor(rShell.GetCursor())
35 , m_aSaveState(*m_pCursor)
49 bool RollbackIfIllegal()
54 m_pCursor->DeleteMark();
55 m_pCursor->RestoreSavePos();
65 bool lcl_ReverseMarkOrderingByEnd(const ::sw::mark::IMark* pFirst,
66 const ::sw::mark::IMark* pSecond)
68 return pFirst->GetMarkEnd() > pSecond->GetMarkEnd();
71 bool lcl_IsInvisibleBookmark(const ::sw::mark::IMark* pMark)
80 const OUString& rName,
102 const OUString& rName,
104 const OUString& rCondition)
116 pBookmark->
Hide(bHide);
133 if (pTextNode ==
nullptr)
147 return pFrame == pOtherFrame
175 CursorStateHelper aCursorSt(*
this);
177 *aCursorSt.m_pCursor->GetPoint() = pMark->GetMarkStart();
179 *aCursorSt.m_pCursor->GetPoint() = pMark->GetMarkEnd();
181 if(aCursorSt.RollbackIfIllegal())
return false;
194 CursorStateHelper aCursorSt(*
this);
195 aCursorSt.SetCursorToMark(pMark);
197 if(aCursorSt.RollbackIfIllegal())
return false;
206 std::vector<::sw::mark::IMark*> vCandidates;
210 back_inserter(vCandidates),
211 &lcl_IsInvisibleBookmark);
214 CursorStateHelper aCursorSt(*
this);
215 auto ppMark = vCandidates.begin();
216 for(; ppMark!=vCandidates.end(); ++ppMark)
222 aCursorSt.SetCursorToMark(*ppMark);
223 if(!aCursorSt.RollbackIfIllegal())
226 if(ppMark==vCandidates.end())
241 std::vector<::sw::mark::IMark*> vCandidates;
245 back_inserter(vCandidates),
246 &lcl_IsInvisibleBookmark);
250 &lcl_ReverseMarkOrderingByEnd);
253 CursorStateHelper aCursorSt(*
this);
254 auto ppMark = vCandidates.begin();
255 for(; ppMark!=vCandidates.end(); ++ppMark)
261 if(!((**ppMark).GetMarkEnd() < *
GetCursor()->GetPoint()))
267 aCursorSt.SetCursorToMark(*ppMark);
268 if(!aCursorSt.RollbackIfIllegal())
271 if(ppMark==vCandidates.end())
307 if(pMark==
nullptr)
return false;
310 CursorStateHelper aCursorSt(*
this);
311 aCursorSt.SetCursorToMark(pMark);
312 aCursorSt.m_pCursor->GetPoint()->AdjustContent(+1);
313 aCursorSt.m_pCursor->GetMark()->AdjustContent(-1);
315 if(aCursorSt.RollbackIfIllegal())
return false;
Provides access to the marks of a document.
virtual sw::mark::IFieldmark * getFieldmarkBefore(const SwPosition &pos, bool bLoop) const =0
virtual const_iterator_t findFirstBookmarkStartsAfter(const SwPosition &rPos) const =0
Finds the first mark that is starting after.
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
virtual sw::mark::IFieldmark * getInnerFieldmarkFor(const SwPosition &pos) const =0
virtual sw::mark::IFieldmark * getFieldmarkAfter(const SwPosition &pos, bool bLoop) const =0
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.
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
A helper class to save cursor state (position).
SAL_DLLPRIVATE void UpdateCursor(sal_uInt16 eFlags=SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE, bool bIdleEnd=false)
bool GotoFieldmark(const ::sw::mark::IFieldmark *const pMark)
bool SttEndDoc(bool bStt)
::sw::mark::IMark * SetBookmark(const vcl::KeyCode &, const OUString &rName, IDocumentMarkAccess::MarkType eMark=IDocumentMarkAccess::MarkType::BOOKMARK)
::sw::mark::IMark * SetBookmark2(const vcl::KeyCode &, const OUString &rName, bool bHide, const OUString &rCondition)
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
bool GotoMark(const ::sw::mark::IMark *const pMark)
void EndAction(const bool bIdleEnd=false)
sw::mark::IFieldmark * GetFieldmarkBefore(bool bLoop)
@ READONLY
make visible in spite of Readonly
@ CHKRANGE
check overlapping PaMs
::sw::mark::IFieldmark * GetCurrentFieldmark()
sw::mark::IFieldmark * GetFieldmarkAfter(bool bLoop)
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Merge GetRedlineMergeFlag() const
The root element of a Writer document layout.
bool HasMergedParas() const
Represents the visualization of a paragraph.
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
SwTextNode is a paragraph in the document model.
virtual sal_Int32 Len() const override
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
SwRootFrame * GetLayout() const
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
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 SwPosition & GetMarkPos() const =0
Dialog to specify the properties of date form field.
bool IsMarkHidden(SwRootFrame const &rLayout, ::sw::mark::IMark const &rMark)
Marks a position in the document model.
void SetMark(const sw::mark::IMark *pMark)
sal_Int32 GetContentIndex() const