summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authornpower Developer <npower@openoffice.org>2010-04-08 16:36:31 +0100
committernpower Developer <npower@openoffice.org>2010-04-08 16:36:31 +0100
commit70f0bc6b7d0cfd4202626c670433859156bc3d3a (patch)
tree78b259c64d55cea6579cb868bb5a2d455833f18e /basctl
parent7fc422304638160f35fae67a02c0c07307ec6012 (diff)
npower13_objectmodule: fold in review comments ( for basctl )
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/baside2.cxx8
-rw-r--r--basctl/source/basicide/basides1.cxx2
-rw-r--r--basctl/source/basicide/basidesh.cxx2
-rw-r--r--basctl/source/basicide/bastype2.cxx17
-rw-r--r--basctl/source/basicide/bastypes.cxx30
5 files changed, 36 insertions, 23 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index c71ddeed788c..95671cd8ae47 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -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();
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 31391297f564..909a28543fae 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -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();
}
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 9a5204ff36cf..e22103e3503c 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -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 );
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 6009ad9f2385..6132d81f9c65 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -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;
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 53f33dfc7e89..85dfa146e178 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -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 );
+ }
+ }
}
}
}