update ooo310-m15
[ooovba.git] / applied_patches / 0380-basic-ide-objectmodule.diff
blob715b4cceb2b43eef366844cce6467482a1475c85
1 --- basctl/source/basicide/bastypes.cxx.orig 2008-08-20 18:25:53.000000000 +0800
2 +++ basctl/source/basicide/bastypes.cxx 2008-08-19 18:40:27.000000000 +0800
3 @@ -60,6 +60,7 @@
4 #include <com/sun/star/script/XLibraryContainer2.hpp>
5 #endif
6 #include <com/sun/star/script/XLibraryContainerPassword.hpp>
7 +#include <com/sun/star/script/ModuleType.hpp>
9 using namespace ::com::sun::star::uno;
10 using namespace ::com::sun::star;
11 @@ -640,8 +641,30 @@ void __EXPORT BasicIDETabBar::Command( c
12 aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
13 aPopup.RemoveDisabledEntries();
16 + // disable to delete or remove object modules in IDE
17 + BasicManager* pBasMgr = aDocument.getBasicManager();
18 + if ( pBasMgr )
19 + {
20 + StarBASIC* pBasic = pBasMgr->GetLib( aOULibName );
21 + if( pBasic )
22 + {
23 + IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable();
24 + IDEBaseWindow* pWin = aIDEWindowTable.Get( GetCurPageId() );
25 + if( pWin && pWin->ISA( ModulWindow ) )
26 + {
27 + SbModule* pActiveModule = (SbModule*)pBasic->FindModule( pWin->GetName() );
28 + if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::Document ) )
29 + {
30 + aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, FALSE );
31 + aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
32 + }
33 + }
34 + }
35 + }
39 SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
40 SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
41 if ( pDispatcher )