summaryrefslogtreecommitdiff
path: root/basctl/source
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
commit1a0c77e86f528ba4321b5f97d6d158e71361c1aa (patch)
tree9c049cdf3fdec0701a079c73058474cfd66b2914 /basctl/source
parent669019a788ac77db6a683147867188314eadfb36 (diff)
npower13_objectmodule: fold in review comments ( for basctl )
Diffstat (limited to 'basctl/source')
-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.cxx32
5 files changed, 37 insertions, 24 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index ba03633b4..a2759aba6 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 d9e7eca95..edcac631f 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 341ac59ee..4c714829b 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 a7d77df6e..cfe10715e 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 7101466f5..37c2e21aa 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 )
- {
- StarBASIC* pBasic = pBasMgr->GetLib( aOULibName );
- if( pBasic )
+ if ( aDocument.isInVBAMode() )
+ {
+ // 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 );
+ }
+ }
}
}
}