ooo-build r14298 - trunk/patches/vba
- From: noelpwer svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r14298 - trunk/patches/vba
- Date: Mon, 13 Oct 2008 12:13:53 +0000 (UTC)
Author: noelpwer
Date: Mon Oct 13 12:13:53 2008
New Revision: 14298
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14298&view=rev
Log:
snapshot #1
Modified:
trunk/patches/vba/vbainfo-import-export-support.diff
Modified: trunk/patches/vba/vbainfo-import-export-support.diff
==============================================================================
--- trunk/patches/vba/vbainfo-import-export-support.diff (original)
+++ trunk/patches/vba/vbainfo-import-export-support.diff Mon Oct 13 12:13:53 2008
@@ -1,3 +1,233 @@
+diff --git basctl/source/basicide/baside3.cxx basctl/source/basicide/baside3.cxx
+index 8d11a16..a0e9f1b 100644
+--- basctl/source/basicide/baside3.cxx
++++ basctl/source/basicide/baside3.cxx
+@@ -82,7 +82,7 @@
+ #include <com/sun/star/resource/XStringResourceResolver.hpp>
+ #include <com/sun/star/resource/StringResourceWithLocation.hpp>
+ #include <com/sun/star/task/XInteractionHandler.hpp>
+-#include <com/sun/star/script/XVBACompat.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
+
+ using namespace comphelper;
+ using namespace ::com::sun::star;
+@@ -118,10 +118,19 @@ DialogWindow::DialogWindow( Window* pPar
+ // set vba mode on DialogModel ( allows it to work in 100thmm instead of MAP_APPFONT )
+ if ( rDocument.getDocument().is() )
+ {
+- uno::Reference< script::XVBACompat > xDocVBAMode( rDocument.getLibraryContainer( E_SCRIPTS ), uno::UNO_QUERY );
+- uno::Reference< script::XVBACompat > xDialogModelVBAMode( xDialogModel, uno::UNO_QUERY );
+- if ( xDocVBAMode.is() && xDialogModelVBAMode.is() )
+- xDialogModelVBAMode->setVBACompatModeOn( xDocVBAMode->getVBACompatModeOn() );
++ uno::Reference< script::XBasicLibraryInfo > xLibInfo( rDocument.getLibraryContainer( E_SCRIPTS ), uno::UNO_QUERY );
++ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
++ {
++ try
++ {
++ Reference< beans::XPropertySet > xDlgProps( xDialogModel, UNO_QUERY_THROW );
++ xDlgProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ), makeAny( sal_True ) );
++ }
++ catch( Exception& )
++ {
++ }
++
++ }
+ }
+ pEditor->SetDialog( xDialogModel );
+
+diff --git basctl/source/basicide/basides2.cxx basctl/source/basicide/basides2.cxx
+index 981de5b..3956971 100644
+--- basctl/source/basicide/basides2.cxx
++++ basctl/source/basicide/basides2.cxx
+@@ -55,7 +55,7 @@
+ #include <tools/diagnose_ex.h>
+ #include <sfx2/sfxdefs.hxx>
+ #include <sfx2/signaturestate.hxx>
+-#include <com/sun/star/script/ModuleInfo.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
+ #include <com/sun/star/container/XNameContainer.hpp>
+ #include <com/sun/star/container/XNamed.hpp>
+ #include <com/sun/star/lang/XServiceInfo.hpp>
+@@ -66,15 +66,14 @@ namespace css = ::com::sun::star;
+
+ void lcl_getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName )
+ {
+- uno::Any aElement( rLib->getByName( rModName ) );
+- script::ModuleInfo aModuleInfo;
+- if( aElement >>= aModuleInfo )
++ Reference< script::XBasicLibraryInfo > xLibInfo( rLib, UNO_QUERY );
++ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
+ {
+- uno::Any aObject( aModuleInfo.ModuleObject );
+- uno::Reference< lang::XServiceInfo > xServiceInfo( aObject, uno::UNO_QUERY );
++ script::ModuleInfo aModuleInfo = xLibInfo->getModuleInfo( rModName );
++ uno::Reference< lang::XServiceInfo > xServiceInfo( aModuleInfo.ModuleObject, uno::UNO_QUERY );
+ if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
+ {
+- uno::Reference< container::XNamed > xNamed( aObject, uno::UNO_QUERY );
++ uno::Reference< container::XNamed > xNamed( aModuleInfo.ModuleObject, uno::UNO_QUERY );
+ if( xNamed.is() )
+ rObjName = xNamed->getName();
+ }
+diff --git basctl/source/basicide/bastype2.cxx basctl/source/basicide/bastype2.cxx
+index faa53e3..94a981c 100644
+--- basctl/source/basicide/bastype2.cxx
++++ basctl/source/basicide/bastype2.cxx
+@@ -55,7 +55,7 @@
+ #include <comphelper/componentcontext.hxx>
+ #include <map>
+ #include <com/sun/star/script/ModuleType.hpp>
+-#include <com/sun/star/script/ModuleInfo.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
+ #include <com/sun/star/container/XNameContainer.hpp>
+
+ using namespace ::com::sun::star::uno;
+@@ -66,10 +66,12 @@ void lcl_getObjectName( const uno::Refer
+ sal_Int32 lcl_getModuleType( const uno::Reference< container::XNameContainer >& rLib, const String& rModName )
+ {
+ sal_Int32 nType = com::sun::star::script::ModuleType::Unknown;
+- uno::Any aElement( rLib->getByName( rModName ) );
+- script::ModuleInfo aModuleInfo;
+- if( aElement >>= aModuleInfo )
++ Reference< script::XBasicLibraryInfo > xLibInfo( rLib, UNO_QUERY );
++ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
++ {
++ script::ModuleInfo aModuleInfo = xLibInfo->getModuleInfo( rModName );
+ nType = aModuleInfo.ModuleType;
++ }
+ return nType;
+ }
+
+diff --git basctl/source/basicide/scriptdocument.cxx basctl/source/basicide/scriptdocument.cxx
+index 7e48d82..0d867b8 100644
+--- basctl/source/basicide/scriptdocument.cxx
++++ basctl/source/basicide/scriptdocument.cxx
+@@ -56,7 +56,7 @@
+ #include <com/sun/star/frame/XModel2.hpp>
+ #include <com/sun/star/awt/XWindow2.hpp>
+ #include <com/sun/star/document/XEmbeddedScripts.hpp>
+-#include <com/sun/star/script/ModuleInfo.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
+ /** === end UNO includes === **/
+
+ #include <sfx2/objsh.hxx>
+@@ -144,6 +144,7 @@ namespace basctl
+ using ::com::sun::star::document::XEventBroadcaster;
+ using ::com::sun::star::document::XEmbeddedScripts;
+ using ::com::sun::star::script::ModuleInfo;
++ using ::com::sun::star::script::XBasicLibraryInfo;
+ /** === end UNO using === **/
+ namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
+ namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag;
+@@ -639,7 +640,10 @@ namespace basctl
+ try
+ {
+ Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, TRUE ), UNO_QUERY_THROW );
+-
++ Reference< XBasicLibraryInfo > xLibInfo( xLib, UNO_QUERY );
++ ModuleInfo sModuleInfo = xLibInfo->getModuleInfo( _rOldName );
++ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
++ sModuleInfo = xLibInfo->getModuleInfo( _rOldName ); // grap old module info
+ // get element
+ Any aElement( xLib->getByName( _rOldName ) );
+
+@@ -678,10 +682,12 @@ namespace basctl
+ // insert element by new name in container
+ if ( _eType == E_SCRIPTS )
+ {
+- ModuleInfo sModuleInfo;
+- if ( aElement >>= sModuleInfo )
++ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
+ {
++ rtl::OUString aMod;
++ aElement >>= aMod; // grab the source
+ sModuleInfo.ModuleName = _rNewName;
++ sModuleInfo.ModuleSource = aMod;
+ aElement <<= sModuleInfo;
+ }
+ }
+@@ -749,15 +755,9 @@ namespace basctl
+ Reference< XNameContainer > xLib( getOrCreateLibrary( E_SCRIPTS, _rLibName ), UNO_QUERY_THROW );
+ if ( !xLib->hasByName( _rModName ) )
+ return false;
+- ModuleInfo mInfo;
+ Any aMod;
+- if ( xLib->getByName( _rModName ) >>= mInfo )
+- {
+- mInfo.ModuleSource = _rModuleCode;
+- aMod <<= mInfo;
+- }
+- else
+- aMod <<= _rModuleCode;
++ aMod <<= _rModuleCode;
++OSL_TRACE("**** about to do a replace by name %s size of source %d", rtl::OUStringToOString( _rModName, RTL_TEXTENCODING_UTF8 ).getStr(), _rModuleCode.getLength() );
+ xLib->replaceByName( _rModName, aMod );
+ return true;
+ }
+@@ -1411,15 +1411,7 @@ namespace basctl
+ Any aCode;
+ if ( !m_pImpl->getModuleOrDialog( E_SCRIPTS, _rLibName, _rModName, aCode ) )
+ return false;
+- ModuleInfo sModuleInfo;
+- if ( aCode >>= sModuleInfo )
+- {
+- _out_rModuleSource = sModuleInfo.ModuleSource;
+- }
+- else
+- {
+- OSL_VERIFY( aCode >>= _out_rModuleSource );
+- }
++ OSL_VERIFY( aCode >>= _out_rModuleSource );
+ return true;
+ }
+
+diff --git basctl/source/dlged/dlgedobj.cxx basctl/source/dlged/dlgedobj.cxx
+index 9a521a3..ae7df5c 100644
+--- basctl/source/dlged/dlgedobj.cxx
++++ basctl/source/dlged/dlgedobj.cxx
+@@ -56,7 +56,7 @@
+ #include <com/sun/star/beans/XPropertySet.hpp>
+ #include <com/sun/star/beans/PropertyAttribute.hpp>
+ #include <com/sun/star/script/XScriptEventsSupplier.hpp>
+-#include <com/sun/star/script/XVBACompat.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
+ #include <com/sun/star/container/XContainer.hpp>
+ #include <com/sun/star/lang/XServiceInfo.hpp>
+ #include <comphelper/processfactory.hxx>
+@@ -81,9 +81,17 @@ DBG_NAME(DlgEdObj);
+ MapMode lcl_getMapModeForForm( DlgEdForm* pForm )
+ {
+ MapMode aMode( MAP_APPFONT ); //Default
+- uno::Reference< script::XVBACompat > xVBA( pForm ? pForm->GetUnoControlModel() : NULL, uno::UNO_QUERY );
+- if ( xVBA.is() && xVBA->getVBACompatModeOn() )
+- aMode = MapMode( MAP_100TH_MM );
++ try
++ {
++ uno::Reference< beans::XPropertySet > xProps( pForm ? pForm->GetUnoControlModel() : NULL, uno::UNO_QUERY_THROW );
++ sal_Bool bVBAForm = sal_False;
++ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBAForm;
++ if ( bVBAForm )
++ aMode = MapMode( MAP_100TH_MM );
++ }
++ catch ( Exception& )
++ {
++ }
+ return aMode;
+ }
+
+diff --git basctl/source/inc/dlged.hxx basctl/source/inc/dlged.hxx
+index 3db132a..2561fc3 100644
+--- basctl/source/inc/dlged.hxx
++++ basctl/source/inc/dlged.hxx
+@@ -136,7 +136,7 @@ protected:
+ public:
+ DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
+ ~DlgEditor();
+-
++ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getDocModel() { return m_xDocument; }
+ void SetWindow( Window* pWindow );
+ Window* GetWindow() const { return pWindow; }
+
diff --git basic/inc/basic/basmgr.hxx basic/inc/basic/basmgr.hxx
index 2674c59..3c4f364 100644
--- basic/inc/basic/basmgr.hxx
@@ -24,37 +254,143 @@
};
diff --git basic/source/basmgr/basmgr.cxx basic/source/basmgr/basmgr.cxx
-index 1c8962c..0a4ca77 100644
+index 1c8962c..f595e39 100644
--- basic/source/basmgr/basmgr.cxx
+++ basic/source/basmgr/basmgr.cxx
-@@ -61,6 +61,7 @@
+@@ -70,7 +70,7 @@
+ #include <com/sun/star/script/XLibraryContainerPassword.hpp>
+ #include <com/sun/star/script/ModuleInfo.hpp>
+ #include <com/sun/star/script/ModuleType.hpp>
+-
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
+ #include <cppuhelper/implbase1.hxx>
- // Library API, implemented for XML import/export
+ using com::sun::star::uno::Reference;
+@@ -239,6 +239,12 @@ void BasMgrContainerListenerImpl::addLib
-+#include <com/sun/star/script/XVBACompat.hpp>
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/container/XContainer.hpp>
- #include <com/sun/star/script/XStarBasicAccess.hpp>
-@@ -291,6 +292,12 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent
+ StarBASIC* pLib = pMgr->GetLib( aLibName );
+ DBG_ASSERT( pLib, "BasMgrContainerListenerImpl::addLibraryModulesImpl: Unknown lib!");
++ Reference< XBasicLibraryInfo > xLibInfo( xLibNameAccess, UNO_QUERY );
++ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
++ pLib->SetVBAEnabled( true );
++
++ OSL_TRACE("addLibraryModulesImpl libname %s, xLibInfo %d", rtl::OUStringToOString( aLibName, RTL_TEXTENCODING_UTF8 ).getStr(), xLibInfo.is() );
++
+ if( pLib )
{
- Reference< XLibraryContainer > xScriptCont( Event.Source, UNO_QUERY );
- insertLibraryImpl( xScriptCont, mpMgr, Event.Element, aName );
-+ Reference< XVBACompat > xCompat( xScriptCont, UNO_QUERY );
-+ if ( xCompat.is() )
-+ {
-+ StarBASIC* pLib = mpMgr->GetLib( aName );
-+ pLib->SetVBAEnabled( xCompat->getVBACompatModeOn() );
-+ }
- }
- else
+ const ::rtl::OUString* pNames = aModuleNames.getConstArray();
+@@ -246,16 +252,18 @@ void BasMgrContainerListenerImpl::addLib
+ {
+ ::rtl::OUString aModuleName = pNames[ j ];
+ Any aElement = xLibNameAccess->getByName( aModuleName );
+- ModuleInfo mInfo;
+- if ( aElement >>= mInfo )
+- {
+- OSL_TRACE("#addLibraryModulesImpl - aMod");
++ ::rtl::OUString aMod;
++ aElement >>= aMod;
++
++ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
++ {
++ ModuleInfo mInfo = xLibInfo->getModuleInfo( pNames[ j ] );
++ mInfo.ModuleSource = aMod;
++ OSL_TRACE("#addLibraryModulesImpl - aMod - source size is %d", mInfo.ModuleSource.getLength());
+ pLib->MakeModule32( mInfo );
+ }
+ else
+ {
+- ::rtl::OUString aMod;
+- aElement >>= aMod;
+ pLib->MakeModule32( aModuleName, aMod );
+ }
+ }
+@@ -284,8 +292,10 @@ void SAL_CALL BasMgrContainerListenerImp
+ sal_Bool bLibContainer = ( maLibName.getLength() == 0 );
+ ::rtl::OUString aName;
+ Event.Accessor >>= aName;
++ OSL_TRACE("ElementInserted %s ", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr() );
+
+ mpMgr->mpImpl->mbModifiedByLibraryContainer = sal_True;
++ Reference< XBasicLibraryInfo > xLibInfo( Event.Source, UNO_QUERY );
+
+ if( bLibContainer )
+ {
+@@ -302,11 +312,11 @@ void SAL_CALL BasMgrContainerListenerImp
+ SbModule* pMod = pLib->FindModule( aName );
+ if( !pMod )
+ {
+- ModuleInfo mInfo;
+- if( Event.Element >>= mInfo )
++ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
+ {
++ ModuleInfo mInfo = xLibInfo->getModuleInfo( aName );
+ pLib->MakeModule32( mInfo );
+- }
++ }
+ else
+ {
+ ::rtl::OUString aMod;
+@@ -327,6 +337,7 @@ void SAL_CALL BasMgrContainerListenerImp
+ ::rtl::OUString aName;
+ Event.Accessor >>= aName;
+
++ OSL_TRACE("ElementReplaced for Librarylelement %s ", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ mpMgr->mpImpl->mbModifiedByLibraryContainer = sal_True;
+
+ // Replace not possible for library container
+@@ -339,33 +350,24 @@ void SAL_CALL BasMgrContainerListenerImp
+
+ if( pLib )
{
-@@ -831,6 +838,12 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo )
+- SbModule* pMod = pLib->FindModule( aName );
++ SbModule* pMod = pLib->FindModule( aName );
+ ::rtl::OUString aMod;
+- ModuleInfo mInfo;
+- if( Event.Element >>= mInfo )
+- aMod = mInfo.ModuleSource;
+- else
+- Event.Element >>= aMod;
++ Event.Element >>= aMod;
+ if( pMod )
+- {
+ pMod->SetSource32( aMod );
+- if ( mInfo.ModuleType == ModuleType::Document )
++ else
++ {
++
++ Reference< XBasicLibraryInfo > xLibInfo( Event.Source, UNO_QUERY );
++ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
+ {
+- SbObjModule* pObjModule = dynamic_cast< SbObjModule* >( pMod );
+- if ( pObjModule )
+- pObjModule->SetUnoObject( makeAny( mInfo.ModuleObject ) );
++ ModuleInfo mInfo = xLibInfo->getModuleInfo( aName );
++ mInfo.ModuleSource = aMod;
++ pLib->MakeModule32( mInfo );
+ }
+- }
+- else
+- // Probably we should have an assert for
+- // unknow module type, e.g. either we are using
+- // the ModuleInfo structure ( vba ) for *all* modules
+- // or not ( normal )
+- if ( mInfo.ModuleType == ModuleType::Unknown )
+- pLib->MakeModule32( aName, aMod );
+ else
+- pLib->MakeModule32( mInfo );
+-
++ pLib->MakeModule32( aName, aMod );
++ }
+ pLib->SetModified( FALSE );
+ }
+ }
+@@ -831,6 +833,12 @@ void BasicManager::SetLibraryContainerIn
Reference< XLibraryContainer > xScriptCont( mpImpl->maContainerInfo.mxScriptCont.get() );
StarBASIC* pStdLib = GetStdLib();
-+ Reference< XVBACompat > xCompat( GetScriptLibraryContainer(), UNO_QUERY );
-+ if ( xCompat.is() )
-+ mpImpl->maContainerInfo.mbVBACompatOn = xCompat->getVBACompatModeOn();
++ Reference< XBasicLibraryInfo > xLibInfo( GetScriptLibraryContainer(), UNO_QUERY );
++ if ( xLibInfo.is() )
++ mpImpl->maContainerInfo.mbVBACompatOn = xLibInfo->getVBACompatMode();
+ // Std is created regardless of any persisted Libraries, so.. we need
+ // to make sure we set its compat mode here
+ pStdLib->SetVBAEnabled( mpImpl->maContainerInfo.mbVBACompatOn );
@@ -62,10 +398,34 @@
if( xScriptCont.is() )
{
diff --git basic/source/inc/namecont.hxx basic/source/inc/namecont.hxx
-index c099b01..7a99f86 100644
+index c099b01..b1c8409 100644
--- basic/source/inc/namecont.hxx
+++ basic/source/inc/namecont.hxx
-@@ -113,6 +113,11 @@ NameContainerNameMap;
+@@ -65,21 +65,20 @@
+ #include <cppuhelper/compbase7.hxx>
+ #include <cppuhelper/compbase8.hxx>
+ #include <cppuhelper/interfacecontainer.hxx>
+-#include <com/sun/star/script/XVBACompat.hpp>
++#include <com/sun/star/script/ModuleInfo.hpp>
+
+ class BasicManager;
+
+ namespace basic
+ {
+
+-typedef ::cppu::WeakComponentImplHelper8<
++typedef ::cppu::WeakComponentImplHelper7<
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::script::XStorageBasedLibraryContainer,
+ ::com::sun::star::script::XLibraryContainerPassword,
+ ::com::sun::star::script::XLibraryContainerExport,
+ ::com::sun::star::container::XContainer,
+ ::com::sun::star::script::XLibraryQueryExecutable,
+- ::com::sun::star::script::XVBACompat,
+ ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
+
+ typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
+@@ -113,6 +112,11 @@ NameContainerNameMap;
//============================================================================
@@ -77,7 +437,7 @@
class NameContainer : public ::cppu::BaseMutex, public NameContainerHelper
{
-@@ -136,7 +141,7 @@ public:
+@@ -136,7 +140,7 @@ public:
void setEventSource( ::com::sun::star::uno::XInterface* pxEventSource )
{ mpxEventSource = pxEventSource; }
@@ -86,7 +446,16 @@
// Methods XElementAccess
virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
throw(::com::sun::star::uno::RuntimeException);
-@@ -251,7 +256,7 @@ protected:
+@@ -222,6 +226,8 @@ public:
+ }
+ };
+
++typedef std::hash_map< rtl::OUString, com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameToInfoHash;
++
+ class SfxLibraryContainer :public LibraryContainerHelper
+ ,public ::utl::OEventListenerAdapter
+ {
+@@ -251,7 +257,7 @@ protected:
sal_Bool mbOwnBasMgr;
InitMode meInitMode;
@@ -95,7 +464,7 @@
void implStoreLibrary( SfxLibrary* pLib,
const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
-@@ -334,7 +339,7 @@ protected:
+@@ -334,7 +340,7 @@ protected:
virtual const sal_Char* SAL_CALL getOldInfoFileName() const = 0;
virtual const sal_Char* SAL_CALL getLibElementFileExtension() const = 0;
virtual const sal_Char* SAL_CALL getLibrariesDir() const = 0;
@@ -104,14 +473,26 @@
// Handle maLibInfoFileURL and maStorageURL correctly
void checkStorageURL
(
-@@ -567,6 +572,7 @@ private:
- sal_Bool mbSharedIndexFile;
- sal_Bool mbExtension;
+@@ -503,9 +509,6 @@ public:
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException) = 0;
+
+- // Methods XVBACompat
+- virtual ::sal_Bool SAL_CALL getVBACompatModeOn() throw (::com::sun::star::uno::RuntimeException);
+- virtual void SAL_CALL setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+ class LibraryContainerMethodGuard
+@@ -581,6 +584,9 @@ protected:
+ inline sal_Bool implIsModified() const { return mbIsModified; }
+ void implSetModified( sal_Bool _bIsModified );
+ ::xmlscript::ObjectModuleDescHash mhCodeNameToObjDesc;
- // Additional functionality for localisation
- // Provide modify state including resources
- virtual sal_Bool isModified( void ) = 0;
++ NameToInfoHash hBasicInfo;
++
+ private:
+ /** checks whether the lib is readonly, or a readonly link, throws an IllegalArgumentException if so
+ */
@@ -660,6 +666,7 @@ public:
virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
::com::sun::star::container::XContainerListener >& xListener )
@@ -121,10 +502,20 @@
protected:
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0;
diff --git basic/source/inc/scriptcont.hxx basic/source/inc/scriptcont.hxx
-index 1679b30..b9d3415 100644
+index 1679b30..4f220bb 100644
--- basic/source/inc/scriptcont.hxx
+++ basic/source/inc/scriptcont.hxx
-@@ -97,6 +97,7 @@ class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPas
+@@ -33,6 +33,9 @@
+
+ #include "namecont.hxx"
+ #include <basic/basmgr.hxx>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
++#include <cppuhelper/implbase1.hxx>
++#include <comphelper/uno3.hxx>
+
+ class BasicManager;
+
+@@ -97,6 +100,7 @@ class SfxScriptLibraryContainer : public
virtual const sal_Char* SAL_CALL getOldInfoFileName() const;
virtual const sal_Char* SAL_CALL getLibElementFileExtension() const;
virtual const sal_Char* SAL_CALL getLibrariesDir() const;
@@ -132,24 +523,62 @@
public:
SfxScriptLibraryContainer( void );
-@@ -161,7 +162,7 @@ public:
- (
- ModifiableHelper& _rModifiable,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
-- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI, bool bVBACompat
- );
+@@ -140,12 +144,17 @@ public:
+
+ //============================================================================
+
++typedef std::hash_map< rtl::OUString, com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameToInfoHash;
++
++typedef ::cppu::ImplHelper1 < ::com::sun::star::script::XBasicLibraryInfo > SfxScriptLibrary_BASE;
+ class SfxScriptLibrary : public SfxLibrary
++ , public SfxScriptLibrary_BASE
+ {
+ friend class SfxScriptLibraryContainer;
- SfxScriptLibrary
-@@ -169,7 +170,7 @@ public:
- ModifiableHelper& _rModifiable,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
+ sal_Bool mbLoadedSource;
+ sal_Bool mbLoadedBinary;
++ sal_Bool mbVBA;
+
+ // Provide modify state including resources
+ virtual sal_Bool isModified( void );
+@@ -171,9 +180,36 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
-- const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly
-+ const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly, bool bVBACOmpat
+ const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly
);
-
+-
++ // XNameReplace
++ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
++ throw(::com::sun::star::lang::IllegalArgumentException,
++ ::com::sun::star::container::NoSuchElementException,
++ ::com::sun::star::lang::WrappedTargetException,
++ ::com::sun::star::uno::RuntimeException);
++
++ // Methods XNameContainer
++ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
++ throw(::com::sun::star::lang::IllegalArgumentException,
++ ::com::sun::star::container::ElementExistException,
++ ::com::sun::star::lang::WrappedTargetException,
++ ::com::sun::star::uno::RuntimeException);
++ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
++ throw(::com::sun::star::container::NoSuchElementException,
++ ::com::sun::star::lang::WrappedTargetException,
++ ::com::sun::star::uno::RuntimeException);
static bool containsValidModule( const ::com::sun::star::uno::Any& _rElement );
++ DECLARE_XINTERFACE()
++ DECLARE_XTYPEPROVIDER()
++
++ // XBasicLibraryInfo
+
++ // Attributes
++ virtual ::sal_Bool SAL_CALL getVBACompatMode() throw (::com::sun::star::uno::RuntimeException);
++ virtual void SAL_CALL setVBACompatMode( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
++
++ // Methods
++ virtual ::com::sun::star::script::ModuleInfo SAL_CALL getModuleInfo( const ::rtl::OUString& ModuleName ) throw (::com::sun::star::uno::RuntimeException);
++
+ protected:
+ virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
+ };
diff --git basic/source/runtime/step2.cxx basic/source/runtime/step2.cxx
index 1f659e1..7382974 100644
--- basic/source/runtime/step2.cxx
@@ -162,7 +591,7 @@
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/script/XDefaultMethod.hpp>
-@@ -708,7 +709,6 @@ void SbiRuntime::StepELEM( UINT32 nOp1, UINT32 nOp2 )
+@@ -708,7 +709,6 @@ void SbiRuntime::StepELEM( UINT32 nOp1,
// #74254 Jetzt per Liste
if( pObj )
SaveRef( (SbxVariable*)pObj );
@@ -171,18 +600,25 @@
}
diff --git basic/source/uno/namecont.cxx basic/source/uno/namecont.cxx
-index ac96039..52efd0c 100644
+index ac96039..1941b88 100644
--- basic/source/uno/namecont.cxx
+++ basic/source/uno/namecont.cxx
-@@ -75,6 +75,7 @@
+@@ -75,11 +75,11 @@
#endif
#include <cppuhelper/exc_hlp.hxx>
#include <basic/sbmod.hxx>
+#include "sbunoobj.hxx"
- #ifndef _COM_SUN_STAR_SCRIPT_MODULEINFO_HPP_
+-#ifndef _COM_SUN_STAR_SCRIPT_MODULEINFO_HPP_
#include <com/sun/star/script/ModuleInfo.hpp>
-@@ -104,12 +105,85 @@ using namespace osl;
+-#endif
+-
++// temp include
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
+ namespace basic
+ {
+
+@@ -104,12 +104,85 @@ using namespace osl;
using com::sun::star::uno::Reference;
@@ -268,7 +704,7 @@
// Methods XElementAccess
Type NameContainer::getElementType()
throw(RuntimeException)
-@@ -158,7 +232,7 @@ void NameContainer::replaceByName( const OUString& aName, const Any& aElement )
+@@ -158,7 +231,7 @@ void NameContainer::replaceByName( const
throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
{
Type aAnyType = aElement.getValueType();
@@ -277,7 +713,7 @@
throw IllegalArgumentException();
NameContainerNameMap::iterator aIt = mHashMap.find( aName );
-@@ -200,7 +274,7 @@ void NameContainer::insertByName( const OUString& aName, const Any& aElement )
+@@ -200,7 +273,7 @@ void NameContainer::insertByName( const
throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
Type aAnyType = aElement.getValueType();
@@ -286,7 +722,7 @@
throw IllegalArgumentException();
NameContainerNameMap::iterator aIt = mHashMap.find( aName );
-@@ -339,6 +413,7 @@ SfxLibraryContainer::SfxLibraryContainer( void )
+@@ -339,6 +412,7 @@ SfxLibraryContainer::SfxLibraryContainer
, mbOasis2OOoFormat( sal_False )
, mpBasMgr( NULL )
, mbOwnBasMgr( sal_False )
@@ -294,7 +730,7 @@
{
DBG_CTOR( SfxLibraryContainer, NULL );
-@@ -798,11 +873,23 @@ sal_Bool SfxLibraryContainer::init_Impl(
+@@ -798,12 +872,10 @@ sal_Bool SfxLibraryContainer::init_Impl(
OSL_ENSURE( 0, OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
return sal_False;
}
@@ -303,6 +739,14 @@
for( sal_Int32 i = 0 ; i < nLibCount ; i++ )
{
::xmlscript::LibDescriptor& rLib = pLibArray->mpLibs[i];
+-
+ // Check storage URL
+ OUString aStorageURL = rLib.aStorageURL;
+ if( !bStorage && !aStorageURL.getLength() && nPass == 0 )
+@@ -860,6 +932,23 @@ sal_Bool SfxLibraryContainer::init_Impl(
+ else
+ {
+ Reference< XNameContainer > xLib = createLibrary( aLibName );
+ // mbVBACompatMode needs to be setup before createLibrary is called
+ // ( and this is called before the library desc. is read )
+ // this implies we need an xml property at the script-lc.xml
@@ -313,13 +757,17 @@
+ OSL_TRACE("*** iteration %d have got Standard Library**** VBA MODE is %d", i, rLib.bVBAMode );
+ // can't use the api here ( because setVBACompat will try to
+ // convert the Libraries )
-+ //SfxLibraryContainer::setVBACompatModeOn( rLib.bVBAMode );
-+ mbVBACompatModeOn = rLib.bVBAMode;
++ Reference< XBasicLibraryInfo > xLibInfo( xLib, UNO_QUERY );
++ if ( xLibInfo.is() )
++ xLibInfo->setVBACompatMode( rLib.bVBAMode );
++
+ }
-
- // Check storage URL
- OUString aStorageURL = rLib.aStorageURL;
-@@ -897,7 +984,9 @@ sal_Bool SfxLibraryContainer::init_Impl(
++
++
+ pImplLib = static_cast< SfxLibrary* >( xLib.get() );
+ pImplLib->mbLoaded = sal_False;
+ pImplLib->mbReadOnly = rLib.bReadOnly;
+@@ -897,7 +986,9 @@ sal_Bool SfxLibraryContainer::init_Impl(
if( !pImplLib->mbInitialised && (!bStorage || xLibraryStor.is()) )
{
OUString aIndexFileName;
@@ -329,7 +777,7 @@
if( bLoaded && aLibName != rLib.aName )
{
OSL_ENSURE( 0, "Different library names in library"
-@@ -1135,6 +1224,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
+@@ -1135,6 +1226,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
Reference< XNameContainer > xLib = createLibrary( aLibName );
SfxLibrary* pNewLib = static_cast< SfxLibrary* >( xLib.get() );
pNewLib->mbLoaded = false;
@@ -337,20 +785,22 @@
pNewLib->implSetModified( sal_False );
checkStorageURL( aLibFolder, pNewLib->maLibInfoFileURL,
pNewLib->maStorageURL, pNewLib->maUnexpandedStorageURL );
-@@ -1724,21 +1814,60 @@ void SfxLibraryContainer::implImportLibDescriptor
+@@ -1724,21 +1816,59 @@ void SfxLibraryContainer::implImportLibD
{
sal_Int32 nElementCount = rLib.aElementNames.getLength();
const OUString* pElementNames = rLib.aElementNames.getConstArray();
- Any aDummyElement = createEmptyLibraryElement();
-+ Any aDummyElement;
-+ ::xmlscript::ObjectModuleDescHash::iterator it_end = rLib.hModuleTypeDesc.end();
++ Any aDummyElement = createEmptyLibraryElement();
++ ::xmlscript::ObjectModuleDescHash::iterator it_end = rLib.hModuleTypeDesc.end();
++ Reference< XNameContainer > xLib( pLib );
++ Reference< XBasicLibraryInfo > xLibInfo( xLib, UNO_QUERY );
for( sal_Int32 i = 0 ; i < nElementCount ; i++ )
{
-+ if ( getVBACompatModeOn() )
++ com::sun::star::script::ModuleInfo mInfo;
++ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
+ {
+ ::xmlscript::ObjectModuleDescHash::iterator it = rLib.hModuleTypeDesc.find( pElementNames[i] );
+
-+ com::sun::star::script::ModuleInfo mInfo;
+ mInfo.ModuleType = ModuleType::Normal;
+ mInfo.ModuleName = pElementNames[i];
+ if ( it != it_end )
@@ -379,12 +829,10 @@
+
+ }
+ }
-+ aDummyElement <<= mInfo;
+ }
-+ else
-+ aDummyElement = createEmptyLibraryElement();
pLib->maNameContainer.insertByName( pElementNames[i], aDummyElement );
- }
++ pLib->hBasicInfo[ pElementNames[i] ] = mInfo;
+ }
pLib->mbPasswordProtected = rLib.bPasswordProtected;
pLib->mbReadOnly = rLib.bReadOnly;
@@ -393,7 +841,6 @@
pLib->mbInitialised = sal_True;
+ pLib->mhCodeNameToObjDesc = rLib.hModuleTypeDesc;
-+
}
}
@@ -401,7 +848,7 @@
// Methods of new XLibraryStorage interface?
void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& xStorage, sal_Bool bComplete )
{
-@@ -1851,7 +1980,18 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
+@@ -1851,7 +1981,21 @@ void SfxLibraryContainer::storeLibraries
rLib.bPreload = pImplLib->mbPreload;
rLib.bPasswordProtected = pImplLib->mbPasswordProtected;
rLib.aElementNames = pImplLib->getElementNames();
@@ -415,26 +862,60 @@
+ // so, leaving for the moment
+ if ( pName->equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) ) )
+ {
-+ rLib.bVBAMode = getVBACompatModeOn();
++ Reference< XNameContainer > xNameContainer( pImplLib );
++ Reference< XBasicLibraryInfo > xLibInfo( xNameContainer, UNO_QUERY );
++ rLib.bVBAMode = xLibInfo.is() ? xLibInfo->getVBACompatMode() : sal_False;
++
+ rLib.hModuleTypeDesc = lcl_getObjModDescHash( *pImplLib );
+ }
if( pImplLib->implIsModified() || bComplete )
{
// Can we copy the storage?
-@@ -2319,13 +2459,29 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
+@@ -2072,11 +2216,11 @@ Reference< XNameContainer > SAL_CALL Sfx
+ {
+ LibraryContainerMethodGuard aGuard( *this );
+ SfxLibrary* pNewLib = implCreateLibrary( Name );
++ Reference< XNameAccess > xNameAccess = static_cast< XNameAccess* >( pNewLib );
+ pNewLib->maLibElementFileExtension = maLibElementFileExtension;
+
+ createVariableURL( pNewLib->maUnexpandedStorageURL, Name, maInfoFileName, true );
+
+- Reference< XNameAccess > xNameAccess = static_cast< XNameAccess* >( pNewLib );
+ Any aElement;
+ aElement <<= xNameAccess;
+ maNameContainer.insertByName( Name, aElement );
+@@ -2102,6 +2246,7 @@ Reference< XNameAccess > SAL_CALL SfxLib
+
+
+ SfxLibrary* pNewLib = implCreateLibraryLink( Name, aLibInfoFileURL, aLibDirURL, ReadOnly );
++ Reference< XNameAccess > xRet = static_cast< XNameAccess* >( pNewLib );
+ pNewLib->maLibElementFileExtension = maLibElementFileExtension;
+ pNewLib->maUnexpandedStorageURL = aUnexpandedStorageURL;
+
+@@ -2111,7 +2256,6 @@ Reference< XNameAccess > SAL_CALL SfxLib
+ /*sal_Bool bReadIndexFile = */implLoadLibraryIndexFile( pNewLib, aLibDesc, xDummyStor, aInitFileName );
+ implImportLibDescriptor( pNewLib, aLibDesc );
+
+- Reference< XNameAccess > xRet = static_cast< XNameAccess* >( pNewLib );
+ Any aElement;
+ aElement <<= xRet;
+ maNameContainer.insertByName( Name, aElement );
+@@ -2319,13 +2463,33 @@ void SAL_CALL SfxLibraryContainer::loadL
}
Any aAny = importLibraryElement( aFile, xInStream );
+
-+ com::sun::star::script::ModuleInfo mInfo;
++// com::sun::star::script::ModuleInfo mInfo;
if( pImplLib->hasByName( aElementName ) )
{
++/*
+ if ( getVBACompatModeOn() )
+ {
+ pImplLib->maNameContainer.getByName( aElementName ) >>= mInfo;
+ aAny >>= mInfo.ModuleSource;
+ aAny <<= mInfo;
+ }
++*/
if( aAny.hasValue() )
+ {
pImplLib->maNameContainer.replaceByName( aElementName, aAny );
@@ -442,19 +923,23 @@
}
else
{
++/*
+ if ( getVBACompatModeOn() )
+ {
+ mInfo.ModuleType = ModuleType::Normal;
+ aAny >>= mInfo.ModuleSource;
+ aAny <<= mInfo;
+ }
++*/
pImplLib->maNameContainer.insertByName( aElementName, aAny );
}
}
-@@ -2725,31 +2881,26 @@ OUString SfxLibraryContainer::expand_url( const OUString& url )
+@@ -2723,35 +2887,6 @@ OUString SfxLibraryContainer::expand_url
+ }
+ }
- ::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatModeOn() throw (RuntimeException)
- {
+-::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatModeOn() throw (RuntimeException)
+-{
- sal_Bool bVBACompat = sal_False;
- BasicManager* pBasMgr = getBasicManager();
- if( pBasMgr )
@@ -467,11 +952,10 @@
- }
-
- return bVBACompat;
-+ return mbVBACompatModeOn;
- }
-
- void SAL_CALL SfxLibraryContainer::setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
- {
+-}
+-
+-void SAL_CALL SfxLibraryContainer::setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
+-{
- BasicManager* pBasMgr = getBasicManager();
- if( pBasMgr )
- {
@@ -481,25 +965,12 @@
- if( pBasic )
- pBasic->SetVBAEnabled( _vbacompatmodeon );
- }
-+ // will need to trigger event so that basicmanager can get it
-+ bool bNeedsConversion = ( mbVBACompatModeOn != _vbacompatmodeon );
-+ mbVBACompatModeOn = ( _vbacompatmodeon == sal_True );
-+ // for Dialogs 'convertLibraryEntries' does nothing ( for now )
-+ // for Scripts the Library's NameContainer needs to be converted as follows
-+ // When vba mode is turned off
-+ // Userform and Document modules need to be deleted
-+ // String -> Any( ModuleInfo ) to
-+ // String -> Any( String )
-+ // When vba mode is turned on
-+ // String -> Any( String ) to
-+ // String -> Any( ModuleInfo )
-+ // Userform and Document modules need to be created
-+ if ( bNeedsConversion )
-+ convertLibraryEntries(); // for Dialogs this does nothing ( for now )
- }
-
+-}
+-
// Methods XServiceInfo
-@@ -2765,6 +2916,12 @@ void SAL_CALL SfxLibraryContainer::setVBACompatModeOn( ::sal_Bool _vbacompatmode
+ ::sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const ::rtl::OUString& _rServiceName )
+ throw (RuntimeException)
+@@ -2765,6 +2900,12 @@ void SAL_CALL SfxLibraryContainer::setVB
return sal_False;
}
@@ -533,28 +1004,10 @@
}
}
diff --git basic/source/uno/scriptcont.cxx basic/source/uno/scriptcont.cxx
-index 4a46e98..1a84f9f 100644
+index 4a46e98..9a45db6 100644
--- basic/source/uno/scriptcont.cxx
+++ basic/source/uno/scriptcont.cxx
-@@ -157,7 +157,7 @@ SfxScriptLibraryContainer::SfxScriptLibraryContainer( const uno::Reference< embe
- SfxLibrary* SfxScriptLibraryContainer::implCreateLibrary( const OUString& aName )
- {
- (void)aName; // Only needed for SfxDialogLibrary
-- SfxLibrary* pRet = new SfxScriptLibrary( maModifiable, mxMSF, mxSFI );
-+ SfxLibrary* pRet = new SfxScriptLibrary( maModifiable, mxMSF, mxSFI, getVBACompatModeOn() );
- return pRet;
- }
-
-@@ -168,7 +168,7 @@ SfxLibrary* SfxScriptLibraryContainer::implCreateLibraryLink
- (void)aName; // Only needed for SfxDialogLibrary
- SfxLibrary* pRet =
- new SfxScriptLibrary
-- ( maModifiable, mxMSF, mxSFI, aLibInfoFileURL, StorageURL, ReadOnly );
-+ ( maModifiable, mxMSF, mxSFI, aLibInfoFileURL, StorageURL, ReadOnly, getVBACompatModeOn() );
- return pRet;
- }
-
-@@ -1068,6 +1068,11 @@ SfxScriptLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library )
+@@ -1068,6 +1068,11 @@ SfxScriptLibraryContainer:: HasExecutabl
//============================================================================
// Service
@@ -566,39 +1019,111 @@
void createRegistryInfo_SfxScriptLibraryContainer()
{
static OAutoRegistration< SfxScriptLibraryContainer > aAutoRegistration;
-@@ -1121,8 +1126,8 @@ Reference< XInterface > SAL_CALL SfxScriptLibraryContainer::Create
- // Ctor
- SfxScriptLibrary::SfxScriptLibrary( ModifiableHelper& _rModifiable,
- const Reference< XMultiServiceFactory >& xMSF,
-- const Reference< XSimpleFileAccess >& xSFI )
-- : SfxLibrary( _rModifiable, getCppuType( (const OUString *)0 ), xMSF, xSFI )
-+ const Reference< XSimpleFileAccess >& xSFI, bool bVBA )
-+ : SfxLibrary( _rModifiable, bVBA ? getCppuType( ( const script::ModuleInfo*)0 ) : getCppuType( (const OUString *)0 ), xMSF, xSFI )
+@@ -1125,6 +1130,7 @@ SfxScriptLibrary::SfxScriptLibrary( Modi
+ : SfxLibrary( _rModifiable, getCppuType( (const OUString *)0 ), xMSF, xSFI )
, mbLoadedSource( sal_False )
, mbLoadedBinary( sal_False )
++ , mbVBA( sal_False )
{
-@@ -1133,8 +1138,8 @@ SfxScriptLibrary::SfxScriptLibrary( ModifiableHelper& _rModifiable,
- const Reference< XSimpleFileAccess >& xSFI,
- const OUString& aLibInfoFileURL,
- const OUString& aStorageURL,
-- sal_Bool ReadOnly )
-- : SfxLibrary( _rModifiable, getCppuType( (const OUString *)0 ), xMSF, xSFI,
-+ sal_Bool ReadOnly, bool bVBA )
-+ : SfxLibrary( _rModifiable, bVBA ? getCppuType( ( const script::ModuleInfo*)0 ) : getCppuType( (const OUString *)0 ), xMSF, xSFI,
+ }
+
+@@ -1138,9 +1144,85 @@ SfxScriptLibrary::SfxScriptLibrary( Modi
aLibInfoFileURL, aStorageURL, ReadOnly)
, mbLoadedSource( sal_False )
, mbLoadedBinary( sal_False )
-@@ -1188,7 +1193,193 @@ bool SAL_CALL SfxScriptLibrary::isLibraryElementValid( ::com::sun::star::uno::An
++ , mbVBA( sal_False )
++{
++}
++
++IMPLEMENT_FORWARD_XINTERFACE2( SfxScriptLibrary, SfxLibrary, SfxScriptLibrary_BASE );
++IMPLEMENT_FORWARD_XTYPEPROVIDER2( SfxScriptLibrary, SfxLibrary, SfxScriptLibrary_BASE );
++
++::sal_Bool SAL_CALL
++SfxScriptLibrary::getVBACompatMode() throw (RuntimeException)
++{
++ return mbVBA;
++}
++
++void SAL_CALL
++SfxScriptLibrary::setVBACompatMode( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
++{
++ mbVBA = _vbacompatmodeon;
++}
++
++// Methods
++::com::sun::star::script::ModuleInfo SAL_CALL
++SfxScriptLibrary::getModuleInfo( const ::rtl::OUString& ModuleName ) throw (RuntimeException)
++{
++ ::com::sun::star::script::ModuleInfo mInfo;
++ NameToInfoHash::iterator it_end = hBasicInfo.end();
++ NameToInfoHash::iterator it = hBasicInfo.find( ModuleName );
++ if ( it != it_end )
++ mInfo = it->second;
++
++ return mInfo;
++}
++
++void SAL_CALL
++SfxScriptLibrary::replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
++ throw(::com::sun::star::lang::IllegalArgumentException,
++ ::com::sun::star::container::NoSuchElementException,
++ ::com::sun::star::lang::WrappedTargetException,
++ ::com::sun::star::uno::RuntimeException)
+ {
++ SfxLibrary::replaceByName( aName, aElement );
+ }
+
++// Methods XNameContainer
++void SAL_CALL
++SfxScriptLibrary::insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
++ throw(::com::sun::star::lang::IllegalArgumentException,
++ ::com::sun::star::container::ElementExistException,
++ ::com::sun::star::lang::WrappedTargetException,
++ ::com::sun::star::uno::RuntimeException)
++{
++ OSL_TRACE("***** insertByName module %s", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr() );
++
++ NameToInfoHash::iterator it_end = hBasicInfo.end();
++ NameToInfoHash::iterator it = hBasicInfo.find( aName );
++
++ if ( it != it_end )
++ throw ElementExistException(); // more detail please
++
++ ModuleInfo mInfo;
++ if ( aElement >>= mInfo )
++ {
++ hBasicInfo[ aName ] = mInfo;
++ uno::Any aTmpElement( mInfo.ModuleSource );
++ SfxLibrary::insertByName( aName, aTmpElement );
++ }
++ else
++ SfxLibrary::insertByName( aName, aElement );
++}
++
++void SAL_CALL
++SfxScriptLibrary::removeByName( const ::rtl::OUString& Name )
++ throw(::com::sun::star::container::NoSuchElementException,
++ ::com::sun::star::lang::WrappedTargetException,
++ ::com::sun::star::uno::RuntimeException)
++{
++ SfxLibrary::removeByName( Name );
++}
++
++
+ // Provide modify state including resources
+ sal_Bool SfxScriptLibrary::isModified( void )
+ {
+@@ -1188,7 +1270,195 @@ bool SAL_CALL SfxScriptLibrary::isLibrar
{
return SfxScriptLibrary::containsValidModule( aElement );
}
+typedef ::cppu::WeakImplHelper3< container::XNameAccess, lang::XInitialization, lang::XServiceInfo > ReadOnlyCodeNames_BASE;
-+
+
+// XNameAccess, codename to/from objectnames
+class PersistedReadOnlyCodeNames : ReadOnlyCodeNames_BASE
+{
+typedef std::hash_map< rtl::OUString, rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > CodeNameHash;
-
++
+ CodeNameHash mCodeNameToObjectNames;
+public:
+ PersistedReadOnlyCodeNames()
@@ -759,6 +1284,7 @@
+
+void SfxScriptLibraryContainer::convertLibraryEntries()
+{
++/*
+ if ( getVBACompatModeOn() )
+ {
+ // going from non-vba to vba
@@ -778,10 +1304,62 @@
+ ConvertEntryFromVbaEntry convertor;
+ bool bRes = pImplLib ? pImplLib->convertContainer( getCppuType( ( const rtl::OUString*) NULL ), convertor ) : false;
+ }
++*/
+}
//============================================================================
} // namespace basic
+diff --git offapi/com/sun/star/script/XVBACompat.idl offapi/com/sun/star/script/XBasicLibraryInfo.idl
+similarity index 87%
+rename from offapi/com/sun/star/script/XVBACompat.idl
+rename to offapi/com/sun/star/script/XBasicLibraryInfo.idl
+index e1b2d28..647d530 100644
+--- offapi/com/sun/star/script/XVBACompat.idl
++++ offapi/com/sun/star/script/XBasicLibraryInfo.idl
+@@ -27,22 +27,26 @@
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+-#ifndef __com_sun_star_script_XVBACompat_idl__
+-#define __com_sun_star_script_XVBACompat_idl__
++#ifndef __com_sun_star_script_XBasicLibraryInfo_idl__
++#define __com_sun_star_script_XBasicLibraryInfo_idl__
+
+ #ifndef __com_sun_star_uno_XInterface_idl__
+ #include <com/sun/star/uno/XInterface.idl>
+ #endif
++#ifndef __com_sun_star_script_ModuleInfo_idl__
++#include <com/sun/star/script/ModuleInfo.idl>
++#endif
+
+ //=============================================================================
+
+ module com { module sun { module star { module script {
+
+-interface XVBACompat: com::sun::star::uno::XInterface
++interface XBasicLibraryInfo: com::sun::star::uno::XInterface
+ {
+
+ //=============================================================================
+- [attribute ] boolean VBACompatModeOn;
++ [attribute ] boolean VBACompatMode;
++ ModuleInfo getModuleInfo( [in] string ModuleName );
+
+ }; }; }; };
+ };
+diff --git offapi/com/sun/star/script/makefile.mk offapi/com/sun/star/script/makefile.mk
+index 9837104..4004c07 100644
+--- offapi/com/sun/star/script/makefile.mk
++++ offapi/com/sun/star/script/makefile.mk
+@@ -52,7 +52,7 @@ IDLFILES=\
+ XPersistentLibraryContainer.idl\
+ XStorageBasedLibraryContainer.idl\
+ XLibraryQueryExecutable.idl \
+- XVBACompat.idl\
++ XBasicLibraryInfo.idl\
+ ModuleSizeExceededRequest.idl\
+
+ # ------------------------------------------------------------------
diff --git sc/inc/document.hxx sc/inc/document.hxx
index 35fd858..8b608f1 100644
--- sc/inc/document.hxx
@@ -812,10 +1390,10 @@
GetServiceManager() const { return xServiceManager; }
diff --git sc/source/core/data/documen2.cxx sc/source/core/data/documen2.cxx
-index 7bd7a09..a9bda22 100644
+index aa0bafd..e867e99 100644
--- sc/source/core/data/documen2.cxx
+++ sc/source/core/data/documen2.cxx
-@@ -263,6 +263,7 @@ ScDocument::ScDocument( ScDocumentMode eMode,
+@@ -263,6 +263,7 @@ ScDocument::ScDocument( ScDocumentMode e
aTrackTimer.SetTimeoutHdl( LINK( this, ScDocument, TrackTimeHdl ) );
aTrackTimer.SetTimeout( 100 );
@@ -837,7 +1415,7 @@
struct ScDefaultAttr
{
-@@ -4485,5 +4488,30 @@ BOOL ScDocument::NeedPageResetAfterTab( SCTAB nTab ) const
+@@ -4485,5 +4488,30 @@ BOOL ScDocument::NeedPageResetAfterTab(
return FALSE; // sonst nicht
}
@@ -872,7 +1450,7 @@
index c56f867..a7b3c40 100644
--- sc/source/filter/xml/xmlsubti.cxx
+++ sc/source/filter/xml/xmlsubti.cxx
-@@ -220,6 +220,7 @@ void ScMyTables::NewSheet(const rtl::OUString& sTableName, const rtl::OUString&
+@@ -220,6 +220,7 @@ void ScMyTables::NewSheet(const rtl::OUS
uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
if ( xIndex.is() )
{
@@ -880,7 +1458,7 @@
xCurrentSheet.set(xIndex->getByIndex(nCurrentSheet), uno::UNO_QUERY);
if ( xCurrentSheet.is() )
{
-@@ -246,6 +247,27 @@ void ScMyTables::NewSheet(const rtl::OUString& sTableName, const rtl::OUString&
+@@ -246,6 +247,27 @@ void ScMyTables::NewSheet(const rtl::OUS
}
}
}
@@ -935,7 +1513,7 @@
void ScDocShell::AfterXMLLoading(sal_Bool bRet)
{
if (GetCreateMode() != SFX_CREATE_MODE_ORGANIZER)
-@@ -372,8 +381,32 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
+@@ -372,8 +381,32 @@ void ScDocShell::AfterXMLLoading(sal_Boo
// suppress VBA events when loading the xml
uno::Reference< document::XVbaEventsHelper > xEvt( aDocument.GetVbaEventsHelper() );
@@ -972,7 +1550,7 @@
index a315af0..b4d0bd9 100644
--- sc/source/ui/vba/vbaeventshelper.cxx
+++ sc/source/ui/vba/vbaeventshelper.cxx
-@@ -620,7 +620,7 @@ String ScVbaEventsHelper::getSheetModuleName( SCTAB nTab )
+@@ -620,7 +620,7 @@ String ScVbaEventsHelper::getSheetModule
{
ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
String aCodeName;
@@ -982,31 +1560,176 @@
if ( pExtOptions )
aCodeName = pExtOptions->GetCodeName( nTab );
diff --git svx/source/msfilter/svxmsbas.cxx svx/source/msfilter/svxmsbas.cxx
-index b00e19c..26b8ca1 100644
+index b00e19c..cde45f7 100644
--- svx/source/msfilter/svxmsbas.cxx
+++ svx/source/msfilter/svxmsbas.cxx
@@ -54,6 +54,8 @@ using namespace com::sun::star::awt;
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/XVBACompat.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
+
using namespace com::sun::star::container;
using namespace com::sun::star::script;
using namespace com::sun::star::uno;
-@@ -272,7 +274,11 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
+@@ -272,7 +274,11 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
Reference< container::XNameAccess > xVBAObjectForCodeName;
if ( !bAsComment )
{
- rDocSh.GetBasic()->SetVBAEnabled( true );
-+ Reference< XVBACompat > xCompat( xLibContainer, UNO_QUERY );
-+ if( xCompat.is() )
-+ xCompat->setVBACompatModeOn( sal_True );
++ Reference< XBasicLibraryInfo > xInfo( xLib, UNO_QUERY );
++ if( xInfo.is() )
++ xInfo->setVBACompatMode( sal_True );
+ else
+ rDocSh.GetBasic()->SetVBAEnabled( true );
Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
if ( xSF.is() )
{
+diff --git toolkit/inc/toolkit/controls/dialogcontrol.hxx toolkit/inc/toolkit/controls/dialogcontrol.hxx
+index 0180ddd..e8f0005 100644
+--- toolkit/inc/toolkit/controls/dialogcontrol.hxx
++++ toolkit/inc/toolkit/controls/dialogcontrol.hxx
+@@ -41,8 +41,6 @@
+ #include <com/sun/star/beans/XPropertyChangeListener.hpp>
+ #include <com/sun/star/awt/XDialog.hpp>
+ #include <com/sun/star/resource/XStringResourceResolver.hpp>
+-#include <com/sun/star/script/XVBACompat.hpp>
+-#include <cppuhelper/implbase7.hxx>
+ #include <cppuhelper/implbase6.hxx>
+ #include <cppuhelper/implbase5.hxx>
+ #include <toolkit/helper/listenermultiplexer.hxx>
+@@ -60,13 +58,12 @@
+ // class UnoControlDialogModel
+ // ----------------------------------------------------
+ typedef UnoControlModel UnoControlDialogModel_Base;
+-typedef ::cppu::ImplHelper7 < ::com::sun::star::lang::XMultiServiceFactory
++typedef ::cppu::ImplHelper6 < ::com::sun::star::lang::XMultiServiceFactory
+ , ::com::sun::star::container::XContainer
+ , ::com::sun::star::container::XNameContainer
+ , ::com::sun::star::awt::XTabControllerModel
+ , ::com::sun::star::util::XChangesNotifier
+ , ::com::sun::star::beans::XPropertyChangeListener
+- , ::com::sun::star::script::XVBACompat
+ > UnoControlDialogModel_IBase;
+
+ class UnoControlDialogModel : public UnoControlDialogModel_IBase
+@@ -179,10 +176,6 @@ public:
+ using cppu::OPropertySetHelper::disposing;
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& evt ) throw (::com::sun::star::uno::RuntimeException);
+
+- // XVBACompat
+- virtual ::sal_Bool SAL_CALL getVBACompatModeOn() throw (::com::sun::star::uno::RuntimeException);
+- virtual void SAL_CALL setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
+-
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlDialogModel,UnoControlDialogModel_Base, szServiceName2_UnoControlDialogModel )
+
+@@ -203,7 +196,6 @@ private:
+ ModelGroup*& rpCurrentGroup );
+ void AddRadioButtonGroup (
+ ::std::map< ::rtl::OUString, ModelGroup >& pNamedGroups );
+- sal_Bool mbVBAMode;
+ };
+
+ // ----------------------------------------------------
+diff --git toolkit/inc/toolkit/helper/property.hxx toolkit/inc/toolkit/helper/property.hxx
+index db61c94..1abcda6 100644
+--- toolkit/inc/toolkit/helper/property.hxx
++++ toolkit/inc/toolkit/helper/property.hxx
+@@ -190,6 +190,7 @@ namespace rtl {
+ #define BASEPROPERTY_CUSTOMUNITTEXT 136 // ::rtl::OUString
+ #define BASEPROPERTY_ENABLEVISIBLE 137 // sal_Bool
+ #define BASEPROPERTY_GROUPNAME 138 // ::rtl::OUString
++#define BASEPROPERTY_VBAFORM 139 // sal_Bool
+
+ // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
+ #define BASEPROPERTY_FONTDESCRIPTORPART_START 1000
+diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
+index a8a5c19..f976562 100644
+--- toolkit/source/controls/dialogcontrol.cxx
++++ toolkit/source/controls/dialogcontrol.cxx
+@@ -268,7 +268,7 @@ static const ::rtl::OUString& getStepPro
+ UnoControlDialogModel::UnoControlDialogModel()
+ :maContainerListeners( *this )
+ ,maChangeListeners ( GetMutex() )
+- ,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false ), mbVBAMode( sal_False )
++ ,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
+ {
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ // ImplRegisterProperty( BASEPROPERTY_BORDER );
+@@ -290,6 +290,8 @@ UnoControlDialogModel::UnoControlDialogM
+ aBool <<= (sal_Bool) sal_True;
+ ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
+ ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
++ aBool <<= (sal_Bool) sal_False;
++ ImplRegisterProperty( BASEPROPERTY_VBAFORM, aBool );
+ }
+
+ UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
+@@ -297,7 +299,7 @@ UnoControlDialogModel::UnoControlDialogM
+ , UnoControlDialogModel_Base( rModel )
+ , maContainerListeners( *this )
+ , maChangeListeners ( GetMutex() )
+- , mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false ), mbVBAMode( rModel.mbVBAMode )
++ , mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
+ {
+ }
+
+@@ -313,18 +315,6 @@ Any UnoControlDialogModel::queryAggregat
+ return (aRet.hasValue() ? aRet : UnoControlDialogModel_Base::queryAggregation( rType ));
+ }
+
+-::sal_Bool SAL_CALL
+-UnoControlDialogModel::getVBACompatModeOn() throw (RuntimeException)
+-{
+- return mbVBAMode;
+-}
+-
+-void SAL_CALL
+-UnoControlDialogModel::setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
+-{
+- mbVBAMode = _vbacompatmodeon;
+-}
+-
+ // XTypeProvider
+ IMPL_IMPLEMENTATION_ID( UnoControlDialogModel )
+ Sequence< Type > UnoControlDialogModel::getTypes() throw(RuntimeException)
+@@ -1491,8 +1481,19 @@ void UnoDialogControl::ImplSetPosSize( R
+ // Currentley we are simply using MAP_APPFONT ( for normal Dialogs )
+ // and MAP_100TH_MM for imported Userforms
+ MapMode aMode( MAP_APPFONT );
+- Reference< script::XVBACompat > xVBA( getModel(), UNO_QUERY );
+- if ( xVBA.is() && xVBA->getVBACompatModeOn() )
++ sal_Bool bVBAForm = sal_False;
++ Reference< XPropertySet > xDlgModelProps( getModel(), UNO_QUERY );
++ if ( xDlgModelProps.is() )
++ {
++ try
++ {
++ xDlgModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAForm" ) ) ) >>= bVBAForm;
++ }
++ catch( Exception& )
++ {
++ }
++ }
++ if ( bVBAForm )
+ aMode = MapMode( MAP_100TH_MM );
+ OutputDevice*pOutDev = Application::GetDefaultDevice();
+ if ( pOutDev )
+diff --git toolkit/source/helper/property.cxx toolkit/source/helper/property.cxx
+index a7fc25b..8d1ee74 100644
+--- toolkit/source/helper/property.cxx
++++ toolkit/source/helper/property.cxx
+@@ -271,7 +271,8 @@ ImplPropertyInfo* ImplGetPropertyInfos(
+ DECL_PROP_2 ( "InvokesStopNodeEditing", TREE_INVOKESSTOPNODEEDITING, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DialogSourceURL", DIALOGSOURCEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+- DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT )
++ DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ),
++ DECL_PROP_2 ( "VBAForm", VBAFORM, sal_Bool, BOUND, MAYBEDEFAULT ),
+ };
+ pPropertyInfos = aImplPropertyInfos;
+ nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
diff --git xmlscript/inc/xmlscript/xmllib_imexp.hxx xmlscript/inc/xmlscript/xmllib_imexp.hxx
index 9a3048f..93826a9 100644
--- xmlscript/inc/xmlscript/xmllib_imexp.hxx
@@ -1062,13 +1785,82 @@
void
SAL_CALL exportLibrary(
+diff --git xmlscript/source/xmldlg_imexp/imp_share.hxx xmlscript/source/xmldlg_imexp/imp_share.hxx
+index bf3ea5f..cda47ef 100644
+--- xmlscript/source/xmldlg_imexp/imp_share.hxx
++++ xmlscript/source/xmldlg_imexp/imp_share.hxx
+@@ -45,7 +45,7 @@
+ #include <com/sun/star/awt/FontEmphasisMark.hpp>
+ #include <com/sun/star/awt/FontRelief.hpp>
+ #include <com/sun/star/xml/input/XRoot.hpp>
+-#include <com/sun/star/script/XLibraryContainer.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
+ #include <vector>
+
+
+@@ -133,7 +133,6 @@ struct DialogImport
+ css::uno::Reference< css::container::XNameContainer > _xDialogModel;
+ css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
+ css::uno::Reference< css::frame::XModel > _xDoc;
+- css::uno::Reference< css::script::XLibraryContainer > _xScriptLibraryContainer;
+
+ sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
+
+@@ -180,7 +179,7 @@ public:
+
+ inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
+
+- css::uno::Reference< css::script::XLibraryContainer > getScriptLibraryContainer();
++ css::uno::Reference< css::script::XBasicLibraryInfo > getScriptLibraryInfo();
+ // XRoot
+ virtual void SAL_CALL startDocument(
+ css::uno::Reference< css::xml::input::XNamespaceMapping >
+diff --git xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+index 92c1a09..f513ecf 100644
+--- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
++++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+@@ -41,7 +41,7 @@
+ #include <com/sun/star/beans/XPropertyState.hpp>
+ #include <com/sun/star/document/XStorageBasedDocument.hpp>
+ #include <com/sun/star/document/XGraphicObjectResolver.hpp>
+-#include <com/sun/star/script/XVBACompat.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
+
+ #include <comphelper/componentcontext.hxx>
+ #include <comphelper/processfactory.hxx>
+@@ -150,10 +150,10 @@ void importBindableAndListRangeBits( Dia
+ sal_Bool isVBACompatModeOn( DialogImport* _pImport )
+ {
+ sal_Bool bVBAMode = sal_False;
+- Reference< script::XVBACompat > xVBACompat( _pImport->getScriptLibraryContainer(), UNO_QUERY );
+- if( xVBACompat.is() )
++ Reference< script::XBasicLibraryInfo > xVBAInfo( _pImport->getScriptLibraryInfo(), UNO_QUERY );
++ if( xVBAInfo.is() )
+ {
+- bVBAMode = xVBACompat->getVBACompatModeOn();
++ bVBAMode = xVBAInfo->getVBACompatMode();
+ }
+ return bVBAMode;
+ }
diff --git xmlscript/source/xmldlg_imexp/xmldlg_import.cxx xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-index 5548016..f739361 100644
+index 5548016..97e852a 100644
--- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-@@ -1880,22 +1880,22 @@ Reference< xml::input::XElement > DialogImport::getStyle(
+@@ -61,7 +61,7 @@
+ #include <com/sun/star/view/SelectionType.hpp>
+ #include <com/sun/star/document/XStorageBasedDocument.hpp>
+ #include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
+-#include <com/sun/star/script/XVBACompat.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
+
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+@@ -1878,24 +1878,32 @@ Reference< xml::input::XElement > Dialog
+ return 0;
+ }
//__________________________________________________________________________________________________
- Reference< script::XLibraryContainer > DialogImport::getScriptLibraryContainer()
+-Reference< script::XLibraryContainer > DialogImport::getScriptLibraryContainer()
++Reference< script::XBasicLibraryInfo > DialogImport::getScriptLibraryInfo()
{
- if( !_xScriptLibraryContainer.is() )
- {
@@ -1086,7 +1878,9 @@
- }
-
- return _xScriptLibraryContainer;
-+ Reference< script::XLibraryContainer > xLib;
++ // #FIXME this is a hack, we should know about the library that
++ // 'owns' the dialog ( in order to determine it's vba mode )
++ Reference< script::XBasicLibraryInfo > xLib;
+ if ( _xDoc.is() )
+ {
+ Reference< beans::XPropertySet > xProps( _xDoc, UNO_QUERY );
@@ -1094,7 +1888,13 @@
+ {
+ try
+ {
-+ xProps->getPropertyValue( OUSTR("BasicLibraries") ) >>= xLib;
++ Reference< container::XNameAccess > xLibContainer;
++ xProps->getPropertyValue( OUSTR("BasicLibraries") ) >>= xLibContainer;
++ if ( xLibContainer.is() )
++ {
++ xLibContainer->getByName( OUSTR("Standard") ) >>= xLib;
++ }
++
+ }
+ catch( Exception& )
+ {
@@ -1105,21 +1905,36 @@
}
//##################################################################################################
-@@ -1911,6 +1911,9 @@ Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
- uno::Reference< script::XVBACompat > xVBAModeSource( pImport->getScriptLibraryContainer(), uno::UNO_QUERY );
-
- uno::Reference< script::XVBACompat > xVBAModeDest( xDialogModel, uno::UNO_QUERY );
-+ bool bOn = false;
-+ if ( xVBAModeSource.is() )
-+ bOn = xVBAModeSource->getVBACompatModeOn();
- if ( xVBAModeSource.is() && xVBAModeDest.is() )
- xVBAModeDest->setVBACompatModeOn( xVBAModeSource->getVBACompatModeOn() );
+@@ -1908,11 +1916,19 @@ Reference< xml::sax::XDocumentHandler >
+ SAL_THROW( (Exception) )
+ {
+ DialogImport* pImport = new DialogImport( xContext, xDialogModel, xDocument );
+- uno::Reference< script::XVBACompat > xVBAModeSource( pImport->getScriptLibraryContainer(), uno::UNO_QUERY );
+-
+- uno::Reference< script::XVBACompat > xVBAModeDest( xDialogModel, uno::UNO_QUERY );
+- if ( xVBAModeSource.is() && xVBAModeDest.is() )
+- xVBAModeDest->setVBACompatModeOn( xVBAModeSource->getVBACompatModeOn() );
++ uno::Reference< script::XBasicLibraryInfo > xVBAModeSource( pImport->getScriptLibraryInfo(), uno::UNO_QUERY );
++ uno::Reference< beans::XPropertySet > xDlgProps( xDialogModel, uno::UNO_QUERY );
++ OSL_TRACE("importDialogModel xVBAModeSource %d, xDialogModel %d", xVBAModeSource.is(), xDlgProps.is() );
++ if ( xVBAModeSource.is() && xVBAModeSource->getVBACompatMode() && xDlgProps.is() )
++ {
++ try
++ {
++ xDlgProps->setPropertyValue( OUSTR("VBAForm"), uno::makeAny( sal_True ) );
++ }
++ catch( Exception& )
++ {
++ }
++ }
return ::xmlscript::createDocumentHandler(
+ static_cast< xml::input::XRoot * >( pImport ) );
+ }
diff --git xmlscript/source/xmllib_imexp/imp_share.hxx xmlscript/source/xmllib_imexp/imp_share.hxx
index d602103..fdc0536 100644
--- xmlscript/source/xmllib_imexp/imp_share.hxx
+++ xmlscript/source/xmllib_imexp/imp_share.hxx
-@@ -220,7 +220,6 @@ class LibrariesElement : public LibElementBase
+@@ -220,7 +220,6 @@ class LibrariesElement : public LibEleme
protected:
vector< LibDescriptor > mLibDescriptors;
@@ -1127,7 +1942,7 @@
public:
virtual Reference< xml::input::XElement > SAL_CALL startChildElement(
sal_Int32 nUid, OUString const & rLocalName,
-@@ -244,7 +243,7 @@ class LibraryElement : public LibElementBase
+@@ -244,7 +243,7 @@ class LibraryElement : public LibElement
{
protected:
vector< OUString > mElements;
@@ -1252,7 +2067,7 @@
//__________________________________________________________________________________________________
Reference< xml::input::XElement > LibElementBase::getParent()
throw (RuntimeException)
-@@ -206,7 +219,11 @@ Reference< xml::input::XElement > LibraryImport::startRootElement(
+@@ -206,7 +219,11 @@ Reference< xml::input::XElement > Librar
&aDesc.bPreload,
OUString( RTL_CONSTASCII_USTRINGPARAM("preload") ),
xAttributes, XMLNS_LIBRARY_UID );
@@ -1265,7 +2080,7 @@
return new LibraryElement( rLocalName, xAttributes, 0, this );
}
else
-@@ -265,7 +282,10 @@ Reference< xml::input::XElement > LibrariesElement::startChildElement(
+@@ -265,7 +282,10 @@ Reference< xml::input::XElement > Librar
&aDesc.bPasswordProtected,
OUString( RTL_CONSTASCII_USTRINGPARAM("passwordprotected") ),
xAttributes, _pImport->XMLNS_LIBRARY_UID );
@@ -1277,7 +2092,7 @@
mLibDescriptors.push_back( aDesc );
return new LibraryElement( rLocalName, xAttributes, this, _pImport );
}
-@@ -312,6 +332,17 @@ Reference< xml::input::XElement > LibraryElement::startChildElement(
+@@ -312,6 +332,17 @@ Reference< xml::input::XElement > Librar
if (aValue.getLength())
mElements.push_back( aValue );
@@ -1303,7 +2118,7 @@
}
-@@ -348,6 +380,15 @@ SAL_CALL importLibraryContainer( LibDescriptorArray* pLibArray )
+@@ -348,6 +380,15 @@ SAL_CALL importLibraryContainer( LibDesc
static_cast< xml::input::XRoot * >( new LibraryImport( pLibArray ) ) );
}
@@ -1319,7 +2134,7 @@
//##################################################################################################
::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >
-@@ -360,6 +401,13 @@ SAL_CALL importLibrary( LibDescriptor& rLib )
+@@ -360,6 +401,13 @@ SAL_CALL importLibrary( LibDescriptor& r
//##################################################################################################
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]