dynamic_cast -> static_cast (tdf#130795)

the dynamic_cast is hot here,
and none of these dynamic_casts are necessary, we already assert that
they must succeed, so just use static_cast

Change-Id: I88ade90431c4da4792c778b5cdab22332ed1c428
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121637
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
index 4e62aba..27c483d 100644
--- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
@@ -191,8 +191,7 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >& 
        }
        else if (xConverter1 && xFastParser)
        {
            auto pImport = dynamic_cast<SvXMLImport*>(xFastParser.get());
            assert(pImport);
            auto pImport = static_cast<SvXMLImport*>(xFastParser.get());
            Reference<XDocumentHandler> xLegacyDocHandler = new SvXMLLegacyToFastDocHandler(pImport);
            if (!xConverter1->importer(aDescriptor,xLegacyDocHandler,msUserData)) {
                if (xStatusIndicator.is())
diff --git a/writerperfect/inc/ImportFilter.hxx b/writerperfect/inc/ImportFilter.hxx
index 972bda6..69b0e77 100644
--- a/writerperfect/inc/ImportFilter.hxx
+++ b/writerperfect/inc/ImportFilter.hxx
@@ -87,7 +87,7 @@ public:
        // OO Graphics Handler: abstract class to handle document SAX messages, concrete implementation here
        // writes to in-memory target doc
        DocumentHandler aHandler(
            new SvXMLLegacyToFastDocHandler(dynamic_cast<SvXMLImport*>(xInternalHandler.get())));
            new SvXMLLegacyToFastDocHandler(static_cast<SvXMLImport*>(xInternalHandler.get())));

        WPXSvInputStream input(xInputStream);

diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
index 4949918..c43be95 100644
--- a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
+++ b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
@@ -333,7 +333,7 @@ MSWorksCalcImportFilter::filter(const css::uno::Sequence<css::beans::PropertyVal
    // OO Graphics Handler: abstract class to handle document SAX messages, concrete implementation here
    // writes to in-memory target doc
    writerperfect::DocumentHandler aHandler(
        new SvXMLLegacyToFastDocHandler(dynamic_cast<SvXMLImport*>(xInternalHandler.get())));
        new SvXMLLegacyToFastDocHandler(static_cast<SvXMLImport*>(xInternalHandler.get())));

    writerperfect::WPXSvInputStream input(xInputStream);
    OdsGenerator exporter;
diff --git a/writerperfect/source/writer/WordPerfectImportFilter.cxx b/writerperfect/source/writer/WordPerfectImportFilter.cxx
index 8888134..8779fb6 100644
--- a/writerperfect/source/writer/WordPerfectImportFilter.cxx
+++ b/writerperfect/source/writer/WordPerfectImportFilter.cxx
@@ -138,7 +138,7 @@ bool WordPerfectImportFilter::importImpl(
    // OO Document Handler: abstract class to handle document SAX messages, concrete implementation here
    // writes to in-memory target doc
    DocumentHandler aHandler(
        new SvXMLLegacyToFastDocHandler(dynamic_cast<SvXMLImport*>(xInternalHandler.get())));
        new SvXMLLegacyToFastDocHandler(static_cast<SvXMLImport*>(xInternalHandler.get())));

    OdtGenerator collector;
    collector.addDocumentHandler(&aHandler, ODF_FLAT_XML);
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index a4f7098..ea5e88b 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -785,7 +785,7 @@ void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
        const SvXMLImportContextRef & pHandler = maContexts.top();
        SAL_INFO("xmloff.core", "calling createFastChildContext on " << typeid(*pHandler.get()).name());
        auto tmp = pHandler->createFastChildContext( Element, Attribs );
        xContext = dynamic_cast<SvXMLImportContext*>(tmp.get());
        xContext = static_cast<SvXMLImportContext*>(tmp.get());
        assert((tmp && xContext) || (!tmp && !xContext));
    }
    else
