sw/source/filter/ww8/docxattributeoutput.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
New commits: commit d4bd8b7b182ac0a015ab0ff69101f33376ce58ae Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Sep 28 20:45:54 2021 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Sep 29 09:16:58 2021 +0200 sw: use StaticWhichCast() in docxattributeoutput See commit 0025e80ba6d882f6f885499efaf37ab0e2ed699d (sw: use SfxPoolItem::StaticWhichCast() in SwTextBoxHelper, 2021-07-07) for motivation. Change-Id: I323b522b5b69ef2c36a6f0743f9010a8f8d05409 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122790 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 1d230b108cb3..43fa8e773b73 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -8070,7 +8070,10 @@ void DocxAttributeOutput::CharBorder( if ( GetExport().m_bStyDef && GetExport().m_pCurrentStyle && GetExport().m_pCurrentStyle->DerivedFrom() ) pInherited = GetExport().m_pCurrentStyle->DerivedFrom()->GetAttrSet().GetItem<SvxBoxItem>(RES_CHRATR_BOX); else if ( m_rExport.m_pChpIter ) // incredibly undocumented, but this is the character-style info, right? - pInherited = static_cast<const SvxBoxItem*>(GetExport().m_pChpIter->HasTextItem(RES_CHRATR_BOX)); + { + const SfxPoolItem* pPoolItem = GetExport().m_pChpIter->HasTextItem(RES_CHRATR_BOX); + pInherited = pPoolItem ? &pPoolItem->StaticWhichCast(RES_CHRATR_BOX) : nullptr; + } if ( pInherited ) rStyleBorder = SvxBoxItem::SvxLineToLine(pInherited->GetRight(), false); @@ -8963,7 +8966,9 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace ) m_pageMargins.nLeft = 0; m_pageMargins.nRight = 0; - if ( auto pBoxItem = static_cast<const SvxBoxItem*>(m_rExport.HasItem( RES_BOX )) ) + const SfxPoolItem* pPoolItem = m_rExport.HasItem(RES_BOX); + const SvxBoxItem* pBoxItem = pPoolItem ? &pPoolItem->StaticWhichCast(RES_BOX) : nullptr; + if (pBoxItem) { m_pageMargins.nLeft = pBoxItem->CalcLineSpace( SvxBoxItemLine::LEFT, /*bEvenIfNoLine*/true ); m_pageMargins.nRight = pBoxItem->CalcLineSpace( SvxBoxItemLine::RIGHT, /*bEvenIfNoLine*/true );