summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/docxattributeoutput.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-09-28 20:45:54 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-09-29 09:16:58 +0200
commitd4bd8b7b182ac0a015ab0ff69101f33376ce58ae (patch)
treef89c6d1aa9b7d99184a3448df6037992c5b8b747 /sw/source/filter/ww8/docxattributeoutput.cxx
parent38eb9a0594393e263f57701702974a030d3327de (diff)
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 <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/filter/ww8/docxattributeoutput.cxx')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx9
1 files changed, 7 insertions, 2 deletions
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 );