From 107b35bd425fb79a9ff2e47b9e2054289cf0213e Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 15 Dec 2023 16:07:29 +0300 Subject: Put some static_casts into a dedicated function And make it explicit that SmModel ctor takes a SmDocShell*. Change-Id: Ic16b2bce8e0a57b9f00382fa03041867f5e3a4ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160828 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- starmath/source/unomodel.cxx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'starmath/source/unomodel.cxx') diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index ea12928d3dbc..695c48f1bab1 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -315,7 +315,7 @@ static const rtl::Reference & lcl_createModelPropertyInfo () return PROPS_INFO; } -SmModel::SmModel( SfxObjectShell *pObjSh ) +SmModel::SmModel(SmDocShell* pObjSh) : SfxBaseModel(pObjSh) , PropertySetHelper ( lcl_createModelPropertyInfo () ) { @@ -325,6 +325,8 @@ SmModel::~SmModel() noexcept { } +SmDocShell* SmModel::GetSmDocShell() const { return static_cast(GetObjectShell()); } + uno::Any SAL_CALL SmModel::queryInterface( const uno::Type& rType ) { uno::Any aRet = ::cppu::queryInterface ( rType, @@ -402,7 +404,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* { SolarMutexGuard aGuard; - SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell()); + SmDocShell* pDocSh = GetSmDocShell(); if ( nullptr == pDocSh ) throw UnknownPropertyException(); @@ -716,7 +718,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValue ) { - SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell()); + SmDocShell* pDocSh = GetSmDocShell(); if ( nullptr == pDocSh ) throw UnknownPropertyException(); @@ -953,7 +955,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( if (0 != nRenderer) throw IllegalArgumentException(); - SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() ); + SmDocShell* pDocSh = GetSmDocShell(); if (!pDocSh) throw RuntimeException(); @@ -994,7 +996,7 @@ void SAL_CALL SmModel::render( if (0 != nRenderer) throw IllegalArgumentException(); - SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() ); + SmDocShell* pDocSh = GetSmDocShell(); if (!pDocSh) throw RuntimeException(); @@ -1088,22 +1090,22 @@ void SmModel::writeFormulaOoxml( oox::core::OoxmlVersion const version, oox::drawingml::DocumentType const documentType, sal_Int8 nAlign) { - static_cast(GetObjectShell())->writeFormulaOoxml(pSerializer, version, documentType, nAlign); + GetSmDocShell()->writeFormulaOoxml(pSerializer, version, documentType, nAlign); } void SmModel::writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding) { - static_cast(GetObjectShell())->writeFormulaRtf(rBuffer, nEncoding); + GetSmDocShell()->writeFormulaRtf(rBuffer, nEncoding); } void SmModel::readFormulaOoxml( oox::formulaimport::XmlStream& stream ) { - static_cast< SmDocShell* >( GetObjectShell())->readFormulaOoxml( stream ); + GetSmDocShell()->readFormulaOoxml(stream); } Size SmModel::getFormulaSize() const { - return o3tl::convert(static_cast< SmDocShell* >( GetObjectShell())->GetSize(), SmO3tlLengthUnit(), o3tl::Length::mm100); + return o3tl::convert(GetSmDocShell()->GetSize(), SmO3tlLengthUnit(), o3tl::Length::mm100); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit