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 /oox | |
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 'oox')
-rw-r--r-- | oox/source/drawingml/shape.cxx | 3 | ||||
-rw-r--r-- | oox/source/export/shapes.cxx | 3 | ||||
-rw-r--r-- | oox/source/mathml/imexport.cxx | 10 |
3 files changed, 14 insertions, 2 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index d5b02455ab35..7c2920eabcbf 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -56,6 +56,7 @@ #include <comphelper/propertysequence.hxx> #include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/diagnose_ex.hxx> #include <tools/gen.hxx> #include <tools/globname.hxx> @@ -1295,7 +1296,7 @@ Reference< XShape > const & Shape::createAndInsert( { uno::Reference<uno::XInterface> const xMathModel(xObj->getComponent()); oox::FormulaImExportBase *const pMagic( - dynamic_cast<oox::FormulaImExportBase*>(xMathModel.get())); + comphelper::getFromUnoTunnel<oox::FormulaImExportBase>(xMathModel)); assert(pMagic); pMagic->readFormulaOoxml(*pMathXml); } diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 137c69fe7c33..ce3787069adb 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -71,6 +71,7 @@ #include <tools/globname.hxx> #include <comphelper/classids.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/storagehelper.hxx> #include <sot/exchange.hxx> #include <utility> @@ -2473,7 +2474,7 @@ void ShapeExport::WriteMathShape(Reference<XShape> const& xShape) mpFS->startElementNS(XML_a14, XML_m); oox::FormulaImExportBase *const pMagic( - dynamic_cast<oox::FormulaImExportBase*>(xMathModel.get())); + comphelper::getFromUnoTunnel<oox::FormulaImExportBase>(xMathModel)); assert(pMagic); pMagic->writeFormulaOoxml(GetFS(), GetFB()->getVersion(), GetDocumentType(), FormulaImExportBase::eFormulaAlign::INLINE); diff --git a/oox/source/mathml/imexport.cxx b/oox/source/mathml/imexport.cxx index 2b5990679bea..ad0389051b42 100644 --- a/oox/source/mathml/imexport.cxx +++ b/oox/source/mathml/imexport.cxx @@ -13,6 +13,7 @@ #include <oox/core/contexthandler.hxx> #include <oox/token/namespaces.hxx> +#include <comphelper/servicehelper.hxx> #include <drawingml/textparagraph.hxx> @@ -21,6 +22,15 @@ using namespace ::com::sun::star; namespace oox { +sal_Int64 FormulaImExportBase::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) { + return comphelper::getSomethingImpl(aIdentifier, this); +} + +css::uno::Sequence<sal_Int8> const & FormulaImExportBase::getUnoTunnelId() { + static comphelper::UnoIdInit const id; + return id.getSeq(); +} + FormulaImExportBase::FormulaImExportBase() { } |