diff options
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 3 | ||||
-rw-r--r-- | basctl/source/basicide/basobj3.cxx | 6 | ||||
-rw-r--r-- | basctl/source/basicide/macrodlg.cxx | 4 | ||||
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 6 | ||||
-rw-r--r-- | basic/source/comp/exprtree.cxx | 3 | ||||
-rw-r--r-- | filter/source/msfilter/msvbahelper.cxx | 10 | ||||
-rw-r--r-- | include/basic/sbmod.hxx | 1 | ||||
-rw-r--r-- | scripting/source/basprov/basprov.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 2 |
9 files changed, 23 insertions, 28 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index e9f9ace3992e..7b319789980c 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1139,8 +1139,7 @@ OUString EditorWindow::GetActualSubName( sal_uLong nLine ) SbxArrayRef pMethods = rModulWindow.GetSbModule()->GetMethods(); for( sal_uInt16 i=0; i < pMethods->Count(); i++ ) { - SbxVariable* p = dynamic_cast<SbMethod*>( pMethods->Get( i ) ); - SbMethod* pMeth = dynamic_cast<SbMethod*>( p ); + SbMethod* pMeth = dynamic_cast<SbMethod*>( pMethods->Get( i ) ); if( pMeth ) { sal_uInt16 l1,l2; diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx index 3d3b9c4895e0..5aee287cdc9f 100644 --- a/basctl/source/basicide/basobj3.cxx +++ b/basctl/source/basicide/basobj3.cxx @@ -58,7 +58,7 @@ SbMethod* CreateMacro( SbModule* pModule, const OUString& rMacroName ) pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES ); } - if ( pModule->GetMethods()->Find( rMacroName, SbxClassType::Method ) ) + if ( pModule->FindMethod( rMacroName, SbxClassType::Method ) ) return nullptr; OUString aMacroName( rMacroName ); @@ -75,7 +75,7 @@ SbMethod* CreateMacro( SbModule* pModule, const OUString& rMacroName ) aMacroName = "Macro"; aMacroName += OUString::number( nMacro ); // test whether existing... - bValid = pModule->GetMethods()->Find( aMacroName, SbxClassType::Method ) == nullptr; + bValid = pModule->FindMethod( aMacroName, SbxClassType::Method ) == nullptr; nMacro++; } } @@ -124,7 +124,7 @@ SbMethod* CreateMacro( SbModule* pModule, const OUString& rMacroName ) } } - SbMethod* pMethod = static_cast<SbMethod*>(pModule->GetMethods()->Find( aMacroName, SbxClassType::Method )); + SbMethod* pMethod = pModule->FindMethod( aMacroName, SbxClassType::Method ); if( pDispatcher ) { diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index 2072c74dcdcd..a8ad23249269 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -269,7 +269,7 @@ SbMethod* MacroChooser::GetMacro() if ( pEntry ) { OUString aMacroName( m_pMacroBox->GetEntryText( pEntry ) ); - pMethod = static_cast<SbMethod*>(pModule->GetMethods()->Find( aMacroName, SbxClassType::Method )); + pMethod = pModule->FindMethod( aMacroName, SbxClassType::Method ); } } return pMethod; @@ -370,7 +370,7 @@ SbMethod* MacroChooser::CreateMacro() } OUString aSubName = m_pMacroNameEdit->GetText(); - DBG_ASSERT( !pModule || !pModule->GetMethods()->Find( aSubName, SbxClassType::Method ), "Macro existiert schon!" ); + DBG_ASSERT( !pModule || !pModule->FindMethod( aSubName, SbxClassType::Method ), "Macro existiert schon!" ); pMethod = pModule ? basctl::CreateMacro( pModule, aSubName ) : nullptr; } diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 375678fd0932..ef6a6797c93b 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -579,6 +579,12 @@ SbMethod* SbModule::GetMethod( const OUString& rName, SbxDataType t ) return pMeth; } +SbMethod* SbModule::FindMethod( const OUString& rName, SbxClassType t ) +{ + return dynamic_cast<SbMethod*> (pMethods->Find( rName, t )); +} + + // request/create property SbProperty* SbModule::GetProperty( const OUString& rName, SbxDataType t ) diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx index f39bb7686948..179aaf3b488e 100644 --- a/basic/source/comp/exprtree.cxx +++ b/basic/source/comp/exprtree.cxx @@ -269,8 +269,7 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo ) // #i109184: Check if symbol is or later will be defined inside module SbModule& rMod = pParser->aGen.GetModule(); - SbxArray* pModMethods = rMod.GetMethods(); - if( pModMethods->Find( aSym, SbxClassType::DontCare ) ) + if( rMod.FindMethod( aSym, SbxClassType::DontCare ) ) { pDef = nullptr; } diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index 49e6190b291c..dc86a4e7c8dd 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -202,15 +202,9 @@ bool hasMacro( SfxObjectShell* pShell, const OUString& sLibrary, OUString& sMod, if ( !sMod.isEmpty() ) // we wish to find the macro is a specific module { SbModule* pModule = pBasic->FindModule( sMod ); - if ( pModule ) + if ( pModule && pModule->FindMethod( sMacro, SbxClassType::Method )) { - SbxArray* pMethods = pModule->GetMethods(); - if ( pMethods ) - { - SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxClassType::Method ) ); - if ( pMethod ) - bFound = true; - } + bFound = true; } } else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxClassType::Method ) ) ) diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx index 23ef22009671..3727d1dcfbb6 100644 --- a/include/basic/sbmod.hxx +++ b/include/basic/sbmod.hxx @@ -132,6 +132,7 @@ public: bool createCOMWrapperForIface( css::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject ); void GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache); const SbxArrayRef& GetMethods() { return pMethods;} + SbMethod* FindMethod( const OUString&, SbxClassType ); static OUString GetKeywordCase( const OUString& sKeyword ); }; diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx index 49ba35497acb..185c4f937692 100644 --- a/scripting/source/basprov/basprov.cxx +++ b/scripting/source/basprov/basprov.cxx @@ -361,17 +361,13 @@ namespace basprov SbModule* pModule = pBasic->FindModule( aModule ); if ( pModule ) { - SbxArray* pMethods = pModule->GetMethods(); - if ( pMethods ) + SbMethod* pMethod = pModule->FindMethod( aMethod, SbxClassType::Method ); + if ( pMethod && !pMethod->IsHidden() ) { - SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( aMethod, SbxClassType::Method ) ); - if ( pMethod && !pMethod->IsHidden() ) - { - if ( m_pDocBasicManager == pBasicMgr ) - xScript = new BasicScriptImpl( aDescription, pMethod, *m_pDocBasicManager, m_xInvocationContext ); - else - xScript = new BasicScriptImpl( aDescription, pMethod ); - } + if ( m_pDocBasicManager == pBasicMgr ) + xScript = new BasicScriptImpl( aDescription, pMethod, *m_pDocBasicManager, m_xInvocationContext ); + else + xScript = new BasicScriptImpl( aDescription, pMethod ); } } } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index fc96248549f7..28ea8f5dba9c 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2550,7 +2550,7 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const OUString& sMacro ) if ( pBasic ) { SbModule* pModule = pBasic->FindModule( aModuleName ); - SbMethod* pMethod = pModule ? static_cast<SbMethod*>(pModule->GetMethods()->Find(aMacroName, SbxClassType::Method)) : nullptr; + SbMethod* pMethod = pModule ? pModule->FindMethod(aMacroName, SbxClassType::Method) : nullptr; if (pMethod) { aOUSource = pModule->GetSource32(); |