diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-02-21 08:00:26 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-02-21 05:52:59 +0000 |
commit | 527741d528ef347b28917976efffd366c62341b1 (patch) | |
tree | 2ba66344e73ceb730bbb78118a665824122ef8b4 /basic | |
parent | ccd0ef98f76011f108f8ea1d282b96386dba0a6a (diff) |
Related: tdf#153752 Use virtual method to avoid dynamic casts
Change-Id: I97c09d82699621d5a43a525b5f2cf75ff5d131c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147353
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/sbx/sbxexec.cxx | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx index de711944d36c..af7d12c00651 100644 --- a/basic/source/sbx/sbxexec.cxx +++ b/basic/source/sbx/sbxexec.cxx @@ -19,7 +19,6 @@ #include <sal/config.h> -#include <basic/sbmod.hxx> #include <basic/sbx.hxx> #include <basic/sberrors.hxx> #include <rtl/character.hxx> @@ -350,7 +349,7 @@ SbxVariable* SbxObject::Execute( const OUString& rTxt ) { SetError( ERRCODE_BASIC_SYNTAX ); break; } - pVar = Assign( this, this, &p, IsModuleCompatible() ); + pVar = Assign( this, this, &p, IsOptionCompatible() ); if( !pVar.is() ) { break; @@ -373,7 +372,7 @@ SbxVariable* SbxObject::FindQualified( const OUString& rName, SbxClassType t ) { return nullptr; } - pVar = QualifiedName( this, this, &p, t, IsModuleCompatible() ); + pVar = QualifiedName( this, this, &p, t, IsOptionCompatible() ); p = SkipWhitespace( p ); if( *p ) { @@ -382,15 +381,10 @@ SbxVariable* SbxObject::FindQualified( const OUString& rName, SbxClassType t ) return pVar.get(); } -bool SbxObject::IsModuleCompatible() const +bool SbxObject::IsOptionCompatible() const { - const SbxObject* pObj = this; - while (pObj) - { - if (auto pMod = dynamic_cast<const SbModule*>(pObj)) - return pMod->IsCompatible(); - pObj = pObj->GetParent(); - } + if (const SbxObject* pObj = GetParent()) + return pObj->IsOptionCompatible(); return false; } |