33 struct CursorStateHelper
36 : m_pCursor(rShell.GetSwCursor())
37 , m_aSaveState(*m_pCursor)
51 bool RollbackIfIllegal()
56 m_pCursor->DeleteMark();
57 m_pCursor->RestoreSavePos();
67 bool lcl_ReverseMarkOrderingByEnd(const ::sw::mark::IMark* pFirst,
68 const ::sw::mark::IMark* pSecond)
70 return pFirst->GetMarkEnd() > pSecond->GetMarkEnd();
73 bool lcl_IsInvisibleBookmark(const ::sw::mark::IMark* pMark)
82 const OUString& rName,
104 const OUString& rName,
106 const OUString& rCondition)
118 pBookmark->
Hide(bHide);
134 SwTextFrame const*
const pFrame(static_cast<SwTextFrame const*>(
135 rNode.getLayoutFrame(&rLayout)));
142 SwTextFrame const*
const pOtherFrame(static_cast<SwTextFrame const*>(
144 return pFrame == pOtherFrame
156 return pFrame->MapModelToViewPos(rMark.
GetMarkPos())
172 CursorStateHelper aCursorSt(*
this);
174 *aCursorSt.m_pCursor->GetPoint() = pMark->GetMarkStart();
176 *aCursorSt.m_pCursor->GetPoint() = pMark->GetMarkEnd();
178 if(aCursorSt.RollbackIfIllegal())
return false;
191 CursorStateHelper aCursorSt(*
this);
192 aCursorSt.SetCursorToMark(pMark);
194 if(aCursorSt.RollbackIfIllegal())
return false;
203 std::vector<::sw::mark::IMark*> vCandidates;
207 back_inserter(vCandidates),
208 &lcl_IsInvisibleBookmark);
211 CursorStateHelper aCursorSt(*
this);
212 auto ppMark = vCandidates.begin();
213 for(; ppMark!=vCandidates.end(); ++ppMark)
219 aCursorSt.SetCursorToMark(*ppMark);
220 if(!aCursorSt.RollbackIfIllegal())
223 if(ppMark==vCandidates.end())
238 std::vector<::sw::mark::IMark*> vCandidates;
242 back_inserter(vCandidates),
243 &lcl_IsInvisibleBookmark);
247 &lcl_ReverseMarkOrderingByEnd);
250 CursorStateHelper aCursorSt(*
this);
251 auto ppMark = vCandidates.begin();
252 for(; ppMark!=vCandidates.end(); ++ppMark)
258 if(!((**ppMark).GetMarkEnd() < *GetCursor()->GetPoint()))
264 aCursorSt.SetCursorToMark(*ppMark);
265 if(!aCursorSt.RollbackIfIllegal())
268 if(ppMark==vCandidates.end())
287 return getIDocumentMarkAccess()->getFieldmarkFor(pos);
293 return getIDocumentMarkAccess()->getFieldmarkAfter(pos);
299 return getIDocumentMarkAccess()->getFieldmarkBefore(pos);
304 if(pMark==
nullptr)
return false;
307 CursorStateHelper aCursorSt(*
this);
308 aCursorSt.SetCursorToMark(pMark);
309 ++aCursorSt.m_pCursor->GetPoint()->nContent;
310 --aCursorSt.m_pCursor->GetMark()->nContent;
312 if(aCursorSt.RollbackIfIllegal())
return false;
Represents the visualization of a paragraph.
Marks a position in the document model.
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Provides access to the marks of a document.
virtual const_iterator_t findFirstBookmarkStartsAfter(const SwPosition &rPos) const =0
Finds the first mark that is starting after.
virtual const SwPosition & GetMarkPos() const =0
bool IsMarkHidden(SwRootFrame const &rLayout,::sw::mark::IMark const &rMark)
Dialog to specify the properties of date form field.
bool GotoMark(const ::sw::mark::IMark *const pMark)
The root element of a Writer document layout.
virtual void SetKeyCode(const vcl::KeyCode &)=0
virtual void SetShortName(const OUString &)=0
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
virtual void Hide(bool hide)=0
A helper class to save cursor state (position).
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
::sw::mark::IMark * SetBookmark(const vcl::KeyCode &, const OUString &rName, IDocumentMarkAccess::MarkType eMark=IDocumentMarkAccess::MarkType::BOOKMARK)
bool GotoFieldmark(const ::sw::mark::IFieldmark *const pMark)
virtual void SetHideCondition(const OUString &)=0
SwTextNode is a paragraph in the document model.
::sw::mark::IFieldmark * GetFieldmarkAfter()
::sw::mark::IMark * SetBookmark2(const vcl::KeyCode &, const OUString &rName, bool bHide, const OUString &rCondition)
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
sal_Int32 GetIndex() const
virtual const SwPosition & GetMarkEnd() const =0
::sw::mark::IFieldmark * GetFieldmarkBefore()
make visible in spite of Readonly
bool HasMergedParas() const
virtual const SwPosition & GetMarkStart() const =0
virtual bool IsExpanded() const =0
::sw::mark::IFieldmark * GetCurrentFieldmark()
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
virtual const SwPosition & GetOtherMarkPos() const =0