diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-08-06 16:37:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-07 11:19:39 +0200 |
commit | 110cc21fe2d59ad76a28b56f029421c0f9672073 (patch) | |
tree | a3bddd3ae4490e3e992bae91b0489fed70b6ed3b /sw | |
parent | c186b552d2b4d9c21f064c77a4d28b9f9abf0667 (diff) |
make SetGetExpField take a SwNode, not an SwNodeIndex
as part of the process of hiding the internals of SwPosition
Change-Id: If92c2b660d7e3333345c3bdd3bd5f4cba43d6659
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137909
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/crsr/crstrvl.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentFieldsManager.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/doc/docfld.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/fields/docufld.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/fields/expfld.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/fields/fldlst.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/inc/docfld.hxx | 6 |
8 files changed, 28 insertions, 40 deletions
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index bd7535f21c18..d0f9fdc2b414 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -550,8 +550,7 @@ bool SwCursorShell::GotoNxtPrvTOXMark( bool bNext ) const SwContentFrame* pCFrame = pTextNd->getLayoutFrame(GetLayout(), nullptr, &tmp); if( pCFrame && ( IsReadOnlyAvailable() || !pCFrame->IsProtected() )) { - SwNodeIndex aNdIndex( *pTextNd ); // UNIX needs this object - SetGetExpField aCmp( aNdIndex, *pTextTOX ); + SetGetExpField aCmp( *pTextNd, *pTextTOX ); aCmp.SetBodyPos( *pCFrame ); if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF ) @@ -648,7 +647,7 @@ static void lcl_MakeFieldLst( if ( pCFrame != nullptr && ( bInReadOnly || !pCFrame->IsProtected() ) ) { - std::unique_ptr<SetGetExpField> pNew(new SetGetExpField( SwNodeIndex( rTextNode ), pTextField )); + std::unique_ptr<SetGetExpField> pNew(new SetGetExpField( rTextNode, pTextField )); pNew->SetBodyPos( *pCFrame ); rLst.insert( std::move(pNew) ); } @@ -666,12 +665,12 @@ lcl_FindField(bool & o_rFound, SetGetExpFields const& rSrtLst, std::unique_ptr<SwContentIndex> pIndex; if (-1 == nContentOffset) { - pSrch.reset(new SetGetExpField(rPos.nNode, pTextField, &rPos.nContent)); + pSrch.reset(new SetGetExpField(rPos.GetNode(), pTextField, &rPos.nContent)); } else { pIndex.reset(new SwContentIndex(rPos.GetNode().GetContentNode(), nContentOffset)); - pSrch.reset(new SetGetExpField(rPos.nNode, pTextField, pIndex.get())); + pSrch.reset(new SetGetExpField(rPos.GetNode(), pTextField, pIndex.get())); } if (rPos.GetNodeIndex() < pTextNode->GetNodes().GetEndOfExtras().GetIndex()) @@ -2616,8 +2615,7 @@ bool SwCursorShell::SelectNxtPrvHyperlink( bool bNext ) if( pTextNd && pTextNd->GetNodes().IsDocNodes() ) { SwTextINetFormat& rAttr = *pFnd; - SwPosition aTmpPos( *pTextNd ); - SetGetExpField aPos( aTmpPos.nNode, rAttr ); + SetGetExpField aPos( *pTextNd, rAttr ); if (pTextNd->GetIndex() < nBodySttNdIdx) { std::pair<Point, bool> tmp(aPt, true); diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index 81216420bb1e..cccdb2978b00 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -727,7 +727,7 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* pHt ) if( GetBodyTextNode( m_rDoc, aPos, *pFrame ) ) { FieldsToCalc( *pCalc, SetGetExpField( - aPos.nNode, pFormatField->GetTextField(), + aPos.GetNode(), pFormatField->GetTextField(), &aPos.nContent, pFrame->GetPhyPageNum()), pLayout); } @@ -738,10 +738,9 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* pHt ) if( !pFrame ) { // create index to determine the TextNode - SwNodeIndex aIdx( rTextNd ); SwFrame const*const pFrame2 = ::sw::FindNeighbourFrameForNode(rTextNd); FieldsToCalc( *pCalc, - SetGetExpField(aIdx, pFormatField->GetTextField(), + SetGetExpField(rTextNd, pFormatField->GetTextField(), nullptr, pFrame2 ? pFrame2->GetPhyPageNum() : 0), pLayout); @@ -804,7 +803,7 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* pHt ) SwPosition aPos( *pCNd ); if( GetBodyTextNode( m_rDoc, aPos, *pFrame ) ) { - FieldsToCalc(*pCalc, SetGetExpField(aPos.nNode, + FieldsToCalc(*pCalc, SetGetExpField(aPos.GetNode(), nullptr, nullptr, pFrame->GetPhyPageNum()), pLayout); } @@ -816,9 +815,8 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* pHt ) if( !pFrame ) { // create index to determine the TextNode - SwNodeIndex aIdx( *pTableNd ); SwFrame const*const pFrame2 = ::sw::FindNeighbourFrameForNode(*pTableNd); - FieldsToCalc(*pCalc, SetGetExpField(aIdx, nullptr, nullptr, + FieldsToCalc(*pCalc, SetGetExpField(*pTableNd, nullptr, nullptr, pFrame2 ? pFrame2->GetPhyPageNum() : 0), pLayout); } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 7db7ede0fa2f..0a95206b0be9 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -467,8 +467,8 @@ namespace { struct PostItField_ : public SetGetExpField { - PostItField_( const SwNodeIndex& rNdIdx, const SwTextField* pField ) - : SetGetExpField( rNdIdx, pField, nullptr ) {} + PostItField_( const SwNode& rNd, const SwTextField* pField ) + : SetGetExpField( rNd, pField, nullptr ) {} sal_uInt16 GetPageNo( const StringRangeEnumerator &rRangeEnum, const o3tl::sorted_vector< sal_Int32 > &rPossiblePages, @@ -524,8 +524,7 @@ bool sw_GetPostIts(const IDocumentFieldsAccess& rIDFA, SetGetExpFields* pSrtLst) for(auto pField: vFields) { auto pTextField = pField->GetTextField(); - SwNodeIndex aIdx(pTextField->GetTextNode()); - std::unique_ptr<PostItField_> pNew(new PostItField_(aIdx, pTextField)); + std::unique_ptr<PostItField_> pNew(new PostItField_(pTextField->GetTextNode(), pTextField)); pSrtLst->insert(std::move(pNew)); } diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index dd178f7941aa..bdc8b0c9f22d 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -64,7 +64,7 @@ using namespace ::com::sun::star::uno; // the StartIndex can be supplied optionally (e.g. if it was queried before - is a virtual // method otherwise!) SetGetExpField::SetGetExpField( - const SwNodeIndex& rNdIdx, + const SwNode& rNdIdx, const SwTextField* pField, const SwContentIndex* pIdx, sal_uInt16 const nPageNumber) @@ -81,7 +81,7 @@ SetGetExpField::SetGetExpField( m_nContent = 0; } -SetGetExpField::SetGetExpField( const SwNodeIndex& rNdIdx, +SetGetExpField::SetGetExpField( const SwNode& rNdIdx, const SwTextINetFormat& rINet ) { m_eSetGetExpFieldType = TEXTINET; @@ -149,7 +149,7 @@ SetGetExpField::SetGetExpField( const SwTableBox& rTBox ) } } -SetGetExpField::SetGetExpField( const SwNodeIndex& rNdIdx, +SetGetExpField::SetGetExpField( const SwNode& rNdIdx, const SwTextTOXMark& rTOX ) { m_eSetGetExpFieldType = TEXTTOXMARK; @@ -1076,9 +1076,7 @@ void SwDocUpdateField::GetBodyNode( const SwTextField& rTField, SwFieldIds nFiel if( !pFrame || pFrame->IsInDocBody() ) { - // create index to determine the TextNode - SwNodeIndex aIdx( rTextNd ); - bIsInBody = rDoc.GetNodes().GetEndOfExtras().GetIndex() < aIdx.GetIndex(); + bIsInBody = rDoc.GetNodes().GetEndOfExtras().GetIndex() < rTextNd.GetIndex(); // We don't want to update fields in redlines, or those // in frames whose anchor is in redline. However, we do want to update @@ -1091,7 +1089,7 @@ void SwDocUpdateField::GetBodyNode( const SwTextField& rTField, SwFieldIds nFiel } if( (pFrame != nullptr) || bIsInBody ) { - pNew.reset(new SetGetExpField(aIdx, &rTField, nullptr, + pNew.reset(new SetGetExpField(rTextNd, &rTField, nullptr, pFrame ? pFrame->GetPhyPageNum() : 0)); } } @@ -1101,7 +1099,7 @@ void SwDocUpdateField::GetBodyNode( const SwTextField& rTField, SwFieldIds nFiel SwPosition aPos( rDoc.GetNodes().GetEndOfPostIts() ); bool const bResult = GetBodyTextNode( rDoc, aPos, *pFrame ); OSL_ENSURE(bResult, "where is the Field"); - pNew.reset(new SetGetExpField(aPos.nNode, &rTField, &aPos.nContent, + pNew.reset(new SetGetExpField(aPos.GetNode(), &rTField, &aPos.nContent, pFrame->GetPhyPageNum())); } diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 3128aeeaf9c7..ac638bfadd58 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -2250,9 +2250,7 @@ bool SwRefPageGetFieldType::MakeSetList(SetGetExpFields& rTmpLst, // Check if pFrame is not yet connected to the layout. !pFrame->FindPageFrame() ) { - // create index for determination of the TextNode - SwNodeIndex aIdx( rTextNd ); - pNew.reset( new SetGetExpField( aIdx, pTField ) ); + pNew.reset( new SetGetExpField( rTextNd, pTField ) ); } else { @@ -2260,7 +2258,7 @@ bool SwRefPageGetFieldType::MakeSetList(SetGetExpFields& rTmpLst, SwPosition aPos( m_rDoc.GetNodes().GetEndOfPostIts() ); bool const bResult = GetBodyTextNode( m_rDoc, aPos, *pFrame ); OSL_ENSURE(bResult, "where is the Field?"); - pNew.reset( new SetGetExpField( aPos.nNode, pTField, + pNew.reset( new SetGetExpField( aPos.GetNode(), pTField, &aPos.nContent ) ); } @@ -2282,8 +2280,7 @@ void SwRefPageGetFieldType::UpdateField( SwTextField const * pTextField, if( pTextNode->StartOfSectionIndex() > m_rDoc.GetNodes().GetEndOfExtras().GetIndex() ) { - SwNodeIndex aIdx( *pTextNode ); - SetGetExpField aEndField( aIdx, pTextField ); + SetGetExpField aEndField( *pTextNode, pTextField ); SetGetExpFields::const_iterator itLast = rSetList.lower_bound( &aEndField ); @@ -2390,7 +2387,7 @@ void SwRefPageGetField::ChangeExpansion(const SwFrame& rFrame, if(!pTextNode) return; - SetGetExpField aEndField( aPos.nNode, pField, &aPos.nContent ); + SetGetExpField aEndField( aPos.GetNode(), pField, &aPos.nContent ); SetGetExpFields::const_iterator itLast = aTmpLst.lower_bound( &aEndField ); diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 1f58ff7bc194..a7434fbc5234 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -373,7 +373,7 @@ void SwGetExpField::ChangeExpansion( const SwFrame& rFrame, const SwTextField& r SwRootFrame const& rLayout(*rFrame.getRootFrame()); OUString & rExpand(rLayout.IsHideRedlines() ? m_sExpandRLHidden : m_sExpand); // here a page number is needed to sort correctly - SetGetExpField aEndField(aPos.nNode, &rField, &aPos.nContent, rFrame.GetPhyPageNum()); + SetGetExpField aEndField(aPos.GetNode(), &rField, &aPos.nContent, rFrame.GetPhyPageNum()); if(GetSubType() & nsSwGetSetExpType::GSE_STRING) { SwHashTable<HashStr> aHashTable(0); diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx index 24eb3e1a43ea..635d09d0ea30 100644 --- a/sw/source/core/fields/fldlst.cxx +++ b/sw/source/core/fields/fldlst.cxx @@ -59,8 +59,7 @@ SwInputFieldList::SwInputFieldList( SwEditShell* pShell, bool bBuildTmpLst ) maTmpLst.insert(pTextField); else { - SwNodeIndex aIdx(pTextField->GetTextNode()); - std::unique_ptr<SetGetExpField> pNew(new SetGetExpField(aIdx, pTextField)); + std::unique_ptr<SetGetExpField> pNew(new SetGetExpField(pTextField->GetTextNode(), pTextField)); mpSrtLst->insert(std::move(pNew)); } } @@ -135,8 +134,7 @@ bool SwInputFieldList::BuildSortLst() auto it = maTmpLst.find(pTextField); if(maTmpLst.end() == it) { - SwNodeIndex aIdx(pTextField->GetTextNode()); - std::unique_ptr<SetGetExpField> pNew(new SetGetExpField(aIdx, pTextField )); + std::unique_ptr<SetGetExpField> pNew(new SetGetExpField(pTextField->GetTextNode(), pTextField )); mpSrtLst->insert(std::move(pNew)); } else diff --git a/sw/source/core/inc/docfld.hxx b/sw/source/core/inc/docfld.hxx index dcc87cce6de8..badae79afc47 100644 --- a/sw/source/core/inc/docfld.hxx +++ b/sw/source/core/inc/docfld.hxx @@ -65,11 +65,11 @@ class SetGetExpField } m_eSetGetExpFieldType; public: - SetGetExpField( const SwNodeIndex& rNdIdx, const SwTextField* pField = nullptr, + SetGetExpField( const SwNode& rNd, const SwTextField* pField = nullptr, const SwContentIndex* pIdx = nullptr, sal_uInt16 nPageNumber = 0); - SetGetExpField( const SwNodeIndex& rNdIdx, const SwTextINetFormat& rINet ); + SetGetExpField( const SwNode& rNd, const SwTextINetFormat& rINet ); SetGetExpField( const SwSectionNode& rSectNode, const SwPosition* pPos = nullptr, @@ -81,7 +81,7 @@ public: SetGetExpField( const SwTableBox& rTableBox ); - SetGetExpField( const SwNodeIndex& rNdIdx, const SwTextTOXMark& rTOX ); + SetGetExpField( const SwNode& rNd, const SwTextTOXMark& rTOX ); SetGetExpField( const SwPosition& rPos ); |