summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/docbm.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-01-23 11:18:44 -0500
committerJustin Luth <jluth@mail.com>2023-01-24 22:22:11 +0000
commite125e6623fa1c0f39d927bb37547ca6d1e299cb1 (patch)
treeb3b626848395a71c52c14cadceec9074444d2518 /sw/source/core/doc/docbm.cxx
parentd8b60e66bf1847989f6ff3c06ea214cef059ecaf (diff)
related tdf#151548 formfield navigation: loop to beginning/end
When reaching the end of the form using keyboard navigation, the next tabstop should return the user to the beginning of the form. This patch adds that to the existing legacy formfield navigation. I'll wait with a unit test until I have added activeX/contentControls into the mix. Change-Id: I24a15a60f5a0a2721f512cca50397efddcbf7e4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146035 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sw/source/core/doc/docbm.cxx')
-rw-r--r--sw/source/core/doc/docbm.cxx27
1 files changed, 20 insertions, 7 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 56a34fb72a3a..cd6afc472350 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -312,7 +312,8 @@ namespace
};
- IMark* lcl_getMarkAfter(const MarkManager::container_t& rMarks, const SwPosition& rPos)
+ IMark* lcl_getMarkAfter(const MarkManager::container_t& rMarks, const SwPosition& rPos,
+ bool bLoop)
{
auto const pMarkAfter = upper_bound(
rMarks.begin(),
@@ -320,11 +321,17 @@ namespace
rPos,
CompareIMarkStartsAfter());
if(pMarkAfter == rMarks.end())
+ {
+ if (bLoop && rMarks.begin() != rMarks.end())
+ return *rMarks.begin();
+
return nullptr;
+ }
return *pMarkAfter;
};
- IMark* lcl_getMarkBefore(const MarkManager::container_t& rMarks, const SwPosition& rPos)
+ IMark* lcl_getMarkBefore(const MarkManager::container_t& rMarks, const SwPosition& rPos,
+ bool bLoop)
{
// candidates from which to choose the mark before
MarkManager::container_t vCandidates;
@@ -342,7 +349,13 @@ namespace
back_inserter(vCandidates),
[&rPos] (const ::sw::mark::MarkBase *const pMark) { return !(pMark->GetMarkEnd() < rPos); } );
// no candidate left => we are in front of the first mark or there are none
- if(vCandidates.empty()) return nullptr;
+ if(vCandidates.empty())
+ {
+ if (bLoop && rMarks.begin() != rMarks.end())
+ return *(rMarks.end() - 1);
+
+ return nullptr;
+ }
// return the highest (last) candidate using mark end ordering
return *max_element(vCandidates.begin(), vCandidates.end(), &lcl_MarkOrderingByEnd);
}
@@ -1640,11 +1653,11 @@ namespace sw::mark
return aRet;
}
- IFieldmark* MarkManager::getFieldmarkAfter(const SwPosition& rPos) const
- { return dynamic_cast<IFieldmark*>(lcl_getMarkAfter(m_vFieldmarks, rPos)); }
+ IFieldmark* MarkManager::getFieldmarkAfter(const SwPosition& rPos, bool bLoop) const
+ { return dynamic_cast<IFieldmark*>(lcl_getMarkAfter(m_vFieldmarks, rPos, bLoop)); }
- IFieldmark* MarkManager::getFieldmarkBefore(const SwPosition& rPos) const
- { return dynamic_cast<IFieldmark*>(lcl_getMarkBefore(m_vFieldmarks, rPos)); }
+ IFieldmark* MarkManager::getFieldmarkBefore(const SwPosition& rPos, bool bLoop) const
+ { return dynamic_cast<IFieldmark*>(lcl_getMarkBefore(m_vFieldmarks, rPos, bLoop)); }
IDocumentMarkAccess::const_iterator_t MarkManager::getAnnotationMarksBegin() const
{