summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-02-21 08:00:26 +0300
committerTor Lillqvist <tml@collabora.com>2023-02-27 07:21:02 +0000
commitbc86ef1e0ec2801d8fead9b98cbe8d4129f3e244 (patch)
treefa2900ff1bec59b80e2df594bfc5c9c3c4378ff7 /basic
parent4e5d0e93ea571ca10b0d920170b7bb9f3179756b (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> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147752 Tested-by: Tor Lillqvist <tml@collabora.com> Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/sbx/sbxexec.cxx16
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;
}