diff options
author | Thomas Benisch <tbe@openoffice.org> | 2001-06-28 14:26:41 +0000 |
---|---|---|
committer | Thomas Benisch <tbe@openoffice.org> | 2001-06-28 14:26:41 +0000 |
commit | 475d993d5ecec15fde78030d18b4916c42aec059 (patch) | |
tree | 347471291ec702c41221e1663f3cbd5707640b37 /basctl/source/basicide/basides2.cxx | |
parent | 230c9326e8b436a501b719f5e3aab6049911d4cb (diff) |
#88565# change module management from sbx to library container
Diffstat (limited to 'basctl/source/basicide/basides2.cxx')
-rw-r--r-- | basctl/source/basicide/basides2.cxx | 63 |
1 files changed, 50 insertions, 13 deletions
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx index 47d405804aac..5633de74e5a7 100644 --- a/basctl/source/basicide/basides2.cxx +++ b/basctl/source/basicide/basides2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: basides2.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: tbe $ $Date: 2001-06-20 09:27:37 $ + * last change: $Author: tbe $ $Date: 2001-06-28 15:26:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,6 +82,10 @@ #include <svtools/xtextedt.hxx> #include <sfx2/sfxdefs.hxx> +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + + IMPL_LINK_INLINE_START( BasicIDEShell, ObjectDialogCancelHdl, ObjectCatalog *, EMPTYARG ) { ShowObjectDialog( FALSE, TRUE ); @@ -223,19 +227,53 @@ void BasicIDEShell::CreateModulWindowLayout() ModulWindow* BasicIDEShell::CreateBasWin( StarBASIC* pBasic, String aModName ) { bCreatingWindow = TRUE; + ULONG nKey = 0; ModulWindow* pWin = 0; - SbModule* pModule = pBasic->FindModule( aModName ); - if ( !pModule ) - pModule = BasicIDE::CreateModule( pBasic, aModName, TRUE ); - else // Vielleicht gibt es ein suspendiertes? - pWin = FindBasWin( pBasic, aModName, FALSE, TRUE ); + // Vielleicht gibt es ein suspendiertes? + pWin = FindBasWin( pBasic, aModName, FALSE, TRUE ); if ( !pWin ) { - pWin = new ModulWindow( pModulLayout, pBasic, pModule ); - nKey = InsertWindowInTable( pWin ); + BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); + if ( pBasMgr ) + { + SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr ); + String aLibName = pBasic->GetName(); + + if ( aModName.Len() == 0 ) + aModName = BasicIDE::CreateModuleName( pShell, aLibName ); + + try + { + ::rtl::OUString aModule; + if ( BasicIDE::HasModule( pShell, aLibName, aModName ) ) + { + // get module + aModule = BasicIDE::GetModule( pShell, aLibName, aModName ); + } + else + { + // create module + aModule = BasicIDE::CreateModule( pShell, aLibName, aModName, TRUE ); + } + + // new module window + pWin = new ModulWindow( pModulLayout, pBasic, pShell, aLibName, aModName, aModule ); + nKey = InsertWindowInTable( pWin ); + } + catch ( container::ElementExistException& e ) + { + ByteString aBStr( String(e.Message), RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR( aBStr.GetBuffer() ); + } + catch ( container::NoSuchElementException& e ) + { + ByteString aBStr( String(e.Message), RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR( aBStr.GetBuffer() ); + } + } } else { @@ -249,7 +287,7 @@ ModulWindow* BasicIDEShell::CreateBasWin( StarBASIC* pBasic, String aModName ) } DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" ); } - pTabBar->InsertPage( (USHORT)nKey, pModule->GetName() ); + pTabBar->InsertPage( (USHORT)nKey, aModName ); pTabBar->Sort(); pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar ); if ( !pCurWin ) @@ -267,11 +305,10 @@ ModulWindow* BasicIDEShell::FindBasWin( StarBASIC* pBasic, const String& rModNam { if ( ( !pWin->IsSuspended() || bFindSuspended ) && pWin->IsA( TYPE( ModulWindow ) ) ) { - String aMod( ((ModulWindow*)pWin)->GetModuleName() ); + String aMod( ((ModulWindow*)pWin)->GetModName() ); if ( !pBasic ) // nur irgendeins finden... pModWin = (ModulWindow*)pWin; - else if ( ( pWin->GetBasic() == pBasic ) && - ( ( rModName.Len() == 0 ) || ( aMod == rModName ) ) ) + else if ( ( pWin->GetBasic() == pBasic ) && ( aMod == rModName ) ) { pModWin = (ModulWindow*)pWin; } |