sw/source/core/access/acccell.cxx | 21 +++++------ sw/source/core/access/acccell.hxx | 1 sw/source/core/access/accfrmobj.cxx | 2 - sw/source/core/access/acctable.cxx | 10 ++--- sw/source/core/crsr/trvltbl.cxx | 8 ++-- sw/source/core/docnode/ndtbl.cxx | 14 +++---- sw/source/core/docnode/ndtbl1.cxx | 12 +++--- sw/source/core/edit/edtab.cxx | 12 +++--- sw/source/core/frmedt/fetab.cxx | 43 +++++++++++------------- sw/source/core/frmedt/tblsel.cxx | 15 +++----- sw/source/core/inc/cellfrm.hxx | 4 +- sw/source/core/layout/dbg_lay.cxx | 4 +- sw/source/core/layout/findfrm.cxx | 10 ++--- sw/source/core/layout/paintfrm.cxx | 6 +-- sw/source/core/layout/ssfrm.cxx | 6 +-- sw/source/core/layout/tabfrm.cxx | 39 ++++++++++----------- sw/source/core/layout/trvlfrm.cxx | 8 ++-- sw/source/core/layout/wsfrm.cxx | 2 - sw/source/core/table/swnewtable.cxx | 2 - sw/source/core/table/swtable.cxx | 10 ++--- sw/source/core/text/EnhancedPDFExportHelper.cxx | 4 +- 21 files changed, 115 insertions(+), 118 deletions(-)
New commits: commit 7a7b9039b38d3e5b034b194602eb06126ab6402c Author: Michael Weghorn <[email protected]> AuthorDate: Wed Mar 4 09:45:37 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Mar 4 12:08:24 2026 +0100 sw: Return reference in SwCellFrame::GetTabBox Change-Id: I7d258afa33539b132b03e9b7b8c352356bfc026e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200930 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx index 4d065328a9a0..5c4ea561f12f 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -57,9 +57,9 @@ bool SwAccessibleCell::IsSelected() { if( pCSh->IsTableMode() ) { - const SwTableBox* pBox = GetCellFrame().GetTabBox(); + const SwTableBox& rBox = GetCellFrame().GetTabBox(); SwSelBoxes const& rBoxes(pCSh->GetTableCursor()->GetSelectedBoxes()); - bRet = rBoxes.find(pBox) != rBoxes.end(); + bRet = rBoxes.find(&rBox) != rBoxes.end(); } } @@ -96,7 +96,7 @@ SwAccessibleCell::SwAccessibleCell(std::shared_ptr<SwAccessibleMap> const& pInit , m_aSelectionHelper( *this ) , m_bIsSelected( false ) { - OUString sBoxName( pCellFrame->GetTabBox()->GetName() ); + OUString sBoxName(pCellFrame->GetTabBox().GetName()); SetName( sBoxName ); m_bIsSelected = IsSelected(); @@ -255,7 +255,7 @@ const SwCellFrame& SwAccessibleCell::GetCellFrame() const SwFrameFormat* SwAccessibleCell::GetTableBoxFormat() const { - return GetCellFrame().GetTabBox()->GetFrameFormat(); + return GetCellFrame().GetTabBox().GetFrameFormat(); } //Implement TableCell currentValue diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx index cb02298bb0e9..3586f7f0eba7 100644 --- a/sw/source/core/access/accfrmobj.cxx +++ b/sw/source/core/access/accfrmobj.cxx @@ -125,7 +125,7 @@ bool SwAccessibleChild::IsFrameAccessible(const SwFrame& rFrame, bool bPagePrevi return false; if (rFrame.IsCellFrame() - && static_cast<const SwCellFrame&>(rFrame).GetTabBox()->GetSttNd() == nullptr) + && static_cast<const SwCellFrame&>(rFrame).GetTabBox().GetSttNd() == nullptr) return false; if (rFrame.IsInCoveredCell()) diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index 7ba2960377e0..d29ad8df5e7b 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -215,8 +215,8 @@ void SwAccessibleTableData_Impl::GetSelection( OSL_ENSURE( pLower->IsCellFrame(), "lower is not a cell frame" ); const SwCellFrame *pCFrame = static_cast < const SwCellFrame * >( pLower ); - const SwTableBox* pBox = pCFrame->GetTabBox(); - if( rSelBoxes.find( pBox ) == rSelBoxes.end() ) + const SwTableBox& rBox = pCFrame->GetTabBox(); + if (rSelBoxes.find(&rBox) == rSelBoxes.end()) { const Int32Set_Impl rRowsOrCols = bColumns ? maColumns : maRows; @@ -510,7 +510,7 @@ const SwTableBox* SwAccessibleTable::GetTableBox( sal_Int64 nChildIndex ) const { const SwCellFrame* pCellFrame = static_cast<const SwCellFrame*>( pChildFrame ); - pBox = pCellFrame->GetTabBox(); + pBox = &pCellFrame->GetTabBox(); } } @@ -960,8 +960,8 @@ sal_Bool SAL_CALL SwAccessibleTable::isAccessibleSelected( if( pSelBoxes ) { const SwCellFrame *pCFrame = static_cast < const SwCellFrame * >( pFrame ); - const SwTableBox* pBox = pCFrame->GetTabBox(); - bRet = pSelBoxes->find( pBox ) != pSelBoxes->end(); + const SwTableBox& rBox = pCFrame->GetTabBox(); + bRet = pSelBoxes->find(&rBox) != pSelBoxes->end(); } } diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 6a9fb3bd2042..b32b9705ed12 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -216,9 +216,9 @@ bool SwCursorShell::SelTableRowOrCol( bool bRow, bool bRowSimple ) else { // will become point of table cursor - pStart = aCells[bVert ? 0 : (bRow ? 2 : 1)]->GetTabBox(); + pStart = &aCells[bVert ? 0 : (bRow ? 2 : 1)]->GetTabBox(); // will become mark of table cursor - pEnd = aCells[bVert ? 3 : (bRow ? 1 : 2)]->GetTabBox(); + pEnd = &aCells[bVert ? 3 : (bRow ? 1 : 2)]->GetTabBox(); } } @@ -761,7 +761,7 @@ OUString SwCursorShell::GetBoxNms() const if( !pFrame ) return sNm; - sNm = static_cast<SwCellFrame*>(pFrame)->GetTabBox()->GetName() + ":"; + sNm = static_cast<SwCellFrame*>(pFrame)->GetTabBox().GetName() + ":"; pPos = m_pTableCursor->End(); } else @@ -782,7 +782,7 @@ OUString SwCursorShell::GetBoxNms() const } while ( pFrame && !pFrame->IsCellFrame() ); if( pFrame ) - sNm += static_cast<SwCellFrame*>(pFrame)->GetTabBox()->GetName(); + sNm += static_cast<SwCellFrame*>(pFrame)->GetTabBox().GetName(); } return sNm; } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index d33271133333..f68ad8ee4a63 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -2686,7 +2686,7 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCellFrame* pBoxFrame ) return; SwTabFrame *pTab = const_cast<SwFrame*>(static_cast<SwFrame const *>(pBoxFrame))->ImplFindTabFrame(); - const SwTableBox* pBox = pBoxFrame->GetTabBox(); + const SwTableBox& rBox = pBoxFrame->GetTabBox(); // Set fixed points, LeftMin in Document coordinates, all others relative SwRectFnSet aRectFnSet(*pTab); @@ -2701,7 +2701,7 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCellFrame* pBoxFrame ) rFill.SetRight ( aRectFnSet.GetRight(pTab->getFramePrintArea())); rFill.SetRightMax( nRightMax - nLeftMin ); - pTab->GetTable()->GetTabCols( rFill, pBox ); + pTab->GetTable()->GetTabCols(rFill, &rBox); } // Here are some little helpers used in SwDoc::GetTabRows @@ -2726,7 +2726,7 @@ static bool lcl_IsFrameInColumn( const SwCellFrame& rFrame, SwSelBoxes const & r { for (size_t i = 0; i < rBoxes.size(); ++i) { - if ( rFrame.GetTabBox() == rBoxes[ i ] ) + if (&rFrame.GetTabBox() == rBoxes[i]) return true; } @@ -2877,7 +2877,7 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, bool bCurRowOnly, if( pBoxFrame ) { pTab = const_cast<SwFrame*>(static_cast<SwFrame const *>(pBoxFrame))->ImplFindTabFrame(); - pBox = pBoxFrame->GetTabBox(); + pBox = &pBoxFrame->GetTabBox(); } else { @@ -3013,12 +3013,12 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, if ( pContent && pContent->IsTextFrame() ) { - const SwTableBox* pBox = static_cast<const SwCellFrame*>(pFrame)->GetTabBox(); - const sal_Int32 nRowSpan = pBox->getRowSpan(); + const SwTableBox& rBox = static_cast<const SwCellFrame*>(pFrame)->GetTabBox(); + const sal_Int32 nRowSpan = rBox.getRowSpan(); if( nRowSpan > 0 ) // Not overlapped pTextFrame = static_cast<const SwTextFrame*>(pContent); if( nRowSpan < 2 ) // Not overlapping for row height - pLine = pBox->GetUpper(); + pLine = rBox.GetUpper(); if( pLine && pTextFrame ) // always for old table model { // The new row height must not to be calculated from an overlapping box diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 1401b688d81b..65e27964d4e6 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -918,14 +918,14 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) aBox.SetDistance( pSetBox->GetDistance( k ), k ); } - SwTableBox *pBox = const_cast<SwTableBox*>(pCell->GetTabBox()); - SwFrameFormat *pNewFormat = SwTableFormatCmp::FindNewFormat( aFormatCmp, pBox->GetFrameFormat(), nType ); + SwTableBox& rBox = const_cast<SwTableBox&>(pCell->GetTabBox()); + SwFrameFormat* pNewFormat = SwTableFormatCmp::FindNewFormat(aFormatCmp, rBox.GetFrameFormat(), nType); if ( nullptr != pNewFormat ) - pBox->ChgFrameFormat( static_cast<SwTableBoxFormat*>(pNewFormat) ); + rBox.ChgFrameFormat(static_cast<SwTableBoxFormat*>(pNewFormat)); else { - SwFrameFormat *pOld = pBox->GetFrameFormat(); - SwFrameFormat *pNew = pBox->ClaimFrameFormat(); + SwFrameFormat* pOld = rBox.GetFrameFormat(); + SwFrameFormat* pNew = rBox.ClaimFrameFormat(); pNew->SetFormatAttr( aBox ); aFormatCmp.push_back(std::make_unique<SwTableFormatCmp>(pOld, pNew, nType)); } @@ -1008,7 +1008,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, if ( pTab->IsFollow() && pTab->IsInHeadline( *pCell ) ) continue; - const_cast<SwTableBox*>(pCell->GetTabBox())->ClaimFrameFormat(); + const_cast<SwTableBox&>(pCell->GetTabBox()).ClaimFrameFormat(); SwFrameFormat *pFormat = pCell->GetFormat(); std::unique_ptr<SvxBoxItem> aBox(pFormat->GetBox().Clone()); diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx index 486b7efb6653..18538410ee69 100644 --- a/sw/source/core/edit/edtab.cxx +++ b/sw/source/core/edit/edtab.cxx @@ -313,8 +313,8 @@ bool SwEditShell::GetTableBoxFormulaAttrs( SfxItemSet& rSet ) const if (pFrame) { - auto pBox = const_cast<SwTableBox*>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()); - aBoxes.insert(pBox); + SwTableBox& rBox = const_cast<SwTableBox&>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()); + aBoxes.insert(&rBox); } } @@ -351,8 +351,8 @@ void SwEditShell::SetTableBoxFormulaAttrs( const SfxItemSet& rSet ) } while ( pFrame && !pFrame->IsCellFrame() ); if ( pFrame ) { - SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()); - aBoxes.insert( pBox ); + SwTableBox& rBox = const_cast<SwTableBox&>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()); + aBoxes.insert(&rBox); } } while( false ); } @@ -383,7 +383,7 @@ bool SwEditShell::IsTableBoxTextFormat() const pFrame = pFrame->GetUpper(); } while ( pFrame && !pFrame->IsCellFrame() ); if ( pFrame ) - pBox = static_cast<SwCellFrame*>(pFrame)->GetTabBox(); + pBox = &static_cast<SwCellFrame*>(pFrame)->GetTabBox(); } if( !pBox ) @@ -421,7 +421,7 @@ OUString SwEditShell::GetTableBoxText() const pFrame = pFrame->GetUpper(); } while ( pFrame && !pFrame->IsCellFrame() ); if ( pFrame ) - pBox = static_cast<SwCellFrame*>(pFrame)->GetTabBox(); + pBox = &static_cast<SwCellFrame*>(pFrame)->GetTabBox(); } SwNodeOffset nNd; diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index d8c705b6dc24..4c50ebc8ea9c 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -762,7 +762,7 @@ void SwFEShell::GetTabCols_(SwTabCols &rToFill, const SwFrame *pBox) const if (m_pColumnCache->pLastCellFrame != pBox) { pTab->GetTable()->GetTabCols( *m_pColumnCache->pLastCols, - static_cast<const SwCellFrame*>(pBox)->GetTabBox(), true); + &static_cast<const SwCellFrame*>(pBox)->GetTabBox(), true); m_pColumnCache->pLastCellFrame = pBox; } rToFill = *m_pColumnCache->pLastCols; @@ -1153,8 +1153,8 @@ void SwFEShell::UnProtectCells() } while ( pFrame && !pFrame->IsCellFrame() ); if( pFrame ) { - SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()); - aBoxes.insert( pBox ); + SwTableBox& rBox = const_cast<SwTableBox&>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()); + aBoxes.insert(&rBox); } } @@ -1197,8 +1197,8 @@ bool SwFEShell::CanUnProtectCells() const } while ( pFrame && !pFrame->IsCellFrame() ); if( pFrame ) { - SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()); - aBoxes.insert( pBox ); + SwTableBox& rBox = const_cast<SwTableBox&>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()); + aBoxes.insert(&rBox); } } if( !aBoxes.empty() ) @@ -1367,8 +1367,8 @@ bool SwFEShell::IsAdjustCellWidthAllowed( bool bBalance ) const if (!pFrame) return false; - SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()); - aBoxes.insert( pBox ); + SwTableBox& rBox = const_cast<SwTableBox&>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()); + aBoxes.insert(&rBox); } for (SwTableBox *pBox : aBoxes) @@ -1533,7 +1533,7 @@ bool SwFEShell::DeleteTableSel() // position they'll be set to the old position while( !pFrame->IsCellFrame() ) pFrame = pFrame->GetUpper(); - ParkCursor( *static_cast<SwCellFrame*>(pFrame)->GetTabBox()->GetSttNd() ); + ParkCursor(*static_cast<SwCellFrame*>(pFrame)->GetTabBox().GetSttNd()); bRet = GetDoc()->DeleteRowCol( aBoxes ); @@ -2029,8 +2029,8 @@ bool SwFEShell::SelTableRowCol( const Point& rPt, const Point* pEnd, bool bRowDr pFrame = static_cast<const SwCellFrame*>( static_cast<const SwLayoutFrame*>( pLower )->Lower() ); pLower = pFrame ? pFrame->Lower() : nullptr; } - if( pFrame && pFrame->GetTabBox()->GetSttNd() && - pFrame->GetTabBox()->GetSttNd()->IsInProtectSect() ) + if( pFrame && pFrame->GetTabBox().GetSttNd() && + pFrame->GetTabBox().GetSttNd()->IsInProtectSect() ) pFrame = nullptr; } @@ -2149,8 +2149,8 @@ SwTab SwFEShell::WhichMouseTabCol( const Point &rPt ) const pFrame = static_cast<const SwCellFrame*>(static_cast<const SwLayoutFrame*>(pLower)->Lower()); pLower = pFrame ? pFrame->Lower() : nullptr; } - if( pFrame && ((pFrame->GetTabBox()->GetSttNd() && - pFrame->GetTabBox()->GetSttNd()->IsInProtectSect()) || (pFrame->GetTabBox()->getRowSpan() < 0))) + if( pFrame && ((pFrame->GetTabBox().GetSttNd() && + pFrame->GetTabBox().GetSttNd()->IsInProtectSect()) || (pFrame->GetTabBox().getRowSpan() < 0))) pFrame = nullptr; } @@ -2413,7 +2413,7 @@ void SwFEShell::SetColRowWidthHeight( TableChgWidthHeightType eType, sal_uInt16 /** The cells are destroyed in here */ GetDoc()->SetColRowWidthHeight( - *const_cast<SwTableBox*>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()), + const_cast<SwTableBox&>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()), eType, nDiff, nLogDiff ); ClearFEShellTabCols(*GetDoc(), nullptr); @@ -2430,7 +2430,7 @@ static bool lcl_IsFormulaSelBoxes( const SwTable& rTable, const SwTableBoxFormul { SwTableBox* pBox = aBoxes[ --nSelBoxes ]; - if( std::none_of(rCells.begin(), rCells.end(), [&pBox](SwCellFrame* pFrame) { return pFrame->GetTabBox() == pBox; }) ) + if( std::none_of(rCells.begin(), rCells.end(), [&pBox](SwCellFrame* pFrame) { return &pFrame->GetTabBox() == pBox; }) ) return false; } @@ -2453,7 +2453,7 @@ void SwFEShell::GetAutoSum( OUString& rFormula ) const for( size_t n = aCells.size(); n; ) { SwCellFrame* pCFrame = aCells[ --n ]; - sal_uInt16 nBoxW = pCFrame->GetTabBox()->IsFormulaOrValueBox(); + sal_uInt16 nBoxW = pCFrame->GetTabBox().IsFormulaOrValueBox(); if( !nBoxW ) break; @@ -2465,13 +2465,13 @@ void SwFEShell::GetAutoSum( OUString& rFormula ) const // formula only if box is contained if( RES_BOXATR_FORMULA == nBoxW && !::lcl_IsFormulaSelBoxes( *pTab->GetTable(), pCFrame-> - GetTabBox()->GetFrameFormat()->GetTableBoxFormula(), aCells)) + GetTabBox().GetFrameFormat()->GetTableBoxFormula(), aCells)) { nW = RES_BOXATR_VALUE; // restore previous spaces! for( size_t i = aCells.size(); n+1 < i; ) { - sFields = "|<" + aCells[--i]->GetTabBox()->GetName() + ">" + sFields = "|<" + aCells[--i]->GetTabBox().GetName() + ">" + sFields; } } @@ -2483,7 +2483,7 @@ void SwFEShell::GetAutoSum( OUString& rFormula ) const // search for values, Value/Formula/Text found -> include if( RES_BOXATR_FORMULA == nBoxW && ::lcl_IsFormulaSelBoxes( *pTab->GetTable(), pCFrame-> - GetTabBox()->GetFrameFormat()->GetTableBoxFormula(), aCells )) + GetTabBox().GetFrameFormat()->GetTableBoxFormula(), aCells )) break; else if( USHRT_MAX != nBoxW ) sFields = OUStringChar(cListDelim) + sFields; @@ -2497,7 +2497,7 @@ void SwFEShell::GetAutoSum( OUString& rFormula ) const if( RES_BOXATR_FORMULA == nBoxW ) { if( !::lcl_IsFormulaSelBoxes( *pTab->GetTable(), pCFrame-> - GetTabBox()->GetFrameFormat()->GetTableBoxFormula(), aCells )) + GetTabBox().GetFrameFormat()->GetTableBoxFormula(), aCells )) { // redo only for values! @@ -2506,8 +2506,7 @@ void SwFEShell::GetAutoSum( OUString& rFormula ) const // restore previous spaces! for( size_t i = aCells.size(); n+1 < i; ) { - sFields = "|<" + aCells[--i]->GetTabBox()->GetName() + ">" - + sFields; + sFields = "|<" + aCells[--i]->GetTabBox().GetName() + ">" + sFields; } } else @@ -2523,7 +2522,7 @@ void SwFEShell::GetAutoSum( OUString& rFormula ) const // possibly allow texts?? break; - sFields = "<" + pCFrame->GetTabBox()->GetName() + ">" + sFields; + sFields = "<" + pCFrame->GetTabBox().GetName() + ">" + sFields; } } diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index d92cb55bbb04..28458e754e23 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -314,12 +314,12 @@ void GetTableSel( const SwLayoutFrame* pStart, const SwLayoutFrame* pEnd, OSL_ENSURE( pCell->IsCellFrame(), "Frame without Cell" ); if( ::IsFrameInTableSel( pUnion->GetUnion(), pCell ) ) { - SwTableBox* pBox = const_cast<SwTableBox*>( + SwTableBox& rBox = const_cast<SwTableBox&>( static_cast<const SwCellFrame*>(pCell)->GetTabBox()); // check for cell protection?? if( !bChkProtected || - !pBox->GetFrameFormat()->GetProtect().IsContentProtected() ) - rBoxes.insert( pBox ); + !rBox.GetFrameFormat()->GetProtect().IsContentProtected() ) + rBoxes.insert(&rBox); if ( pCells ) { @@ -739,7 +739,7 @@ bool GetAutoSumSel( const SwCursorShell& rShell, SwCellFrames& rBoxes ) sal_uInt16 nWhichId = 0; for( size_t n = rBoxes.size(); n; ) { - nWhichId = rBoxes[ --n ]->GetTabBox()->IsFormulaOrValueBox(); + nWhichId = rBoxes[ --n ]->GetTabBox().IsFormulaOrValueBox(); if( USHRT_MAX != nWhichId ) break; } @@ -810,7 +810,7 @@ bool GetAutoSumSel( const SwCursorShell& rShell, SwCellFrames& rBoxes ) for( size_t n = rBoxes.size(); n; ) { nWhichId = rBoxes[ --n ] - ->GetTabBox()->IsFormulaOrValueBox(); + ->GetTabBox().IsFormulaOrValueBox(); if( USHRT_MAX != nWhichId ) break; } @@ -990,7 +990,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, if( rUnion.Top() <= pCell->getFrameArea().Top() && rUnion.Bottom() >= pCell->getFrameArea().Bottom() ) { - SwTableBox* pBox = const_cast<SwTableBox*>(static_cast<const SwCellFrame*>(pCell)->GetTabBox()); + SwTableBox* pBox = &const_cast<SwTableBox&>(static_cast<const SwCellFrame*>(pCell)->GetTabBox()); // only overlap to the right? if( ( rUnion.Left() - COLFUZZY ) <= pCell->getFrameArea().Left() && @@ -1583,8 +1583,7 @@ static void lcl_FindStartEndRow( const SwLayoutFrame *&rpStart, if( n ) { const SwCellFrame* pCellFrame = static_cast<const SwCellFrame*>(aSttArr[ n-1 ]); - const SwTableLines& rLns = pCellFrame-> - GetTabBox()->GetTabLines(); + const SwTableLines& rLns = pCellFrame->GetTabBox().GetTabLines(); if( rLns[ 0 ] == static_cast<const SwRowFrame*>(aSttArr[ n ])->GetTabLine() && rLns[ rLns.size() - 1 ] == static_cast<const SwRowFrame*>(aEndArr[ n ])->GetTabLine() ) diff --git a/sw/source/core/inc/cellfrm.hxx b/sw/source/core/inc/cellfrm.hxx index 55a64c686bba..d3d52a4244b9 100644 --- a/sw/source/core/inc/cellfrm.hxx +++ b/sw/source/core/inc/cellfrm.hxx @@ -46,7 +46,7 @@ public: // #i103961# virtual void Cut() override; - const SwTableBox* GetTabBox() const { return &m_rTabBox; } + const SwTableBox& GetTabBox() const { return m_rTabBox; } // used for breaking table rows: SwCellFrame* GetFollowCell() const; diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx index 2fef5cba61d7..699246811b0b 100644 --- a/sw/source/core/layout/dbg_lay.cxx +++ b/sw/source/core/layout/dbg_lay.cxx @@ -541,7 +541,7 @@ static OUString lcl_CellText(const SwCellFrame* pFrame) OUString result; int n = 0; - const SwStartNode* pStartNode = pFrame->GetTabBox()->GetSttNd(); + const SwStartNode* pStartNode = pFrame->GetTabBox().GetSttNd(); const SwEndNode* pEndNode = pStartNode->EndOfSectionNode(); const SwNodes& nodes = pStartNode->GetNodes(); @@ -567,7 +567,7 @@ static OUString lcl_CellText(const SwCellFrame* pFrame) static OString lcl_CellInfo(const SwCellFrame* pFrame) { - const OUString text = "CellInfo: " + pFrame->GetTabBox()->GetName() + " Text: " + lcl_CellText(pFrame); + const OUString text = "CellInfo: " + pFrame->GetTabBox().GetName() + " Text: " + lcl_CellText(pFrame); return OUStringToOString(text, RTL_TEXTENCODING_ASCII_US); } diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 3b367632d87a..08722393e0f5 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -1843,7 +1843,7 @@ SwCellFrame* SwCellFrame::GetPreviousCell() const SwRowFrame* pMasterRow = static_cast<SwRowFrame*>(pMaster->GetLastLower()); if ( pMasterRow ) pRet = lcl_FindCorrespondingCellFrame( *static_cast<const SwRowFrame*>(pRow), *this, *pMasterRow, false ); - if ( pRet && pRet->GetTabBox()->getRowSpan() < 1 ) + if (pRet && pRet->GetTabBox().getRowSpan() < 1) pRet = &const_cast<SwCellFrame&>(pRet->FindStartEndOfRowSpanCell( true )); } } @@ -1861,7 +1861,7 @@ const SwCellFrame& SwCellFrame::FindStartEndOfRowSpanCell( bool bStart ) const return *this; OSL_ENSURE( pTableFrame && - ( (bStart && GetTabBox()->getRowSpan() < 1) || + ( (bStart && GetTabBox().getRowSpan() < 1) || (!bStart && GetLayoutRowSpan() > 1) ), "SwCellFrame::FindStartRowSpanCell: No rowspan, no table, no cookies" ); @@ -1898,14 +1898,14 @@ const SwCellFrame& SwCellFrame::FindStartEndOfRowSpanCell( bool bStart ) const // is set) we assure that we find a rMasterBox that has a SwCellFrame in // the current table frame: const SwTableBox& rMasterBox = bStart ? - GetTabBox()->FindStartOfRowSpan( *pTable, nMax ) : - GetTabBox()->FindEndOfRowSpan( *pTable, nMax ); + GetTabBox().FindStartOfRowSpan(*pTable, nMax) : + GetTabBox().FindEndOfRowSpan(*pTable, nMax); SwIterator<SwCellFrame,SwFormat> aIter( *rMasterBox.GetFrameFormat() ); for ( SwCellFrame* pMasterCell = aIter.First(); pMasterCell; pMasterCell = aIter.Next() ) { - if ( pMasterCell->GetTabBox() == &rMasterBox ) + if (&pMasterCell->GetTabBox() == &rMasterBox) { const SwTabFrame* pMasterTable = static_cast<const SwTabFrame*>(pMasterCell->GetUpper()->GetUpper()); diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index cb09dca89c42..baebde837ba6 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2399,7 +2399,7 @@ void SwTabFramePainter::HandleFrame(const SwLayoutFrame& rLayoutFrame, const SwR { const SwCellFrame* pThisCell = static_cast<const SwCellFrame*>(&rLayoutFrame); const SwRowFrame* pRowFrame = static_cast<const SwRowFrame*>(pThisCell->GetUpper()); - const tools::Long nRowSpan = pThisCell->GetTabBox()->getRowSpan(); + const tools::Long nRowSpan = pThisCell->GetTabBox().getRowSpan(); if ( !pRowFrame->IsRowSpanLine() || nRowSpan > 1 || nRowSpan < -1 ) { SwBorderAttrAccess aAccess( SwFrame::GetCache(), &rLayoutFrame ); @@ -2824,7 +2824,7 @@ static bool lcl_IsLastVisibleCellBeforeHiddenCellAtTheEndOfRow( && rBoxItem.GetLeft() // last visible table cell isn't equal to the last cell: // there are invisible deleted cells in Hide Changes mode - && pThisRowFrame->GetTabLine()->GetTabBoxes().back() != pThisCell->GetTabBox(); + && pThisRowFrame->GetTabLine()->GetTabBoxes().back() != &pThisCell->GetTabBox(); } void SwTabFramePainter::InsertFollowTopBorder(const SwFrame& rFrame, const SvxBoxItem& rBoxItem, @@ -6906,7 +6906,7 @@ void SwFrame::PaintSwFrameBackground( const SwRect &rRect, const SwPageFrame *pP } else if ( IsCellFrame() && !bHideTableRedlines ) { - RedlineType eType = static_cast<const SwCellFrame*>(this)->GetTabBox()->GetRedlineType(); + RedlineType eType = static_cast<const SwCellFrame*>(this)->GetTabBox().GetRedlineType(); if ( RedlineType::Delete == eType || RedlineType::Insert == eType ) { pCol = RedlineType::Delete == eType ? COL_AUTHOR_TABLE_DEL : COL_AUTHOR_TABLE_INS; diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 3ab3b5cdecd0..e98ce4ac5d7d 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -204,13 +204,13 @@ void SwFrame::CheckDirChange() if ( IsCellFrame() && GetUpper() ) { if ( IsVertical() != GetUpper()->IsVertical() && - static_cast<SwCellFrame*>(this)->GetTabBox()->getRowSpan() == 1 ) + static_cast<SwCellFrame*>(this)->GetTabBox().getRowSpan() == 1 ) { enum { MIN_VERT_CELL_HEIGHT = 1135 }; - SwTableLine* pLine = const_cast<SwTableLine*>(static_cast<SwCellFrame*>(this)->GetTabBox()->GetUpper()); + SwTableLine* pLine = const_cast<SwTableLine*>(static_cast<SwCellFrame*>(this)->GetTabBox().GetUpper()); SwFrameFormat* pFrameFormat = pLine->GetFrameFormat(); SwFormatFrameSize aNew( pFrameFormat->GetFrameSize() ); if ( SwFrameSize::Fixed != aNew.GetHeightSizeType() ) @@ -602,7 +602,7 @@ SwRect SwFrame::GetPaintArea() const { if( pTmp->IsCellFrame() && pTmp->GetUpper() && pTmp->GetUpper()->IsVertical() != pTmp->IsVertical() ) - nRowSpan = static_cast<const SwCellFrame*>(pTmp)->GetTabBox()->getRowSpan(); + nRowSpan = static_cast<const SwCellFrame*>(pTmp)->GetTabBox().getRowSpan(); tools::Long nTmpRight = aRectFnSet.GetRight(pTmp->getFrameArea()); tools::Long nTmpLeft = aRectFnSet.GetLeft(pTmp->getFrameArea()); if( pTmp->IsRowFrame() && nRowSpan > 1 ) diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 775c1831f039..7623123d7fe1 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -348,7 +348,7 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow ) while ( pCurrMasterCell ) { // NEW TABLES - SwCellFrame& rToAdjust = pCurrMasterCell->GetTabBox()->getRowSpan() < 1 ? + SwCellFrame& rToAdjust = pCurrMasterCell->GetTabBox().getRowSpan() < 1 ? const_cast<SwCellFrame&>(pCurrMasterCell->FindStartEndOfRowSpanCell( true )) : *pCurrMasterCell; @@ -507,7 +507,7 @@ static void lcl_MoveRowContent( SwRowFrame& rSourceLine, SwRowFrame& rDestLine ) { // NEW TABLES SwCellFrame* pDestCell = pCurrDestCell; - if ( pDestCell->GetTabBox()->getRowSpan() < 1 ) + if ( pDestCell->GetTabBox().getRowSpan() < 1 ) pDestCell = & const_cast<SwCellFrame&>(pDestCell->FindStartEndOfRowSpanCell( true )); // Find last content @@ -855,7 +855,7 @@ static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, SwRowFrame& rFollowLine, SwCellFrame* pCurrMasterCell = static_cast<SwCellFrame*>(rLastLine.Lower()); while ( pCurrMasterCell ) { - if ( !pCurrMasterCell->ContainsContent() && pCurrMasterCell->GetTabBox()->getRowSpan() >= 1 ) + if (!pCurrMasterCell->ContainsContent() && pCurrMasterCell->GetTabBox().getRowSpan() >= 1) { bRet = false; break; @@ -945,7 +945,7 @@ static tools::Long lcl_GetMaximumLayoutRowSpan( const SwRowFrame& rRow ) const SwCellFrame* pLower = static_cast<const SwCellFrame*>( pCurrentRowFrame->Lower()); while ( pLower ) { - if ( pLower->GetTabBox()->getRowSpan() < 0 ) + if (pLower->GetTabBox().getRowSpan() < 0) { ++nRet; bNextRow = true; @@ -1305,7 +1305,7 @@ bool SwTabFrame::Split(const SwTwips nCutPos, bool bTryToSplit, pCellFrame; pCellFrame = static_cast<const SwCellFrame*>(pCellFrame->GetNext())) { - if (pCellFrame->GetTabBox()->getRowSpan() > 1) // Master cell + if (pCellFrame->GetTabBox().getRowSpan() > 1) // Master cell { bCellSpanCanSplit = true; break; @@ -1434,7 +1434,7 @@ bool SwTabFrame::Split(const SwTwips nCutPos, bool bTryToSplit, const SwCellFrame* pCellFrame = static_cast<const SwCellFrame*>(pFollowRow->GetLower()); while ( pCellFrame ) { - if ( pCellFrame->GetTabBox()->getRowSpan() < 1 ) + if (pCellFrame->GetTabBox().getRowSpan() < 1) { pLastRow = static_cast<SwRowFrame*>(pRow->GetPrev()); break; @@ -1744,7 +1744,7 @@ void SwInvalidateAll( SwFrame *pFrame, tools::Long nBottom ) if (pFrame->IsCellFrame()) { SwCellFrame* pThisCell = static_cast<SwCellFrame*>(pFrame); - if ( pThisCell->GetTabBox()->getRowSpan() < 1 ) + if (pThisCell->GetTabBox().getRowSpan() < 1) { pToInvalidate = & const_cast<SwCellFrame&>(pThisCell->FindStartEndOfRowSpanCell( true )); pToInvalidate->InvalidatePos_(); @@ -1932,7 +1932,7 @@ static bool lcl_InnerCalcLayout( SwFrame *pFrame, if (pFrame->IsCellFrame()) { SwCellFrame* pThisCell = static_cast<SwCellFrame*>(pFrame); - if ( pThisCell->GetTabBox()->getRowSpan() < 1 ) + if (pThisCell->GetTabBox().getRowSpan() < 1) { SwCellFrame& rToCalc = const_cast<SwCellFrame&>(pThisCell->FindStartEndOfRowSpanCell( true )); bRet |= !rToCalc.isFrameAreaDefinitionValid(); @@ -2402,7 +2402,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) pCellFrame; pCellFrame = static_cast<const SwCellFrame*>(pCellFrame->GetNext())) { - if (pCellFrame->GetTabBox()->getRowSpan() > 1) // Master cell + if (pCellFrame->GetTabBox().getRowSpan() > 1) // Master cell { bCellSpanCanSplit = true; break; @@ -3001,7 +3001,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) pLower = pLower->GetNext()) { auto pCellFrame = static_cast<const SwCellFrame*>(pLower); - if (pCellFrame->GetTabBox()->getRowSpan() != 1) + if (pCellFrame->GetTabBox().getRowSpan() != 1) { // The cell has a rowspan, don't split the row itself in this // case (but just move it forward, i.e. split between the rows). @@ -5486,7 +5486,7 @@ void SwRowFrame::AdjustCells( const SwTwips nHeight, const bool bHeight ) // Current frame is a covered frame: // Set new height for covered cell and adjust master cell: - if ( pCellFrame->GetTabBox()->getRowSpan() < 1 ) + if (pCellFrame->GetTabBox().getRowSpan() < 1) { // Set height of current (covered) cell to new line height. const tools::Long nDiff = nHeight - aRectFnSet.GetHeight(pCellFrame->getFrameArea()); @@ -6105,7 +6105,7 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder } } // #i26945# - tools::Long nRemaining = GetTabBox()->getRowSpan() >= 1 ? + tools::Long nRemaining = GetTabBox().getRowSpan() >= 1 ? ::lcl_CalcMinCellHeight( this, pTab->IsConsiderObjsForMinCellHeight(), pAttrs ) : 0; if ( !isFrameAreaSizeValid() ) @@ -6137,7 +6137,7 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder if ( pTab->GetTable()->IsNewModel() ) { // 1. sum of widths of cells up to this cell (in model) - const SwTableLine* pTabLine = GetTabBox()->GetUpper(); + const SwTableLine* pTabLine = GetTabBox().GetUpper(); const SwTableBoxes& rBoxes = pTabLine->GetTabBoxes(); const SwTableBox* pTmpBox = nullptr; @@ -6148,7 +6148,7 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder pTmpBox = rBoxes[ i++ ]; nSumWidth += pTmpBox->GetFrameFormat()->GetFrameSize().GetWidth(); } - while ( pTmpBox != GetTabBox() ); + while (pTmpBox != &GetTabBox()); // 2. calculate actual width of cells up to this one double nTmpWidth = nSumWidth; @@ -6370,7 +6370,7 @@ void SwCellFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) if(rHint.GetId() == SfxHintId::SwTableBoxFormatChanged) { auto pNewFormatHint = static_cast<const sw::TableBoxFormatChanged*>(&rHint); - if(GetTabBox() != &pNewFormatHint->m_rTableBox) + if (&GetTabBox() != &pNewFormatHint->m_rTableBox) return; RegisterToFormat(const_cast<SwTableBoxFormat&>(pNewFormatHint->m_rNewFormat)); InvalidateSize(); @@ -6394,7 +6394,7 @@ void SwCellFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) else if(rHint.GetId() == SfxHintId::SwMoveTableBox) { auto pMoveTableBoxHint = static_cast<const sw::MoveTableBoxHint*>(&rHint); - if(GetTabBox() != &pMoveTableBoxHint->m_rTableBox) + if (&GetTabBox() != &pMoveTableBoxHint->m_rTableBox) return; const_cast<SwFrameFormat*>(&pMoveTableBoxHint->m_rNewFormat)->Add(*this); InvalidateAll(); @@ -6504,8 +6504,7 @@ void SwCellFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) tools::Long SwCellFrame::GetLayoutRowSpan() const { - const SwTableBox *pTabBox = GetTabBox(); - tools::Long nRet = pTabBox ? pTabBox->getRowSpan() : 0; + tools::Long nRet = GetTabBox().getRowSpan(); if ( nRet < 1 ) { const SwFrame* pRow = GetUpper(); @@ -6974,7 +6973,7 @@ SwTwips SwTabFrame::CalcHeightOfFirstContentLine() const const SwCellFrame* pLower2 = static_cast<const SwCellFrame*>(pFirstRow->Lower()); while ( pLower2 ) { - if ( 1 == pLower2->GetTabBox()->getRowSpan() ) + if (1 == pLower2->GetTabBox().getRowSpan()) { const SwTwips nCellHeight = lcl_CalcMinCellHeight( pLower2, true ); nMaxHeight = std::max( nCellHeight, nMaxHeight ); diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index b7c3df403152..3233de6a5505 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -2034,9 +2034,9 @@ bool SwRootFrame::MakeTableCursors( SwTableCursor& rTableCursor ) (bReadOnlyAvailable || !pCell->GetFormat()->GetProtect().IsContentProtected())) { - SwTableBox* pInsBox = const_cast<SwTableBox*>( + SwTableBox& rInsBox = const_cast<SwTableBox&>( static_cast<const SwCellFrame*>(pCell)->GetTabBox()); - aNew.insert( pInsBox ); + aNew.insert(&rInsBox); } if ( pCell->GetNext() ) { @@ -2580,7 +2580,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor const& rCursor, SwRects & rRects, //Now the frames between, if there are any bool const bBody = pStartFrame->IsInDocBody(); const SwTableBox* pCellBox = pStartFrame->GetUpper()->IsCellFrame() ? - static_cast<const SwCellFrame*>(pStartFrame->GetUpper())->GetTabBox() : nullptr; + &static_cast<const SwCellFrame*>(pStartFrame->GetUpper())->GetTabBox() : nullptr; assert(pSh); if (pSh->IsSelectAll()) pCellBox = nullptr; @@ -2605,7 +2605,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor const& rCursor, SwRects & rRects, // If pStartFrame is inside a SwCellFrame, consider only frames which are inside the // same cell frame (or its follow cell) const SwTableBox* pTmpCellBox = pContent->GetUpper()->IsCellFrame() ? - static_cast<const SwCellFrame*>(pContent->GetUpper())->GetTabBox() : nullptr; + &static_cast<const SwCellFrame*>(pContent->GetUpper())->GetTabBox() : nullptr; if (pSh->IsSelectAll()) pTmpCellBox = nullptr; if ( bBody == pContent->IsInDocBody() && diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index b3afcb4999cd..2ddd920ed1f3 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -2809,7 +2809,7 @@ SwTwips SwLayoutFrame::GrowFrame(SwTwips nDist, SwResizeLimitReason& reason, boo if ( pThisCell->GetLayoutRowSpan() > 1 ) { SwCellFrame& rEndCell = const_cast<SwCellFrame&>(pThisCell->FindStartEndOfRowSpanCell( false )); - if ( -1 == rEndCell.GetTabBox()->getRowSpan() ) + if ( -1 == rEndCell.GetTabBox().getRowSpan() ) pToGrow = rEndCell.GetUpper(); else { diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index 3a94085227bd..84c3f41eed02 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -593,7 +593,7 @@ static void lcl_InvalidateCellFrame( const SwTableBox& rBox ) SwIterator<SwCellFrame,SwFormat> aIter( *rBox.GetFrameFormat() ); for( SwCellFrame* pCell = aIter.First(); pCell; pCell = aIter.Next() ) { - if( pCell->GetTabBox() == &rBox ) + if (&pCell->GetTabBox() == &rBox) { pCell->InvalidateSize(); SwFrame* pLower = pCell->GetLower(); diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index ce3da88f56c0..313d597408e2 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -1425,7 +1425,7 @@ SwTableBox* SwTable::GetTableBox( SwNodeOffset nSttIdx ) while ( pFrame && !pFrame->IsCellFrame() ) pFrame = pFrame->GetUpper(); if ( pFrame ) - pRet = const_cast<SwTableBox*>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()); + pRet = &const_cast<SwTableBox&>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()); } // In case the layout doesn't exist yet or anything else goes wrong. @@ -2159,7 +2159,7 @@ SwTableBoxFormat* SwTableBox::ClaimFrameFormat() // re-register SwCellFrame objects that know me SwIterator<SwCellFrame,SwFormat> aFrameIter( *pRet ); for( SwCellFrame* pCell = aFrameIter.First(); pCell; pCell = aFrameIter.Next() ) - if( pCell->GetTabBox() == this ) + if (&pCell->GetTabBox() == this) pCell->RegisterToFormat( *pNewFormat ); // re-register myself @@ -3179,8 +3179,8 @@ const SwCellFrame * SwTableCellInfo::Impl::getNextTableBoxsCellFrame(const SwFra while ((pFrame = getNextCellFrame(pFrame)) != nullptr) { const SwCellFrame * pCellFrame = static_cast<const SwCellFrame *>(pFrame); - const SwTableBox * pTabBox = pCellFrame->GetTabBox(); - auto aIt = m_HandledTableBoxes.insert(pTabBox); + const SwTableBox& rTabBox = pCellFrame->GetTabBox(); + auto aIt = m_HandledTableBoxes.insert(&rTabBox); if (aIt.second) { pResult = pCellFrame; @@ -3239,7 +3239,7 @@ const SwTableBox * SwTableCellInfo::getTableBox() const const SwTableBox * pRet = nullptr; if (getCellFrame() != nullptr) - pRet = getCellFrame()->GetTabBox(); + pRet = &getCellFrame()->GetTabBox(); return pRet; } diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 10de19d814f0..43d120a1fe83 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -370,7 +370,7 @@ void const* lcl_GetKeyFromFrame( const SwFrame& rFrame ) { const SwTabFrame* pTabFrame = rFrame.FindTabFrame(); const SwTable* pTable = pTabFrame->GetTable(); - pKey = static_cast<void const *>(& static_cast<const SwCellFrame&>(rFrame).GetTabBox()->FindStartOfRowSpan(*pTable)); + pKey = static_cast<void const *>(& static_cast<const SwCellFrame&>(rFrame).GetTabBox().FindStartOfRowSpan(*pTable)); } else if (rFrame.IsFootnoteFrame()) { @@ -984,7 +984,7 @@ void SwTaggedPDFHelper::SetAttributes(vcl::pdf::StructElement eType) if ( pFrame->IsCellFrame() ) { const SwCellFrame* pThisCell = static_cast<const SwCellFrame*>(pFrame); - nVal = pThisCell->GetTabBox()->getRowSpan(); + nVal = pThisCell->GetTabBox().getRowSpan(); if ( nVal > 1 ) mpPDFExtOutDevData->SetStructureAttributeNumerical( vcl::pdf::PDFWriter::RowSpan, nVal ); commit 1d5784045ec1aaec1f3062ca3a8dfcd7639aa25d Author: Michael Weghorn <[email protected]> AuthorDate: Wed Mar 4 09:23:16 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Mar 4 12:08:16 2026 +0100 sw: Switch SwCellFrame::m_pTabBox to reference ... and rename accordingly. SwCellFrame::GetTabBox will also be switched in an upcoming commit. Change-Id: I1ae14b5cb43d45d6a7fa72fefcfb6f62e365cc3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200929 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/sw/source/core/inc/cellfrm.hxx b/sw/source/core/inc/cellfrm.hxx index d0c79e3b7f20..55a64c686bba 100644 --- a/sw/source/core/inc/cellfrm.hxx +++ b/sw/source/core/inc/cellfrm.hxx @@ -27,7 +27,7 @@ class SwTableBox; /// SwCellFrame is one table cell in the document layout. class SW_DLLPUBLIC SwCellFrame final : public SwLayoutFrame { - const SwTableBox* m_pTabBox; + const SwTableBox& m_rTabBox; virtual void DestroyImpl() override; virtual ~SwCellFrame() override; @@ -46,7 +46,7 @@ public: // #i103961# virtual void Cut() override; - const SwTableBox *GetTabBox() const { return m_pTabBox; } + const SwTableBox* GetTabBox() const { return &m_rTabBox; } // used for breaking table rows: SwCellFrame* GetFollowCell() const; diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 7f0757ba9c88..775c1831f039 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -5792,7 +5792,7 @@ bool SwRowFrame::ShouldRowKeepWithNext( const bool bCheckParents ) const SwCellFrame::SwCellFrame(const SwTableBox &rBox, SwFrame* pSib, bool bInsertContent) : SwLayoutFrame( rBox.GetFrameFormat(), pSib ) - , m_pTabBox( &rBox ) + , m_rTabBox(rBox) { mnFrameType = SwFrameType::Cell; commit bcb0c914f7ddb0be5941f7ed430ab043b56531c4 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Mar 4 09:18:23 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Mar 4 12:08:09 2026 +0100 tdf#171086 sw a11y: Extract helper to get SwCellFrame Have a single place where the casting happens. Change-Id: I9b4cff4bac8d709a573208a410e3ad395a78fdc7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200928 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx index 69a033ee8f0d..4d065328a9a0 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -57,9 +57,7 @@ bool SwAccessibleCell::IsSelected() { if( pCSh->IsTableMode() ) { - const SwCellFrame *pCFrame = - static_cast< const SwCellFrame * >( GetFrame() ); - const SwTableBox* pBox = pCFrame->GetTabBox(); + const SwTableBox* pBox = GetCellFrame().GetTabBox(); SwSelBoxes const& rBoxes(pCSh->GetTableCursor()->GetSelectedBoxes()); bRet = rBoxes.find(pBox) != rBoxes.end(); } @@ -248,15 +246,16 @@ void SwAccessibleCell::InvalidatePosOrSize( const SwRect& rOldBox ) SwAccessibleContext::InvalidatePosOrSize( rOldBox ); } -// XAccessibleValue +const SwCellFrame& SwAccessibleCell::GetCellFrame() const +{ + const SwFrame* pSwFrame = GetFrame(); + assert(pSwFrame && pSwFrame->IsCellFrame()); + return static_cast<const SwCellFrame&>(*pSwFrame); +} SwFrameFormat* SwAccessibleCell::GetTableBoxFormat() const { - assert(GetFrame()); - assert(GetFrame()->IsCellFrame()); - - const SwCellFrame* pCellFrame = static_cast<const SwCellFrame*>( GetFrame() ); - return pCellFrame->GetTabBox()->GetFrameFormat(); + return GetCellFrame().GetTabBox()->GetFrameFormat(); } //Implement TableCell currentValue diff --git a/sw/source/core/access/acccell.hxx b/sw/source/core/access/acccell.hxx index aae9827d0f99..289568ef95d0 100644 --- a/sw/source/core/access/acccell.hxx +++ b/sw/source/core/access/acccell.hxx @@ -72,6 +72,7 @@ public: // XAccessibleExtendedAttributes OUString SAL_CALL getExtendedAttributes() override; private: + const SwCellFrame& GetCellFrame() const; SwFrameFormat* GetTableBoxFormat() const; public:
