summaryrefslogtreecommitdiff
path: root/basic/source/basmgr/basmgr.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/basmgr/basmgr.cxx')
-rw-r--r--basic/source/basmgr/basmgr.cxx41
1 files changed, 34 insertions, 7 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index ffb23f9710..a18b9bb081 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -41,6 +41,7 @@
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <basic/sbmod.hxx>
+#include <basic/sbobjmod.hxx>
#include <basic/sbuno.hxx>
#include <basic/basmgr.hxx>
@@ -65,6 +66,9 @@
#include <com/sun/star/script/XStarBasicDialogInfo.hpp>
#include <com/sun/star/script/XStarBasicLibraryInfo.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
+#include <com/sun/star/script/ModuleInfo.hpp>
+#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/script/XVBACompat.hpp>
#include <cppuhelper/implbase1.hxx>
@@ -236,7 +240,15 @@ void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr,
Any aElement = xLibNameAccess->getByName( aModuleName );
::rtl::OUString aMod;
aElement >>= aMod;
- pLib->MakeModule32( aModuleName, aMod );
+ Reference< XVBAModuleInfo > xVBAModuleInfo( xLibNameAccess, UNO_QUERY );
+ if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( aModuleName ) )
+ {
+ ModuleInfo mInfo = xVBAModuleInfo->getModuleInfo( aModuleName );
+ OSL_TRACE("#addLibraryModulesImpl - aMod");
+ pLib->MakeModule32( aModuleName, mInfo, aMod );
+ }
+ else
+ pLib->MakeModule32( aModuleName, aMod );
}
}
@@ -270,11 +282,16 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent
{
Reference< XLibraryContainer > xScriptCont( Event.Source, UNO_QUERY );
insertLibraryImpl( xScriptCont, mpMgr, Event.Element, aName );
+ StarBASIC* pLib = mpMgr->GetLib( aName );
+ if ( pLib )
+ {
+ Reference<XVBACompat> xVBACompat( xScriptCont, UNO_QUERY );
+ if ( xVBACompat.is() )
+ pLib->SetVBAEnabled( xVBACompat->getVBACompatModeOn() );
+ }
}
else
{
- ::rtl::OUString aMod;
- Event.Element >>= aMod;
StarBASIC* pLib = mpMgr->GetLib( maLibName );
DBG_ASSERT( pLib, "BasMgrContainerListenerImpl::elementInserted: Unknown lib!");
@@ -283,7 +300,16 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent
SbModule* pMod = pLib->FindModule( aName );
if( !pMod )
{
- pLib->MakeModule32( aName, aMod );
+ ::rtl::OUString aMod;
+ Event.Element >>= aMod;
+ Reference< XVBAModuleInfo > xVBAModuleInfo( Event.Source, UNO_QUERY );
+ if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( aName ) )
+ {
+ ModuleInfo mInfo = xVBAModuleInfo->getModuleInfo( aName );
+ pLib->MakeModule32( aName, mInfo, aMod );
+ }
+ else
+ pLib->MakeModule32( aName, aMod );
pLib->SetModified( FALSE );
}
}
@@ -312,11 +338,12 @@ void SAL_CALL BasMgrContainerListenerImpl::elementReplaced( const ContainerEvent
SbModule* pMod = pLib->FindModule( aName );
::rtl::OUString aMod;
Event.Element >>= aMod;
+
if( pMod )
- pMod->SetSource32( aMod );
+ pMod->SetSource32( aMod );
else
- pLib->MakeModule32( aName, aMod );
-
+ pLib->MakeModule32( aName, aMod );
+
pLib->SetModified( FALSE );
}
}