summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-05-07 17:39:01 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2023-05-07 21:03:41 +0200
commit059892da740e4272477ad0d69183b0e9b77129d7 (patch)
tree791bf151f921b3cfc2f8c509f4a94a39f84064dd /sw
parent1c7cbd685633d44eac554629572f3401c450f855 (diff)
Simplify a bit
Change-Id: Ibcf59feaa1631c06a393017d1b6342d4a646b9a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151387 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/pam.hxx16
-rw-r--r--sw/source/core/crsr/pam.cxx12
2 files changed, 4 insertions, 24 deletions
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index 2a7a0cdb8bd3..62721beb0c4c 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -27,6 +27,7 @@
#include "nodeoffset.hxx"
#include <iostream>
+#include <utility>
class SwDoc;
class SwPaM;
@@ -230,7 +231,7 @@ public:
void DeleteMark()
{
- if (m_pMark != m_pPoint)
+ if (HasMark())
{
/** clear the mark position; this helps if mark's SwContentIndex is
registered at some node, and that node is then deleted */
@@ -238,20 +239,11 @@ public:
m_pMark = m_pPoint;
}
}
-#ifdef DBG_UTIL
- void Exchange();
-
-#else
void Exchange()
{
- if (m_pPoint != m_pMark)
- {
- SwPosition *pTmp = m_pPoint;
- m_pPoint = m_pMark;
- m_pMark = pTmp;
- }
+ if (HasMark())
+ std::swap(m_pPoint, m_pMark);
}
-#endif
/** A PaM marks a selection if Point and Mark are distinct positions.
@return true if the PaM spans a selection
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 06690354a8b9..eafa38907fcd 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -652,18 +652,6 @@ void SwPaM::SetMark()
(*m_pMark) = *m_pPoint;
}
-#ifdef DBG_UTIL
-void SwPaM::Exchange()
-{
- if (m_pPoint != m_pMark)
- {
- SwPosition *pTmp = m_pPoint;
- m_pPoint = m_pMark;
- m_pMark = pTmp;
- }
-}
-#endif
-
/// movement of cursor
bool SwPaM::Move( SwMoveFnCollection const & fnMove, SwGoInDoc fnGo )
{