diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-09-27 16:32:51 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-10-04 17:21:22 +0200 |
commit | bba3ccf1270a2e851f718c7045187a388cc8532b (patch) | |
tree | 60ae560bb01a2ffe06db7a5306fa0a6b3a70b2c2 /sw | |
parent | 5088d4050d5997265ac52322afbc7bf69ab03b04 (diff) |
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.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140661
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 70973680f05c587c866d2de2a16bff9ebf8007ca)
Change-Id: I1a0ef4e3d93a6733d972544abfe07ddf929eb62c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140699
Tested-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/crsrsh.hxx | 4 | ||||
-rw-r--r-- | sw/inc/ndtxt.hxx | 10 | ||||
-rw-r--r-- | sw/inc/swtypes.hxx | 10 | ||||
-rw-r--r-- | sw/source/core/crsr/annotationmark.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/crsr/crstrvl.cxx | 23 | ||||
-rw-r--r-- | sw/source/core/crsr/swcrsr.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/crsr/viscrs.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentFieldsManager.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/edit/edfld.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/layout/flycnt.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndtxt.cxx | 23 | ||||
-rw-r--r-- | sw/source/core/txtnode/txtedt.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unocrsrhelper.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unofield.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/basflt/fltshell.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/textfld.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/delete.cxx | 2 |
18 files changed, 60 insertions, 51 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index b6173fdee6f0..6336011add14 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -710,10 +710,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 f4612d476ac4..46f6c11b3145 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -357,12 +357,6 @@ public: bool DontExpandFormat( const SwIndex& rIdx, 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). @@ -374,7 +368,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. @@ -397,7 +391,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 03f136e2ea34..b1b8c1e9cc4b 100644 --- a/sw/inc/swtypes.hxx +++ b/sw/inc/swtypes.hxx @@ -167,6 +167,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/source/core/crsr/annotationmark.cxx b/sw/source/core/crsr/annotationmark.cxx index ea11fad3d2cc..1deeb7e1f067 100644 --- a/sw/source/core/crsr/annotationmark.cxx +++ b/sw/source/core/crsr/annotationmark.cxx @@ -54,7 +54,7 @@ namespace sw { namespace mark SwTextNode *pTextNode = GetMarkEnd().nNode.GetNode().GetTextNode(); assert(pTextNode); SwTextField *const pTextField = pTextNode->GetFieldTextAttrAt( - GetMarkEnd().nContent.GetIndex()-1, true); + GetMarkEnd().nContent.GetIndex()-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 2d5898d7f51e..0c53e6448b46 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -774,7 +774,7 @@ bool SwCursorShell::MoveFieldType( SwTextNode* pTNd = rPos.nNode.GetNode().GetTextNode(); OSL_ENSURE( pTNd, "No ContentNode" ); - SwTextField * pTextField = pTNd->GetFieldTextAttrAt( rPos.nContent.GetIndex(), true ); + SwTextField * pTextField = pTNd->GetFieldTextAttrAt(rPos.nContent.GetIndex(), ::sw::GetTextAttrMode::Default); const bool bDelField = ( pTextField == nullptr ); sal_Int32 nContentOffset = -1; @@ -878,14 +878,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->nNode.GetNode().GetTextNode(); if ( pNode != nullptr ) { - pTextField = pNode->GetFieldTextAttrAt( pPos->nContent.GetIndex(), bIncludeInputFieldAtStart ); + pTextField = pNode->GetFieldTextAttrAt( pPos->nContent.GetIndex(), eMode); } return pTextField; @@ -893,11 +893,11 @@ SwTextField * SwCursorShell::GetTextFieldAtPos( SwTextField* SwCursorShell::GetTextFieldAtCursor( const SwPaM* pCursor, - const bool bIncludeInputFieldAtStart ) + ::sw::GetTextAttrMode const eMode) { SwTextField* pFieldAtCursor = nullptr; - SwTextField* pTextField = GetTextFieldAtPos( pCursor->Start(), bIncludeInputFieldAtStart ); + SwTextField* pTextField = GetTextFieldAtPos(pCursor->Start(), eMode); if ( pTextField != nullptr && pCursor->Start()->nNode == pCursor->End()->nNode ) { @@ -918,7 +918,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; @@ -949,7 +950,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; @@ -957,7 +958,7 @@ bool SwCursorShell::CursorInsideInputField() 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 @@ -973,7 +974,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(); @@ -981,7 +982,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()); @@ -2007,7 +2008,7 @@ bool SwCursorShell::SelectTextAttr( sal_uInt16 nWhich, pTextAttr = pTextNd ? pTextNd->GetTextAttrAt(rPos.nContent.GetIndex(), nWhich, - bExpand ? SwTextNode::EXPAND : SwTextNode::DEFAULT) + bExpand ? ::sw::GetTextAttrMode::Expand : ::sw::GetTextAttrMode::Default) : nullptr; } diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 19d47dcec68e..98a3b9682442 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -210,7 +210,7 @@ namespace SwTextNode* pTextNd = pPos->nNode.GetNode().GetTextNode(); if (!pTextNd) return nullptr; - return pTextNd->GetTextAttrAt(pPos->nContent.GetIndex(), RES_TXTATR_INPUTFIELD, SwTextNode::PARENT); + return pTextNd->GetTextAttrAt(pPos->nContent.GetIndex(), RES_TXTATR_INPUTFIELD, ::sw::GetTextAttrMode::Parent); } } @@ -1790,7 +1790,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, SwTextNode const*const pNode(GetPoint()->nNode.GetNode().GetTextNode()); assert(pNode); SwTextAttr const*const pInputField(pNode->GetTextAttrAt( - GetPoint()->nContent.GetIndex(), RES_TXTATR_INPUTFIELD, SwTextNode::PARENT)); + GetPoint()->nContent.GetIndex(), 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 5aa804d364b0..4c4bbd682056 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -422,7 +422,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(); diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index b1a7c88e033c..b696734c6899 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -1754,7 +1754,7 @@ SwTextField * DocumentFieldsManager::GetTextFieldAtPos(const SwPosition & rPos) SwTextNode * const pNode = rPos.nNode.GetNode().GetTextNode(); return (pNode != nullptr) - ? pNode->GetFieldTextAttrAt( rPos.nContent.GetIndex(), true ) + ? pNode->GetFieldTextAttrAt(rPos.nContent.GetIndex(), ::sw::GetTextAttrMode::Default) : nullptr; } diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index ee8e8b23d8c0..66c6af16f4c9 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -1784,7 +1784,7 @@ OUString SwRangeRedline::GetDescr() OUString sDescr = DenoteSpecialCharacters(pPaM->GetText()); if (const SwTextNode *pTextNode = pPaM->GetNode().GetTextNode()) { - if (const SwTextAttr* pTextAttr = pTextNode->GetFieldTextAttrAt(pPaM->GetPoint()->nContent.GetIndex() - 1, true )) + if (const SwTextAttr* pTextAttr = pTextNode->GetFieldTextAttrAt(pPaM->GetPoint()->nContent.GetIndex() - 1, ::sw::GetTextAttrMode::Default)) { sDescr = 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 29365cfa263c..75364a42bd1d 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -225,7 +225,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); @@ -270,7 +270,8 @@ void SwEditShell::UpdateOneField(SwField &rField) if( aPam.Start()->nContent != pCurStt->nContent ) bOkay = false; - if( nullptr != (pTextField = GetTextFieldAtPos( pCurStt, true )) ) + pTextField = GetTextFieldAtPos(pCurStt, ::sw::GetTextAttrMode::Default); + if( nullptr != pTextField ) { pFormatField = const_cast<SwFormatField*>(&pTextField->GetFormatField()); SwField *pCurField = pFormatField->GetField(); diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index a197974d74f2..06baefd15fa7 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -1347,7 +1347,7 @@ void SwFlyAtContentFrame::SetAbsPos( const Point &rNew ) { const SwTextAttr *const pTextInputField = pos.nNode.GetNode().GetTextNode()->GetTextAttrAt( - pos.nContent.GetIndex(), RES_TXTATR_INPUTFIELD, SwTextNode::PARENT ); + pos.nContent.GetIndex(), RES_TXTATR_INPUTFIELD, ::sw::GetTextAttrMode::Parent); if (pTextInputField != nullptr) { pos.nContent = pTextInputField->GetStart(); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index f42adf2a642c..ed1e19bd5ce7 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1662,7 +1662,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) @@ -1672,9 +1672,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); } @@ -1724,13 +1727,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) @@ -1748,11 +1751,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; @@ -1775,7 +1778,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 ) @@ -1788,7 +1791,7 @@ SwTextField* SwTextNode::GetFieldTextAttrAt( dynamic_cast<SwTextField*>( GetTextAttrAt( nIndex, RES_TXTATR_INPUTFIELD, - bIncludeInputFieldAtStart ? DEFAULT : EXPAND )); + eMode)); } return pTextField; diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 5c599d78afab..73cb47930eac 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -375,10 +375,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 d7634e2a2713..9d0710cf3384 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -283,8 +283,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 = @@ -582,7 +582,7 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry const SwTextNode *pTextNd = rPam.GetDoc()->GetNodes()[pPos->nNode.GetIndex()]->GetTextNode(); const SwTextAttr* pTextAttr = pTextNd - ? pTextNd->GetFieldTextAttrAt( pPos->nContent.GetIndex(), true ) + ? pTextNd->GetFieldTextAttrAt(pPos->nContent.GetIndex(), ::sw::GetTextAttrMode::Default) : nullptr; if ( pTextAttr != nullptr ) { diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index b5b7f4e1a88e..d5061ea58658 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1327,7 +1327,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)); @@ -2011,7 +2011,7 @@ void SAL_CALL SwXTextField::attach( else pDoc->getIDocumentContentOperations().InsertPoolItem(aPam, aFormat, nInsertFlags); - SwTextAttr* pTextAttr = aPam.GetNode().GetTextNode()->GetFieldTextAttrAt( aPam.GetPoint()->nContent.GetIndex()-1, true ); + SwTextAttr* pTextAttr = aPam.GetNode().GetTextNode()->GetFieldTextAttrAt(aPam.GetPoint()->nContent.GetIndex()-1, ::sw::GetTextAttrMode::Default); // What about updating the fields? (see fldmgr.cxx) if (!pTextAttr) @@ -2075,7 +2075,7 @@ void SAL_CALL SwXTextField::attach( } // keep inserted annotation { - SwTextField* pTextAttr = aEnd.GetNode().GetTextNode()->GetFieldTextAttrAt( aEnd.End()->nContent.GetIndex()-1, true ); + SwTextField *const pTextAttr = aEnd.GetNode().GetTextNode()->GetFieldTextAttrAt(aEnd.End()->nContent.GetIndex()-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 7d96867acb00..8a94cd48d5b3 100644 --- a/sw/source/filter/basflt/fltshell.cxx +++ b/sw/source/filter/basflt/fltshell.cxx @@ -660,7 +660,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwTextNode const*const pTextNode( aRegion.End()->nNode.GetNode().GetTextNode()); SwTextField const*const pField = pTextNode ? pTextNode->GetFieldTextAttrAt( - aRegion.End()->nContent.GetIndex() - 1, true) : nullptr; + aRegion.End()->nContent.GetIndex() - 1, ::sw::GetTextAttrMode::Default) : nullptr; if (pField) { SwPostItField const*const pPostIt( diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 83233f3fef11..61f4b8e86f26 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -196,7 +196,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/wrtsh/delete.cxx b/sw/source/uibase/wrtsh/delete.cxx index bf165d4d66a2..8b5cd59bfa0c 100644 --- a/sw/source/uibase/wrtsh/delete.cxx +++ b/sw/source/uibase/wrtsh/delete.cxx @@ -434,7 +434,7 @@ bool SwWrtShell::DelRight(bool const isReplaceHeuristic) if (pTextNode) { const SwTextField* pField( - pTextNode->GetFieldTextAttrAt(pAnchor->nContent.GetIndex(), true)); + pTextNode->GetFieldTextAttrAt(pAnchor->nContent.GetIndex(), ::sw::GetTextAttrMode::Default)); if (pField && dynamic_cast<const SwPostItField*>(pField->GetFormatField().GetField())) { |