diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-12-16 23:02:08 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-12-19 12:57:29 +0000 |
commit | 4d6c23216559eb48f9943bb49d6e475a6d64ba15 (patch) | |
tree | 99a907237afacf57a9016b185cda8cdb25e071c1 /writerfilter | |
parent | 1e4709f47dec87d5d2b66f3de222588c3babaf18 (diff) |
loplugin:unocast (oox::ForumlaImExportBase)
(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)
Change-Id: I11bc363447c44319bc47f7eebb7084f64ea85511
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144400
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 3 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 3 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 09b1ba422aec..fe7374848d72 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -82,6 +82,7 @@ #include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/document/XFilter.hpp> #include <comphelper/indexedpropertyvalues.hxx> +#include <comphelper/servicehelper.hxx> #include <editeng/flditem.hxx> #include <editeng/unotext.hxx> #include <o3tl/safeint.hxx> @@ -3011,7 +3012,7 @@ void DomainMapper_Impl::appendStarMath( const Value& val ) xComponentProperties->setPropertyValue(getPropertyName( PROP_BOTTOM_MARGIN ), uno::Any(sal_Int32(0))); Size size( 1000, 1000 ); - if( oox::FormulaImExportBase* formulaimport = dynamic_cast< oox::FormulaImExportBase* >( xInterface.get())) + if( oox::FormulaImExportBase* formulaimport = comphelper::getFromUnoTunnel< oox::FormulaImExportBase >( xInterface)) size = formulaimport->getFormulaSize(); xStarMathProperties->setPropertyValue(getPropertyName( PROP_WIDTH ), uno::Any( sal_Int32(size.Width()))); diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index 2563956bf97a..32e0aa403867 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -28,6 +28,7 @@ #include <sal/log.hxx> #include <comphelper/embeddedobjectcontainer.hxx> #include <comphelper/propertyvalue.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/exc_hlp.hxx> #include <tools/globname.hxx> #include <comphelper/classids.hxx> @@ -2283,7 +2284,7 @@ void OOXMLFastContextHandlerMath::process() return; uno::Reference< uno::XInterface > component(ref->getComponent(), uno::UNO_QUERY_THROW); if( oox::FormulaImExportBase* import - = dynamic_cast< oox::FormulaImExportBase* >( component.get())) + = comphelper::getFromUnoTunnel< oox::FormulaImExportBase >( component)) import->readFormulaOoxml( buffer ); if (!isForwardEvents()) return; diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index ac5bbfb042f2..c61721ff484e 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -26,6 +26,7 @@ #include <filter/msfilter/rtfutil.hxx> #include <comphelper/string.hxx> #include <comphelper/diagnose_ex.hxx> +#include <comphelper/servicehelper.hxx> #include <tools/globname.hxx> #include <tools/datetimeutils.hxx> #include <comphelper/classids.hxx> @@ -2968,7 +2969,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState) uno::Reference<util::XCloseable> xComponent(xObject->getComponent(), uno::UNO_SET_THROW); if (oox::FormulaImExportBase* pImport - = dynamic_cast<oox::FormulaImExportBase*>(xComponent.get())) + = comphelper::getFromUnoTunnel<oox::FormulaImExportBase>(xComponent)) pImport->readFormulaOoxml(m_aMathBuffer); auto pValue = new RTFValue(xObject); |