diff options
author | npower Developer <npower@openoffice.org> | 2010-03-03 12:59:39 +0000 |
---|---|---|
committer | npower Developer <npower@openoffice.org> | 2010-03-03 12:59:39 +0000 |
commit | b4cfc7121b263041c586fe3c3ed894f3a5494e7c (patch) | |
tree | 4f62983c0166cecd146bf8ead1b2fc25540b6aef /basctl | |
parent | 07716c77cc6b451aa4717b7811fd5f5c2aa22967 (diff) |
npower13_objectmodule: tweak IDE to only run macros from cursor in VBA mode
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/baside2.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index bed5aa96dc28..4f31af11be6f 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -336,7 +336,8 @@ BOOL ModulWindow::BasicExecute() AddStatus( BASWIN_RUNNINGBASIC ); USHORT nStart, nEnd, nCurMethodStart = 0; TextSelection aSel = GetEditView()->GetSelection(); - nCurMethodStart = ( aSel.GetStart().GetPara() + 1 ); + if ( aDocument.isInVBAMode() ) + nCurMethodStart = ( aSel.GetStart().GetPara() + 1 ); SbMethod* pMethod = 0; // erstes Macro, sonst blind "Main" (ExtSearch?) for ( USHORT nMacro = 0; nMacro < xModule->GetMethods()->Count(); nMacro++ ) @@ -344,16 +345,20 @@ BOOL ModulWindow::BasicExecute() SbMethod* pM = (SbMethod*)xModule->GetMethods()->Get( nMacro ); DBG_ASSERT( pM, "Method?" ); pM->GetLineRange( nStart, nEnd ); - if ( nCurMethodStart >= nStart && nCurMethodStart <= nEnd ) + if ( ( aDocument.isInVBAMode() && ( nCurMethodStart >= nStart && nCurMethodStart <= nEnd ) ) || ( !aDocument.isInVBAMode() && !pMethod ) ) { pMethod = pM; break; } } if ( !pMethod ) - return ( BasicIDE::ChooseMacro( uno::Reference< frame::XModel >(), FALSE, rtl::OUString() ).getLength() > 0 ) ? TRUE : FALSE; - - else + { + if ( aDocument.isInVBAMode() ) + return ( BasicIDE::ChooseMacro( uno::Reference< frame::XModel >(), FALSE, rtl::OUString() ).getLength() > 0 ) ? TRUE : FALSE; + else + pMethod = (SbMethod*)xModule->Find( String( RTL_CONSTASCII_USTRINGPARAM( "Main" ) ), SbxCLASS_METHOD ); + } + if ( pMethod ) { pMethod->SetDebugFlags( aStatus.nBasicFlags ); BasicDLL::SetDebugMode( TRUE ); |