sw/inc/crsrsh.hxx                            |    4 ++--
 sw/inc/ndtxt.hxx                             |   10 ++--------
 sw/inc/swtypes.hxx                           |   10 ++++++++++
 sw/qa/core/txtnode/txtnode.cxx               |    4 ++--
 sw/source/core/crsr/annotationmark.cxx       |    2 +-
 sw/source/core/crsr/crstrvl.cxx              |   27 ++++++++++++++-------------
 sw/source/core/crsr/pam.cxx                  |    2 +-
 sw/source/core/crsr/swcrsr.cxx               |    4 ++--
 sw/source/core/crsr/viscrs.cxx               |    6 +++---
 sw/source/core/doc/DocumentFieldsManager.cxx |    2 +-
 sw/source/core/doc/docredln.cxx              |    2 +-
 sw/source/core/edit/edfld.cxx                |    4 ++--
 sw/source/core/layout/flycnt.cxx             |    2 +-
 sw/source/core/text/itrform2.cxx             |    2 +-
 sw/source/core/txtnode/ndtxt.cxx             |   25 ++++++++++++++-----------
 sw/source/core/txtnode/thints.cxx            |    2 +-
 sw/source/core/txtnode/txtedt.cxx            |    4 ++--
 sw/source/core/unocore/unocrsrhelper.cxx     |   10 +++++-----
 sw/source/core/unocore/unofield.cxx          |    6 +++---
 sw/source/filter/basflt/fltshell.cxx         |    2 +-
 sw/source/filter/ww8/docxattributeoutput.cxx |    4 ++--
 sw/source/ui/misc/contentcontroldlg.cxx      |    4 ++--
 sw/source/uibase/docvw/edtwin.cxx            |    6 +++---
 sw/source/uibase/shells/textfld.cxx          |    2 +-
 sw/source/uibase/uno/unotxdoc.cxx            |    4 ++--
 sw/source/uibase/wrtsh/delete.cxx            |    2 +-
 26 files changed, 80 insertions(+), 72 deletions(-)

New commits:
commit 70973680f05c587c866d2de2a16bff9ebf8007ca
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Sep 27 16:32:51 2022 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Tue Sep 27 21:18:19 2022 +0200

    sw: fix inserting fields between 2 adjacent input fields
    
    Primarily this is achieved by using GetTextAttrMode PARENT in
    SwCursorShell::CursorInsideInputField() and
    SwCursorShell::PosInsideInputField().
    
    But this requires some refactoring to make this parameter available.
    
    Change-Id: I1a0ef4e3d93a6733d972544abfe07ddf929eb62c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140661
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 2c1001b44c50..2e9a9f0f1e62 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -719,10 +719,10 @@ public:
 
     static SwTextField* GetTextFieldAtPos(
         const SwPosition* pPos,
-        const bool bIncludeInputFieldAtStart );
+        ::sw::GetTextAttrMode eMode);
     static SwTextField* GetTextFieldAtCursor(
         const SwPaM* pCursor,
-        const bool bIncludeInputFieldAtStart );
+        ::sw::GetTextAttrMode eMode);
     static SwField* GetFieldAtCursor(
         const SwPaM* pCursor,
         const bool bIncludeInputFieldAtStart );
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 12b823a52f7c..a86b495515b0 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -381,12 +381,6 @@ public:
     bool DontExpandFormat( sal_Int32 nContentIdx, bool bFlag = true,
                         bool bFormatToTextAttributes = true );
 
