summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/viewfun2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/view/viewfun2.cxx')
-rw-r--r--sc/source/ui/view/viewfun2.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 5fcd094acffc..11ecfa5aae8c 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -87,6 +87,13 @@
#include "docuno.hxx"
#include "charthelper.hxx"
+#include <basic/sbstar.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
+using namespace com::sun::star;
+
+// helper func defined in docfunc.cxx
+void VBA_DeleteModule( ScDocShell& rDocSh, String& sModuleName );
// STATIC DATA ---------------------------------------------------------------
@@ -2141,6 +2148,7 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
{
ScDocShell* pDocSh = GetViewData()->GetDocShell();
ScDocument* pDoc = pDocSh->GetDocument();
+ BOOL bVbaEnabled = pDoc ? pDoc->IsInVBAMode() : FALSE;
SCTAB nNewTab = TheTabs[0];
int i;
WaitObject aWait( GetFrameWin() );
@@ -2212,9 +2220,18 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
for(i=TheTabs.Count()-1;i>=0;i--)
{
+ String sCodeName;
+ BOOL bHasCodeName = pDoc->GetCodeName( TheTabs[sal::static_int_cast<USHORT>(i)], sCodeName );
if (pDoc->DeleteTab( TheTabs[sal::static_int_cast<USHORT>(i)], pUndoDoc ))
{
bDelDone = TRUE;
+ if( bVbaEnabled )
+ {
+ if( bHasCodeName )
+ {
+ VBA_DeleteModule( *pDocSh, sCodeName );
+ }
+ }
pDocSh->Broadcast( ScTablesHint( SC_TAB_DELETED, TheTabs[sal::static_int_cast<USHORT>(i)] ) );
}
}