summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-10-12 16:09:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-13 09:30:12 +0200
commitf9ac067da9e61f479e2433d500b9b940e5a45470 (patch)
tree1b057d3b97cc7dcf6d3de377da34cbf23af9c3ee /sw/source/filter
parent3ee3ae85de3a29ebfb89e75960b65417bfd6ca55 (diff)
static_cast after dynamic_cast
Change-Id: I487b5dc148f5a3d0d45f198c00179002841242ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104213 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/html/swhtml.cxx4
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx3
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx3
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx23
4 files changed, 14 insertions, 19 deletions
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index d7bbb52ac908..d5cd46f5e3db 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2617,8 +2617,8 @@ SwViewShell *SwHTMLParser::CallStartAction( SwViewShell *pVSh, bool bChkPtr )
if( m_pActionViewShell )
{
- if( dynamic_cast< const SwEditShell *>( m_pActionViewShell ) != nullptr )
- static_cast<SwEditShell*>(m_pActionViewShell)->StartAction();
+ if( auto pEditShell = dynamic_cast< SwEditShell *>( m_pActionViewShell ) )
+ pEditShell->StartAction();
else
m_pActionViewShell->StartAction();
}
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 6b61fd14e519..0c04d094e505 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1579,9 +1579,8 @@ SvxFrameDirection MSWordExportBase::GetDefaultFrameDirection( ) const
{
nDir = TrueFrameDirection( *static_cast< const SwFrameFormat * >(m_pOutFormatNode) );
}
- else if ( dynamic_cast< const SwContentNode *>( m_pOutFormatNode ) != nullptr ) //paragraph
+ else if ( auto pNd = dynamic_cast< const SwContentNode *>( m_pOutFormatNode ) ) //paragraph
{
- const SwContentNode *pNd = static_cast<const SwContentNode *>(m_pOutFormatNode);
SwPosition aPos( *pNd );
nDir = m_rDoc.GetTextDirection( aPos );
}
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index e0600d4cb33d..73d31b68245b 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -401,9 +401,8 @@ void WW8Export::OutGrf(const ww8::Frame &rFrame)
bool bVert = false;
//The default for word in vertical text mode is to center,
//otherwise a sub/super script hack is employed
- if (dynamic_cast< const SwContentNode *>( m_pOutFormatNode ) )
+ if (auto pTextNd = dynamic_cast< const SwContentNode *>( m_pOutFormatNode ) )
{
- const SwTextNode* pTextNd = static_cast<const SwTextNode*>(m_pOutFormatNode);
SwPosition aPos(*pTextNd);
bVert = m_rDoc.IsInVerticalText(aPos);
}
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index d6b0fabe8701..068601af0637 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3637,9 +3637,8 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule )
nNumId = 0;
}
}
- else if ( dynamic_cast< const SwTextFormatColl *>( GetExport().m_pOutFormatNode ) != nullptr )
+ else if ( auto pC = dynamic_cast< const SwTextFormatColl *>( GetExport().m_pOutFormatNode ) )
{
- const SwTextFormatColl* pC = static_cast<const SwTextFormatColl*>(GetExport().m_pOutFormatNode);
if ( pC && pC->IsAssignedToListLevelOfOutlineStyle() )
nLvl = static_cast< sal_uInt8 >( pC->GetAssignedOutlineStyleLevel() );
}
@@ -3801,12 +3800,12 @@ void WW8AttributeOutput::TableRowEnd(sal_uInt32 nDepth)
void AttributeOutputBase::FormatPageDescription( const SwFormatPageDesc& rPageDesc )
{
- if ( GetExport().m_bStyDef && dynamic_cast< const SwTextFormatColl *>( GetExport().m_pOutFormatNode ) )
- {
- const SwTextFormatColl* pC = static_cast<const SwTextFormatColl*>(GetExport().m_pOutFormatNode);
- if ( (SfxItemState::SET != pC->GetItemState( RES_BREAK, false ) ) && rPageDesc.KnowsPageDesc() )
- FormatBreak( SvxFormatBreakItem( SvxBreak::PageBefore, RES_BREAK ) );
- }
+ if ( GetExport().m_bStyDef )
+ if (auto pC = dynamic_cast< const SwTextFormatColl *>( GetExport().m_pOutFormatNode ) )
+ {
+ if ( (SfxItemState::SET != pC->GetItemState( RES_BREAK, false ) ) && rPageDesc.KnowsPageDesc() )
+ FormatBreak( SvxFormatBreakItem( SvxBreak::PageBefore, RES_BREAK ) );
+ }
}
void WW8AttributeOutput::PageBreakBefore( bool bBreak )
@@ -4803,15 +4802,13 @@ void WW8AttributeOutput::ParaAdjust( const SvxAdjustItem& rAdjust )
if (m_rWW8Export.m_pOutFormatNode)
{
SvxFrameDirection nDirection = SvxFrameDirection::Horizontal_LR_TB;
- if (dynamic_cast<const SwTextNode*>(m_rWW8Export.m_pOutFormatNode) != nullptr)
+ if (auto pTN = dynamic_cast<const SwTextNode*>(m_rWW8Export.m_pOutFormatNode))
{
- SwPosition aPos(*static_cast<const SwContentNode*>(m_rWW8Export.m_pOutFormatNode));
+ SwPosition aPos(*pTN);
nDirection = m_rWW8Export.m_rDoc.GetTextDirection(aPos);
}
- else if (dynamic_cast<const SwTextFormatColl*>(m_rWW8Export.m_pOutFormatNode) != nullptr)
+ else if (auto pC = dynamic_cast<const SwTextFormatColl*>(m_rWW8Export.m_pOutFormatNode))
{
- const SwTextFormatColl* pC =
- static_cast<const SwTextFormatColl*>(m_rWW8Export.m_pOutFormatNode);
const SvxFrameDirectionItem &rItem =
ItemGet<SvxFrameDirectionItem>(*pC, RES_FRAMEDIR);
nDirection = rItem.GetValue();