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 ...@@ -205,21 +205,27 @@ ModulWindow::ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDoc
pLayout = pParent; pLayout = pParent;
aXEditorWindow.Show(); aXEditorWindow.Show();
BasicManager* pBasMgr = rDocument.getBasicManager(); SetBackground();
if ( pBasMgr ) }
SbModuleRef ModulWindow::XModule()
{
if ( !xModule.Is() )
{ {
StarBASIC* pBasic = pBasMgr->GetLib( aLibName ); BasicManager* pBasMgr = GetDocument().getBasicManager();
if ( pBasic ) if ( pBasMgr )
{ {
xBasic = pBasic; StarBASIC* pBasic = pBasMgr->GetLib( GetLibName() );
xModule = (SbModule*)pBasic->FindModule( aName ); if ( pBasic )
{
xBasic = pBasic;
xModule = (SbModule*)pBasic->FindModule( GetName() );
}
} }
} }
return xModule;
SetBackground();
} }
__EXPORT ModulWindow::~ModulWindow() __EXPORT ModulWindow::~ModulWindow()
{ {
DBG_DTOR( ModulWindow, 0 ); DBG_DTOR( ModulWindow, 0 );
...@@ -269,7 +275,7 @@ void ModulWindow::CheckCompileBasic() ...@@ -269,7 +275,7 @@ void ModulWindow::CheckCompileBasic()
{ {
DBG_CHKTHIS( ModulWindow, 0 ); DBG_CHKTHIS( ModulWindow, 0 );
if ( xModule.Is() ) if ( XModule().Is() )
{ {
// Zur Laufzeit wird niemals compiliert! // Zur Laufzeit wird niemals compiliert!
BOOL bRunning = StarBASIC::IsRunning(); BOOL bRunning = StarBASIC::IsRunning();
...@@ -325,7 +331,7 @@ BOOL ModulWindow::BasicExecute() ...@@ -325,7 +331,7 @@ BOOL ModulWindow::BasicExecute()
CheckCompileBasic(); CheckCompileBasic();
if ( xModule.Is() && xModule->IsCompiled() && !aStatus.bError ) if ( XModule().Is() && xModule->IsCompiled() && !aStatus.bError )
{ {
if ( GetBreakPoints().Count() ) if ( GetBreakPoints().Count() )
aStatus.nBasicFlags = aStatus.nBasicFlags | SbDEBUG_BREAK; aStatus.nBasicFlags = aStatus.nBasicFlags | SbDEBUG_BREAK;
...@@ -345,10 +351,18 @@ BOOL ModulWindow::BasicExecute() ...@@ -345,10 +351,18 @@ BOOL ModulWindow::BasicExecute()
SbMethod* pM = (SbMethod*)xModule->GetMethods()->Get( nMacro ); SbMethod* pM = (SbMethod*)xModule->GetMethods()->Get( nMacro );
DBG_ASSERT( pM, "Method?" ); DBG_ASSERT( pM, "Method?" );
pM->GetLineRange( nStart, nEnd ); 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; pMethod = pM;
break; nCurMethodStart = nStart;
} }
} }
if ( !pMethod ) if ( !pMethod )
...@@ -384,7 +398,7 @@ BOOL ModulWindow::CompileBasic() ...@@ -384,7 +398,7 @@ BOOL ModulWindow::CompileBasic()
CheckCompileBasic(); CheckCompileBasic();
BOOL bIsCompiled = FALSE; BOOL bIsCompiled = FALSE;
if ( xModule.Is() ) if ( XModule().Is() )
bIsCompiled = xModule->IsCompiled(); bIsCompiled = xModule->IsCompiled();
return bIsCompiled; return bIsCompiled;
...@@ -561,11 +575,11 @@ BOOL ModulWindow::ImportDialog() ...@@ -561,11 +575,11 @@ BOOL ModulWindow::ImportDialog()
BOOL ModulWindow::ToggleBreakPoint( ULONG nLine ) BOOL ModulWindow::ToggleBreakPoint( ULONG nLine )
{ {
DBG_ASSERT( xModule.Is(), "Kein Modul!" ); DBG_ASSERT( XModule().Is(), "Kein Modul!" );
BOOL bNewBreakPoint = FALSE; BOOL bNewBreakPoint = FALSE;
if ( xModule.Is() ) if ( XModule().Is() )
{ {
CheckCompileBasic(); CheckCompileBasic();
if ( aStatus.bError ) if ( aStatus.bError )
...@@ -607,9 +621,9 @@ BOOL ModulWindow::ToggleBreakPoint( ULONG nLine ) ...@@ -607,9 +621,9 @@ BOOL ModulWindow::ToggleBreakPoint( ULONG nLine )
void ModulWindow::UpdateBreakPoint( const BreakPoint& rBrk ) 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(); CheckCompileBasic();
...@@ -833,9 +847,9 @@ void ModulWindow::BasicRemoveWatch() ...@@ -833,9 +847,9 @@ void ModulWindow::BasicRemoveWatch()
void ModulWindow::EditMacro( const String& rMacroName ) void ModulWindow::EditMacro( const String& rMacroName )
{ {
DBG_CHKTHIS( ModulWindow, 0 ); DBG_CHKTHIS( ModulWindow, 0 );
DBG_ASSERT( xModule.Is(), "Kein Modul!" ); DBG_ASSERT( XModule().Is(), "Kein Modul!" );
if ( xModule.Is() ) if ( XModule().Is() )
{ {
CheckCompileBasic(); CheckCompileBasic();
...@@ -905,12 +919,12 @@ BOOL __EXPORT ModulWindow::AllowUndo() ...@@ -905,12 +919,12 @@ BOOL __EXPORT ModulWindow::AllowUndo()
void __EXPORT ModulWindow::UpdateData() void __EXPORT ModulWindow::UpdateData()
{ {
DBG_CHKTHIS( ModulWindow, 0 ); 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 // UpdateData wird gerufen, wenn sich der Source von aussen
// geaendert hat. // geaendert hat.
// => Keine Unterbrechungen erwuenscht! // => Keine Unterbrechungen erwuenscht!
if ( xModule.Is() ) if ( XModule().Is() )
{ {
SetModule( xModule->GetSource32() ); SetModule( xModule->GetSource32() );
...@@ -1231,7 +1245,7 @@ void __EXPORT ModulWindow::GoOnTop() ...@@ -1231,7 +1245,7 @@ void __EXPORT ModulWindow::GoOnTop()
String ModulWindow::GetSbModuleName() String ModulWindow::GetSbModuleName()
{ {
String aModuleName; String aModuleName;
if ( xModule.Is() ) if ( XModule().Is() )
aModuleName = xModule->GetName(); aModuleName = xModule->GetName();
return aModuleName; return aModuleName;
} }
...@@ -1353,7 +1367,7 @@ USHORT __EXPORT ModulWindow::GetSearchOptions() ...@@ -1353,7 +1367,7 @@ USHORT __EXPORT ModulWindow::GetSearchOptions()
void __EXPORT ModulWindow::BasicStarted() void __EXPORT ModulWindow::BasicStarted()
{ {
if ( xModule.Is() ) if ( XModule().Is() )
{ {
aStatus.bIsRunning = TRUE; aStatus.bIsRunning = TRUE;
BreakPointList& rList = GetBreakPoints(); BreakPointList& rList = GetBreakPoints();
...@@ -1384,7 +1398,7 @@ BasicEntryDescriptor ModulWindow::CreateEntryDescriptor() ...@@ -1384,7 +1398,7 @@ BasicEntryDescriptor ModulWindow::CreateEntryDescriptor()
LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName ); LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
String aModName( GetName() ); String aModName( GetName() );
String aLibSubName; String aLibSubName;
if( xBasic.Is() && aDocument.isInVBAMode() && xModule.Is() ) if( xBasic.Is() && aDocument.isInVBAMode() && XModule().Is() )
{ {
switch( xModule->GetModuleType() ) switch( xModule->GetModuleType() )
{ {
......
...@@ -357,6 +357,7 @@ private: ...@@ -357,6 +357,7 @@ private:
void AssertValidEditEngine(); void AssertValidEditEngine();
sal_Int32 FormatAndPrint( Printer* pPrinter, sal_Int32 nPage = -1 ); sal_Int32 FormatAndPrint( Printer* pPrinter, sal_Int32 nPage = -1 );
SbModuleRef XModule();
protected: protected:
virtual void Resize(); virtual void Resize();
virtual void GetFocus(); virtual void GetFocus();
......
...@@ -147,7 +147,7 @@ public: ...@@ -147,7 +147,7 @@ public:
{ {
IDEBaseWindow* pWin = mpShell->FindWindow( mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, BASICIDE_TYPE_MODULE, TRUE ); IDEBaseWindow* pWin = mpShell->FindWindow( mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, BASICIDE_TYPE_MODULE, TRUE );
if( pWin ) if( pWin )
mpShell->RemoveWindow( pWin, FALSE, TRUE ); mpShell->RemoveWindow( pWin, TRUE, TRUE );
} }
} }
...@@ -1006,7 +1006,7 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, String aLibName, ...@@ -1006,7 +1006,7 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, String aLibName,
{ {
if ( !bCheck || ( rDocument != m_aCurDocument || aLibName != m_aCurLibName ) ) 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 ) if ( pListener )
pListener->removeContainerListener( m_aCurDocument, m_aCurLibName ); 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