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
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() )
{
BasicManager* pBasMgr = GetDocument().getBasicManager();
......
......@@ -1201,7 +1201,9 @@ IDEBaseWindow* BasicIDEShell::FindWindow( const ScriptDocument& rDocument, const
else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rName &&
( ( pWin->IsA( TYPE( ModulWindow ) ) && nType == BASICIDE_TYPE_MODULE ) ||
( pWin->IsA( TYPE( DialogWindow ) ) && nType == BASICIDE_TYPE_DIALOG ) ) )
{
return pWin;
}
}
pWin = aIDEWindowTable.Next();
}
......
......@@ -282,7 +282,7 @@ __EXPORT BasicIDEShell::~BasicIDEShell()
delete pObjectCatalog;
DestroyModulWindowLayout();
ContainerListenerImpl* pListener = dynamic_cast< ContainerListenerImpl* >( m_xLibListener.get() );
ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() );
// Destroy all ContainerListeners for Basic Container.
if ( pListener )
pListener->removeContainerListener( m_aCurDocument, m_aCurLibName );
......
......@@ -395,14 +395,15 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const
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 ) ) ) );
aEntryMap.insert( ::std::make_pair( OBJ_TYPE_USERFORMS, String( IDEResId( RID_STR_USERFORMS ) ) ) );
aEntryMap.insert( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, String( IDEResId( RID_STR_NORMAL_MODULES ) ) ) );
aEntryMap.insert( ::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 > > aEntries;
aEntries.push_back( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) );
aEntries.push_back( ::std::make_pair( OBJ_TYPE_USERFORMS, String( IDEResId( RID_STR_USERFORMS ) ) ) );
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::vector< std::pair< BasicEntryType, ::rtl::OUString > >::iterator iter;
for( iter = aEntries.begin(); iter != aEntries.end(); ++iter )
{
BasicEntryType eType = iter->first;
::rtl::OUString aEntryName = iter->second;
......
......@@ -585,24 +585,26 @@ void __EXPORT BasicIDETabBar::Command( const CommandEvent& rCEvt )
aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
aPopup.RemoveDisabledEntries();
}
// disable to delete or remove object modules in IDE
BasicManager* pBasMgr = aDocument.getBasicManager();
if ( pBasMgr )
if ( aDocument.isInVBAMode() )
{
StarBASIC* pBasic = pBasMgr->GetLib( aOULibName );
if( pBasic )
// disable to delete or remove object modules in IDE
BasicManager* pBasMgr = aDocument.getBasicManager();
if ( pBasMgr )
{
IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable();
IDEBaseWindow* pWin = aIDEWindowTable.Get( GetCurPageId() );
if( pWin && pWin->ISA( ModulWindow ) )
StarBASIC* pBasic = pBasMgr->GetLib( aOULibName );
if( pBasic )
{
SbModule* pActiveModule = (SbModule*)pBasic->FindModule( pWin->GetName() );
if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::Document ) )
IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable();
IDEBaseWindow* pWin = aIDEWindowTable.Get( GetCurPageId() );
if( pWin && pWin->ISA( ModulWindow ) )
{
aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, FALSE );
aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
}
SbModule* pActiveModule = (SbModule*)pBasic->FindModule( pWin->GetName() );
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