sw/inc/accmap.hxx | 4 - sw/source/core/access/accmap.cxx | 17 +++---- sw/source/core/inc/flyfrm.hxx | 4 - sw/source/core/inc/viewimp.hxx | 3 - sw/source/core/layout/fly.cxx | 84 +++++++++++++++++++-------------------- sw/source/core/view/viewimp.cxx | 7 +-- 6 files changed, 57 insertions(+), 62 deletions(-)
New commits: commit 9ed09f66a3cfb24753facb8763ee1677fc764f2c Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Apr 24 15:23:46 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Apr 25 07:32:04 2025 +0200 sw a11y: Pass frame by ref to SwAccessibleMap::InvalidateRelationSet_ Change-Id: I6468df09f1e7447e1837aee64701dccbad637f42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184586 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx index f508d54b162c..940c38ffc500 100644 --- a/sw/inc/accmap.hxx +++ b/sw/inc/accmap.hxx @@ -130,7 +130,7 @@ class SwAccessibleMap final : public ::accessibility::IAccessibleViewForwarder, //InvalidateShapeInParaSelection() method is responsible for the updating the selected states of the objects. void InvalidateShapeInParaSelection(); - void InvalidateRelationSet_( const SwFrame* pFrame, bool bFrom ); + void InvalidateRelationSet_(const SwFrame& rFrame, bool bFrom); rtl::Reference<SwAccessibleContext> GetDocumentView_(bool bPagePreview); diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 4f7a3c3969ee..183130eae5aa 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -2528,17 +2528,17 @@ void SwAccessibleMap::InvalidateEditableStates( const SwFrame* _pFrame ) } } -void SwAccessibleMap::InvalidateRelationSet_( const SwFrame* pFrame, +void SwAccessibleMap::InvalidateRelationSet_(const SwFrame& rFrame, bool bFrom ) { DBG_TESTSOLARMUTEX(); // first, see if this frame is accessible, and if so, get the respective - if (!pFrame || !SwAccessibleChild::IsFrameAccessible(*pFrame, GetShell().IsPreview())) + if (!SwAccessibleChild::IsFrameAccessible(rFrame, GetShell().IsPreview())) return; rtl::Reference < SwAccessibleContext > xAcc; - SwAccessibleContextMap::iterator aIter = maFrameMap.find(pFrame); + SwAccessibleContextMap::iterator aIter = maFrameMap.find(&rFrame); if (aIter != maFrameMap.end()) { xAcc = (*aIter).second; @@ -2551,7 +2551,7 @@ void SwAccessibleMap::InvalidateRelationSet_( const SwFrame* pFrame, if (GetShell().ActionPend()) { SwAccessibleEvent_Impl aEvent( SwAccessibleEvent_Impl::CARET_OR_STATES, - xAcc.get(), SwAccessibleChild(pFrame), + xAcc.get(), SwAccessibleChild(&rFrame), ( bFrom ? AccessibleStates::RELATION_FROM : AccessibleStates::RELATION_TO ) ); @@ -2568,15 +2568,15 @@ void SwAccessibleMap::InvalidateRelationSet_( const SwFrame* pFrame, void SwAccessibleMap::InvalidateRelationSet(const SwFrame& rMaster, const SwFrame& rFollow) { - InvalidateRelationSet_(&rMaster, false); - InvalidateRelationSet_(&rFollow, true); + InvalidateRelationSet_(rMaster, false); + InvalidateRelationSet_(rFollow, true); } // invalidation of CONTENT_FLOW_FROM/_TO relation of a paragraph void SwAccessibleMap::InvalidateParaFlowRelation( const SwTextFrame& _rTextFrame, const bool _bFrom ) { - InvalidateRelationSet_( &_rTextFrame, _bFrom ); + InvalidateRelationSet_(_rTextFrame, _bFrom ); } // invalidation of text selection of a paragraph commit 56d1a1eb2b38e5901a6f06a812f7db60424a22eb Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Apr 24 15:21:24 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Apr 25 07:31:56 2025 +0200 sw a11y: Pass frames by ref to SwViewShellImp::InvalidateRelationSet ... and SwAccessibleMap::InvalidateRelationSet. Change-Id: Ifd2c9a4b2fe48cc641ccf31736e886a807fe19b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184585 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx index ddad147103a6..f508d54b162c 100644 --- a/sw/inc/accmap.hxx +++ b/sw/inc/accmap.hxx @@ -221,7 +221,7 @@ public: // is processed when the last action ends. void InvalidateEditableStates( const SwFrame* _pFrame ); - void InvalidateRelationSet( const SwFrame* pMaster, const SwFrame* pFollow ); + void InvalidateRelationSet(const SwFrame& rMaster, const SwFrame& rFollow); /** invalidation CONTENT_FLOWS_FROM/_TO relation of a paragraph diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index d5139bbed74a..4f7a3c3969ee 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -2566,11 +2566,10 @@ void SwAccessibleMap::InvalidateRelationSet_( const SwFrame* pFrame, } } -void SwAccessibleMap::InvalidateRelationSet( const SwFrame* pMaster, - const SwFrame* pFollow ) +void SwAccessibleMap::InvalidateRelationSet(const SwFrame& rMaster, const SwFrame& rFollow) { - InvalidateRelationSet_( pMaster, false ); - InvalidateRelationSet_( pFollow, true ); + InvalidateRelationSet_(&rMaster, false); + InvalidateRelationSet_(&rFollow, true); } // invalidation of CONTENT_FLOW_FROM/_TO relation of a paragraph diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx index f9036293bfeb..af3fd44a73ba 100644 --- a/sw/source/core/inc/viewimp.hxx +++ b/sw/source/core/inc/viewimp.hxx @@ -276,8 +276,7 @@ public: const SwFrame *pFrame=nullptr ); /// Invalidate frame's relation set (for chained frames) - void InvalidateAccessibleRelationSet( const SwFlyFrame *pMaster, - const SwFlyFrame *pFollow ); + void InvalidateAccessibleRelationSet(const SwFlyFrame& rMaster, const SwFlyFrame& rFollow); /// update data for accessible preview /// change method signature due to new page preview functionality diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 2de7b162e502..420745989cfa 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -565,7 +565,7 @@ void SwFlyFrame::ChainFrames( SwFlyFrame &rMaster, SwFlyFrame &rFollow ) { SwRootFrame* pLayout = rMaster.getRootFrame(); if( pLayout && pLayout->IsAnyShellAccessible() ) - pSh->Imp()->InvalidateAccessibleRelationSet( &rMaster, &rFollow ); + pSh->Imp()->InvalidateAccessibleRelationSet(rMaster, rFollow); } #endif } @@ -614,7 +614,7 @@ void SwFlyFrame::UnchainFrames( SwFlyFrame &rMaster, SwFlyFrame &rFollow ) { SwRootFrame* pLayout = rMaster.getRootFrame(); if( pLayout && pLayout->IsAnyShellAccessible() ) - pSh->Imp()->InvalidateAccessibleRelationSet( &rMaster, &rFollow ); + pSh->Imp()->InvalidateAccessibleRelationSet(rMaster, rFollow); } #endif } diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index bed6ad867587..4a093f2bb9e7 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -434,14 +434,13 @@ void SwViewShellImp::InvalidateAccessibleEditableState( bool bAllShells, } } -void SwViewShellImp::InvalidateAccessibleRelationSet( const SwFlyFrame *pMaster, - const SwFlyFrame *pFollow ) +void SwViewShellImp::InvalidateAccessibleRelationSet(const SwFlyFrame& rMaster, + const SwFlyFrame& rFollow) { for(SwViewShell& rTmp : GetShell().GetRingContainer()) { if( rTmp.Imp()->IsAccessible() ) - rTmp.Imp()->GetAccessibleMap().InvalidateRelationSet( pMaster, - pFollow ); + rTmp.Imp()->GetAccessibleMap().InvalidateRelationSet(rMaster, rFollow); } } commit 3e3f759cdd96719f54c36585d55b0ef193d18175 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Apr 24 15:15:17 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Apr 25 07:31:49 2025 +0200 sw: Pass frames to SwFlyFrame::UnchainFrames by ref ... instead of by pointer. They're always non-null. This will also allow similar changes all the way down to SwAccessibleMap::InvalidateRelationSet_ in upcoming commits. Change-Id: Ia109884eedd8b8e1271e5f922470b63a2927da04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184584 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index f599fa86b888..35c454d0da7f 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -193,8 +193,8 @@ public: SwFlyFrame *GetPrevLink() const { return m_pPrevLink; } SwFlyFrame *GetNextLink() const { return m_pNextLink; } - static void ChainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow ); - static void UnchainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow ); + static void ChainFrames( SwFlyFrame &rMaster, SwFlyFrame &rFollow ); + static void UnchainFrames( SwFlyFrame &rMaster, SwFlyFrame &rFollow ); SwFlyFrame *FindChainNeighbour( SwFrameFormat const &rFormat, SwFrame *pAnch = nullptr ); diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 1ea04c000d72..2de7b162e502 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -262,7 +262,7 @@ void SwFlyFrame::Chain( SwFrame* _pAnch ) { OSL_ENSURE( !pFollow->GetPrevLink(), "wrong chain detected" ); if ( !pFollow->GetPrevLink() ) - SwFlyFrame::ChainFrames( this, pFollow ); + SwFlyFrame::ChainFrames( *this, *pFollow ); } } if ( rChain.GetPrev() ) @@ -272,7 +272,7 @@ void SwFlyFrame::Chain( SwFrame* _pAnch ) { OSL_ENSURE( !pMaster->GetNextLink(), "wrong chain detected" ); if ( !pMaster->GetNextLink() ) - SwFlyFrame::ChainFrames( pMaster, this ); + SwFlyFrame::ChainFrames( *pMaster, *this ); } } } @@ -382,9 +382,9 @@ const IDocumentDrawModelAccess& SwFlyFrame::getIDocumentDrawModelAccess() void SwFlyFrame::Unchain() { if ( GetPrevLink() ) - UnchainFrames( GetPrevLink(), this ); + UnchainFrames( *GetPrevLink(), *this ); if ( GetNextLink() ) - UnchainFrames( this, GetNextLink() ); + UnchainFrames( *this, *GetNextLink() ); } void SwFlyFrame::DeleteCnt() @@ -521,21 +521,20 @@ void SwFlyFrame::FinitDrawObj() ClearDrawObj(); } -void SwFlyFrame::ChainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow ) +void SwFlyFrame::ChainFrames( SwFlyFrame &rMaster, SwFlyFrame &rFollow ) { - assert(pMaster && pFollow && "incomplete chain"); - OSL_ENSURE( !pMaster->GetNextLink(), "link can not be changed" ); - OSL_ENSURE( !pFollow->GetPrevLink(), "link can not be changed" ); + OSL_ENSURE( !rMaster.GetNextLink(), "link can not be changed" ); + OSL_ENSURE( !rFollow.GetPrevLink(), "link can not be changed" ); - pMaster->m_pNextLink = pFollow; - pFollow->m_pPrevLink = pMaster; + rMaster.m_pNextLink = &rFollow; + rFollow.m_pPrevLink = &rMaster; - if ( pMaster->ContainsContent() ) + if ( rMaster.ContainsContent() ) { // To get a text flow we need to invalidate - SwFrame *pInva = pMaster->FindLastLower(); - SwRectFnSet aRectFnSet(pMaster); - const tools::Long nBottom = aRectFnSet.GetPrtBottom(*pMaster); + SwFrame *pInva = rMaster.FindLastLower(); + SwRectFnSet aRectFnSet(&rMaster); + const tools::Long nBottom = aRectFnSet.GetPrtBottom(rMaster); while ( pInva ) { if( aRectFnSet.BottomDist( pInva->getFrameArea(), nBottom ) <= 0 ) @@ -549,11 +548,11 @@ void SwFlyFrame::ChainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow ) } } - if ( pFollow->ContainsContent() ) + if ( rFollow.ContainsContent() ) { // There's only the content from the Masters left; the content from the Follow // does not have any Frames left (should always be exactly one empty TextNode). - SwFrame *pFrame = pFollow->ContainsContent(); + SwFrame *pFrame = rFollow.ContainsContent(); OSL_ENSURE( !pFrame->IsTabFrame() && !pFrame->FindNext(), "follow in chain contains content" ); pFrame->Cut(); SwFrame::DestroyFrame(pFrame); @@ -561,37 +560,37 @@ void SwFlyFrame::ChainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow ) // invalidate accessible relation set (accessibility wrapper) #if !ENABLE_WASM_STRIP_ACCESSIBILITY - SwViewShell* pSh = pMaster->getRootFrame()->GetCurrShell(); + SwViewShell* pSh = rMaster.getRootFrame()->GetCurrShell(); if( pSh ) { - SwRootFrame* pLayout = pMaster->getRootFrame(); + SwRootFrame* pLayout = rMaster.getRootFrame(); if( pLayout && pLayout->IsAnyShellAccessible() ) - pSh->Imp()->InvalidateAccessibleRelationSet( pMaster, pFollow ); + pSh->Imp()->InvalidateAccessibleRelationSet( &rMaster, &rFollow ); } #endif } -void SwFlyFrame::UnchainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow ) +void SwFlyFrame::UnchainFrames( SwFlyFrame &rMaster, SwFlyFrame &rFollow ) { - pMaster->m_pNextLink = nullptr; - pFollow->m_pPrevLink = nullptr; + rMaster.m_pNextLink = nullptr; + rFollow.m_pPrevLink = nullptr; - if ( pFollow->ContainsContent() ) + if ( rFollow.ContainsContent() ) { // The Master sucks up the content of the Follow - SwLayoutFrame *pUpper = pMaster; + SwLayoutFrame *pUpper = &rMaster; if ( pUpper->Lower()->IsColumnFrame() ) { pUpper = static_cast<SwLayoutFrame*>(pUpper->GetLastLower()); pUpper = static_cast<SwLayoutFrame*>(pUpper->Lower()); // The (Column)BodyFrame OSL_ENSURE( pUpper && pUpper->IsColBodyFrame(), "Missing ColumnBody" ); } - SwFlyFrame *pFoll = pFollow; + SwFlyFrame *pFoll = &rFollow; while ( pFoll ) { SwFrame *pTmp = ::SaveContent( pFoll ); if ( pTmp ) - ::RestoreContent( pTmp, pUpper, pMaster->FindLastLower() ); + ::RestoreContent( pTmp, pUpper, rMaster.FindLastLower() ); pFoll->SetCompletePaint(); pFoll->InvalidateSize(); pFoll = pFoll->GetNextLink(); @@ -599,23 +598,23 @@ void SwFlyFrame::UnchainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow ) } // The Follow needs his own content to be served - const SwFormatContent &rContent = pFollow->GetFormat()->GetContent(); + const SwFormatContent &rContent = rFollow.GetFormat()->GetContent(); OSL_ENSURE( rContent.GetContentIdx(), ":-( No content prepared." ); SwNodeOffset nIndex = rContent.GetContentIdx()->GetIndex(); // Lower() means SwColumnFrame: this one contains another SwBodyFrame - SwFrame* pLower = pFollow->Lower(); + SwFrame* pLower = rFollow.Lower(); ::InsertCnt_( pLower ? const_cast<SwLayoutFrame*>(static_cast<const SwLayoutFrame*>(static_cast<const SwLayoutFrame*>(pLower)->Lower())) - : static_cast<SwLayoutFrame*>(pFollow), - pFollow->GetFormat()->GetDoc(), ++nIndex ); + : static_cast<SwLayoutFrame*>(&rFollow), + rFollow.GetFormat()->GetDoc(), ++nIndex ); // invalidate accessible relation set (accessibility wrapper) #if !ENABLE_WASM_STRIP_ACCESSIBILITY - SwViewShell* pSh = pMaster->getRootFrame()->GetCurrShell(); + SwViewShell* pSh = rMaster.getRootFrame()->GetCurrShell(); if( pSh ) { - SwRootFrame* pLayout = pMaster->getRootFrame(); + SwRootFrame* pLayout = rMaster.getRootFrame(); if( pLayout && pLayout->IsAnyShellAccessible() ) - pSh->Imp()->InvalidateAccessibleRelationSet( pMaster, pFollow ); + pSh->Imp()->InvalidateAccessibleRelationSet( &rMaster, &rFollow ); } #endif } @@ -1168,36 +1167,35 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, { SwFlyFrame *pFollow = FindChainNeighbour( *pChain->GetNext() ); if ( GetNextLink() && pFollow != GetNextLink() ) - SwFlyFrame::UnchainFrames( this, GetNextLink()); + SwFlyFrame::UnchainFrames( *this, *GetNextLink()); if ( pFollow ) { if ( pFollow->GetPrevLink() && pFollow->GetPrevLink() != this ) - SwFlyFrame::UnchainFrames( pFollow->GetPrevLink(), - pFollow ); + SwFlyFrame::UnchainFrames( *pFollow->GetPrevLink(), + *pFollow ); if ( !GetNextLink() ) - SwFlyFrame::ChainFrames( this, pFollow ); + SwFlyFrame::ChainFrames( *this, *pFollow ); } } else if ( GetNextLink() ) - SwFlyFrame::UnchainFrames( this, GetNextLink() ); + SwFlyFrame::UnchainFrames( *this, *GetNextLink() ); if ( pChain->GetPrev() ) { SwFlyFrame *pMaster = FindChainNeighbour( *pChain->GetPrev() ); if ( GetPrevLink() && pMaster != GetPrevLink() ) - SwFlyFrame::UnchainFrames( GetPrevLink(), this ); + SwFlyFrame::UnchainFrames( *GetPrevLink(), *this ); if ( pMaster ) { if ( pMaster->GetNextLink() && pMaster->GetNextLink() != this ) - SwFlyFrame::UnchainFrames( pMaster, - pMaster->GetNextLink() ); + SwFlyFrame::UnchainFrames( *pMaster, *pMaster->GetNextLink() ); if ( !GetPrevLink() ) - SwFlyFrame::ChainFrames( pMaster, this ); + SwFlyFrame::ChainFrames( *pMaster, *this ); } } else if ( GetPrevLink() ) - SwFlyFrame::UnchainFrames( GetPrevLink(), this ); + SwFlyFrame::UnchainFrames( *GetPrevLink(), *this ); } [[fallthrough]]; default: