19#ifndef INCLUDED_SW_INC_PAM_HXX
20#define INCLUDED_SW_INC_PAM_HXX
67 SwDoc& GetDoc()
const;
91 void Assign(
SwNodeOffset nNodeOffset, sal_Int32 nContentOffset = 0 );
92 void Assign(
const SwContentNode& rNode, sal_Int32 nContentOffset = 0 );
93 void Assign(
const SwNode& rNd, sal_Int32 nContentOffset = 0 );
94 void Assign(
const SwNodeIndex& rNdIdx, sal_Int32 nContentOffset = 0 );
102 void AdjustContent( sal_Int32 nDelta );
104 void SetContent( sal_Int32 nContentIndex );
124 const T& rStt1,
const T& rEnd1,
125 const T& rStt2,
const T& rEnd2 )
138 else if( rEnd1 == rStt2 )
143 else if( rEnd2 > rStt1 )
147 if( rEnd2 == rEnd1 && rStt2 == rStt1 )
160 else if( rEnd2 == rStt1 )
207 const SwNode& rPt, sal_Int32 nPtContent,
SwPaM* pRing =
nullptr );
211 explicit SwPaM(
const SwNode& rNd, sal_Int32 nContent = 0,
SwPaM* pRing =
nullptr );
214 virtual ~SwPaM()
override;
230 virtual void SetMark();
245 std::swap(m_pPoint, m_pMark);
251 bool HasMark()
const {
return m_pPoint != m_pMark; }
259 {
return (*m_pPoint) <= (*m_pMark) ? m_pPoint : m_pMark; }
261 {
return (*m_pPoint) <= (*m_pMark) ? m_pPoint : m_pMark; }
264 {
return (*m_pPoint) > (*m_pMark) ? m_pPoint : m_pMark; }
266 {
return (*m_pPoint) > (*m_pMark) ? m_pPoint : m_pMark; }
269 std::pair<const SwPosition *, const SwPosition *>
StartEnd()
const
270 {
if ((*m_pPoint) <= (*m_pMark))
return { m_pPoint, m_pMark };
else return { m_pMark, m_pPoint }; }
272 {
if ((*m_pPoint) <= (*m_pMark))
return { m_pPoint, m_pMark };
else return { m_pMark, m_pPoint }; }
288 void Normalize(
bool bPointFirst =
true);
294 {
return bOne ? m_Bound1 : m_Bound2; }
296 {
return bOne ? m_Bound1 : m_Bound2; }
299 sal_uInt16 GetPageNum(
bool bAtPoint =
true,
const Point* pLayPos =
nullptr );
303 bool HasReadonlySel(
bool bFormView,
bool isReplace)
const;
305 bool HasHiddenSections()
const;
309 return *
Start() <= rPos && rPos <= *
End();
312 OUString GetText()
const;
313 void InvalidatePaM();
315 {
return GetNextInRing(); }
317 {
return GetNextInRing(); }
319 {
return GetPrevInRing(); }
321 {
return GetPrevInRing(); }
323 {
return !unique(); }
Marks a character position inside a document model content node (SwContentNode)
void SetMark(const sw::mark::IMark *pMark)
sal_Int32 GetIndex() const
const SwContentNode * GetContentNode() const
void SetRedline(SwRangeRedline *pRangeRedline)
Marks a node in the document model.
const SwNodes & GetNodes() const
SwNodeOffset GetIndex() const
Base class of the Writer document model elements.
SwContentNode * GetContentNode()
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
void SetInFrontOfLabel_(bool bNew)
SwNode & GetPointNode() const
SwPosition * m_pMark
points at either m_Bound1 or m_Bound2
bool ContainsPosition(const SwPosition &rPos) const
bool IsInFrontOfLabel() const
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
SwPosition * m_pPoint
points at either m_Bound1 or m_Bound2
bool IsMultiSelection() const
SwContentNode * GetPointContentNode() const
const SwPosition * End() const
SwPaM(SwPaM const &rPaM)=delete
SwContentNode * GetMarkContentNode() const
std::pair< SwPosition *, SwPosition * > StartEnd()
const SwPaM * GetPrev() const
SwPosition & GetBound(bool bOne=true)
SwNode & GetMarkNode() const
const SwPosition * GetPoint() const
const SwPaM * GetNext() const
const SwPosition * Start() const
const SwPosition & GetBound(bool bOne=true) const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
struct _xmlTextWriter * xmlTextWriterPtr
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
SwComparePosition ComparePosition(const T &rStt1, const T &rEnd1, const T &rStt2, const T &rEnd2)
auto(*)(SwPaM &rPam, SwMoveFnCollection const &fnMove) -> bool SwGoInDoc
bool GoInContentSkipHidden(SwPaM &, SwMoveFnCollection const &)
SW_DLLPUBLIC SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
SW_DLLPUBLIC bool GoInDoc(SwPaM &, SwMoveFnCollection const &)
SW_DLLPUBLIC bool GoInNode(SwPaM &, SwMoveFnCollection const &)
bool CheckNodesRange(const SwNode &, const SwNode &, bool bChkSection)
Check if the given range is inside one of the defined top-level sections.
SW_DLLPUBLIC std::ostream & operator<<(std::ostream &s, const SwPosition &position)
bool GoInContentCells(SwPaM &, SwMoveFnCollection const &)
bool GoInSection(SwPaM &, SwMoveFnCollection const &)
@ 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.
SW_DLLPUBLIC bool GoInContent(SwPaM &, SwMoveFnCollection const &)
SW_DLLPUBLIC SwMoveFnCollection const & fnMoveBackward
bool GoInContentCellsSkipHidden(SwPaM &, SwMoveFnCollection const &)
Marks a position in the document model.
SwPosition(SwNodeIndex &&, const SwContentNode *, sal_Int32)=delete
void SetMark(const sw::mark::IMark *pMark)
SwPosition(const SwNode &rNode, SwNodeOffset nDiff, const SwContentNode *, sal_Int32 nContentOffset)
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
SwPosition(SwNodeIndex &&, SwNodeOffset)=delete
SwPosition(SwNodeIndex &&, SwContentIndex &&)=delete
SwPosition(SwNodeIndex &&)=delete
SwPosition(const SwNodeIndex &, SwContentIndex &&)=delete
const SwContentNode * GetContentNode() const
SwNodeOffset GetNodeIndex() const
const SwNodes & GetNodes() const
void SetRedline(SwRangeRedline *pRangeRedline)
sal_Int32 GetContentIndex() const
SwPosition(SwContentIndex &&, short)=delete
bool operator<(const wwFont &r1, const wwFont &r2)