summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authornpower Developer <npower@openoffice.org>2010-03-03 19:59:09 +0000
committernpower Developer <npower@openoffice.org>2010-03-03 19:59:09 +0000
commit7fc422304638160f35fae67a02c0c07307ec6012 (patch)
tree164f4c3cc26cc91ca146bc4750fb1d2d217c3cbd /basctl
parente8a31aab0a174873306d78df361c3646c7e4215d (diff)
npower13_objectmodule: #i109734# fix a couple of problems, a) introduce lazy init of xModule for ModuleWindow ( needed because we get the module added before basic is updated ), b) fix compile warning, c) make sure elementRemoved really does try to remove the ModuleWindow
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/baside2.cxx64
-rw-r--r--basctl/source/basicide/baside2.hxx1
-rw-r--r--basctl/source/basicide/basidesh.cxx4
3 files changed, 42 insertions, 27 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 4f31af11be6f..c71ddeed788c 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -205,21 +205,27 @@ ModulWindow::ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDoc
pLayout = pParent;
aXEditorWindow.Show();
- BasicManager* pBasMgr = rDocument.getBasicManager();
- if ( pBasMgr )
+ SetBackground();
+}
+
+SbModuleRef ModulWindow::XModule()
+{
+ if ( !xModule.Is() )
{
- StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
- if ( pBasic )
+ BasicManager* pBasMgr = GetDocument().getBasicManager();
+ if ( pBasMgr )
{
- xBasic = pBasic;
- xModule = (SbModule*)pBasic->FindModule( aName );
+ StarBASIC* pBasic = pBasMgr->GetLib( GetLibName() );
+ if ( pBasic )
+ {
+ xBasic = pBasic;
+ xModule = (SbModule*)pBasic->FindModule( GetName() );
+ }
}
}
-
- SetBackground();
+ return xModule;
}
-
__EXPORT ModulWindow::~ModulWindow()
{
DBG_DTOR( ModulWindow, 0 );
@@ -269,7 +275,7 @@ void ModulWindow::CheckCompileBasic()
{
DBG_CHKTHIS( ModulWindow, 0 );
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
// Zur Laufzeit wird niemals compiliert!
BOOL bRunning = StarBASIC::IsRunning();
@@ -325,7 +331,7 @@ BOOL ModulWindow::BasicExecute()
CheckCompileBasic();
- if ( xModule.Is() && xModule->IsCompiled() && !aStatus.bError )
+ if ( XModule().Is() && xModule->IsCompiled() && !aStatus.bError )
{
if ( GetBreakPoints().Count() )
aStatus.nBasicFlags = aStatus.nBasicFlags | SbDEBUG_BREAK;
@@ -345,10 +351,18 @@ BOOL ModulWindow::BasicExecute()
SbMethod* pM = (SbMethod*)xModule->GetMethods()->Get( nMacro );
DBG_ASSERT( pM, "Method?" );
pM->GetLineRange( nStart, nEnd );
- if ( ( aDocument.isInVBAMode() && ( nCurMethodStart >= nStart && nCurMethodStart <= nEnd ) ) || ( !aDocument.isInVBAMode() && !pMethod ) )
+ if ( aDocument.isInVBAMode() )
+ {
+ if ( nCurMethodStart >= nStart && nCurMethodStart <= nEnd )
+ {
+ pMethod = pM;
+ break;
+ }
+ }
+ else if ( !pMethod || ( nStart < nCurMethodStart ) )
{
pMethod = pM;
- break;
+ nCurMethodStart = nStart;
}
}
if ( !pMethod )
@@ -384,7 +398,7 @@ BOOL ModulWindow::CompileBasic()
CheckCompileBasic();
BOOL bIsCompiled = FALSE;
- if ( xModule.Is() )
+ if ( XModule().Is() )
bIsCompiled = xModule->IsCompiled();
return bIsCompiled;
@@ -561,11 +575,11 @@ BOOL ModulWindow::ImportDialog()
BOOL ModulWindow::ToggleBreakPoint( ULONG nLine )
{
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
+ DBG_ASSERT( XModule().Is(), "Kein Modul!" );
BOOL bNewBreakPoint = FALSE;
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
CheckCompileBasic();
if ( aStatus.bError )
@@ -607,9 +621,9 @@ BOOL ModulWindow::ToggleBreakPoint( ULONG nLine )
void ModulWindow::UpdateBreakPoint( const BreakPoint& rBrk )
{
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
+ DBG_ASSERT( XModule().Is(), "Kein Modul!" );
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
CheckCompileBasic();
@@ -833,9 +847,9 @@ void ModulWindow::BasicRemoveWatch()
void ModulWindow::EditMacro( const String& rMacroName )
{
DBG_CHKTHIS( ModulWindow, 0 );
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
+ DBG_ASSERT( XModule().Is(), "Kein Modul!" );
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
CheckCompileBasic();
@@ -905,12 +919,12 @@ BOOL __EXPORT ModulWindow::AllowUndo()
void __EXPORT ModulWindow::UpdateData()
{
DBG_CHKTHIS( ModulWindow, 0 );
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
+ DBG_ASSERT( XModule().Is(), "Kein Modul!" );
// UpdateData wird gerufen, wenn sich der Source von aussen
// geaendert hat.
// => Keine Unterbrechungen erwuenscht!
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
SetModule( xModule->GetSource32() );
@@ -1231,7 +1245,7 @@ void __EXPORT ModulWindow::GoOnTop()
String ModulWindow::GetSbModuleName()
{
String aModuleName;
- if ( xModule.Is() )
+ if ( XModule().Is() )
aModuleName = xModule->GetName();
return aModuleName;
}
@@ -1353,7 +1367,7 @@ USHORT __EXPORT ModulWindow::GetSearchOptions()
void __EXPORT ModulWindow::BasicStarted()
{
- if ( xModule.Is() )
+ if ( XModule().Is() )
{
aStatus.bIsRunning = TRUE;
BreakPointList& rList = GetBreakPoints();
@@ -1384,7 +1398,7 @@ BasicEntryDescriptor ModulWindow::CreateEntryDescriptor()
LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
String aModName( GetName() );
String aLibSubName;
- if( xBasic.Is() && aDocument.isInVBAMode() && xModule.Is() )
+ if( xBasic.Is() && aDocument.isInVBAMode() && XModule().Is() )
{
switch( xModule->GetModuleType() )
{
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 6d35f0a027a8..0bcf4a87476b 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -357,6 +357,7 @@ private:
void AssertValidEditEngine();
sal_Int32 FormatAndPrint( Printer* pPrinter, sal_Int32 nPage = -1 );
+ SbModuleRef XModule();
protected:
virtual void Resize();
virtual void GetFocus();
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 036127e1c844..9a5204ff36cf 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -147,7 +147,7 @@ public:
{
IDEBaseWindow* pWin = mpShell->FindWindow( mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, BASICIDE_TYPE_MODULE, TRUE );
if( pWin )
- mpShell->RemoveWindow( pWin, FALSE, TRUE );
+ mpShell->RemoveWindow( pWin, TRUE, TRUE );
}
}
@@ -1006,7 +1006,7 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, String aLibName,
{
if ( !bCheck || ( rDocument != m_aCurDocument || aLibName != m_aCurLibName ) )
{
- ContainerListenerImpl* pListener = pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() );
+ ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() );
if ( pListener )
pListener->removeContainerListener( m_aCurDocument, m_aCurLibName );