summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-09-13 20:30:06 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-09-19 10:18:32 +0200
commit7409c8a6a61623d8f6463e1229a8fb1c9d9aedcc (patch)
treec3d1c4b5cd974b564116aec09d643cbd3c7096bc /sw
parente2dc30d6b01a02efc40849b15a38f30b1f34181c (diff)
sw_redlinehide_2: view cursor: IsSelOnePara(),IsStartPara(),IsEndPara()
Change-Id: Idb7bdc139e501dfbd7e7d3b2d4598d211fa11591
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/crsrsh.hxx8
-rw-r--r--sw/source/core/crsr/crsrsh.cxx55
2 files changed, 54 insertions, 9 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 12337a2da62c..327674e3c547 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -502,7 +502,7 @@ public:
bool ShouldWait() const;
// Check if selection is within one paragraph.
- inline bool IsSelOnePara() const;
+ bool IsSelOnePara() const;
/*
* Returns SRectangle, at which the cursor is located.
@@ -870,12 +870,6 @@ inline bool SwCursorShell::IsMultiSelection() const
return m_pCurrentCursor->GetNext() != m_pCurrentCursor;
}
-inline bool SwCursorShell::IsSelOnePara() const
-{
- return !m_pCurrentCursor->IsMultiSelection() &&
- m_pCurrentCursor->GetPoint()->nNode == m_pCurrentCursor->GetMark()->nNode;
-}
-
inline const SwTableNode* SwCursorShell::IsCursorInTable() const
{
return m_pCurrentCursor->GetNode().FindTableNode();
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index c4861ed75fe5..c818a9400c3f 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1045,11 +1045,62 @@ int SwCursorShell::CompareCursorStackMkCurrPt() const
return nRet;
}
+bool SwCursorShell::IsSelOnePara() const
+{
+ if (m_pCurrentCursor->IsMultiSelection())
+ {
+ return false;
+ }
+ if (m_pCurrentCursor->GetPoint()->nNode == m_pCurrentCursor->GetMark()->nNode)
+ {
+ return true;
+ }
+ if (GetLayout()->IsHideRedlines())
+ {
+ SwContentFrame const*const pFrame(GetCurrFrame(false));
+ auto const n(m_pCurrentCursor->GetMark()->nNode.GetIndex());
+ return FrameContainsNode(*pFrame, n);
+ }
+ return false;
+}
+
bool SwCursorShell::IsSttPara() const
-{ return m_pCurrentCursor->GetPoint()->nContent == 0; }
+{
+ if (GetLayout()->IsHideRedlines())
+ {
+ SwTextNode const*const pNode(m_pCurrentCursor->GetPoint()->nNode.GetNode().GetTextNode());
+ if (pNode)
+ {
+ SwTextFrame const*const pFrame(static_cast<SwTextFrame*>(
+ pNode->getLayoutFrame(GetLayout())));
+ if (pFrame)
+ {
+ return pFrame->MapModelToViewPos(*m_pCurrentCursor->GetPoint())
+ == TextFrameIndex(0);
+ }
+ }
+ }
+ return m_pCurrentCursor->GetPoint()->nContent == 0;
+}
bool SwCursorShell::IsEndPara() const
-{ return m_pCurrentCursor->GetPoint()->nContent == m_pCurrentCursor->GetContentNode()->Len(); }
+{
+ if (GetLayout()->IsHideRedlines())
+ {
+ SwTextNode const*const pNode(m_pCurrentCursor->GetPoint()->nNode.GetNode().GetTextNode());
+ if (pNode)
+ {
+ SwTextFrame const*const pFrame(static_cast<SwTextFrame*>(
+ pNode->getLayoutFrame(GetLayout())));
+ if (pFrame)
+ {
+ return pFrame->MapModelToViewPos(*m_pCurrentCursor->GetPoint())
+ == TextFrameIndex(pFrame->GetText().getLength());
+ }
+ }
+ }
+ return m_pCurrentCursor->GetPoint()->nContent == m_pCurrentCursor->GetContentNode()->Len();
+}
bool SwCursorShell::IsEndOfTable() const
{