diff options
author | Jan Holesovsky <kendy@collabora.com> | 2016-06-21 22:47:05 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2016-06-21 22:50:49 +0200 |
commit | bd7d74791954f9de709b7595498613d728e5fb6a (patch) | |
tree | fafa2357936a94b02cdeacc7397ef3dd80e6c020 /xmloff | |
parent | 1bbf0612ea35c73adf0c2aabedf457f7d85acdc0 (diff) |
Simplify dynamic_cast followed by a static_cast.
Change-Id: I86e756ce46f6cdb84bddc3faae74782c8b4ad519
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/draw/ximpstyl.cxx | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index 890ea69496a5..44c7989843de 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -868,8 +868,8 @@ void SdXMLMasterPageContext::EndElement() if(!msName.isEmpty() && GetSdImport().GetShapeImport()->GetStylesContext()) { SvXMLImportContext* pContext = GetSdImport().GetShapeImport()->GetStylesContext(); - if( dynamic_cast<const SdXMLStylesContext*>(pContext) != nullptr ) - static_cast<SdXMLStylesContext*>(pContext)->SetMasterPageStyles(*this); + if (SdXMLStylesContext* pSdContext = dynamic_cast<SdXMLStylesContext*>(pContext)) + pSdContext->SetMasterPageStyles(*this); } SdXMLGenericPageContext::EndElement(); @@ -1137,18 +1137,15 @@ void SdXMLStylesContext::EndElement() for(sal_uInt32 a(0L); a < GetStyleCount(); a++) { const SvXMLStyleContext* pStyle = GetStyle(a); - if(pStyle && dynamic_cast<const XMLShapeStyleContext*>(pStyle) != nullptr) + if (const XMLShapeStyleContext* pDocStyle = dynamic_cast<const XMLShapeStyleContext*>(pStyle)) { - const XMLShapeStyleContext* pDocStyle = static_cast<const XMLShapeStyleContext*>(pStyle); - SvXMLStylesContext* pStylesContext = GetSdImport().GetShapeImport()->GetStylesContext(); - if( pStylesContext ) + if (pStylesContext) { pStyle = pStylesContext->FindStyleChildContext(pStyle->GetFamily(), pStyle->GetParentName()); - if(pStyle && dynamic_cast<const XMLShapeStyleContext*>(pStyle) != nullptr) + if (const XMLShapeStyleContext* pParentStyle = dynamic_cast<const XMLShapeStyleContext*>(pStyle)) { - const XMLShapeStyleContext* pParentStyle = static_cast<const XMLShapeStyleContext*>(pStyle); if(pParentStyle->GetStyle().is()) { const_cast<XMLShapeStyleContext*>(pDocStyle)->SetStyle(pParentStyle->GetStyle()); @@ -1445,10 +1442,9 @@ uno::Reference< container::XNameAccess > SdXMLStylesContext::getPageLayouts() co for(sal_uInt32 a(0L); a < GetStyleCount(); a++) { const SvXMLStyleContext* pStyle = GetStyle(a); - if(pStyle && dynamic_cast<const SdXMLPresentationPageLayoutContext*>(pStyle) != nullptr) + if (const SdXMLPresentationPageLayoutContext* pContext = dynamic_cast<const SdXMLPresentationPageLayoutContext*>(pStyle)) { - xLayouts->insertByName( pStyle->GetName(), uno::makeAny( - (sal_Int32)static_cast<const SdXMLPresentationPageLayoutContext*>(pStyle)->GetTypeId() ) ); + xLayouts->insertByName(pStyle->GetName(), uno::makeAny((sal_Int32)pContext->GetTypeId())); } } |