diff options
Diffstat (limited to 'basctl/source/basicide/bastypes.cxx')
-rw-r--r-- | basctl/source/basicide/bastypes.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index af42503a5dae..150e10a5a76f 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -57,6 +57,7 @@ #include <com/sun/star/script/XLibraryContainer2.hpp> #endif #include <com/sun/star/script/XLibraryContainerPassword.hpp> +#include <com/sun/star/script/ModuleType.hpp> using namespace ::com::sun::star::uno; using namespace ::com::sun::star; @@ -584,8 +585,32 @@ void __EXPORT BasicIDETabBar::Command( const CommandEvent& rCEvt ) aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE ); 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 ); + if( pBasic ) + { + IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable(); + IDEBaseWindow* pWin = aIDEWindowTable.Get( GetCurPageId() ); + if( pWin && pWin->ISA( ModulWindow ) ) + { + 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 ); + } + } + } + } + } } + SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; if ( pDispatcher ) |