summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2010-09-29 14:32:58 +0100
committerNoel Power <noel.power@novell.com>2010-09-29 14:32:58 +0100
commitc200ed4a9076e2d942d706c8fdc7ca2dd6522c8b (patch)
treec2f9f077bb414d915d28ff6aaf03495cac935159 /basctl
parent4d45788533940100b53249adeeba9aea04be8cae (diff)
fix for bugs.freedesktop.org/show_bug.cgi?id=30452
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/baside2.cxx23
1 files changed, 7 insertions, 16 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index d0a8ca1a6ddb..a8d5b37c6a4a 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -348,8 +348,8 @@ BOOL ModulWindow::BasicExecute()
AddStatus( BASWIN_RUNNINGBASIC );
USHORT nStart, nEnd, nCurMethodStart = 0;
TextSelection aSel = GetEditView()->GetSelection();
- if ( aDocument.isInVBAMode() )
- nCurMethodStart = ( aSel.GetStart().GetPara() + 1 );
+ // Init cursor to top
+ nCurMethodStart = ( aSel.GetStart().GetPara() + 1 );
SbMethod* pMethod = 0;
// erstes Macro, sonst blind "Main" (ExtSearch?)
for ( USHORT nMacro = 0; nMacro < xModule->GetMethods()->Count(); nMacro++ )
@@ -357,26 +357,17 @@ BOOL ModulWindow::BasicExecute()
SbMethod* pM = (SbMethod*)xModule->GetMethods()->Get( nMacro );
DBG_ASSERT( pM, "Method?" );
pM->GetLineRange( nStart, nEnd );
- if ( aDocument.isInVBAMode() )
- {
- if ( nCurMethodStart >= nStart && nCurMethodStart <= nEnd )
- {
- pMethod = pM;
- break;
- }
- }
- else if ( !pMethod || ( nStart < nCurMethodStart && !pM->IsHidden() ) )
+ if ( nCurMethodStart >= nStart && nCurMethodStart <= nEnd )
{
+ // matched a method to the cursor position
pMethod = pM;
- nCurMethodStart = nStart;
+ break;
}
}
if ( !pMethod )
{
- 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 not in a method then prompt the user
+ return ( BasicIDE::ChooseMacro( uno::Reference< frame::XModel >(), FALSE, rtl::OUString() ).getLength() > 0 ) ? TRUE : FALSE;
}
if ( pMethod )
{