Kaydet (Commit) 70f0bc6b authored tarafından npower Developer's avatar npower Developer

npower13_objectmodule: fold in review comments ( for basctl )

üst 7fc42230
...@@ -210,6 +210,14 @@ ModulWindow::ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDoc ...@@ -210,6 +210,14 @@ ModulWindow::ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDoc
SbModuleRef ModulWindow::XModule() SbModuleRef ModulWindow::XModule()
{ {
// ModuleWindows can now be created as a result of the
// modules getting created via the api. This is a result of an
// elementInserted event from the BasicLibrary container.
// However the SbModule is also created from a different listener to
// the same event ( in basmgr ) Therefore it is possible when we look
// for xModule it may not yet be available, here we keep tring to access
// the module until such time as it exists
if ( !xModule.Is() ) if ( !xModule.Is() )
{ {
BasicManager* pBasMgr = GetDocument().getBasicManager(); BasicManager* pBasMgr = GetDocument().getBasicManager();
......
...@@ -1201,7 +1201,9 @@ IDEBaseWindow* BasicIDEShell::FindWindow( const ScriptDocument& rDocument, const ...@@ -1201,7 +1201,9 @@ IDEBaseWindow* BasicIDEShell::FindWindow( const ScriptDocument& rDocument, const
else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rName && else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rName &&
( ( pWin->IsA( TYPE( ModulWindow ) ) && nType == BASICIDE_TYPE_MODULE ) || ( ( pWin->IsA( TYPE( ModulWindow ) ) && nType == BASICIDE_TYPE_MODULE ) ||
( pWin->IsA( TYPE( DialogWindow ) ) && nType == BASICIDE_TYPE_DIALOG ) ) ) ( pWin->IsA( TYPE( DialogWindow ) ) && nType == BASICIDE_TYPE_DIALOG ) ) )
{
return pWin; return pWin;
}
} }
pWin = aIDEWindowTable.Next(); pWin = aIDEWindowTable.Next();
} }
......
...@@ -282,7 +282,7 @@ __EXPORT BasicIDEShell::~BasicIDEShell() ...@@ -282,7 +282,7 @@ __EXPORT BasicIDEShell::~BasicIDEShell()
delete pObjectCatalog; delete pObjectCatalog;
DestroyModulWindowLayout(); DestroyModulWindowLayout();
ContainerListenerImpl* pListener = dynamic_cast< ContainerListenerImpl* >( m_xLibListener.get() ); ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() );
// Destroy all ContainerListeners for Basic Container. // Destroy all ContainerListeners for Basic Container.
if ( pListener ) if ( pListener )
pListener->removeContainerListener( m_aCurDocument, m_aCurLibName ); pListener->removeContainerListener( m_aCurDocument, m_aCurLibName );
......
...@@ -395,14 +395,15 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ...@@ -395,14 +395,15 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const
void BasicTreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName ) void BasicTreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName )
{ {
::std::map< BasicEntryType, ::rtl::OUString > aEntryMap;
aEntryMap.insert( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ); ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > > aEntries;
aEntryMap.insert( ::std::make_pair( OBJ_TYPE_USERFORMS, String( IDEResId( RID_STR_USERFORMS ) ) ) ); aEntries.push_back( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) );
aEntryMap.insert( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, String( IDEResId( RID_STR_NORMAL_MODULES ) ) ) ); aEntries.push_back( ::std::make_pair( OBJ_TYPE_USERFORMS, String( IDEResId( RID_STR_USERFORMS ) ) ) );
aEntryMap.insert( ::std::make_pair( OBJ_TYPE_CLASS_MODULES, String( IDEResId( RID_STR_CLASS_MODULES ) ) ) ); aEntries.push_back( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, String( IDEResId( RID_STR_NORMAL_MODULES ) ) ) );
aEntries.push_back( ::std::make_pair( OBJ_TYPE_CLASS_MODULES, String( IDEResId( RID_STR_CLASS_MODULES ) ) ) );
::std::map< BasicEntryType, ::rtl::OUString >::iterator iter;
for( iter = aEntryMap.begin(); iter != aEntryMap.end(); ++iter ) ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > >::iterator iter;
for( iter = aEntries.begin(); iter != aEntries.end(); ++iter )
{ {
BasicEntryType eType = iter->first; BasicEntryType eType = iter->first;
::rtl::OUString aEntryName = iter->second; ::rtl::OUString aEntryName = iter->second;
......
...@@ -585,24 +585,26 @@ void __EXPORT BasicIDETabBar::Command( const CommandEvent& rCEvt ) ...@@ -585,24 +585,26 @@ void __EXPORT BasicIDETabBar::Command( const CommandEvent& rCEvt )
aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE ); aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
aPopup.RemoveDisabledEntries(); aPopup.RemoveDisabledEntries();
} }
if ( aDocument.isInVBAMode() )
// disable to delete or remove object modules in IDE
BasicManager* pBasMgr = aDocument.getBasicManager();
if ( pBasMgr )
{ {
StarBASIC* pBasic = pBasMgr->GetLib( aOULibName ); // disable to delete or remove object modules in IDE
if( pBasic ) BasicManager* pBasMgr = aDocument.getBasicManager();
if ( pBasMgr )
{ {
IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable(); StarBASIC* pBasic = pBasMgr->GetLib( aOULibName );
IDEBaseWindow* pWin = aIDEWindowTable.Get( GetCurPageId() ); if( pBasic )
if( pWin && pWin->ISA( ModulWindow ) )
{ {
SbModule* pActiveModule = (SbModule*)pBasic->FindModule( pWin->GetName() ); IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable();
if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::Document ) ) IDEBaseWindow* pWin = aIDEWindowTable.Get( GetCurPageId() );
if( pWin && pWin->ISA( ModulWindow ) )
{ {
aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, FALSE ); SbModule* pActiveModule = (SbModule*)pBasic->FindModule( pWin->GetName() );
aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE ); if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::Document ) )
} {
aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, FALSE );
aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
}
}
} }
} }
} }
......
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