Kaydet (Commit) 7fc42230 authored tarafından npower Developer's avatar npower Developer

npower13_objectmodule: #i109734# fix a couple of problems, a) introduce lazy…

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
üst e8a31aab
......@@ -205,21 +205,27 @@ ModulWindow::ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDoc
pLayout = pParent;
aXEditorWindow.Show();
BasicManager* pBasMgr = rDocument.getBasicManager();
SetBackground();
}
SbModuleRef ModulWindow::XModule()
{
if ( !xModule.Is() )
{
BasicManager* pBasMgr = GetDocument().getBasicManager();
if ( pBasMgr )
{
StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
StarBASIC* pBasic = pBasMgr->GetLib( GetLibName() );
if ( pBasic )
{
xBasic = pBasic;
xModule = (SbModule*)pBasic->FindModule( aName );
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,12 +351,20 @@ 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;
nCurMethodStart = nStart;
}
}
if ( !pMethod )
{
if ( aDocument.isInVBAMode() )
......@@ -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() )
{
......
......@@ -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();
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment