summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basctl/source/basicide/baside2.cxx13
-rw-r--r--basctl/source/basicide/baside2.hxx3
-rw-r--r--basctl/source/basicide/basides1.cxx26
-rw-r--r--basctl/source/basicide/basobj2.cxx2
4 files changed, 25 insertions, 19 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 71dcd25ed51a..9f97e1766c3b 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -1223,19 +1223,6 @@ void __EXPORT ModulWindow::DoScroll( ScrollBar* pCurScrollBar )
}
-BOOL ModulWindow::RenameModule( const String& rNewName )
-{
- if ( !BasicIDE::RenameModule( this, GetDocument(), GetLibName(), GetName(), rNewName ) )
- return FALSE;
-
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_DOC_MODIFIED );
-
- return TRUE;
-}
-
-
BOOL __EXPORT ModulWindow::IsModified()
{
return GetEditEngine() ? GetEditEngine()->IsModified() : FALSE;
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 0bcf4a87476b..280bb6ee3ab6 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -390,7 +390,7 @@ public:
virtual void SetReadOnly( BOOL bReadOnly );
virtual BOOL IsReadOnly();
- StarBASIC* GetBasic() { return xBasic; }
+ StarBASIC* GetBasic() { XModule(); return xBasic; }
SbModule* GetSbModule() { return xModule; }
void SetSbModule( SbModule* pModule ) { xModule = pModule; }
@@ -418,7 +418,6 @@ public:
// void InsertFromObjectCatalog( ObjectCatalog* pObjDlg );
BOOL ToggleBreakPoint( ULONG nLine );
- BOOL RenameModule( const String& rNewName );
BasicStatus& GetBasicStatus() { return aStatus; }
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 909a28543fae..e361a17ff578 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -430,11 +430,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() );
}
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index d2672f39928f..3604866b4202 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -191,7 +191,7 @@ bool RenameModule( Window* pErrorParent, const ScriptDocument& rDocument, const
BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
if ( pIDEShell )
{
- IDEBaseWindow* pWin = pIDEShell->FindWindow( rDocument, rLibName, rOldName, BASICIDE_TYPE_MODULE, FALSE );
+ IDEBaseWindow* pWin = pIDEShell->FindWindow( rDocument, rLibName, rNewName, BASICIDE_TYPE_MODULE, TRUE );
if ( pWin )
{
// set new name in window