diff options
author | Justin Luth <jluth@mail.com> | 2023-11-02 13:35:24 -0400 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2023-11-15 20:03:28 +0100 |
commit | 213c6a9999e84f084978391c16276017078bf9ed (patch) | |
tree | 4a7750b860ed2cb877576fe4801b243c2295184b /include | |
parent | 861ebce9ca52cbe87121879f159d8ec0cb572755 (diff) |
related tdf#158031 editeng: GetFieldAtSel...(+look before cursor)
Nearly a No-Functional-Change, but not quite.
For practical and intentional purposes, it can be considered NFC.
Although I didn't find an actual case where it happened,
a code read says SelectFieldAtCursor COULD select a non-field.
It assumed that previous code had already identified that there
must be a field here.
Well, I want to extend GetFieldAtSelection to check backwards
to solve bug 158031 anyway, so I might as well "fix"
this assumption to only select a valid field.
This function REALLY depends on
GetFieldAtSelection working properly.
So, I put some asserts in to ensure that stays true.
Change-Id: Ie22945a418497511501b04df5e17071d977cbd5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158855
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/editeng/editview.hxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index 48019e3c4776..4c18ac2ba3e4 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -329,7 +329,10 @@ public: const SvxFieldItem* GetFieldUnderMousePointer( sal_Int32& nPara, sal_Int32& nPos ) const; const SvxFieldItem* GetField( const Point& rPos, sal_Int32* pnPara = nullptr, sal_Int32* pnPos = nullptr ) const; - const SvxFieldItem* GetFieldAtSelection() const; + /// return the selected field or the field immediately after (or before) the current cursor + const SvxFieldItem* GetFieldAtSelection(bool bAlsoCheckBeforeCursor = false) const; + const SvxFieldItem* GetFieldAtSelection(bool* pIsBeforeCursor) const; + /// Select and return the field at the current cursor position const SvxFieldData* GetFieldAtCursor() const; void SelectFieldAtCursor(); |