summaryrefslogtreecommitdiff
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
commitc43ac455fe23c130a394c3a561e09697e08752e1 (patch)
tree10e8fd69c2056c3f878dbffc15958aa597ec015d
parente4567b3a3e425d8e3cac6eb71ebf9556afcfb141 (diff)
fix for bugs.freedesktop.org/show_bug.cgi?id=30452
-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 93625b0ba..84a878194 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 )
{