sw/inc/swtable.hxx | 4 ++-- sw/source/core/doc/tblrwcl.cxx | 20 ++++++++++---------- sw/source/core/docnode/ndcopy.cxx | 2 +- sw/source/core/docnode/ndtbl.cxx | 4 ++-- sw/source/core/edit/edtab.cxx | 2 +- sw/source/core/fields/ddetbl.cxx | 2 +- sw/source/core/frmedt/tblsel.cxx | 4 ++-- sw/source/core/table/swnewtable.cxx | 6 +++--- sw/source/core/table/swtable.cxx | 2 +- sw/source/core/undo/untbl.cxx | 4 ++-- sw/source/filter/html/htmltab.cxx | 2 +- sw/source/filter/ww8/ww8par2.cxx | 2 +- sw/source/filter/xml/xmltbli.cxx | 2 +- 13 files changed, 28 insertions(+), 28 deletions(-)
New commits: commit edc20f4d34d102b385ece53a60abad0047661661 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Sep 5 19:30:48 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Sep 6 10:41:45 2024 +0200 return SwTableBoxFormat from SwTableBox::GetFrameFormat since that is always the SwFrameFormat subclass we are attached to Change-Id: Iaac0503818c7c9c8e2563ad0dd7d689bdddb8438 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172922 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 4f4c5672ae4d..368665e5008c 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -480,8 +480,8 @@ public: const SwTableLine *GetUpper() const { return m_pUpper; } void SetUpper( SwTableLine *pNew ) { m_pUpper = pNew; } - SwFrameFormat* GetFrameFormat() { return static_cast<SwFrameFormat*>(GetRegisteredIn()); } - SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); } + SwTableBoxFormat* GetFrameFormat() { return static_cast<SwTableBoxFormat*>(GetRegisteredIn()); } + SwTableBoxFormat* GetFrameFormat() const { return const_cast<SwTableBoxFormat*>(static_cast<const SwTableBoxFormat*>(GetRegisteredIn())); } /// Set that this table box contains formatting that is not set by the table style. void SetDirectFormatting(bool bDirect) { mbDirectFormatting = bDirect; } diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 35e573d89d7c..e71982fd6077 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -286,7 +286,7 @@ static void lcl_CopyCol( FndBox_ & rFndBox, CpyPara *const pCpyPara) itFind != pCpyPara->rTabFrameArr.end() ) aFindFrame = *itFind; else - aFindFrame.pNewFrameFormat = static_cast<SwTableBoxFormat*>(pBox->GetFrameFormat()); + aFindFrame.pNewFrameFormat = pBox->GetFrameFormat(); } if (!rFndBox.GetLines().empty()) @@ -333,7 +333,7 @@ static void lcl_CopyCol( FndBox_ & rFndBox, CpyPara *const pCpyPara) pCpyPara->nInsPos - 1 ]; } - aFindFrame.pNewFrameFormat = static_cast<SwTableBoxFormat*>(pBox->GetFrameFormat()); + aFindFrame.pNewFrameFormat = pBox->GetFrameFormat(); // Else we copy before that and the first Line keeps the TopLine // and we remove it at the original @@ -1055,7 +1055,7 @@ bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn // Insert nCnt new Lines into the Box SwTableLine* pInsLine = pSelBox->GetUpper(); - SwTableBoxFormat* pFrameFormat = static_cast<SwTableBoxFormat*>(pSelBox->GetFrameFormat()); + SwTableBoxFormat* pFrameFormat = pSelBox->GetFrameFormat(); // Respect the Line's height, reset if needed SwFormatFrameSize aFSz( pInsLine->GetFrameFormat()->GetFrameSize() ); @@ -1087,7 +1087,7 @@ bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn } } - SwTableBoxFormat* pCpyBoxFrameFormat = static_cast<SwTableBoxFormat*>(pSelBox->GetFrameFormat()); + SwTableBoxFormat* pCpyBoxFrameFormat = pSelBox->GetFrameFormat(); bool bChkBorder = nullptr != pCpyBoxFrameFormat->GetBox().GetTop(); if( bChkBorder ) pCpyBoxFrameFormat = static_cast<SwTableBoxFormat*>(pSelBox->ClaimFrameFormat()); @@ -1195,7 +1195,7 @@ bool SwTable::SplitCol(SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt) // Find the Frame Format in the Frame Format Array SwTableBoxFormat* pLastBoxFormat; - CpyTabFrame aFindFrame( static_cast<SwTableBoxFormat*>(pSelBox->GetFrameFormat()) ); + CpyTabFrame aFindFrame( pSelBox->GetFrameFormat() ); CpyTabFrames::const_iterator itFind = aFrameArr.lower_bound( aFindFrame ); const size_t nFndPos = itFind - aFrameArr.begin(); if( itFind == aFrameArr.end() || !(*itFind == aFindFrame) ) @@ -1404,7 +1404,7 @@ static void lcl_Merge_MoveBox(FndBox_ & rFndBox, InsULPara *const pULPara) return; SwTableBox* pBox = new SwTableBox( - static_cast<SwTableBoxFormat*>(rFndBox.GetBox()->GetFrameFormat()), + rFndBox.GetBox()->GetFrameFormat(), 0, pULPara->pInsLine ); InsULPara aPara( *pULPara ); aPara.pInsBox = pBox; @@ -1469,7 +1469,7 @@ static void lcl_Merge_MoveLine(FndLine_& rFndLine, InsULPara *const pULPara) // inserted SwTableLine* pInsLine = pULPara->pLeftBox->GetUpper(); SwTableBox* pLMBox = new SwTableBox( - static_cast<SwTableBoxFormat*>(pULPara->pLeftBox->GetFrameFormat()), 0, pInsLine ); + pULPara->pLeftBox->GetFrameFormat(), 0, pInsLine ); SwTableLine* pLMLn = new SwTableLine( static_cast<SwTableLineFormat*>(pInsLine->GetFrameFormat()), 2, pLMBox ); pLMLn->ClaimFrameFormat()->ResetFormatAttr( RES_FRM_SIZE ); @@ -1578,8 +1578,8 @@ bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nInsPos = pLines->GetPos( pNewLine ); pLines->insert( pLines->begin() + nInsPos, pInsLine ); - SwTableBox* pLeftBox = new SwTableBox( static_cast<SwTableBoxFormat*>(pMergeBox->GetFrameFormat()), 0, pInsLine ); - SwTableBox* pRightBox = new SwTableBox( static_cast<SwTableBoxFormat*>(pMergeBox->GetFrameFormat()), 0, pInsLine ); + SwTableBox* pLeftBox = new SwTableBox( pMergeBox->GetFrameFormat(), 0, pInsLine ); + SwTableBox* pRightBox = new SwTableBox( pMergeBox->GetFrameFormat(), 0, pInsLine ); pMergeBox->SetUpper( pInsLine ); pInsLine->GetTabBoxes().insert( pInsLine->GetTabBoxes().begin(), pLeftBox ); pLeftBox->ClaimFrameFormat(); @@ -1829,7 +1829,7 @@ static void lcl_CopyBoxToDoc(FndBox_ const& rFndBox, CpyPara *const pCpyPara) do { // Find the Frame Format in the list of all Frame Formats - CpyTabFrame aFindFrame(static_cast<SwTableBoxFormat*>(rFndBox.GetBox()->GetFrameFormat())); + CpyTabFrame aFindFrame(rFndBox.GetBox()->GetFrameFormat()); std::shared_ptr<SwFormatFrameSize> aFrameSz(std::make_shared<SwFormatFrameSize>()); CpyTabFrames::const_iterator itFind = pCpyPara->rTabFrameArr.lower_bound( aFindFrame ); diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 8a63949fa3c8..142de524f5be 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -148,7 +148,7 @@ static void lcl_CopyTableLine( const SwTableLine* pLine, CopyTable* pCT ); static void lcl_CopyTableBox( SwTableBox* pBox, CopyTable* pCT ) { - SwTableBoxFormat * pBoxFormat = static_cast<SwTableBoxFormat*>(pBox->GetFrameFormat()); + SwTableBoxFormat * pBoxFormat = pBox->GetFrameFormat(); for (const auto& rMap : pCT->m_rMapArr) if ( !lcl_SrchNew( rMap, reinterpret_cast<SwFrameFormat**>(&pBoxFormat) ) ) break; diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 3d6ba9e8ab2d..f5f3483ec914 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -4114,7 +4114,7 @@ void SwDoc::ChkBoxNumFormat( SwTableBox& rBox, bool bCallUpdate ) pUndo->SetNumFormat( nFormatIdx, fNumber ); } - SwTableBoxFormat* pBoxFormat = static_cast<SwTableBoxFormat*>(rBox.GetFrameFormat()); + SwTableBoxFormat* pBoxFormat = rBox.GetFrameFormat(); SfxItemSetFixed<RES_BOXATR_FORMAT, RES_BOXATR_VALUE> aBoxSet( GetAttrPool() ); bool bLockModify = true; @@ -4173,7 +4173,7 @@ void SwDoc::ChkBoxNumFormat( SwTableBox& rBox, bool bCallUpdate ) else { // It's not a number - SwTableBoxFormat* pBoxFormat = static_cast<SwTableBoxFormat*>(rBox.GetFrameFormat()); + SwTableBoxFormat* pBoxFormat = rBox.GetFrameFormat(); if( SfxItemState::SET == pBoxFormat->GetItemState( RES_BOXATR_FORMAT, false ) || SfxItemState::SET == pBoxFormat->GetItemState( RES_BOXATR_VALUE, false ) ) { diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx index 4d95db1e16f9..486b7efb6653 100644 --- a/sw/source/core/edit/edtab.cxx +++ b/sw/source/core/edit/edtab.cxx @@ -321,7 +321,7 @@ bool SwEditShell::GetTableBoxFormulaAttrs( SfxItemSet& rSet ) const for (size_t n = 0; n < aBoxes.size(); ++n) { const SwTableBox* pSelBox = aBoxes[ n ]; - const SwTableBoxFormat* pTableFormat = static_cast<SwTableBoxFormat*>(pSelBox->GetFrameFormat()); + const SwTableBoxFormat* pTableFormat = pSelBox->GetFrameFormat(); if( !n ) { // Convert formulae into external presentation diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index b47524ec9a37..76b78bf93784 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -160,7 +160,7 @@ void SwDDETable::ChangeContent() pTextNode->EraseText( aCntIdx ); pTextNode->InsertText( aLine.getToken( 0, ' ', nLineTokenPos ), aCntIdx ); - SwTableBoxFormat* pBoxFormat = static_cast<SwTableBoxFormat*>(pBox->GetFrameFormat()); + SwTableBoxFormat* pBoxFormat = pBox->GetFrameFormat(); pBoxFormat->LockModify(); pBoxFormat->ResetFormatAttr( RES_BOXATR_VALUE ); pBoxFormat->UnlockModify(); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index ccaa3d2ae9b1..5f35840addf2 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -877,13 +877,13 @@ static void lcl_InsTableBox( SwTableNode* pTableNd, SwDoc* pDoc, SwTableBox* pBo ->GetContentNode(); if( pCNd && pCNd->IsTextNode() ) pDoc->GetNodes().InsBoxen( pTableNd, pBox->GetUpper(), - static_cast<SwTableBoxFormat*>(pBox->GetFrameFormat()), + pBox->GetFrameFormat(), static_cast<SwTextNode*>(pCNd)->GetTextColl(), pCNd->GetpSwAttrSet(), nInsPos, nCnt ); else pDoc->GetNodes().InsBoxen( pTableNd, pBox->GetUpper(), - static_cast<SwTableBoxFormat*>(pBox->GetFrameFormat()), + pBox->GetFrameFormat(), pDoc->GetDfltTextFormatColl(), nullptr, nInsPos, nCnt ); } diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index f066fa008157..21a684baca6a 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -704,7 +704,7 @@ bool SwTable::NewInsertCol( SwDoc& rDoc, const SwSelBoxes& rBoxes, SwTableBox* pBox = pLine->GetTabBoxes()[ nInsPos ]; if( bBehind ) ++nInsPos; - SwTableBoxFormat* pBoxFrameFormat = static_cast<SwTableBoxFormat*>(pBox->GetFrameFormat()); + SwTableBoxFormat* pBoxFrameFormat = pBox->GetFrameFormat(); ::InsTableBox( rDoc, pTableNd, pLine, pBoxFrameFormat, pBox, nInsPos, nCnt ); sal_Int32 nRowSpan = pBox->getRowSpan(); tools::Long nDiff = i - nLastLine; @@ -2227,7 +2227,7 @@ void SwTable::ConvertSubtableBox(sal_uInt16 const nRow, sal_uInt16 const nBox) // import filter (xmltbli.cxx) converts all box widths to absolute assert(pSourceBox->GetFrameFormat()->GetFrameSize().GetWidthPercent() == 0); ::InsTableBox(*pDoc, GetTableNode(), pNewLine, - static_cast<SwTableBoxFormat*>(pSourceBox->GetFrameFormat()), + pSourceBox->GetFrameFormat(), pSourceBox, j+k, 1); // insert dummy text node... pDoc->GetNodes().MakeTextNode( @@ -2265,7 +2265,7 @@ void SwTable::ConvertSubtableBox(sal_uInt16 const nRow, sal_uInt16 const nBox) assert(pSourceBox->GetTabLines().empty()); // checked for that sal_uInt16 const nInsPos(j < nBox ? j : j + pSubLine->GetTabBoxes().size() - 1); ::InsTableBox(*pDoc, GetTableNode(), pNewLine, - static_cast<SwTableBoxFormat*>(pSourceBox->GetFrameFormat()), + pSourceBox->GetFrameFormat(), pSourceBox, nInsPos, 1); // adjust row span: // N rows in subtable, N-1 rows inserted: diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 36bae796cf05..ce9025ef1b7a 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -2117,7 +2117,7 @@ SwFrameFormat* SwTableBox::ClaimFrameFormat() // of an SwTableBoxFormat object // If other SwTableBox objects currently listen to the same SwTableBoxFormat as // this one, something needs to be done - SwTableBoxFormat *pRet = static_cast<SwTableBoxFormat*>(GetFrameFormat()); + SwTableBoxFormat *pRet = GetFrameFormat(); SwIterator<SwTableBox,SwFormat> aIter( *pRet ); for( SwTableBox* pLast = aIter.First(); pLast; pLast = aIter.Next() ) { diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 0f515b942d8c..fcbeb2b99ff5 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -1685,7 +1685,7 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & rContext) pSave->RestoreSection( &rDoc, &aIdx, SwTableBoxStartNode ); if( pSave->GetHistory() ) pSave->GetHistory()->Rollback( &rDoc ); - SwTableBox* pBox = new SwTableBox( static_cast<SwTableBoxFormat*>(pCpyBox->GetFrameFormat()), aIdx, + SwTableBox* pBox = new SwTableBox( pCpyBox->GetFrameFormat(), aIdx, pCpyBox->GetUpper() ); rLnBoxes.push_back( pBox ); } @@ -1889,7 +1889,7 @@ void SwUndoTableMerge::UndoImpl(::sw::UndoRedoContext & rContext) aIdx = rBox; SwStartNode* pSttNd = rDoc.GetNodes().MakeTextSection( aIdx.GetNode(), SwTableBoxStartNode, pColl ); - pBox = new SwTableBox( static_cast<SwTableBoxFormat*>(pCpyBox->GetFrameFormat()), *pSttNd, + pBox = new SwTableBox( pCpyBox->GetFrameFormat(), *pSttNd, pCpyBox->GetUpper() ); rLnBoxes.push_back( pBox ); diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index b7a4d6357a42..db6f125cc45c 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -2392,7 +2392,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail, pLine1->GetTabBoxes().erase(pLine1->GetTabBoxes().begin()); m_pLineFormat = static_cast<SwTableLineFormat*>(pLine1->GetFrameFormat()); - m_pBoxFormat = static_cast<SwTableBoxFormat*>(m_xBox1->GetFrameFormat()); + m_pBoxFormat = m_xBox1->GetFrameFormat(); MakeTable_( pBox ); diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index bdaedc02dfa1..7919f57d7c71 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -3012,7 +3012,7 @@ void WW8TabDesc::InsertCells( short nIns ) m_pTabBoxes = &m_pTabLine->GetTabBoxes(); m_pTabBox = (*m_pTabBoxes)[0]; - m_pIo->m_rDoc.GetNodes().InsBoxen( m_pTableNd, m_pTabLine, static_cast<SwTableBoxFormat*>(m_pTabBox->GetFrameFormat()), + m_pIo->m_rDoc.GetNodes().InsBoxen( m_pTableNd, m_pTabLine, m_pTabBox->GetFrameFormat(), const_cast<SwTextFormatColl*>(m_pIo->m_pDfltTextFormatColl), nullptr, m_pTabBoxes->size(), nIns ); // The third parameter contains the FrameFormat of the boxes. // Here it is possible to optimize to save (reduce) FrameFormats. diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 1190a3146b99..1ae9b8d8ef33 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -2614,7 +2614,7 @@ void SwXMLTableContext::MakeTable() m_bOwnsBox1 = true; m_pLineFormat = static_cast<SwTableLineFormat*>(pLine1->GetFrameFormat()); - m_pBoxFormat = static_cast<SwTableBoxFormat*>(m_pBox1->GetFrameFormat()); + m_pBoxFormat = m_pBox1->GetFrameFormat(); MakeTable_();