-    enum GetTextAttrMode {
-        DEFAULT,    /// DEFAULT: (Start <= nIndex <  End)
-        EXPAND,     /// EXPAND : (Start <  nIndex <= End)
-        PARENT,     /// PARENT : (Start <  nIndex <  End)
-    };
-
     /** get the innermost text attribute covering position nIndex.
         @param nWhich   only attribute with this id is returned.
         @param eMode    the predicate for matching (@see GetTextAttrMode).
@@ -398,7 +392,7 @@ public:
     SwTextAttr *GetTextAttrAt(
         sal_Int32 const nIndex,
         sal_uInt16 const nWhich,
-        enum GetTextAttrMode const eMode = DEFAULT ) const;
+        ::sw::GetTextAttrMode const eMode = ::sw::GetTextAttrMode::Default) 
const;
 
     /** get the innermost text attributes covering position nIndex.
         @param nWhich   only attributes with this id are returned.
@@ -429,7 +423,7 @@ public:
 
     SwTextField* GetFieldTextAttrAt(
         const sal_Int32 nIndex,
-        const bool bIncludeInputFieldAtStart = false ) const;
+        ::sw::GetTextAttrMode const eMode = ::sw::GetTextAttrMode::Expand) 
const;
 
     bool Spell(SwSpellArgs*);
     bool Convert( SwConversionArgs & );
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index 857165217237..55ed0c22240d 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -156,6 +156,16 @@ namespace o3tl
     template<> struct typed_flags<SetAttrMode> : is_typed_flags<SetAttrMode, 
0x1ff> {};
 }
 
+namespace sw {
+
+enum class GetTextAttrMode {
+    Default,    /// DEFAULT: (Start <= nIndex <  End)
+    Expand,     /// EXPAND : (Start <  nIndex <= End)
+    Parent,     /// PARENT : (Start <  nIndex <  End)
+};
+
+} // namespace sw
+
 constexpr bool SW_ISPRINTABLE(sal_Unicode c) { return c >= ' ' && 127 != c; }
 
 #define CHAR_HARDBLANK      u'\x00A0'
diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx
index 510bcbb92284..f9a95640e865 100644
--- a/sw/qa/core/txtnode/txtnode.cxx
+++ b/sw/qa/core/txtnode/txtnode.cxx
@@ -283,8 +283,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testPictureContentControlKeyboard)
     const SwFormatAnchor& rFormatAnchor = pFlyFormat->GetAnchor();
     const SwPosition* pAnchorPos = rFormatAnchor.GetContentAnchor();
     SwTextNode* pTextNode = pAnchorPos->GetNode().GetTextNode();
-    SwTextAttr* pAttr = pTextNode->GetTextAttrAt(pAnchorPos->GetContentIndex(),
-                                                 RES_TXTATR_CONTENTCONTROL, 
SwTextNode::PARENT);
+    SwTextAttr* pAttr = pTextNode->GetTextAttrAt(
+        pAnchorPos->GetContentIndex(), RES_TXTATR_CONTENTCONTROL, 
::sw::GetTextAttrMode::Parent);
     auto pTextContentControl = 
static_txtattr_cast<SwTextContentControl*>(pAttr);
     auto& rFormatContentControl
         = static_cast<SwFormatContentControl&>(pTextContentControl->GetAttr());
diff --git a/sw/source/core/crsr/annotationmark.cxx 
b/sw/source/core/crsr/annotationmark.cxx
index d8d048be0c98..28e0bcf85b24 100644
--- a/sw/source/core/crsr/annotationmark.cxx
+++ b/sw/source/core/crsr/annotationmark.cxx
@@ -54,7 +54,7 @@ namespace sw::mark
         SwTextNode *pTextNode = GetMarkEnd().GetNode().GetTextNode();
         assert(pTextNode);
         SwTextField *const pTextField = pTextNode->GetFieldTextAttrAt(
-            GetMarkEnd().GetContentIndex()-1, true);
+            GetMarkEnd().GetContentIndex()-1, ::sw::GetTextAttrMode::Default);
         assert(pTextField != nullptr);
         auto pPostItField
             = dynamic_cast<const 
SwPostItField*>(pTextField->GetFormatField().GetField());
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index b2e432d53965..4b07f24a2234 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -730,7 +730,7 @@ bool SwCursorShell::MoveFieldType(
         SwTextNode* pTNd = rPos.GetNode().GetTextNode();
         OSL_ENSURE( pTNd, "No ContentNode" );
 
-        SwTextField * pTextField = pTNd->GetFieldTextAttrAt( 
rPos.GetContentIndex(), true );
+        SwTextField * pTextField = 
pTNd->GetFieldTextAttrAt(rPos.GetContentIndex(), 
::sw::GetTextAttrMode::Default);
         const bool bDelField = ( pTextField == nullptr );
         sal_Int32 nContentOffset = -1;
 
@@ -893,14 +893,14 @@ bool SwCursorShell::GotoFormatField( const SwFormatField& 
rField )
 
 SwTextField * SwCursorShell::GetTextFieldAtPos(
     const SwPosition* pPos,
-    const bool bIncludeInputFieldAtStart )
+    ::sw::GetTextAttrMode const eMode)
 {
     SwTextField* pTextField = nullptr;
 
     SwTextNode * const pNode = pPos->GetNode().GetTextNode();
     if ( pNode != nullptr )
     {
-        pTextField = pNode->GetFieldTextAttrAt( pPos->GetContentIndex(), 
bIncludeInputFieldAtStart );
+        pTextField = pNode->GetFieldTextAttrAt(pPos->GetContentIndex(), eMode);
     }
 
     return pTextField;
@@ -908,9 +908,9 @@ SwTextField * SwCursorShell::GetTextFieldAtPos(
 
 SwTextField* SwCursorShell::GetTextFieldAtCursor(
     const SwPaM* pCursor,
-    const bool bIncludeInputFieldAtStart )
+    ::sw::GetTextAttrMode const eMode)
 {
-    SwTextField* pTextField = GetTextFieldAtPos( pCursor->Start(), 
bIncludeInputFieldAtStart );
+    SwTextField* pTextField = GetTextFieldAtPos(pCursor->Start(), eMode);
     if ( !pTextField
         || pCursor->Start()->GetNode() != pCursor->End()->GetNode() )
         return nullptr;
@@ -932,7 +932,8 @@ SwField* SwCursorShell::GetFieldAtCursor(
     const SwPaM *const pCursor,
     const bool bIncludeInputFieldAtStart)
 {
-    SwTextField *const pField(GetTextFieldAtCursor(pCursor, 
bIncludeInputFieldAtStart));
+    SwTextField *const pField(GetTextFieldAtCursor(pCursor,
+        bIncludeInputFieldAtStart ? ::sw::GetTextAttrMode::Default : 
::sw::GetTextAttrMode::Expand));
     return pField
         ? const_cast<SwField*>(pField->GetFormatField().GetField())
         : nullptr;
@@ -963,7 +964,7 @@ bool SwCursorShell::CursorInsideInputField() const
 {
     for(SwPaM& rCursor : GetCursor()->GetRingContainer())
     {
-        if (dynamic_cast<const 
SwTextInputField*>(GetTextFieldAtCursor(&rCursor, true)))
+        if (dynamic_cast<const 
SwTextInputField*>(GetTextFieldAtCursor(&rCursor, 
::sw::GetTextAttrMode::Parent)))
             return true;
     }
     return false;
@@ -981,7 +982,7 @@ SwTextContentControl* 
SwCursorShell::CursorInsideContentControl() const
         }
 
         sal_Int32 nIndex = pStart->GetContentIndex();
-        if (SwTextAttr* pAttr = pTextNode->GetTextAttrAt(nIndex, 
RES_TXTATR_CONTENTCONTROL, SwTextNode::PARENT))
+        if (SwTextAttr* pAttr = pTextNode->GetTextAttrAt(nIndex, 
RES_TXTATR_CONTENTCONTROL, ::sw::GetTextAttrMode::Parent))
         {
             return static_txtattr_cast<SwTextContentControl*>(pAttr);
         }
@@ -992,7 +993,7 @@ SwTextContentControl* 
SwCursorShell::CursorInsideContentControl() const
 
 bool SwCursorShell::PosInsideInputField( const SwPosition& rPos )
 {
-    return dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos( &rPos, 
false )) != nullptr;
+    return dynamic_cast<const SwTextInputField*>(GetTextFieldAtPos(&rPos, 
::sw::GetTextAttrMode::Parent)) != nullptr;
 }
 
 bool SwCursorShell::DocPtInsideInputField( const Point& rDocPt ) const
@@ -1008,7 +1009,7 @@ bool SwCursorShell::DocPtInsideInputField( const Point& 
rDocPt ) const
 
 sal_Int32 SwCursorShell::StartOfInputFieldAtPos( const SwPosition& rPos )
 {
-    const SwTextInputField* pTextInputField = dynamic_cast<const 
SwTextInputField*>(GetTextFieldAtPos( &rPos, true ));
+    const SwTextInputField* pTextInputField = dynamic_cast<const 
SwTextInputField*>(GetTextFieldAtPos(&rPos, ::sw::GetTextAttrMode::Default));
     assert(pTextInputField != nullptr
         && "<SwEditShell::StartOfInputFieldAtPos(..)> - no Input Field at 
given position");
     return pTextInputField->GetStart();
@@ -1016,7 +1017,7 @@ sal_Int32 SwCursorShell::StartOfInputFieldAtPos( const 
SwPosition& rPos )
 
 sal_Int32 SwCursorShell::EndOfInputFieldAtPos( const SwPosition& rPos )
 {
-    const SwTextInputField* pTextInputField = dynamic_cast<const 
SwTextInputField*>(GetTextFieldAtPos( &rPos, true ));
+    const SwTextInputField* pTextInputField = dynamic_cast<const 
SwTextInputField*>(GetTextFieldAtPos(&rPos, ::sw::GetTextAttrMode::Default));
     assert(pTextInputField != nullptr
         && "<SwEditShell::EndOfInputFieldAtPos(..)> - no Input Field at given 
position");
     return *(pTextInputField->End());
@@ -1497,7 +1498,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
             if (!bRet && rContentAtPos.eContentAtPos & 
IsAttrAtPos::ContentControl)
             {
                 SwTextAttr* pAttr = pTextNd->GetTextAttrAt(
-                    aPos.GetContentIndex(), RES_TXTATR_CONTENTCONTROL, 
SwTextNode::PARENT);
+                    aPos.GetContentIndex(), RES_TXTATR_CONTENTCONTROL, 
::sw::GetTextAttrMode::Parent);
                 if (pAttr)
                 {
                     rContentAtPos.eContentAtPos = IsAttrAtPos::ContentControl;
@@ -2112,7 +2113,7 @@ bool SwCursorShell::SelectTextAttr( sal_uInt16 nWhich,
         pTextAttr = pTextNd
             ? pTextNd->GetTextAttrAt(rPos.GetContentIndex(),
                     nWhich,
-                    bExpand ? SwTextNode::EXPAND : SwTextNode::DEFAULT)
+                    bExpand ? ::sw::GetTextAttrMode::Expand : 
::sw::GetTextAttrMode::Default)
             : nullptr;
     }
     if( !pTextAttr )
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index a00ccc8224ef..c2f28270eb14 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -977,7 +977,7 @@ bool SwPaM::HasReadonlySel(bool bFormView, bool const 
isReplace) const
         {
             sal_Int32 nIndex = pStart->GetContentIndex();
             SwTextAttr* pAttr
-                = pTextNode->GetTextAttrAt(nIndex, RES_TXTATR_CONTENTCONTROL, 
SwTextNode::PARENT);
+                = pTextNode->GetTextAttrAt(nIndex, RES_TXTATR_CONTENTCONTROL, 
::sw::GetTextAttrMode::Parent);
             auto pTextContentControl = 
static_txtattr_cast<SwTextContentControl*>(pAttr);
             if (pTextContentControl)
             {
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 1a50bb2d8dd4..566b225c7e61 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -215,7 +215,7 @@ namespace
         SwTextNode* pTextNd = pPos->GetNode().GetTextNode();
         if (!pTextNd)
             return nullptr;
-        return pTextNd->GetTextAttrAt(pPos->GetContentIndex(), 
RES_TXTATR_INPUTFIELD, SwTextNode::PARENT);
+        return pTextNd->GetTextAttrAt(pPos->GetContentIndex(), 
RES_TXTATR_INPUTFIELD, ::sw::GetTextAttrMode::Parent);
     }
 }
 
@@ -1841,7 +1841,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, 
SwCursorSkipMode nMode,
             SwTextNode const*const pNode(GetPoint()->GetNode().GetTextNode());
             assert(pNode);
             SwTextAttr const*const pInputField(pNode->GetTextAttrAt(
-                GetPoint()->GetContentIndex(), RES_TXTATR_INPUTFIELD, 
SwTextNode::PARENT));
+                GetPoint()->GetContentIndex(), RES_TXTATR_INPUTFIELD, 
::sw::GetTextAttrMode::Parent));
             if (pInputField)
             {
                 continue; // skip over input fields
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 2ef5f4b25e8f..3ea1fdfc9536 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -578,7 +578,7 @@ void SwSelPaintRects::HighlightInputField()
     if (m_bShowTextInputFieldOverlay)
     {
         SwTextInputField* pCurTextInputFieldAtCursor =
-            dynamic_cast<SwTextInputField*>(SwCursorShell::GetTextFieldAtPos( 
GetShell()->GetCursor()->Start(), false ));
+            dynamic_cast<SwTextInputField*>(SwCursorShell::GetTextFieldAtPos( 
GetShell()->GetCursor()->Start(), ::sw::GetTextAttrMode::Expand));
         if ( pCurTextInputFieldAtCursor != nullptr )
         {
             SwTextNode* pTextNode = pCurTextInputFieldAtCursor->GetpTextNode();
@@ -644,10 +644,10 @@ void SwSelPaintRects::HighlightContentControl()
         SwTextContentControl* pCurContentControlAtCursor = nullptr;
         if (pTextNode)
         {
-            // SwTextNode::PARENT because this way we highlight when the user 
will type inside the
+            // GetTextAttrMode::Parent because this way we highlight when the 
user will type inside the
             // content control, not outside of it.
             SwTextAttr* pAttr = pTextNode->GetTextAttrAt(
-                pStart->GetContentIndex(), RES_TXTATR_CONTENTCONTROL, 
SwTextNode::PARENT);
+                pStart->GetContentIndex(), RES_TXTATR_CONTENTCONTROL, 
::sw::GetTextAttrMode::Parent);
             if (pAttr)
             {
                 pCurContentControlAtCursor = 
static_txtattr_cast<SwTextContentControl*>(pAttr);
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx 
b/sw/source/core/doc/DocumentFieldsManager.cxx
index a0eb50754f0c..334b7edd1580 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1726,7 +1726,7 @@ SwTextField * 
DocumentFieldsManager::GetTextFieldAtPos(const SwPosition & rPos)
     SwTextNode * const pNode = rPos.GetNode().GetTextNode();
 
     return (pNode != nullptr)
-        ? pNode->GetFieldTextAttrAt( rPos.GetContentIndex(), true )
+        ? pNode->GetFieldTextAttrAt(rPos.GetContentIndex(), 
::sw::GetTextAttrMode::Default)
         : nullptr;
 }
 
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index ba94076c7b2e..ebf4e7cc4f3e 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1994,7 +1994,7 @@ OUString SwRangeRedline::GetDescr(bool bSimplified)
     OUString sDescr = DenoteSpecialCharacters(pPaM->GetText().replace('\n', ' 
'), /*bQuoted=*/!bSimplified);
     if (const SwTextNode *pTextNode = pPaM->GetPointNode().GetTextNode())
     {
-        if (const SwTextAttr* pTextAttr = 
pTextNode->GetFieldTextAttrAt(pPaM->GetPoint()->GetContentIndex() - 1, true ))
+        if (const SwTextAttr* pTextAttr = 
pTextNode->GetFieldTextAttrAt(pPaM->GetPoint()->GetContentIndex() - 1, 
::sw::GetTextAttrMode::Default))
         {
             sDescr = ( bSimplified ? "" : SwResId(STR_START_QUOTE) )
                 + pTextAttr->GetFormatField().GetField()->GetFieldName()
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 9bd2ba252a2f..19a8a690b50b 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -215,7 +215,7 @@ void SwEditShell::UpdateOneField(SwField &rField)
 
         if ( !pCursor->IsMultiSelection() && !pCursor->HasMark())
         {
-            pTextField = GetTextFieldAtPos( pCursor->Start(), true );
+            pTextField = GetTextFieldAtPos(pCursor->Start(), 
::sw::GetTextAttrMode::Default);
 
             if (!pTextField) // #i30221#
                 pTextField = lcl_FindInputField( GetDoc(), rField);
@@ -260,7 +260,7 @@ void SwEditShell::UpdateOneField(SwField &rField)
                     if( aPam.Start()->nContent != pCurStt->nContent )
                         bOkay = false;
 
-                    pTextField = GetTextFieldAtPos( pCurStt, true );
+                    pTextField = GetTextFieldAtPos(pCurStt, 
::sw::GetTextAttrMode::Default);
                     if( nullptr != pTextField )
                     {
                         pFormatField = 
const_cast<SwFormatField*>(&pTextField->GetFormatField());
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index d40220bc631f..7fce8802948b 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -1390,7 +1390,7 @@ void SwFlyAtContentFrame::SetAbsPos( const Point &rNew )
             {
                 const SwTextAttr *const pTextInputField =
                     pos.GetNode().GetTextNode()->GetTextAttrAt(
-                        pos.GetContentIndex(), RES_TXTATR_INPUTFIELD, 
SwTextNode::PARENT );
+                        pos.GetContentIndex(), RES_TXTATR_INPUTFIELD, 
::sw::GetTextAttrMode::Parent);
                 if (pTextInputField != nullptr)
                 {
                     pos.nContent = pTextInputField->GetStart();
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 20855df95956..700669f3d2e2 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1159,7 +1159,7 @@ SwTextPortion *SwTextFormatter::WhichTextPor( 
SwTextFormatInfo &rInf ) const
             if (pTextNode)
             {
                 sal_Int32 nIndex = aPosition.GetContentIndex();
-                if (SwTextAttr* pAttr = pTextNode->GetTextAttrAt(nIndex, 
RES_TXTATR_CONTENTCONTROL, SwTextNode::PARENT))
+                if (SwTextAttr* pAttr = pTextNode->GetTextAttrAt(nIndex, 
RES_TXTATR_CONTENTCONTROL, ::sw::GetTextAttrMode::Parent))
                 {
                     pTextContentControl = 
static_txtattr_cast<SwTextContentControl*>(pAttr);
                 }
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 12f0a219a8bd..18c649b33996 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1711,7 +1711,7 @@ lcl_GetTextAttrs(
     SwTextAttr **const ppTextAttr,
     SwpHints const *const pSwpHints,
     sal_Int32 const nIndex, sal_uInt16 const nWhich,
-    enum SwTextNode::GetTextAttrMode const eMode)
+    ::sw::GetTextAttrMode const eMode)
 {
     assert(nWhich >= RES_TXTATR_BEGIN && nWhich < RES_TXTATR_END);
     if (!pSwpHints)
@@ -1721,9 +1721,12 @@ lcl_GetTextAttrs(
     bool (*pMatchFunc)(sal_Int32, sal_Int32, sal_Int32)=nullptr;
     switch (eMode)
     {
-        case SwTextNode::DEFAULT:   pMatchFunc = &lcl_GetTextAttrDefault; 
break;
-        case SwTextNode::EXPAND:    pMatchFunc = &lcl_GetTextAttrExpand;  
break;
-        case SwTextNode::PARENT:    pMatchFunc = &lcl_GetTextAttrParent;  
break;
+        case ::sw::GetTextAttrMode::Default: pMatchFunc = 
&lcl_GetTextAttrDefault;
+        break;
+        case ::sw::GetTextAttrMode::Expand:  pMatchFunc = 
&lcl_GetTextAttrExpand;
+        break;
+        case ::sw::GetTextAttrMode::Parent:  pMatchFunc = 
&lcl_GetTextAttrParent;
+        break;
         default: assert(false);
     }
 
@@ -1773,13 +1776,13 @@ SwTextNode::GetTextAttrsAt(sal_Int32 const nIndex, 
sal_uInt16 const nWhich) cons
 {
     assert(nWhich >= RES_TXTATR_BEGIN && nWhich < RES_TXTATR_END);
     std::vector<SwTextAttr *> ret;
-    lcl_GetTextAttrs(&ret, nullptr, m_pSwpHints.get(), nIndex, nWhich, 
DEFAULT);
+    lcl_GetTextAttrs(&ret, nullptr, m_pSwpHints.get(), nIndex, nWhich, 
::sw::GetTextAttrMode::Default);
     return ret;
 }
 
 SwTextAttr *
 SwTextNode::GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich,
-                        enum GetTextAttrMode const eMode) const
+        ::sw::GetTextAttrMode const eMode) const
 {
     assert(    (nWhich == RES_TXTATR_META)
             || (nWhich == RES_TXTATR_METAFIELD)
@@ -1798,11 +1801,11 @@ SwTextNode::GetTextAttrAt(sal_Int32 const nIndex, 
sal_uInt16 const nWhich,
 
 const SwTextInputField* SwTextNode::GetOverlappingInputField( const 
SwTextAttr& rTextAttr ) const
 {
-    const SwTextInputField* pTextInputField = dynamic_cast<const 
SwTextInputField*>(GetTextAttrAt( rTextAttr.GetStart(), RES_TXTATR_INPUTFIELD, 
PARENT ));
+    const SwTextInputField* pTextInputField = dynamic_cast<const 
SwTextInputField*>(GetTextAttrAt(rTextAttr.GetStart(), RES_TXTATR_INPUTFIELD, 
::sw::GetTextAttrMode::Parent));
 
     if ( pTextInputField == nullptr && rTextAttr.End() != nullptr )
     {
-        pTextInputField = dynamic_cast<const SwTextInputField*>(GetTextAttrAt( 
*(rTextAttr.End()), RES_TXTATR_INPUTFIELD, PARENT ));
+        pTextInputField = dynamic_cast<const 
SwTextInputField*>(GetTextAttrAt(*(rTextAttr.End()), RES_TXTATR_INPUTFIELD, 
::sw::GetTextAttrMode::Parent));
     }
 
     return pTextInputField;
@@ -1825,7 +1828,7 @@ void SwTextNode::DelFrames_TextNodePart()
 
 SwTextField* SwTextNode::GetFieldTextAttrAt(
     const sal_Int32 nIndex,
-    const bool bIncludeInputFieldAtStart ) const
+    ::sw::GetTextAttrMode const eMode) const
 {
     SwTextField* pTextField = dynamic_cast<SwTextField*>(GetTextAttrForCharAt( 
nIndex, RES_TXTATR_FIELD ));
     if ( pTextField == nullptr )
@@ -1838,7 +1841,7 @@ SwTextField* SwTextNode::GetFieldTextAttrAt(
             dynamic_cast<SwTextField*>( GetTextAttrAt(
                 nIndex,
                 RES_TXTATR_INPUTFIELD,
-                bIncludeInputFieldAtStart ? DEFAULT : EXPAND ));
+                eMode));
     }
 
     return pTextField;
@@ -3145,7 +3148,7 @@ SwTextAttr * SwTextNode::GetTextAttrForCharAt(
 
 SwTextAttr* SwTextNode::GetTextAttrForEndCharAt(sal_Int32 nIndex, sal_uInt16 
nWhich) const
 {
-    SwTextAttr* pAttr = GetTextAttrAt(nIndex, nWhich, SwTextNode::EXPAND);
+    SwTextAttr* pAttr = GetTextAttrAt(nIndex, nWhich, 
::sw::GetTextAttrMode::Expand);
     if (!pAttr)
     {
         return nullptr;
diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index e7434b6fe4e6..0ea2a3e8aecc 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1688,7 +1688,7 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, 
const SetAttrMode nMode )
         // Handle the invariant that a plain text content control has the same 
character formatting
         // for all of its content.
         auto* pTextContentControl = static_txtattr_cast<SwTextContentControl*>(
-            GetTextAttrAt(pAttr->GetStart(), RES_TXTATR_CONTENTCONTROL, 
PARENT));
+            GetTextAttrAt(pAttr->GetStart(), RES_TXTATR_CONTENTCONTROL, 
::sw::GetTextAttrMode::Parent));
         if (pTextContentControl)
         {
             auto& rFormatContentControl
diff --git a/sw/source/core/txtnode/txtedt.cxx 
b/sw/source/core/txtnode/txtedt.cxx
index 30ea67277ab8..da25a9b97d59 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -380,10 +380,10 @@ void SwTextNode::RstTextAttr(
     sal_Int32 nEnd = nStt + nLen;
     {
         // enlarge range for the reset of text attributes in case of an 
overlapping input field
-        const SwTextInputField* pTextInputField = dynamic_cast<const 
SwTextInputField*>(GetTextAttrAt( nStt, RES_TXTATR_INPUTFIELD, PARENT ));
+        const SwTextInputField* pTextInputField = dynamic_cast<const 
SwTextInputField*>(GetTextAttrAt(nStt, RES_TXTATR_INPUTFIELD, 
::sw::GetTextAttrMode::Parent));
         if ( pTextInputField == nullptr )
         {
-            pTextInputField = dynamic_cast<const 
SwTextInputField*>(GetTextAttrAt(nEnd, RES_TXTATR_INPUTFIELD, PARENT ));
+            pTextInputField = dynamic_cast<const 
SwTextInputField*>(GetTextAttrAt(nEnd, RES_TXTATR_INPUTFIELD, 
::sw::GetTextAttrMode::Parent));
         }
         if ( pTextInputField != nullptr )
         {
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index 2148b6cfb3fb..24b9e6883c63 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -279,8 +279,8 @@ GetNestedTextContent(SwTextNode const & rTextNode, 
sal_Int32 const nIndex,
         bool const bParent)
 {
     // these should be unambiguous because of the dummy character
-    SwTextNode::GetTextAttrMode const eMode( bParent
-        ? SwTextNode::PARENT : SwTextNode::EXPAND );
+    auto const eMode( bParent
+        ? ::sw::GetTextAttrMode::Parent : ::sw::GetTextAttrMode::Expand );
     SwTextAttr *const pMetaTextAttr =
         rTextNode.GetTextAttrAt(nIndex, RES_TXTATR_META, eMode);
     SwTextAttr *const pMetaFieldTextAttr =
@@ -580,7 +580,7 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& 
rEntry
             const SwTextNode *pTextNd =
                 rPam.GetDoc().GetNodes()[pPos->GetNodeIndex()]->GetTextNode();
             const SwTextAttr* pTextAttr = pTextNd
-                ? pTextNd->GetFieldTextAttrAt( pPos->GetContentIndex(), true )
+                ? pTextNd->GetFieldTextAttrAt(pPos->GetContentIndex(), 
::sw::GetTextAttrMode::Default)
                 : nullptr;
             if ( pTextAttr != nullptr )
             {
@@ -1028,13 +1028,13 @@ void InsertFile(SwUnoCursor* pUnoCursor, const 
OUString& rURL,
     {
         // TODO: check meta field here too in case it ever grows a 2nd char
         if (pTextNode->GetTextAttrAt(pUnoCursor->GetPoint()->GetContentIndex(),
-                    RES_TXTATR_INPUTFIELD, SwTextNode::PARENT))
+                RES_TXTATR_INPUTFIELD, ::sw::GetTextAttrMode::Parent))
         {
             throw uno::RuntimeException("cannot insert file inside input 
field");
         }
 
         if (pTextNode->GetTextAttrAt(pUnoCursor->GetPoint()->GetContentIndex(),
-                                     RES_TXTATR_CONTENTCONTROL, 
SwTextNode::PARENT))
+                RES_TXTATR_CONTENTCONTROL, ::sw::GetTextAttrMode::Parent))
         {
             throw uno::RuntimeException("cannot insert file inside content 
controls");
         }
diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index 7849c96229cc..2785d95b2224 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1285,7 +1285,7 @@ void 
SwXTextField::TransmuteLeadToInputField(SwSetExpField & rField)
     bool bSuccess = rIDCO.InsertPoolItem(*pPamForTextField, tempFormat);
     assert(bSuccess);
     (void) bSuccess;
-    SwTextField const* pNewAttr(rNode.GetFieldTextAttrAt(nStart, true));
+    SwTextField const* pNewAttr(rNode.GetFieldTextAttrAt(nStart, 
::sw::GetTextAttrMode::Default));
     assert(pNewAttr);
     SwFormatField const& rNewFormat(pNewAttr->GetFormatField());
     assert(rNewFormat.Which() == (static_cast<SwSetExpField 
const*>(rNewFormat.GetField())->GetInputFlag() ? RES_TXTATR_INPUTFIELD : 
RES_TXTATR_FIELD));
@@ -1961,7 +1961,7 @@ void SAL_CALL SwXTextField::attach(
         else
             pDoc->getIDocumentContentOperations().InsertPoolItem(aPam, 
aFormat, nInsertFlags);
 
-        SwTextAttr* pTextAttr = 
aPam.GetPointNode().GetTextNode()->GetFieldTextAttrAt( 
aPam.GetPoint()->GetContentIndex()-1, true );
+        SwTextAttr* pTextAttr = 
aPam.GetPointNode().GetTextNode()->GetFieldTextAttrAt(aPam.GetPoint()->GetContentIndex()-1,
 ::sw::GetTextAttrMode::Default);
 
         // What about updating the fields? (see fldmgr.cxx)
         if (!pTextAttr)
@@ -2025,7 +2025,7 @@ void SAL_CALL SwXTextField::attach(
             }
             // keep inserted annotation
             {
-                SwTextField* pTextAttr = 
aEnd.GetPointNode().GetTextNode()->GetFieldTextAttrAt( 
aEnd.End()->GetContentIndex()-1, true );
+                SwTextField *const pTextAttr = 
aEnd.GetPointNode().GetTextNode()->GetFieldTextAttrAt(aEnd.End()->GetContentIndex()-1,
 ::sw::GetTextAttrMode::Default);
                 if ( pTextAttr != nullptr )
                 {
                     
m_pImpl->SetFormatField(const_cast<SwFormatField*>(&pTextAttr->GetFormatField()),
 m_pImpl->m_pDoc);
diff --git a/sw/source/filter/basflt/fltshell.cxx 
b/sw/source/filter/basflt/fltshell.cxx
index 75ef5d5c36b4..fbfec5eaeccf 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -590,7 +590,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& 
rTmpPos,
                 SwTextNode const*const pTextNode(
                         aRegion.End()->GetNode().GetTextNode());
                 SwTextField const*const pField = pTextNode ? 
pTextNode->GetFieldTextAttrAt(
-                        aRegion.End()->GetContentIndex() - 1, true) : nullptr;
+                        aRegion.End()->GetContentIndex() - 1, 
::sw::GetTextAttrMode::Default) : nullptr;
                 if (pField)
                 {
                     SwPostItField const*const pPostIt(
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 501d347dc932..16af1afc910a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1769,7 +1769,7 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, 
sal_Int32 nPos, sal_In
 
     if (nLen != -1)
     {
-        SwTextAttr* pAttr = pNode->GetTextAttrAt(nPos, 
RES_TXTATR_CONTENTCONTROL, SwTextNode::DEFAULT);
+        SwTextAttr* pAttr = pNode->GetTextAttrAt(nPos, 
RES_TXTATR_CONTENTCONTROL, ::sw::GetTextAttrMode::Default);
         if (pAttr && pAttr->GetStart() == nPos)
         {
             auto pTextContentControl = 
static_txtattr_cast<SwTextContentControl*>(pAttr);
@@ -1799,7 +1799,7 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, 
sal_Int32 nPos, sal_In
     if (nLen != -1)
     {
         sal_Int32 nEnd = nPos + nLen;
-        SwTextAttr* pAttr = pNode->GetTextAttrAt(nPos, 
RES_TXTATR_CONTENTCONTROL, SwTextNode::DEFAULT);
+        SwTextAttr* pAttr = pNode->GetTextAttrAt(nPos, 
RES_TXTATR_CONTENTCONTROL, ::sw::GetTextAttrMode::Default);
         if (pAttr && *pAttr->GetEnd() == nEnd)
         {
             WriteContentControlEnd();
diff --git a/sw/source/ui/misc/contentcontroldlg.cxx 
b/sw/source/ui/misc/contentcontroldlg.cxx
index ef636388cc39..11fe590f0413 100644
--- a/sw/source/ui/misc/contentcontroldlg.cxx
+++ b/sw/source/ui/misc/contentcontroldlg.cxx
@@ -78,8 +78,8 @@ SwContentControlDlg::SwContentControlDlg(weld::Window* 
pParent, SwWrtShell& rWrt
         return;
     }
 
-    SwTextAttr* pAttr = pTextNode->GetTextAttrAt(pStart->GetContentIndex(),
-                                                 RES_TXTATR_CONTENTCONTROL, 
SwTextNode::PARENT);
+    SwTextAttr* pAttr = pTextNode->GetTextAttrAt(
+        pStart->GetContentIndex(), RES_TXTATR_CONTENTCONTROL, 
::sw::GetTextAttrMode::Parent);
     if (!pAttr)
     {
         return;
diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 66145652c6d7..1ceb7d70f827 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -1559,7 +1559,7 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
             if (pTextNode)
             {
                 SwTextAttr* pAttr = pTextNode->GetTextAttrAt(
-                    pAnchorPos->GetContentIndex(), RES_TXTATR_CONTENTCONTROL, 
SwTextNode::PARENT);
+                    pAnchorPos->GetContentIndex(), RES_TXTATR_CONTENTCONTROL, 
::sw::GetTextAttrMode::Parent);
                 if (pAttr)
                 {
                     SwTextContentControl* pTextContentControl
@@ -2475,7 +2475,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
                 if (pTextNode)
                 {
                     sal_Int32 nIndex = pStart->GetContentIndex();
-                    SwTextAttr* pAttr = pTextNode->GetTextAttrAt(nIndex, 
RES_TXTATR_CONTENTCONTROL, SwTextNode::PARENT);
+                    SwTextAttr* pAttr = pTextNode->GetTextAttrAt(nIndex, 
RES_TXTATR_CONTENTCONTROL, ::sw::GetTextAttrMode::Parent);
                     if (pAttr)
                     {
                         auto pTextContentControl = 
static_txtattr_cast<SwTextContentControl*>(pAttr);
@@ -4800,7 +4800,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
                                 {
                                     SwTextAttr* pAttr = 
pTextNode->GetTextAttrAt(
                                         pAnchorPos->GetContentIndex(), 
RES_TXTATR_CONTENTCONTROL,
-                                        SwTextNode::PARENT);
+                                        ::sw::GetTextAttrMode::Parent);
                                     if (pAttr)
                                     {
                                         SwTextContentControl* 
pTextContentControl
diff --git a/sw/source/uibase/shells/textfld.cxx 
b/sw/source/uibase/shells/textfld.cxx
index d06acdcfb730..344a246747e1 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -177,7 +177,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
                     rSh.ClearMark();
                     if (!rSh.IsMultiSelection()
                         && (nullptr != dynamic_cast<const SwTextInputField*>(
-                               
SwCursorShell::GetTextFieldAtCursor(rSh.GetCursor(), true))))
+                               
SwCursorShell::GetTextFieldAtCursor(rSh.GetCursor(), 
::sw::GetTextAttrMode::Default))))
                     {
                         rSh.SttSelect();
                         rSh.SelectTextModel(
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 502e1997c90e..6b49898d7c1b 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3386,7 +3386,7 @@ void SwXTextDocument::executeContentControlEvent(const 
StringMap& rArguments)
         }
 
         SwTextAttr* pAttr = pTextNode->GetTextAttrAt(pStart->GetContentIndex(),
-                                                     
RES_TXTATR_CONTENTCONTROL, SwTextNode::PARENT);
+                                                     
RES_TXTATR_CONTENTCONTROL, ::sw::GetTextAttrMode::Parent);
         if (!pAttr)
         {
             return;
@@ -3440,7 +3440,7 @@ void SwXTextDocument::executeContentControlEvent(const 
StringMap& rArguments)
         }
 
         SwTextAttr* pAttr = pTextNode->GetTextAttrAt(pStart->GetContentIndex(),
-                                                     
RES_TXTATR_CONTENTCONTROL, SwTextNode::PARENT);
+                                                     
RES_TXTATR_CONTENTCONTROL, ::sw::GetTextAttrMode::Parent);
         if (!pAttr)
         {
             return;
diff --git a/sw/source/uibase/wrtsh/delete.cxx 
b/sw/source/uibase/wrtsh/delete.cxx
index 4351f6f6acbb..2a6038d6d9a6 100644
--- a/sw/source/uibase/wrtsh/delete.cxx
+++ b/sw/source/uibase/wrtsh/delete.cxx
@@ -495,7 +495,7 @@ bool SwWrtShell::DelRight(bool const isReplaceHeuristic)
                 if (pTextNode)
                 {
                     const SwTextField* pField(
-                        
pTextNode->GetFieldTextAttrAt(oAnchor->GetContentIndex(), true));
+                        
pTextNode->GetFieldTextAttrAt(oAnchor->GetContentIndex(), 
::sw::GetTextAttrMode::Default));
                     if (pField
                         && dynamic_cast<const 
SwPostItField*>(pField->GetFormatField().GetField()))
                     {

Reply via email to