@@ -823,7 +823,7 @@ void SAL_CALL SvXMLImport::startUnknownElement (const OUString & rNamespace, con
        const SvXMLImportContextRef & pHandler = maContexts.top();
        SAL_INFO("xmloff.core", "calling createUnknownChildContext on " << typeid(*pHandler.get()).name());
        auto tmp = pHandler->createUnknownChildContext( rNamespace, rName, Attribs );
        xContext = dynamic_cast<SvXMLImportContext*>(tmp.get());
        xContext = static_cast<SvXMLImportContext*>(tmp.get());
        assert((tmp && xContext) || (!tmp && !xContext));
    }
    else
diff --git a/xmloff/source/draw/XMLNumberStyles.cxx b/xmloff/source/draw/XMLNumberStyles.cxx
index 33bafa2..baf9f1f 100644
--- a/xmloff/source/draw/XMLNumberStyles.cxx
+++ b/xmloff/source/draw/XMLNumberStyles.cxx
@@ -704,7 +704,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLNumberFormatImpor
    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
    return new SdXMLNumberFormatMemberImportContext( GetImport(), nElement, xAttrList,
        this, &dynamic_cast<SvXMLImportContext&>(*SvXMLNumFormatContext::createFastChildContext( nElement, xAttrList )) );
        this, static_cast<SvXMLImportContext*>(SvXMLNumFormatContext::createFastChildContext( nElement, xAttrList ).get()) );
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index fdf4089..0100a25 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -1636,7 +1636,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextFrameContext::c
            // note: no more draw:image can be added once we get here
            m_xImplContext = solveMultipleImages();
        }
        xContext = &dynamic_cast<SvXMLImportContext&>(*m_xImplContext->createFastChildContext( nElement, xAttrList ));
        xContext = static_cast<SvXMLImportContext*>(m_xImplContext->createFastChildContext( nElement, xAttrList ).get());
    }
    else if (nElement == XML_ELEMENT(LO_EXT, XML_SIGNATURELINE))
    {
@@ -1645,7 +1645,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextFrameContext::c
            // note: no more draw:image can be added once we get here
            m_xImplContext = solveMultipleImages();
        }
        xContext = &dynamic_cast<SvXMLImportContext&>(*m_xImplContext->createFastChildContext(nElement, xAttrList));
        xContext = static_cast<SvXMLImportContext*>(m_xImplContext->createFastChildContext(nElement, xAttrList).get());
    }
    else if (nElement == XML_ELEMENT(LO_EXT, XML_QRCODE))
    {
@@ -1654,11 +1654,11 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextFrameContext::c
            // note: no more draw:image can be added once we get here
            m_xImplContext = solveMultipleImages();
        }
        xContext = &dynamic_cast<SvXMLImportContext&>(*m_xImplContext->createFastChildContext(nElement, xAttrList));
        xContext = static_cast<SvXMLImportContext*>(m_xImplContext->createFastChildContext(nElement, xAttrList).get());
    }
    else if (nElement == XML_ELEMENT(DRAW, XML_A))
    {
        xContext = &dynamic_cast<SvXMLImportContext&>(*m_xImplContext->createFastChildContext(nElement, xAttrList));
        xContext = static_cast<SvXMLImportContext*>(m_xImplContext->createFastChildContext(nElement, xAttrList).get());
    }
    else
    {
diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx
index f75a275..90f8b19 100644
--- a/xmloff/source/transform/TransformerBase.cxx
+++ b/xmloff/source/transform/TransformerBase.cxx
@@ -387,8 +387,7 @@ void SAL_CALL XMLTransformerBase::initialize( const Sequence< Any >& aArguments 
        css::uno::Reference< XFastDocumentHandler > xFastHandler;
        if( (rArgument >>= xFastHandler) && xFastHandler )
        {
            SvXMLImport *pFastHandler = dynamic_cast<SvXMLImport*>( xFastHandler.get() );
            assert(pFastHandler);
            SvXMLImport *pFastHandler = static_cast<SvXMLImport*>( xFastHandler.get() );
            m_xHandler.set( new SvXMLLegacyToFastDocHandler( pFastHandler ) );
        }
        // document handler