summaryrefslogtreecommitdiff
path: root/basctl/source/basicide/basides1.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basctl/source/basicide/basides1.cxx')
-rw-r--r--basctl/source/basicide/basides1.cxx27
1 files changed, 23 insertions, 4 deletions
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 4432de9aa282..351186325b09 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -109,7 +109,6 @@ void __EXPORT BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
{
if ( aDocument.removeModule( aLibName, aName ) )
{
- RemoveWindow( pCurWin, TRUE );
BasicIDE::MarkDocumentModified( aDocument );
}
}
@@ -430,11 +429,31 @@ void __EXPORT BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
{
String aNewName( rModName.GetValue() );
String aOldName( pWin->GetName() );
-
if ( aNewName != aOldName )
{
- if ( ( pWin->IsA( TYPE( ModulWindow ) ) && ((ModulWindow*)pWin)->RenameModule( aNewName ) )
- || ( pWin->IsA( TYPE( DialogWindow ) ) && ((DialogWindow*)pWin)->RenameDialog( aNewName ) ) )
+ bool bRenameOk = false;
+ if ( pWin->IsA( TYPE( ModulWindow ) ) )
+ {
+ ModulWindow* pModWin = (ModulWindow*)pWin;
+ String aLibName = ( pModWin->GetLibName() );
+ ScriptDocument aDocument( pWin->GetDocument() );
+
+ if ( BasicIDE::RenameModule( pModWin, aDocument, aLibName, aOldName, aNewName ) )
+ {
+ bRenameOk = true;
+ // Because we listen for container events for script
+ // modules, rename will delete the 'old' window
+ // pWin has been invalidated, restore now
+ pWin = FindBasWin( aDocument, aLibName, aNewName, TRUE );
+ }
+
+ }
+ else if ( pWin->IsA( TYPE( DialogWindow ) ) )
+ {
+ DialogWindow* pDlgWin = (DialogWindow*)pWin;
+ bRenameOk = pDlgWin->RenameDialog( aNewName );
+ }
+ if ( bRenameOk )
{
BasicIDE::MarkDocumentModified( pWin->GetDocument() );
}