diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-12-15 16:07:29 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-12-15 17:40:28 +0100 |
commit | 107b35bd425fb79a9ff2e47b9e2054289cf0213e (patch) | |
tree | bf7622de4b1d2aab417361dbe2de059ccf51ef95 /starmath/source/unomodel.cxx | |
parent | d942b4a7d187f106dfb1f5085e7c655bf13974bf (diff) |
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'starmath/source/unomodel.cxx')
-rw-r--r-- | starmath/source/unomodel.cxx | 20 |
1 files changed, 11 insertions, 9 deletions
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<PropertySetInfo> & 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<SmDocShell*>(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<SmDocShell*>(GetObjectShell())->writeFormulaOoxml(pSerializer, version, documentType, nAlign); + GetSmDocShell()->writeFormulaOoxml(pSerializer, version, documentType, nAlign); } void SmModel::writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding) { - static_cast<SmDocShell*>(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: */ |