sw/source/core/unocore/unoredline.cxx | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-)
New commits: commit fc6d75664e1d33defcff28def72c287aadcabeda Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat Jun 14 22:56:03 2025 +0500 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Jun 17 08:52:35 2025 +0200 Simplify SwXRedline::getPropertyValue No need to consider if it has mark or not: the respective getters will return the correct value in any case. Use assert for things that get dereferenced unconditionally. Unify section and table cases' code. Change-Id: I3679fed05f7bdddf5ebd0b7abdaa9d593d127fa8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186502 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186567 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx index 76a95fdcffe7..b6517587d006 100644 --- a/sw/source/core/unocore/unoredline.cxx +++ b/sw/source/core/unocore/unoredline.cxx @@ -421,38 +421,28 @@ uno::Any SwXRedline::getPropertyValue( const OUString& rPropertyName ) rPropertyName == UNO_NAME_REDLINE_END) { uno::Reference<XInterface> xRet; - SwNode* pNode = &m_pRedline->GetPointNode(); - if(!bStart && m_pRedline->HasMark()) - pNode = &m_pRedline->GetMarkNode(); - switch(pNode->GetNodeType()) + SwPosition* pPoint = bStart ? m_pRedline->GetPoint() : m_pRedline->GetMark(); + switch (pPoint->GetNode().GetNodeType()) { case SwNodeType::Section: { - SwSectionNode* pSectNode = pNode->GetSectionNode(); - OSL_ENSURE(pSectNode, "No section node!"); - rtl::Reference< SwXTextSection > xSect = SwXTextSections::GetObject( *pSectNode->GetSection().GetFormat() ); - xRet = uno::Reference< text::XTextSection >(xSect); + SwSectionNode* pSectNode = pPoint->GetNode().GetSectionNode(); + assert(pSectNode); + SwSectionFormat* pSectionFormat = pSectNode->GetSection().GetFormat(); + xRet = cppu::getXWeak(SwXTextSections::GetObject(*pSectionFormat).get()); } break; case SwNodeType::Table : { - SwTableNode* pTableNode = pNode->GetTableNode(); - OSL_ENSURE(pTableNode, "No table node!"); - SwTable& rTable = pTableNode->GetTable(); - SwFrameFormat* pTableFormat = rTable.GetFrameFormat(); + SwTableNode* pTableNode = pPoint->GetNode().GetTableNode(); + assert(pTableNode); + SwFrameFormat* pTableFormat = pTableNode->GetTable().GetFrameFormat(); xRet = cppu::getXWeak(SwXTextTables::GetObject( *pTableFormat ).get()); } break; case SwNodeType::Text : { - SwPosition* pPoint = nullptr; - if(bStart || !m_pRedline->HasMark()) - pPoint = m_pRedline->GetPoint(); - else - pPoint = m_pRedline->GetMark(); - const rtl::Reference<SwXTextRange> xRange = - SwXTextRange::CreateXTextRange(*m_pDoc, *pPoint, nullptr); - xRet = uno::Reference<text::XTextRange>(xRange); + xRet = cppu::getXWeak(SwXTextRange::CreateXTextRange(*m_pDoc, *pPoint, nullptr).get()); } break; default: