From b4cfc7121b263041c586fe3c3ed894f3a5494e7c Mon Sep 17 00:00:00 2001 From: npower Developer Date: Wed, 3 Mar 2010 12:59:39 +0000 Subject: npower13_objectmodule: tweak IDE to only run macros from cursor in VBA mode --- basctl/source/basicide/baside2.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'basctl') 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 ); -- cgit v1.2.3