sw/inc/swtable.hxx | 2 +- sw/source/core/doc/tblrwcl.cxx | 10 +++++----- sw/source/core/docnode/ndtbl.cxx | 7 +++---- sw/source/core/table/swtable.cxx | 2 +- sw/source/filter/xml/xmltbli.cxx | 4 ++-- 5 files changed, 12 insertions(+), 13 deletions(-)
New commits: commit 713592e2503c7fb2acfc713b9db2c15cd2ec806d Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Sep 6 15:57:41 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Sep 7 09:34:11 2024 +0200 return SwTableBoxFormat from SwTableBox::ClaimFrameFormat since that is always the SwFrameFormat subclass we are attached to Change-Id: If4bcff17d3983f1fc55b4a25c7c4e40e9087a1a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172972 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index dc156ded1b30..c28ce241a8f1 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -492,7 +492,7 @@ public: bool HasDirectFormatting() const { return mbDirectFormatting; } // Creates its own FrameFormat if more boxes depend on it. - SwFrameFormat* ClaimFrameFormat(); + SwTableBoxFormat* ClaimFrameFormat(); void ChgFrameFormat( SwTableBoxFormat *pNewFormat, bool bNeedToReregister = true ); void RemoveFromTable(); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 13dc1a20250b..bc1333591853 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -227,7 +227,7 @@ static void lcl_CopyCol( FndBox_ & rFndBox, CpyPara *const pCpyPara) if( itFind == pCpyPara->rTabFrameArr.end() || !(*itFind == aFindFrame) ) { // For nested copying, also save the new Format as an old one. - SwTableBoxFormat* pNewFormat = static_cast<SwTableBoxFormat*>(pBox->ClaimFrameFormat()); + SwTableBoxFormat* pNewFormat = pBox->ClaimFrameFormat(); // Find the selected Boxes in the Line: FndLine_ const* pCmpLine = nullptr; @@ -1090,7 +1090,7 @@ bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn SwTableBoxFormat* pCpyBoxFrameFormat = pSelBox->GetFrameFormat(); bool bChkBorder = nullptr != pCpyBoxFrameFormat->GetBox().GetTop(); if( bChkBorder ) - pCpyBoxFrameFormat = static_cast<SwTableBoxFormat*>(pSelBox->ClaimFrameFormat()); + pCpyBoxFrameFormat = pSelBox->ClaimFrameFormat(); for( sal_uInt16 i = 0; i <= nCnt; ++i ) { @@ -1116,7 +1116,7 @@ bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn if( bChkBorder ) { - pCpyBoxFrameFormat = static_cast<SwTableBoxFormat*>(pNewLine->GetTabBoxes()[ 0 ]->ClaimFrameFormat()); + pCpyBoxFrameFormat = pNewLine->GetTabBoxes()[ 0 ]->ClaimFrameFormat(); SvxBoxItem aTmp( pCpyBoxFrameFormat->GetBox() ); aTmp.SetLine( nullptr, SvxBoxItemLine::TOP ); pCpyBoxFrameFormat->SetFormatAttr( aTmp ); @@ -1139,7 +1139,7 @@ bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn } } // In Boxes with Lines, we can only have Size/Fillorder - pFrameFormat = static_cast<SwTableBoxFormat*>(pNewBox->ClaimFrameFormat()); + pFrameFormat = pNewBox->ClaimFrameFormat(); pFrameFormat->ResetFormatAttr( RES_LR_SPACE, RES_FRMATR_END - 1 ); pFrameFormat->ResetFormatAttr( RES_BOXATR_BEGIN, RES_BOXATR_END - 1 ); } @@ -1201,7 +1201,7 @@ bool SwTable::SplitCol(SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt) if( itFind == aFrameArr.end() || !(*itFind == aFindFrame) ) { // Change the FrameFormat - aFindFrame.pNewFrameFormat = static_cast<SwTableBoxFormat*>(pSelBox->ClaimFrameFormat()); + aFindFrame.pNewFrameFormat = pSelBox->ClaimFrameFormat(); SwTwips nBoxSz = aFindFrame.pNewFrameFormat->GetFrameSize().GetWidth(); SwTwips nNewBoxSz = nBoxSz / ( nCnt + 1 ); aFindFrame.pNewFrameFormat->SetFormatAttr( SwFormatFrameSize( SwFrameSize::Variable, diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index f5f3483ec914..b36fd35dba4b 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -4147,7 +4147,7 @@ void SwDoc::ChkBoxNumFormat( SwTableBox& rBox, bool bCallUpdate ) if( bSetNumberFormat || bForceNumberFormat ) { - pBoxFormat = static_cast<SwTableBoxFormat*>(rBox.ClaimFrameFormat()); + pBoxFormat = rBox.ClaimFrameFormat(); aBoxSet.Put( SwTableBoxValue( fNumber )); aBoxSet.Put( SwTableBoxNumFormat( nFormatIdx )); @@ -4183,7 +4183,7 @@ void SwDoc::ChkBoxNumFormat( SwTableBox& rBox, bool bCallUpdate ) pUndo.reset(new SwUndoTableNumFormat( rBox )); } - pBoxFormat = static_cast<SwTableBoxFormat*>(rBox.ClaimFrameFormat()); + pBoxFormat = rBox.ClaimFrameFormat(); // Remove all number formats sal_uInt16 nWhich1 = RES_BOXATR_FORMULA; @@ -4526,8 +4526,7 @@ bool SwDoc::UnProtectCells( const SwSelBoxes& rBoxes ) pBox->ChgFrameFormat(it->second); else { - SwTableBoxFormat *const pNewBoxFormat( - static_cast<SwTableBoxFormat*>(pBox->ClaimFrameFormat())); + SwTableBoxFormat *const pNewBoxFormat(pBox->ClaimFrameFormat()); pNewBoxFormat->ResetFormatAttr( RES_PROTECT ); aFormatsMap.insert(std::make_pair(pBoxFormat, pNewBoxFormat)); } diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 73d71a6df459..fbda582fb3f9 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -2133,7 +2133,7 @@ SwTableBoxFormat* SwTableBox::CheckBoxFormat( SwTableBoxFormat* pFormat ) return pFormat; } -SwFrameFormat* SwTableBox::ClaimFrameFormat() +SwTableBoxFormat* SwTableBox::ClaimFrameFormat() { // This method makes sure that this object is an exclusive SwTableBox client // of an SwTableBoxFormat object diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 65819f0afb3d..2655317127cd 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1721,7 +1721,7 @@ SwTableBoxFormat* SwXMLTableContext::GetSharedBoxFormat( // get the old format, and reset all attributes // (but preserve FillOrder) - pBoxFormat2 = static_cast<SwTableBoxFormat*>(pBox->ClaimFrameFormat()); + pBoxFormat2 = pBox->ClaimFrameFormat(); SwFormatFillOrder aFillOrder( pBoxFormat2->GetFillOrder() ); pBoxFormat2->ResetAllFormatAttr(); // #i73790# - method renamed pBoxFormat2->SetFormatAttr( aFillOrder ); @@ -1740,7 +1740,7 @@ SwTableBoxFormat* SwXMLTableContext::GetSharedBoxFormat( // claim it, if we are not allowed to share if ( !bMayShare ) - pBoxFormat2 = static_cast<SwTableBoxFormat*>(pBox->ClaimFrameFormat()); + pBoxFormat2 = pBox->ClaimFrameFormat(); } // lock format (if so desired)